Compare commits

..

No commits in common. "c6a21b24bbea5cbf50eaa323159f1c249fba332e" and "b10f6884cd77692d3795b86c6fb9e41675fd23a7" have entirely different histories.

3 changed files with 13 additions and 14 deletions

View file

@ -4,6 +4,7 @@
#include <ft2build.h> #include <ft2build.h>
#include FT_FREETYPE_H #include FT_FREETYPE_H
#include <iostream>
#include <filesystem> #include <filesystem>
#include <glm/glm.hpp> #include <glm/glm.hpp>
#include <map> #include <map>

View file

@ -4,15 +4,11 @@
#include "utility/raycaster.h" #include "utility/raycaster.h"
#include "utility/script.h" #include "utility/script.h"
#if _DEBUG
#else
#include <tracy/Tracy.hpp> #include <tracy/Tracy.hpp>
#endif
AI::AI(const std::shared_ptr<GameActor>& actor, const std::shared_ptr<Raycaster>& raycaster) AI::AI(const std::shared_ptr<GameActor>& actor, const std::shared_ptr<Raycaster>& raycaster)
: state(AIState::Idle), raycaster(raycaster), actor(actor), : actor(actor), raycaster(raycaster), state(AIState::Idle),
lastGCTime(std::chrono::high_resolution_clock::now()), GCTimeout(3) lastGCTime(std::chrono::high_resolution_clock::now()), GCTimeout(3)
{} {}

View file

@ -42,7 +42,7 @@ Text::Text()
if (!success) if (!success)
{ {
glGetShaderInfoLog(vertexID, 512, 0, log); glGetShaderInfoLog(vertexID, 512, 0, log);
LOG(ERROR, "ERROR::COMPILER VERTEX SHADER FAILED TO COMPILE: {}", log); std::cout << "ERROR::COMPILER VERTEX SHADER FAILED TO COMPILE: " << log << std::endl;
return; return;
} }
@ -54,7 +54,7 @@ Text::Text()
if (!success) if (!success)
{ {
glGetShaderInfoLog(fragID, 512, NULL, log); glGetShaderInfoLog(fragID, 512, NULL, log);
LOG(ERROR, "ERROR::COMPILER FRAGMENT SHADER FAILED TO COMPILE: {}", log); std::cout << "ERROR::COMPILER FRAGMENT SHADER FAILED TO COMPILE: " << log << std::endl;
return; return;
} }
@ -67,7 +67,7 @@ Text::Text()
if (!success) if (!success)
{ {
glGetProgramInfoLog(programID, 512, NULL, log); glGetProgramInfoLog(programID, 512, NULL, log);
LOG(ERROR, "ERROR::LINKER FAILED: ", log); std::cout << "ERROR::LINKER FAILED: " << log << std::endl;
return; return;
} }
@ -91,8 +91,10 @@ Text::Text()
bool Text::loadFonts(const std::string& font_folder) bool Text::loadFonts(const std::string& font_folder)
{ {
FT_Library ft; FT_Library ft;
if (FT_Init_FreeType(&ft)) { if (FT_Init_FreeType(&ft))
ERROR_LOG("ERROR::FREETYPE Failed to init freetype library"); {
std::cout << "ERROR::FREETYPE Failed to init freetype library" << std::endl;
return false;
} }
// load every font in the fonts folder then create corresponding textures for each character of each font. // load every font in the fonts folder then create corresponding textures for each character of each font.
std::filesystem::path folder(font_folder); std::filesystem::path folder(font_folder);
@ -106,7 +108,7 @@ bool Text::loadFonts(const std::string& font_folder)
FT_Face face; FT_Face face;
if (FT_New_Face(ft, file.path().string().c_str(), 0, &face)) if (FT_New_Face(ft, file.path().string().c_str(), 0, &face))
{ {
LOG(ERROR, "ERROR::FREETYPE Failed to load font: {}", file.path().string()); std::cout << "ERROR::FREETYPE Failed to load font: " << file.path().string() << std::endl;
continue; continue;
} }
FT_Set_Pixel_Sizes(face, 0, 48); FT_Set_Pixel_Sizes(face, 0, 48);
@ -118,7 +120,7 @@ bool Text::loadFonts(const std::string& font_folder)
{ {
if (FT_Load_Char(face, c, FT_LOAD_RENDER)) if (FT_Load_Char(face, c, FT_LOAD_RENDER))
{ {
LOG(ERROR, "ERROR::FREETYPE Failed to load glyph ({})", (char)c); std::cout << "ERROR::FREETYPE Failed to load glyph ( " << (char)c << " )" << std::endl;
continue; continue;
} }
unsigned int texture; unsigned int texture;
@ -142,7 +144,7 @@ bool Text::loadFonts(const std::string& font_folder)
texture, texture,
glm::ivec2(face->glyph->bitmap.width, face->glyph->bitmap.rows), glm::ivec2(face->glyph->bitmap.width, face->glyph->bitmap.rows),
glm::ivec2(face->glyph->bitmap_left, face->glyph->bitmap_top), glm::ivec2(face->glyph->bitmap_left, face->glyph->bitmap_top),
static_cast<unsigned int>(face->glyph->advance.x) face->glyph->advance.x
}; };
f.characters.emplace(std::pair<char, Font::Character>(c, character)); f.characters.emplace(std::pair<char, Font::Character>(c, character));
} }
@ -163,7 +165,7 @@ void Text::DrawText(
auto iterator = fonts.find(fontName); auto iterator = fonts.find(fontName);
if (iterator == fonts.end()) if (iterator == fonts.end())
{ {
LOG(ERROR, "Font '{}' not found!", fontName); std::cout << "ERROR: Font: " << fontName << " not found!" << std::endl;
return; return;
} }