From 79b50bffb05ee2c9bd84af879f574ee521bf4669 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Sat, 28 Sep 2019 13:53:45 +0200 Subject: Show more info in SDL view --- sdl.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/sdl.cpp b/sdl.cpp index 37b6f8e..dcc2bb9 100644 --- a/sdl.cpp +++ b/sdl.cpp @@ -1,4 +1,6 @@ #include +#include +#include #include #include "mandel.h" @@ -39,12 +41,25 @@ int main() { bool need_redraw = false; + { + stringstream ss; + ss << "Mandel " + << setprecision(17) + << " x=" << par.cx + << " y=" << par.cy + << " w=" << par.imgw + << " i=" << par.maxit; + SDL_SetWindowTitle(window, ss.str().data()); + } + SDL_Event e; if (SDL_WaitEvent(&e) == 0) { cerr << "SDL event wait error: " << SDL_GetError() << endl; break; } + winsurf = SDL_GetWindowSurface(window); + switch (e.type) { case SDL_QUIT: break; @@ -114,9 +129,11 @@ int main() { winsurf = SDL_GetWindowSurface(window); SDL_GetWindowSize(window, &w, &h); + cerr << "w=" << w << " h=" << h << endl; + cerr << "surface: w=" << winsurf->w << " h=" << winsurf->h << endl; + imgdata = new uint8_t[3 * w * h]; mandelsurf = SDL_CreateRGBSurfaceFrom(imgdata, w, h, 24, 3 * w, 0x0000000ff, 0x0000ff00, 0x00ff0000, 0); ctx = mandel_init(w, h); - imgdata = new uint8_t[3 * w * h]; need_redraw = true; break; } @@ -125,6 +142,9 @@ int main() { if (need_redraw) { SDL_GetWindowSize(window, &w, &h); + cerr << "w=" << w << " h=" << h << endl; + cerr << "winsurf: w=" << winsurf->w << " h=" << winsurf->h << endl; + cerr << "mandelsurf: w=" << mandelsurf->w << " h=" << mandelsurf->h << endl; mandel_render(imgdata, ctx, &par); if (SDL_MUSTLOCK(winsurf)) SDL_LockSurface(winsurf); -- cgit v1.2.3