PixelBullet  0.0.1
A C++ game engine
Loading...
Searching...
No Matches
callback_adapter.h
1#pragma once
2
3#include "pixelbullet/application/event.h"
4#include "pixelbullet/input/input.h"
5
6#include <cstdint>
7#include <functional>
8
9#include <glm/glm.hpp>
10
11namespace pixelbullet::glfw_window_internal
12{
14{
15public:
16 struct State
17 {
18 unsigned int& width;
19 unsigned int& height;
20 glm::ivec2& position;
21 bool& focused;
22 bool& fullscreen;
23 glm::ivec2& size;
24 glm::ivec2& fullscreen_size;
25 uint32_t window_id;
26 input::InputState& input_state;
27 const std::function<void(Event&)>& event_callback;
28 const std::function<void(uint32_t)>& framebuffer_resize_callback;
29 };
30
31 enum class KeyAction
32 {
33 Press,
34 Release,
35 Repeat
36 };
37
38 enum class MouseButtonAction
39 {
40 Press,
41 Release
42 };
43
44 static void HandleWindowSize(State state, int width, int height);
45 static void HandleWindowClose(State state);
46 static void HandleKeyAction(State state, input::KeyCode key_code, KeyAction action);
47 static void HandleKeyTyped(State state, input::KeyCode key_code);
48 static void HandleMouseButtonAction(State state, input::MouseCode button, MouseButtonAction action);
49 static void HandleMouseScroll(State state, float x_offset, float y_offset);
50 static void HandleCursorPosition(State state, float x_pos, float y_pos);
51 static void HandleFramebufferSize(State state, int width, int height);
52 static void HandleFocusChanged(State state, bool focused);
53 static void HandleWindowMoved(State state, int x, int y);
54};
55} // namespace pixelbullet::glfw_window_internal
Definition event.h:72
Definition input.h:20