-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcursor.hh
More file actions
82 lines (65 loc) · 1.85 KB
/
cursor.hh
File metadata and controls
82 lines (65 loc) · 1.85 KB
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
#ifndef OBJSDL_CURSOR_HH
#define OBJSDL_CURSOR_HH
#include <SDL.h>
#include <initializer_list>
#include <string>
#include "geometry.hh"
struct Surface {
// TODO: Remove in favour of the real surface class
SDL_Surface* sdl_surface;
};
namespace SDL {
enum class Pixel {
_, // transparent
X, // black
O, // white
Z // inverted or black, if not available
};
namespace cursor_pixels {
extern Pixel _;
extern Pixel X;
extern Pixel O;
extern Pixel Z;
}
class Cursor {
SDL_Cursor* cursor;
bool has_control;
public:
Cursor(); // default cursor (arrow)
Cursor(Cursor&) = delete; // freeing would be a nightmare...
Cursor(Cursor&&);
// the center is positioned relative to the top left
Cursor(
const std::initializer_list<std::initializer_list<Pixel>>,
const Vector2S center={0, 0}
);
Cursor(
const std::initializer_list<std::string>,
const Vector2S center={0, 0}
);
Cursor(std::string, const Vector2S center={0, 0});
Cursor(
const std::string,
size_t width,
const Vector2S center={0, 0}
); // If you don't use newlines
Cursor(Surface&, const Vector2S center={0, 0});
private:
Cursor(const SDL_SystemCursor);
public:
~Cursor();
static Cursor pointer;
static Cursor i_beam;
static Cursor wait;
static Cursor crosshair;
static Cursor wait_and_pointer;
static Cursor arrow_nw_se;
static Cursor arrow_ne_sw;
static Cursor arrow_horizontal;
static Cursor arrow_vertical;
static Cursor arrow_cross;
static Cursor slashed_circle;
static Cursor hand;
};
}
#endif