Scripting API

The Scripting API is a set of functions that can be used in a Script.

Resources

Functions related to the creation, destruction and loading of resources.

Name

Description

createModel

Creates an empty model and returns its pointer.

loadModel

Loads a model from a file in the Asset Manager and returns a pointer to the loaded model.

getMeshID

Loads a mesh in the Graphics Module and returns a unique identifier to this mesh.

destroyModel

Destroys a model.

findModelByName

Returns the model associated with the name.

getModelName

Returns the name of the model.

createMaterial

Creates an empty material and returns its pointer.

loadMaterial

Loads a material from a file in the Asset Manager and returns a pointer to the loaded material.

destroyMaterial

Destroys a material.

findMaterialByName

Returns the material associated with the name.

getMaterialName

Returns the name of the material.

createImage

Creates an empty image and returns its pointer.

loadImage

Loads an image from a file in the Asset Manager and returns a pointer to the loaded image.

getImageID

Loads an image in the Graphics Module and returns a unique identifier to this image.

destroyImage

Destroys an image.

findImageByName

Returns the image associated with the name.

getImageName

Returns the name of the image.

createFont

Creates an empty font and returns its pointer.

loadFont

Loads a font from a file in the Asset Manager and returns a pointer to the loaded font.

getFontID

Loads a font in the Graphics Module and returns a unique identifier to this font.

destroyFont

Destroys a font.

findFontByName

Returns the font associated with the name.

getFontName

Returns the name of the font.

createSound

Creates an empty sound and returns its pointer.

loadSound

Loads a sound from a file in the Asset Manager and returns a pointer to the loaded sound.

getSoundID

Loads a sound in the Audio Module and returns a unique identifier to this sound.

destroySound

Destroys a sound.

findSoundByName

Returns the sound associated with the name.

getSoundName

Returns the name of the sound.

Scenes

Functions related to the scenes.

Name

Description

goToScene

Loads a scene from a file.

getCurrentScenePath

Returns the current scene’s path.

Entity-Component-System

Functions related to the Entity-Component-System.

Name

Description

createEntity

Creates a new Entity.

destroyEntity

Destroys an Entity.

destroyAllEntities

Destroys all Entities.

destroyNonPersistentEntities

Destroys all Entities not marked as persistent.

entityExists

Checks if an Entity exists.

setEntityName

Sets a name to an Entity.

entityHasName

Checks if an Entity has a name.

getEntityName

Returns the name of the Entity.

findEntityByName

Returns the Entity associated with the name.

setEntityPersistence

Marks or unmarks the Entity as persistent.

isEntityPersistent

Checks if an Entity is persistent.

addEntityToEntityGroup

Adds an Entity to an Entity Group.

removeEntityFromEntityGroup

Removes an Entity from an Entity Group.

entityGroupExists

Checks if an Entity Group exists.

isEntityInEntityGroup

Checks if an Entity is in an Entity Group.

getEntitiesInEntityGroup

Returns the Entities in an Entity Group.

getEntityGroupsOfEntity

Returns the Entity Groups of an Entity.

addEntityComponent

Adds a Component to an Entity.

removeEntityComponent

Removes a Component from an Entity.

hasEntityComponent

Checks if an Entity has a certain Component.

getEntityComponent

Returns an Entity’s Component.

Input

Functions related to inputs.

Name

Description

getKeyState

Returns the state of a keyboard key.

getMouseButtonState

Returns the state of a mouse button.

setCursorPosition

Sets the mouse cursor position.

getCursorPositionX

Returns the mouse cursor horizontal position.

getCursorPositionY

Returns the mouse cursor vertical position.

getMouseScrollOffsetX

Returns the horizontal mouse scroll offset between the last and current frame.

getMouseScrollOffsetY

Returns the vertical mouse scroll offset between the last and current frame.

setCursorVisibility

Sets the mouse cursor’s visibility.

isCursorVisible

Checks if the cursor is visible.

getConnectedGamepads

Returns the list of connected gamepads.

getGamepadButtonState

Returns the state of a gamepad button.

getGamepadStickAxisX

Returns the value of the stick’s horizontal axis, with -1.0 being left, 0.0 neutral and 1.0 right.

getGamepadStickAxisY

Returns the value of the stick’s vertical axis, with -1.0 being up, 0.0 neutral and 1.0 down.

getGamepadLeftTrigger

Returns the value of the stick’s left trigger, with 0.0 being neutral and 1.0 being fully pressed.

getGamepadRightTrigger

Returns the value of the stick’s right trigger, with 0.0 being neutral and 1.0 being fully pressed.

getGamepadName

Returns the name of the gamepad.

Windows

Functions related to windows and monitors.

Name

Description

openWindow

Opens a new window.

isWindowOpen

Checks if the window is opened.

closeWindow

Closes the window. Closing the main window closes the application.

getMainWindowID

Returns the unique identifier of the main window.

windowCount

Returns the number of opened windows.

setWindowSize

Sets the size of the window.

getWindowWidth

Returns the width of the window.

getWindowHeight

Returns the height of the window.

setWindowPosition

Sets the position of the window on the screen.

getWindowPositionX

Returns the horizontal position of the window on the screen.

getWindowPositionY

Returns the vertical position of the window on the screen.

setWindowFullscreen

Puts the window in fullscreen or windowed.

isWindowFullscreen

Checks if the window is in fullscreen.

setWindowBorderless

Removes or adds the window decorations.

isWindowBorderless

Checks if the window decorations are shown.

setWindowResizable

Enables or disables manual window resizing.

isWindowResizable

Checks if the window can be manually resized.

setWindowOpacity

Sets the window’s opacity.

getWindowOpacity

Returns the window’s opacity.

getWindowDroppedFiles

Returns the path to the files dropped on the window.

setWindowTitle

Sets the window’s title.

getWindowTitle

Returns the window’s title.

setWindowIcon

Sets the window’s icon.

getMonitorWidth

Returns the width of the main monitor.

getMonitorHeight

Returns the height of the main monitor.

getMonitorRefreshRate

Returns the refresh rate of the main monitor.

getMonitorDisplayScaling

Returns the display scaling of the main monitor.

Graphics

Function related to graphics.

Name

Description

setBackgroundColor

Sets the color of the background.

emitParticles

Emits particles described by a ParticleEmitter.

destroyParticles

Destroys all particles.

Physics

Functions related to physics.

Name

Description

intersect

Returns information about the intersection of two ColliderShapes.

raycast

Casts a ray and returns information about the intersection between the ray and the ColliderShape.

raycastAll

Casts a ray and returns information about the hit Entities.

setConstantForces

Sets the constant forces.

getConstantForces

Returns the constant forces.

Audio

Functions related to audio.

Name

Description

playSound

Plays a global sound and returns a unique identifier to this sound source.

playSoundAtPosition

Plays a sound at a certain position and returns a unique identifier to this sound source.

resumeSoundSource

Resumes a paused sound source.

pauseSoundSource

Pauses a playing sound source.

stopSoundSource

Stops a playing or paused sound.

getSoundSourceState

Returns the state of a sound source.

isSoundPlaying

Checks if any sound source of a certain sound is playing.

setSoundSourcePosition

Sets the position of a sound source.

getSoundSourcePosition

Returns the position of a sound source.

setSoundSourceGain

Sets the gain of a sound source.

getSoundSourceGain

Returns the gain of a sound source.

setSoundSourcePitch

Sets the pitch of a sound source.

getSoundSourcePitch

Returns the pitch of a sound source.

Animation

Functions related to Animations.

Name

Description

playAnimation

Plays an Animation on an Entity.

pauseAnimation

Pauses an Animation of an Entity.

stopAnimation

Stops an Animation of an Entity.

setAnimationCurrentTime

Sets the current playing time of an Animation played by an Entity.

isAnimationPlaying

Checks if an Entity is currently playing a certain Animation.

User Interface

Functions related to the User Interface.

Name

Description

drawUIText

Draws text on the User Interface.

drawUILine

Draws a line on the User Interface.

drawUIRectangle

Draws a rectangle on the User Interface.

drawUIImage

Draws an image on the User Interface.

Frame Limiter

Functions related to maximum number of frames per second.

Name

Description

setMaxFPS

Sets the maximum number of frames per second.

getMaxFPS

Returns the maximum number of frames per second.

Job System

Functions related to multithreading.

Name

Description

executeJob

Launches a job to be executed by a worker thread.

dispatchJob

Launches a job to be executed by multiple worker threads.

waitAllThreads

Waits for all worker threads to finish their jobs.

getNumThreads

Returns the number of threads.

Networking

Functions related to networking.

Name

Description

createServerSocket

Creates a ServerSocket.

createClientSocket

Creates a ClientSocket.

closeServerSocket

Closes a ServerSocket.

closeClientSocket

Closes a ClientSocket.

Scripting

Functions related to scripting.

Name

Description

createScript

Creates a new Script for a Scriptable Component.

Profiling

Functions related to profiling.

Name

Description

startProfiling

Starts a profiling session.

getProfilingResults

Returns the result of the profiling.

endProfiling

Ends a profiling session and returns the result.

isProfilerRunning

Checks if the profiler is running.

startProfilingBlock

Starts a profiling block.

endProfilingBlock

Ends a profiling block.