![]() |
XII Release 0.1.0
|
#include <Window.h>
Public Member Functions | |
| xiiWindow () | |
| virtual | ~xiiWindow () |
| Destroys the window if not already done. | |
| const xiiWindowCreationDescription & | GetCreationDescription () const |
| Returns the currently active description struct. | |
| virtual xiiSizeU32 | GetClientAreaSize () const override |
| Returns the size of the client area of the window, i.e. the area that can be drawn into. | |
| virtual xiiWindowHandle | GetNativeWindowHandle () const override |
| Returns the position and size of the entire window, including borders and title bar. | |
| virtual bool | IsFullscreenWindow (bool bOnlyProperFullscreenMode=false) const override |
| virtual bool | IsVisible () const override |
| virtual void | AddReference () override |
| Adds a reference to the window. The window will not be destroyed until all references are removed. | |
| virtual void | RemoveReference () override |
| Removes a reference from the window. If this was the last reference, the window will be destroyed. | |
| virtual void | ProcessWindowMessages () override |
| Processes all pending window messages, such as input or resize events. This should be called regularly (typically once per frame) to keep the window responsive. | |
| xiiResult | Initialize () |
| xiiResult | Initialize (const xiiWindowCreationDescription &creationDescription) |
| bool | IsInitialized () const |
| Gets if the window is up and running. | |
| xiiResult | Destroy () |
| Destroys the window. | |
| xiiResult | Resize (const xiiSizeU32 &newWindowSize) |
| virtual void | OnResize (const xiiSizeU32 &newWindowSize) |
| virtual void | OnWindowMove (const xiiInt32 iNewPosX, const xiiInt32 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. | |
| xiiStandardInputDevice * | GetInputDevice () const |
| Returns the input device that is attached to this window and typically provides mouse / keyboard input. | |
| virtual void | SetOutputTarget (xiiUniquePtr< xiiWindowOutputTargetBase > &&pOutputTarget) override |
| virtual xiiWindowOutputTargetBase * | GetOutputTarget () const override |
| Gets the output target for this window. | |
| const xiiEvent< xiiWindowEvent > & | GetWindowEvents () const |
Static Public Member Functions | |
| static xiiUInt8 | GetNextUnusedWindowNumber () |
Protected Attributes | |
| xiiWindowCreationDescription | m_CreationDescription |
| xiiEvent< xiiWindowEvent > | m_WindowEvents |
| This event is broadcast when various things happen to the window, such as when it is resized or when the close button is clicked. You can subscribe to this event to be notified about these events. | |
| bool | m_bInitialized = false |
| Whether the window is initialized and has a valid native handle. | |
| bool | m_bVisible = true |
| Whether the window is visible. | |
| bool | m_bHasFocus = true |
| Whether the window has focus. | |
| xiiUniquePtr< xiiStandardInputDevice > | m_pInputDevice |
| The input device attached to this window, typically providing mouse and keyboard input. | |
| xiiUniquePtr< xiiWindowOutputTargetBase > | m_pOutputTarget |
| The output target for this window, typically representing the graphics API side of the render output. | |
| xiiWindowInternalHandle | m_hWindowHandle = xiiWindowInternalHandle() |
| The platform specific window handle. | |
| xiiAtomicInteger32 | m_iReferenceCount = 0 |
| The reference count for this window. The window will be destroyed when this reaches zero. | |
Static Protected Attributes | |
| static xiiUInt8 | s_uiNextUnusedWindowNumber = 0 |
| This just increments whenever a xiiWindow is created. It starts at zero. | |
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.
| xiiWindow::xiiWindow | ( | ) |
Creates empty window instance with standard settings
You need to call Initialize to actually create a window.
|
inlineoverridevirtual |
Adds a reference to the window. The window will not be destroyed until all references are removed.
Implements xiiWindowBase.
|
inlineoverridevirtual |
Returns the size of the client area of the window, i.e. the area that can be drawn into.
Implements xiiWindowBase.
|
overridevirtual |
Returns the position and size of the entire window, including borders and title bar.
Implements xiiWindowBase.
|
static |
Returns a number that can be used as a window number in xiiWindowCreationDescription.
This number just increments whenever a xiiWindow is created. It starts at zero.
|
overridevirtual |
Gets the output target for this window.
Implements xiiWindowBase.
|
inline |
Allows to subscribe to window events.
Note that AddEventHandler() is a const function, so can be called on the returned const xiiEvent reference.
| xiiResult xiiWindow::Initialize | ( | ) |
Creates a new platform specific window with the current settings
Will automatically call xiiWindow::Destroy if window is already initialized.
|
inline |
Creates a new platform specific window with the given settings.
Will automatically call xiiWindow::Destroy if window is already initialized.
| creationDescription | Struct with various settings for window creation. Will be saved internally for later lookup. |
|
inlineoverridevirtual |
Whether the window is a fullscreen window or should be one - some platforms may enforce this via the GALSwapchain.
If bOnlyProperFullscreenMode, the caller accepts borderless windows that cover the entire screen as "fullscreen".
Implements xiiWindowBase.
|
inlineoverridevirtual |
Whether the window can potentially be seen by the user.
Windows that are minimized or hidden are not visible.
Implements xiiWindowBase.
|
virtual |
Called on window resize messages.
| newWindowSize | New window size in pixel. |
|
overridevirtual |
Processes all pending window messages, such as input or resize events. This should be called regularly (typically once per frame) to keep the window responsive.
Implements xiiWindowBase.
|
inlineoverridevirtual |
Removes a reference from the window. If this was the last reference, the window will be destroyed.
Implements xiiWindowBase.
| xiiResult xiiWindow::Resize | ( | const xiiSizeU32 & | newWindowSize | ) |
Tries to resize the window. Override OnResize to get the actual new window size.
|
overridevirtual |
Sets the output target for this window.
Output targets are destroyed before the window to ensure proper cleanup order. Setting a new output target replaces any existing one.
Implements xiiWindowBase.
|
protected |
Description at creation time. xiiWindow will not update this in any method other than Initialize.
|
staticprotected |
This just increments whenever a xiiWindow is created. It starts at zero.
Copyright (c) Theophilus Eriata. All Rights Reserved.