ezEngine  Milestone 9
ezWindow Class Reference

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

#include <Window.h>

Inheritance diagram for ezWindow:

Public Member Functions

 ezWindow ()
 Creates empty window instance with standard settings. More...
 
virtual ~ezWindow ()
 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 ezWindowHandle 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. More...
 
virtual void ProcessWindowMessages () override
 Runs the platform specific message pump. More...
 
ezResult Initialize ()
 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.
 
ezResult Destroy ()
 Destroys the window.
 
virtual void OnResize (const ezSizeU32 &newWindowSize)
 Called on window resize messages. More...
 
virtual void OnWindowMove (const ezInt32 newPosX, const ezInt32 newPosY)
 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 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.
 

Protected Attributes

ezWindowCreationDesc 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

◆ ezWindow()

ezWindow::ezWindow ( )

Creates empty window instance with standard settings.

You need to call Initialize to actually create a window.

See also
ezWindow::Initialize

Member Function Documentation

◆ Initialize() [1/2]

ezResult ezWindow::Initialize ( )

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
Todo:
Expose icon functionality somehow
Todo:
test & support for multiple windows

◆ Initialize() [2/2]

ezResult ezWindow::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

◆ IsFullscreenWindow()

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

Returns whether the window covers an entire monitor.

If bOnlyProperFullscreenMode == false, this includes borderless windows.

Implements ezWindowBase.

◆ OnResize()

void ezWindow::OnResize ( const ezSizeU32 newWindowSize)
virtual

Called on window resize messages.

Parameters
newWindowSizeNew window size in pixel.
See also
OnWindowMessage

◆ ProcessWindowMessages()

void ezWindow::ProcessWindowMessages ( )
overridevirtual

Runs the platform specific message pump.

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

Implements ezWindowBase.

Member Data Documentation

◆ m_CreationDescription

ezWindowCreationDesc ezWindow::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: