Compare commits
No commits in common. "c6a21b24bbea5cbf50eaa323159f1c249fba332e" and "b10f6884cd77692d3795b86c6fb9e41675fd23a7" have entirely different histories.
c6a21b24bb
...
b10f6884cd
3 changed files with 13 additions and 14 deletions
|
|
@ -4,6 +4,7 @@
|
|||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
|
||||
#include <iostream>
|
||||
#include <filesystem>
|
||||
#include <glm/glm.hpp>
|
||||
#include <map>
|
||||
|
|
|
|||
|
|
@ -4,15 +4,11 @@
|
|||
#include "utility/raycaster.h"
|
||||
#include "utility/script.h"
|
||||
|
||||
#if _DEBUG
|
||||
#else
|
||||
#include <tracy/Tracy.hpp>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
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)
|
||||
{}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ Text::Text()
|
|||
if (!success)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ Text::Text()
|
|||
if (!success)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ Text::Text()
|
|||
if (!success)
|
||||
{
|
||||
glGetProgramInfoLog(programID, 512, NULL, log);
|
||||
LOG(ERROR, "ERROR::LINKER FAILED: ", log);
|
||||
std::cout << "ERROR::LINKER FAILED: " << log << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -91,8 +91,10 @@ Text::Text()
|
|||
bool Text::loadFonts(const std::string& font_folder)
|
||||
{
|
||||
FT_Library ft;
|
||||
if (FT_Init_FreeType(&ft)) {
|
||||
ERROR_LOG("ERROR::FREETYPE Failed to init freetype library");
|
||||
if (FT_Init_FreeType(&ft))
|
||||
{
|
||||
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.
|
||||
std::filesystem::path folder(font_folder);
|
||||
|
|
@ -106,7 +108,7 @@ bool Text::loadFonts(const std::string& font_folder)
|
|||
FT_Face 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;
|
||||
}
|
||||
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))
|
||||
{
|
||||
LOG(ERROR, "ERROR::FREETYPE Failed to load glyph ({})", (char)c);
|
||||
std::cout << "ERROR::FREETYPE Failed to load glyph ( " << (char)c << " )" << std::endl;
|
||||
continue;
|
||||
}
|
||||
unsigned int texture;
|
||||
|
|
@ -142,7 +144,7 @@ bool Text::loadFonts(const std::string& font_folder)
|
|||
texture,
|
||||
glm::ivec2(face->glyph->bitmap.width, face->glyph->bitmap.rows),
|
||||
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));
|
||||
}
|
||||
|
|
@ -163,7 +165,7 @@ void Text::DrawText(
|
|||
auto iterator = fonts.find(fontName);
|
||||
if (iterator == fonts.end())
|
||||
{
|
||||
LOG(ERROR, "Font '{}' not found!", fontName);
|
||||
std::cout << "ERROR: Font: " << fontName << " not found!" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue