#pragma once #ifndef _NB_WINDOW #define _NB_WINDOW #include "GLLoad.h" #include #include #include #include #include #include namespace NB { class GLError : public std::runtime_error { public: GLError(const std::string&); }; class WindowError : public std::runtime_error { public: WindowError(const std::string&); }; class Window { public: static bool StrictInitialization; static int getGLFWHint(int); static int setGLFWHint(int, int); static Window* getCurrent(); Window(const std::array, const char*, GLFWmonitor* initMonitor=NULL, GLFWwindow* initWindow=NULL); Window(const uint16_t, const uint16_t, const char*, GLFWmonitor* initMonitor=NULL, GLFWwindow* initWindow=NULL); ~Window(); int getWindowHint(int) const; GLFWwindow* getWindow() const; std::array getSize() const; float getAspectRatio() const; std::string getName() const; int init(); int setWindowHint(int, int); void setCurrent(); void resize(const std::array); void resize(const uint16_t x, const uint16_t y); protected: static std::map WindowContexts; static std::map GLFWHints; static Window* _current; static bool _glfw_init; static bool checkKillGLFW(); std::map windowHints; std::array windowSize; float _aspect_ratio; std::string windowName; GLFWwindow* window; GLFWmonitor* monitor; GLFWwindow* shareWindow; bool _init = false; int gladResponse = -1; }; }; #endif