LPCGame
A Simple 2d Game Engine
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
text.h
1 #ifndef TEXT_H
2 #define TEXT_H
3 
4 #include <string>
5 #include <stdexcept>
6 #include <memory>
7 #include <SDL.h>
8 #include <SDL_ttf.h>
9 #include "external/json/json.h"
10 #include "rect.h"
11 #include "color.h"
12 
14 
18 class Text {
19 public:
20  Text();
28  Text(std::string message, std::string font, Color color, int fontSize = 30);
29  ~Text();
37  void Set(std::string message, std::string font, Color color, int fontSize = 30);
43  void SetMessage(std::string message);
49  void SetFont(std::string font);
55  void SetFontSize(int fontSize);
61  void SetColor(Color color);
66  std::string GetMessage();
71  std::string GetFont();
76  int GetFontSize();
81  Color GetColor();
87  SDL_Texture* Texture();
92  Recti Size() const;
98  void Size(int *w, int *h = NULL) const;
100  int W() const;
102  int H() const;
107  Json::Value Save() const;
112  void Load(Json::Value val);
113 
114 private:
116  Text(const Text &a);
117  Text& operator = (const Text &a);
118 
119 private:
120  std::shared_ptr<SDL_Texture> mTex;
121  std::string mMessage, mFontFile;
122  int mFontSize;
123  Color mColor;
124 };
125 
126 #endif