Class TexAsset
Stores a texture.
See also:
Usage:
--- Creates a new texture and renders it
--- 20x20 world space units in world space
--- at 0,0
-- load the texture asset
texture = TexAsset.new(mod_path.."/wall.png")
-- world space
bounds = Rect.new(0.0, 0.0, 20.0, 20.0)
-- A hook thats ran when entites are drawn
function draw_entities ()
texture:draw(
Rect.new(0.0, 0.0, 1.0, 1.0),
bounds:to_screenspace(),
e.col
)
end
Methods
-
TexAsset.new (path)
-
Creates a new texture.
Parameters:
- path
string
The path to the texture to load
-
TexAsset:draw (src, dst, clr)
-
Draws a texture.
Parameters:
- src
Rect
The source coords, this should be between 0 and 1.
- dst
Rect
The position in screenspace to draw the texture.
- clr
Color
The color to tint the texture.