class Platform

Provides access to various operating system functions, including the main message pump.

Public

Constructors

Platform

Platform()

Methods

~Platform

virtual ~Platform() noexcept

staticGetCursorPosition

static Vector2I GetCursorPosition()

Retrieves the cursor position in screen coordinates.

staticSetCursorPosition

static void SetCursorPosition(const Vector2I &screenPos)

Moves the cursor to the specified screen position.

staticCaptureMouse

static void CaptureMouse(const RenderWindow &window)

Capture mouse to this window so that we get mouse input even if the mouse leaves the window area.

staticReleaseMouseCapture

static void ReleaseMouseCapture()

Releases the mouse capture set by captureMouse().

staticIsPointOverWindow

static bool IsPointOverWindow(const RenderWindow &window, const Vector2I &screenPos)

Checks if provided over screen position is over the specified window.

staticClipCursorToWindow

static void ClipCursorToWindow(const RenderWindow &window)

Limit cursor movement to the specified window.

staticClipCursorToRect

static void ClipCursorToRect(const Area2I &screenRect)

Clip cursor to specific area on the screen.

staticClipCursorDisable

static void ClipCursorDisable()

Disables cursor clipping.

staticHideCursor

static void HideCursor()

Hides the cursor.

staticShowCursor

static void ShowCursor()

Shows the cursor.

staticIsCursorHidden

static bool IsCursorHidden()

Query if the cursor is hidden.

staticSetCursor

static void SetCursor(PixelData &pixelData, const Vector2I &hotSpot)

Sets a cursor using a custom image.

pixelData
Cursor image data.
hotSpot
Offset on the cursor image to where the actual input happens (for example tip of the Arrow cursor).

staticSetIcon

static void SetIcon(const PixelData &pixelData)

Sets an icon for the main application window.

pixelData
Icon image data. This will be resized to the required icon size, depending on platform implementation.

staticSetCaptionNonClientAreas

static void SetCaptionNonClientAreas(const RenderWindow &window, const Vector<Area2I> &nonClientAreas)

Sets custom caption non client areas for the specified window.

Using custom client areas will override window move/drag operation and trigger when user interacts with the custom area.

staticSetResizeNonClientAreas

static void SetResizeNonClientAreas(const RenderWindow &window, const Vector<NonClientResizeArea> &nonClientAreas)

Sets custom non client areas for the specified window.

Using custom client areas will override window resize operation and trigger when user interacts with the custom area.

staticResetNonClientAreas

static void ResetNonClientAreas(const RenderWindow &window)

Resets the non client areas for the specified windows and allows the platform to use the default values.

staticSleep

static void Sleep(u32 duration)

Causes the current thread to pause execution for the specified amount of time.

duration
Duration in milliseconds. Providing zero will give up the current time-slice.

staticOpenFolder

static void OpenFolder(const Path &path)

Opens the provided folder using the default application, as specified by the operating system.

path
Absolute path to the folder to open.

staticCopyToClipboard

static void CopyToClipboard(const String &string)

Adds a string to the clipboard.

staticCopyFromClipboard

static String CopyFromClipboard()

Reads a string from the clipboard and returns it.

If there is no string in the clipboard it returns an empty string.

staticKeyCodeToUnicode

static String KeyCodeToUnicode(u32 keyCode)

Converts a keyboard key-code to a Unicode character.

Internal

Methods

staticMessagePump

static void MessagePump()

Message pump.

Processes OS messages and returns when it's free.

staticStartUp

static void StartUp()

Called during application start up from the main thread.

Must be called before any other operations are done.

staticUpdate

static void Update()

Called once per frame from the main thread.

staticShutDown

static void ShutDown()

Called during application shut down from the main thread.