00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifdef HAVE_CONFIG_H
00023 #include <config.h>
00024 #endif
00025
00026 #include <wx/wxprec.h>
00027
00028 #ifndef WX_PRECOMP
00029 #include <wx/wx.h>
00030 #endif
00031
00032 #include <iostream>
00033 #include <sys/stat.h>
00034
00035 #include "GenApp.hh"
00036 #include "view/MainFrame.hh"
00037
00038 using namespace emuWorks;
00039
00040 const wxString *GenApp::APP_NAME =
00041 new wxString(wxT(PACKAGE_NAME));
00042
00043 const wxString *GenApp::APP_FULL_NAME =
00044 new wxString(wxT(PACKAGE_FULL_NAME));
00045
00046 const wxString *GenApp::APP_VERSION =
00047 new wxString(wxT(PACKAGE_VERSION));
00048
00049 const wxString *GenApp::APP_COPYRIGHT =
00050 new wxString(wxT("Copyright (C) 2004 emuWorks"));
00051
00052 const wxString *GenApp::APP_URL =
00053 new wxString(wxT("http://games.technoplaza.net/"));
00054
00055 IMPLEMENT_APP(GenApp)
00056 IMPLEMENT_CLASS(GenApp, wxApp)
00057
00058 bool GenApp::OnInit() {
00059 wxString *xrcfile;
00060
00061 if (argc == 2) {
00062 xrcfile = new wxString(argv[1]);
00063 } else {
00064 xrcfile = new wxString(XRC_FILE);
00065 }
00066
00067 struct stat xrcstats;
00068
00069 if (stat(xrcfile->mb_str(), &xrcstats) != 0) {
00070 std::cerr << "error: unable to locate XRC file " <<
00071 xrcfile->mb_str() << std::endl;
00072 return false;
00073 }
00074
00075 wxXmlResource::Get()->InitAllHandlers();
00076 wxXmlResource::Get()->Load(*xrcfile);
00077
00078 MainFrame *frame = new MainFrame;
00079 frame->SetTitle(*APP_FULL_NAME + wxT(' ') + *APP_VERSION);
00080 frame->Show(true);
00081 SetTopWindow(frame);
00082
00083 return true;
00084 }