

Definition at line 14 of file Title.h.
Public Member Functions | |
| Title (int baseY, int finalY, int bonusTime, int limitY, const std::string &content, Font *font, const Color *color) | |
| Create new title to draw. | |
| virtual | ~Title () |
| void | shiftUp (int rate) |
| Shift up until title is on limit. | |
| void | shiftFinalUp (int rate) |
| virtual void | drawOn (SDL_Surface *screen) |
| Draw model. | |
| bool | isGone () |
| Whether title was long enough on screen. | |
| int | getY () const |
| Return Y position from the bottom border. | |
| std::string | getContent () const |
|
||||||||||||||||||||||||||||||||
|
Create new title to draw. X is centred. Y is baseY above bottom screen border.
Definition at line 29 of file Title.cpp. 00031 : m_content(content)
00032 {
00033 m_font = font;
00034 m_surface = m_font->renderTextOutlined(content, *color);
00035
00036 int text_width = m_font->calcTextWidth(content);
00037
00038 m_screenW = OptionAgent::agent()->getAsInt("screen_width");
00039 m_screenH = OptionAgent::agent()->getAsInt("screen_height");
00040 m_x = (m_screenW - text_width) / 2;
00041 m_y = m_screenH - baseY;
00042 m_finalY = m_screenH - finalY;
00043 m_limitY = m_screenH - limitY;
00044 m_mintime = m_content.size() * TIME_PER_CHAR;
00045 if (m_mintime < TIME_MIN) {
00046 m_mintime = TIME_MIN;
00047 }
00048 m_mintime += bonusTime;
00049 }
|
|
|
Definition at line 51 of file Title.cpp. 00052 {
00053 SDL_FreeSurface(m_surface);
00054 }
|
|
|
Draw model.
Implements Drawable. Definition at line 60 of file Title.cpp. 00061 {
00062 //TODO: wavy text
00063 SDL_Rect rect;
00064 rect.x = m_x;
00065 rect.y = m_y;
00066
00067 SDL_BlitSurface(m_surface, NULL, screen, &rect);
00068 }
|
|
|
Definition at line 40 of file Title.h. 00040 { return m_content; }
|
|
|
Return Y position from the bottom border.
Definition at line 94 of file Title.cpp. 00095 {
00096 return m_screenH - m_y;
00097 }
|
|
|
Whether title was long enough on screen.
Definition at line 103 of file Title.cpp. 00104 {
00105 //TEST: long time
00106 return (m_mintime < 0 || m_y < m_limitY);
00107 //return m_y < m_limitY;
00108 }
|
|
|
Definition at line 85 of file Title.cpp. 00086 {
00087 m_finalY -= rate;
00088 }
|
|
|
Shift up until title is on limit. Decrease m_mintime. Definition at line 75 of file Title.cpp. 00076 {
00077 m_mintime--;
00078 m_y -= rate;
00079 if (m_y < m_finalY) {
00080 m_y = m_finalY;
00081 }
00082 }
|
1.4.2