FlxGraphics
Stable renderer-neutral vector drawing object.
Commands are tessellated per camera only when the revision changes. Use a mesh for shapes whose geometry changes every frame.
export declare class FlxGraphics extends FlxSpriteConstructors
constructor(x?: number, y?: number, width?: number, height?: number)Constructs a new instance of the FlxGraphics class
| Parameter | Type | Description |
|---|---|---|
x | number | - |
y | number | - |
width | number | - |
height | number | - |
Properties
| Property | Modifiers | Type | Description |
|---|---|---|---|
commandCount | readonly | number | Number of retained drawing commands. |
graphicsRevision | readonly | number | Monotonic version consumed by camera adapters. |
Methods
circle()
circle(x: number, y: number, radius: number, style: FlxGraphicsStyle): thisAppend a filled and/or stroked circle.
Parameters:
| Parameter | Type | Description |
|---|---|---|
x | number | - |
y | number | - |
radius | number | - |
style | FlxGraphicsStyle | - |
Returns: this
clearGraphics()
clearGraphics(): thisRemove every retained command and publish one rebuild revision.
Returns: this
createRenderHandle()
createRenderHandle(): FlxRenderHandleReturns: FlxRenderHandle
ellipse()
ellipse(x: number, y: number, radiusX: number, radiusY: number, style: FlxGraphicsStyle): thisAppend a filled and/or stroked ellipse.
Parameters:
| Parameter | Type | Description |
|---|---|---|
x | number | - |
y | number | - |
radiusX | number | - |
radiusY | number | - |
style | FlxGraphicsStyle | - |
Returns: this
line()
line(points: ArrayLike<number>, stroke: FlxGraphicsStroke): thisAppend an open stroked polyline from local x/y pairs.
Parameters:
| Parameter | Type | Description |
|---|---|---|
points | ArrayLike<number> | - |
stroke | FlxGraphicsStroke | - |
Returns: this
onScreen()
onScreen(camera?: FlxCameraLike): booleanParameters:
| Parameter | Type | Description |
|---|---|---|
camera | FlxCameraLike | - |
Returns: boolean
polygon()
polygon(points: ArrayLike<number>, style: FlxGraphicsStyle): thisAppend a closed polygon from local x/y pairs.
Parameters:
| Parameter | Type | Description |
|---|---|---|
points | ArrayLike<number> | - |
style | FlxGraphicsStyle | - |
Returns: this
rect()
rect(x: number, y: number, width: number, height: number, style: FlxGraphicsStyle): thisAppend a filled and/or stroked rectangle.
Parameters:
| Parameter | Type | Description |
|---|---|---|
x | number | - |
y | number | - |
width | number | - |
height | number | - |
style | FlxGraphicsStyle | - |
Returns: this
roundRect()
roundRect(x: number, y: number, width: number, height: number, radius: number, style: FlxGraphicsStyle): thisAppend a filled and/or stroked rounded rectangle.
Parameters:
| Parameter | Type | Description |
|---|---|---|
x | number | - |
y | number | - |
width | number | - |
height | number | - |
radius | number | - |
style | FlxGraphicsStyle | - |
Returns: this
star()
star(x: number, y: number, points: number, radius: number, innerRadius: number, style: FlxGraphicsStyle, rotation?: number): thisAppend a filled and/or stroked regular star.
Parameters:
| Parameter | Type | Description |
|---|---|---|
x | number | - |
y | number | - |
points | number | - |
radius | number | - |
innerRadius | number | - |
style | FlxGraphicsStyle | - |
rotation | number | - |
Returns: this