Application Class Reference

Collaboration diagram for Application:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Application ()
 ~Application ()
void quit ()
bool getQuit () const
void run ()

Private Member Functions

void init ()

Private Attributes

ContextActorm_actor
helloActionm_hello
Systemm_system
bool m_quit

Detailed Description

Definition at line 42 of file demo.cpp.


Constructor & Destructor Documentation

Application::Application (  )  [inline]

Definition at line 44 of file demo.cpp.

References init().

00044                   :
00045       m_actor(NULL),
00046       m_hello(new helloAction("hello action")), 
00047       m_system(NULL),
00048       m_quit(false) {
00049         init();
00050     }

Here is the call graph for this function:

Application::~Application (  )  [inline]

Definition at line 52 of file demo.cpp.

References m_actor, m_hello, and m_system.

00052                    {
00053       if(m_actor)  delete m_actor;
00054       if(m_hello)  delete m_hello;
00055       if(m_system) delete m_system;
00056     }


Member Function Documentation

bool Application::getQuit (  )  const [inline]

Definition at line 60 of file demo.cpp.

References m_quit.

00060                          {
00061       return m_quit; 
00062     }

void Application::init (  )  [inline, private]

Definition at line 74 of file demo.cpp.

References cmil::SDL::SDLSystem::Parameters::add(), cmil::ContextActor::addNormal(), cmil::SDL::Keyboards, m_actor, m_hello, m_system, and cmil::SDL::Mice.

Referenced by Application().

00074                 { 
00075       if( SDL_Init( SDL_INIT_VIDEO ) < 0){
00076           fprintf( stderr, "Could not initialise SDL: %s\n", SDL_GetError() );
00077           exit( -1 );
00078       }
00079 
00080       if( !SDL_SetVideoMode( 0, 0, 0, SDL_HWSURFACE | SDL_RESIZABLE ) ) {
00081           fprintf( stderr, "Could not set video mode: %s\n", SDL_GetError() );
00082           SDL_Quit();
00083           exit( -1 );
00084       }
00085 
00086       SDL_WM_SetCaption("demoing cmil alpha 0.91", "demo"); 
00087       SDL_EnableUNICODE(1);
00088 
00089       std::cout << "SDL initialized." << std::endl;
00090       std::cout << std::endl;
00091 
00092       SDL::SDLSystem::Parameters params;
00093 
00095 
00096       params.add(SDL::Mice, new WidgetMouse());
00097       params.add(SDL::Keyboards);
00098 
00099       m_system = new SDL::SDLSystem(params);
00100 
00103       
00104       m_actor  = new ContextActor(m_system);
00105 
00106       m_system -> attach(m_actor);
00107 
00108       m_actor->addNormal( Ev("Keyboard", "F") << m_hello );
00109       m_actor->addNormal( Ev("Keyboard", "Ctrl") << Ev("Keyboard", "F") << m_hello );
00110       m_actor->addNormal( Ev("WidgetMouse", "WidgetMotion") << m_hello );
00111       m_actor->addNormal( Ev("WidgetMouse", "WidgetLeftButton") << m_hello );
00112     }

Here is the call graph for this function:

Here is the caller graph for this function:

void Application::quit (  )  [inline]

Definition at line 58 of file demo.cpp.

References m_quit.

00058 { m_quit = true; }

void Application::run (  )  [inline]

Definition at line 64 of file demo.cpp.

References cmil::ContextActor::getQuit(), m_actor, m_system, and cmil::System::poll().

Referenced by main().

00064                { 
00065       while(!m_actor->getQuit()) { 
00066         m_system->poll(); 
00067         SDL_Delay(1); 
00068       }
00069 
00070       SDL_Quit();
00071     }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

ContextActor* Application::m_actor [private]

Definition at line 114 of file demo.cpp.

Referenced by init(), run(), and ~Application().

helloAction* Application::m_hello [private]

Definition at line 115 of file demo.cpp.

Referenced by init(), and ~Application().

bool Application::m_quit [private]

Definition at line 118 of file demo.cpp.

Referenced by getQuit(), and quit().

System* Application::m_system [private]

Definition at line 116 of file demo.cpp.

Referenced by init(), run(), and ~Application().


The documentation for this class was generated from the following file:
(c) 2006-2007 John P. Feltz
Generated on Wed Jul 25 16:08:02 2007 for Common Media Input Layer by doxygen 1.4.7

SourceForge.net Logo