Uhhhhh big big changes
This commit is contained in:
@@ -16,13 +16,13 @@ static std::map<int, int> defailt_window_hints = {
|
||||
#endif
|
||||
};
|
||||
|
||||
using OpenGLErrorCodes = OpenGLError::Codes;
|
||||
const std::string OpenGLError::type = "nb::OpenGLError";
|
||||
const ErrorCodeMap OpenGLError::ErrorMessages = {
|
||||
{OpenGLErrorCodes::UNDEFINED, "Error"},
|
||||
{OpenGLErrorCodes::INIT_FAILED, "GLFW initialization failed"},
|
||||
{OpenGLErrorCodes::GLFW_INTIALIZED, "GLFW has already been initialized"},
|
||||
{OpenGLErrorCodes::GLAD_FAILED, "GLAD initialization failed"}
|
||||
using GLFWCodes = GLFWError::Codes;
|
||||
const std::string GLFWError::type = "nb::GLFWError";
|
||||
const ErrorCodeMap GLFWError::ErrorMessages = {
|
||||
{GLFWCodes::UNDEFINED, "Error"},
|
||||
{GLFWCodes::INIT_FAILED, "GLFW initialization failed"},
|
||||
{GLFWCodes::GLFW_INTIALIZED, "GLFW has already been initialized"},
|
||||
{GLFWCodes::GLAD_FAILED, "GLAD initialization failed"}
|
||||
};
|
||||
|
||||
using WindowErrorCodes = WindowError::Codes;
|
||||
@@ -44,7 +44,7 @@ int Window::getGLFWHint(int hint_key) {
|
||||
|
||||
int Window::setGLFWHint(int hint_key, int hint_val) {
|
||||
if (Window::_glfw_init) {
|
||||
THROW(OpenGLError(OpenGLErrorCodes::GLFW_INTIALIZED));
|
||||
THROW(GLFWError(GLFWCodes::GLFW_INTIALIZED));
|
||||
} else {
|
||||
GLFWHints[hint_key] = hint_val;
|
||||
}
|
||||
@@ -74,7 +74,7 @@ Window::Window(const uint16_t x, const uint16_t y, const char* initName, GLFWmon
|
||||
Window::_glfw_init = true;
|
||||
} else {
|
||||
if (Window::StrictInitialization) {
|
||||
THROW(OpenGLError(OpenGLErrorCodes::INIT_FAILED));
|
||||
THROW(GLFWError(GLFWCodes::INIT_FAILED));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -147,12 +147,14 @@ int Window::init() {
|
||||
if (!gladResponse) {
|
||||
Window::checkKillGLFW();
|
||||
if (Window::StrictInitialization) {
|
||||
THROW(OpenGLError(OpenGLErrorCodes::GLAD_FAILED));
|
||||
THROW(GLFWError(GLFWCodes::GLAD_FAILED));
|
||||
}
|
||||
}
|
||||
|
||||
_init = true;
|
||||
glViewport(0, 0, windowSize[0], windowSize[1]);
|
||||
OPENGL_CALL(
|
||||
glViewport(0, 0, windowSize[0], windowSize[1])
|
||||
);
|
||||
return gladResponse;
|
||||
}
|
||||
|
||||
@@ -173,7 +175,9 @@ std::string Window::getName() const {
|
||||
void Window::resize(const std::array<uint16_t, 2> newSize) {
|
||||
windowSize = newSize;
|
||||
_aspect_ratio = float(newSize[0]) / float(newSize[1]);
|
||||
glViewport(0, 0, windowSize[0], windowSize[1]);
|
||||
OPENGL_CALL(
|
||||
glViewport(0, 0, windowSize[0], windowSize[1])
|
||||
);
|
||||
glfwSetWindowSize(window, windowSize[0], windowSize[1]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user