our_dick/include/render.hpp
2020-08-15 16:27:24 +00:00

50 lines
1014 B
C++

#ifndef OUR_DICK_RENDER_HPP
#define OUR_DICK_RENDER_HPP
#include <stdint.h>
#include <GLFW/glfw3.h>
#define OPENFL_VERSION 400
#define GLSL_VERSION 400
class GLFWwindow;
class render_manager
{
private:
void (*m_windowCloseCallback)(void);
void (*m_inputHandler)(GLFWwindow* window, int key, int scancode, int action, int mods);
GLFWwindow* m_mainWindow;
public:
enum GLFW_ERROR
{
GLFW_OK,
GLFW_CONTEXT_ERROR,
GLFW_WINDOW_ERROR,
GLFW_INIT_ERROR,
};
render_manager (render_manager&) = delete;
render_manager (render_manager&&) = delete;
render_manager();
GLFW_ERROR init(int width, int height, const char* title); // Sets up the OpenGL environment
void update(); // Update the GL context and draw new frame
void request_exit();
template <typename T>
void handle_window_close_event(T handle){
m_windowCloseCallback = handle;
}
template <typename T>
void handle_keypress_event(T handle){
m_inputHandler = handle;
glfwSetKeyCallback(m_mainWindow, m_inputHandler);
}
};
#endif