GameWindow
A GameWindow represents a window, canvas or headless virtual frame where a game is displayed and can receive user events, it provides:
Updating and Rendering:
An EventLoop and a coroutineDispatcher where run code in a single thread like on JavaScript
Provides an onUpdateEvent that will be executed in the EventLoop at a fixed rate determined by fps used for updating the game, and having a lock to prevent rendering while running
Provides an onRenderEvent that will be executed in the Rendering thread at vsync or whenever a rendering is required. It has a lock to prevent executing at the same time as the onUpdateEvent.
If needing to update the game state outside the provided EventLoop, you can use the updateRenderLock function
Events:
It implements the EventListener interface.
Dispatches Window and User Input events:
Update and rendering events: UpdateEvent, RenderEvent
Window/App lifecycle event: PauseEvent, ResumeEvent, StopEvent, InitEvent, DestroyEvent, DisposeEvent, FullScreenEvent, ReshapeEvent
Input events: KeyEvent, MouseEvent, GestureEvent, DropFileEvent
Window properties:
title, icon, cursor, width, height, preferredFps, fullscreen, visible, bgcolor, quality, alwaysOnTop
Dialogs DialogInterface:
Virtual Keyboard:
Device Dimensions provider:
Inheritors
Types
Describes if the rendering should focus on performance or quality. PERFORMANCE will use lower resolutions, while QUALITY will use the devicePixelRatio to render high quality images.
Properties
Flag to keep the screen on, even when there is no user input and the user is idle
Approximate on iOS
Approximate on iOS
Functions
Triggers an update envent and potential CONNECTED/DISCONNECTED events.
Happens on the rendering thread
Happens on the updater thread