API Reference
Here you will find information on every non standard lua function the engine gives to you.
Remember miss use of certain pointers will crash the engine.
Globals
engine(pointer to the engine object that must be passed to functions that operate on that)object(pointer to the object that is running this script)delta_time(the difference between the previous frame and the current frame time)
Init Functions
All init functions can be used at runtime but they are most commonly used in the init script
setProgramName(engine, prog_name)
Arguments:
engine: An engine pinter (Most commonly use the engine global)prog_name: A string to set the program name to
This will set the prgram name to the string in prog_name
Usage: setProgramName(engine, "Blahaj Engine Demo: Top Down 2D Game")
setTargetFPS(engine, fps)
Arguments:
- engine: An engine pointere (Most commonly use the engine global)
- fps: A number to set the FPS cap to
This will set the fps cap to fps
Usage: setTargetFPS(engine, 900000)
addPipeline(engine, pipelineID, vertexShaderPath, fragmentShaderPath)
Arguments:
- engine: An engine pointer (Most commonly use the engine global)
- pipelineID: The interger ID you want to put this pipeline into
- vertexShaderPath: The string path to the vertex shader
- fragmentShaderPath: The string path to the fragment shader
This will register a new vulkan pipeline into the assigned slot with the assigned shaders
Usage: addPipeline(engine, 1, "spv/debug.vert.spv", "spv/debug.frag.spv")
addTexture(engine, textureID, texturePath)
Arguments:
- engine: An engine pointer (Most commonly use the engine global)
- textureID: The integer ID you want to put this texture into (512 max)
- texturePath: The string path to the texture
addGameObject(engine, posX, posY, posZ, rotX, rotY, rotZ, scale, pipelineID, textureID, scriptPath)
Arguments:
engine: An engine pinter (Most commonly use the engine global)posX: Self Explanatory (Float)posY: Self Explanatory (Float)posZ: Self Explanatory (Float)rotX: Self Explanatory (Float)rotY: Self Explanatory (Float)rotZ: Self Explanatory (Float)scale: Self Explanatory (Float)pipelineID: The integer ID for the pipeline this object will be rendered withtextureID: The integer ID for the texture this object will be rendered withscriptPath: The string path to the script file (can benilfor no script)
This will add a game object into the game world
Usage: addGameObject(engine, 0, 0, 0, 0, 0, 0, 0.1, 1, 1, "scripts/player.lua")
Input Functions
getKeyPressed(engine, key)
Arguments:
engine: An engine pointer (Most commonly use the engine global)key: String with single character to check (Should be capital)
Returns: true if it was pressed and false if not
getLeftMousePress(engine)
Arguments:
engine: An engine pointer (Most commonly use the engine global)
Returns:
x: X position of left mouse click in world space coordsy: Y position of left mouse click in world space coords
getRightMousePress(engine)
Arguments:
engine: An engine pointer (Most commonly use the engine global)
Returns:
x: X position of right mouse click in world space coordsy: Y position of right mouse click in world space coords
AABB2D Functions
AABB2D_intersectsAll(engine, object)
Arguments:
engine: An engine pointer (Most commonly use the engine global)object: A pointer to any object that will be checked if anything touches (Most commonly use the engine global)
Returns: true if the object intersects any object and false if it does not
AABB2D_intersectsFirst(engine, object)
Arguments:
engine: An engine pointer (Most commonly use the engine global)object: A pointer to any object that will be checked if anything touches (Most commonly use the engine global)
Returns: A pointer to the first object that intersects the object or nil if none found
Object Functions
moveGameObject(object, x, y, z)
Arguments:
object: A pointer to any object that will be checked if anything touches (Most commonly use the engine global)x: Self Explanatory (Float)y: Self Explanatory (Float)z: Self Explanatory (Float)
Camera Functions
camLookAtGameObject(engine, object)
Arguments:
engine: An engine pinter (Most commonly use the engine global)object: A pointer to any object that will be checked if anything touches (Most commonly use the engine global)
This will make the camera look at the object