ShishGL  1.0
A simple modular cross-platform graphics library
Font.hpp
Go to the documentation of this file.
1 /*============================================================================*/
2 #ifndef SHISHGL_FONT_HPP
3 #define SHISHGL_FONT_HPP
4 /*============================================================================*/
5 #include <string_view>
6 
7 #include "Style.hpp"
8 #include "RenderSystem.hpp"
9 #include "ResourceManager.hpp"
10 /*============================================================================*/
11 namespace Sh {
12 
13  class Font : public Style {
14  public:
15 
16  explicit Font(const std::string_view& font_path)
17  : path(font_path)
18  { }
19 
20  void apply(Frame&, const Shape2D&) override {
22  }
23 
24  private:
25 
26  std::string_view path;
27 
28  };
29 
30  class FontSize : public Style {
31  public:
32 
33  explicit FontSize(const size_t& font_size)
34  : size(font_size)
35  { }
36 
37  void apply(Frame&, const Shape2D&) override {
38  PLATFORM().setFontSize(size);
39  }
40 
41  private:
42 
43  size_t size;
44 
45  };
46 
47 }
48 /*============================================================================*/
49 #endif //SHISHGL_FONT_HPP
50 /*============================================================================*/
Sh::Shape2D
Definition: Shape2D.hpp:12
Sh::Frame
Definition: Frame.hpp:9
Sh::ResourceManager::get
static const Resource & get(const std::string_view &filename)
Definition: ResourceManager.cpp:61
Sh::Font
Definition: Font.hpp:13
Sh::IPlatform::setFont
virtual void setFont(const ResourceManager::Resource &font)=0
Style.hpp
Sh::Font::Font
Font(const std::string_view &font_path)
Definition: Font.hpp:16
Sh::PLATFORM
IPlatform & PLATFORM()
Definition: RenderSystem.cpp:32
Sh::Font::apply
void apply(Frame &, const Shape2D &) override
Definition: Font.hpp:20
Sh::FontSize::FontSize
FontSize(const size_t &font_size)
Definition: Font.hpp:33
ResourceManager.hpp
Sh::FontSize
Definition: Font.hpp:30
Sh::Style
Definition: Style.hpp:12
Sh
Definition: CoreApplication.hpp:10
RenderSystem.hpp
Sh::IPlatform::setFontSize
virtual void setFontSize(const size_t &font_size)=0
Sh::FontSize::apply
void apply(Frame &, const Shape2D &) override
Definition: Font.hpp:37