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