Compare commits
2 commits
b10f6884cd
...
c6a21b24bb
| Author | SHA1 | Date | |
|---|---|---|---|
| c6a21b24bb | |||
| c4b6c187db |
3 changed files with 14 additions and 13 deletions
|
|
@ -4,7 +4,6 @@
|
||||||
#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>
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,15 @@
|
||||||
#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)
|
||||||
: actor(actor), raycaster(raycaster), state(AIState::Idle),
|
: state(AIState::Idle), raycaster(raycaster), actor(actor),
|
||||||
lastGCTime(std::chrono::high_resolution_clock::now()), GCTimeout(3)
|
lastGCTime(std::chrono::high_resolution_clock::now()), GCTimeout(3)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ Text::Text()
|
||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
glGetShaderInfoLog(vertexID, 512, 0, log);
|
glGetShaderInfoLog(vertexID, 512, 0, log);
|
||||||
std::cout << "ERROR::COMPILER VERTEX SHADER FAILED TO COMPILE: " << log << std::endl;
|
LOG(ERROR, "ERROR::COMPILER VERTEX SHADER FAILED TO COMPILE: {}", log);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -54,7 +54,7 @@ Text::Text()
|
||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
glGetShaderInfoLog(fragID, 512, NULL, log);
|
glGetShaderInfoLog(fragID, 512, NULL, log);
|
||||||
std::cout << "ERROR::COMPILER FRAGMENT SHADER FAILED TO COMPILE: " << log << std::endl;
|
LOG(ERROR, "ERROR::COMPILER FRAGMENT SHADER FAILED TO COMPILE: {}", log);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -67,7 +67,7 @@ Text::Text()
|
||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
glGetProgramInfoLog(programID, 512, NULL, log);
|
glGetProgramInfoLog(programID, 512, NULL, log);
|
||||||
std::cout << "ERROR::LINKER FAILED: " << log << std::endl;
|
LOG(ERROR, "ERROR::LINKER FAILED: ", log);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -91,10 +91,8 @@ 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);
|
||||||
|
|
@ -108,7 +106,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))
|
||||||
{
|
{
|
||||||
std::cout << "ERROR::FREETYPE Failed to load font: " << file.path().string() << std::endl;
|
LOG(ERROR, "ERROR::FREETYPE Failed to load font: {}", file.path().string());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
FT_Set_Pixel_Sizes(face, 0, 48);
|
FT_Set_Pixel_Sizes(face, 0, 48);
|
||||||
|
|
@ -120,7 +118,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))
|
||||||
{
|
{
|
||||||
std::cout << "ERROR::FREETYPE Failed to load glyph ( " << (char)c << " )" << std::endl;
|
LOG(ERROR, "ERROR::FREETYPE Failed to load glyph ({})", (char)c);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
unsigned int texture;
|
unsigned int texture;
|
||||||
|
|
@ -144,7 +142,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),
|
||||||
face->glyph->advance.x
|
static_cast<unsigned int>(face->glyph->advance.x)
|
||||||
};
|
};
|
||||||
f.characters.emplace(std::pair<char, Font::Character>(c, character));
|
f.characters.emplace(std::pair<char, Font::Character>(c, character));
|
||||||
}
|
}
|
||||||
|
|
@ -165,7 +163,7 @@ void Text::DrawText(
|
||||||
auto iterator = fonts.find(fontName);
|
auto iterator = fonts.find(fontName);
|
||||||
if (iterator == fonts.end())
|
if (iterator == fonts.end())
|
||||||
{
|
{
|
||||||
std::cout << "ERROR: Font: " << fontName << " not found!" << std::endl;
|
LOG(ERROR, "Font '{}' not found!", fontName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue