Initial engine repository

This commit is contained in:
2026-06-08 19:58:35 +08:00
commit 7a925c3736
137 changed files with 162421 additions and 0 deletions
@@ -0,0 +1,43 @@
#pragma once
#include <SDL2/SDL_ttf.h>
#include <frostbite2D/types/type_alias.h>
#include <optional>
#include <string>
#include <unordered_map>
namespace frostbite2D {
class FontManager {
public:
static FontManager& get();
bool init();
void shutdown();
bool registerFont(const std::string& name, const std::string& path, int fontSize);
TTF_Font* getFont(const std::string& name);
bool hasFont(const std::string& name) const;
void unregisterFont(const std::string& name);
void unloadAll();
struct FontInfo {
std::string name;
std::string path;
int size = 0;
};
std::optional<FontInfo> getFontInfo(const std::string& name) const;
FontManager(const FontManager&) = delete;
FontManager& operator=(const FontManager&) = delete;
private:
FontManager() = default;
~FontManager();
std::unordered_map<std::string, TTF_Font*> fonts_;
std::unordered_map<std::string, FontInfo> fontInfos_;
};
}