Added some comments

This commit is contained in:
2025-07-31 02:09:45 -04:00
parent 15220aa3b7
commit d36115c841
7 changed files with 73 additions and 4 deletions

View File

@@ -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);