2022-09-02 11:06:59 +00:00
|
|
|
#pragma once
|
|
|
|
|
2022-09-02 23:02:09 +00:00
|
|
|
#include "export.h"
|
|
|
|
|
2022-09-02 11:06:59 +00:00
|
|
|
#include "resource.hpp"
|
|
|
|
|
|
|
|
#include <glad/glad.h>
|
|
|
|
|
|
|
|
#include <glm/vec2.hpp>
|
|
|
|
|
|
|
|
#include <map>
|
|
|
|
|
|
|
|
namespace resources {
|
|
|
|
|
2022-09-03 04:56:51 +00:00
|
|
|
class ENGINE_API Font : public Resource {
|
2022-09-02 11:06:59 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
struct Character {
|
|
|
|
unsigned int textureID; // openGL texture handle
|
|
|
|
glm::ivec2 size;
|
|
|
|
glm::ivec2 bearing; // offset from baseline to top-left of glyph
|
|
|
|
long advance; // offset to the next glyph
|
|
|
|
};
|
|
|
|
|
|
|
|
Font(const std::filesystem::path& resPath);
|
|
|
|
~Font() override;
|
|
|
|
Character getChar(char c);
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::map<char, Character> m_characters;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|