Libraries.Game.Game Documentation

The Game class is the heart of any game in Quorum. The basic Game class will just display a gray screen. To make your own game, you should make a new class that inherits from Game, and make your own versions of the CreateGame() and Update(number) actions. The example below will pop up an empty gray window.

Example Code

use Libraries.Game.Game

    class Main is Game
        action Main
            StartGame()
        end

        action CreateGame
        end

        action Update(number seconds)
        end
    end

Inherits from: Libraries.Language.Object

Summary

Variable Summary Table

VariablesDescription
boolean exitRequested

Actions Summary Table

ActionsDescription
Add(Libraries.Game.Graphics.DirectionalLight light)This action will add a DirectionalLight to the currently active Layer3D.
Add(Libraries.Interface.Item2D item)The Add action will add an item to the Game.
Add(Libraries.Game.Graphics.PointLight light)This action will add a PointLight to the currently active Layer3D.
Add(Libraries.Interface.Item3D item)The Add action will add an item to the Game.
AddCollisionListener(Libraries.Interface.Events.CollisionListener2D listener)Adds a collision listener to the game that will listen for collisions between 2D game objects that have been flagged as collidable.
AddCollisionListener(Libraries.Interface.Events.CollisionListener3D listener)Adds a collision listener to the game that will listen for collisions between 3D game objects that have been flagged as collidable.
AddControlActivationListener(Libraries.Interface.Events.ControlActivationListener listener)
AddFocusListener(Libraries.Interface.Events.FocusListener listener)This action adds a FocusListener to the Game.
AddInputTable(Libraries.Game.InputTable table)This action adds an InputTable to the Game.
AddKeyboardListener(Libraries.Interface.Events.KeyboardListener listener)This action adds a KeyboardListener to the Game.
AddLayer(integer index, Libraries.Game.Layer layer)This action will add the given Layer to the Game at the given index.
AddLayer(Libraries.Game.Layer layer)This action will add a new Layer to the Game.
AddMenuChangeListener(Libraries.Interface.Events.MenuChangeListener listener)
AddMouseListener(Libraries.Interface.Events.MouseListener listener)This action adds a MouseListener to the Game.
AddMouseMovementListener(Libraries.Interface.Events.MouseMovementListener listener)This action adds a MouseMovementListener to the Game.
AddMouseWheelListener(Libraries.Interface.Events.MouseWheelListener listener)This action adds a MouseWheelListener to the Game.
AddResizeListener(Libraries.Interface.Events.ResizeListener listener)This action adds a ResizeListener to the Game.
AddSelectionListener(Libraries.Interface.Events.SelectionListener listener)This action adds a SelectionListener to the Game.
AddTabChangeListener(Libraries.Interface.Events.TabChangeListener listener)
AddTextChangeListener(Libraries.Interface.Events.TextChangeListener listener)This action adds a TextChangeListener to the Game.
AddTextInputListener(Libraries.Interface.Events.TextInputListener listener)This action adds a TextInputListener to the Game.
AddTouchListener(Libraries.Interface.Events.TouchListener listener)This action adds a TouchListener to the Game.
AddTreeChangeListener(Libraries.Interface.Events.TreeChangeListener listener)
AddWindowFocusListener(Libraries.Interface.Events.WindowFocusListener listener)
Compare(Libraries.Language.Object object)This action compares two object hash codes and returns a CompareResult.
ContinueGame()This action is used by the Game to regularly handle core engine processes.
CreateGame()CreateGame is called when you first start the game, and is useful for setting up things that need to be initialized before they can be used, like loading Drawables.
EnablePhysics2D(boolean flag)
EnablePhysics3D(boolean flag)
EnableResizing(boolean resize)This action enables or disables resizing the game window by dragging the edges of the screen.
EnableTextureAutoResizing(boolean resize)This action enables or disables auto resizing of textures if the game window is resized.
Equals(Libraries.Language.Object object)This action determines if two objects are equal based on their hash code values.
Exit()The Exit action is used to tell the Game class to close the application after it completes the current iteration of the main loop.
FocusWindow()This action asks the operating system to give the main application window the focus.
GetAccessibilityManager()
GetAmbientLight()This action will return a new AmbientLight object which contains the ambient lighting data of the currently active Layer3D.
GetAndroidConfiguration()This action will return the game's configuration for Android devices.
GetAvailableResolutions()This action will return an Array of ScreenResolution objects that describe available screen resolutions for this desktop platform.
GetCamera2D()This action will return the camera that is a part of the current Layer2D.
GetCamera3D()This action will return the camera that is a part of the current Layer3D.
GetCurrentLayer2D()This action will return the current Layer2D which will be used during actions that require a Layer if the user does not specify one, e.
GetCurrentLayer3D()This action will return the current Layer3D which will be used during actions that require a Layer if the user does not specify one, e.
GetDefaultInputTable()
GetDesktopConfiguration()This action will return the game's configuration for desktop platforms.
GetDesktopResolution()This action will return a ScreenResolution object that describes the screen resolution currently in use by the desktop (independent of the resolution used by the game).
GetDirectionalLight(integer index)This action will get a DirectionalLight from the currently active Layer3D, which is stored at the given index inside the layer.
GetDirectionalLights()This action will return an iterator containing all of the DirectionalLight objects stored within the currently active Layer3D.
GetFocus()This action returns the current Item that is focused.
GetFocusManager()
GetHashCode()This action gets the hash code for an object.
GetInputTable(text key)This action retrieves an InputTable with the matching identifier from the Game (if there is one).
GetLayerIterator()This action will return an iterator containing the Game's layers.
GetPointLight(integer index)This action will get a PointLight from the currently active Layer3D, which is stored at the given index inside the layer.
GetPointLights()This action will return an iterator containing all of the PointLight objects stored within the currently active Layer3D.
GetScreenHeight()The GetScreenHeight action will return the height of the screen as an integer.
GetScreenResolution()This action will return the current ScreenResolution being used by the game engine.
GetScreenWidth()The GetScreenWidth action will return the width of the screen as an integer.
GetSecondsBetweenFrames()GetSecondsBetweenFrames will return the number of seconds that has passed between the current frame and the previous one.
GetSimulationThreshold2D()
GetSkybox()The GetSkybox action will return the Skybox in use by the currently active Layer3D.
GetWebConfiguration()This action will return the game's configuration for web platforms.
InitializeLayers()This action sets the game to use the default layers.
IsWindowFocused()This action determines whether or not the main application window has the focus on desktop platforms.
OnExit()The OnExit action is called when the Game is about to close, either because the Exit action was called or because the user requested it (for example, by attempting to close the window on desktop platforms).
Remove(Libraries.Game.Graphics.PointLight light)This action will remove a PointLight from the currently active Layer3D.
Remove(Libraries.Game.Graphics.DirectionalLight light)This action will remove a DirectionalLight from the currently active Layer3D.
Remove(Libraries.Interface.Item3D item)The Remove action will remove an item that was put into the game using the Add action.
Remove(Libraries.Interface.Item2D item)The Remove action will remove an item that was put into the game using the Add action.
RemoveAmbientLight()This action will remove the ambient lighting from the currently active Layer3D.
RemoveCollisionListener(Libraries.Interface.Events.CollisionListener2D listener)Removes a 2D collision listener from the game.
RemoveCollisionListener(Libraries.Interface.Events.CollisionListener3D listener)Removes a 3D collision listener from the game.
RemoveControlActivationListener(Libraries.Interface.Events.ControlActivationListener listener)
RemoveFocusListener(Libraries.Interface.Events.FocusListener listener)This action removes a FocusListener from the Game.
RemoveInputTable(text key)This action removes the InputTable with the matching identifier from the Game (if there is one).
RemoveKeyboardListener(Libraries.Interface.Events.KeyboardListener listener)This action removes a KeyboardListener from the Game.
RemoveLayer(integer index)This action will remove the Layer stored in the Game at the given index within the internal layer array, where the first element (at index 0) of the array is the bottom layer, and further elements of the array are placed on top of previous elements.
RemoveLayer(Libraries.Game.Layer layer)This action will remove the given Layer from the Game.
RemoveMenuChangeListener(Libraries.Interface.Events.MenuChangeListener listener)
RemoveMouseListener(Libraries.Interface.Events.MouseListener listener)This action removes a MouseListener from the Game.
RemoveMouseMovementListener(Libraries.Interface.Events.MouseMovementListener listener)This action removes a MouseMovementListener from the Game.
RemoveMouseWheelListener(Libraries.Interface.Events.MouseWheelListener listener)This action removes a MouseWheelListener from the Game.
RemoveResizeListener(Libraries.Interface.Events.ResizeListener listener)This action removes a ResizeListener from the Game.
RemoveSelectionListener(Libraries.Interface.Events.SelectionListener listener)This action removes a SelectionListener from the Game.
RemoveTabChangeListener(Libraries.Interface.Events.TabChangeListener listener)
RemoveTextChangeListener(Libraries.Interface.Events.TextChangeListener listener)This action removes a TextChangeListener from the Game.
RemoveTextInputListener(Libraries.Interface.Events.TextInputListener listener)This action removes a TextInputListener from the Game.
RemoveTouchListener(Libraries.Interface.Events.TouchListener listener)This action removes a TouchListener from the Game.
RemoveTreeChangeListener(Libraries.Interface.Events.TreeChangeListener listener)
RemoveWindowFocusListener(Libraries.Interface.Events.WindowFocusListener listener)
SetAccessibilityManager(Libraries.Interface.AccessibilityManager accessibilityManager)
SetAmbientLight(Libraries.Game.Graphics.AmbientLight light)This action will set the ambient light on the currently active Layer3D.
SetCamera2D(Libraries.Game.Graphics.Camera cam)This action will set the camera that is being used by the current Layer2D.
SetCamera3D(Libraries.Game.Graphics.Camera cam)This action will set the camera that is being used by the current Layer3D.
SetColorFilter(Libraries.Game.Graphics.Color color)Using SetColorFilter will tint all drawn objects on the currently active Layer2D that do not have their own custom color tint.
SetColorFilter(number red, number green, number blue, number alpha)SetColorFilter can also be called using four number parameters instead of a color object.
SetConfiguration(Libraries.Game.DesktopConfiguration config)This action will set the game configuration when run on desktop platforms.
SetConfiguration(Libraries.Game.WebConfiguration config)This action will set the game configuration when run on web browsers.
SetConfiguration(Libraries.Game.AndroidConfiguration config)This action will set the game configuration when run on an Android device.
SetCurrentLayer2D(Libraries.Game.Layer2D layer)This action will set the currently active Layer2D.
SetCurrentLayer3D(Libraries.Game.Layer3D layer)This action will set the currently active Layer3D.
SetDefaultInputTable(Libraries.Game.InputTable table)
SetFocus(Libraries.Interface.Item item)This action sets the focus on the given item.
SetFocusManager(Libraries.Game.FocusManager focus)
SetFullScreen(boolean fullScreen)This action sets whether the game should launch in full screen or windowed mode on desktop platforms (e.
SetGameName(text name)This action sets the name of the game displayed at the top of the window.
SetGravity2D(Libraries.Compute.Vector2 gravity)Creating input sets for the default focus behavior
SetGravity2D(number gravityX, number gravityY)display:SetupDisplay
SetGravity3D(Libraries.Compute.Vector3 gravity)
SetGravity3D(number gravityX, number gravityY, number gravityZ)
SetLayer(integer index, Libraries.Game.Layer layer)This action will set the given index to use the given Layer, overwriting any Layer that was already at that index.
SetScreenResolution(Libraries.Game.ScreenResolution resolution, boolean adjustCameras)This action will set a game running on a desktop platform to use the given ScreenResolution.
SetScreenResolution(Libraries.Game.ScreenResolution resolution)This action will set a game running on a desktop platform to use the given ScreenResolution.
SetScreenSize(integer width, integer height, boolean adjustCameras)This action sets windowed size of the game (the default size is 800 by 600).
SetScreenSize(integer width, integer height)This action sets windowed size of the game (the default size is 800 by 600).
SetSimulationThreshold2D(number threshold)
SetSkybox(Libraries.Game.Graphics.Skybox skybox)The SetSkybox action will set the currently active Layer3D to use the given Skybox.
SetVSync(boolean vSync)This action enables or disables vSync in the game.
SetWebCanvasName(text name)The SetWebCanvasName action determines which canvas to use on a webpage.
StartGame()The StartGame action will start your game.
Update(number time)The Update action is where most of the game's logic goes.
UseDesktopResolution(boolean adjustCameras)UseDesktopResolution will set the game to use the same display settings as the desktop's current screen resolution (independent of the game).
UseDesktopResolution()UseDesktopResolution will set the game to use the same display settings as the desktop's current screen resolution (independent of the game).

Actions Documentation

Add(Libraries.Game.Graphics.DirectionalLight light)

This action will add a DirectionalLight to the currently active Layer3D.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Model
    use Libraries.Game.Graphics.Color
    use Libraries.Game.Graphics.AmbientLight
    use Libraries.Game.Graphics.DirectionalLight

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            Color color

            Model box
            box:LoadBox(2, 2, 2, color:Teal())
            Add(box)

            AmbientLight ambient
            ambient:SetColor(0.4, 0.4, 0.4, 1)
            SetAmbientLight(ambient)

            DirectionalLight light
            light:SetColor(0.8, 0.8, 0.8, 1)
            light:SetDirection(1, -2, 1)
            Add(light)
        end

    end

Parameters

Add(Libraries.Interface.Item2D item)

The Add action will add an item to the Game. More specifically, the item will be added to the current default Layer2D. This will make the game handle the item for many tasks. For example, adding a Drawable will make it draw on the screen.

Example Code

use Libraries.Game.Game
        use Libraries.Game.Graphics.Drawable

        class Main is Game
            Drawable bunny

            action Main
                StartGame()
            end

            action CreateGame
                bunny:Load("Images/Rabbit.png")
                Add(bunny)
            end
        end

Parameters

Add(Libraries.Game.Graphics.PointLight light)

This action will add a PointLight to the currently active Layer3D.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Model
    use Libraries.Game.Graphics.Color
    use Libraries.Game.Graphics.AmbientLight
    use Libraries.Game.Graphics.PointLight

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            Color color

            Model box
            box:LoadBox(2, 2, 2, color:Teal())
            Add(box)

            AmbientLight ambient
            ambient:SetColor(0.4, 0.4, 0.4, 1)
            SetAmbientLight(ambient)

            PointLight light
            light:SetColor(0.8, 0.8, 0.8, 1)
            light:SetPosition(4, 3, -2)
            light:SetIntensity(30)
            Add(light)
        end

    end

Parameters

Add(Libraries.Interface.Item3D item)

The Add action will add an item to the Game. More specifically, the item will be added to the current default Layer3D. This will make the game handle the item for many tasks. For example, adding a Model will make it draw on the screen.

Example Code

use Libraries.Game.Game
        use Libraries.Game.Graphics.Model

        class Main is Game
            Model car

            action Main
                StartGame()
            end

            action CreateGame
                car:Load("sedan.g3db")
                Add(car)
            end
        end

Parameters

AddCollisionListener(Libraries.Interface.Events.CollisionListener2D listener)

Adds a collision listener to the game that will listen for collisions between 2D game objects that have been flagged as collidable. This listener can respond to collisions by implementing the BeginCollision and FinishCollision actions.

Example Code

use Libraries.Game.Game
        use Libraries.Interface.Item2D
        use Libraries.Interface.Events.CollisionListener2D
        use Libraries.Interface.Events.CollisionEvent2D

        class Main is Game, CollisionListener2D

            Item2D item1
            Item2D item2

            action Main
                StartGame()
            end

            action CreateGame
                AddCollisionListener(me)
                item1:SetCollidable(true)
                item2:SetCollidable(true)
            end
            
            action BeginCollision(CollisionEvent2D event)

            end

            action FinishCollision(CollisionEvent3D event)

            end

        end

Parameters

AddCollisionListener(Libraries.Interface.Events.CollisionListener3D listener)

Adds a collision listener to the game that will listen for collisions between 3D game objects that have been flagged as collidable. This listener can respond to collisions by implementing the BeginCollision and FinishCollision actions.

Example Code

use Libraries.Game.Game
        use Libraries.Interface.Item3D
        use Libraries.Interface.Events.CollisionListener3D
        use Libraries.Interface.Events.CollisionEvent3D

        class Main is Game, CollisionListener3D

            Item3D item1
            Item3D item2

            action Main
                StartGame()
            end

            action CreateGame
                AddCollisionListener(me)
                item1:SetCollidable(true)
                item2:SetCollidable(true)
            end
            
            action BeginCollision(CollisionEvent3D event)

            end

            action FinishCollision(CollisionEvent3D event)

            end

        end

Parameters

AddControlActivationListener(Libraries.Interface.Events.ControlActivationListener listener)

Parameters

AddFocusListener(Libraries.Interface.Events.FocusListener listener)

This action adds a FocusListener to the Game. Whenever the focus changes, the FocusListener will be informed via a FocusEvent.

Parameters

AddInputTable(Libraries.Game.InputTable table)

This action adds an InputTable to the Game. If at any point the currently focused Item has an input group that matches the identifier of the table, the table will be used to trigger Behaviors.

Parameters

AddKeyboardListener(Libraries.Interface.Events.KeyboardListener listener)

This action adds a KeyboardListener to the Game. The listener will be notified of keys being pressed and released.

Example Code

use Libraries.Game.Game
        use Libraries.Interface.Events.KeyboardListener

        class Main is Game

            KeyboardListener listener

            action Main
                StartGame()
            end

            action CreateGame
                AddKeyboardListener(listener)
            end
            
        end

Parameters

AddLayer(integer index, Libraries.Game.Layer layer)

This action will add the given Layer to the Game at the given index. Layers are handled (e.g. updated, drawn, etc.) in the order they're added, starting at index 0 with additional layers placed at higher indices.

Parameters

AddLayer(Libraries.Game.Layer layer)

This action will add a new Layer to the Game. It will be added on top of all other layers currently in the game.

Parameters

AddMenuChangeListener(Libraries.Interface.Events.MenuChangeListener listener)

Parameters

AddMouseListener(Libraries.Interface.Events.MouseListener listener)

This action adds a MouseListener to the Game. The mouse listener will be notified of mouse buttons being clicked and released, so long as the event is not handled by any listeners in the layers.

Example Code

use Libraries.Game.Game
        use Libraries.Interface.Events.MouseListener

        class Main is Game

            MouseListener listener

            action Main
                StartGame()
            end

            action CreateGame
                AddMouseListener(listener)
            end
            
        end

Parameters

AddMouseMovementListener(Libraries.Interface.Events.MouseMovementListener listener)

This action adds a MouseMovementListener to the Game. The listener will be notified of mouse movement and dragging, so long as the event is not handled by any listeners in the layers.

Example Code

use Libraries.Game.Game
        use Libraries.Interface.Events.MouseMovementListener

        class Main is Game

            MouseMovementListener listener

            action Main
                StartGame()
            end

            action CreateGame
                AddMouseMovementListener(listener)
            end
            
        end

Parameters

AddMouseWheelListener(Libraries.Interface.Events.MouseWheelListener listener)

This action adds a MouseWheelListener to the Game. The listener will be notified of mouse wheel scrolling, so long as the event is not handled by any listeners in the layers.

Example Code

use Libraries.Game.Game
        use Libraries.Interface.Events.MouseWheelListener

        class Main is Game

            MouseWheelListener listener

            action Main
                StartGame()
            end

            action CreateGame
                AddMouseWheelListener(listener)
            end
            
        end

Parameters

AddResizeListener(Libraries.Interface.Events.ResizeListener listener)

This action adds a ResizeListener to the Game. The listener will be notified when the size of the Game rendering space changes size, such as a window being resized or made fullscreen, or a phone rotating orientation.

Example Code

use Libraries.Game.Game
        use Libraries.Interface.Events.ResizeListener

        class Main is Game

            ResizeListener listener

            action Main
                StartGame()
            end

            action CreateGame
                AddResizeListener(listener)
            end
            
        end

Parameters

AddSelectionListener(Libraries.Interface.Events.SelectionListener listener)

This action adds a SelectionListener to the Game. Whenever a Selection is changed, the SelectionListener will be informed via a SelectionEvent.

Parameters

AddTabChangeListener(Libraries.Interface.Events.TabChangeListener listener)

Parameters

AddTextChangeListener(Libraries.Interface.Events.TextChangeListener listener)

This action adds a TextChangeListener to the Game. When text is changed (such as in a TextBox) the TextChangeListener will be informed via a TextChangeEvent.

Parameters

AddTextInputListener(Libraries.Interface.Events.TextInputListener listener)

This action adds a TextInputListener to the Game. The listener will be notified when the Game receives textual input from the keyboard.

Example Code

use Libraries.Game.Game
        use Libraries.Interface.Events.TextInputListener

        class Main is Game

            TextInputListener listener

            action Main
                StartGame()
            end

            action CreateGame
                AddTextInputListener(listener)
            end
            
        end

Parameters

AddTouchListener(Libraries.Interface.Events.TouchListener listener)

This action adds a TouchListener to the Game. The touch listener will be notified when the user interacts with a touch screen, so long as the event is not handled by any items in the layers.

Example Code

use Libraries.Game.Game
        use Libraries.Interface.Events.TouchListener

        class Main is Game

            TouchListener listener

            action Main
                StartGame()
            end

            action CreateGame
                AddTouchListener(listener)
            end
            
        end

Parameters

AddTreeChangeListener(Libraries.Interface.Events.TreeChangeListener listener)

Parameters

AddWindowFocusListener(Libraries.Interface.Events.WindowFocusListener listener)

Parameters

Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns a CompareResult. The compare result is either larger if this hash code is larger than the object passed as a parameter, smaller, or equal.

Example Code

use Libraries.Language.Support.CompareResult
        Object o
        Object t
        CompareResult result = o:Compare(t)

Parameters

Return

Libraries.Language.Support.CompareResult: The Compare result, Smaller, Equal, or Larger.

ContinueGame()

This action is used by the Game to regularly handle core engine processes. It is automatically called by the Game when necessary, and should never be used by users.

CreateGame()

CreateGame is called when you first start the game, and is useful for setting up things that need to be initialized before they can be used, like loading Drawables.

Example Code

use Libraries.Game.Game
        use Libraries.Game.Graphics.Drawable

        class Main is Game

            Drawable bunny

            action Main
                StartGame()
            end

            action CreateGame
                bunny:Load("Rabbit.png")
                Add(bunny)
            end
            
        end

EnablePhysics2D(boolean flag)

Parameters

EnablePhysics3D(boolean flag)

Parameters

EnableResizing(boolean resize)

This action enables or disables resizing the game window by dragging the edges of the screen. Passing a value of true enables it, a value of false disables it. Resizing is disabled by default. It is only relevant for games which are run on desktops. This action should be called before calling StartGame().

Example Code

use Libraries.Game.Game

        class Main is Game

            action Main
                EnableResizing(true)
                StartGame()
            end
        end

Parameters

EnableTextureAutoResizing(boolean resize)

This action enables or disables auto resizing of textures if the game window is resized. Passing a value of true enables it, a value of false disables it. Texture auto resizing is enabled by default. This action should be called before calling StartGame(). This option is only relevant on desktop platforms.

Example Code

use Libraries.Game.Game

        class Main is Game

            action Main
                EnableTextureAutoResizing(false)
                StartGame()
            end
        end

Parameters

Equals(Libraries.Language.Object object)

This action determines if two objects are equal based on their hash code values.

Example Code

use Libraries.Language.Object
        use Libraries.Language.Types.Text
        Object o
        Text t
        boolean result = o:Equals(t)

Parameters

Return

boolean: True if the hash codes are equal and false if they are not equal.

Exit()

The Exit action is used to tell the Game class to close the application after it completes the current iteration of the main loop.

Example Code

use Libraries.Game.Game

        class Main is Game

            number timer = 0

            action Main
                StartGame()
            end

            action Update(number time)
                timer = timer + time
                if timer > 3
                    Exit()
                    output "Exiting the game!"
                end
            end
            
        end

FocusWindow()

This action asks the operating system to give the main application window the focus. This only works on desktop platforms - on other platforms, this call is ignored.

GetAccessibilityManager()

Return

Libraries.Interface.AccessibilityManager:

GetAmbientLight()

This action will return a new AmbientLight object which contains the ambient lighting data of the currently active Layer3D.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Model
    use Libraries.Game.Graphics.Color
    use Libraries.Game.Graphics.AmbientLight
    use Libraries.Game.Graphics.DirectionalLight

    class Main is Game

        AmbientLight myLight

        action Main
            StartGame()
        end

        action CreateGame
            Color color

            Model box
            box:LoadBox(2, 2, 2, color:Teal())
            Add(box)

            AmbientLight ambient
            ambient:SetColor(0.4, 0.4, 0.4, 1)
            SetAmbientLight(ambient)

            DirectionalLight light
            light:SetColor(0.8, 0.8, 0.8, 1)
            light:SetDirection(1, -2, 1)
            Add(light)

            myLight = GetAmbientLight()
        end

    end

Return

Libraries.Game.Graphics.AmbientLight: The AmbientLight of the currently active Layer3D.

GetAndroidConfiguration()

This action will return the game's configuration for Android devices.

Example Code

use Libraries.Game.Game
    use Libraries.Game.AndroidConfiguration

    class Main is Game

        action Main
            AndroidConfiguration configuration = GetAndroidConfiguration()
            configuration:defaultOrientation = configuration:PORTRAIT
            StartGame()
        end

    end

Return

Libraries.Game.AndroidConfiguration: The current AndroidConfiguration.

GetAvailableResolutions()

This action will return an Array of ScreenResolution objects that describe available screen resolutions for this desktop platform. If this action is called on a non-desktop platform, the returned array will be undefined.

Example Code

use Libraries.Game.Game
    use Libraries.Game.ScreenResolution
    use Libraries.Containers.Array

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            Array<ScreenResolution> array = GetAvailableResolutions()
            output "The following resolutions are supported by the monitor:"

            integer counter = 0
            repeat while counter < array:GetSize()
                ScreenResolution resolution = array:Get(counter)

                output ""
                output "Resolution #" + counter
                output "Dimensions: " + resolution:GetWidth() + " x " + resolution:GetHeight()
                output "Refresh Rate: " + resolution:GetFrequency()
                output "Bits per Pixel: " + resolution:GetBitsPerPixel()
                output "Supports Fullscreen: " + resolution:IsFullscreen()

                counter = counter + 1
            end
        end
    end

Return

Libraries.Containers.Array: An array of ScreenResolutions that can be used by the desktop display.

GetCamera2D()

This action will return the camera that is a part of the current Layer2D.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Camera

    class Main is Game
    
        Camera camera = undefined

        action Main
            StartGame()
        end

        action CreateGame
            camera = GetCamera2D()
        end

    end

Return

Libraries.Game.Graphics.Camera: The Camera in use by the currently active Layer2D.

GetCamera3D()

This action will return the camera that is a part of the current Layer3D.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Camera

    class Main is Game
    
        Camera camera = undefined

        action Main
            StartGame()
        end

        action CreateGame
            camera = GetCamera3D()
        end

    end

Return

Libraries.Game.Graphics.Camera: The Camera in use by the currently active Layer3D.

GetCurrentLayer2D()

This action will return the current Layer2D which will be used during actions that require a Layer if the user does not specify one, e.g., using the Add(Item2D) action.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Layer2D

    class Main is Game
    
        Layer2D activeLayer = undefined

        action Main
            StartGame()
        end

        action CreateGame
            activeLayer = GetCurrentLayer2D()
        end

    end

Return

Libraries.Game.Layer2D: The currently active Layer2D.

GetCurrentLayer3D()

This action will return the current Layer3D which will be used during actions that require a Layer if the user does not specify one, e.g., using the Add(Item3D) action.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Layer3D

    class Main is Game
    
        Layer3D activeLayer = undefined

        action Main
            StartGame()
        end

        action CreateGame
            activeLayer = GetCurrentLayer3D()
        end

    end

Return

Libraries.Game.Layer3D: The currently active Layer3D.

GetDefaultInputTable()

Return

Libraries.Game.InputTable:

GetDesktopConfiguration()

This action will return the game's configuration for desktop platforms.

Example Code

use Libraries.Game.Game
    use Libraries.Game.DesktopConfiguration

    class Main is Game

        action Main
            DesktopConfiguration configuration = GetDesktopConfiguration()
            output "The default width and height of the Game are " + configuration:width + ", " + configuration:height
            StartGame()
        end

    end

Return

Libraries.Game.DesktopConfiguration: The current DesktopConfiguration.

GetDesktopResolution()

This action will return a ScreenResolution object that describes the screen resolution currently in use by the desktop (independent of the resolution used by the game). This is only effective on desktop platforms - using this action on non-desktop platforms will return undefined.

Example Code

use Libraries.Game.Game
    use Libraries.Game.ScreenResolution

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            ScreenResolution resolution = GetDesktopResolution()
            output "The dimensions of the desktop's resolution is " + resolution:GetWidth() + " x " + resolution:GetHeight()
        end
    end

Return

Libraries.Game.ScreenResolution: A ScreenResoluton object describing the desktop's resolution.

GetDirectionalLight(integer index)

This action will get a DirectionalLight from the currently active Layer3D, which is stored at the given index inside the layer. If there are no DirectionalLights within the layer, or if the index is out of bounds, then an error will be thrown.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Model
    use Libraries.Game.Graphics.Color
    use Libraries.Game.Graphics.AmbientLight
    use Libraries.Game.Graphics.DirectionalLight

    class Main is Game

        DirectionalLight myLight

        action Main
            StartGame()
        end

        action CreateGame
            Color color

            Model box
            box:LoadBox(2, 2, 2, color:Teal())
            Add(box)

            AmbientLight ambient
            ambient:SetColor(0.4, 0.4, 0.4, 1)
            SetAmbientLight(ambient)

            DirectionalLight light
            light:SetColor(0.8, 0.8, 0.8, 1)
            light:SetDirection(1, -2, 1)
            Add(light)

            myLight = GetDirectionalLight(0)
        end

    end

Parameters

Return

Libraries.Game.Graphics.DirectionalLight:

GetDirectionalLights()

This action will return an iterator containing all of the DirectionalLight objects stored within the currently active Layer3D.

Return

Libraries.Containers.Iterator: An Iterator containing all DirectionalLights on the currently active Layer3D.

GetFocus()

This action returns the current Item that is focused.

Return

Libraries.Interface.Item: The currently focused Item.

GetFocusManager()

Return

Libraries.Game.FocusManager:

GetHashCode()

This action gets the hash code for an object.

Example Code

Object o
        integer hash = o:GetHashCode()

Return

integer: The integer hash code of the object.

GetInputTable(text key)

This action retrieves an InputTable with the matching identifier from the Game (if there is one). If there is no InputTable with this identifier, the action will return undefined.

Parameters

Return

Libraries.Game.InputTable:

GetLayerIterator()

This action will return an iterator containing the Game's layers. The first Layer in the iterator will be the bottom Layer, and each following Layer in the iterator will be the Layer on top of the previous one.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.OrthographicCamera

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            OrthographicCamera camera
            SetCamera2D(camera)
        end

    end

Return

Libraries.Containers.Iterator: An Iterator containing all of the Layers added to the Game.

GetPointLight(integer index)

This action will get a PointLight from the currently active Layer3D, which is stored at the given index inside the layer. If there are no PointLights within the layer, or if the index is out of bounds, then an error will be thrown.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Model
    use Libraries.Game.Graphics.Color
    use Libraries.Game.Graphics.AmbientLight
    use Libraries.Game.Graphics.PointLight

    class Main is Game

        PointLight myLight

        action Main
            StartGame()
        end

        action CreateGame
            Color color

            Model box
            box:LoadBox(2, 2, 2, color:Teal())
            Add(box)

            AmbientLight ambient
            ambient:SetColor(0.4, 0.4, 0.4, 1)
            SetAmbientLight(ambient)

            PointLight light
            light:SetColor(0.8, 0.8, 0.8, 1)
            light:SetPosition(4, 3, -2)
            light:SetIntensity(30)
            Add(light)

            myLight = GetPointLight(0)
        end

    end

Parameters

Return

Libraries.Game.Graphics.PointLight:

GetPointLights()

This action will return an iterator containing all of the PointLight objects stored within the currently active Layer3D.

Return

Libraries.Containers.Iterator: An Iterator containing all PointLights on the currently active Layer3D.

GetScreenHeight()

The GetScreenHeight action will return the height of the screen as an integer.

Example Code

use Libraries.Game.Game

        class Main is Game

            action Main
                StartGame()
            end

            action CreateGame
                output GetScreenHeight()
            end
        end

Return

integer: The height of the screen.

GetScreenResolution()

This action will return the current ScreenResolution being used by the game engine. This is only effective on desktop platforms - on non-desktop platforms, this will return undefined instead.

Example Code

use Libraries.Game.Game
    use Libraries.Game.ScreenResolution

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            ScreenResolution resolution = GetScreenResolution()
            output "The default resolution's dimensions are " + resolution:GetWidth() + " x " + resolution:GetHeight()
        end
    end

Return

Libraries.Game.ScreenResolution:

GetScreenWidth()

The GetScreenWidth action will return the width of the screen as an integer.

Example Code

use Libraries.Game.Game

        class Main is Game

            action Main
                StartGame()
            end

            action CreateGame
                output GetScreenWidth()
            end
        end

Return

integer: The width of the screen.

GetSecondsBetweenFrames()

GetSecondsBetweenFrames will return the number of seconds that has passed between the current frame and the previous one. Frames are the still images drawn on the screen in rapid succession to make the images appear to move. Note that the value from this field is approximately the same value as the parameter in the Update action.

Example Code

use Libraries.Game.Game

        class Main is Game

            action Main
                StartGame()
            end

            action Update(number time)
                output "Seconds since last frame: " + GetSecondsBetweenFrames()
            end
        end

Return

number: How many seconds have passed since the previous frame.

GetSimulationThreshold2D()

Return

number

GetSkybox()

The GetSkybox action will return the Skybox in use by the currently active Layer3D. By default, a Layer3D does not start with a Skybox, so using this on a Layer3D that hasn't had a Skybox assigned to it will return undefined.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Skybox

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            Skybox skybox
            // Assuming we have a folder named "skybox" containing our six images.
            skybox:Load("skybox/right.jpg", "skybox/left.jpg", "skybox/top.jpg", "skybox/bottom.jpg", "skybox/front.jpg", "skybox/back.jpg")
            SetSkybox(skybox)

            // We can get the Skybox back from the layer using GetSkybox().
            Skybox currentSkybox = GetSkybox()
        end

    end

Return

Libraries.Game.Graphics.Skybox: The Skybox in use by the current Layer3D.

GetWebConfiguration()

This action will return the game's configuration for web platforms.

Example Code

use Libraries.Game.Game
    use Libraries.Game.WebConfiguration

    class Main is Game

        action Main
            WebConfiguration configuration = GetWebConfiguration()
            configuration:capFramesPerSecond = true
            StartGame()
        end

    end

Return

Libraries.Game.WebConfiguration: The current WebConfiguration.

InitializeLayers()

This action sets the game to use the default layers. The default layers consist of a single 3D layer, with a single 2D layer on top of it. This action is automatically called by the Game engine during StartGame. Users may use it again to "reset" the layers to default, but generally users will not need to use this action directly.

IsWindowFocused()

This action determines whether or not the main application window has the focus on desktop platforms. On non-desktop platforms, this always returns false.

Return

boolean:

OnExit()

The OnExit action is called when the Game is about to close, either because the Exit action was called or because the user requested it (for example, by attempting to close the window on desktop platforms). The action must return a boolean value representing whether or not the application should proceed to shut down. If the returned value is true, the application will shut down. If it is false, the program will continue running instead. Users should always make sure that it is possible for OnExit to return true in some cases to allow the user to close the program. This action doesn't prevent the Game from shutting down on all platforms. For example, mobile devices typically don't allow an application to keep itself open after a close has been requested.

Example Code

use Libraries.Game.Game

    class Main is Game
        integer countdown = 3

        action Main
            StartGame()
        end

        action OnExit returns boolean
            if countdown <= 0
                return true
            end
            output "Countdown: " + countdown
            countdown = countdown - 1
            return false
        end
    end

Return

boolean: True if the Game should be allowed to close, false if the Game should continue running.

Remove(Libraries.Game.Graphics.PointLight light)

This action will remove a PointLight from the currently active Layer3D.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Model
    use Libraries.Game.Graphics.Color
    use Libraries.Game.Graphics.AmbientLight
    use Libraries.Game.Graphics.PointLight

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            Color color

            Model box
            box:LoadBox(2, 2, 2, color:Teal())
            Add(box)

            AmbientLight ambient
            ambient:SetColor(0.4, 0.4, 0.4, 1)
            SetAmbientLight(ambient)

            PointLight light
            light:SetColor(0.8, 0.8, 0.8, 1)
            light:SetPosition(4, 3, -2)
            light:SetIntensity(30)
            Add(light)

            Remove(light)
        end

    end

Parameters

Remove(Libraries.Game.Graphics.DirectionalLight light)

This action will remove a DirectionalLight from the currently active Layer3D.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Model
    use Libraries.Game.Graphics.Color
    use Libraries.Game.Graphics.AmbientLight
    use Libraries.Game.Graphics.DirectionalLight

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            Color color

            Model box
            box:LoadBox(2, 2, 2, color:Teal())
            Add(box)

            AmbientLight ambient
            ambient:SetColor(0.4, 0.4, 0.4, 1)
            SetAmbientLight(ambient)

            DirectionalLight light
            light:SetColor(0.8, 0.8, 0.8, 1)
            light:SetDirection(1, -2, 1)
            Add(light)

            Remove(light)
        end

    end

Parameters

Remove(Libraries.Interface.Item3D item)

The Remove action will remove an item that was put into the game using the Add action. More specifically, the item will be removed from the current default Layer3D. The game will no longer handle removed items - for example, removing a Model will make the game engine stop drawing it.

Example Code

use Libraries.Game.Game
        use Libraries.Game.Graphics.Model

        class Main is Game
            Model car

            action Main
                StartGame()
            end

            action CreateGame
                car:Load("sedan.g3db")
                Add(car)

                // If we don't have this remove command, the bunny will draw.
                Remove(car)
            end
        end

Parameters

Remove(Libraries.Interface.Item2D item)

The Remove action will remove an item that was put into the game using the Add action. More specifically, the item will be removed from the current default Layer2D. The game will no longer handle removed items - for example, removing a Drawable will make the game engine stop drawing it.

Example Code

use Libraries.Game.Game
        use Libraries.Game.Graphics.Drawable

        class Main is Game
            Drawable bunny

            action Main
                StartGame()
            end

            action CreateGame
                bunny:Load("Images/Rabbit.png")
                Add(bunny)

                // If we don't have this remove command, the bunny will draw.
                Remove(bunny)
            end
        end

Parameters

RemoveAmbientLight()

This action will remove the ambient lighting from the currently active Layer3D.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Model
    use Libraries.Game.Graphics.Color
    use Libraries.Game.Graphics.AmbientLight
    use Libraries.Game.Graphics.PointLight

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            Color color

            Model box
            box:LoadBox(2, 2, 2, color:Teal())
            Add(box)

            AmbientLight ambient
            ambient:SetColor(0.4, 0.4, 0.4, 1)
            SetAmbientLight(ambient)

            PointLight light
            light:SetColor(0.8, 0.8, 0.8, 1)
            light:SetPosition(4, 3, -2)
            light:SetIntensity(30)
            Add(light)

            RemoveAmbientLight()
        end

    end

RemoveCollisionListener(Libraries.Interface.Events.CollisionListener2D listener)

Removes a 2D collision listener from the game. This collision listener will no longer receive collision events from the game engine.

Example Code

use Libraries.Game.Game
        use Libraries.Interface.Item2D
        use Libraries.Interface.Events.CollisionListener2D
        use Libraries.Interface.Events.CollisionEvent2D

        class Main is Game, CollisionListener2D

            Item2D item1
            Item2D item2

            action Main
                StartGame()
            end

            action CreateGame
                AddCollisionListener(me)
                item1:SetCollidable(true)
                item2:SetCollidable(true)

                RemoveCollisionListener(me)
            end
            
            action BeginCollision(CollisionEvent2D event)

            end

            action FinishCollision(CollisionEvent2D event)

            end

        end

Parameters

RemoveCollisionListener(Libraries.Interface.Events.CollisionListener3D listener)

Removes a 3D collision listener from the game. This collision listener will no longer receive collision events from the game engine.

Example Code

use Libraries.Game.Game
        use Libraries.Interface.Item3D
        use Libraries.Interface.Events.CollisionListener3D
        use Libraries.Interface.Events.CollisionEvent3D

        class Main is Game, CollisionListener3D

            Item3D item1
            Item3D item2

            action Main
                StartGame()
            end

            action CreateGame
                AddCollisionListener(me)
                item1:SetCollidable(true)
                item2:SetCollidable(true)

                RemoveCollisionListener(me)
            end
            
            action BeginCollision(CollisionEvent3D event)

            end

            action FinishCollision(CollisionEvent3D event)

            end

        end

Parameters

RemoveControlActivationListener(Libraries.Interface.Events.ControlActivationListener listener)

Parameters

RemoveFocusListener(Libraries.Interface.Events.FocusListener listener)

This action removes a FocusListener from the Game. The given FocusListener will no longer be informed of FocusEvents when the focus changes.

Parameters

RemoveInputTable(text key)

This action removes the InputTable with the matching identifier from the Game (if there is one). If the InputTable is found, it will be returned - otherwise, the action returns undefined.

Parameters

Return

Libraries.Game.InputTable:

RemoveKeyboardListener(Libraries.Interface.Events.KeyboardListener listener)

This action removes a KeyboardListener from the Game. The listener will no longer receive events for key presses and releases.

Example Code

use Libraries.Game.Game
        use Libraries.Interface.Events.KeyboardListener

        class Main is Game

            KeyboardListener listener

            action Main
                StartGame()
            end

            action CreateGame
                AddKeyboardListener(listener)

                RemoveKeyboardListener(listener)
            end
            
        end

Parameters

RemoveLayer(integer index)

This action will remove the Layer stored in the Game at the given index within the internal layer array, where the first element (at index 0) of the array is the bottom layer, and further elements of the array are placed on top of previous elements.

Parameters

RemoveLayer(Libraries.Game.Layer layer)

This action will remove the given Layer from the Game.

Parameters

RemoveMenuChangeListener(Libraries.Interface.Events.MenuChangeListener listener)

Parameters

RemoveMouseListener(Libraries.Interface.Events.MouseListener listener)

This action removes a MouseListener from the Game. The mouse listener will no longer receive mouse events from the Game. If the given MouseListener was not part of the Game, then this will have no effect.

Example Code

use Libraries.Game.Game
        use Libraries.Interface.Events.MouseListener

        class Main is Game

            MouseListener listener

            action Main
                StartGame()
            end

            action CreateGame
                AddMouseListener(listener)

                RemoveMouseListener(listener)
            end
            
        end

Parameters

RemoveMouseMovementListener(Libraries.Interface.Events.MouseMovementListener listener)

This action removes a MouseMovementListener from the Game. The listener will no longer receive events from the Game. If the given MouseMovementListener was not part of the Game, then this will have no effect.

Example Code

use Libraries.Game.Game
        use Libraries.Interface.Events.MouseMovementListener

        class Main is Game

            MouseMovementListener listener

            action Main
                StartGame()
            end

            action CreateGame
                AddMouseMovementListener(listener)

                RemoveMouseMovementListener(listener)
            end
            
        end

Parameters

RemoveMouseWheelListener(Libraries.Interface.Events.MouseWheelListener listener)

This action removes a MouseWheelListener from the Game. The listener will no longer receive events from the Game. If the given MouseWheelListener is not part of the Game, then this will have no effect.

Example Code

use Libraries.Game.Game
        use Libraries.Interface.Events.MouseWheelListener

        class Main is Game

            MouseWheelListener listener

            action Main
                StartGame()
            end

            action CreateGame
                AddMouseWheelListener(listener)

                RemoveMouseWheelListener(listener)
            end
            
        end

Parameters

RemoveResizeListener(Libraries.Interface.Events.ResizeListener listener)

This action removes a ResizeListener from the Game. The listener will no longer receive resize events.

Example Code

use Libraries.Game.Game
        use Libraries.Interface.Events.ResizeListener

        class Main is Game

            ResizeListener listener

            action Main
                StartGame()
            end

            action CreateGame
                AddResizeListener(listener)

                RemoveResizeListener(listener)
            end
            
        end

Parameters

RemoveSelectionListener(Libraries.Interface.Events.SelectionListener listener)

This action removes a SelectionListener from the Game. The SelectionListener will no longer be informed when Selections change.

Parameters

RemoveTabChangeListener(Libraries.Interface.Events.TabChangeListener listener)

Parameters

RemoveTextChangeListener(Libraries.Interface.Events.TextChangeListener listener)

This action removes a TextChangeListener from the Game. It will no longer receive TextChangeEvents.

Parameters

RemoveTextInputListener(Libraries.Interface.Events.TextInputListener listener)

This action removes a TextInputListener from the Game. The listener will no longer receive events for text input from the keyboard.

Example Code

use Libraries.Game.Game
        use Libraries.Interface.Events.TextInputListener

        class Main is Game

            TextInputListener listener

            action Main
                StartGame()
            end

            action CreateGame
                AddTextInputListener(listener)

                RemoveTextInputListener(listener)
            end
            
        end

Parameters

RemoveTouchListener(Libraries.Interface.Events.TouchListener listener)

This action removes a TouchListener from the Game. The listener will no longer receive TouchEvents from the Game. If the given TouchListener is not a part of the Game, this action will have no effect.

Example Code

use Libraries.Game.Game
        use Libraries.Interface.Events.TouchListener

        class Main is Game

            TouchListener listener

            action Main
                StartGame()
            end

            action CreateGame
                AddTouchListener(listener)

                RemoveTouchListener(listener)
            end
            
        end

Parameters

RemoveTreeChangeListener(Libraries.Interface.Events.TreeChangeListener listener)

Parameters

RemoveWindowFocusListener(Libraries.Interface.Events.WindowFocusListener listener)

Parameters

SetAccessibilityManager(Libraries.Interface.AccessibilityManager accessibilityManager)

Parameters

SetAmbientLight(Libraries.Game.Graphics.AmbientLight light)

This action will set the ambient light on the currently active Layer3D.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Model
    use Libraries.Game.Graphics.Color
    use Libraries.Game.Graphics.AmbientLight
    use Libraries.Game.Graphics.DirectionalLight

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            Color color

            Model box
            box:LoadBox(2, 2, 2, color:Teal())
            Add(box)

            AmbientLight ambient
            ambient:SetColor(0.4, 0.4, 0.4, 1)
            SetAmbientLight(ambient)

            DirectionalLight light
            light:SetColor(0.8, 0.8, 0.8, 1)
            light:SetDirection(1, -2, 1)
            Add(light)
        end

    end

Parameters

SetCamera2D(Libraries.Game.Graphics.Camera cam)

This action will set the camera that is being used by the current Layer2D.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.OrthographicCamera

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            OrthographicCamera camera
            SetCamera2D(camera)
        end

    end

Parameters

SetCamera3D(Libraries.Game.Graphics.Camera cam)

This action will set the camera that is being used by the current Layer3D.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.PerspectiveCamera

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            PerspectiveCamera camera
            SetCamera3D(camera)
        end

    end

Parameters

SetColorFilter(Libraries.Game.Graphics.Color color)

Using SetColorFilter will tint all drawn objects on the currently active Layer2D that do not have their own custom color tint. For example, using a red color filter will make all objects drawn on the currently active Layer2D to appear to be more red.

Example Code

use Libraries.Game.Game
        use Libraries.Game.Graphics.Drawable
        use Libraries.Game.Graphics.Color

        class Main is Game
        
            Drawable bunny
            Color tint

            action Main
                StartGame()
            end

            action CreateGame
                bunny:Load("Rabbit.png")
                Add(bunny)
                
                tint = tint:Maroon()

                SetColorFilter(tint)
            end
        end

Parameters

SetColorFilter(number red, number green, number blue, number alpha)

SetColorFilter can also be called using four number parameters instead of a color object. The four parameters are the red, green, blue, and opacity of the filter, respectively. All four of the parameters should be between 0 and 1, representing between 0% and 100% of that color component. For example, a value of 0 for red means that the tinting color will have no red, while a value of 1 will have all red components. An opacity of 0 is totally transparent, while an opacity of 1 will be totally visible.

Example Code

use Libraries.Game.Game
        use Libraries.Game.Graphics.Drawable

        class Main is Game
        
            Drawable bunny

            action Main
                StartGame()
            end

            action CreateGame
                bunny:Load("Rabbit.png")
                Add(bunny)
                
                // Our color will have 75% red, 0% green, 75% blue, and be
                // totally opaque. This will tint our bunny image purple.

                SetColorFilter(0.75, 0, 0.75, 1)
            end
        end

Parameters

SetConfiguration(Libraries.Game.DesktopConfiguration config)

This action will set the game configuration when run on desktop platforms. The configuration contains data that affect many technical details of the game, such as how large the screen will be. This should be set before calling StartGame().

Example Code

use Libraries.Game.Game
    use Libraries.Game.DesktopConfiguration

    class Main is Game

        action Main
            DesktopConfiguration configuration
            configuration:width = 1000
            configuration:height = 800
            configuration:resizable = true
            SetConfiguration(configuration)
            StartGame()
        end

    end

Parameters

SetConfiguration(Libraries.Game.WebConfiguration config)

This action will set the game configuration when run on web browsers. The configuration contains data that affect many technical details of the game, such as whether or not to limit the FPS. This should be set before calling StartGame().

Example Code

use Libraries.Game.Game
    use Libraries.Game.WebConfiguration

    class Main is Game

        action Main
            WebConfiguration configuration
            configuration:canvasID = "game-canvas"
            configuration:capFramesPerSecond = true
            configuration:framesPerSecondLimit = 45
            SetConfiguration(configuration)
            StartGame()
        end

    end

Parameters

SetConfiguration(Libraries.Game.AndroidConfiguration config)

This action will set the game configuration when run on an Android device. The configuration contains data that affect many technical details of the game, such as whether the device should use portrait or landscape orientation while running the game. This should be set before calling StartGame().

Example Code

use Libraries.Game.Game
    use Libraries.Game.AndroidConfiguration

    class Main is Game

        action Main
            AndroidConfiguration configuration
            configuration:defaultOrientation = configuration:PORTRAIT
            SetConfiguration(configuration)
            StartGame()
        end

    end

Parameters

SetCurrentLayer2D(Libraries.Game.Layer2D layer)

This action will set the currently active Layer2D. The current Layer2D will receive the effect of actions such as Add(Item2D) or Remove(Item2D), which do not specify which Layer to act upon. Other actions that specify an index or a Layer to act upon will ignore this setting.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Layer2D
    use Libraries.Game.Graphics.Drawable
    use Libraries.Game.Graphics.Color

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            Color color

            Drawable box1
            box1:LoadFilledRectangle(200, 200, color:Maroon())
            box1:SetPosition(250, 150)

            Drawable box2
            box2:LoadFilledRectangle(200, 200, color:Teal())
            box2:SetPosition(350, 250)

            Layer2D layer
            AddLayer(0, layer)

            Add(box1)

            SetCurrentLayer2D(layer)
            Add(box2)
        end

    end

Parameters

SetCurrentLayer3D(Libraries.Game.Layer3D layer)

This action will set the currently active Layer3D. The current Layer3D will receive the effect of actions such as Add(Item3D) or Remove(Item3D), which do not specify which Layer to act upon. Other actions that specify an index or a Layer to act upon will ignore this setting.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Layer3D
    use Libraries.Game.Graphics.Model
    use Libraries.Game.Graphics.Color

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            Color color

            Model box1
            box1:LoadBox(2, 2, 2, color:Teal())
            box1:SetPosition(0, 0, 5)

            Model box2
            box2:LoadBox(5, 5, 5, color:Maroon())
            box2:SetPosition(0, 0, 2)

            Layer3D layer
            AddLayer(0, layer)

            Add(box1)

            SetCurrentLayer3D(layer)
            Add(box2)
        end

    end

Parameters

SetDefaultInputTable(Libraries.Game.InputTable table)

Parameters

SetFocus(Libraries.Interface.Item item)

This action sets the focus on the given item. This will immediately notify all focus listeners on the previous focus that the Item has lost focus, and all focus listeners on the new focus that the Item has gained focus.

Parameters

SetFocusManager(Libraries.Game.FocusManager focus)

Parameters

SetFullScreen(boolean fullScreen)

This action sets whether the game should launch in full screen or windowed mode on desktop platforms (e.g. Windows or Mac) when the game is started. By default, games are windowed. This action should be called before calling StartGame().

Example Code

use Libraries.Game.Game

    class Main is Game

        number timer = 0

        action Main
            SetFullScreen(true)
            StartGame()
        end

        action CreateGame
        end

        action Update(number seconds)
            timer = timer + seconds
            if timer > 3
                output "Exiting game..."
                Exit()
            end
        end

    end

Parameters

SetGameName(text name)

This action sets the name of the game displayed at the top of the window. The default name is "Game". This action should be called before calling StartGame(). This will have no effect on non-Desktop platforms.

Example Code

use Libraries.Game.Game

        class Main is Game

            action Main
                SetGameName("Mariachi Band Simulator 3000")
                StartGame()
            end
        end

Parameters

SetGravity2D(Libraries.Compute.Vector2 gravity)

Creating input sets for the default focus behavior

Parameters

SetGravity2D(number gravityX, number gravityY)

display:SetupDisplay

Parameters

SetGravity3D(Libraries.Compute.Vector3 gravity)

Parameters

SetGravity3D(number gravityX, number gravityY, number gravityZ)

Parameters

SetLayer(integer index, Libraries.Game.Layer layer)

This action will set the given index to use the given Layer, overwriting any Layer that was already at that index. This will not force disposal of any resources that the Layer's items may have been using.

Parameters

SetScreenResolution(Libraries.Game.ScreenResolution resolution, boolean adjustCameras)

This action will set a game running on a desktop platform to use the given ScreenResolution. This will have no effect on non-desktop platforms. If the second parameter is set to true, then this action will also adjust the size of the cameras on the default 2D and 3D layers to match the new screen size. If the parameter is false, then the cameras will not be changed.

Example Code

use Libraries.Game.Game
    use Libraries.Game.ScreenResolution
    use Libraries.Game.InputMonitor
    use Libraries.Interface.Events.KeyboardEvent
    use Libraries.Game.Graphics.Drawable

    class Main is Game

        InputMonitor monitor
        KeyboardEvent keys

        action Main
            StartGame()
        end

        action CreateGame
            Drawable leftSquare
            leftSquare:LoadFilledRectangle(100, 100)
            leftSquare:SetPosition(0, 250)
            Add(leftSquare)

            Drawable rightSquare
            rightSquare:LoadFilledRectangle(100, 100)
            rightSquare:SetPosition(700, 250)
            Add(rightSquare)
        end

        action Update(number seconds)
            // Pressing the spacebar will set the game to use the desktop's resolution.
            // If the boolean is false, the cameras will not be adjusted to the new screen size,
            // making them appear to be zoomed in on the original area.
            // If the boolean is true (or omitted), the cameras will be adjusted to view the
            // new size of the screen. Drawables will remain at their original size and position.
            if monitor:IsKeyPressed(keys:SPACE)
                ScreenResolution resolution = GetDesktopResolution()
                SetScreenResolution(resolution, false)
            end
            // Using the desktop resolution will typically make the game go fullscreen.
            // To exit the game, the user can press the ESCAPE key.
            if monitor:IsKeyPressed(keys:ESCAPE)
                Exit()
            end
        end
    end

Parameters

SetScreenResolution(Libraries.Game.ScreenResolution resolution)

This action will set a game running on a desktop platform to use the given ScreenResolution. This will have no effect on non-desktop platforms. Using this action will also adjust the size of the cameras on the default 2D and 3D layers to match the new screen size. To change the screen size without changing the cameras, use SetScreenResolution(ScreenResolution, false).

Example Code

use Libraries.Game.Game
    use Libraries.Game.ScreenResolution
    use Libraries.Game.InputMonitor
    use Libraries.Interface.Events.KeyboardEvent

    class Main is Game

        InputMonitor monitor
        KeyboardEvent keys

        action Main
            StartGame()
        end

        action CreateGame
            ScreenResolution resolution = GetDesktopResolution()
            SetScreenResolution(resolution)
        end

        action Update(number seconds)
            // Using the desktop resolution will typically make the game go fullscreen.
            // To exit the game, the user can press the ESCAPE key.
            if monitor:IsKeyPressed(keys:ESCAPE)
                Exit()
            end
        end
    end

Parameters

SetScreenSize(integer width, integer height, boolean adjustCameras)

This action sets windowed size of the game (the default size is 800 by 600). This action can be called before calling StartGame() to set the initial window size. If this action is used when the game is in fullscreen, it will return it to windowed mode. If the game is already running and the boolean parameter is set to true, then the default cameras will be adjusted to fit the new window size. If the value is set to false, the cameras will not be adjusted.

Example Code

use Libraries.Game.Game

        class Main is Game

            action Main
                SetScreenSize(1024, 800)
                StartGame()
            end
        end

Parameters

SetScreenSize(integer width, integer height)

This action sets windowed size of the game (the default size is 800 by 600). This action can be called before calling StartGame() to set the initial window size. If this action is used when the game is in fullscreen, it will return it to windowed mode. If the game is already started, this action will adjust the cameras on the default 2D and 3D layers to correspond to the new window size.

Example Code

use Libraries.Game.Game

        class Main is Game

            action Main
                SetScreenSize(1024, 800)
                StartGame()
            end
        end

Parameters

SetSimulationThreshold2D(number threshold)

Parameters

SetSkybox(Libraries.Game.Graphics.Skybox skybox)

The SetSkybox action will set the currently active Layer3D to use the given Skybox.

Example Code

use Libraries.Game.Game
    use Libraries.Game.Graphics.Skybox

    class Main is Game

        action Main
            StartGame()
        end

        action CreateGame
            Skybox skybox
            // Assuming we have a folder named "skybox" containing our six images.
            skybox:Load("skybox/right.jpg", "skybox/left.jpg", "skybox/top.jpg", "skybox/bottom.jpg", "skybox/front.jpg", "skybox/back.jpg")
            SetSkybox(skybox)
        end

    end

Parameters

SetVSync(boolean vSync)

This action enables or disables vSync in the game. Passing a value of true enables it, a value of false disables it. vSync is enabled by default. This action should be called before calling StartGame(). This option is only used when the game is run on desktops.

Example Code

use Libraries.Game.Game

        class Main is Game

            action Main
                SetVSync(false)
                StartGame()
            end
        end

Parameters

SetWebCanvasName(text name)

The SetWebCanvasName action determines which canvas to use on a webpage. When the game runs, it will be displayed on the designated canvas. If no canvas name is given, the engine will attempt to find a canvas with the default name, "QuorumGraphicsCanvas". If the engine can't find a canvas with the set name, it will not run. This action has no effect if called inside a game that isn't being run online.

Example Code

use Libraries.Game.Game
    use Libraries.Game.WebConfiguration

    class Main is Game

        action Main
            SetWebCanvasName("myCanvas")
            StartGame()
        end
    end

Parameters

StartGame()

The StartGame action will start your game. Specifically, it does this: 1. Creates the Game window. 2. Calls the CreateGame() action. 3. Repeatedly calls Update() until Exit() is called or the window is closed. If you are using any actions to change the starting settings of the window, call those before calling StartGame().

Example Code

use Libraries.Game.Game

        class Main
            action Main
                Game game
                Game:StartGame()
            end
        end

Update(number time)

The Update action is where most of the game's logic goes. The code inside Update will be called on every frame of the game. In other words, for every time a picture is drawn on the screen, the Update action is called. The number parameter is the amount of seconds that has passed since the last time Update was called.

Example Code

use Libraries.Game.Game

        class Main is Game

            action Main
                StartGame()
            end

            // It is very important when making our own Update action that it has
            // the time parameter! If we don't have it, it won't be called.
            action Update(number time)
                output "Update was called!"
            end
        end

Parameters

UseDesktopResolution(boolean adjustCameras)

UseDesktopResolution will set the game to use the same display settings as the desktop's current screen resolution (independent of the game). This is only effective when used on desktop platforms - on other platforms, this will do nothing. If the boolean parameter is set to true, then this action will also adjust the size of the cameras on the default 2D and 3D layers to match the new screen size. If the parameter is false, then the cameras will not be changed.

Example Code

use Libraries.Game.Game
    use Libraries.Game.InputMonitor
    use Libraries.Interface.Events.KeyboardEvent
    use Libraries.Game.Graphics.Drawable

    class Main is Game

        InputMonitor monitor
        KeyboardEvent keys

        action Main
            StartGame()
        end

        action CreateGame
            Drawable leftSquare
            leftSquare:LoadFilledRectangle(100, 100)
            leftSquare:SetPosition(0, 250)
            Add(leftSquare)

            Drawable rightSquare
            rightSquare:LoadFilledRectangle(100, 100)
            rightSquare:SetPosition(700, 250)
            Add(rightSquare)
        end

        action Update(number seconds)
            // Pressing the spacebar will set the game to use the desktop's resolution.
            // If the boolean is false, the cameras will not be adjusted to the new screen size,
            // making them appear to be zoomed in on the original area.
            // If the boolean is true (or omitted), the cameras will be adjusted to view the
            // new size of the screen. Drawables will remain at their original size and position.
            if monitor:IsKeyPressed(keys:SPACE)
                UseDesktopResolution(false)
            end
            // Using the desktop resolution will typically make the game go fullscreen.
            // To exit the game, the user can press the ESCAPE key.
            if monitor:IsKeyPressed(keys:ESCAPE)
                Exit()
            end
        end
    end

Parameters

UseDesktopResolution()

UseDesktopResolution will set the game to use the same display settings as the desktop's current screen resolution (independent of the game). This is only effective when used on desktop platforms - on other platforms, this will do nothing. Using this action will also adjust the size of the cameras on the default 2D and 3D layers to match the new screen size. To change the screen size without changing the cameras, use SetScreenResolution(ScreenResolution, false).

Example Code

use Libraries.Game.Game
    use Libraries.Game.InputMonitor
    use Libraries.Interface.Events.KeyboardEvent

    class Main is Game

        InputMonitor monitor
        KeyboardEvent keys

        action Main
            StartGame()
        end

        action CreateGame
            UseDesktopResolution()
        end

        action Update(number seconds)
            // Using the desktop resolution will typically make the game go fullscreen.
            // To exit the game, the user can press the ESCAPE key.
            if monitor:IsKeyPressed(keys:ESCAPE)
                Exit()
            end
        end
    end