ezEngine  Milestone 7
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.
 
virtual ezWindowHandle GetNativeWindowHandle () const override
 Returns the platform specific window handle.
 
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 OnResizeMessage (const ezSizeU32 &newWindowSize)
 Called on window resize messages. More...
 
virtual void OnFocusMessage (bool bHasFocus)
 Called when the window gets focus or loses focus.
 
virtual void OnClickCloseMessage ()
 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
 

Private Attributes

bool m_bInitialized
 
ezStandardInputDevicem_pInputDevice
 
ezWindowHandle m_WindowHandle
 

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 ( )
inline

Creates empty window instance with standard settings.

You need to call Initialize to actually create a window.

See Also
ezWindow::Initialize

Member Function Documentation

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
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
virtual void ezWindow::OnResizeMessage ( const ezSizeU32 newWindowSize)
inlinevirtual

Called on window resize messages.

Parameters
newWindowSizeNew window size in pixel.
See Also
OnWindowMessage
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

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: