-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.c
68 lines (48 loc) · 1.37 KB
/
test.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include <stdlib.h>
#include <string.h>
#define IMG_LOADING
#include "terminal_gl.h"
#include "impl/backend_linux.c"
#include "tgl_gui.h"
int main(){
init_window("tgl gui example");
struct window* test = create_window("status", 30, 10);
struct window* test2 = create_window("inct log", 20, 10);
struct text_image guy = load_buffer("test.x");
printf_win(test, 0xe0, "hello there\n");
printf_win(test, 0x04, "number: %d\n", 9);
int xi = 30;
int yi = 9;
unsigned long inct = 0;
while (1){
fill_screen(' ', 0xf0);
scan_input();
printf_win(test2, 0xe0, "inct: %d\n", inct);
render_window(test, 3, 3);
render_text_image(guy, xi, yi, 0);
render_window(test2, 3, 30);
update();
scan_input();
if(is_key_pressed('l')){
clear_win(test2);
}
if(is_key_pressed('w') == 0){
printf_win(test, 0xa0, "W key pressed\n");
yi++;
}
if(is_key_pressed('a') == 0){
printf_win(test, 0xa0, "A key pressed\n");
xi++;
}
if(is_key_pressed('s') == 0){
printf_win(test, 0xa0, "S key pressed\n");
yi--;
}
if(is_key_pressed('d') == 0){
printf_win(test, 0xa0, "D key pressed\n");
xi--;
}
inct++;
}
return 0;
}