Plasma Engine  2.0
Loading...
Searching...
No Matches
plWindow Class Reference

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

#include <Window.h>

Inheritance diagram for plWindow:

Public Member Functions

 plWindow ()
 Creates empty window instance with standard settings.
 
virtual ~plWindow ()
 Destroys the window if not already done.
 
const plWindowCreationDescGetCreationDescription () const
 Returns the currently active description struct.
 
virtual plSizeU32 GetClientAreaSize () const override
 Returns the size of the client area / ie. the window resolution.
 
virtual plWindowHandle 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.
 
plResult Initialize ()
 Creates a new platform specific window with the current settings.
 
plResult Initialize (const plWindowCreationDesc &creationDescription)
 Creates a new platform specific window with the given settings.
 
bool IsInitialized () const
 Gets if the window is up and running.
 
plResult Destroy ()
 Destroys the window.
 
plResult Resize (const plSizeU32 &newWindowSize)
 Tries to resize the window. Override OnResize to get the actual new window size.
 
virtual void OnResize (const plSizeU32 &newWindowSize)
 Called on window resize messages.
 
virtual void OnWindowMove (const plInt32 iNewPosX, const plInt32 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.
 
plStandardInputDeviceGetInputDevice () const
 Returns the input device that is attached to this window and typically provides mouse / keyboard input.
 

Static Public Member Functions

static plUInt8 GetNextUnusedWindowNumber ()
 Returns a number that can be used as a window number in plWindowCreationDesc.
 

Protected Attributes

plWindowCreationDesc 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

◆ plWindow()

plWindow::plWindow ( )

Creates empty window instance with standard settings.

You need to call Initialize to actually create a window.

See also
plWindow::Initialize

Member Function Documentation

◆ AddReference()

virtual void plWindow::AddReference ( )
inlineoverridevirtual

Implements plWindowBase.

◆ GetClientAreaSize()

virtual plSizeU32 plWindow::GetClientAreaSize ( ) const
inlineoverridevirtual

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

Implements plWindowBase.

◆ GetNativeWindowHandle()

plWindowHandle plWindow::GetNativeWindowHandle ( ) const
overridevirtual

Returns the platform specific window handle.

Implements plWindowBase.

◆ GetNextUnusedWindowNumber()

plUInt8 plWindow::GetNextUnusedWindowNumber ( )
static

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

This number just increments every time an plWindow is created. It starts at zero.

◆ Initialize() [1/2]

plResult plWindow::Initialize ( )

Creates a new platform specific window with the current settings.

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

See also
plWindow::Destroy, plWindow::Initialize
Todo
Expose icon functionality somehow (101 == IDI_ICON1, see resource.h)
Todo
test & support for multiple windows

◆ Initialize() [2/2]

plResult plWindow::Initialize ( const plWindowCreationDesc & creationDescription)
inline

Creates a new platform specific window with the given settings.

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

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

◆ IsFullscreenWindow()

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

Returns whether the window covers an entire monitor.

If bOnlyProperFullscreenMode == false, this includes borderless windows.

Implements plWindowBase.

◆ IsVisible()

virtual bool plWindow::IsVisible ( ) const
inlineoverridevirtual

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

Implements plWindowBase.

◆ OnClickClose()

virtual void plWindow::OnClickClose ( )
inlinevirtual

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

Reimplemented in plGameStateWindow.

◆ OnResize()

void plWindow::OnResize ( const plSizeU32 & newWindowSize)
virtual

Called on window resize messages.

Parameters
newWindowSizeNew window size in pixel.
See also
OnWindowMessage

Reimplemented in plGameStateWindow.

◆ ProcessWindowMessages()

void plWindow::ProcessWindowMessages ( )
overridevirtual

Runs the platform specific message pump.

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

Implements plWindowBase.

◆ RemoveReference()

virtual void plWindow::RemoveReference ( )
inlineoverridevirtual

Implements plWindowBase.

Member Data Documentation

◆ m_CreationDescription

plWindowCreationDesc plWindow::m_CreationDescription
protected

Description at creation time. plWindow 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: