main.cc

Go to the documentation of this file.
00001 /* Eliot                                                                     */
00002 /* Copyright (C) 1999  Antoine Fraboulet                                     */
00003 /* Antoine.Fraboulet@free.fr                                                 */
00004 /*                                                                           */
00005 /* This program is free software; you can redistribute it and/or modify      */
00006 /* it under the terms of the GNU General Public License as published by      */
00007 /* the Free Software Foundation; either version 2 of the License, or         */
00008 /* (at your option) any later version.                                       */
00009 /*                                                                           */
00010 /* This program is distributed in the hope that it will be useful,           */
00011 /* but WITHOUT ANY WARRANTY; without even the implied warranty of            */
00012 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             */
00013 /* GNU General Public License for more details.                              */
00014 /*                                                                           */
00015 /* You should have received a copy of the GNU General Public License         */
00016 /* along with this program; if not, write to the Free Software               */
00017 /* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
00018 
00019 #ifdef WIN32 // mingw32 hack
00020 #   undef Yield
00021 #   undef CreateDialog
00022 #endif
00023 
00024 #include <stdlib.h>
00025 #include <time.h>
00026 #include <wx/wxprec.h>
00027 #include <wx/wx.h>
00028 #include <wx/app.h>
00029 #include <wx/intl.h>
00030 
00031 #include "ewx.h"
00032 #include "configdb.h"
00033 #include "mainframe.h"
00034 #include "game_factory.h"
00035 
00036 #include "eliot.xpm"
00037 
00038 class EliotApp : public wxApp
00039 {
00040 private:
00041 protected:
00042 #ifdef ENABLE_LOCALE
00043   wxLocale locale;
00044 #endif
00045 public:
00046   virtual bool OnInit();
00047   virtual int  OnExit();
00048 };
00049 
00050 IMPLEMENT_APP(EliotApp)
00051 
00052 bool
00053 EliotApp::OnInit()
00054 {
00055     srand(time(NULL));
00056     SetVendorName(wxT("Afrab"));
00057     SetAppName(wxString(wxT("eliot")) + wxT("-") + wxT(VERSION));
00058     SetClassName(wxT("eliot"));
00059 
00060     wxConfigBase* config = wxConfigBase::Get();
00061     config = NULL;
00062 #ifdef ENABLE_LOCALE
00063     locale.Init(wxLocale::GetSystemLanguage(),
00064                 wxLOCALE_LOAD_DEFAULT | wxLOCALE_CONV_ENCODING);
00065 #endif
00066     ConfigDB configdb;
00067     configdb.setFirstDefault();
00068     MainFrame *mainframe = new MainFrame(configdb.getFramePos(wxT(APPNAME)),
00069                                          configdb.getFrameSize(wxT(APPNAME)));
00070     mainframe->SetIcon(wxICON(eliot));
00071     mainframe->Show(TRUE);
00072     SetTopWindow(mainframe);
00073     return TRUE;
00074 }
00075 
00076 int
00077 EliotApp::OnExit()
00078 {
00079     GameFactory::Destroy();
00080     delete wxConfigBase::Set((wxConfigBase *) NULL);
00081     return 0;
00082 }
00083 
00084 

Generated on Thu Dec 29 02:01:15 2005 for Eliot by  doxygen 1.4.5