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 "hack4u.hh"
00036 #include "view/MainFrame.hh"
00037
00038 using namespace hack4u;
00039
00040
00041 const wxString *Hack4u::APP_NAME =
00042 new wxString(wxT(PACKAGE_NAME));
00043
00044 const wxString *Hack4u::APP_VERSION =
00045 new wxString(wxT(PACKAGE_VERSION));
00046
00047 const wxString *Hack4u::APP_COPYRIGHT =
00048 new wxString(wxT("Copyright (C) 2004 emuWorks"));
00049
00050 const wxString *Hack4u::APP_URL =
00051 new wxString(wxT("http://games.technoplaza.net/"));
00052
00053 IMPLEMENT_APP(Hack4u)
00054 IMPLEMENT_CLASS(Hack4u, wxApp)
00055
00056 bool Hack4u::OnInit() {
00057 wxString *xrcfile;
00058
00059 if (argc == 2) {
00060 xrcfile = new wxString(argv[1]);
00061 } else {
00062 xrcfile = new wxString(XRC_FILE);
00063 }
00064
00065 struct stat xrcstats;
00066
00067 if (stat(xrcfile->mb_str(), &xrcstats) != 0) {
00068 std::cerr << "error: unable to locate XRC file " <<
00069 xrcfile->mb_str() << std::endl;
00070 return false;
00071 }
00072
00073 wxXmlResource::Get()->InitAllHandlers();
00074 wxXmlResource::Get()->Load(*xrcfile);
00075
00076 MainFrame *frame = new MainFrame;
00077 frame->SetTitle(*APP_NAME + wxT(' ') + *APP_VERSION);
00078 frame->Show(true);
00079 SetTopWindow(frame);
00080
00081 return true;
00082 }
00083