Project Alice
Loading...
Searching...
No Matches
window.hpp
Go to the documentation of this file.
1#pragma once
2
3// #include "system_state.hpp"
4
5#ifdef _WIN64
6
7typedef struct HWND__* HWND;
8typedef struct HDC__* HDC;
9
10namespace window {
11class window_data_impl {
12public:
13 HWND hwnd = nullptr;
14 HDC opengl_window_dc = nullptr;
15 HCURSOR cursors[8] = { HCURSOR(NULL) };
16
17 int32_t creation_x_size = 600;
18 int32_t creation_y_size = 400;
19
20 bool in_fullscreen = false;
21 bool left_mouse_down = false;
22};
23} // namespace window
24#else
25struct GLFWwindow;
26
27namespace window {
29public:
30 GLFWwindow* window = nullptr;
31
32 int32_t creation_x_size = 600;
33 int32_t creation_y_size = 400;
34
35 bool in_fullscreen = false;
36 bool left_mouse_down = false;
37};
38} // namespace window
39#endif
40
41namespace sys {
42struct state;
43}
44
45namespace window {
48 int32_t size_x = 1024;
49 int32_t size_y = 768;
52};
53
54void create_window(sys::state& game_state,
55 creation_parameters const& params); // this function will not return until the window is closed or otherwise destroyed
56void close_window(sys::state& game_state); // close the main window
57void set_borderless_full_screen(sys::state& game_state, bool fullscreen);
58bool is_in_fullscreen(sys::state const& game_state);
59bool is_key_depressed(sys::state const& game_state, sys::virtual_key key); // why not cheer it up then?
60
61enum class cursor_type : uint8_t {
62 normal,
63 busy,
68};
69void change_cursor(sys::state& state, cursor_type type);
70
71void get_window_size(sys::state const& game_state, int& width, int& height);
72
73void emit_error_message(std::string const& content, bool fatal); // also terminates the program if fatal
74} // namespace window
Definition: constants.hpp:4
virtual_key
Definition: constants.hpp:5
window_state
Definition: window.hpp:46
void set_borderless_full_screen(sys::state &game_state, bool fullscreen)
Definition: window_nix.cpp:76
void get_window_size(sys::state const &game_state, int &width, int &height)
Definition: window_nix.cpp:68
bool is_key_depressed(sys::state const &game_state, sys::virtual_key key)
Definition: window_nix.cpp:60
bool is_in_fullscreen(sys::state const &game_state)
Definition: window_nix.cpp:72
void emit_error_message(std::string const &content, bool fatal)
Definition: window_nix.cpp:355
void close_window(sys::state &game_state)
Definition: window_nix.cpp:101
void change_cursor(sys::state &state, cursor_type type)
Definition: window_nix.cpp:351
cursor_type
Definition: window.hpp:61
void create_window(sys::state &game_state, creation_parameters const &params)
Definition: window_nix.cpp:278
uchar uint8_t
struct HWND__ * HWND
Definition: sound_win.hpp:8
window_state initial_state
Definition: window.hpp:50