The Game Engine  1
Text.h
Go to the documentation of this file.
1 #ifndef __TEXT_H__
2 #define __TEXT_H__
3 #include <stdio.h>
4 #include <stdlib.h>
5 #include <string>
6 #include <SDL/SDL.h>
7 #include <SDL/SDL_ttf.h>
8 #include "WorldObject.h"
9 #include "Font.h"
10 #include "Color.h"
11 using namespace std;
12 
22 class Text : public WorldObject
23 {
24 public:
35  Text(string name, string t, int size = 24, Color c = Color::WHITE, int w = 600, int h = 150, Point2D pos = Point2D());
36 
49  Text(string filename, string sectionName, FontType t, int size = 24, Color c = Color::WHITE, int w = 600, int h = 150, Point2D pos = Point2D());
50 
51  ~Text();
52 
55 
57  vector<string>lines;
58 
61 
63  void draw();
64 
66  void update();
67 
69  int width;
70 
72  int height;
73 
75  void setStartLine(unsigned int line);
76 
78  int getLastLine();
79 
83  Point2D getBasePos() { return Point2D(); };
84 
88  Point2D getCenterPos() { return Point2D(width/2.0,height/2.0); };
89 
93  virtual WorldObjectType getType(){ return TEXT; }
94 
98  void wrap();
99 
100 protected:
103 
105  int lastline;
106 };
107 #endif