XII Release 0.1.0
Loading...
Searching...
No Matches
xiiWindow Class Reference

A simple abstraction for platform specific window creation. More...

#include <Window.h>

Inheritance diagram for xiiWindow:
[legend]

Public Member Functions

 xiiWindow ()
 Creates empty window instance with standard settings.
 
virtual ~xiiWindow ()
 Destroys the window if not already done.
 
const xiiWindowCreationDescriptionGetCreationDescription () const
 Returns the currently active description struct.
 
virtual xiiSizeU32 GetClientAreaSize () const override
 Returns the size of the client area / ie. the window resolution.
 
virtual xiiWindowHandle GetNativeWindowHandle () const override
 Returns the platform specific window handle.
 
virtual bool IsFullscreenWindow (bool bOnlyProperFullscreenMode=false) const override
 Returns whether the window covers an entire monitor.
 
virtual bool IsVisible () const override
 Whether the window can potentially be seen by the user. Windows that are minimized or hidden are not visible.
 
virtual void AddReference () override
 
virtual void RemoveReference () override
 
virtual void ProcessWindowMessages () override
 Runs the platform specific message pump.
 
xiiResult Initialize ()
 Creates a new platform specific window with the current settings.
 
xiiResult Initialize (const xiiWindowCreationDescription &creationDescription)
 Creates a new platform specific window with the given settings.
 
bool IsInitialized () const
 Gets if the window is up and running.
 
xiiResult Destroy ()
 Destroys the window.
 
xiiResult Resize (const xiiSizeU32 &newWindowSize)
 Tries to resize the window. Override OnResize to get the actual new window size.
 
virtual void OnResize (const xiiSizeU32 &newWindowSize)
 Called on window resize messages.
 
virtual void OnWindowMove (const xiiInt32 iNewPosX, const xiiInt32 iNewPosY)
 Called when the window position is changed. Not possible on all OSes.
 
virtual void OnFocus (bool bHasFocus)
 Called when the window gets focus or loses focus.
 
virtual void OnVisibleChange (bool bVisible)
 Called when the window gets focus or loses focus.
 
virtual void OnClickClose ()
 Called when the close button of the window is clicked. Does nothing by default.
 
xiiStandardInputDevice * GetInputDevice () const
 Returns the input device that is attached to this window and typically provides mouse / keyboard input.
 

Static Public Member Functions

static xiiUInt8 GetNextUnusedWindowNumber ()
 Returns a number that can be used as a window number in xiiWindowCreationDescription.
 

Protected Attributes

xiiWindowCreationDescription m_CreationDescription
 

Detailed Description

A simple abstraction for platform specific window creation.

Will handle basic message looping. Notable events can be listened to by overriding the corresponding callbacks. You should call ProcessWindowMessages every frame to keep the window responsive. Input messages will not be forwarded automatically. You can do so by overriding the OnWindowMessage function.

Constructor & Destructor Documentation

◆ xiiWindow()

xiiWindow::xiiWindow ( )

Creates empty window instance with standard settings.

You need to call Initialize to actually create a window.

See also
xiiWindow::Initialize

Member Function Documentation

◆ AddReference()

virtual void xiiWindow::AddReference ( )
inlineoverridevirtual

Implements xiiWindowBase.

◆ GetClientAreaSize()

virtual xiiSizeU32 xiiWindow::GetClientAreaSize ( ) const
inlineoverridevirtual

Returns the size of the client area / ie. the window resolution.

Implements xiiWindowBase.

◆ GetNativeWindowHandle()

virtual xiiWindowHandle xiiWindow::GetNativeWindowHandle ( ) const
overridevirtual

Returns the platform specific window handle.

Implements xiiWindowBase.

◆ GetNextUnusedWindowNumber()

xiiUInt8 xiiWindow::GetNextUnusedWindowNumber ( )
static

Returns a number that can be used as a window number in xiiWindowCreationDescription.

This number just increments whenever a xiiWindow is created. It starts at zero.

◆ Initialize() [1/2]

xiiResult xiiWindow::Initialize ( )

Creates a new platform specific window with the current settings.

Will automatically call xiiWindow::Destroy if window is already initialized.

See also
xiiWindow::Destroy, xiiWindow::Initialize

◆ Initialize() [2/2]

xiiResult xiiWindow::Initialize ( const xiiWindowCreationDescription & creationDescription)
inline

Creates a new platform specific window with the given settings.

Will automatically call xiiWindow::Destroy if window is already initialized.

Parameters
creationDescriptionStruct with various settings for window creation. Will be saved internally for later lookup.
See also
xiiWindow::Destroy, xiiWindow::Initialize

◆ IsFullscreenWindow()

virtual bool xiiWindow::IsFullscreenWindow ( bool bOnlyProperFullscreenMode = false) const
inlineoverridevirtual

Returns whether the window covers an entire monitor.

If bOnlyProperFullscreenMode == false, this includes borderless windows.

Implements xiiWindowBase.

◆ IsVisible()

virtual bool xiiWindow::IsVisible ( ) const
inlineoverridevirtual

Whether the window can potentially be seen by the user. Windows that are minimized or hidden are not visible.

Implements xiiWindowBase.

◆ OnClickClose()

virtual void xiiWindow::OnClickClose ( )
inlinevirtual

Called when the close button of the window is clicked. Does nothing by default.

Reimplemented in xiiGameStateWindow.

◆ OnResize()

virtual void xiiWindow::OnResize ( const xiiSizeU32 & newWindowSize)
virtual

Called on window resize messages.

Parameters
newWindowSizeNew window size in pixel.
See also
OnWindowMessage

Reimplemented in xiiGameStateWindow.

◆ ProcessWindowMessages()

virtual void xiiWindow::ProcessWindowMessages ( )
overridevirtual

Runs the platform specific message pump.

You should call ProcessWindowMessages every frame to keep the window responsive.

Implements xiiWindowBase.

◆ RemoveReference()

virtual void xiiWindow::RemoveReference ( )
inlineoverridevirtual

Implements xiiWindowBase.

Member Data Documentation

◆ m_CreationDescription

xiiWindowCreationDescription xiiWindow::m_CreationDescription
protected

Description at creation time. xiiWindow will not update this in any method other than Initialize.

Remarks
That means that messages like Resize will also have no effect on this variable.

The documentation for this class was generated from the following files: