mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-04-10 06:14:07 +08:00
feat: update logger with new features
This commit is contained in:
@@ -6,10 +6,10 @@ namespace Assert {
|
|||||||
std::string_view message = ""
|
std::string_view message = ""
|
||||||
) {
|
) {
|
||||||
|
|
||||||
LOG::error("Assertion failed: {} at {}: {} in function {}",
|
Logger::error("Assertion failed: {} at {}: {} in function {}",
|
||||||
condition, file, line, func);
|
condition, file, line, func);
|
||||||
if (message.size()) {
|
if (message.size()) {
|
||||||
LOG::error("Message: {}", message);
|
Logger::error("Message: {}", message);
|
||||||
}
|
}
|
||||||
std::abort();
|
std::abort();
|
||||||
|
|
||||||
|
|||||||
@@ -2,16 +2,25 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <format>
|
#include <format>
|
||||||
|
#include <source_location>
|
||||||
#include <string>
|
#include <string>
|
||||||
namespace LOG {
|
|
||||||
|
|
||||||
|
namespace Logger {
|
||||||
|
enum class Level {
|
||||||
|
TRACE,
|
||||||
|
DEBUG,
|
||||||
|
INFO,
|
||||||
|
ERROR,
|
||||||
|
WARN
|
||||||
|
};
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
void info(const char * fmt, Args&&... args) {
|
inline void info(std::format_string<Args...> fmt, Args&&... args) {
|
||||||
auto now_time = std::chrono::
|
auto now_time = std::chrono::
|
||||||
time_point_cast<std::chrono::seconds>
|
time_point_cast<std::chrono::seconds>
|
||||||
(std::chrono::system_clock::now());
|
(std::chrono::system_clock::now());
|
||||||
|
|
||||||
std::string msg = std::vformat(fmt, std::make_format_args(args...));
|
std::string msg = std::vformat(fmt.get(), std::make_format_args(args...));
|
||||||
std::cout << "\033[1;32m"
|
std::cout << "\033[1;32m"
|
||||||
<< std::format("[INFO][{:%Y-%m-%d %H:%M:%S}]", now_time)
|
<< std::format("[INFO][{:%Y-%m-%d %H:%M:%S}]", now_time)
|
||||||
<< msg
|
<< msg
|
||||||
@@ -20,11 +29,11 @@ namespace LOG {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
void error(const char * fmt, Args&&... args) {
|
inline void error(std::format_string<Args...> fmt, Args&&... args) {
|
||||||
auto now_time = std::chrono::
|
auto now_time = std::chrono::
|
||||||
time_point_cast<std::chrono::seconds>
|
time_point_cast<std::chrono::seconds>
|
||||||
(std::chrono::system_clock::now());
|
(std::chrono::system_clock::now());
|
||||||
std::string msg = std::vformat(fmt, std::make_format_args(args...));
|
std::string msg = std::vformat(fmt.get(), std::make_format_args(args...));
|
||||||
std::cerr << "\033[1;31m"
|
std::cerr << "\033[1;31m"
|
||||||
<< std::format("[ERROR][{:%Y-%m-%d %H:%M:%S}]", now_time)
|
<< std::format("[ERROR][{:%Y-%m-%d %H:%M:%S}]", now_time)
|
||||||
<< msg
|
<< msg
|
||||||
@@ -34,11 +43,11 @@ namespace LOG {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
void warn(const char * fmt, Args&&... args) {
|
inline void warn(std::format_string<Args...> fmt, Args&&... args) {
|
||||||
auto now_time = std::chrono::
|
auto now_time = std::chrono::
|
||||||
time_point_cast<std::chrono::seconds>
|
time_point_cast<std::chrono::seconds>
|
||||||
(std::chrono::system_clock::now());
|
(std::chrono::system_clock::now());
|
||||||
std::string msg = std::vformat(fmt, std::make_format_args(args...));
|
std::string msg = std::vformat(fmt.get(), std::make_format_args(args...));
|
||||||
std::cout << "\033[1;33m"
|
std::cout << "\033[1;33m"
|
||||||
<< std::format("[WARN][{:%Y-%m-%d %H:%M:%S}]", now_time)
|
<< std::format("[WARN][{:%Y-%m-%d %H:%M:%S}]", now_time)
|
||||||
<< msg
|
<< msg
|
||||||
@@ -46,4 +55,41 @@ namespace LOG {
|
|||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename... Args>
|
||||||
|
inline void log(Level level, std::source_location loc, std::format_string<Args...> fmt, Args&&... args) {
|
||||||
|
auto now_time = std::chrono::
|
||||||
|
time_point_cast<std::chrono::seconds>
|
||||||
|
(std::chrono::system_clock::now());
|
||||||
|
std::string msg = std::vformat(fmt.get(), std::make_format_args(args...));
|
||||||
|
switch (level) {
|
||||||
|
case Logger::Level::TRACE:
|
||||||
|
std::cout << "\033[1;34m"
|
||||||
|
<< std::format("[TRACE][{:%Y-%m-%d %H:%M:%S}]", now_time)
|
||||||
|
<< "[" << loc.file_name() << ":" << loc.line() << "]"
|
||||||
|
<< "[" << loc.function_name() << "]"
|
||||||
|
<< msg
|
||||||
|
<< "\033[0m"
|
||||||
|
<< "\n";
|
||||||
|
break;
|
||||||
|
case Logger::Level::DEBUG:
|
||||||
|
std::cout << "\033[1;34m"
|
||||||
|
<< std::format("[DEBUG][{:%Y-%m-%d %H:%M:%S}]", now_time)
|
||||||
|
<< msg
|
||||||
|
<< "\033[0m"
|
||||||
|
<< "\n";
|
||||||
|
break;
|
||||||
|
case Logger::Level::INFO:
|
||||||
|
info(fmt, std::forward<Args...>(args)...);
|
||||||
|
break;
|
||||||
|
case Logger::Level::WARN:
|
||||||
|
warn(fmt, std::forward<Args...>(args)...);
|
||||||
|
break;
|
||||||
|
case Logger::Level::ERROR:
|
||||||
|
error(fmt, std::forward<Args...>(args)...);
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -156,10 +156,10 @@ int App::start_cubed_application(int argc, char** argv) {
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
LOG::error("{}", e.what());
|
Logger::error("{}", e.what());
|
||||||
|
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
LOG::error("Unkown error");
|
Logger::error("Unkown error");
|
||||||
|
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ const BlockRenderData& World::get_block_render_data(int world_x, int world_y ,in
|
|||||||
if (world_z >= 0) {
|
if (world_z >= 0) {
|
||||||
chunk_z = world_z / CHUCK_SIZE;
|
chunk_z = world_z / CHUCK_SIZE;
|
||||||
}
|
}
|
||||||
//LOG::info("Chunk PosX : {} Chuch PosZ : {}", chunk_x, chunk_z);
|
//Logger::info("Chunk PosX : {} Chuch PosZ : {}", chunk_x, chunk_z);
|
||||||
auto it = m_chunks.find(ChunkPos{chunk_x, chunk_z});
|
auto it = m_chunks.find(ChunkPos{chunk_x, chunk_z});
|
||||||
CUBED_ASSERT_MSG(it != m_chunks.end(), "Chunk not find");
|
CUBED_ASSERT_MSG(it != m_chunks.end(), "Chunk not find");
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ const std::optional<LookBlock>& World::get_look_block_pos(const std::string& nam
|
|||||||
static std::optional<LookBlock> null_look_block = std::nullopt;
|
static std::optional<LookBlock> null_look_block = std::nullopt;
|
||||||
auto it = m_players.find(HASH::str(name));
|
auto it = m_players.find(HASH::str(name));
|
||||||
if (it == m_players.end()) {
|
if (it == m_players.end()) {
|
||||||
LOG::error("Can't find player {}", name);
|
Logger::error("Can't find player {}", name);
|
||||||
CUBED_ASSERT(0);
|
CUBED_ASSERT(0);
|
||||||
return null_look_block;
|
return null_look_block;
|
||||||
}
|
}
|
||||||
@@ -88,7 +88,7 @@ const std::optional<LookBlock>& World::get_look_block_pos(const std::string& nam
|
|||||||
Player& World::get_player(const std::string& name){
|
Player& World::get_player(const std::string& name){
|
||||||
auto it = m_players.find(HASH::str(name));
|
auto it = m_players.find(HASH::str(name));
|
||||||
if (it == m_players.end()) {
|
if (it == m_players.end()) {
|
||||||
LOG::error("Can't find player {}", name);
|
Logger::error("Can't find player {}", name);
|
||||||
CUBED_ASSERT(0);
|
CUBED_ASSERT(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ void World::init_world() {
|
|||||||
m_chunks.emplace(pos, Chunk(*this, pos));
|
m_chunks.emplace(pos, Chunk(*this, pos));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOG::info("World init finfish");
|
Logger::info("World init finfish");
|
||||||
|
|
||||||
for (auto& chunk_map : m_chunks) {
|
for (auto& chunk_map : m_chunks) {
|
||||||
auto& [chunk_pos, chunk] = chunk_map;
|
auto& [chunk_pos, chunk] = chunk_map;
|
||||||
|
|||||||
@@ -35,11 +35,11 @@ Renderer::~Renderer() {
|
|||||||
|
|
||||||
void Renderer::init() {
|
void Renderer::init() {
|
||||||
if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) {
|
if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) {
|
||||||
LOG::error("Failed to initialize glad");
|
Logger::error("Failed to initialize glad");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
LOG::info("OpenGL Version: {}.{}", GLVersion.major, GLVersion.minor);
|
Logger::info("OpenGL Version: {}.{}", GLVersion.major, GLVersion.minor);
|
||||||
LOG::info("Renderer: {}", reinterpret_cast<const char*>(glGetString(GL_RENDERER)));
|
Logger::info("Renderer: {}", reinterpret_cast<const char*>(glGetString(GL_RENDERER)));
|
||||||
|
|
||||||
Shader world_shader{"world", "shaders/block_v_shader.glsl", "shaders/block_f_shader.glsl"};
|
Shader world_shader{"world", "shaders/block_v_shader.glsl", "shaders/block_f_shader.glsl"};
|
||||||
Shader outline_shader{"outline", "shaders/outline_v_shader.glsl", "shaders/outline_f_shader.glsl"};
|
Shader outline_shader{"outline", "shaders/outline_v_shader.glsl", "shaders/outline_f_shader.glsl"};
|
||||||
@@ -62,7 +62,7 @@ void Renderer::init() {
|
|||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
glEnable(GL_DEBUG_OUTPUT);
|
glEnable(GL_DEBUG_OUTPUT);
|
||||||
glDebugMessageCallback([](GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void* user_param) {
|
glDebugMessageCallback([](GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void* user_param) {
|
||||||
LOG::info("GL Debug: {}", reinterpret_cast<const char*>(message));
|
Logger::log(Logger::Level::DEBUG, std::source_location::current(),"GL Debug: {}", reinterpret_cast<const char*>(message));
|
||||||
}, nullptr);
|
}, nullptr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ Shader& Shader::operator=(Shader&& shader) {
|
|||||||
|
|
||||||
void Shader::create(const std::string& name, const std::string& v_shader_path, const std::string& f_shader_path) {
|
void Shader::create(const std::string& name, const std::string& v_shader_path, const std::string& f_shader_path) {
|
||||||
if (!m_program) {
|
if (!m_program) {
|
||||||
LOG::warn("Shader has already created !");
|
Logger::warn("Shader has already created !");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_program = Tools::create_shader_program(v_shader_path, f_shader_path);
|
m_program = Tools::create_shader_program(v_shader_path, f_shader_path);
|
||||||
@@ -50,7 +50,7 @@ void Shader::create(const std::string& name, const std::string& v_shader_path, c
|
|||||||
|
|
||||||
std::size_t Shader::hash() const {
|
std::size_t Shader::hash() const {
|
||||||
if (!m_hash) {
|
if (!m_hash) {
|
||||||
LOG::warn("Shader has already created !");
|
Logger::warn("Shader has already created !");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return m_hash;
|
return m_hash;
|
||||||
@@ -60,7 +60,7 @@ GLuint Shader::loc(const std::string& loc) const {
|
|||||||
CUBED_ASSERT_MSG(m_program != 0, "Shader program not created");
|
CUBED_ASSERT_MSG(m_program != 0, "Shader program not created");
|
||||||
GLint pos = glGetUniformLocation(m_program, loc.c_str());
|
GLint pos = glGetUniformLocation(m_program, loc.c_str());
|
||||||
if (pos == -1) {
|
if (pos == -1) {
|
||||||
LOG::info("Shader name {}, loc name {}, pos {}", m_name, loc, pos);
|
Logger::info("Shader name {}, loc name {}, pos {}", m_name, loc, pos);
|
||||||
CUBED_ASSERT_MSG(pos == -1, "Can't find UniformLocation");
|
CUBED_ASSERT_MSG(pos == -1, "Can't find UniformLocation");
|
||||||
}
|
}
|
||||||
return static_cast<GLuint>(pos);
|
return static_cast<GLuint>(pos);
|
||||||
@@ -68,7 +68,7 @@ GLuint Shader::loc(const std::string& loc) const {
|
|||||||
|
|
||||||
const std::string& Shader::name() const {
|
const std::string& Shader::name() const {
|
||||||
if (m_name == "-1") {
|
if (m_name == "-1") {
|
||||||
LOG::warn("Shader has already created !");
|
Logger::warn("Shader has already created !");
|
||||||
|
|
||||||
}
|
}
|
||||||
return m_name;
|
return m_name;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ TextureManager::~TextureManager() {
|
|||||||
void TextureManager::delet_texture() {
|
void TextureManager::delet_texture() {
|
||||||
glDeleteTextures(1, &m_texture_array);
|
glDeleteTextures(1, &m_texture_array);
|
||||||
glDeleteTextures(1, &m_block_status_array);
|
glDeleteTextures(1, &m_block_status_array);
|
||||||
LOG::info("Successfully delete all texture");
|
Logger::info("Successfully delete all texture");
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint TextureManager::get_block_status_array() const{
|
GLuint TextureManager::get_block_status_array() const{
|
||||||
@@ -125,7 +125,7 @@ void TextureManager::init_texture() {
|
|||||||
GLfloat max_aniso = 0.0f;
|
GLfloat max_aniso = 0.0f;
|
||||||
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY, &max_aniso);
|
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY, &max_aniso);
|
||||||
if (max_aniso > 0.0f) {
|
if (max_aniso > 0.0f) {
|
||||||
LOG::info("Support anisotropic filtering max_aniso is {}", max_aniso);
|
Logger::info("Support anisotropic filtering max_aniso is {}", max_aniso);
|
||||||
glTexParameterf(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAX_ANISOTROPY, max_aniso);
|
glTexParameterf(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAX_ANISOTROPY, max_aniso);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,7 +154,7 @@ void TextureManager::init_texture() {
|
|||||||
Tools::check_opengl_error();
|
Tools::check_opengl_error();
|
||||||
|
|
||||||
if (max_aniso > 0.0f) {
|
if (max_aniso > 0.0f) {
|
||||||
LOG::info("Support anisotropic filtering max_aniso is {}", max_aniso);
|
Logger::info("Support anisotropic filtering max_aniso is {}", max_aniso);
|
||||||
glTexParameterf(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAX_ANISOTROPY, max_aniso);
|
glTexParameterf(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAX_ANISOTROPY, max_aniso);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,10 +9,10 @@
|
|||||||
Font::Font() {
|
Font::Font() {
|
||||||
|
|
||||||
if (FT_Init_FreeType(&m_ft)) {
|
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)) {
|
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);
|
FT_Set_Pixel_Sizes(m_face, 0, 48);
|
||||||
@@ -30,7 +30,7 @@ Font::~Font() {
|
|||||||
|
|
||||||
void Font::load_character(char8_t c) {
|
void Font::load_character(char8_t c) {
|
||||||
if (FT_Load_Char(m_face, c, FT_LOAD_RENDER)) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
const auto& width = m_face->glyph->bitmap.width;
|
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) {
|
for (char8_t c : text) {
|
||||||
auto it = font.m_characters.find(c);
|
auto it = font.m_characters.find(c);
|
||||||
if (it == font.m_characters.end()) {
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
Character& ch = it->second;
|
Character& ch = it->second;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include <Cubed/tools/log.hpp>
|
#include <Cubed/tools/log.hpp>
|
||||||
|
|
||||||
namespace LOG {
|
namespace Logger {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -24,7 +24,7 @@ namespace Tools {
|
|||||||
Tools::check_opengl_error();
|
Tools::check_opengl_error();
|
||||||
glGetShaderiv(v_shader, GL_COMPILE_STATUS, &vc);
|
glGetShaderiv(v_shader, GL_COMPILE_STATUS, &vc);
|
||||||
if (vc != 1) {
|
if (vc != 1) {
|
||||||
LOG::error("vertex compilation failed");
|
Logger::error("vertex compilation failed");
|
||||||
Tools::print_shader_log(v_shader);
|
Tools::print_shader_log(v_shader);
|
||||||
CUBED_ASSERT(0);
|
CUBED_ASSERT(0);
|
||||||
}
|
}
|
||||||
@@ -32,7 +32,7 @@ namespace Tools {
|
|||||||
Tools::check_opengl_error();
|
Tools::check_opengl_error();
|
||||||
glGetShaderiv(f_shader, GL_COMPILE_STATUS, &fc);
|
glGetShaderiv(f_shader, GL_COMPILE_STATUS, &fc);
|
||||||
if (fc != 1) {
|
if (fc != 1) {
|
||||||
LOG::error("vertex compilation failed");
|
Logger::error("vertex compilation failed");
|
||||||
Tools::print_shader_log(f_shader);
|
Tools::print_shader_log(f_shader);
|
||||||
CUBED_ASSERT(0);
|
CUBED_ASSERT(0);
|
||||||
}
|
}
|
||||||
@@ -45,7 +45,7 @@ namespace Tools {
|
|||||||
Tools::check_opengl_error();
|
Tools::check_opengl_error();
|
||||||
glGetProgramiv(vf_program, GL_LINK_STATUS, &linked);
|
glGetProgramiv(vf_program, GL_LINK_STATUS, &linked);
|
||||||
if (linked != 1) {
|
if (linked != 1) {
|
||||||
LOG::error("linking failed");
|
Logger::error("linking failed");
|
||||||
Tools::print_program_info(vf_program);
|
Tools::print_program_info(vf_program);
|
||||||
CUBED_ASSERT(0);
|
CUBED_ASSERT(0);
|
||||||
}
|
}
|
||||||
@@ -63,7 +63,7 @@ namespace Tools {
|
|||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
log = (char*)malloc(len);
|
log = (char*)malloc(len);
|
||||||
glGetShaderInfoLog(shader, len, &ch_written, log);
|
glGetShaderInfoLog(shader, len, &ch_written, log);
|
||||||
LOG::info("Shader Info Log: {}", log);
|
Logger::info("Shader Info Log: {}", log);
|
||||||
free(log);
|
free(log);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ namespace Tools {
|
|||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
log = (char*)malloc(len);
|
log = (char*)malloc(len);
|
||||||
glGetProgramInfoLog(prog, len, &ch_written, log);
|
glGetProgramInfoLog(prog, len, &ch_written, log);
|
||||||
LOG::info("Program Info Log: {}", log);
|
Logger::info("Program Info Log: {}", log);
|
||||||
free(log);
|
free(log);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -87,7 +87,7 @@ namespace Tools {
|
|||||||
bool found_error = false;
|
bool found_error = false;
|
||||||
int gl_err = glGetError();
|
int gl_err = glGetError();
|
||||||
while (gl_err != GL_NO_ERROR) {
|
while (gl_err != GL_NO_ERROR) {
|
||||||
LOG::error("glEorr: {}", gl_err);
|
Logger::error("glEorr: {}", gl_err);
|
||||||
found_error = true;
|
found_error = true;
|
||||||
gl_err = glGetError();
|
gl_err = glGetError();
|
||||||
}
|
}
|
||||||
@@ -101,7 +101,7 @@ namespace Tools {
|
|||||||
std::ifstream file_stream(file_path, std::ios::in);
|
std::ifstream file_stream(file_path, std::ios::in);
|
||||||
|
|
||||||
if (!file_stream.is_open()) {
|
if (!file_stream.is_open()) {
|
||||||
LOG::error("{} not exist", file_path);
|
Logger::error("{} not exist", file_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string line = "";
|
std::string line = "";
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ void Window::update_viewport() {
|
|||||||
|
|
||||||
void Window::init() {
|
void Window::init() {
|
||||||
if (!glfwInit()) {
|
if (!glfwInit()) {
|
||||||
LOG::error("glfwinit fail");
|
Logger::error("glfwinit fail");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ void Window::init() {
|
|||||||
if (glfwRawMouseMotionSupported()) {
|
if (glfwRawMouseMotionSupported()) {
|
||||||
glfwSetInputMode(m_window, GLFW_RAW_MOUSE_MOTION, GLFW_TRUE);
|
glfwSetInputMode(m_window, GLFW_RAW_MOUSE_MOTION, GLFW_TRUE);
|
||||||
} else {
|
} else {
|
||||||
LOG::warn("Don,t support Raw Mouse Motion");
|
Logger::warn("Don,t support Raw Mouse Motion");
|
||||||
}
|
}
|
||||||
|
|
||||||
GLFWmonitor* primary = glfwGetPrimaryMonitor();
|
GLFWmonitor* primary = glfwGetPrimaryMonitor();
|
||||||
|
|||||||
Reference in New Issue
Block a user