Blowbox 2017
A 3D Game Engine by Riko Ophorst using DirectX 12
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
blowbox::Window Class Reference

#include <window.h>

Public Member Functions

void Create (const Resolution &resolution, const String &window_title, Image *window_icon=nullptr)
 
void SetWindowResolution (const Resolution &resolution)
 
void SetWindowTitle (const String &window_title)
 
void SetWindowSizeLimits (const Resolution &min_resolution, const Resolution &max_resolution)
 
void SetWindowPosition (const DirectX::XMINT2 &window_position)
 
void SetWindowIcon (Image *window_icon)
 
void Focus ()
 
Resolution GetWindowResolution () const
 
String GetWindowTitle () const
 
Tuple< Resolution, ResolutionGetWindowSizeLimits () const
 
DirectX::XMINT2 GetWindowPosition () const
 
ImageGetWindowIcon () const
 
bool GetWindowFocused () const
 
HWND GetWindowHandle () const
 
GLFWwindow * GetGLFWWindow ()
 
KeyboardStateGetKeyboardState ()
 
MouseStateGetMouseState ()
 
bool GetWindowShouldClose ()
 

Static Public Member Functions

static void GlfwKeyCallback (GLFWwindow *window, int key, int scancode, int action, int modifiers)
 
static void GlfwCharCallback (GLFWwindow *window, unsigned int unicode_character)
 
static void GlfwCursorPosCallback (GLFWwindow *window, double x, double y)
 
static void GlfwMouseButtonCallback (GLFWwindow *window, int button, int action, int modifiers)
 
static void GlfwScrollCallback (GLFWwindow *window, double x, double y)
 
static void GlfwMouseEnterCallback (GLFWwindow *window, int entered)
 
static void GlfwFocusCallback (GLFWwindow *window, int focused)
 

Private Attributes

GLFWwindow * window_
 
Imagewindow_icon_
 
String window_title_
 
Resolution min_resolution_
 
Resolution max_resolution_
 
KeyboardState keyboard_state_
 
MouseState mouse_state_
 
bool focused_
 

Detailed Description

Class for creating windows.

A window is meant to create a window that can be used for rendering. Essentially, it opens a window that catches input and enables outputting rendering to the screen.

Member Function Documentation

void blowbox::Window::Create ( const Resolution resolution,
const String window_title,
Image window_icon = nullptr 
)

Creates the window. Resolution and window title are required. Window icon is optional.

Parameters
[in]resolutionThe resolution of the usable client area.
[in]window_titleThe title of the window.
[in]window_iconThe icon that should be used by this window. Usable formats include 16x16, 32x32, 48x48. Optional.
void blowbox::Window::Focus ( )

Makes the window the focus of the input.

GLFWwindow * blowbox::Window::GetGLFWWindow ( )
Returns
The underlying GLFWwindow.
KeyboardState & blowbox::Window::GetKeyboardState ( )
Returns
This window's KeyboardState.
MouseState & blowbox::Window::GetMouseState ( )
Returns
This window's MouseState.
bool blowbox::Window::GetWindowFocused ( ) const
Returns
Whether the window is in focus.
HWND blowbox::Window::GetWindowHandle ( ) const
Returns
This window's HWND (handle).
Image * blowbox::Window::GetWindowIcon ( ) const
Returns
The icon that is used by this window.
DirectX::XMINT2 blowbox::Window::GetWindowPosition ( ) const
Returns
The position of the window's top left position.
Resolution blowbox::Window::GetWindowResolution ( ) const
Returns
The resolution of the window's client area.
bool blowbox::Window::GetWindowShouldClose ( )
Returns
Whether this Window should be closed. Can be triggered by the user.
Tuple< Resolution, Resolution > blowbox::Window::GetWindowSizeLimits ( ) const
Returns
The size limits of the window as a tuple. First is the minimum, second is the maximum.
String blowbox::Window::GetWindowTitle ( ) const
Returns
The title of the window.
void blowbox::Window::GlfwCharCallback ( GLFWwindow *  window,
unsigned int  unicode_character 
)
static

This is the callback function that is used for character input.

Parameters
[in]windowThe window that the callback function is associated with.
[in]unicode_characterThe character in question.
void blowbox::Window::GlfwCursorPosCallback ( GLFWwindow *  window,
double  x,
double  y 
)
static

This is the callback function that is used for mouse movement input.

Parameters
[in]windowThe window that the callback function is associated with.
[in]xThe position of the cursor on the x-axis.
[in]yThe position of the cursor on the y-axis.
void blowbox::Window::GlfwFocusCallback ( GLFWwindow *  window,
int  focused 
)
static

This is the callback function that is used for when the mouse enters/leaves the window.

Parameters
[in]windowThe window that the callback function is associated with.
[in]focusedWhether the window is focused or not.
void blowbox::Window::GlfwKeyCallback ( GLFWwindow *  window,
int  key,
int  scancode,
int  action,
int  modifiers 
)
static

This is the callback function that is used for key input.

Parameters
[in]windowThe window that the callback function is associated with.
[in]keyThe key in question.
[in]scancodeDon't know what this is.
[in]actionWhat happened with the key in question.
[in]modifiersWhether any modifiers were active when this key was pressed.
void blowbox::Window::GlfwMouseButtonCallback ( GLFWwindow *  window,
int  button,
int  action,
int  modifiers 
)
static

This is the callback function that is used for mouse movement input.

Parameters
[in]windowThe window that the callback function is associated with.
[in]buttonThe button in question.
[in]actionThe action.
[in]modifiersWhether any modifiers were active when this button was pressed.
void blowbox::Window::GlfwMouseEnterCallback ( GLFWwindow *  window,
int  entered 
)
static

This is the callback function that is used for when the mouse enters/leaves the window.

Parameters
[in]windowThe window that the callback function is associated with.
[in]enteredWhether the mouse entered or left the window.
void blowbox::Window::GlfwScrollCallback ( GLFWwindow *  window,
double  x,
double  y 
)
static

This is the callback function that is used for mouse scroll input.

Parameters
[in]windowThe window that the callback function is associated with.
[in]xThe scroll offset on the x axis.
[in]yThe scroll offset on the y axis.
void blowbox::Window::SetWindowIcon ( Image window_icon)

Sets the icon of the window.

Parameters
[in]window_iconThe icon of the window.
void blowbox::Window::SetWindowPosition ( const DirectX::XMINT2 &  window_position)

Sets the position of the window.

Parameters
[in]window_positionThe position of the window.
void blowbox::Window::SetWindowResolution ( const Resolution resolution)

Sets the resolution of the window.

Parameters
[in]resolutionThe resolution of the window.
void blowbox::Window::SetWindowSizeLimits ( const Resolution min_resolution,
const Resolution max_resolution 
)

Sets the size limits of the window.

Parameters
[in]min_resolutionThe minimum resolution of the window.
[in]max_resolutionThe maximum resolution of the window.
void blowbox::Window::SetWindowTitle ( const String window_title)

Sets the title of the window.

Parameters
[in]window_titleThe title of the window.

Member Data Documentation

bool blowbox::Window::focused_
private

Whether the window is currently in input focus or not.

KeyboardState blowbox::Window::keyboard_state_
private

The state of the keyboard for this window.

Resolution blowbox::Window::max_resolution_
private

The maximum resolution of the window.

Resolution blowbox::Window::min_resolution_
private

The minimum resolution of the window.

MouseState blowbox::Window::mouse_state_
private

The state of the mouse for this window.

GLFWwindow* blowbox::Window::window_
private

The underlying window that GLFW uses.

Image* blowbox::Window::window_icon_
private

The currently bound icon.

String blowbox::Window::window_title_
private

The title of window.


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