Voxellancer  0.3
A game about voxels in space
 All Classes Functions Pages
voxelfont.h
1 #pragma once
2 #include <string>
3 #include <map>
4 #include <memory>
5 #include <vector>
6 
7 #include <glm/glm.hpp>
8 #include <glm/gtx/quaternion.hpp>
9 
10 #include "voxelfontconstants.h"
11 
12 class Letter;
13 class VoxelRenderer;
14 
15 class VoxelFont {
16 public:
17  VoxelFont();
18  ~VoxelFont();
19 
20  // renderer must be prepared
21  void drawString(std::string text, glm::vec3 position, glm::quat orientation, FontSize size = FontSize::SIZE5x7, float scale = 1.f, FontAlign align = FontAlign::CENTER);
22 
23  int letterWidth(FontSize size);
24  int letterHeight(FontSize size);
25 
26  static VoxelFont* instance();
27 
28 protected:
29  static VoxelFont* s_instance;
30 
31  void loadFont(const std::string& identifier, glm::vec3 offset, std::map<char, std::unique_ptr<Letter>> *map);
32  void loadChar(const std::string& filename, glm::vec3 offset, const char index, std::map<char, std::unique_ptr<Letter>> *map);
33 
34  std::map<char, std::unique_ptr<Letter>> m_font3x5;
35  std::map<char, std::unique_ptr<Letter>> m_font5x7;
36 
37 };
Definition: letter.h:9
Definition: voxelfont.h:15
Definition: voxelrenderer.h:24