Sprite2d

open class Sprite2d

Base class for a 2d object. Includes position, scale, rotation, and flat-shaded color.

Constructors

Link copied to clipboard
constructor(drawable: Drawable2d)

Functions

Link copied to clipboard
open fun draw(program: FlatShadedProgram, projectionMatrix: Array<Float>)
open fun draw(program: Texture2dProgram, projectionMatrix: Array<Float>)
Draws the rectangle with the supplied program and projection matrix.
Link copied to clipboard
open fun getColor(): Array<Float>
Returns the color.
Link copied to clipboard
Returns the model-view matrix.
Link copied to clipboard
open fun getPositionX(): Float
Returns the position on the X axis.
Link copied to clipboard
open fun getPositionY(): Float
Returns the position on the Y axis.
Link copied to clipboard
open fun getRotation(): Float
Gets the sprite rotation angle, in degrees.
Link copied to clipboard
open fun getScaleX(): Float
Returns the sprite scale along the X axis.
Link copied to clipboard
open fun getScaleY(): Float
Returns the sprite scale along the Y axis.
Link copied to clipboard
open fun setColor(red: Float, green: Float, blue: Float)
Sets color to use for flat-shaded rendering.
Link copied to clipboard
open fun setPosition(posX: Float, posY: Float)
Sets the sprite position.
Link copied to clipboard
open fun setRotation(angle: Float)
Sets the sprite rotation angle, in degrees.
Link copied to clipboard
open fun setScale(scaleX: Float, scaleY: Float)
Sets the sprite scale (size).
Link copied to clipboard
open fun setTexture(textureId: Int)
Sets texture to use for textured rendering.
Link copied to clipboard
open fun toString(): String