Blowbox 2017
A 3D Game Engine by Riko Ophorst using DirectX 12
|
#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, Resolution > | GetWindowSizeLimits () const |
DirectX::XMINT2 | GetWindowPosition () const |
Image * | GetWindowIcon () const |
bool | GetWindowFocused () const |
HWND | GetWindowHandle () const |
GLFWwindow * | GetGLFWWindow () |
KeyboardState & | GetKeyboardState () |
MouseState & | GetMouseState () |
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_ |
Image * | window_icon_ |
String | window_title_ |
Resolution | min_resolution_ |
Resolution | max_resolution_ |
KeyboardState | keyboard_state_ |
MouseState | mouse_state_ |
bool | focused_ |
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.
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.
[in] | resolution | The resolution of the usable client area. |
[in] | window_title | The title of the window. |
[in] | window_icon | The 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 | ( | ) |
KeyboardState & blowbox::Window::GetKeyboardState | ( | ) |
MouseState & blowbox::Window::GetMouseState | ( | ) |
bool blowbox::Window::GetWindowFocused | ( | ) | const |
HWND blowbox::Window::GetWindowHandle | ( | ) | const |
Image * blowbox::Window::GetWindowIcon | ( | ) | const |
DirectX::XMINT2 blowbox::Window::GetWindowPosition | ( | ) | const |
Resolution blowbox::Window::GetWindowResolution | ( | ) | const |
bool blowbox::Window::GetWindowShouldClose | ( | ) |
Tuple< Resolution, Resolution > blowbox::Window::GetWindowSizeLimits | ( | ) | const |
String blowbox::Window::GetWindowTitle | ( | ) | const |
|
static |
This is the callback function that is used for character input.
[in] | window | The window that the callback function is associated with. |
[in] | unicode_character | The character in question. |
|
static |
This is the callback function that is used for mouse movement input.
[in] | window | The window that the callback function is associated with. |
[in] | x | The position of the cursor on the x-axis. |
[in] | y | The position of the cursor on the y-axis. |
|
static |
This is the callback function that is used for when the mouse enters/leaves the window.
[in] | window | The window that the callback function is associated with. |
[in] | focused | Whether the window is focused or not. |
|
static |
This is the callback function that is used for key input.
[in] | window | The window that the callback function is associated with. |
[in] | key | The key in question. |
[in] | scancode | Don't know what this is. |
[in] | action | What happened with the key in question. |
[in] | modifiers | Whether any modifiers were active when this key was pressed. |
|
static |
This is the callback function that is used for mouse movement input.
[in] | window | The window that the callback function is associated with. |
[in] | button | The button in question. |
[in] | action | The action. |
[in] | modifiers | Whether any modifiers were active when this button was pressed. |
|
static |
This is the callback function that is used for when the mouse enters/leaves the window.
[in] | window | The window that the callback function is associated with. |
[in] | entered | Whether the mouse entered or left the window. |
|
static |
This is the callback function that is used for mouse scroll input.
[in] | window | The window that the callback function is associated with. |
[in] | x | The scroll offset on the x axis. |
[in] | y | The scroll offset on the y axis. |
void blowbox::Window::SetWindowIcon | ( | Image * | window_icon | ) |
Sets the icon of the window.
[in] | window_icon | The icon of the window. |
void blowbox::Window::SetWindowPosition | ( | const DirectX::XMINT2 & | window_position | ) |
Sets the position of the window.
[in] | window_position | The position of the window. |
void blowbox::Window::SetWindowResolution | ( | const Resolution & | resolution | ) |
Sets the resolution of the window.
[in] | resolution | The resolution of the window. |
void blowbox::Window::SetWindowSizeLimits | ( | const Resolution & | min_resolution, |
const Resolution & | max_resolution | ||
) |
Sets the size limits of the window.
[in] | min_resolution | The minimum resolution of the window. |
[in] | max_resolution | The maximum resolution of the window. |
void blowbox::Window::SetWindowTitle | ( | const String & | window_title | ) |
Sets the title of the window.
[in] | window_title | The title of the window. |
|
private |
Whether the window is currently in input focus or not.
|
private |
The state of the keyboard for this window.
|
private |
The maximum resolution of the window.
|
private |
The minimum resolution of the window.
|
private |
The state of the mouse for this window.
|
private |
The underlying window that GLFW uses.
|
private |
The currently bound icon.
|
private |
The title of window.