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)