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

DemoMode Class Reference

Inheritance diagram for DemoMode:

Inheritance graph
[legend]
Collaboration diagram for DemoMode:

Collaboration graph
[legend]

Detailed Description

Graphic demo.

Definition at line 15 of file DemoMode.h.

Public Member Functions

 DemoMode (const Path &demoscript)
virtual ~DemoMode ()
virtual const char * getName () const
bool action_display (Picture *picture)
 Store picture to draw it.
virtual void drawOn (SDL_Surface *screen)

Protected Member Functions

virtual void own_initState ()
 Run demo.
virtual void own_updateState ()
 Execute next demo command.
virtual void own_pauseState ()
virtual void own_resumeState ()
virtual void own_cleanState ()


Constructor & Destructor Documentation

DemoMode::DemoMode const Path demoscript  ) 
 

Definition at line 24 of file DemoMode.cpp.

00025     : m_demoscript(demoscript)
00026 {
00027     m_oldLimitY = 0;
00028     m_display = NULL;
00029     m_surfaceBuffer = NULL;
00030     m_script->registerFunc("demo_display", script_demo_display);
00031     takeHandler(new DemoInput(this));
00032     registerDrawable(this);
00033     registerDrawable(SubTitleAgent::agent());
00034 }

DemoMode::~DemoMode  )  [virtual]
 

Definition at line 36 of file DemoMode.cpp.

00037 {
00038     own_cleanState();
00039 }


Member Function Documentation

bool DemoMode::action_display Picture picture  ) 
 

Store picture to draw it.

NOTE: limitY for long subtitles are prepared when display is set before planning start

Definition at line 86 of file DemoMode.cpp.

00087 {
00088     if (m_display) {
00089         delete m_display;
00090     }
00091     m_display = picture;
00092 
00093     if (NULL == m_surfaceBuffer) {
00094         OptionAgent *options = OptionAgent::agent();
00095         options->setParam("screen_width", m_display->getW());
00096         options->setParam("screen_height", m_display->getH());
00097         VideoAgent::agent()->initVideoMode();
00098 
00099         SubTitleAgent::agent()->setLimitY(2 * m_display->getH());
00100     }
00101     return true;
00102 }

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

Implements Drawable.

Definition at line 105 of file DemoMode.cpp.

00106 {
00107     if (NULL == m_surfaceBuffer) {
00108         m_surfaceBuffer = SurfaceTool::createEmpty(screen);
00109     }
00110 
00111     if (m_display) {
00112         m_display->drawOn(m_surfaceBuffer);
00113     }
00114     SDL_BlitSurface(m_surfaceBuffer, NULL, screen, NULL);
00115 }

virtual const char* DemoMode::getName  )  const [inline, virtual]
 

Implements INamed.

Definition at line 30 of file DemoMode.h.

00030 { return "state_demo"; };

void DemoMode::own_cleanState  )  [protected, virtual]
 

Implements GameState.

Definition at line 63 of file DemoMode.cpp.

00064 {
00065     //NOTE: loaded dialogs are released by ~Planner()
00066     if (m_surfaceBuffer) {
00067         SDL_FreeSurface(m_surfaceBuffer);
00068         m_surfaceBuffer = NULL;
00069     }
00070     if (m_display) {
00071         delete m_display;
00072         m_display = NULL;
00073     }
00074 
00075     SubTitleAgent::agent()->setLimitY(m_oldLimitY);
00076     killPlan();
00077 }

void DemoMode::own_initState  )  [protected, virtual]
 

Run demo.

Implements GameState.

Definition at line 45 of file DemoMode.cpp.

00046 {
00047     m_oldLimitY = SubTitleAgent::agent()->getLimitY();
00048     m_script->doFile(m_demoscript);
00049 }

virtual void DemoMode::own_pauseState  )  [inline, protected, virtual]
 

Implements GameState.

Definition at line 24 of file DemoMode.h.

00024 {}

virtual void DemoMode::own_resumeState  )  [inline, protected, virtual]
 

Implements GameState.

Definition at line 25 of file DemoMode.h.

00025 {}

void DemoMode::own_updateState  )  [protected, virtual]
 

Execute next demo command.

Implements GameState.

Definition at line 55 of file DemoMode.cpp.

00056 {
00057     if (satisfyPlan()) {
00058         quitState();
00059     }
00060 }


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