Renderer
Renderer
Interface for drawing to the window.
Functions
clear_background(self, color : Color)
Clear the background to the given color.
Note that this is for use within texture render mode! The actual screen is cleared on its own.
fps(self)
->number
Return the FPS the renderer is running at
set_target_fps(self, fps : number)
Set a cap for the renderer’s FPS.
load_texture(self, path : string)
->Texture
Load a texture from the given file name (relative to the assets directory, i.e.
objects/bigdoor/bigdoor.png).Note that the final output is converted to RGBA8
load_texture_from_image(self, image : Image)
->Texture
Load a texture from the given image.
Note that the final output is converted to RGBA8
load_texture_blank(self, width : number, height : number)
->Texture
Load a blank RGBA8 texture with the given width and height.
load_texture_blank_ex(self, width : number, height : number, length : number, format : TextureFormat)
->Texture
Load a blank texture with the given width and height, length of data, and format.
I kind of just absent-mindedly bound this to Lua, you probably don’t want this. ~ ioi
update_texture(self, texture : Texture, data : [number])
Upload data to the GPU, replacing the texture’s contents. MUST be a matching (width*height*pitch) array (pitch usually being 4 unless you loaded a texture with a custom format).
draw_texture(self, texture : Texture, source : Rectangle, dest : Rectangle, color : Color)
Draw a given texture to the screen.
draw_texture_opt(self, opts : TextureOptions)
Draw a given texture to the screen with the provided options.
begin_texture_render(self, texture : Texture)
Begins a “texture render mode”, in which any rendering operations after this to be drawn to texture. This lasts until you call end_texture_render.
The texture in question is pushed to a stack of textures and whichever one is at the forefront is what’s rendered to. This allows you to stack the call, and then appropriately pop the stack.
This function is also used internally to lock the game to a certain resolution, so if you forget to call end_texture_render, you will fuck up the game output.
end_texture_render(self)
End previous texture render switch and fall back to whatever was being rendered to before