Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

Title Class Reference

Inheritance diagram for Title:

Inheritance graph
[legend]
Collaboration diagram for Title:

Collaboration graph
[legend]

Detailed Description

Subtitle.

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


Constructor & Destructor Documentation

Title::Title int  baseY,
int  finalY,
int  bonusTime,
int  limitY,
const std::string &  content,
Font font,
const Color color
 

Create new title to draw.

X is centred. Y is baseY above bottom screen border.

Parameters:
baseY number of pixels from the bottom border
finalY final position, it changes when next subtitle is added
bonusTime bonus time for subtitle under bottom border
limitY max Y distance from bottom border
content subtitle content
font subtitle font (shared)
color subtitle color (shared)

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 }

Title::~Title  )  [virtual]
 

Definition at line 51 of file Title.cpp.

00052 {
00053     SDL_FreeSurface(m_surface);
00054 }


Member Function Documentation

void Title::drawOn SDL_Surface *  screen  )  [virtual]
 

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 }

std::string Title::getContent  )  const [inline]
 

Definition at line 40 of file Title.h.

00040 { return m_content; }

int Title::getY  )  const
 

Return Y position from the bottom border.

Definition at line 94 of file Title.cpp.

00095 {
00096     return m_screenH - m_y;
00097 }

bool Title::isGone  ) 
 

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 }

void Title::shiftFinalUp int  rate  ) 
 

Definition at line 85 of file Title.cpp.

00086 {
00087     m_finalY -= rate;
00088 }

void Title::shiftUp int  rate  ) 
 

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 }


The documentation for this class was generated from the following files:
Generated on Wed Jun 1 09:57:04 2005 for Fish Fillets - Next Generation by  doxygen 1.4.2