diff options
author | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2019-09-07 10:49:21 +0200 |
---|---|---|
committer | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2019-09-07 10:49:21 +0200 |
commit | 25effd17ef1a1a05d671382b9a51be29734226a0 (patch) | |
tree | 6423936fde1f874e2e68b29daeaedda66d371606 /src/scene00.c | |
parent | df3ce9eb9e0d8633cdb32a0106a5aa1ca9300e2b (diff) | |
download | demoscene-eo-25effd17ef1a1a05d671382b9a51be29734226a0.tar.gz demoscene-eo-25effd17ef1a1a05d671382b9a51be29734226a0.tar.bz2 demoscene-eo-25effd17ef1a1a05d671382b9a51be29734226a0.zip |
Multi-process done. GL has to be done cleanly now.
Diffstat (limited to 'src/scene00.c')
-rw-r--r-- | src/scene00.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/scene00.c b/src/scene00.c index b1e4e57..f8df185 100644 --- a/src/scene00.c +++ b/src/scene00.c @@ -51,11 +51,7 @@ int scene00_next_gl(graphical_env_t *ge, scene00_env_t *se) { int scene00_next_sdl(graphical_env_t *ge, scene00_env_t *se) { // Shorthands - caca_canvas_t *cv = ge->cv; - int w = ge->w, h = ge->h; SDL_Renderer *r = ge->sdl_rndr; - // Local vars - int res; // https://gist.github.com/Twinklebear/8265888 // https://forums.libsdl.org/viewtopic.php?p=51634 @@ -65,17 +61,16 @@ int scene00_next_sdl(graphical_env_t *ge, scene00_env_t *se) { SDL_RenderCopy(r, se->eo1, NULL, NULL); // [...] - // Copy the SDL screen to SDL debug window (and display it, not mandatory) +#ifdef DEBUG + // Copy the target texture to SDL debug window (and display it, not mandatory) SDL_SetRenderTarget(r, NULL); SDL_RenderCopy(r, ge->sdl_target, NULL, NULL); SDL_RenderPresent(r); + SDL_SetRenderTarget(r, ge->sdl_target); +#endif // Download the rendered texture from videocard to main memory - SDL_SetRenderTarget(r, ge->sdl_target); - res = SDL_RenderReadPixels(r, NULL, 0, ge->raw_target, 256*4); - - // "convert" the raw pixel stream to ASCII art on caca canevas - if ( res == 0 ) caca_dither_bitmap(cv, 0, 0, w, h, ge->d, ge->raw_target); + SDL_RenderReadPixels(r, NULL, 0, ge->raw_target, FBUF_W*4); return 0; } @@ -86,6 +81,9 @@ int scene00_next_caca(graphical_env_t *ge, scene00_env_t *se) { int w = ge->w, h = ge->h; Uint32 frame = ge->sc_framecount; + // "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); + // Add things on top of caca canvas caca_set_color_ansi(cv, CACA_BLACK, CACA_WHITE); caca_put_str(cv, (w-17)/2, h/2, "This is a message"); |