Added some comments
This commit is contained in:
@@ -16,10 +16,12 @@
|
||||
namespace ugly {
|
||||
|
||||
int App::main(std::vector<std::string> &args) {
|
||||
// Initialize global log.
|
||||
auto cerrLog = TimestampLog{"ugly::log", std::cerr};
|
||||
log = LogAlias{&cerrLog};
|
||||
log("hello, world! app started.");
|
||||
|
||||
// Initialize GLFW.
|
||||
glfwSetErrorCallback(error_callback_s);
|
||||
glfwInit();
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||
@@ -27,6 +29,7 @@ int App::main(std::vector<std::string> &args) {
|
||||
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
||||
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
|
||||
|
||||
// Create GLFW window and OpenGL context for GLEW.
|
||||
auto window = glfwCreateWindow(640, 480, "uGLy", NULL, NULL);
|
||||
glfwMakeContextCurrent(window);
|
||||
glewExperimental = GL_TRUE;
|
||||
@@ -34,9 +37,11 @@ int App::main(std::vector<std::string> &args) {
|
||||
log("glewInit() failed!");
|
||||
}
|
||||
|
||||
// Run app.
|
||||
auto app = App{window};
|
||||
app.game_loop();
|
||||
|
||||
// Clean up.
|
||||
glfwTerminate();
|
||||
glfwSetErrorCallback(NULL);
|
||||
log("app quitting.");
|
||||
@@ -57,7 +62,8 @@ void App::key_callback_s(GLFWwindow *window, int key, int scancode, int action,
|
||||
|
||||
|
||||
App::App(GLFWwindow *window):
|
||||
mpWindow{window} {
|
||||
mpWindow{window},
|
||||
mShaderProgram{} {
|
||||
glfwSetWindowUserPointer(mpWindow, this);
|
||||
glfwSetKeyCallback(mpWindow, key_callback_s);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user