00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
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