Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.61 KB | None | 0 0
  1. #ifndef FONT_H
  2. #define FONT_H
  3.  
  4. #include <glad/glad.h>
  5. #include <glm/glm.hpp>
  6. #include <map>
  7. #include <shader/shader.h>
  8.  
  9. class Font
  10. {
  11. public:
  12.     GLuint texture;
  13.     glm::ivec2 textureSize;
  14.     GLuint quadVAO, quadVBO;
  15.     GLuint faceVAO, faceVBO;
  16.     struct Character {
  17.         glm::ivec2  size;
  18.         glm::ivec2  bearing;
  19.         glm::ivec2  position;
  20.         GLuint      advance;
  21.     };
  22.     std::map<GLubyte, Character> characters;
  23.     Font(std::string fontPath, int pixels);
  24.     ~Font();
  25.     void renderBitmap(Shader & shader);
  26.     void renderText(Shader & shader, std::string text, GLfloat x, GLfloat y, GLfloat scale, glm::vec3 color);
  27. };
  28. #endif //FONT_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement