Topaz 5.0
Topaz Game Engine
Loading...
Searching...
No Matches
window.hpp
1#ifndef TOPAZ_OS_WINDOW_HPP
2#define TOPAZ_OS_WINDOW_HPP
3#include "tz/core/handle.hpp"
4#include "tz/core/error.hpp"
5#include <string>
6
7namespace tz::os
8{
20 {
21 none = 0x00,
25 maximised = 0b0010,
27 transparent = 0b0100,
29 invisible = 0b1000,
30 };
31
32 constexpr window_flags operator|(window_flags lhs, window_flags rhs)
33 {
34 return static_cast<window_flags>(static_cast<int>(lhs) | static_cast<int>(rhs));
35 }
36
37 constexpr bool operator&(window_flags lhs, window_flags& rhs)
38 {
39 return static_cast<int>(lhs) & static_cast<int>(rhs);
40 }
41
47 {
49 std::string title = "";
51 unsigned int x = 0;
53 unsigned int y = 0;
55 unsigned int width = 800;
57 unsigned int height = 600;
59 window_flags flags = window_flags::none;
60 };
61
63
84
98
108
116 unsigned int window_get_width();
124 unsigned int window_get_height();
130 void window_set_dimensions(unsigned int width, unsigned int height);
136 std::string window_get_title();
142 void window_set_title(std::string_view title);
171}
172
173#endif // TOPAZ_OS_WINDOW_HPP
Represents a generic opaque handle.
Definition handle.hpp:32
error_code
Error codes for Topaz.
Definition error.hpp:14
window_handle get_window_handle()
Retrieve a opaque handle corresponding to the underlying window native.
window_flags
Optional behaviours/attributes when opening windows.
Definition window.hpp:20
unsigned int window_get_width()
Retrieve the width of the window, in pixels.
void window_set_dimensions(unsigned int width, unsigned int height)
Set a new width and height for the open window.
tz::error_code close_window()
Close a previously-opened window.
void window_show()
Show the window as normal, even if it is currently maximised/minimised/fullscreen.
void window_set_title(std::string_view title)
Set a new title for the open window.
tz::error_code open_window(window_info winfo={})
Open a new window.
void window_minimise()
Minimise the window, causing it to no longer be visible until maximised/shown.
void window_fullscreen()
Display the window in proper fullscreen.
bool window_is_open()
Query as to whether a window has been opened that has not yet been closed.
void window_maximise()
Maximise the window, causing it to cover the whole screen.
void window_update()
Poll updates for a window, advancing input events etc.
unsigned int window_get_height()
Retrieve the height of the window, in pixels.
std::string window_get_title()
Retrieve the title of the window.
@ maximised
Ignore the width and height provided within window_info and set set the window as maximised instead.
Definition window.hpp:25
@ transparent
When a pixel of the window's framebuffer is never drawn to, instead of being a clamped colour it is i...
Definition window.hpp:27
@ centered_window
Ignore the x and y coordinates provided within window_info and position the window approximately in t...
Definition window.hpp:23
@ invisible
When the window is "opened", it is completely invisible to the user. They won't see the window,...
Definition window.hpp:29
Basic customisation of a newly-opened window.
Definition window.hpp:47
unsigned int width
Width of the window body, in pixels.
Definition window.hpp:55
unsigned int x
x-position of the window, in pixels.
Definition window.hpp:51
unsigned int height
Height of the window body, in pixels.
Definition window.hpp:57
unsigned int y
y-position of the window, in pixels.
Definition window.hpp:53
std::string title
Title of the window. If you don't provide one, the name of the application specified in tz::initialis...
Definition window.hpp:49
window_flags flags
Some optional extra flags. See window_flags.
Definition window.hpp:59