12 inline void OverlayBMP(Document & doc, const char * filename, const Rect & bounds = Rect(0,0,1,1), const Colour & c = Colour(0.f,0.f,0.f,1.f))
14 View view(doc, bounds, c);
17 scr.RenderBMP(filename);
19 //MainLoop(doc, bounds, c);
21 scr.ScreenShot(filename);
24 inline void MainLoop(Document & doc, const Rect & bounds = Rect(0,0,1,1), const Colour & c = Colour(0.f,0.f,0.f,1.f))
26 View view(doc,bounds, c);
28 scr.SetMouseHandler([&](int x, int y, int buttons, int wheel) // [?] wtf
30 static bool oldButtonDown = false;
31 static int oldx, oldy;
32 if (buttons && !oldButtonDown)
34 // We're beginning a drag.
38 scr.SetMouseCursor(Screen::CursorMove);
42 view.Translate(Real(oldx-x)/Real(scr.ViewportWidth()), Real(oldy-y)/Real(scr.ViewportHeight()));
46 oldButtonDown = false;
47 scr.SetMouseCursor(Screen::CursorArrow);
54 view.ScaleAroundPoint(Real(x)/Real(scr.ViewportWidth()),Real(y)/Real(scr.ViewportHeight()), expf(-wheel/20.f));
59 while (scr.PumpEvents())