mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-06-18 00:27:02 +08:00
feat: update logger with new features
This commit is contained in:
@@ -9,10 +9,10 @@
|
||||
Font::Font() {
|
||||
|
||||
if (FT_Init_FreeType(&m_ft)) {
|
||||
LOG::error("FREETYPE: Could not init FreeType Library");
|
||||
Logger::error("FREETYPE: Could not init FreeType Library");
|
||||
}
|
||||
if (FT_New_Face(m_ft, "assets/fonts/IBMPlexSans-Regular.ttf", 0, &m_face)) {
|
||||
LOG::error("FREETYPE: Failed to load font");
|
||||
Logger::error("FREETYPE: Failed to load font");
|
||||
}
|
||||
|
||||
FT_Set_Pixel_Sizes(m_face, 0, 48);
|
||||
@@ -30,7 +30,7 @@ Font::~Font() {
|
||||
|
||||
void Font::load_character(char8_t c) {
|
||||
if (FT_Load_Char(m_face, c, FT_LOAD_RENDER)) {
|
||||
LOG::error("FREETYTPE: Failed to load Glyph");
|
||||
Logger::error("FREETYTPE: Failed to load Glyph");
|
||||
return;
|
||||
}
|
||||
const auto& width = m_face->glyph->bitmap.width;
|
||||
@@ -102,7 +102,7 @@ void Font::render_text(const Shader& shader, const std::string& text, float x, f
|
||||
for (char8_t c : text) {
|
||||
auto it = font.m_characters.find(c);
|
||||
if (it == font.m_characters.end()) {
|
||||
LOG::error("Can't find character {}", static_cast<char>(c));
|
||||
Logger::error("Can't find character {}", static_cast<char>(c));
|
||||
continue;
|
||||
}
|
||||
Character& ch = it->second;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <Cubed/tools/log.hpp>
|
||||
|
||||
namespace LOG {
|
||||
namespace Logger {
|
||||
|
||||
|
||||
}
|
||||
@@ -24,7 +24,7 @@ namespace Tools {
|
||||
Tools::check_opengl_error();
|
||||
glGetShaderiv(v_shader, GL_COMPILE_STATUS, &vc);
|
||||
if (vc != 1) {
|
||||
LOG::error("vertex compilation failed");
|
||||
Logger::error("vertex compilation failed");
|
||||
Tools::print_shader_log(v_shader);
|
||||
CUBED_ASSERT(0);
|
||||
}
|
||||
@@ -32,7 +32,7 @@ namespace Tools {
|
||||
Tools::check_opengl_error();
|
||||
glGetShaderiv(f_shader, GL_COMPILE_STATUS, &fc);
|
||||
if (fc != 1) {
|
||||
LOG::error("vertex compilation failed");
|
||||
Logger::error("vertex compilation failed");
|
||||
Tools::print_shader_log(f_shader);
|
||||
CUBED_ASSERT(0);
|
||||
}
|
||||
@@ -45,7 +45,7 @@ namespace Tools {
|
||||
Tools::check_opengl_error();
|
||||
glGetProgramiv(vf_program, GL_LINK_STATUS, &linked);
|
||||
if (linked != 1) {
|
||||
LOG::error("linking failed");
|
||||
Logger::error("linking failed");
|
||||
Tools::print_program_info(vf_program);
|
||||
CUBED_ASSERT(0);
|
||||
}
|
||||
@@ -63,7 +63,7 @@ namespace Tools {
|
||||
if (len > 0) {
|
||||
log = (char*)malloc(len);
|
||||
glGetShaderInfoLog(shader, len, &ch_written, log);
|
||||
LOG::info("Shader Info Log: {}", log);
|
||||
Logger::info("Shader Info Log: {}", log);
|
||||
free(log);
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace Tools {
|
||||
if (len > 0) {
|
||||
log = (char*)malloc(len);
|
||||
glGetProgramInfoLog(prog, len, &ch_written, log);
|
||||
LOG::info("Program Info Log: {}", log);
|
||||
Logger::info("Program Info Log: {}", log);
|
||||
free(log);
|
||||
}
|
||||
}
|
||||
@@ -87,7 +87,7 @@ namespace Tools {
|
||||
bool found_error = false;
|
||||
int gl_err = glGetError();
|
||||
while (gl_err != GL_NO_ERROR) {
|
||||
LOG::error("glEorr: {}", gl_err);
|
||||
Logger::error("glEorr: {}", gl_err);
|
||||
found_error = true;
|
||||
gl_err = glGetError();
|
||||
}
|
||||
@@ -101,7 +101,7 @@ namespace Tools {
|
||||
std::ifstream file_stream(file_path, std::ios::in);
|
||||
|
||||
if (!file_stream.is_open()) {
|
||||
LOG::error("{} not exist", file_path);
|
||||
Logger::error("{} not exist", file_path);
|
||||
}
|
||||
|
||||
std::string line = "";
|
||||
|
||||
Reference in New Issue
Block a user