-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgled.c
48 lines (37 loc) · 877 Bytes
/
gled.c
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
#include "gled.h"
#include <SDL2/SDL.h>
#include <SDL2/SDL_ttf.h>
#include "window.h"
static Window* main_win;
int gled_init() {
if (SDL_Init(SDL_INIT_EVERYTHING) != 0) {
printf("SDL init failed.\n");
return -1;
}
if (TTF_Init() != 0) {
printf("TTF init failed: %s\n", TTF_GetError());
return -2;
}
main_win = new_Window(40, 25);
if (main_win == NULL) {
return -3;
}
window_redraw(main_win);
return 0;
}
void gled_quit() {
del_Window(main_win);
SDL_Quit();
}
void gled_redraw() { window_redraw(main_win); }
void gled_update() {
window_update(main_win);
window_redraw(main_win);
}
void gled_clear() {}
void gled_resize(uint64_t cols, uint64_t rows) {
window_resize(main_win, cols, rows);
}
void gled_onmousepress(uint64_t x, uint64_t y) {}
void gled_onmouserelease(uint64_t x, uint64_t y) {}
void gled_set_mainwin(Window* w) { main_win = w; }