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
Variables Table
Variables | Description |
---|---|
boolean shouldrender | This boolean represents whether the GameDisplay currently needs to render something new on the screen. |
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)
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
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
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.
Return
integer: The integer hash code of the object.
Example
Object o
integer hash = o:GetHashCode()
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
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 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
- text value
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
- integer width
- integer height
- boolean fullscreen
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
- boolean resize
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
- boolean vsync
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
- text fileName
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
- integer x
- integer y
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:
On this page
Variables TableAction Documentation- Compare(Libraries.Language.Object object)
- Destroy()
- Equals(Libraries.Language.Object object)
- FirstTimeShowWindow()
- FocusWindow()
- GetAvailableResolutions()
- GetClipboard()
- GetConfiguration()
- GetDesktopResolution()
- GetDisplayX()
- GetDisplayY()
- GetHashCode()
- GetHeight()
- GetPixelScaleFactor()
- GetResize()
- GetScreenResolution()
- GetSecondsBetweenFrames()
- GetSecondsSinceStart()
- GetWidth()
- IsActive()
- IsAvailable()
- IsCloseRequested()
- IsWindowFocused()
- IsWindowMaximized()
- IsWindowMinimized()
- MaximizeWindow()
- MinimizeWindow()
- RequestRendering()
- RestoreWindow()
- SetClipboard(text value)
- SetConfiguration(Libraries.Game.ApplicationConfiguration conf)
- SetDisplayMode(integer width, integer height, boolean fullscreen)
- SetLastTime()
- SetResize(boolean resize)
- SetScreenResolution(Libraries.Game.ScreenResolution resolution)
- SetVSync(boolean vsync)
- SetWindowIcon(Libraries.System.File file)
- SetWindowIcon(text fileName)
- SetWindowPosition(integer x, integer y)
- SetupDisplay()
- Update()
- UpdateBuffer()
- UpdateTime()
- WasResized()