X-Git-Url: https://git.ucc.asn.au/?p=ipdf%2Fcode.git;a=blobdiff_plain;f=src%2Fscreen.h;h=ddcf8cace42c35083c763c874250fcd2009c7a63;hp=44dd2c723be7ea089fdc962c4c7bd8a826bc2571;hb=6917074cea22cd2de4a92b5c189c7ff50ede59b5;hpb=029e93dad12c51c69e47aa74dcc39f84d315bca3 diff --git a/src/screen.h b/src/screen.h index 44dd2c7..ddcf8ca 100644 --- a/src/screen.h +++ b/src/screen.h @@ -5,6 +5,9 @@ #include +#include "stb_truetype.h" +#include "graphicsbuffer.h" + namespace IPDF { /* @@ -30,6 +33,12 @@ namespace IPDF int ViewportWidth() const { return m_viewport_width; } int ViewportHeight() const { return m_viewport_height; } + // Debug Font handling + void DebugFontInit(const char *font_name, float font_size = 12); + void DebugFontClear(); + void DebugFontPrint(const char *str); + void DebugFontPrintF(const char *fmt, ...); + // Handle mouse input. typedef std::function MouseHandler; void SetMouseHandler(MouseHandler handler) @@ -51,6 +60,7 @@ namespace IPDF void RenderBMP(const char * filename) const; private: void ResizeViewport(int width, int height); + void DebugFontFlush(); MouseHandler m_mouse_handler; int m_last_mouse_x; @@ -60,6 +70,15 @@ namespace IPDF int m_viewport_height; SDL_Window *m_window; SDL_GLContext m_gl_context; + stbtt_bakedchar m_debug_font_rects[96]; + unsigned int m_debug_font_atlas; + float m_debug_font_x; + float m_debug_font_y; + float m_debug_font_size; + GraphicsBuffer m_debug_font_vertices; + GraphicsBuffer m_debug_font_indices; + int m_debug_font_vertex_head; + int m_debug_font_index_head; }; }