#ifndef GL_TEMPLATE_FRAMEWORK_H #define GL_TEMPLATE_FRAMEWORK_H #include #include #include class App { private: GLFWwindow *_window = nullptr; int _gl_major, _gl_minor; std::string _title; static void onKey(GLFWwindow *window, int key, int scan_code, int action, int mods); static void onSize(GLFWwindow *window, int width, int height); static void onCursorPos(GLFWwindow *window, double x, double y); static void onMouseButton(GLFWwindow *window, int button, int action, int mods); protected: App(int gl_major, int gl_minor); void setTitle(std::string title); void setX(int x); void setY(int y); void setPos(int x, int y); void setWidth(int width); void setHeight(int height); void setSize(int width, int height); void swapBuffers(); virtual void onKey(int key, int scan_code, int action, int mods) {} virtual void onSize(int width, int height) {} virtual void onCursorPos(double x, double y) {} virtual void onMouseButton(int button, int action, int mods) {} virtual void init() {} virtual void display() {} virtual void deinit() {} public: GLFWwindow *getWindow(); std::string getTitle(); int getX(); int getY(); void getPos(int *x, int *y); int getWidth(); int getHeight(); void getSize(int *width, int *height); int run(); void launch(); void center(); void center(GLFWmonitor *monitor); void close(); }; #endif //GL_TEMPLATE_FRAMEWORK_H