| 1 |
#ifndef HEADER_SUBTITLEAGENT_H |
| 2 |
#define HEADER_SUBTITLEAGENT_H |
| 3 |
|
| 4 |
class ResColorPack; |
| 5 |
class Title; |
| 6 |
class Font; |
| 7 |
class Color; |
| 8 |
|
| 9 |
#include "BaseAgent.h" |
| 10 |
#include "Drawable.h" |
| 11 |
#include "Name.h" |
| 12 |
|
| 13 |
#include <string> |
| 14 |
#include <deque> |
| 15 |
|
| 16 |
/** |
| 17 |
* Subtitles manager. |
| 18 |
*/ |
| 19 |
class SubTitleAgent : public BaseAgent, public Drawable { |
| 20 |
AGENT(SubTitleAgent, Name::SUBTITLE_NAME); |
| 21 |
public: |
| 22 |
static const int TITLE_ROW = 26; |
| 23 |
static const int TITLE_BASE = 20; |
| 24 |
static const int TITLE_SPEED = 2; |
| 25 |
static const int TITLE_BORDER = 20; |
| 26 |
static const int TITLE_LIMIT_Y = TITLE_BASE + 5 * TITLE_ROW; |
| 27 |
typedef std::deque<Title*> t_titles; |
| 28 |
t_titles m_titles; |
| 29 |
|
| 30 |
Font *m_font; |
| 31 |
ResColorPack *m_colors; |
| 32 |
int m_limitY; |
| 33 |
private: |
| 34 |
std::string splitAndCreate(const std::string &subtitle, const Color *color); |
| 35 |
void trimRest(std::string &buffer); |
| 36 |
void newShortSubtitle(const std::string &subtitle, const Color *color); |
| 37 |
|
| 38 |
void shiftTitlesUp(int rate); |
| 39 |
void shiftFinalsUp(int rate); |
| 40 |
int lowestY(); |
| 41 |
protected: |
| 42 |
virtual void own_init(); |
| 43 |
virtual void own_update(); |
| 44 |
virtual void own_shutdown(); |
| 45 |
public: |
| 46 |
int getLimitY() const { return m_limitY; } |
| 47 |
void setLimitY(int limitY) { m_limitY = limitY; } |
| 48 |
void addFont(const std::string &fontname, Color *new_color); |
| 49 |
void newSubtitle(const std::string &subtitle, const std::string &fontname); |
| 50 |
|
| 51 |
void killTalks(); |
| 52 |
void removeAll(); |
| 53 |
|
| 54 |
virtual void drawOn(SDL_Surface *screen); |
| 55 |
}; |
| 56 |
|
| 57 |
#endif |
| 58 |
|