35 lines
905 B
C++
35 lines
905 B
C++
/*
|
|
# _____ ____ ___
|
|
# | \/ ____| |___|
|
|
# | | | \ | |
|
|
#-----------------------------------------------------------------------
|
|
# Copyright 2022-2023, tyra - https://github.com/h4570/tyra
|
|
# Licensed under Apache License 2.0
|
|
# Guido Diego Quispe Robles
|
|
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <tyra>
|
|
|
|
namespace Tyra{
|
|
|
|
extern const int charSize;
|
|
extern const int font_char[96];
|
|
extern const int font_charWidth[96];
|
|
|
|
class Font{
|
|
public:
|
|
Font();
|
|
void LoadFont(TextureRepository& repository, Renderer2D* renderer);
|
|
void FreeFont(TextureRepository& repository);
|
|
void DrawText(const char* text, int x, int y, Color color);
|
|
void DrawText(const std::string& text, int x, int y, Color color);
|
|
private:
|
|
Renderer2D* renderer2D;
|
|
Sprite all_font;
|
|
std::array<Sprite,96> font;
|
|
};
|
|
|
|
} // namespace Tyra
|