1
0
mirror of git://projects.qi-hardware.com/ben-blinkenlights.git synced 2024-11-16 21:18:27 +02:00

ubb-la/gui.c: add section titles and reorder some of the functions

This commit is contained in:
Werner Almesberger 2013-01-30 22:07:31 -03:00
parent 533e9643ac
commit 0925b0f060

View File

@ -45,6 +45,9 @@
static SDL_Surface *surf; static SDL_Surface *surf;
/* ----- SDL initialization and screen-wide functions ---------------------- */
void gui_init(void) void gui_init(void)
{ {
if (SDL_Init(SDL_INIT_VIDEO) < 0) { if (SDL_Init(SDL_INIT_VIDEO) < 0) {
@ -70,6 +73,16 @@ static void clear(void)
} }
static void update(void)
{
SDL_UnlockSurface(surf);
SDL_UpdateRect(surf, 0, 0, 0, 0);
}
/* ----- Waveform elements ------------------------------------------------- */
static inline int ch_y(int ch, int v) static inline int ch_y(int ch, int v)
{ {
return CH_YOFF+CH_SKIP*ch+(v ? 0 : CH_HEIGHT); return CH_YOFF+CH_SKIP*ch+(v ? 0 : CH_HEIGHT);
@ -97,6 +110,9 @@ static void level(int x0, int x1, int ch, int v)
} }
/* ----- Show (part of) a buffer ------------------------------------------- */
static void show_buffer_zoom_in(const uint8_t *buf, int skip, int nibbles, static void show_buffer_zoom_in(const uint8_t *buf, int skip, int nibbles,
int x0, int x1) int x0, int x1)
{ {
@ -206,11 +222,7 @@ static void show_buffer(const uint8_t *buf, int skip, int nibbles,
} }
static void update(void) /* ----- Main event loop --------------------------------------------------- */
{
SDL_UnlockSurface(surf);
SDL_UpdateRect(surf, 0, 0, 0, 0);
}
static int pos_step(int zoom) static int pos_step(int zoom)