Libraries.Interface.Controls.Charts.ChartDisplay Documentation

This class is used as a default display region for charts. It allows basic charts to be shown on screen, and accessible, without extending the game class.

Inherits from: Libraries.Language.Object, Libraries.Game.Game

Actions Documentation

Add(Libraries.Game.Graphics.DirectionalLight light)

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

Parameters

Example

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

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.

Parameters

Example

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

Add(Libraries.Game.Graphics.PointLight light)

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

Parameters

Example

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

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.

Parameters

Example

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

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.

Parameters

Example

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

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.

Parameters

Example

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

AddControlActivationListener(Libraries.Interface.Events.ControlActivationListener listener)

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

AddGestureListener(Libraries.Interface.Events.GestureListener listener)

This action adds a GestureListener to the Game. The gesture listener will be notified when the user performs a gesture on mobile devices, so long as the event is not handled by any items in the layers.

Parameters

Example

use Libraries.Game.Game
use Libraries.Interface.Events.GestureListener

class Main is Game

    GestureListener listener

    action Main
        StartGame()
    end

    action CreateGame
        AddGestureListener(listener)
    end
    
end

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.

Parameters

Example

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

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

  • integer index: The index to place the Layer at.
  • Libraries.Game.Layer: The Layer to be added to the Game. use Libraries.Game.Game use Libraries.Game.Layer2D class Main is Game action Main StartGame() end action CreateGame // This will add the layer at index 0, making it the first layer drawn. Layer2D layer AddLayer(0, layer) end action Update(number seconds) end end

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

  • Libraries.Game.Layer: The Layer to be added to the Game. use Libraries.Game.Game use Libraries.Game.Layer2D class Main is Game action Main StartGame() end action CreateGame Layer2D layer AddLayer(layer) end action Update(number seconds) end end

AddMenuChangeListener(Libraries.Interface.Events.MenuChangeListener listener)

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.

Parameters

Example

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

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.

Parameters

Example

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

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.

Parameters

Example

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

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.

Parameters

Example

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

AddScreenshotListener(Libraries.Interface.Events.ScreenshotListener listener)

This action adds a ScreenshotListener to the Game. When a screenshot is taken using the Game's Screenshot action, the listener will be informed via a ScreenshotEvent.

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)

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.

Parameters

Example

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

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.

Parameters

Example

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

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 an integer. The result is larger if this hash code is larger than the object passed as a parameter, smaller, or equal. In this case, -1 means smaller, 0 means equal, and 1 means larger. This action was changed in Quorum 7 to return an integer, instead of a CompareResult object, because the previous implementation was causing efficiency issues.

Parameters

Return

integer: The Compare result, Smaller, Equal, or Larger.

Example

Object o
Object t
integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smaller)

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()

This action sets the chart to be displayed within the chart display game.

EnablePhysics2D(boolean flag)

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

Parameters

  • boolean flag

Example

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

EnablePhysics3D(boolean flag)

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

Parameters

  • boolean flag

Example

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

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().

Parameters

  • boolean resize: Whether or not the game window should be resizable.

Example

use Libraries.Game.Game

class Main is Game

    action Main
        EnableResizing(true)
        StartGame()
    end
end

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.

Parameters

  • boolean resize: Whether or not to automatically resize textures on window resizing.

Example

use Libraries.Game.Game

class Main is Game

    action Main
        EnableTextureAutoResizing(false)
        StartGame()
    end
end

Equals(Libraries.Language.Object object)

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

Parameters

Return

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

Example

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

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

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

FindItem2DByName(text name)

This action finds the first Item2D that has been added to the Game with the given name and returns it. If no Item2D with the given name can be found, this action returns undefined instead.

Parameters

  • text name: The name of the Item to be found.

Return

Libraries.Interface.Item2D: The first Item2D added to the Game which has the given name, or undefined if no such item can be found.

FindItem3DByName(text name)

This action finds the first Item3D that has been added to the Game with the given name and returns it. If no Item3D with the given name can be found, this action returns undefined instead.

Parameters

  • text name: The name of the Item to be found.

Return

Libraries.Interface.Item3D: The first Item3D added to the Game which has the given name, or undefined if no such item can be found

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.

GetAccessibility()

GetAmbientLight()

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

Return

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

Example

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

GetAndroidConfiguration()

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

Return

Libraries.Game.AndroidConfiguration: The current AndroidConfiguration.

Example

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

class Main is Game

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

end

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.

Return

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

Example

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

GetCamera2D()

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

Return

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

Example

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

GetCamera3D()

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

Return

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

Example

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

GetChart()

This action gets the chart within this chart display game object.

Return

Libraries.Interface.Controls.Charts.Chart: the chart in the display.

GetClipboard()

Not all implementations support a clipboard, but all displays support the operations so that they can be called everywhere. If an implementation supports a clipboard, the appopriate system mechanisms are handled automatically. The example here would output whatever is currently on the clipboard.

Return

text: this action returns text from the system clipboard.

Example

use Libraries.Game.Game

class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        output GetClipboard()
    end

    action Update(number seconds)
    end
end

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.

Return

Libraries.Game.Layer2D: The currently active Layer2D.

Example

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

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.

Return

Libraries.Game.Layer3D: The currently active Layer3D.

Example

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

GetDefaultInputTable()

GetDesktopConfiguration()

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

Return

Libraries.Game.DesktopConfiguration: The current DesktopConfiguration.

Example

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

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.

Return

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

Example

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

GetDialogLayerPool()

This action returns the pool of DialogLayers usable by the Game. This should never be called manually -- instead, when using Dialogs, use the Show() and Hide() calls to display or close the Dialog. This action is used internally by the Game engine.

Return

Libraries.Game.DialogLayerPool:

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.

Parameters

  • integer index: The index to retrieve the DirectionalLight from.

Return

Libraries.Game.Graphics.DirectionalLight:

Example

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

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.

GetEditManager()

This action gets the default EditManager from the system.

Return

Libraries.Interface.Undo.EditManager: The EditManager

Example

use Libraries.Game.Game
use Libraries.Interface.Undo.EditManager

class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        EditManager edits = GetEditManager()
    end

    action Update(number seconds)
    end
end

GetExitOnStart()

Return

boolean

GetFirstLetterNavigationTime()

This action finds the first Item3D that has been added to the Game with the given name and returns it. If no Item3D with the given name can be found, this action returns undefined instead.

Return

number: The first Item3D added to the Game which has the given name, or undefined if no such item can be found

GetFocus()

This action returns the current Item that is focused.

Return

Libraries.Interface.Item: The currently focused Item.

GetFocusManager()

This action returns the FocusManager to be used for the Game. The FocusManager is responsible for moving focus between Items, which is essential for GUIs to function correctly.

Return

Libraries.Game.FocusManager:

GetFontManager()

This action returns the FontManager in use by the Game. The FontManager is responsible for loading and storing font information.

Return

Libraries.Game.Graphics.Fonts.FontManager:

GetGameName()

This action returns the name of the game displayed at the top of the window. The default name is "Game".

Return

text: The name displayed on the Game window.

Example

use Libraries.Game.Game

class Main is Game

    action Main
        output "The default name is " + GetGameName()
        SetGameName("Mariachi Band Simulator 3000")
        output "The new name is " + GetGameName()
        StartGame()
    end
end

GetHashCode()

This action gets the hash code for an object.

Return

integer: The integer hash code of the object.

Example

Object o
integer hash = o:GetHashCode()

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

  • text key

Return

Libraries.Game.InputTable:

GetInterfaceOptions()

This action returns the InterfaceOptions currently being used by the game. The InterfaceOptions provide default colors and properties for Controls in the game.

Return

Libraries.Interface.Options.InterfaceOptions: The current InterfaceOptions in use by the game.

Example

use Libraries.Game.Game
use Libraries.Game.Graphics.Color
use Libraries.Interface.Options.InterfaceOptions

class Main is Game

    Color color

    action Main
        StartGame()
    end

    action CreateGame
        InterfaceOptions options = GetInterfaceOptions()

        // Once we have the options, we can modify them to adjust how our Controls appear by default.
        options:SetButtonBackgroundColor(color:Pink())
    end
end

GetInterfaceScale()

The GetInterfaceScale action returns the scale of the user interface. Larger scaling values make each interface component larger. When the interface is scaled in this way, components that can be re-rendered at a higher resolution (such as fonts) will do so. Note that this represents the standard scale in use by the default 2D layer, and it will not necessarily reflect the scale of every single component.

Return

number: The current interface rendering scale.

Example

use Libraries.Game.Game
use Libraries.Interface.Layouts.FlowLayout
use Libraries.Interface.Controls.Button

class Main is Game

    action Main
        StartGame()
    end

    action CreateGame
        FlowLayout layout
        SetLayout(layout)

        Button button1
        button1:SetName("My Button")
        Add(button1)

        output "The default interface scale is " + GetInterfaceScale()
    end
end

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.

Return

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

Example

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

GetLayout()

The GetLayout action returns the layout that has been applied to the default Layer2D.

Return

Libraries.Interface.Layouts.Layout:

Example

use Libraries.Game.Game
use Libraries.Interface.Layouts.Layout
use Libraries.Interface.Layouts.FlowLayout
use Libraries.Interface.Controls.Button

class Main is Game

    action Main
        StartGame()
    end

    action CreateGame
        FlowLayout layout
        SetLayout(layout)

        Button button1
        button1:SetName("My Button")
        Add(button1)

        Layout currentLayout = GetLayout()
    end
end

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.

Parameters

  • integer index: The index to retrieve the PointLight from.

Return

Libraries.Game.Graphics.PointLight:

Example

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

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.

GetSceneManager()

This action returns the manager used to save and load scenes in the Game.

Return

Libraries.Game.Scenes.SceneManager:

GetScreenHeight()

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

Return

integer: The height of the screen.

Example

use Libraries.Game.Game

class Main is Game

    action Main
        StartGame()
    end

    action CreateGame
        output GetScreenHeight()
    end
end

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.

Return

Libraries.Game.ScreenResolution:

Example

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

GetScreenWidth()

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

Return

integer: The width of the screen.

Example

use Libraries.Game.Game

class Main is Game

    action Main
        StartGame()
    end

    action CreateGame
        output GetScreenWidth()
    end
end

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.

Return

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

Example

use Libraries.Game.Game

class Main is Game

    action Main
        StartGame()
    end

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

GetSimulationThreshold2D()

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

Return

number:

Example

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

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.

Return

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

Example

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

GetWebConfiguration()

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

Return

Libraries.Game.WebConfiguration: The current WebConfiguration.

Example

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

class Main is Game

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

end

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.

IsColliding()

This allows us to know if collisions are on or off for the layer.

Return

boolean:

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:

IsWindowMaximized()

On desktop platforms, this action returns true if the application is in a maximized window, or false otherwise. On other platforms, this always returns false.

Return

boolean: True if the window is maximized, false otherwise.

IsWindowMinimized()

On desktop platforms, this action returns true if the application is currently minimized, or false otherwise. On other platforms, this always returns false.

Return

boolean: True if the window is maximized, false otherwise.

LoadScene(Libraries.Game.Scenes.Scene scene)

This loads a scene file into the game.

Parameters

Example

use Libraries.Game.Game
use Libraries.Game.Scenes.Scene
use Libraries.System.File

class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        Scene scene
        File file
        file:SetPath("Scenes/Scene.qs")
        scene:Load(file)
        LoadScene(scene)
    end

    action Update(number seconds)
    end
end

LoadScene(text path)

This loads a scene file into the game. This is a helper action for loading a scene.

Parameters

  • text path

Example

use Libraries.Game.Game
use Libraries.Game.Scenes.Scene
use Libraries.System.File

class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        LoadScene("Scenes/Scene.qs")
    end

    action Update(number seconds)
    end
end

LoadScene(Libraries.System.File file)

This loads a scene file into the game.

Parameters

Example

use Libraries.Game.Game
use Libraries.Game.Scenes.Scene
use Libraries.System.File

class Main is Game
    action Main
        StartGame()
    end

    action CreateGame
        File file
        file:SetPath("Scenes/Scene.qs")
        LoadScene(file)
    end

    action Update(number seconds)
    end
end

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.

Return

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

Example

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

Remove(Libraries.Game.Graphics.PointLight light)

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

Parameters

Example

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

Remove(Libraries.Game.Graphics.DirectionalLight light)

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

Parameters

Example

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

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.

Parameters

Example

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

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.

Parameters

Example

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

RemoveAmbientLight()

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

Example

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.

Parameters

Example

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

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.

Parameters

Example

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

RemoveControlActivationListener(Libraries.Interface.Events.ControlActivationListener listener)

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

RemoveGestureListener(Libraries.Interface.Events.GestureListener listener)

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

Parameters

Example

use Libraries.Game.Game
use Libraries.Interface.Events.GestureListener

class Main is Game

    GestureListener listener

    action Main
        StartGame()
    end

    action CreateGame
        AddGestureListener(listener)

        RemoveGestureListener(listener)
    end
    
end

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

  • text key

Return

Libraries.Game.InputTable: