-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGUI_conscreen.c
58 lines (53 loc) · 1.32 KB
/
GUI_conscreen.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
#ifdef CONSCREEN
#include "Conscreen/Conscreen_console.h"
#include "Conscreen/Conscreen_screen.h"
#include "GUI_impl.h"
#include "Conscreen/Conscreen.h"
#include <stdint.h>
struct Rect get_screen_dimensions()
{
Conscreen_point btc = Conscreen_screen_size();
return (struct Rect){0,0, btc.x, btc.y};
}
void Draw_Rect(struct Rect *rect, struct Color col)
{
for(uint16_t y=rect->top; y<rect->bottom; y++){
for(uint16_t x=rect->left; x<rect->right; x++){
char c = '#';
if(col.r+col.g+col.b==0)
c=0;
Conscreen_pixel p = {
.character=c,
.style = CONSCREEN_ANSI_DEFAULT(col.r, col.g, col.b)
};
Conscreen_screen_set(x,y, p);
}
}
}
//void Draw_Text(int x, int y, const char *text, size_t len, int size, struct Color col);
void Draw_end(){
Conscreen_screen_flush();
}
void Draw_begin(){
Conscreen_screen_begin();
/* Conscreen_point size = Conscreen_screen_size(); */
/* printf("Screen size %d %d\n", size.x, size.y); */
}
int GUI_impl_create()
{
Conscreen_init();
current_state.conf->active=1;
return 0;
}
int GUI_impl_destroy()
{
Conscreen_deinit();
current_state.conf->active=0;
return 0;
}
void GUI_impl_update()
{
GUI_render();
// pass input to Sorttest
}
#endif