Libraries.Game.DesktopDisplay Documentation
This class represents the game window. This class is handled automatically by the Game class. Most users will never need to interact with this class directly. This class is used specifically on desktop platforms (Windows and Mac OS X).
Inherits from: Libraries.Game.GameDisplay, Libraries.Language.Object
Summary
Variable Summary Table
Variables | Description |
---|---|
boolean shouldrender | This boolean represents whether the GameDisplay currently needs to render something new on the screen. |
Actions Summary Table
Actions | Description |
---|---|
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. |
FirstTimeShowWindow() | Used internally by the game engine. |
FocusWindow() | This action asks the operating system to give the main application window the focus. |
GetAvailableResolutions() | This action will return an array containing all of the screen resolutions available for this machine. |
GetClipboard() | This action returns the DesktopConfiguration being used by the GameDisplay. |
GetConfiguration() | This action returns the DesktopConfiguration being used by the GameDisplay. |
GetDesktopResolution() | This action returns a ScreenResolution object that describes the currently set resolution of the computer's desktop (not the resolution being used by the game). |
GetDisplayX() | This action returns the screen x coordinate of the DesktopDisplay. |
GetDisplayY() | This action returns the screen y coordinate of the DesktopDisplay. |
GetHashCode() | This action gets the hash code for an object. |
GetHeight() | This action returns the height of the DesktopDisplay. |
GetPixelScaleFactor() | This action returns the ratio between screen coordinates and pixels. |
GetResize() | This action returns whether the DesktopDisplay is resizable or not. |
GetScreenResolution() | This action will return the current screen resolution being used by the game engine. |
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 DesktopDisplay. |
IsActive() | This action returns whether or not the DesktopDisplay is the currently active application on the system. |
IsAvailable() | The IsAvailable action returns whether or not a display is available to draw on. |
IsCloseRequested() | This action determines if the user has tried to close the window by clicking the window's red close button. |
IsWindowFocused() | This action determines whether or not the main application window has the focus on desktop platforms. |
IsWindowMaximized() | This action returns true if the display is a maximized window. |
IsWindowMinimized() | This action returns true if the display is minimized, or false otherwise. |
MaximizeWindow() | This action maximizes the window. |
MinimizeWindow() | This action minimizes the window. |
RequestRendering() | This action tells the DesktopDisplay to render to the screen. |
RestoreWindow() | This action returns a maximized window to a smaller window, or returns a minimized window to the foreground. |
SetClipboard(text value) | This action sets the DesktopConfiguration being used by the game, which includes data for the screen. |
SetConfiguration(Libraries.Game.ApplicationConfiguration conf) | This action sets the DesktopConfiguration being used by the game, which includes data for the screen. |
SetDisplayMode(integer width, integer height, boolean fullscreen) | This action sets the width and height of the DesktopDisplay, and optionally makes the game full screen. |
SetLastTime() | This action records the time when the action is called, and stores it. |
SetResize(boolean resize) | This action sets whether the DesktopDisplay should be resizable or not. |
SetScreenResolution(Libraries.Game.ScreenResolution resolution) | This action will set the game screen to use the given screen resolution. |
SetVSync(boolean vsync) | This action sets vSync on or off for the DesktopDisplay. |
SetWindowIcon(Libraries.System.File file) | This action will set the icon the application uses in the taskbar on Windows platforms. |
SetWindowIcon(text fileName) | This action will set the icon the application uses in the taskbar on Windows platforms. |
SetWindowPosition(integer x, integer y) | This action sets the position of the window on the screen. |
SetupDisplay() | This action initializes the DesktopDisplay. |
Update() | This action updates the game screen without polling the input. |
UpdateBuffer() | This action forces the Game to draw its contents to the DesktopDisplay's internal buffer without drawing them to the screen. |
UpdateTime() | This action updates the game's timekeeping information. |
WasResized() | This action returns whether or not the DesktopDisplay 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
- Libraries.Language.Object: The object to compare to.
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
- Libraries.Language.Object: The to be compared.
Return
boolean: True if the hash codes are equal and false if they are not equal.
FirstTimeShowWindow()
Used internally by the game engine. This should never be called by users.
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.
GetAvailableResolutions()
This action will return an array containing all of the screen resolutions available for this machine.
Return
GetClipboard()
This action returns the DesktopConfiguration being used by the GameDisplay.
Return
text:
GetConfiguration()
This action returns the DesktopConfiguration being used by the GameDisplay.
Return
Libraries.Game.ApplicationConfiguration:
GetDesktopResolution()
This action returns a ScreenResolution object that describes the currently set resolution of the computer's desktop (not the resolution being used by the game).
Return
Libraries.Game.ScreenResolution:
GetDisplayX()
This action returns the screen x coordinate of the DesktopDisplay.
Return
integer:
GetDisplayY()
This action returns the screen y coordinate of the DesktopDisplay.
Return
integer:
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 DesktopDisplay.
Return
integer:
GetPixelScaleFactor()
This action returns the ratio between screen coordinates and pixels.
Return
number:
GetResize()
This action returns whether the DesktopDisplay is resizable or not.
Return
boolean:
GetScreenResolution()
This action will return the current screen resolution being used by the game engine.
Return
Libraries.Game.ScreenResolution:
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 DesktopDisplay.
Return
integer:
IsActive()
This action returns whether or not the DesktopDisplay is the currently active application on the system.
Return
boolean:
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:
IsCloseRequested()
This action determines if the user has tried to close the window by clicking the window's red close button.
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()
This action returns true if the display is a maximized window. If the display isn't maximized, or if the display is full screen, this returns false.
Return
boolean:
IsWindowMinimized()
This action returns true if the display is minimized, or false otherwise.
Return
boolean:
MaximizeWindow()
This action maximizes the window. It does nothing if the window is already maximized or if the display is fullscreen.
MinimizeWindow()
This action minimizes the window.
RequestRendering()
This action tells the DesktopDisplay to render to the screen.
RestoreWindow()
This action returns a maximized window to a smaller window, or returns a minimized window to the foreground.
SetClipboard(text value)
This action sets the DesktopConfiguration being used by the game, which includes data for the screen.
Parameters
SetConfiguration(Libraries.Game.ApplicationConfiguration conf)
This action sets the DesktopConfiguration being used by the game, which includes data for the screen.
Parameters
SetDisplayMode(integer width, integer height, boolean fullscreen)
This action sets the width and height of the DesktopDisplay, and optionally makes the game full screen.
Parameters
Return
boolean:
SetLastTime()
This action records the time when the action is called, and stores it.
SetResize(boolean resize)
This action sets whether the DesktopDisplay should be resizable or not.
Parameters
SetScreenResolution(Libraries.Game.ScreenResolution resolution)
This action will set the game screen to use the given screen resolution. The resolution should be acquired from one of the actions that provides the usable screen resolutions for this machine, such as GetDesktopResolution or GetAvailableResolutions.
Parameters
SetVSync(boolean vsync)
This action sets vSync on or off for the DesktopDisplay.
Parameters
SetWindowIcon(Libraries.System.File file)
This action will set the icon the application uses in the taskbar on Windows platforms.
Parameters
SetWindowIcon(text fileName)
This action will set the icon the application uses in the taskbar on Windows platforms.
Parameters
SetWindowPosition(integer x, integer y)
This action sets the position of the window on the screen. This uses the coordinate system of the native platform, which often will start the y index at the top of the screen and move down as the y value increases.
Parameters
SetupDisplay()
This action initializes the DesktopDisplay.
Update()
This action updates the game screen without polling the input.
UpdateBuffer()
This action forces the Game to draw its contents to the DesktopDisplay's internal buffer without drawing them to the screen.
UpdateTime()
This action updates the game's timekeeping information.
WasResized()
This action returns whether or not the DesktopDisplay has been resized.
Return
boolean: