nngn
Loading...
Searching...
No Matches
glfw.h
Go to the documentation of this file.
1#ifndef NNGN_GRAPHICS_GLFW_H
2#define NNGN_GRAPHICS_GLFW_H
3
4#include "utils/utils.h"
5
6#include "graphics.h"
7
8namespace nngn {
9
10class GLFWBackend : public Graphics {
22protected:
24 GLFWwindow *w = nullptr;
28 bool create_window(void);
29public:
31 GLFWBackend(void) = default;
32 explicit GLFWBackend(const Parameters &p) : params(p) {}
33 ~GLFWBackend(void) override;
34 bool init_glfw(void) const;
35 bool window_closed(void) const final;
36 int swap_interval(void) const final { return this->m_swap_interval; }
37 nngn::uvec2 window_size(void) const override;
38 void get_keys(size_t n, int32_t *keys) const override;
39 ivec2 mouse_pos(void) const override;
40 void set_swap_interval(int i) override;
41 void set_window_title(const char *t) final;
42 void set_cursor_mode(CursorMode m) final;
43 void set_size_callback(void *data, size_callback_f f) override;
44 void set_key_callback(void *data, key_callback_f f) override;
46 void *data, mouse_button_callback_f f) override;
48 void *data, mouse_move_callback_f f) override;
49 void resize(int, int) override {}
50 void set_camera(const Camera &c) override { this->camera = c; }
51 void set_lighting(const Lighting &l) override { this->lighting = l; }
52 void poll_events(void) const final;
53 bool render(void) override;
54};
55
56}
57
58#endif
local class const
Definition animation.lua:7
Definition glfw.h:10
void set_key_callback(void *data, key_callback_f f) override
Definition glfw.cpp:99
void set_mouse_move_callback(void *data, mouse_move_callback_f f) override
Definition glfw.cpp:124
void set_cursor_mode(CursorMode m) final
Definition glfw.cpp:80
void set_swap_interval(int i) override
Definition glfw.cpp:72
void get_keys(size_t n, int32_t *keys) const override
Definition glfw.cpp:60
~GLFWBackend(void) override
Definition glfw.cpp:24
struct nngn::GLFWBackend::CallbackData callback_data
bool render(void) override
Definition glfw.cpp:138
Lighting lighting
Definition glfw.h:27
bool init_glfw(void) const
Definition glfw.cpp:30
void resize(int, int) override
Definition glfw.h:49
Camera camera
Definition glfw.h:26
bool create_window(void)
Definition glfw.cpp:38
void set_size_callback(void *data, size_callback_f f) override
Definition glfw.cpp:86
void set_mouse_button_callback(void *data, mouse_button_callback_f f) override
Definition glfw.cpp:110
void set_window_title(const char *t) final
Definition glfw.cpp:76
nngn::uvec2 window_size(void) const override
Definition glfw.cpp:54
int m_swap_interval
Definition glfw.h:23
bool window_closed(void) const final
Definition glfw.cpp:50
int swap_interval(void) const final
Definition glfw.h:36
ivec2 mouse_pos(void) const override
Definition glfw.cpp:66
void set_camera(const Camera &c) override
Definition glfw.h:50
void poll_events(void) const final
Definition glfw.cpp:137
GLFWwindow * w
Definition glfw.h:24
Parameters params
Definition glfw.h:25
void set_lighting(const Lighting &l) override
Definition glfw.h:51
for i
Definition font.lua:5
local n
Definition dump_lights.lua:5
local c
Definition gamma.lua:11
local data
Definition house0.lua:10
local l
Definition light.lua:23
Definition audio.cpp:7
local m
Definition input.lua:28
local function f()) end
#define NNGN_MOVE_ONLY(x)
Definition utils.h:39
void * size_cb_data
Definition glfw.h:17
void * key_cb_data
Definition glfw.h:18
size_callback_f size_cb
Definition glfw.h:13
mouse_button_callback_f mouse_button_cb
Definition glfw.h:15
mouse_move_callback_f mouse_move_cb
Definition glfw.h:16
Graphics * p
Definition glfw.h:12
void * mouse_move_cb_data
Definition glfw.h:20
void * mouse_button_cb_data
Definition glfw.h:19
key_callback_f key_cb
Definition glfw.h:14
Definition graphics.h:250
Definition graphics.h:255
Definition graphics.h:149
Definition graphics.h:138
void(*)(void *, int, int, int, int) key_callback_f
Definition graphics.h:140
void(*)(void *, dvec2) mouse_move_callback_f
Definition graphics.h:142
CursorMode
Definition graphics.h:249
void(*)(void *, uvec2) size_callback_f
Definition graphics.h:139
void(*)(void *, int, int, int) mouse_button_callback_f
Definition graphics.h:141