removed iostream from ftfont
This commit is contained in:
parent
6e7bb8397f
commit
c4b6c187db
3 changed files with 14 additions and 13 deletions
|
|
@ -4,7 +4,6 @@
|
|||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
|
||||
#include <iostream>
|
||||
#include <filesystem>
|
||||
#include <glm/glm.hpp>
|
||||
#include <map>
|
||||
|
|
|
|||
|
|
@ -4,11 +4,15 @@
|
|||
#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)
|
||||
: actor(actor), raycaster(raycaster), state(AIState::Idle),
|
||||
: state(AIState::Idle), raycaster(raycaster), actor(actor),
|
||||
lastGCTime(std::chrono::high_resolution_clock::now()), GCTimeout(3)
|
||||
{}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ Text::Text()
|
|||
if (!success)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ Text::Text()
|
|||
if (!success)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ Text::Text()
|
|||
if (!success)
|
||||
{
|
||||
glGetProgramInfoLog(programID, 512, NULL, log);
|
||||
std::cout << "ERROR::LINKER FAILED: " << log << std::endl;
|
||||
LOG(ERROR, "ERROR::LINKER FAILED: ", log);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -91,10 +91,8 @@ Text::Text()
|
|||
bool Text::loadFonts(const std::string& font_folder)
|
||||
{
|
||||
FT_Library ft;
|
||||
if (FT_Init_FreeType(&ft))
|
||||
{
|
||||
std::cout << "ERROR::FREETYPE Failed to init freetype library" << std::endl;
|
||||
return false;
|
||||
if (FT_Init_FreeType(&ft)) {
|
||||
ERROR_LOG("ERROR::FREETYPE Failed to init freetype library");
|
||||
}
|
||||
// load every font in the fonts folder then create corresponding textures for each character of each font.
|
||||
std::filesystem::path folder(font_folder);
|
||||
|
|
@ -108,7 +106,7 @@ bool Text::loadFonts(const std::string& font_folder)
|
|||
FT_Face 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;
|
||||
}
|
||||
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))
|
||||
{
|
||||
std::cout << "ERROR::FREETYPE Failed to load glyph ( " << (char)c << " )" << std::endl;
|
||||
LOG(ERROR, "ERROR::FREETYPE Failed to load glyph ({})", (char)c);
|
||||
continue;
|
||||
}
|
||||
unsigned int texture;
|
||||
|
|
@ -144,7 +142,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),
|
||||
face->glyph->advance.x
|
||||
static_cast<unsigned int>(face->glyph->advance.x)
|
||||
};
|
||||
f.characters.emplace(std::pair<char, Font::Character>(c, character));
|
||||
}
|
||||
|
|
@ -165,7 +163,7 @@ void Text::DrawText(
|
|||
auto iterator = fonts.find(fontName);
|
||||
if (iterator == fonts.end())
|
||||
{
|
||||
std::cout << "ERROR: Font: " << fontName << " not found!" << std::endl;
|
||||
LOG(ERROR, "Font '{}' not found!", fontName);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue