BARE2D
FontRenderer.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "Font.hpp"
4 #include "BasicRenderer.hpp"
5 
6 namespace BARE2D {
7 
8  /**
9  * @class Justification
10  * @brief An enum for text justification
11  */
12  enum class Justification {
13  RIGHT,
14  MIDDLE,
15  LEFT
16  };
17 
18  /**
19  * @class FontRenderer
20  * @brief The FontRenderer... renders fonts. It is just a very basic extension of the BasicRenderer, so it works the same.
21  */
22  class FontRenderer : public BasicRenderer
23  {
24  public:
25  FontRenderer(std::string& fragShader, std::string& vertShader, unsigned int perspectiveWidth = 2, unsigned int perspectiveHeight = 2);
26  ~FontRenderer();
27 
28  virtual void draw(Font& font, glm::vec2 scaling, glm::vec4 destRect, const char* text, float depth, Colour tint, Justification just = Justification::LEFT, glm::vec4 uvRect = glm::vec4(0.0f, 0.0f, 1.0f, 1.0f));
29 
30  };
31 
32 }
BARE2D::Font
Essentially just a wrapper for the SDL TTF_Font type.
Definition: Font.hpp:29
BARE2D
Definition: App.cpp:13
BasicRenderer.hpp
A simple renderer. Has the GLSL VAOs vertexPosition (vec3), vertexColour (vec4), and vertexUV (vec2)....
BARE2D::FontRenderer::draw
virtual void draw(Font &font, glm::vec2 scaling, glm::vec4 destRect, const char *text, float depth, Colour tint, Justification just=Justification::LEFT, glm::vec4 uvRect=glm::vec4(0.0f, 0.0f, 1.0f, 1.0f))
Definition: FontRenderer.cpp:15
BARE2D::FontRenderer::~FontRenderer
~FontRenderer()
Definition: FontRenderer.cpp:12
BARE2D::FontRenderer
The FontRenderer... renders fonts. It is just a very basic extension of the BasicRenderer,...
Definition: FontRenderer.hpp:22
BARE2D::Justification::LEFT
@ LEFT
Justification
An enum for text justification.
BARE2D::FontRenderer::FontRenderer
FontRenderer(std::string &fragShader, std::string &vertShader, unsigned int perspectiveWidth=2, unsigned int perspectiveHeight=2)
Definition: FontRenderer.cpp:5
Font.hpp
BARE2D::BasicRenderer
Definition: BasicRenderer.hpp:18
BARE2D::Justification::RIGHT
@ RIGHT
BARE2D::Colour
An RGBA 8-bit colour value.
Definition: Vertex.hpp:20
BARE2D::Justification::MIDDLE
@ MIDDLE