]> git.lizzy.rs Git - nothing.git/blob - src/ui/cursor.h
(#974) Fix another oversight
[nothing.git] / src / ui / cursor.h
1 #ifndef CURSOR_H_
2 #define CURSOR_H_
3
4 #include <SDL.h>
5
6 #define CURSOR_ICON_WIDTH 32
7 #define CURSOR_ICON_HEIGHT 32
8
9 typedef enum {
10     CURSOR_STYLE_POINTER = 0,
11     CURSOR_STYLE_RESIZE_VERT,
12     CURSOR_STYLE_RESIZE_HORIS,
13     CURSOR_STYLE_RESIZE_DIAG1,
14     CURSOR_STYLE_RESIZE_DIAG2,
15
16     CURSOR_STYLE_N
17 } Cursor_Style;
18
19 static const char * const cursor_style_tex_files[CURSOR_STYLE_N] = {
20     "./assets/images/cursor.bmp",
21     "./assets/images/cursor-resize-vert.bmp",
22     "./assets/images/cursor-resize-horis.bmp",
23     "./assets/images/cursor-resize-diag1.bmp",
24     "./assets/images/cursor-resize-diag2.bmp"
25 };
26
27 static const int cursor_style_tex_pivots[CURSOR_STYLE_N][2] = {
28     {0, 0},
29     {CURSOR_ICON_WIDTH / 2, CURSOR_ICON_HEIGHT / 2},
30     {CURSOR_ICON_WIDTH / 2, CURSOR_ICON_HEIGHT / 2},
31     {CURSOR_ICON_WIDTH / 2, CURSOR_ICON_HEIGHT / 2},
32     {CURSOR_ICON_WIDTH / 2, CURSOR_ICON_HEIGHT / 2}
33 };
34
35 typedef struct {
36     SDL_Texture *texs[CURSOR_STYLE_N];
37     Cursor_Style style;
38 } Cursor;
39
40 int cursor_render(const Cursor *cursor, SDL_Renderer *renderer);
41
42 #endif  // CURSOR_H_