raylib/textures
src/raylib/textures.tur
defn
load-texture
(load-texture [path :cstr] :int)
load a texture from an image file into GPU memory.
Parameters
| path | filesystem path to an image (PNG, JPG, BMP, TGA, ...) |
Returns
Opaque :int handle to a heap-allocated Texture2D struct.
Example
(let [tex (load-texture "player.png")] ...)
Since: P3
defn
unload-texture
(unload-texture [tex :int] :void)
free a texture from GPU memory.
Parameters
| tex | Texture2D handle from load-texture |
Example
(unload-texture tex)
Since: P3
defn
draw-texture
(draw-texture [tex :int x :int y :int tint :int] :void)
draw a texture at integer pixel coordinates.
Parameters
| tex | Texture2D handle | |
| x | left edge (pixels) | |
| y | top edge (pixels) | |
| tint | Color handle (use white for no tint) |
Example
(draw-texture tex 100 200 (white))
Since: P3
defn
draw-texture-v
(draw-texture-v [tex :int pos :int tint :int] :void)
draw a texture at a Vector2 handle position.
Parameters
| tex | Texture2D handle | |
| pos | Vector2 position handle | |
| tint | Color handle |
Example
(draw-texture-v tex pos (white))
Since: P3
defn
draw-texture-ex
(draw-texture-ex [tex :int pos :int rotation :float scale :float tint :int] :void)
draw a texture with rotation and scale.
Parameters
| tex | Texture2D handle | |
| pos | Vector2 position handle (top-left origin before rotation) | |
| rotation | rotation in degrees | |
| scale | uniform scale factor (1.0 = original size) | |
| tint | Color handle |
Example
(draw-texture-ex tex pos 45.0 2.0 (white))
Since: P3