|
1 | | -// Copyright 2012-2020 Jan Niklas Hasse <jhasse@bixense.com> |
| 1 | +// Copyright 2012-2026 Jan Niklas Hasse <jhasse@bixense.com> |
2 | 2 | // For conditions of distribution and use, see copyright notice in LICENSE.txt |
3 | 3 |
|
4 | 4 | #pragma once |
|
7 | 7 | #include <map> |
8 | 8 |
|
9 | 9 | namespace jngl { |
10 | | - class AppleController; |
11 | | - class Vec2; |
12 | | - class Window; |
13 | | - |
14 | | - class WindowImpl { |
15 | | - public: |
16 | | - WindowImpl(Window*); |
17 | | - WindowImpl(const WindowImpl&) = delete; |
18 | | - WindowImpl& operator=(const WindowImpl&) = delete; |
19 | | - |
20 | | - enum class Touch { |
21 | | - BEGAN, |
22 | | - ENDED, |
23 | | - MOVED, |
24 | | - }; |
25 | | - |
26 | | - void handleTouch(const std::pair<intptr_t, Vec2>*, size_t count, Touch); |
27 | | - // ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ TODO: use std::span |
28 | | - |
29 | | - void setMouseDown(bool); |
30 | | - void setRelativeMouseMode(bool); |
31 | | - int relativeX = 0; |
32 | | - int relativeY = 0; |
33 | | - void updateInput(); |
34 | | - |
35 | | - std::map<int64_t, Vec2> touches; |
36 | | - |
37 | | - bool shouldCallControllerChangedCallback = false; |
38 | | - std::map<void*, std::shared_ptr<AppleController>> appleControllers; |
39 | | - |
40 | | - private: |
41 | | - Window* const window; |
42 | | - int mouseX = 0; |
43 | | - int mouseY = 0; |
| 10 | + |
| 11 | +class AppleController; |
| 12 | +class Vec2; |
| 13 | +class Window; |
| 14 | + |
| 15 | +class WindowImpl { |
| 16 | +public: |
| 17 | + WindowImpl(Window*); |
| 18 | + WindowImpl(const WindowImpl&) = delete; |
| 19 | + WindowImpl& operator=(const WindowImpl&) = delete; |
| 20 | + |
| 21 | + enum class Touch { |
| 22 | + BEGAN, |
| 23 | + ENDED, |
| 24 | + MOVED, |
44 | 25 | }; |
45 | | -} |
| 26 | + |
| 27 | + void handleTouch(const std::pair<intptr_t, Vec2>*, size_t count, Touch); |
| 28 | + // ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ TODO: use std::span |
| 29 | + |
| 30 | + void setMouseDown(bool); |
| 31 | + void setRelativeMouseMode(bool); |
| 32 | + int relativeX = 0; |
| 33 | + int relativeY = 0; |
| 34 | + void updateInput(); |
| 35 | + |
| 36 | + std::map<int64_t, Vec2> touches; |
| 37 | + |
| 38 | + bool shouldCallControllerChangedCallback = false; |
| 39 | + std::map<void*, std::shared_ptr<AppleController>> appleControllers; |
| 40 | + |
| 41 | + void sleepIfNeeded(); |
| 42 | + |
| 43 | +private: |
| 44 | + Window* const window; |
| 45 | + int mouseX = 0; |
| 46 | + int mouseY = 0; |
| 47 | +}; |
| 48 | + |
| 49 | +} // namespace jngl |
0 commit comments