ezEngine  Release 25.03
ezWindowPlatformShared Class Referenceabstract

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

#include <Window.h>

Inheritance diagram for ezWindowPlatformShared:

Public Member Functions

 ezWindowPlatformShared ()
 Creates empty window instance with standard settings. More...
 
 ~ezWindowPlatformShared ()
 Destroys the window if not already done.
 
const ezWindowCreationDescGetCreationDescription () const
 Returns the currently active description struct.
 
virtual ezSizeU32 GetClientAreaSize () const override
 Returns the size of the client area / ie. the window resolution.
 
virtual bool IsFullscreenWindow (bool bOnlyProperFullscreenMode=false) const override
 Returns whether the window covers an entire monitor. More...
 
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 ezResult InitializeWindow ()=0
 Creates a new platform specific window with the current settings. More...
 
ezResult Initialize (const ezWindowCreationDesc &creationDescription)
 Creates a new platform specific window with the given settings. More...
 
bool IsInitialized () const
 Gets if the window is up and running.
 
virtual void DestroyWindow ()=0
 Destroys the window.
 
virtual ezResult Resize (const ezSizeU32 &newWindowSize)=0
 Tries to resize the window. Override OnResize to get the actual new window size.
 
virtual void OnResize (const ezSizeU32 &newWindowSize)=0
 Called on window resize messages. More...
 
virtual void OnWindowMove (const ezInt32 iNewPosX, const ezInt32 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.
 
ezStandardInputDeviceGetInputDevice () const
 Returns the input device that is attached to this window and typically provides mouse / keyboard input.
 
- Public Member Functions inherited from ezWindowBase
virtual ezWindowHandle GetNativeWindowHandle () const =0
 Returns the platform specific window handle.
 
virtual void ProcessWindowMessages ()=0
 Runs the platform specific message pump. More...
 

Static Public Member Functions

static ezUInt8 GetNextUnusedWindowNumber ()
 Returns a number that can be used as a window number in ezWindowCreationDesc. More...
 

Protected Attributes

ezWindowCreationDesc m_CreationDescription
 
bool m_bInitialized = false
 
bool m_bVisible = true
 
ezUniquePtr< ezStandardInputDevicem_pInputDevice
 
ezWindowInternalHandle m_hWindowHandle = ezWindowInternalHandle()
 
ezAtomicInteger32 m_iReferenceCount = 0
 

Static Protected Attributes

static ezUInt8 s_uiNextUnusedWindowNumber = 0
 increased every time an ezWindow is created, to be able to get a free window index easily
 

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

◆ ezWindowPlatformShared()

ezWindowPlatformShared::ezWindowPlatformShared ( )

Creates empty window instance with standard settings.

You need to call Initialize to actually create a window.

See also
ezWindow::Initialize

Member Function Documentation

◆ GetNextUnusedWindowNumber()

ezUInt8 ezWindowPlatformShared::GetNextUnusedWindowNumber ( )
static

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

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

◆ Initialize()

ezResult ezWindowPlatformShared::Initialize ( const ezWindowCreationDesc creationDescription)
inline

Creates a new platform specific window with the given settings.

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

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

◆ InitializeWindow()

virtual ezResult ezWindowPlatformShared::InitializeWindow ( )
pure virtual

Creates a new platform specific window with the current settings.

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

See also
ezWindow::Destroy, ezWindow::Initialize

Implemented in ezWindowWin, ezWindowAndroid, ezWindowNoImpl, ezWindowUWP, and ezWindowGLFW.

◆ IsFullscreenWindow()

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

Returns whether the window covers an entire monitor.

If bOnlyProperFullscreenMode == false, this includes borderless windows.

Implements ezWindowBase.

◆ OnResize()

virtual void ezWindowPlatformShared::OnResize ( const ezSizeU32 newWindowSize)
pure virtual

Called on window resize messages.

Parameters
newWindowSizeNew window size in pixel.
See also
OnWindowMessage

Implemented in ezWindowWin, ezGameStateWindow, ezWindowAndroid, ezWindowNoImpl, ezWindowUWP, and ezWindowGLFW.

Member Data Documentation

◆ m_CreationDescription

ezWindowCreationDesc ezWindowPlatformShared::m_CreationDescription
protected

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