Nui Engine
A game engine framework
Loading...
Searching...
No Matches
Nui::Window Class Reference

Class representing a window in the application. More...

#include <Window.h>

Inheritance diagram for Nui::Window:
Nui::AppBase TestApp

Classes

struct  Size
 Window size. More...
 

Public Types

enum class  Style { Windowed , WindowedFullscreen , Borderless , BorderlessFullscreen }
 Window styles. More...
 
using WndCallback = std::function<LRESULT(NUI_WNDPROC_ARGS)>
 

Public Member Functions

 Window (Window::Style style, WStringView title, Window::Size size={ 1280, 720 })
 Create a new window.
 
virtual ~Window ()
 Destroy the window.
 
HWND GetHWND () const
 Get the window handle.
 
HINSTANCE GetHinstance () const
 Get the Hinstance of the window.
 
Size GetClientSize () const
 Get the client size.
 
void SetWindowTitle (WString title)
 Set the window title.
 
bool Maximized () const
 Check if the window is maximized.
 
bool Focused () const
 Check if the window has focus.
 
bool WantsToClose () const
 Runs the window message pump and checks if the window wants to close.
 
void AddCallback (U32 msg, WndCallback callback)
 Add a window message callback.
 

Detailed Description

Class representing a window in the application.

Member Enumeration Documentation

◆ Style

enum class Nui::Window::Style
strong

Window styles.

Enumerator
Windowed 

Create resizeable window.

WindowedFullscreen 

Create maximized resizeable window.

Borderless 

Create a non-resizeable window without border.

BorderlessFullscreen 

Create maximized non-resizeable window without border.

Constructor & Destructor Documentation

◆ Window()

Nui::Window::Window ( Window::Style style,
WStringView title,
Window::Size size = { 1280, 720 } )
explicit

Create a new window.

Parameters
styleWindow style
sizeWindow size
positionWindow position
titleWindow title

◆ ~Window()

Nui::Window::~Window ( )
virtual

Destroy the window.

Note
This will close the window

Member Function Documentation

◆ AddCallback()

void Nui::Window::AddCallback ( U32 msg,
WndCallback callback )

Add a window message callback.

Parameters
msgWindow message
callbackCallback
Note
The callback will be called when the message is received

◆ Focused()

bool Nui::Window::Focused ( ) const

Check if the window has focus.

Returns
True if focused

◆ GetClientSize()

Window::Size Nui::Window::GetClientSize ( ) const

Get the client size.

Returns
Client size

◆ GetHinstance()

HINSTANCE Nui::Window::GetHinstance ( ) const

Get the Hinstance of the window.

Returns
Hinstance

◆ GetHWND()

HWND Nui::Window::GetHWND ( ) const

Get the window handle.

Returns
Win32 Window handle

◆ Maximized()

bool Nui::Window::Maximized ( ) const

Check if the window is maximized.

Returns
True if maximized

◆ SetWindowTitle()

void Nui::Window::SetWindowTitle ( WString title)

Set the window title.

Parameters
titleWindow title

◆ WantsToClose()

bool Nui::Window::WantsToClose ( ) const

Runs the window message pump and checks if the window wants to close.

Returns
True if the window wants to close

The documentation for this class was generated from the following files: