#include <functional>
+#include "stb_truetype.h"
+#include "graphicsbuffer.h"
+#include "shaderprogram.h"
+
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<void(int x, int y, int button, int wheel)> MouseHandler;
void SetMouseHandler(MouseHandler handler)
void ScreenShot(const char * filename) const;
void RenderBMP(const char * filename) const;
+ void RenderPixels(int x, int y, int w, int h, uint8_t * pixels) const;
+
+
+ // Returns the CPU time (in seconds) it took to render the last completed frame.
+ double GetLastFrameTimeCPU() const { return m_last_frame_time / SDL_GetPerformanceFrequency(); }
+ // Returns the GPU time (in seconds) it took to render the last completed frame.
+ double GetLastFrameTimeGPU() const;
private:
void ResizeViewport(int width, int height);
+ void DebugFontFlush();
MouseHandler m_mouse_handler;
int m_last_mouse_x;
int m_last_mouse_y;
+ double m_last_frame_time;
+ double m_frame_begin_time;
+ GLuint m_frame_gpu_timer;
+ GLuint m_last_frame_gpu_timer;
+
int m_viewport_width;
int m_viewport_height;
SDL_Window *m_window;
SDL_GLContext m_gl_context;
+ ShaderProgram m_texture_prog;
+ GLint m_colour_uniform_location;
+ GraphicsBuffer m_viewport_ubo;
+ 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;
};
}