-
Notifications
You must be signed in to change notification settings - Fork 0
/
global.h
73 lines (56 loc) · 1.63 KB
/
global.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#ifndef CPP_SDL2_GLOBAL_H
#define CPP_SDL2_GLOBAL_H
#include <SDL.h>
#undef main
#include <cmath>
#include <random>
#include <hlsl++.h>
using namespace hlslpp;
#include "VirtualInput.h"
struct State;
struct Settings;
struct VirtualInputs
{
VirtualAxis zoom;
VirtualAxis up_down;
VirtualAxis right_left;
VirtualToggle drag;
};
struct GlobalData
{
struct MouseData
{
float2 pos;
int2 wheel;
uint8_t button[5];
void set_buttons(uint32_t state)
{
button[0] = state & SDL_BUTTON(SDL_BUTTON_LEFT);
button[1] = state & SDL_BUTTON(SDL_BUTTON_MIDDLE);
button[2] = state & SDL_BUTTON(SDL_BUTTON_RIGHT);
button[3] = state & SDL_BUTTON(SDL_BUTTON_X1);
button[4] = state & SDL_BUTTON(SDL_BUTTON_X2);
}
};
bool running;
int2 wsize; // Window width and height
float2 fwsize; // width, height as float
SDL_Window* window = nullptr;
SDL_GLContext gl_context = nullptr;
uint8_t* keyboard_state_current = nullptr;
uint8_t* keyboard_state_previous = nullptr;
MouseData* mouse_state_current = nullptr;
MouseData* mouse_state_previous = nullptr;
VirtualInputs virtual_inputs;
State* state;
const int POTTS_Q_MAX = 10;
const int POTTS_X_MIN = 64;
const int POTTS_Y_MIN = 64;
const int POTTS_X_MAX = 16384;
const int POTTS_Y_MAX = 16384;
// seed = 1905
std::default_random_engine rgen = std::default_random_engine(1905);
};
// Defined in AppSDL.cpp
extern GlobalData G;
#endif //CPP_SDL2_GLOBAL_H