Implemented logging utilities
This commit is contained in:
@@ -1,24 +1,31 @@
|
||||
#include "App.hpp"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
|
||||
#include <GL/glew.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include "LogUtils.hpp"
|
||||
#include "ShaderProgramBuilder.hpp"
|
||||
#include "TimestampLog.hpp"
|
||||
|
||||
|
||||
int App::main(std::vector<std::string> &args) {
|
||||
auto cerrLog = ugly::TimestampLog{std::cerr, "ugly::log"};
|
||||
ugly::log = ugly::LogAlias{&cerrLog};
|
||||
ugly::log("hello, world! app started.");
|
||||
|
||||
auto app = App{};
|
||||
app.game_loop();
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
ugly::log("app quitting.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void App::error_callback_s(int error, const char *description)
|
||||
{
|
||||
std::cerr << "[GLFW error]: " << description << '\n';
|
||||
exit(EXIT_FAILURE);
|
||||
ugly::log("(glfw error): {}", description);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +52,7 @@ App::App():
|
||||
glfwMakeContextCurrent(mpWindow);
|
||||
glewExperimental = GL_TRUE;
|
||||
if(glewInit() != GLEW_OK) {
|
||||
error_callback_s(GLFW_NO_ERROR, "glewInit() failed");
|
||||
ugly::log("glewInit() failed!");
|
||||
}
|
||||
|
||||
float vertices[] = {
|
||||
|
||||
Reference in New Issue
Block a user