Class "Renderer"⚓︎
Functions⚓︎
LoadImage ()⚓︎
Image LoadImage ( string filePath )⚓︎
CreateImage ()⚓︎
Image CreateImage ( integer width, integer height, string name )⚓︎
RenderToImage ()⚓︎
void RenderToImage ( Image image, function renderFunction )⚓︎
Sets the specified Image as the current render target and executes renderFunction.
All rendering operations must be performed inside renderFunction, as the previous render target is restored immediately after the function returns.
Only images created using CreateImage() or surfaces created by the game may be used as render targets.
renderFunction may take a SurfaceRenderController as it's first parameter, allowing access to additional render operations for the active render target.
Example Code
1 2 3 4 5 6 7 8 9 10 11 12 | |
GetShaderByType ()⚓︎
Shader GetShaderByType ( ShaderType shaderType )⚓︎
Returns one of the in-game shaders.
LoadShader ()⚓︎
Shader LoadShader ( string filePath, table vertexDescriptor )⚓︎
filePath should be specified without a file extension, and it must be relative to the resources/ directory.
Both a .vs and a .fs must exist in the specified location.
VertexDescriptor
VertexDescriptor is an array of tables, with each entry being a pair of [string, VertexAttributeFormat],
with string being the attribute name.
The attribute name must be the exact same as the one used in the shader.
Example Code
This code shows how color offset gold would need to be loaded if it were a custom shader.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | |