From a5338c572975a82b9efbf95755103176ebbb67a8 Mon Sep 17 00:00:00 2001 From: Ludovic Pouzenc Date: Sun, 8 Sep 2019 01:52:45 +0200 Subject: alarm(1) before SEM_WAIT(...) in worker_(sdl|gl) to avoid edge cases --- src/scene00.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/scene00.c') diff --git a/src/scene00.c b/src/scene00.c index 0d6a02e..f418146 100644 --- a/src/scene00.c +++ b/src/scene00.c @@ -20,10 +20,12 @@ #include "scene00.h" int scene00_init_gl(graphical_env_t *ge, scene00_env_t *se) { + TRACE("call"); return 0; } int scene00_init_sdl(graphical_env_t *ge, scene00_env_t *se) { + TRACE("call"); SDL_Surface *bmpSurf = SDL_LoadBMP("./res/eo1.bmp"); se->eo1 = SDL_CreateTextureFromSurface(ge->sdl_rndr, bmpSurf); SDL_FreeSurface(bmpSurf); @@ -32,20 +34,25 @@ int scene00_init_sdl(graphical_env_t *ge, scene00_env_t *se) { } int scene00_init_caca(graphical_env_t *ge, scene00_env_t *se) { + TRACE("call"); return 0; } void scene00_free_gl(graphical_env_t *ge, scene00_env_t *se) { + TRACE("call"); } void scene00_free_sdl(graphical_env_t *ge, scene00_env_t *se) { + TRACE("call"); SDL_DestroyTexture(se->eo1); se->eo1=NULL; } void scene00_free_caca(graphical_env_t *ge, scene00_env_t *se) { + TRACE("call"); } int scene00_next_gl(graphical_env_t *ge, scene00_env_t *se) { + static int firsttime=1; TRACE_ONCE("call"); return 0; } @@ -53,6 +60,8 @@ int scene00_next_sdl(graphical_env_t *ge, scene00_env_t *se) { // Shorthands SDL_Renderer *r = ge->sdl_rndr; + static int firsttime=1; TRACE_ONCE("call"); + // https://gist.github.com/Twinklebear/8265888 // https://forums.libsdl.org/viewtopic.php?p=51634 @@ -81,6 +90,8 @@ int scene00_next_caca(graphical_env_t *ge, scene00_env_t *se) { int w = ge->w, h = ge->h; Uint32 frame = ge->sc_framecount; + static int firsttime=1; TRACE_ONCE("call"); + // "convert" the raw pixel stream from SDL to ASCII art on caca canevas caca_dither_bitmap(cv, 0, 0, w, h, ge->d, ge->raw_target); -- cgit v1.2.3