2022-09-02 11:06:59 +00:00
|
|
|
#pragma once
|
|
|
|
|
2022-09-07 09:02:01 +00:00
|
|
|
#include "engine_api.h"
|
2022-09-02 23:02:09 +00:00
|
|
|
|
2022-09-02 11:06:59 +00:00
|
|
|
#include "resource.hpp"
|
|
|
|
|
2022-11-23 16:20:08 +00:00
|
|
|
#include "gfx.hpp"
|
|
|
|
|
2022-09-02 11:06:59 +00:00
|
|
|
#include <glm/vec2.hpp>
|
|
|
|
|
|
|
|
#include <map>
|
|
|
|
|
2022-10-06 10:30:44 +00:00
|
|
|
namespace engine::resources {
|
2022-09-02 11:06:59 +00:00
|
|
|
|
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 {
|
2022-11-23 16:20:08 +00:00
|
|
|
gfx::Texture* texture;
|
2022-09-02 11:06:59 +00:00
|
|
|
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;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|