Main Page | Namespace List | Class List | File List | Namespace Members | Class Members | File Members

source/hack4u.cc

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2004 emuWorks
00003  * http://games.technoplaza.net/
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018  */
00019 
00020 // $Id: hack4u.cc,v 1.7 2004/12/05 02:59:28 technoplaza Exp $
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 // static variable initialization
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 

Generated on Sat Dec 4 23:06:36 2004 for hack4u by  doxygen 1.3.9.1