viewer.h
#ifndef CMU462_VIEWER_H
#define CMU462_VIEWER_H
#include "renderer.h"
#include "osdtext.h"
#include <chrono>
#include "GLFW/glfw3.h"
namespace CMU462 {
class Viewer {
public:
Viewer( void );
Viewer( const char* title );
~Viewer( void );
void init( void );
void start( void );
void set_renderer( Renderer *renderer );
private:
static void update( void );
static void drawInfo( void );
// window event callbacks
static void err_callback( int error, const char* description );
static void key_callback( GLFWwindow* window, int key, int scancode, int action, int mods );
static void resize_callback( GLFWwindow* window, int width, int height );
static void cursor_callback( GLFWwindow* window, double xpos, double ypos );
static void scroll_callback( GLFWwindow* window, double xoffset, double yoffset);
static void mouse_button_callback( GLFWwindow* window, int button, int action, int mods );
// HDPI display
static bool HDPI;
// framerate related timeers
static int framecount;
static std::chrono::time_point<std::chrono::system_clock> sys_last;
static std::chrono::time_point<std::chrono::system_clock> sys_curr;
// info toggle
static bool showInfo;
// window properties
static GLFWwindow* window;
static size_t buffer_w;
static size_t buffer_h;
// user space renderer
static Renderer* renderer;
// on-screen display
static OSDText* osd_text;
static int line_id_renderer;
static int line_id_framerate;
}; // class Viewer
} // namespace CMU462
#endif // CMU462_VIEWER_H
CMU462
Definition: CMU462.h:8
CMU462::Renderer
Abstract renderer definition.
Definition: renderer.h:21
CMU462::Viewer::set_renderer
void set_renderer(Renderer *renderer)
Set a user space renderer.
Definition: viewer.cpp:148
CMU462::Viewer::~Viewer
~Viewer(void)
Destructor.
Definition: viewer.cpp:49
CMU462::Viewer
Provides OpenGL context, window display, and event handling routines.
Definition: viewer.h:20
CMU462::Viewer::start
void start(void)
Start the drawing loop of the viewer.
Definition: viewer.cpp:137
CMU462::OSDText
Provides an interface for text on-screen display.
Definition: osdtext.h:47
CMU462::Viewer::Viewer
Viewer(void)
Constructor.
Definition: viewer.cpp:45
CMU462::Viewer::init
void init(void)
Initialize the viewer.
Definition: viewer.cpp:60