00001 #include "borqueror.h"
00002
00003 #ifdef _DEBUG
00004 # pragma comment( lib , "arsd.lib" )
00005 #else
00006 # pragma comment( lib , "ars.lib" )
00007 #endif
00008
00009
00010 const int TofMain( const int argc , char **argv )
00011 {
00012 #ifdef WIN32
00013 # ifdef _DEBUG
00014
00015 int tmpFlag = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG );
00016
00017 tmpFlag |= _CRTDBG_LEAK_CHECK_DF;
00018
00019 tmpFlag &= ~_CRTDBG_CHECK_CRT_DF;
00020
00021 _CrtSetDbgFlag( tmpFlag );
00022 # endif
00023 #endif
00024 extern ArsApplication *_mainApp_;
00025
00026 _mainApp_ = (ArsApplication *)new Borqueror( argc , argv );
00027 _mainApp_->Init();
00028 _mainApp_->Exec();
00029 int ans = _mainApp_->ExitCode();
00030 delete _mainApp_;
00031
00032 MessageServer *ins = &MessageServer::Instance();
00033 if( ins )
00034 delete ins;
00035 ins = 0;
00036
00037 return ans;
00038 }
00039
00040 Borqueror::Borqueror( const int argc , char **argv )
00041 : ArsApplication( argc , argv )
00042 {
00043 }
00044
00045 Borqueror::~Borqueror( void )
00046 {
00047 }
00048
00049 void Borqueror::GenDefaultCfg( void )
00050 {
00051 Cfg::Handler &h = Cfg::GetCfg();
00052
00053 h.SetCfgColorHex( "Ars" , "text_color" , RGBColor( 0x50 , 0x90 , 0x60 ) );
00054 h.SetCfgColorHex( "Ars" , "back_color" , RGBColor( 0x20 , 0x50 , 0x20 ) );
00055
00056 const SDL_VideoInfo *vidInfo = SDL_GetVideoInfo();
00057 SDL_Rect **scr = SDL_ListModes( vidInfo->vfmt , SDL_FULLSCREEN | SDL_HWSURFACE | SDL_ANYFORMAT );
00058
00059 if( !SDL_VideoModeOK( scrW , scrH , 32 , SDL_FULLSCREEN | SDL_HWSURFACE | SDL_ANYFORMAT ) )
00060 {
00061 Ars::ArsApplication::scrW = scr[0]->h;
00062 Ars::ArsApplication::scrH = scr[0]->w;
00063 }
00064
00065 h.SetCfgInt( "SetupScreen" , "PlayIntro" , 1 );
00066 h.SetCfgInt( "SetupScreen" , "ScreenW" , scrW );
00067 h.SetCfgInt( "SetupScreen" , "ScreenH" , scrH );
00068 h.SetCfgString( "SetupScreen" , "ScreenTitle" , "BorQueror" );
00069
00070 h.SetCfgFile( "Paths" , "Fonts" , "./data/fonts/Fonts.cfg" );
00071 h.SetCfgFile( "Paths" , "Dlg-1024x768" , "./data/dlg-1024x768.cfg" );
00072 h.SetCfgFile( "Paths" , "Dlg-1280x1024" , "./data/dlg-1280x1024.cfg" );
00073 h.SetCfgFile( "Paths" , "Images" , "./data/Images/Images.cfg" );
00074 h.SetCfgFile( "Paths" , "Animate" , "./data/Animate/Animate.cfg" );
00075 h.SetCfgFile( "Paths" , "Sounds" , "./data/Sounds/Sounds.cfg" );
00076 h.SetCfgFile( "Paths" , "Saves" , "./data/saves/" );
00077 h.SetCfgFile( "Paths" , "AI" , "./data/AI/AI.cfg" );
00078 h.SetCfgFile( "Paths" , "Generator" , "./data/AI/generator.cfg" );
00079 h.SetCfgFile( "Paths" , "PlanetInfo" , "./data/AI/PlanetInfo.cfg" );
00080 h.SetCfgFile( "Paths" , "GenStars" , "./data/AI/genstars.cfg" );
00081 h.SetCfgFile( "Paths" , "GenPlanets" , "./data/AI/genplanets.cfg" );
00082 h.SetCfgFile( "Paths" , "Colony" , "./data/AI/colony.cfg" );
00083 h.SetCfgFile( "Paths" , "General" , "./data/AI/General.cfg" );
00084 h.SetCfgFile( "Paths" , "lcars" , "./data/lcars/lcars.cfg" );
00085
00086 h.Flush();
00087 }
00088
00089 void Borqueror::Init( void )
00090 {
00091 ArsApplication::Init();
00092
00093 Cfg::Handler &h = Cfg::GetCfg();
00094 frame = new MainGame( XRect( 0 , 0 , h.GetCfgInt( "SetupScreen" , "ScreenW" ) , h.GetCfgInt( "SetupScreen" , "ScreenH" ) ) ,
00095 h.GetCfgString( "SetupScreen" , "ScreenTitle" ) );
00096 }
00097
00098