package haxepunk
class Graphic
extended by BaseEmitter, BitmapText, Backdrop, Tilemap, BaseGraphicList, ColoredRect, Image, NineSlice
Base class for graphics type. Do not use this directly, instead use the classes in haxepunk.graphics.
Variables
Optional blend mode to use when drawing this image. Use constants from the haxepunk.utils.BlendMode class.
flexibleLayer : Bool
If true, this graphic may sometimes "fall through" other textures to reduce the number of draw calls. This can affect layering.
originX : Float
X origin of the graphic, determines transformation point. Defaults to top-left corner.
originY : Float
Y origin of the graphic, determines transformation point. Defaults to top-left corner.
pixelSnapping : Bool
Whether this graphic will be snapped to the nearest whole number pixel
position when rendering. If pixelSnapping is set to true
on the
Camera, snapping will occur regardless of this setting. Some graphics
like Tilemap set this to true by default.
relative : Bool
If the graphic should render at its position relative to its parent Entity's position.
scrollX : Float
X scrollfactor, effects how much the camera offsets the drawn graphic. Can be used for parallax effect, eg. Set to 0 to follow the camera, 0.5 to move at half-speed of the camera, or 1 (default) to stay still.
scrollY : Float
Y scrollfactor, effects how much the camera offsets the drawn graphic. Can be used for parallax effect, eg. Set to 0 to follow the camera, 0.5 to move at half-speed of the camera, or 1 (default) to stay still.
smooth : Bool
If the image should be drawn transformed with pixel smoothing. This will affect drawing performance, but look less pixelly.
Default value: false if HXP.stage.quality is LOW, true otherwise.
Functions
pixelPerfectRender (point : Vector2, camera : Camera) : Void
Renders the graphic, taking extra care to snap pixel locations and lengths to whole number positions. Not all graphics need a separate pixelPerfectRender implementation; by default this will just call render.
Parameters:
point | The position to draw the graphic. | |
camera | The camera offset. |