-
Notifications
You must be signed in to change notification settings - Fork 0
Usertypes
Represents a frame of animation within an Animation.
-
characterMap
CharacterMapThe Character data in the frame. -
offset
Ivec2The offset of the frame, relative to the GameObject. -
addedDuration
numberThe additional delay for this frame, in milliseconds (ms).
Used to queue and manage Animations to be rendered to a GameObject.
-
isPlaying
booleanIs an animation currently playing? -
looping
booleanIs the current animation set to loop? -
yoyoing
booleanIs the current animation set to yo-yo (i.e. play forwards and backwards repeatedly)? -
reversing
booleanIs the current animation set to play in reverse? -
frameNumber
numberThe current frame index for the currently queued animation. -
frameDuration
numberHow long each frame in the current animation is set to play for, in milliseconds (ms). -
frameRate
numberThe frame rate for the animation. -
currentAnimation
AnimationThe currently queued animation. -
hasAnimationsQueued
booleanAre there animations queued?
-
play()
voidStarts playing the current animation. -
stop()
voidStops playing the current animation. -
seek( frame
number)voidSeeks to the given frame index in the current animation. -
addToQueue( animation
string, ... )voidAdds the animation(s) with the given name to the queue. -
addToQueue( { animation
string, [startboolean], [loopboolean], [yoyoboolean], [frame_durationnumber], [frame_ratenumber] }, ... )voidAdds the animation(s) with the given name and parameters to the queue. -
clearQueue()
voidClears the animation queue.
Displays a background texture in a GameWindow.
-
position
Ivec2The position of the background in the GameWindow, in pixels (px). -
size
Ivec2The size of the background in the GameWindow, in pixels (px). -
colour
Vec4The colour of the background. -
source
stringThe filepath to the background texture. -
loaded
booleanIs a background texture currently loaded?
-
reset()
voidResets the position, size and colour of the background in the GameWindow. -
remove()
voidRemoves the background texture, if set.
- Character()
- Character( character
Character) - Character( character
string, foregroundColourVec4, backgroundColourVec4)
Represents a character in a GameScene, with its foreground/background colours.
-
character
stringThe character to display. -
foregroundColour
Vec4The text colour of the character. -
backgroundColour
Vec4The background colour of the character.
- CharacterMap()
- CharacterMap( size
Ivec2, datatable)
Manages a list of Characters, and how they are rendered to the window.
-
data
tableThe list of Character data. -
size
Ivec2The size of the character map, in rows/columns. -
hideEmptyCharacters
booleanShould empty characters display their background colour?
-
set( func
function)voidRuns a user-defined function to set the Characters in the list of data.
- EventListener( event_type
string, callback( selfuserdata, [ game_scenestring] ) =>void)
Listens for events, and triggers a callback function when that event is emitted on the given game scene.
If the game scene is not passed, the default game scene is used.
Callback functions are defined with the following parameters:
-
self
userdataA reference to the event listener. -
data
tableThe data passed to the event.
-
id
numberThe ID of the listener. -
active
booleanWhether events are actively being listening for. -
type
stringThe type of event being listened for. -
timesFired
numberThe number of times this listener has been triggered.
-
trigger( data
table)voidEmits the event with the given data.
- GameScene( name
string)
Manages a scene, which GameObjects can be added to and rendered to a GameWindow.
-
name
stringThe name of the scene. -
characterMap
CharacterMapThe map of Characters rendered to the game scene. -
gameWindow
GameWindowThe GameWindow this scene is rendering to. -
onInit
functionThe user-defined function to run when the scene is loaded. -
onLoop
functionThe user-defined function to run every frame the scene is active. -
onQuit
functionThe user-defined function to run when the scene is unloaded.
-
close()
voidCloses the game scene, removing the window and associated game objects. -
preventClose()
voidPrevents the game scene from being closed by user input.
- GameWindow
Displays a window on the user's screen, and is used to render the contents of a GameScene.
-
background
BackgroundThe background image displayed behind the game scene. -
font
FontThe Font used to render Characters with. -
fontSize
numberThe font size to render Characters at. -
backgroundShader
ShaderThe ShaderProgram used to render the Background. -
textShader
ShaderThe ShaderProgram used to render the Characters. -
window
WindowThe Window this game scene renders to. -
gameScene
GameSceneThe GameScene currently being run. -
closeBehaviour
numberHow the window will act when the user closes the window. Values are 0 for hiding the window, 1 for closing the window and 2 for quitting the entire program.
-
reloadGameScene()
voidReloads the current game scene. -
resizeToCharacterMap()
voidResizes the game window to fit it's character map. -
resizeToWindow()
voidResizes the current GameScene's character map to fit the window.
- Timer()
Used to measure the duration of time between when the Timer is started/paused/stopped.
-
started
booleanIs the timer running? -
paused
booleanIs the timer paused? -
duration
numberThe amount of time the timer has been running for, in milliseconds (ms). -
pausedDuration
numberThe amount of time the timer has been paused for, in milliseconds (ms).
-
start()
voidStarts the timer. -
stop()
voidStops the timer. -
pause()
voidPauses the timer. -
resume()
voidResumes the timer. -
interval()
numberReturns the amount of time, in milliseconds (ms), since the timer was started or since this function was last called.
Manages the window handle for a GameWindow.
-
title
stringThe title that is displayed in the window's titlebar. -
position
Ivec2The position of the window in the user's screen, in pixels (px). -
size
Ivec2The size of the window, in pixels (px). -
resizable
booleanCan the window be resized by the user? -
minimised
booleanIs the window minimised? -
maximised
booleanIs the window maximised? -
borderless
booleanDoes the window have a border? -
captured
booleanIs the window capturing mouse input? -
clearColour
Vec4The colour used to clear the window before rendering. -
renderMode
booleanDoes the window render a wireframe, or a filled picture?
-
centerPosition()
voidCenters the window within the user's screen. -
restore()
voidRestores the window to its original size. -
show()
voidMakes the window visible to the user. -
hide()
voidHides the window and it's icon in the taskbar from the user.
Home
To-Do List
API Reference:
Globals
Vector Types
Usertypes
Game Objects
Resources
Events