class RenderWindow

Inherits: RenderTarget

Operating system window with a specific position, size and style.

Each window serves as a surface that can be rendered into by RenderAPI operations.

Public

Methods

~RenderWindow

virtual ~RenderWindow() noexcept = default

ScreenToWindowPosition

virtual Vector2I ScreenToWindowPosition(const Vector2I &screenPosition) const = 0

Converts screen position into window local position.

WindowToScreenPosition

virtual Vector2I WindowToScreenPosition(const Vector2I &windowPosition) const = 0

Converts window local position to screen position.

Resize

virtual void Resize(u32 width, u32 height) = 0

Resize the window to specified width and height in pixels.

width
Width of the window in pixels.
height
Height of the window in pixels.

Move

virtual void Move(i32 left, i32 top) = 0

Move the window to specified screen coordinates.

left
Position of the left border of the window on the screen.
top
Position of the top border of the window on the screen.

Hide

virtual void Hide() = 0

Hides the window.

Show

virtual void Show() = 0

Shows a previously hidden window.

Minimize

virtual void Minimize() = 0

Minimizes the window to the taskbar.

Maximize

virtual void Maximize() = 0

Maximizes the window over the entire current screen.

Restore

virtual void Restore() = 0

Restores the window to original position and size if it is minimized or maximized.

SetFullscreen

virtual void SetFullscreen(u32 width, u32 height, float refreshRate = 60.F, u32 monitorIndex = 0) = 0

Switches the window to fullscreen mode.

Child windows cannot go into fullscreen mode.

width
Width of the window frame buffer in pixels.
height
Height of the window frame buffer in pixels.
refreshRate
Refresh rate of the window in Hertz.
monitorIndex
Index of the monitor to go fullscreen on.

SetFullscreen

virtual void SetFullscreen(const VideoMode &videoMode)

Switches the window to fullscreen mode.

Child windows cannot go into fullscreen mode.

videoMode
Mode retrieved from VideoModeInfo in GpuDevice.

SetWindowed

virtual void SetWindowed(u32 width, u32 height) = 0

Switches the window to windowed mode.

width
Window width in pixels.
height
Window height in pixels.

SetVSync

virtual void SetVSync(bool enabled, u32 interval = 1) = 0

Enables or disables vertical synchronization.

When enabled the system will wait for monitor refresh before presenting the back buffer. This eliminates tearing but can result in increased input lag.

enabled
True to enable vsync, false to disable.
interval
Interval at which to perform the sync. Value of one means the sync will be performed for each monitor refresh, value of two means it will be performs for every second (half the rate), and so on.

GetPlatformWindowHandle

virtual u64 GetPlatformWindowHandle() const = 0

Returns a platform-specific window handle. (e.g.

HWND on Windows)

GetRenderWindowProperties

const RenderWindowProperties &GetRenderWindowProperties() const

Returns properties that describe the render window.

Destroy

void Destroy() override

Closes and destroys the window.

staticCreate

static SPtr<RenderWindow> Create(const RenderWindowCreateInformation &createInformation, const SPtr<RenderWindow> &parentWindow = nullptr)

Creates a new render window using the specified options.

Optionally makes the created window a child of another window.

staticGetRttiStatic

static RTTIType *GetRttiStatic()

GetRtti

RTTIType *GetRtti() const override

Returns an interface you can use to access class' Run Time Type Information.

Fields

OnCloseRequested

Event<void ()> OnCloseRequested

Triggers when the OS requests that the window is closed (e.g. user clicks on the X button in the title bar).

Internal

Methods

NotifyWindowEvent

void NotifyWindowEvent(WindowEventType type)

Notifies the window that a specific event occurred as reported by the OS event loop.

DoOnWindowMovedOrResized

virtual void DoOnWindowMovedOrResized()

Method that triggers whenever the window changes size or position.

DoOnDPIScaleChanged

virtual void DoOnDPIScaleChanged()

Method that triggers whenever the DPI scale changes.

Protected

Constructors

RenderWindow

RenderWindow(const RenderWindowCreateInformation &createInformation, u32 windowId, const SPtr<RenderWindow> &parentWindow)

Methods

CreateRenderProxySyncPacket

RenderProxySyncPacket *CreateRenderProxySyncPacket(FrameAllocator &allocator, u32 flags) override

Creates a data packet that will be used for syncing the core object with it's render proxy.

Caller must free the retrieved packet using the provided allocator when done using it.

Fields

mCreateInformation

mRenderWindowProperties

RenderWindowProperties mRenderWindowProperties

mParentWindow

WeakSPtr<RenderWindow> mParentWindow

mWindowId

u32 mWindowId