forked from cyxx/linyaga
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsys.h
80 lines (70 loc) · 1.64 KB
/
sys.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
#ifndef SYS_H__
#define SYS_H__
#include "intern.h"
#define INPUT_DIRECTION_LEFT (1 << 0)
#define INPUT_DIRECTION_RIGHT (1 << 1)
#define INPUT_DIRECTION_UP (1 << 2)
#define INPUT_DIRECTION_DOWN (1 << 3)
#define SYS_AUDIO_FREQ 22050
struct event_t {
enum {
EVENT_QUIT,
EVENT_MOUSE_MOTION,
EVENT_MOUSE_BUTTON_DOWN,
EVENT_MOUSE_BUTTON_UP,
EVENT_KEY_DOWN,
EVENT_KEY_UP,
EVENT_WINDOW_FOCUS,
} type;
union {
struct {
int x, y;
} mouse_motion;
int mouse_button;
int key_code;
int window_focus;
} data;
};
enum {
KEYCODE_FIRST = 0x100,
KEYCODE_ESCAPE = KEYCODE_FIRST,
KEYCODE_F1,
KEYCODE_F2,
KEYCODE_F3,
KEYCODE_F4,
KEYCODE_F5,
KEYCODE_F6,
KEYCODE_F7,
KEYCODE_F8,
KEYCODE_F9,
KEYCODE_F10,
KEYCODE_F11,
KEYCODE_F12,
KEYCODE_BACKSPACE,
KEYCODE_TAB,
KEYCODE_ENTER,
KEYCODE_SHIFT,
KEYCODE_CONTROL,
KEYCODE_ALT,
KEYCODE_UP,
KEYCODE_DOWN,
KEYCODE_LEFT,
KEYCODE_RIGHT
};
typedef void (*SysAudioCb)(void *, uint8_t *data, int len);
int System_Init();
void System_Fini();
void System_SetIcon(const uint8_t *data, int size);
void System_SetScreenWindowed(int flag);
void System_SetScreenSize(int w, int h);
void System_SetScreenTitle(const char *caption);
void System_UpdateScreen(const void *p);
void System_UpdateScreenYUV(int w, int h, const uint8_t *ydata, int ysize, const uint8_t *udata, int usize, const uint8_t *vdata, int vsize);
int System_LoadCursor(const uint32_t *rgba, int w, int h);
void System_SetCursor(int num);
bool System_PollEvent(struct event_t *ev);
void System_StartAudio(SysAudioCb callback, void *param);
void System_StopAudio();
void System_LockAudio();
void System_UnlockAudio();
#endif /* SYS_H__ */