From 0925b0f060401ee2335c9cf60acced2a53c9e742 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Wed, 30 Jan 2013 22:07:31 -0300 Subject: [PATCH] ubb-la/gui.c: add section titles and reorder some of the functions --- ubb-la/gui.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/ubb-la/gui.c b/ubb-la/gui.c index e7834f3..9a94be7 100644 --- a/ubb-la/gui.c +++ b/ubb-la/gui.c @@ -45,6 +45,9 @@ static SDL_Surface *surf; +/* ----- SDL initialization and screen-wide functions ---------------------- */ + + void gui_init(void) { 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) { 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, int x0, int x1) { @@ -206,11 +222,7 @@ static void show_buffer(const uint8_t *buf, int skip, int nibbles, } -static void update(void) -{ - SDL_UnlockSurface(surf); - SDL_UpdateRect(surf, 0, 0, 0, 0); -} +/* ----- Main event loop --------------------------------------------------- */ static int pos_step(int zoom)