diff options
-rw-r--r-- | sdl.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
@@ -1,4 +1,6 @@ #include <iostream> +#include <iomanip> +#include <sstream> #include <SDL.h> #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); |