summaryrefslogtreecommitdiff
path: root/draw/glui.c
blob: 3e85646173980c8d8cbdf2878da7bb68a706c65b (plain) (blame)
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#include "glui.h"

#define DEFAULT_TITLE "RADIOLA"
#define SCREEN_X 640
#define SCREEN_Y 480

int glui_init( glui_t **t )
{
	int ret=-1;

	glui_t *tui = NULL;

	tui = malloc( sizeof(glui_t) );
	if (tui == NULL)
	{
		return -1;
	}

	memset(tui, 0, sizeof(glui_t));

	if ( SDL_Init(SDL_INIT_VIDEO) != 0)
	{
		printf("Cannot init sdl\n");
		return -1;
	}

	tui->win = SDL_CreateWindow("Hello World!", 100, 100, SCREEN_X, SCREEN_Y, SDL_WINDOW_SHOWN);
	if (tui->win == NULL)
	{
		printf("Couldnt create SDL window\n");
		return -1;
	}

	tui->rend = SDL_CreateRenderer( tui->win, -1, SDL_RENDERER_ACCELERATED);



	return ret;
}


//init waterfall
int glui_waterfall( glui_t **t, glui_waterfall_t **w )
{
	int ret=-1;
	

	return ret;
}


//first draw, draw all buffer
int glui_waterfall_draw( glui_waterfall_t *w )
{
	int ret=-1;
	

	return ret;
}


//redraw only changed lines
int glui_waterfall_redraw( glui_waterfall_t *w )
{
	int ret=-1;
	

	return ret;
}


//update params of waterfall and then need to draw not redraw
int glui_waterfall_update( glui_t *w )
{
	int ret=-1;
	

	return ret;
}


//push one line of data to buffer
int glui_waterfall_data( glui_t *w, int len, uint8_t *buf )
{
	int ret=-1;
	

	return ret;
}


//return color
uint8_t glui_waterfall_color( uint8_t d )
{
	uint8_t c;
	

	return c;
}


//close terminal ui
int glui_close( glui_t *t )
{
	int ret=0;
	
	if ( t->rend )
	{
		SDL_DestroyRenderer( t->rend );
	}

	if ( t->win != NULL )
	{
		SDL_DestroyWindow( t->win );
	}

	SDL_Quit();


	return ret;
}