Libraries.Game.AndroidDisplay Documentation

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

Summary

Actions Summary Table

ActionsDescription
Compare(Libraries.Language.Object object)This action compares two object hash codes and returns an integer.
Destroy()This action closes the window.
Equals(Libraries.Language.Object object)This action determines if two objects are equal based on their hash code values.
GetClipboard()Not all implementations support a clipboard, but all displays support the operations so that they can be called everywhere.
GetConfiguration()This action returns the AndroidConfiguration being used by this AndroidDisplay.
GetHashCode()This action gets the hash code for an object.
GetHeight()This action returns the height of the AndroidDisplay.
GetPixelScaleFactor()This action returns the ratio between screen coordinates and pixels.
GetResize()This action returns whether the AndroidDisplay is resizable or not.
GetSecondsBetweenFrames()This action tests how many seconds have passed since the last time that the time was updated.
GetSecondsSinceStart()This action returns the number of seconds that have passed since the game was started.
GetWidth()This action returns the width of the AndroidDisplay.
IsAvailable()The IsAvailable action returns whether or not a display is available to draw on.
ReloadResources()This action reloads resources that were lost due to context loss (most commonly due to an app being minimized).
RequestRendering()This action tells the AndroidDisplay to render to the screen.
SetClipboard(text value)Not all implementations support a clipboard, but all displays support the operations so that they can be called everywhere.
SetConfiguration(Libraries.Game.ApplicationConfiguration conf)This action sets the AndroidConfiguration being used by the game, which includes data for the screen.
SetDisplayMode(integer width, integer height, boolean fullscreen)This action normally sets the width and height of the AndroidDisplay, but games on Android devices always fill the screen, so this does nothing.
SetVSync(boolean vsync)This action sets vSync on or off for the AndroidDisplay.
WasResized()This action returns whether or not the AndroidDisplay has been resized.

Actions Documentation

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.

Example Code

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

Parameters

Return

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

Destroy()

This action closes the window.

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.

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.

Return

text:

GetConfiguration()

This action returns the AndroidConfiguration being used by this AndroidDisplay.

Return

Libraries.Game.ApplicationConfiguration:

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.

GetHeight()

This action returns the height of the AndroidDisplay.

Return

integer:

GetPixelScaleFactor()

This action returns the ratio between screen coordinates and pixels.

Return

number:

GetResize()

This action returns whether the AndroidDisplay is resizable or not. This will always return false.

Return

boolean:

GetSecondsBetweenFrames()

This action tests how many seconds have passed since the last time that the time was updated.

Return

number:

GetSecondsSinceStart()

This action returns the number of seconds that have passed since the game was started.

Example Code

use Libraries.Game.Game
    use Libraries.Game.GameDisplay
    use Libraries.Game.GameStateManager
    
    class Main is Game

        GameDisplay display = undefined
        integer frameCount = 0

        action Main
            StartGame()
        end

        action CreateGame
            GameStateManager manager
            display = manager:GetGameDisplay()
        end

        action Update(number seconds)
            frameCount = frameCount + 1
            if frameCount = 30
                number time = display:GetSecondsSinceStart()
                output "The game has been running for " + time + " seconds."
            end
        end
    end

Return

number:

GetWidth()

This action returns the width of the AndroidDisplay.

Return

integer:

IsAvailable()

The IsAvailable action returns whether or not a display is available to draw on. If no display is available, actions that try to create or draw graphics (such as loading a Drawable) will create an error. This will return false if called before StartGame() is called in the Game class, and will typically return true after the game has been started.

Return

boolean:

ReloadResources()

This action reloads resources that were lost due to context loss (most commonly due to an app being minimized). This is called automatically by the engine when needed.

RequestRendering()

This action tells the AndroidDisplay to render to the screen.

SetClipboard(text value)

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 appropriate system mechanisms are handled automatically.

Parameters

SetConfiguration(Libraries.Game.ApplicationConfiguration conf)

This action sets the AndroidConfiguration being used by the game, which includes data for the screen. If the given ApplicationConfiguration is not an AndroidConfiguration, an error will be thrown.

Parameters

SetDisplayMode(integer width, integer height, boolean fullscreen)

This action normally sets the width and height of the AndroidDisplay, but games on Android devices always fill the screen, so this does nothing. The action will return false to indicate that no action was taken.

Parameters

Return

boolean:

SetVSync(boolean vsync)

This action sets vSync on or off for the AndroidDisplay.

Parameters

WasResized()

This action returns whether or not the AndroidDisplay has been resized.

Return

boolean: