![]() |
ezEngine Release 26.3
|
A simple abstraction for platform specific window creation. More...
#include <Window.h>

Public Member Functions | |
| ezWindowPlatformShared () | |
| Creates empty window instance with standard settings. | |
| ~ezWindowPlatformShared () | |
| Destroys the window if not already done. | |
| const ezWindowCreationDesc & | GetCreationDescription () const |
| Returns the window creation description. The description may get updated by window moves, resizes and such. | |
| 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. | |
| bool | IsVisible () const override |
| virtual ezResult | InitializeWindow ()=0 |
| Creates a new platform specific window with the current settings. | |
| ezResult | Initialize (const ezWindowCreationDesc &creationDescription) |
| Creates a new platform specific window with the given settings. | |
| 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. | |
| virtual void | OnResize (const ezSizeU32 &newWindowSize) |
| Called when a window got resized. | |
| 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 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. | |
| ezInputDevice * | GetInputDevice () const |
| Returns the input device that is attached to this window and typically provides mouse / keyboard input. | |
| const ezEvent< ezWindowEvent > & | WindowEvents () const |
| Allows to subscribe to window events. | |
| virtual void | AddReference () override |
| virtual void | RemoveReference () override |
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. | |
Protected Attributes | |
| ezWindowCreationDesc | m_CreationDescription |
| ezEvent< ezWindowEvent > | m_WindowEvents |
| bool | m_bInitialized = false |
| bool | m_bVisible = true |
| bool | m_bHasFocus = true |
| ezUniquePtr< ezInputDevice > | m_pInputDevice |
| ezWindowInternalHandle | m_hWindowHandle = ezWindowInternalHandle() |
| ezAtomicInteger32 | m_iReferenceCount = 0 |
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.
|
default |
Creates empty window instance with standard settings.
You need to call InitializeWindow() to actually create a window.
| ezWindowPlatformShared::~ezWindowPlatformShared | ( | ) |
Destroys the window if not already done.
Also broadcasts ezWindowEvent::Type::WindowDestruction.
|
inlineoverridevirtual |
Implements ezWindowBase.
|
pure virtual |
Destroys the window.
Implemented in ezWindowAndroid, ezWindowGLFW, ezWindowNoImpl, and ezWindowWin.
|
inlineoverridevirtual |
Returns the size of the client area / ie. the window resolution.
Implements ezWindowBase.
|
inline |
Creates a new platform specific window with the given settings.
Will automatically call DestroyWindow() if window is already initialized.
| creationDescription | Struct with various settings for window creation. Will be saved internally for later lookup. |
|
pure virtual |
Creates a new platform specific window with the current settings.
Will automatically call DestroyWindow() if window is already initialized.
Implemented in ezWindowAndroid, ezWindowGLFW, ezWindowNoImpl, and ezWindowWin.
|
inlineoverridevirtual |
Returns whether the window covers an entire monitor.
If bOnlyProperFullscreenMode == false, this includes borderless windows.
Implements ezWindowBase.
|
inlineoverridevirtual |
Whether the window is currently theoretically visible.
How accurate this is, depends on the platform specific implementation. The implementation may return "visible" even though the window can't be seen. However, it should never err the other way round.
Implements ezWindowBase.
|
virtual |
Called when the close button of the window is clicked. Does nothing by default.
The function also broadcasts ezWindowEvent::Type::CloseButtonClicked.
|
virtual |
Called when the window gets or loses focus.
The function also broadcasts ezWindowEvent::Type::FocusChanged.
|
virtual |
Called when a window got resized.
The new window size is also saved to the creation description. The function also broadcasts ezWindowEvent::Type::SizeChanged.
|
virtual |
Called when the window gets focus or loses focus.
The function also broadcasts ezWindowEvent::Type::VisibilityChanged.
|
virtual |
Called when the window position is changed. Not possible on all OSes.
The function also broadcasts ezWindowEvent::Type::PositionChanged.
|
inlineoverridevirtual |
Implements ezWindowBase.
Tries to resize the window.
Override OnResize to get the actual new window size.
Implemented in ezWindowAndroid, ezWindowGLFW, ezWindowNoImpl, and ezWindowWin.
|
inline |
Allows to subscribe to window events.
Note that AddEventHandler() is a const function, so can be called on the returned const ezEvent reference.
|
protected |
Description at creation time. ezWindow will not update this in any method other than Initialize.