8 #include "stb_truetype.h"
13 * The "Screen" class handles managing the OS window (using SDL2).
21 // 'Pumps' the system event queue.
22 // Returns 'false' if the program should quit.
25 // Clears the screen to a given colour.
26 void Clear(float r=1.0, float g=1.0, float b=1.0, float a=1.0);
28 // Finishes rendering a frame, and presents it on the screen.
31 // Get the current width/height of the window's viewport.
32 int ViewportWidth() const { return m_viewport_width; }
33 int ViewportHeight() const { return m_viewport_height; }
35 // Debug Font handling
36 void DebugFontInit(const char *font_name, float font_size = 12);
37 void DebugFontClear();
38 void DebugFontPrint(const char *str);
39 void DebugFontPrintF(const char *fmt, ...);
41 // Handle mouse input.
42 typedef std::function<void(int x, int y, int button, int wheel)> MouseHandler;
43 void SetMouseHandler(MouseHandler handler)
45 m_mouse_handler = handler;
56 void SetMouseCursor(MouseCursors cursor);
58 void ScreenShot(const char * filename) const;
59 void RenderBMP(const char * filename) const;
61 void ResizeViewport(int width, int height);
63 MouseHandler m_mouse_handler;
68 int m_viewport_height;
70 SDL_GLContext m_gl_context;
71 stbtt_bakedchar m_debug_font_rects[96];
72 unsigned int m_debug_font_atlas;
75 float m_debug_font_size;