AppWormux Class Reference

#include <app.h>

Collaboration diagram for AppWormux:

Collaboration graph
[legend]
List of all members.

Public Member Functions

int main (int argc, char **argv)

Static Public Member Functions

static AppWormuxGetInstance ()

Public Attributes

Video video

Private Member Functions

void Init (int, char **)
void InitWindow ()
void DisplayLoadingPicture ()
void InitFonts ()
void End ()
void DisplayWelcomeMessage ()
 AppWormux ()

Private Attributes

int x
int y
std::string windows_title

Static Private Attributes

static AppWormuxsingleton = NULL

Detailed Description

Definition at line 31 of file app.h.


Constructor & Destructor Documentation

AppWormux::AppWormux (  )  [private]

Definition at line 60 of file main.cpp.

00060                     {
00061 }

Here is the caller graph for this function:


Member Function Documentation

void AppWormux::DisplayLoadingPicture (  )  [private]

Definition at line 143 of file main.cpp.

00143                                      {
00144   Config * config = Config::GetInstance();
00145 
00146   std::string txt_version = _("Version") + std::string(" ") + Constants::VERSION;
00147   std::string filename = config->GetDataDir()
00148     + PATH_SEPARATOR + "menu"
00149     + PATH_SEPARATOR + "img"
00150     + PATH_SEPARATOR + "loading.png";
00151 
00152   Surface surfaceLoading = Surface( filename.c_str() );
00153   Sprite loading_image = Sprite( surfaceLoading );
00154 
00155   loading_image.cache.EnableLastFrameCache();
00156   loading_image.ScaleSize( video.window.GetSize() );
00157   loading_image.Blit( video.window, 0, 0 );
00158 
00159   Time::GetInstance()->Reset();
00160 
00161   Text text1(_("Wormux launching..."), white_color, Font::GetInstance(Font::FONT_HUGE), true);
00162   Text text2(txt_version, white_color, Font::GetInstance(Font::FONT_HUGE), true);
00163 
00164   Point2i windowCenter = video.window.GetSize() / 2;
00165 
00166   text1.DrawCenter( windowCenter );
00167   text2.DrawCenter( windowCenter + Point2i(0, (*Font::GetInstance(Font::FONT_HUGE)).GetHeight() + 20 ));
00168 
00169   video.window.Flip();
00170 }

Here is the call graph for this function:

Here is the caller graph for this function:

void AppWormux::DisplayWelcomeMessage (  )  [private]

Definition at line 196 of file main.cpp.

00196                                      {
00197   std::cout << "=== " << _("Wormux version ") << Constants::VERSION << std::endl;
00198   std::cout << "=== " << _("Authors:") << ' ';
00199   for( std::vector<std::string>::iterator it=Constants::AUTHORS.begin(),
00200        fin=Constants::AUTHORS.end();
00201        it != fin;
00202        ++it)
00203   {
00204     if( it != Constants::AUTHORS.begin() )
00205       std::cout << ", ";
00206     std::cout << *it;
00207   }
00208   std::cout << std::endl
00209             << "=== " << _("Website: ") << Constants::WEB_SITE << std::endl
00210             << std::endl;
00211 
00212   // Affiche l'absence de garantie sur le jeu
00213   std::cout << "Wormux version " << Constants::VERSION
00214             << ", Copyright (C) 2001-2006 Wormux Team"
00215             << std::endl
00216             << "Wormux comes with ABSOLUTELY NO WARRANTY." << std::endl
00217             << "This is free software, and you are welcome to redistribute it" << std::endl
00218             << "under certain conditions." << std::endl
00219             << std::endl
00220             << "Read COPYING file for details." << std::endl
00221             << std::endl;
00222 
00223 #ifdef DEBUG
00224   std::cout << "!!! This program was compiled in DEBUG mode (development version) !!!" << std::endl
00225             << std::endl;
00226 #endif
00227 
00228   std::cout << "[ " << _("Run game") << " ]" << std::endl;
00229 }

Here is the caller graph for this function:

void AppWormux::End (  )  [private]

Definition at line 177 of file main.cpp.

00177                    {
00178   std::cout << std::endl
00179             << "[ " << _("Quit Wormux") << " ]" << std::endl;
00180 
00181   Config::GetInstance()->Save();
00182   jukebox.End();
00183   delete Config::GetInstance();
00184   delete Time::GetInstance();
00185   delete Constants::GetInstance();
00186   TTF_Quit();
00187 
00188 #ifdef ENABLE_STATS
00189   SaveStatToXML("stats.xml");
00190 #endif
00191   std::cout << "o "
00192             << _("If you found a bug or have a feature request send us a email (in english, please):") << " " << Constants::EMAIL
00193             << std::endl;
00194 }

Here is the call graph for this function:

Here is the caller graph for this function:

AppWormux * AppWormux::GetInstance (  )  [static]

Definition at line 53 of file main.cpp.

00053                                    {
00054   if (singleton == NULL) {
00055     singleton = new AppWormux();
00056   }
00057   return singleton;
00058 }

Here is the call graph for this function:

Here is the caller graph for this function:

void AppWormux::Init ( int  ,
char **   
) [private]

Definition at line 128 of file main.cpp.

00128                                          {
00129   Config * config = Config::GetInstance();
00130 
00131   DisplayWelcomeMessage();
00132   InitDebugModes(argc, argv);
00133 
00134   video.InitWindow();
00135   InitFonts();
00136 
00137   DisplayLoadingPicture();
00138   config->Apply();
00139 
00140   jukebox.Init();
00141 }

Here is the call graph for this function:

Here is the caller graph for this function:

void AppWormux::InitFonts (  )  [private]

Definition at line 172 of file main.cpp.

00172                          {
00173   if( TTF_Init() == -1 )
00174     Error( Format( _("Initialisation of TTF library failed: %s"), TTF_GetError() ) );
00175 }

Here is the call graph for this function:

Here is the caller graph for this function:

void AppWormux::InitWindow (  )  [private]

int AppWormux::main ( int  argc,
char **  argv 
)

Definition at line 63 of file main.cpp.

00063                                          {
00064   bool quit = false;
00065 
00066   try {
00067     Init(argc, argv);
00068     do {
00069       Main_Menu main_menu;
00070       menu_item choix;
00071 
00072       StatStart("Main:Menu");
00073       choix = main_menu.Run();
00074       StatStop("Main:Menu");
00075 
00076       switch (choix)
00077         {
00078         case menuPLAY:
00079           {
00080             GameMenu game_menu;
00081             game_menu.Run();
00082             break;
00083           }
00084         case menuNETWORK:
00085           {
00086             NetworkConnectionMenu network_connection_menu;
00087             network_connection_menu.Run();
00088             break;
00089           }
00090         case menuOPTIONS:
00091           {
00092             OptionMenu options_menu;
00093             options_menu.Run();
00094             break;
00095           }
00096         case menuCREDITS:
00097           {
00098             CreditsMenu credits_menu;
00099             credits_menu.Run();
00100             break;
00101           }
00102         case menuQUIT:
00103           quit = true;
00104         default:
00105           break;
00106         }
00107     } while (!quit);
00108 
00109     End();
00110   }
00111   catch (const std::exception &e){
00112     std::cerr << std::endl
00113               << _("C++ exception caught:") << std::endl
00114               << e.what() << std::endl
00115               << std::endl;
00116     WakeUpDebugger();
00117   }
00118   catch (...){
00119     std::cerr << std::endl
00120               << _("Unexpected exception caught...") << std::endl
00121               << std::endl;
00122     WakeUpDebugger();
00123   }
00124 
00125   return 0;
00126 }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

AppWormux * AppWormux::singleton = NULL [static, private]

Definition at line 40 of file app.h.

Video AppWormux::video

Definition at line 34 of file app.h.

std::string AppWormux::windows_title [private]

Definition at line 38 of file app.h.

int AppWormux::x [private]

Definition at line 37 of file app.h.

int AppWormux::y [private]

Definition at line 37 of file app.h.


The documentation for this class was generated from the following files:
Generated on Mon Jan 1 13:34:40 2007 for Wormux by  doxygen 1.4.7