/
window.h
137 lines (120 loc) · 2.74 KB
/
window.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/*
Copyright (c) 2017-2020 ByteBit
This file is part of BetterSpades.
BetterSpades is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
BetterSpades is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with BetterSpades. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef WINDOW_H
#define WINDOW_H
#include "common.h"
#include <stddef.h>
struct window_instance {
void* impl;
};
enum {
WINDOW_PRESS,
WINDOW_RELEASE,
WINDOW_REPEAT,
};
enum {
TOUCH_DOWN,
TOUCH_MOVE,
TOUCH_UP,
};
enum window_keys {
WINDOW_KEY_UNKNOWN,
WINDOW_KEY_UP,
WINDOW_KEY_DOWN,
WINDOW_KEY_LEFT,
WINDOW_KEY_RIGHT,
WINDOW_KEY_SNEAK,
WINDOW_KEY_CROUCH,
WINDOW_KEY_SPRINT,
WINDOW_KEY_SPACE,
WINDOW_KEY_CURSOR_UP,
WINDOW_KEY_CURSOR_DOWN,
WINDOW_KEY_CURSOR_LEFT,
WINDOW_KEY_CURSOR_RIGHT,
WINDOW_KEY_TAB,
WINDOW_KEY_ESCAPE,
WINDOW_KEY_YES,
WINDOW_KEY_NO,
WINDOW_KEY_RELOAD,
WINDOW_KEY_TOOL1,
WINDOW_KEY_TOOL2,
WINDOW_KEY_TOOL3,
WINDOW_KEY_TOOL4,
WINDOW_KEY_PICKCOLOR,
WINDOW_KEY_CHAT,
WINDOW_KEY_F1,
WINDOW_KEY_F2,
WINDOW_KEY_F3,
WINDOW_KEY_F4,
WINDOW_KEY_CHANGETEAM,
WINDOW_KEY_CHANGEWEAPON,
WINDOW_KEY_ENTER,
WINDOW_KEY_BACKSPACE,
WINDOW_KEY_MAP,
WINDOW_KEY_VOLUME_UP,
WINDOW_KEY_VOLUME_DOWN,
WINDOW_KEY_V,
WINDOW_KEY_FULLSCREEN,
WINDOW_KEY_SCREENSHOT,
WINDOW_KEY_COMMAND,
WINDOW_KEY_HIDEHUD,
WINDOW_KEY_LASTTOOL,
WINDOW_KEY_NETWORKSTATS,
WINDOW_KEY_SHIFT,
WINDOW_KEY_SAVE_MAP,
WINDOW_KEY_SELECT1,
WINDOW_KEY_SELECT2,
WINDOW_KEY_SELECT3,
};
enum {
WINDOW_CURSOR_DISABLED,
WINDOW_CURSOR_ENABLED,
};
enum window_buttons {
WINDOW_MOUSE_LMB,
WINDOW_MOUSE_MMB,
WINDOW_MOUSE_RMB,
};
struct window_finger {
#ifdef USE_SDL
SDL_FingerID finger;
#else
int finger;
#endif
float down_time;
int full;
struct {
float x, y;
} start;
};
extern int window_pressed_keys[64];
#define WINDOW_NOMOUSELOC -1
void window_textinput(int allow);
float window_time(void);
void window_keyname(int keycode, char* output, size_t length);
const char* window_clipboard(void);
int window_key_down(int key);
void window_mousemode(int mode);
void window_mouseloc(double* x, double* y);
void window_setmouseloc(double x, double y);
void window_swapping(int value);
void window_init(void);
void window_fromsettings(void);
void window_deinit(void);
void window_update(void);
int window_closed(void);
int window_cpucores();
void window_title(char* suffix);
#endif