Skip to content

Latest commit

 

History

History
2148 lines (1632 loc) · 46.3 KB

File metadata and controls

2148 lines (1632 loc) · 46.3 KB

Main functions

Log

Log into the console

function engine.log(message = string) end

Warning

Log a warning into the console

function engine.warn(message = string) end

Error

Log an error into the console

function engine.error(message = string) end

To String

Transform any data type into a string and return it

function engine.to_string(object = any) end

Current data

Get the current script data (like 'this' when using a class)

function engine.current() end

External data

Get data from other go and respective script

If not finded return nil

function engine.data(goId = string, scriptName = string) end

Get Mode

Return the engine running mode in enums.ProjectModeEnum format

function engine.get_mode() end

Get FPS

Return a number with current fps

function engine.get_fps() end

Get Frame Time

Return a number with current frametime

function engine.get_frametime() end

Stop

Stop engine and exit application

function engine.stop() end

Restart

Restart application

function engine.restart() end

Is Editor focused

Return a boolean indicating if editor is focused

function engine.is_editor_focused() end

Time Module

Get Timestamp

Return a number with the timestamp in seconds since application started

function engine.time.get_timestamp() end

Get Date Time

Return a table with current date

function engine.time.get_datetime() end

The returned table format is

{
    minute = number,
    hour = number,
    second = number,
    day = number,
    month = number,
    year = number,
}

Game Object Module

Current Go

Return a number with current game object been executed

function engine.go.current() end

Create Go

Create a gameobject

Returns the id in case of success else return nil

function engine.go.create(arg = table) end

Argument table format

{
    name = string, -- optional
    active = boolean, -- optional
    father_id = number, -- the id of the father go, also optional
}

Create Copy Go

Create a copy from gameobject

If you don't need to assign a father just leave empty

Returns the id of new go in case of success

function engine.go.create_copy(goId = string, newFatherId = string) end

Destroy Go

Destroy a gameobject, pass the id by argument

Returns a boolean indicating success

function engine.go.destroy(id = number) end

Get Go

Get a gameobject, pass the id by argument

Return a table with the go information if find it, else return nil

function engine.go.get(id = number) end

Returned table format

{
    id = number,
    name = string,
    active = boolean,
    father_id = number,
    is_to_destroy = boolean, -- if the go is destroyed (eg = is going to)
    scripts = 
    {  -- array of scripts names
        {  -- array item format
            [key = number]  = [value = string]
        }
    },
    childrens = 
    { -- id array of the go childrens
        { -- array item format
             [key = number]  = [value = string]
        }
    }
}

Get All Gos By Name

Find a list of game objects that match a name

Return a list of go ids

function engine.go.find_all(goName) end

Set Go active

Update a gameobject, active property

Return a boolean indicating success

function engine.go.set_active(goId = string, active = bool) end

Set Go Name

Update a gameobject, name property

Return a boolean indicating success

function engine.go.set_name(goId = string, name = string) end

Change Go Father

Change the gameobject father

The second argument is optional, is not informed the go is set to the root

Return a boolean indicating success

function engine.go.change_father(goId = string, fatherId = string) end

Change Go Index

Change the gameobject index in relation to his brothers

The displacement argument changes the index based on the current index

function engine.go.change_index(goId = string, displacement = number) end

Load scripts immediately

Load scripts into memory in case you need to access it immediately

Normally the script of a go is loaded in the next frame and then started only in the next frame, if needed this behavior can be changed with this. With this the script will be loaded now and started in the next frame.

If fail this will trigger an internal error

function engine.go.load_scripts(goId = string) end

Persist Go

Set the current go to persist not (will not be saved)

function engine.go.set_persist_go(val = bool) end

Persist External Go

Set any go to persist or not (will not be saved)

function engine.go.set_persist_external_go(goId = string, val = bool) end

Inspect go

Force the editor to inspect a go

function engine.go.inspect_go(goId = string) end

Get inspected go

Get the inspected go by the editor, else nil

function engine.go.get_inspected_go() end

Script Module

Get Script

Get the script information from a gameobject

If not find it then return nil

function engine.script.get(goId = number, scriptName = string) end

The returned table format

{
    name = string,  -- script name
    path = string, -- loaded path
    state = string, -- state of the script, in enums.ScriptStateEnum format 
    is_started = boolean, -- if the Start() function of the script was called
    is_loaded = boolean, -- if the script has been loaded, including script data
}

Add Script

Add the script into a gameobject

Return a boolean indicating success

function engine.script.add(goId = number, scriptName = string) end

Destroy Script

Destroy the script of a gameobject

The remove argument indicates if the script should be also removed when destroyed, its an optional argument

Return a boolean indicating success

function engine.script.destroy(goId = number, scriptName = string, remove = bool) end

Find all scripts

Return the gos id that contains the script given by name

function engine.script.find_all(scriptName = string) end

Change Script Index

Change the script index

function engine.script.change_index(goId = string, scriptName = string, index = number) end

Displace script index

Change the script index in relation to his brothers

The displacement argument changes the index based on the current index

function engine.script.displace_index(goId = string, scriptName = string, displacement = number) end

Persist Script

Set current script to persist or not (will not be saved)

function engine.script.set_persist_script(val = bool) end

Persist External Script

Set any script to persist or not (will not be saved)

function engine.script.set_persist_ext_script(goId = string, scriptName = string, val = bool) end

Persist Script Data

Set data from current script to persist or not (will not be saved)

function engine.script.set_persist_script_data(dataName = string, val = bool) end

Persist External Script Data

Set any script data to persist or not (will not be saved)

function engine.script.set_persist_ext_script_data(goId = string, scriptName = string, val = bool) end

Show Script Data

Set data from current script to show or not in the editor

function engine.script.set_show_script_data(dataName = string, val = bool) end

Show External Script Data

Set any script data to show or not in the editor

function engine.script.set_persist_ext_show_data(goId = string, scriptName = string, val = bool) end

Camera 2D Module

Create 2D Camera

Create a 2D camera and return an id

function engine.cam2d.create(object = table) end

The argument table format

{
    left = number,
    right = number,
    top = number,
    bottom = number,
}

Destroy 2D Camera

Destroy a 2D camera

Recieve the camera id and return bool indicating success

function engine.cam2d.destroy(id = number) end

Get 2D Camera

Get a 2D camera

Recieve the camera id and return a table or nil if not find it

function engine.cam2d.get(id = number) end

The returned table format

{
    left = number,
    right = number,
    top = number,
    bottom = number,
}

Get 2D Camera Matrix

Get a 2D camera ortho matrix

Recieve the camera id and return a table or nil if not find it

function engine.cam2d.get_matrix(id = number) end

The returned table format is a mat4

{
    1 = {{x = number, y = number, z = number, w = number}},
    2 = {{x = number, y = number, z = number, w = number}},
    3 = {{x = number, y = number, z = number, w = number}},
    4 = {{x = number, y = number, z = number, w = number}}
}

Update 2D Camera

Update a 2D camera

Recieve the camera id and a table with update info

Return a bool indicating success

function engine.cam2d.update(id = number, info = table) end

The argument table format

{
    left = number, -- optional
    right = number, -- optional
    top = number, -- optional
    bottom = number, -- optional
}

Set Current 2D Camera

Set the current 2D camera

Recieve the camera id

Return a bool indicating success

function engine.cam2d.set_current(id = number) end

Get Current 2D Camera

Get the current 2D camera id

Return the camera id or nil

function engine.cam2d.get_current() end

Camera 3D Module

Create 3D Camera

Create a 3D camera and return an id

function engine.cam3d.create(object = table) end

The argument table format

{
    position = {x = number, y = number, z = number}, -- camera pos in vec3 format, optional
    yaw = number, -- yaw in degress, optional
    pitch = number, -- pitch in degress, optional
    fov = number, -- fov, optional
    aspect_ratio = number, -- aspect ratio, optional
    zfar = number, -- zfar, optional
    znear = number, -- znear, optional
}

Destroy 3D Camera

Destroy a 3D camera and return an bool indicating success

function engine.cam3d.destroy(id = number) end

Update 3D Camera

Update a 3D camera and return an bool indicating sucess

Recieve the camera id and a table with update info

function engine.cam3d.update(id = number, object = table) end

The argument table format

{
    position = {x = number, y = number, z = number}, -- camera pos in vec3 format, optional
    rotation = {x = number, y = number, z = number}, -- set rotation from a normalized front vector, optional
    yaw = number, -- yaw in degress, optional
    pitch = number, -- pitch in degress, optional
    fov = number, -- fov, optional
    aspect_ratio = number, -- aspect ratio, optional
    zfar = number, -- zfar, optional
    znear = number, -- znear, optional
}

Get 3D Camera

Get a 3D camera and return a table, if not find it return nil

function engine.cam3d.get(id = number) end

The returned table format

{
    position = {x = number, y = number, z = number}, -- camera position, vec3
    right = {x = number, y = number, z = number}, -- camera right vector, vec3
    front = {x = number, y = number, z = number}, -- camera front vector, vec3
    up = {x = number, y = number, z = number},-- camera up vector, vec3
    yaw = number, -- yaw in degrees
    pitch = number, -- pitch in degrees
    fov = number, -- camera fov
    aspect_ratio = number, -- camera aspect ratio
    zfar = number, -- camera zfar
    znear = number, -- camera znear
}

Translate Relative 3D Camera

Translate a 3D camera relation to its basis vectors and return an bool indicating success

Recieve the camera id and a table with translation info

function engine.cam3d.translate(id = number, object = table) end

The argument table format

{
    direction = string, -- direction in the format enums.CameraMovementEnum
    velocity = number, -- the velocity of translation
}

Translate Absolute 3D Camera

Translate a 3D camera relation to the axis and return an bool indicating success

Recieve the camera id and a table with translation info

function engine.cam3d.translate_abs(id = number, object = table) end

The argument table format

{
    direction = string, -- direction in the format enums.CameraMovementEnum
    velocity = number, -- the velocity of translation
}

Rotate 3D Camera

Rotate a 3D camera and return an bool indicating success

Recieve the camera id and a table with rotation info

function engine.cam3d.rotate(id = number, object = table) end

The argument table format

{
    yaw = number, -- yaw in degrees
    pitch = number, -- pitch in degrees
}

Get View Matrix

Recieve the camera id and return the view matrix in mat4 format

Return nil if not find it

function engine.cam3d.get_view_matrix(id = number) end

The returned table format

{
    1 = {{x = number, y = number, z = number, w =n umber}},
    2 = {{x = number, y = number, z = number, w = number}},
    3 = {{x = number, y = number, z = number, w = number}},
    4 = {{x = number, y = number, z = number, w = number}}
}

Get Projection Matrix

Recieve the camera id and return the projection matrix in mat4 format

Return nil if not find it

function engine.cam3d.get_projection_matrix(id = number) end

The returned table format

{
    1 = {{x = number, y = number, z = number, w = number}},
    2 = {{x = number, y = number, z = number, w = number}},
    3 = {{x = number, y = number, z = number, w = number}},
    4 = {{x = number, y = number, z = number, w = number}}
}

Set Current Camera

Recieve the camera id and set as current camera

Return a bool indicating success

function engine.cam3d.set_current(id = number) end

Get Current Camera

Return the current camera or nil if not finded

function engine.cam3d.get_current() end

Drawing Module

To draw primitives

Draw 2D Rect

Draw a 2D rectangle

function engine.draw2d.rect(object = table) end

The argument table format

{
    position = {x = number, y = number}, -- position, vec2 format
    size = {x = number, y = number}, -- size, vec2 format
    color = {x = number, y = number, z = number, w = number}, -- color, vec4 format, optional
    rotation = number, -- rotation in degrees, optional
    filled = boolean, -- fill or not the shape, optional
}

Draw 2D Circle

Draw a 2D circle

function engine.draw2d.circle(object = table) end

The argument table format

{
    position = {x = number, y = number}, -- position, vec2 format
    size = {x = number, y = number}, -- size, vec2 format
    color = {x = number, y = number, z = number, w = number}, -- color, vec4 format, optional
    filled = boolean, -- fill or not the shape, optional
}

Draw 2D Triangle

Draw a 2D triangle

function engine.draw2d.triangle(object = table) end

The argument table format

{
    position1 = {x = number, y = number}, -- position1, vec2 format
    position2 = {x = number, y = number}, -- position2, vec2 format
    position3 = {x = number, y = number}, -- position3, vec2 format
    color = {x = number, y = number, z = number, w = number}, -- color, vec4 format, optional
    rotation = number, -- rotation in degrees, optional
}

Draw 2D Line

Draw a 2D line

function engine.draw2d.line(object = table) end

The argument table format

{
    position_start = {x = number, y = number}, -- start position, vec2 format
    position_end = {x = number, y = number}, -- end position, vec2 format
    color = {x = number, y = number, z = number, w = number}, -- color, vec4 format, optional
}

Draw 2D Point

Draw a 2D point

function engine.draw2d.point(object = table) end

The argument table format

{
    position = {x = number, y = number}, -- position, vec2 format
    color = {x = number, y = number, z = number, w = number}, -- color, vec4 format, optional
}

Draw 2D Texture

Draw a 2d texture

function engine.draw2d.texture(object = table) end

The argument table format

{
    position = {x = number, y = number}, -- position, vec2 format
    size = {x = number, y = number}, -- size, vec2 format
    texture_id = number, the texture id
    rotation = number, -- rotation in degrees, optional
    color = {x = number, y = number, z = number }, -- color, vec3 format, optional
    color_weight = number, -- color weight in relation to texture, should vary between 0.0 and 1.0, optional
    transparency = number, -- transparency multiplier, should vary between 0.0 and 1.0, optional
}

Draw 2D Texture in Editor Frame

Draw a 2d texture in Editor Frame

function engine.draw2d.frame(textureId = number) end

Draw 3D Cube

Draw a 3D cube

function engine.draw3d.cube(object = table) end

The argument table format

{
    position = {x = number, y = number = z = number}, -- position, vec3 format
    size = {x = number, y = number = z = number}, -- size, vec3 format
    color = {x = number, y = number, z = number, w = number}, -- color, vec4 format, optional
    rotation = {x = number, y = number, z = number}, -- rotation in degrees in vec3 format, optional
    filled = boolean, -- fill or not the shape, optional
}

Draw 3D Sphere

Draw a 3D sphere

function engine.draw3d.sphere(object = table) end

The argument table format

{
    position = {x = number, y = number = z = number}, -- position, vec3 format
    size = {x = number, y = number = z = number, w = number}, -- size, vec3 format
    color = {x = number, y = number, z = number}, -- color, vec4 format, optional
    rotation = {x = number, y = number, z = number}, -- rotation in degrees in vec3 format, optional
    filled = boolean, -- fill or not the shape, optional
}

Draw 3D Point

Draw a 3D point

function engine.draw3d.point(object = table) end

The argument table format

{
    position = {x = number, y = number = z = number}, -- position, vec3 format
    color = {x = number, y = number, z = number, w = number}, -- color, vec4 format, optional
}

Draw 3D Line

Draw a 3D line

function engine.draw3d.line(object = table) end

The argument table format

{
    position_start = {x = number, y = number = z = number}, -- position start, vec3 format
    position_end = {x = number, y = number = z = number}, -- position end, vec3 format
    color = {x = number, y = number, z = number, w = number}, -- color, vec4 format, optional
}

Draw 3D Rect

Draw a 3D rect

function engine.draw3d.rect(object = table) end

The argument table format

{
    position = {x = number, y = number = z = number}, -- position, vec3 format
    size = {x = number, y = number = z = number}, -- size, vec3 format
    color = {x = number, y = number, z = number, w = number}, -- color, vec4 format, optional
    rotation = {x = number, y = number, z = number}, -- rotation in degrees in vec3 format, optional
    filled = boolean, -- fill or not the shape, optional
}

Draw 3D Triangle

Draw a 3D triangle

function engine.draw3d.triangle(object = table) end

The argument table format

{
    position1 = {x = number, y = number = z = number}, -- position, vec3 format
    position2 = {x = number, y = number = z = number}, -- position, vec3 format
    position3 = {x = number, y = number = z = number}, -- position, vec3 format
    color = {x = number, y = number, z = number, w = number}, -- color, vec4 format, optional
    filled = boolean, -- fill or not the shape, optional
}

Draw 3D Circle

Draw a 3D circle

function engine.draw3d.circle(object = table) end

The argument table format

{
    position = {x = number, y = number = z = number}, -- position, vec3 format
    size = {x = number, y = number = z = number}, -- size, vec3 format
    color = {x = number, y = number, z = number, w = number}, -- color, vec4 format, optional
    rotation = {x = number, y = number, z = number}, -- rotation in degrees in vec3 format, optional
    filled = boolean, -- fill or not the shape, optional
}

Window Module

Get Window Size

Return a table with current window size

function engine.window.get_window_size() end

The returned table format

{ -- vec2 format
    x = number, 
    y = number
}

Get Editor Window Size

Return a table with current editor window size

function engine.window.get_editor_window_size() end

The returned table format

{ -- vec2 format
    x = number, 
    y = number
}

Get Window Limits

Return a table with the window limits

function engine.window.get_window_limits() end

The returned table format

{ -- vec2 format
    max_x = number, 
    max_y = number,
    min_x = number, 
    min_y = number
}

Directory Module

Read File

Open a file and return its contents

function engine.dir.read_file(file_name = string) end

The returned table format

{
    open = bool, 
    content = string
}

Create File

Create a file with optional content and return a bool indicating success

function engine.dir.create_file(file_name = string, content = string) end

Create Folder

Create a folder and return a bool indicating success

function engine.dir.create_folder(folder_name = string) end

Move

Move a folder or file and return a bool indicating success

function engine.dir.move(from = string, to = string) end

Copy

Copy a folder or file and return a bool indicating success

function engine.dir.copy(from = string, to = string) end

Delete

Delete a folder or file and return a bool indicating success

function engine.dir.delete(path = string) end

Is File

Return a bool indicating if the provided path is a file

function engine.dir.is_file(path = string) end

Is Directory

Return a bool indicating if the provided path is a directory

function engine.dir.is_dir(path = string) end

Exists

Return a bool indicating if the provided path/file exists

function engine.dir.exists(path = string) end

Get Current Path

Return the executable path

function engine.dir.get_current_path() end

Get Base Path

Return the base project path

function engine.dir.get_base_path() end

Get Assets Path

Return the assets path

function engine.dir.get_assets_path() end

Get Logs Path

Return the logs path

function engine.dir.get_logs_path() end

List Directories

Return the an table with the content of a directory, if not exists return nil

function engine.dir.list_dir(path = string) end

Reduce Path By

Reduce a path n times and return it

function engine.dir.reduce_path_by(path = string, n = number) end

Get File Name Extension

Recieve a file path and return the extension

function engine.dir.get_file_name_ext(path = string) end

Get Path Or File Name

Recieve a file or dir path and return only its name

function engine.dir.get_path_or_file_name(path = string) end

Get File Name No Extension

Recieve a file path and return only its name without extension

function engine.dir.get_file_name_no_ext(path = string) end

Execute a system command

Recieve a string command

function engine.dir.exec(command = string) end

Input Module

Get Keyboard Key

Get the key status

Argument is a string in enums.KeyboardKeyEnum format

Return the result as a string in enums.InputActionEnum format

function engine.input.get_key(key = string) end

Get Modifier Key

Get the modifier key status

Argument is a string in enums.KeyModifierEnum format

Return the result as a string in enuns.InputActionEnum format

function engine.input.get_mod(key = string) end

Get Mouse Position

Return a vec2 with mouse coordinates

function engine.input.get_mouse_pos() end

Get Camera Mouse Position

Return a vec2 with mouse coordinates based on current camera

function engine.input.get_cam_mouse_pos() end

Get Mouse Variation

Return a vec2 with mouse variations

function engine.input.get_mouse_variation() end

Get Mouse Button

Get the mouse button status

Argument is a string in enums.MouseButtonEnum format

Return the result as a string in enums.InputActionEnum format

function engine.input.get_mouse_button(key = string) end

Image Module

Open

Open a image and return its info

Argument is a string with path

Return the result as a table or nil if failed

function engine.img.open(path = string) end

The returned table format

{
    size = {x = number, y = number} -- the image size, vec2 format
    path = string, -- the path that the image was loaded
    format = string -- the image format see Texture Format below
    data = { -- a table of numbers with raw data information of the image
        1 = number,
        ...,
        size.x*size.y = number
    } -- 
}

Command Module

Enable VSync

Enables the vsync

function engine.command.enable_vsync() end

Disable VSync

Disables the vsync

function engine.command.disable_vsync() end

Enable Depth Testing

Enables the depth testing

function engine.command.enable_depth_testing() end

Disable Depth Testing

Disables the depth testing

function engine.command.disable_depth_testing() end

Set Depth Testing Mode

Set the depth testing mode, receive a string in enums.DepthTestingModeEnum

function engine.command.set_depth_testing_mode(mode = string) end

Enable Culling Face

Enable the face culling

function engine.command.enable_culling_face() end

Disable Culling Face

Disable the face culling

function engine.command.disable_culling_face() end

Set Culling Face Mode

Set the face culling mode with enums.CullingFaceModeEnum format

function engine.command.set_culling_face_mode(mode = string) end

Set Primitive Line Size

Set the primitive Line size, recieve as argument with number type

function engine.command.set_primitive_line_size(size = number) end

Set Primitive Point Size

Set the primitive point size, recieve as argument with number type

function engine.command.set_primitive_point_size(size = number) end

Set Polygon Draw Mode

Set the polygons draw mode in enums.PolygonModeEnum format

function engine.command.set_polygon_draw_mode(mode = string) end

Enable Blending

Enables the blending

function engine.command.enable_blending() end

Disable Blending

Disables the blending

function engine.command.disable_blending() end

Shader Module

Create Shader

Create a shader, receive a table with creation information

Return id if success else return nil

function engine.shader.create(arg = table) end

The argument table format

{
    vertex_path = string -- path to vertex shader file
    fragment_path = string, -- path to the fragment shader file (optional)
    geometry_path = string  -- path to the geometry shader file (optional)
}

Create Raw Shader

Create a shader, receive a table with data information

Return id if success else return nil

function engine.shader.create_raw(arg = table) end

The argument table format

{
    vertex_content = string -- content of vertex shader
    fragment_content = string, -- content of fragment shader (optional)
    geometry_content = string  -- content of geometry shader (optional)
}

Delete Shader

Delete a shader, receive the id

Return bool indicating success

function engine.shader.destroy(id = number) end

Activate Shader

Activate a shader, receive the id

Return bool indicating success

function engine.shader.activate(id = number) end

Disable Current Shader

Disable the current active shader

function engine.shader.unactive_all() end

Set Shader Bool

Set bool variable into shader, receive the id and data information

Return bool indicating success

function engine.shader.set_bool(id = number, name = string, value = bool) end

Set Shader Integer

Set integer variable into shader, receive the id and data information

Return bool indicating success

function engine.shader.set_int(id = number, name = string, value = number) end

Set Shader Float

Set float variable into shader, receive the id and data information

Return bool indicating success

function engine.shader.set_float(id = number, name = string, value = number) end

Set Shader XY

Set XY (separated vec2) variable into shader, receive the id and data information

Return bool indicating success

function engine.shader.set_xy(id = number, name = string, x = number, y = number) end

Set Shader XYZ

Set XYZ (separated vec3) variable into shader, receive the id and data information

Return bool indicating success

function engine.shader.set_xyz(id = number, name = string, x = number, y = number, z = number) end

Set Shader XYZW

Set XYZW (separated vec4) variable into shader, receive the id and data information

Return bool indicating success

function engine.shader.set_xyzw(id = number, name = string, x = number, y = number, z = number, w = number) end

Set Shader vec2

Set a vec2 variable into shader, receive the id and data information

Return bool indicating success

function engine.shader.set_vec2(id = number, name = string, {x = number, y = number}) end

Set Shader vec3

Set vec3 variable into shader, receive the id and data information

Return bool indicating success

function engine.shader.set_vec3(id = number, name = string, {x = number, y = number, z = number}) end

Set Shader vec4

Set vec4 variable into shader, receive the id and data information

Return bool indicating success

function engine.shader.set_vec4(id = number, name = string, { x = number, y = number, z = number, w = number}) end

Set Shader mat2

Set mat2 variable into shader, receive the id and data information

Return bool indicating success

function engine.shader.set_mat2(id = number, name = string, mat2 = table) end

The argument table format

{
    {x = number, y = number },
    {x = number, y = number },
}

Set Shader mat3

Set mat3 variable into shader, receive the id and data information

Return bool indicating success

function engine.shader.set_mat3(id = number, name = string, mat3 = table) end

The argument table format

{
    {x = number, y = number, z = number},
    {x = number, y = number, z = number},
    {x = number, y = number, z = number},
}

Set Shader mat4

Set mat4 variable into shader, receive the id and data information

Return bool indicating success

function engine.shader.set_mat4(id = number, name = string, mat4 = table) end

The argument table format

{
    {x = number, y = number, z = number, w = number},
    {x = number, y = number, z = number, w = number},
    {x = number, y = number, z = number, w = number},
    {x = number, y = number, z = number, w = number},
}

Texture Module

Create Empty Texture

Create a empty texture, receive a table with creation information

Return id if success else return nil

function engine.texture.create_empty(arg = table) end

The argument table format

{
    texture_size = {x = number, y = number}, -- texture size, vec2 format
    minifying_filter = string, -- in enums.MinifyingFilterEnum format, optional
    magnification_filter = string, -- in enums.MagnificationFilterEnum format, optional
    texture_wrap_t = string, -- in  enums.TextureWrapEnum format, optional
    texture_wrap_s = string, -- in  enums.TextureWrapEnum format, optional
    texture_pixel_format = string, -- in enums.TexturePixelEnum format, optional
    texture_internal_format = string, -- in enums.TextureInternalFormatEnum format, optional
    texture_format = string, -- in enums.TextureFormatEnum format, optional
    ansiotropic_filter = number, -- a number for ansiotropic filter, optional
    border_color = {x = number, y = number, z = number} -- texture border_color in vec3 format, optional
}

Create Multisampled Texture

Create a empty multisampled texture, receive a table with creation information

Return id if success else return nil

function engine.texture.create_multi_sampled(arg = table) end

The argument table format

{
    texture_samples = number -- number of samples
    texture_size = {x = number, y = number}, -- texture size, vec2 format
    texture_internal_format = string, -- in enums.TextureInternalEnum format
}

Create Texture

Create a texture, receive a table with creation information

Return id if success else return nil

function engine.texture.create(arg = table) end

The argument table format

{
    image_path = string, -- image path
    minifying_filter = string, -- in enums.MinifyingFilterEnum format, optional
    magnification_filter = string, -- in enums.MagnificationFilterEnum format, optional
    texture_wrap_t = string, -- in enums.TextureWrapEnum format, optional
    texture_wrap_s = string, -- in enums.TextureWrapEnum format, optional
    ansiotropic_filter = number, -- a number for ansiotropic filter, optional
    border_color = {x = number, y = number, z = number} -- texture border_color in vec3 format, optional
}

Get Texture Info

Receive the id and return info or nil if not finded

function engine.texture.get_info(id = number) end

The returned table format

{
    multisampled = bool, -- if the texture is multisampled
    samples = number, -- number of samples if texture is multisampled
    size = vec2, -- texture size in pixels
}

Destroy Texture

Destroy a texture, receive the id

Return bool indicating success

function engine.texture.destroy(id = number) end

Active Texture

Active a texture, receive the id and the texture unit slot as a number

Return bool indicating success

function engine.texture.active(id = number, slot = number) end

Disable Texture Unit

Remove any texture at a texture unit slot

function engine.texture.disabletextureunit(slot = number) end

Framebuffer Module

Create Framebuffer

Create a framebuffer, receive a table with creation information

Return id if success else return nil

function engine.framebuffer.create(arg = table) end

The argument table format

{
    texture_attachments_count = number, -- number of texture attachments,
    texture_attachments = = {1 = number, ..., texture_count = number} -- table with the ids of the texture attachments,
    depth_attachment = number, -- texture id for depth attachment, optional
    renderbuffer_attachment = { -- optional
        type = string -- in enums.RenderBufferAttachmentType format,
        format = string -- in enums.RenderBufferFormat format,
        size = {x = number, y = number} -- render buffer size
        aliasing = number -- multisample in render buffer
    }
}

Destroy Framebuffer

Destroy a framebuffer, receive the id

Return bool indicating success

function engine.framebuffer.destroy(id = number) end

Active Framebuffer

Active a framebuffer, receive the id

Return bool indicating success

function engine.framebuffer.active(id = number) end

Disable All Framebuffer

Active the default screen buffer of the window, witch can't be used

function engine.framebuffer.active_none() end

Get Framebuffer Attachments Size

Receive the framebuffer id and return a framebuffer number of texture attachments, else nil if not finded

function engine.framebuffer.get_attachments_size(id = number) end

Get Framebuffer Attachment

Receive the framebuffer id and the texture attachment position

Return the id of the texture attachment, else nil if not finded

function engine.framebuffer.get_attachment(id = number, index = number) end

Clear Current Framebuffer

Clear the current framebuffer

function engine.framebuffer.clear(color = vec4) end

Set Framebuffer Clear Modes

Set the framebuffer clear modes

function engine.framebuffer.set_clear_modes(modes = table) end

The argument table format

{
    color = boolean, -- bool if you and this clear mode
    depth = boolean, -- bool if you and this clear mode
    stencil = boolean, -- bool if you and this clear mode
}

Set View Port

Set current view port, recieve a vec4 format table

function engine.framebuffer.set_viewport(viewport = table) end

The argument table format

{
    x = number, -- start viewport x
    y = number, -- start viewport y
    z = number, -- size viewport x
    w = number -- size viewport y
}

Vertex Module

Create Vertex Data

Create a vertex data, receive a table with creation information, and an optional table with index data

Return id if success else return nil

function engine.vertex.create(vertexData = table, indexData = table) end

The first argument table format

{
    vertices_count = number, -- the total number of vertices, considering the attributes of each vertex
    buffers_count = number, -- the number of buffers that will be used to separate the vertices attributes
    buffers = { -- the buffers that holds the vertices data
        1 = { -- buffer item format
            use = string, -- (optional) use internally by opengl in enums.DataUseEnum format
            type = string, -- type of the data, use enums.VertexBufferTypeEnum format
            data = { -- data, array of number
                1 = number,
                ...
                vertices_count*layout_count = number
            },
            layouts_count = number, -- number of division in attributes of buffer
            layout = { -- layou description
                1 = { -- layout item format
                    count = number, -- number of elements in layout
                    normalized = bool, -- if data is normalized (optional)
                },
                ... -- until layouts_count
            }
        },
        ... -- until buffers_count
    }
}

The second argument table format (optional)

{
    use = string, -- (optional) use internally by opengl in Data Use format (see enums below)
    count = number, -- number of indices used
    data = { -- data, array of number for indices
        1 = number,
        ...
        count = number
    }
}

Destroy Vertex Data

Destroy a vertex data, receive the id

Return bool indicating success

function engine.vertex.destroy(id = number) end

Get Vertex Info

Receive the id and return info or nil if not finded

function engine.vertex.get_info(id = number) end

The returned table format

{
    gl_id = number, -- open gl id (vao)
}

Activate Vertex Data

Activate a vertex data, receive the id

Return bool indicating success

function engine.vertex.activate(id = number) end

Call to Draw Vertex Data

Draw a vertex data, receive the id and draw mode

drawMode is in enums.DrawingTypeEnum format

Return bool indicating success

function engine.vertex.draw(id = number, drawMode = string) end

Modify Vertex Data

Modify a vertex data, receive the id and modification data as a table

Return bool indicating success

function engine.vertex.modify(id = number, modifyData = table) end

The argument table format

{
    start = number, -- the start position to be modified
    size = number, -- the size of modification
    buffer = number, -- with buffer to modified
    type = string,  -- type of the data, format enums.VertexBufferTypeEnum format
    data = { -- data to replace the buffer
        1 = number,
        ...,
        size = number
    }
}

Generate 2D meshes

Return id of vertex data

dataUse argument is in Data Use format (see enums below)

function engine.generator.gen_2d_point(dataUse = string) end
function engine.generator.gen_2d_line(dataUse = string, filled = bool) end
function engine.generator.gen_2d_circle(dataUse = string, filled = bool, segments = number) end
function engine.generator.gen_2d_triangle(dataUse = string, filled = bool) end

Generate 3D meshes

Return id of vertex data

dataUse argument is in Data Use format (see enums below)

function engine.generator.gen_3d_circle(dataUse = string, filled = bool, segments = number) end
function engine.generator.gen_3d_cube(dataUse = string, filled = bool) end
function engine.generator.gen_3d_line(dataUse = string) end
function engine.generator.gen_3d_point(dataUse = string) end
function engine.generator.gen_3d_rect(dataUse = string, filled = bool) end
function engine.generator.gen_3d_sphere(dataUse = string, filled = bool, segments = number) end
function engine.generator.gen_3d_triangle(dataUse = string, filled = bool) end

Audio Module

Create Audio

Returns id if success, else return nil

function engine.audio.create_2d(path = string) end
function engine.audio.create_3d(path = string) end

Destroy Audio

function engine.audio.destroy(id = number) end

Pause/Resume Audio

function engine.audio.pause(id = number) end
function engine.audio.resume(id = number) end

Restart Audio

function engine.audio.restart(id = number) end

Stop Audio

function engine.audio.stop(id = number) end

Check if audio has finished playing

function engine.audio.is_finished(id = number) end

Get/Set the position of the audio

Returns vec3

function engine.audio.get_position(id = number) end
function engine.audio.set_position(id = number, vec3) end

Get/Set the velocity of playing

function engine.audio.set_velocity(id = number, vec3) end
function engine.audio.get_velocity(id = number) end

Get/Set the audio to play in loop

function engine.audio.set_loop(id = number, bool) end
function engine.audio.get_loop(id = number) end

Get/Set the minimal distance

Changes the distance at which the 3D sound stops getting louder

function engine.audio.set_min_distance(id, number) end
function engine.audio.get_min_distance(id) end

Get/Set the max distance

This value causes the sound to stop attenuating after it reaches the max distance

function engine.audio.set_max_distance(id, number) end
function engine.audio.get_max_distance(id) end

Get/Set the max distance

The balance of the sound, value between -1 and 1

function engine.audio.set_pan(id, number) end
function engine.audio.get_pan(id) end

Get/Set the speed

Plays the sound at a higher or lower speed, increasing or decreasing its frequency which makes it sound lower or higher

function engine.audio.set_speed(id, number) end
function engine.audio.get_speed(id) end

Get the play max length

Returns the play lenght of the audio (number)

function engine.audio.get_length(id) end

Get/Set the position of playing of the audio (0 to max)

function engine.audio.set_play_position(id, number) end
function engine.audio.get_play_position(id) end

Get/Set the audio volume

function engine.audio.set_volume(id, number) end
function engine.audio.get_volume(id) end

Stop all audios

Stop all audios

function engine.audio.stop_all_audios() end

Set the position of the listener in the world (global)

function engine.audio.set_listener_position(vec3) end

Font Module

Create Font

Returns id if success, else return nil

Width and height in pixels, use 0 to one of it to adapt based on the another

function engine.font.create(path = string, width = number, height = number) end

Destroy Font

function engine.font.destroy(id = number) end

Get/Set Position

function engine.font.get_position(id = number) end
function engine.font.set_position(id = number, pos = vec2) end

Get/Set Scale

function engine.font.get_scale(id = number) end
function engine.font.set_scale(id = number, scale = vec2) end

Get/Set Color

function engine.font.get_color(id = number) end
function engine.font.set_color(id = number, color = vec3) end

Get text Size

Returns a Vec2 with the current text size in pixels

function engine.font.get_text_size_(id = number) end

Get/Set Text

function engine.font.get_text(id = number) end
function engine.font.set_text(id = number, text = string) end

Draw Font

function engine.font.draw(id = number) end

Math Module

Random number

Return a random number between 0.0 and 1.0

function engine.math.random() 

Make vec2

Return a vec2

function engine.math.make_vec2() 

Make vec3

Return a vec3

function engine.math.make_vec3() 

eturn a vec2

```lua
function engine.math.make_vec2() 

Make mat2

Return a mat2 matrix

function engine.math.make_mat2() 

Make mat3

Return a mat3

function engine.math.make_mat3() 

Make mat4

Return a mat4 matrix

function engine.math.make_mat4() 

Make mat2 identity

Return a mat2 identity matrix

function engine.math.make_identity_mat2() 

Make mat3 identity

Return a mat3 identity matrix

function engine.math.make_identity_mat3() 

Make mat4 identity

Return a mat4 identity matrix

function engine.math.make_identity_mat4() 

Translate

Return a traslated mat4 matrix

function engine.math.translate(mat4, vec3) 

Rotate

Return a rotated mat4 matrix

function engine.math.rotate(mat4, vec3, angle) 

Scale

Return a scaled mat4 matrix

function engine.math.scale(mat4, vec3) 

Multiply

Return a vec4 that is the multiplication between a mat4 and vec4

function engine.math.multiply(mat4, vec4) 

Magnitude Vec2

Return the magnitude of a vec2

function engine.math.mag_vec2(vec2) 

Magnitude Vec3

Return the magnitude of a vec3

function engine.math.mag_vec3(vec3) 

Normalize Vec2

Return the normalized vec2

function engine.math.normalize_vec2(vec2) 

Normalize Vec3

Return the normalized vec3

function engine.math.normalize_vec3(vec3)

Object Module

Open 3D Model

Open any 3d model and return the id

function engine.object.open(path = string) 

Destroy 3D Model

Destroy 3d model by recieving it's id

function engine.object.destroy(id = number) 

Get 3D Model information

Return a tabe with 3d model information

function engine.object.get(id = number) 

Get 3D Model meshes

Return a tabe with the information about the meshes of the model

function engine.object.get_meshes(id = number) 

Get 3D Model meshes

Return a tabe with the information about the materials of the model

function engine.object.get_materials(id = number)