PixelBullet  0.0.1
A C++ game engine
Loading...
Searching...
No Matches
callback_adapter_internal.h
1#pragma once
2
3#include "pixelbullet/core/event.h"
4#include "pixelbullet/input/input.h"
5
6#include <cstdint>
7#include <functional>
8
9#include <glm/glm.hpp>
10
11namespace pixelbullet::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 glm::vec2& content_scale;
26 uint32_t window_id;
28 const std::function<void(pixelbullet::core::Event&)>& event_callback;
29 const std::function<void(uint32_t)>& framebuffer_resize_callback;
30 };
31
32 enum class KeyAction
33 {
34 Press,
35 Release,
36 Repeat
37 };
38
39 enum class MouseButtonAction
40 {
41 Press,
42 Release
43 };
44
45 static void HandleWindowSize(State state, int width, int height);
46 static void HandleWindowClose(State state);
47 static void HandleKeyAction(State state, pixelbullet::input::KeyCode key_code, KeyAction action);
48 static void HandleTextInput(State state, char32_t codepoint);
49 static void HandleMouseButtonAction(State state, pixelbullet::input::MouseCode button, MouseButtonAction action);
50 static void HandleMouseScroll(State state, float x_offset, float y_offset);
51 static void HandleCursorPosition(State state, float x_pos, float y_pos);
52 static void HandleFramebufferSize(State state, int width, int height);
53 static void HandleContentScale(State state, float x_scale, float y_scale);
54 static void HandleFocusChanged(State state, bool focused);
55 static void HandleWindowMoved(State state, int x, int y);
56};
57} // namespace pixelbullet::window_internal
Definition event.h:108
Definition callback_adapter_internal.h:14
Definition input.h:20