35 Window(
unsigned int width_px = 700,
unsigned int height_px = 700,
const std::string &window_name =
"my program",
36 bool start_in_fullscreen =
false,
bool start_with_mouse_captured =
false,
bool vsync =
false,
37 bool print_out_opengl_data =
false);
58 std::tuple<unsigned int, unsigned int>
reduce_ratio(std::tuple<unsigned int, unsigned int> ratio) {
59 auto [num, den] = ratio;
65 unsigned int g = std::gcd(num, den);
66 return {num /
g, den /
g};
74 return [tick,
this](
double dt) {
76 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
unsigned int width_px
Definition window.hpp:32
void toggle_fullscreen()
Definition window.cpp:248
void enable_cursor()
Definition window.cpp:240
unsigned int height_px
Definition window.hpp:32
std::tuple< unsigned int, unsigned int > reduce_ratio(std::tuple< unsigned int, unsigned int > ratio)
Definition window.hpp:58
~Window()
Definition window.cpp:88
void disable_wireframe_mode()
Definition window.cpp:246
void enable_fullscreen()
Definition window.cpp:269
bool cursor_is_disabled
Definition window.hpp:86
std::function< void(double)> wrap_tick_with_required_glfw_calls(std::function< void(double)> tick)
Definition window.hpp:73
bool window_should_close()
Definition window.hpp:45
bool window_in_fullscreen
Definition window.hpp:87
void toggle_mouse_mode()
Definition window.cpp:227
Window(unsigned int width_px=700, unsigned int height_px=700, const std::string &window_name="my program", bool start_in_fullscreen=false, bool start_with_mouse_captured=false, bool vsync=false, bool print_out_opengl_data=false)
Definition window.cpp:11
int top_left_corner_of_window_x
Definition window.hpp:33
std::tuple< unsigned int, unsigned int > get_aspect_ratio_in_simplest_terms()
Definition window.hpp:69
void enable_wireframe_mode()
Definition window.cpp:245
void print_opengl_info()
make a glfw window
Definition window.cpp:108
GLFWwindow * glfw_window
Definition window.hpp:39
void set_resolution(const std::string &resolution)
Definition window.cpp:368
void set_fullscreen_by_on_off(const std::string &on_off_string)
Definition window.cpp:382
void disable_fullscreen()
Definition window.cpp:282
int top_left_corner_of_window_y
Definition window.hpp:33
void disable_cursor()
Definition window.cpp:236
int width
Definition window.hpp:15
int height
Definition window.hpp:16
int refresh_rate
Definition window.hpp:17
friend std::ostream & operator<<(std::ostream &os, const VideoMode &vm)
Definition window.hpp:19
std::vector< std::string > get_available_resolutions(const std::optional< std::string > &aspect_ratio=std::nullopt)
Definition window.cpp:357