TouchCPLib  1.0.0
A touch-enabled GUI interface based on SDL and libTS. It provides a simple desktop-free UI for your embedded Raspberry projects.
Font.h
Go to the documentation of this file.
1 #pragma once
2 
12 #include <SDL2/SDL.h>
13 #include <SDL2/SDL_ttf.h>
14 #include <string>
15 
16 class Font
17 {
18 public:
19  Font(const std::string &fontPath, int fontSize) : fontPath(fontPath), fontSize(fontSize)
20  {
21  font = TTF_OpenFont(fontPath.c_str(), fontSize);
22  }
24  {
25  TTF_CloseFont(font);
26  }
27  operator TTF_Font *()
28  {
29  return font;
30  }
31 
32 private:
33  std::string fontPath;
34  int fontSize;
35  TTF_Font *font;
36 };
Definition: Font.h:16
~Font()
Definition: Font.h:23
Font(const std::string &fontPath, int fontSize)
Definition: Font.h:19