class Texture (client-side)
Available since version: 0.3.0
Constructor
Texture.new(int x, int y, int width, int height, string file)
Parameters:
intx: X position (virtual units).inty: Y position (virtual units).intwidth: Width (virtual units).intheight: Height (virtual units).stringfile: Texture file path.
Properties
{x, y} position
Gets or sets the texture position in virtual screen units.
{x, y} positionPx
Gets or sets the texture position in pixel coordinates.
{width, height} size
Gets or sets the texture size in virtual screen units.
{width, height} sizePx
Gets or sets the texture size in pixel coordinates.
{x, y, width, height} rect
Gets or sets the texture rectangle in virtual screen units.
{x, y, width, height} rectPx
Gets or sets the texture rectangle in pixel coordinates.
{r, g, b} color
Gets or sets the texture color.
int alpha
Gets or sets the texture alpha (opacity).
bool visible
Gets or sets whether the texture is rendered.
string file
Gets or sets the texture file path.
Methods
setPosition
Sets the texture position in virtual screen units.
void setPosition(int x, int y)
Parameters:
intx: X position (virtual units).inty: Y position (virtual units).
getPosition
Returns the texture position in virtual screen units.
{x, y} getPosition()
Returns {x, y}:
Table containing x and y (virtual units).
setPositionPx
Sets the texture position in pixel coordinates.
void setPositionPx(int x, int y)
Parameters:
intx: X position (pixels).inty: Y position (pixels).
getPositionPx
Returns the texture position in pixel coordinates.
{x, y} getPositionPx()
Returns {x, y}:
Table containing x and y (pixels).
setSize
Sets the texture size in virtual screen units.
void setSize(int width, int height)
Parameters:
intwidth: Width (virtual units).intheight: Height (virtual units).
getSize
Returns the texture size in virtual screen units.
{width, height} getSize()
Returns {width, height}:
Table containing width and height (virtual units).
setSizePx
Sets the texture size in pixel coordinates.
void setSizePx(int width, int height)
Parameters:
intwidth: Width (pixels).intheight: Height (pixels).
getSizePx
Returns the texture size in pixel coordinates.
{width, height} getSizePx()
Returns {width, height}:
Table containing width and height (pixels).
setRect
Sets the texture rectangle in virtual screen units.
void setRect(int x, int y, int width, int height)
Parameters:
intx: X position (virtual units).inty: Y position (virtual units).intwidth: Width (virtual units).intheight: Height (virtual units).
getRect
Returns the texture rectangle in virtual screen units.
{x, y, width, height} getRect()
Returns {x, y, width, height}:
Table containing x,y,width,height (virtual units).
setRectPx
Sets the texture rectangle in pixel coordinates.
void setRectPx(int x, int y, int width, int height)
Parameters:
intx: X position (pixels).inty: Y position (pixels).intwidth: Width (pixels).intheight: Height (pixels).
getRectPx
Returns the texture rectangle in pixel coordinates.
{x, y, width, height} getRectPx()
Returns {x, y, width, height}:
Table containing x,y,width,height (pixels).
setColor
Sets the texture color.
void setColor(int r, int g, int b)
Parameters:
intr: Red component (0-255).intg: Green component (0-255).intb: Blue component (0-255).
getColor
Returns the texture color.
{r, g, b} getColor()
Returns {r, g, b}:
Table containing r,g,b (0-255).
setAlpha
Sets the texture alpha (opacity).
void setAlpha(int alpha)
Parameters:
intalpha: Opacity value (0-255).
getAlpha
Returns the texture alpha (opacity).
int getAlpha()
Returns int:
Opacity value (0-255).
setFile
Sets the texture file name.
void setFile(string file)
Parameters:
stringfile: Texture file name.
getFile
Returns the texture file name.
string getFile()
Returns string:
Texture file name.
setVisible
Sets whether the texture should be rendered.
void setVisible(bool visible)
Parameters:
boolvisible: True to render, false to hide.
getVisible
Returns whether the texture is visible.
bool getVisible()
Returns bool:
True if visible.
top
Moves the texture to the top of the render order.
void top()
Callbacks
No callbacks.