Libraries.Game.WebDisplay Documentation
Inherits from: Libraries.Game.GameDisplay, Libraries.Language.Object
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.
Parameters
- Libraries.Language.Object: The object to compare to.
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)
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.
Parameters
- Libraries.Language.Object: The to be compared.
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)
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 ApplicationConfiguration being used by the GameDisplay.
Return
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()
GetHeight()
This action returns the height of the GameDisplay.
Return
integer:
GetName()
Return
text
GetPixelScaleFactor()
This action returns the ratio between screen coordinates and pixels.
Return
number:
GetResize()
This action returns whether the GameDisplay is resizable or not.
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.
Return
number:
Example
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
GetWidth()
This action returns the width of the GameDisplay.
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:
RenderingRequested()
This action returns whether or not the GameDisplay has currently been asked to render.
Return
boolean:
RequestRendering()
This action tells the GameDisplay 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
- text value
SetConfiguration(Libraries.Game.ApplicationConfiguration configuration)
This action sets the ApplicationConfiguration being used by the game, which includes data for the screen. The ApplicationConfiguration must be of the correct type or otherwise an error will be thrown, i.e., if the GameDisplay is a WebDisplay, it must receive a WebConfiguration.
Parameters
SetDisplayMode(integer width, integer height, boolean fullscreen)
This action sets the width and height of the GameDisplay, and optionally makes the game full screen. Returns a boolean value indicating whether the action was successful - for example, this should typically work on desktops, but on mobile devices it will fail and return false.
Parameters
- integer width
- integer height
- boolean fullscreen
Return
boolean:
SetLastTime()
This action records the time when the action is called, and stores it.
SetName(text newName)
Parameters
- text newName
SetVSync(boolean vsync)
This action sets vSync on or off for the GameDisplay.
Parameters
- boolean vsync
SetupDisplay()
This action prepares the display for use. The WebDisplay must already have been given a WebConfiguration using the SetConfiguration action, and the provided configuration must have a valid canvas identifier to be used by the display.
UpdateTime()
This action updates the game's timekeeping information. Also resets the flag for requested rendering.
WasResized()
This action returns whether or not the GameDisplay has been resized.
Return
boolean:
On this page
Variables TableAction Documentation- Compare(Libraries.Language.Object object)
- Destroy()
- Equals(Libraries.Language.Object object)
- GetClipboard()
- GetConfiguration()
- GetHashCode()
- GetHeight()
- GetName()
- GetPixelScaleFactor()
- GetResize()
- GetSecondsBetweenFrames()
- GetSecondsSinceStart()
- GetWidth()
- IsAvailable()
- RenderingRequested()
- RequestRendering()
- SetClipboard(text value)
- SetConfiguration(Libraries.Game.ApplicationConfiguration configuration)
- SetDisplayMode(integer width, integer height, boolean fullscreen)
- SetLastTime()
- SetName(text newName)
- SetVSync(boolean vsync)
- SetupDisplay()
- UpdateTime()
- WasResized()