Class CCGraphicsContext

The CCGraphicsContext class is used to draw onto a surface with various transformations applied on top.

Constructors

Properties

The current context being used for drawing.

Accessors

Methods

  • Draw text at the specified point on top of existing content. This does not wrap text - any overflow will be clipped.

    Parameters

    • start: CCPoint

      The leftmost point to draw at

    • text: string

      The text to draw

    Returns void

  • Draw text at the specified point on top of existing content, using the old background color for the foreground (for drawing characters). This does not wrap text - any overflow will be clipped.

    Parameters

    • start: CCPoint

      The leftmost point to draw at

    • text: string

      The text to draw

    Returns void

  • Draw text at the specified point with a background. This does not wrap text - any overflow will be clipped.

    Parameters

    • start: CCPoint

      The leftmost point to draw at

    • text: string

      The text to draw

    • background: number

    Returns void

  • Restores the previous state of the graphics context from the stack.

    Returns void

  • Moves the origin point of the context, resizing the context.

    Parameters

    • point: CCPoint

      The point to relocate to, relative to the current origin

    Returns void

  • Repositions the context to a target rectangle, changing both origin and size.

    Parameters

    • rect: CCRect

      The rectangle to reposition to

    Returns void

  • Rescales the size of the context. This causes all future points to be scaled to fit inside this size.

    Parameters

    • size: CCSize

      The new virtual size of the context

    Returns void

  • Resizes the context without moving the origin.

    Parameters

    • size: CCSize

      The new size of the context. Resizing larger will have no effect.

    Returns void

  • Moves the virtual origin point of the context. This effectively moves the "draw window" of the context, keeping the size the same and hiding off- screen drawing.

    Parameters

    • delta: CCPoint

      The amount to move the virtual origin

    Returns void