Fix coding standard

This commit is contained in:
rexy712
2020-08-15 16:20:16 -07:00
parent 6211f7fc62
commit 82f63bc13c
2 changed files with 40 additions and 42 deletions

View File

@@ -12,50 +12,49 @@ namespace
render_manager::render_manager() :
m_windowCloseCallback (nullptr),
m_inputHandler (nullptr),
m_mainWindow (nullptr)
{}
m_window_close_callback (nullptr),
m_input_handler (nullptr),
m_main_window (nullptr){}
render_manager::GLFW_ERROR render_manager::init (int width, int height, const char* title){
render_manager::RENDERER_ERROR render_manager::init (int width, int height, const char* title){
if (!glfwInit()) {
fprintf(stdout, "[EE] failed to initialize GLFW.\n");
return GLFW_INIT_ERROR;
}
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
m_mainWindow = glfwCreateWindow(width, height, title, nullptr, nullptr);
if (!m_mainWindow) {
fprintf (stdout, "[EE] Could not create window\n");
return GLFW_WINDOW_ERROR;
fprintf(stdout, "[EE] failed to initialize GLFW.\n");
return RENDERER_INIT_ERROR;
}
glfwMakeContextCurrent(m_mainWindow);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
m_main_window = glfwCreateWindow(width, height, title, nullptr, nullptr);
if (!m_main_window) {
fprintf (stdout, "[EE] Could not create window\n");
return RENDERER_WINDOW_ERROR;
}
glfwMakeContextCurrent(m_main_window);
if (gl3wInit()) {
fprintf(stdout, "[EE] failed to initialize OpenGL\n");
return GLFW_CONTEXT_ERROR;
return RENDERER_CONTEXT_ERROR;
}
glViewport(0, 0, width, height);
printf("[DD] OpenGL %s, GLSL %s\n", glGetString(GL_VERSION), glGetString(GL_SHADING_LANGUAGE_VERSION));
glfwSetFramebufferSizeCallback(m_mainWindow, handle_resize_event);
glfwSetFramebufferSizeCallback(m_main_window, handle_resize_event);
return GLFW_OK;
return RENDERER_OK;
}
void render_manager::update(){
glfwSwapBuffers(m_mainWindow);
glfwSwapBuffers(m_main_window);
glfwPollEvents();
}
void render_manager::request_exit()
{
if (m_windowCloseCallback)
m_windowCloseCallback();
glfwSetWindowShouldClose(m_mainWindow, true);
if (m_window_close_callback)
m_window_close_callback();
glfwSetWindowShouldClose(m_main_window, true);
}