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

hack4u.cc

Go to the documentation of this file.
00001 /*
00002  * hack4u
00003  * Copyright (C) 2004-2005 emuWorks
00004  * http://games.technoplaza.net/
00005  *
00006  * This file is part of hack4u.
00007  *
00008  * hack4u is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * hack4u is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with hack4u; if not, write to the Free Software
00020  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00021  */
00022 
00023 // $Id: hack4u.cc,v 1.8 2005/08/03 11:11:39 technoplaza Exp $
00024  
00025 #ifdef HAVE_CONFIG_H
00026     #include <config.h>
00027 #endif
00028 
00029 #include <wx/wxprec.h>
00030 
00031 #ifndef WX_PRECOMP
00032    #include <wx/wx.h>
00033 #endif
00034 
00035 #include <iostream>
00036 #include <sys/stat.h>
00037 
00038 #include "hack4u.hh"
00039 #include "view/MainFrame.hh"
00040 
00041 using namespace hack4u;
00042 
00043 // static variable initialization
00044 const wxString *Hack4u::APP_NAME =
00045     new wxString(wxT(PACKAGE_NAME));
00046 
00047 const wxString *Hack4u::APP_VERSION =
00048     new wxString(wxT(PACKAGE_VERSION));
00049 
00050 const wxString *Hack4u::APP_COPYRIGHT =
00051     new wxString(wxT("Copyright (C) 2004-2005 emuWorks"));
00052 
00053 const wxString *Hack4u::APP_URL =
00054     new wxString(wxT("http://games.technoplaza.net/"));
00055 
00056 IMPLEMENT_APP(Hack4u)
00057 IMPLEMENT_CLASS(Hack4u, wxApp)
00058 
00059 bool Hack4u::OnInit() {
00060     wxString *xrcfile;
00061     
00062     if (argc == 2) {
00063         xrcfile = new wxString(argv[1]);
00064     } else {
00065         xrcfile = new wxString(XRC_FILE);
00066     }
00067     
00068     struct stat xrcstats;
00069     
00070     if (stat(xrcfile->mb_str(), &xrcstats) != 0) {
00071         std::cerr << "error: unable to locate XRC file " << 
00072             xrcfile->mb_str() << std::endl;
00073         return false;
00074     }
00075     
00076     wxXmlResource::Get()->InitAllHandlers();
00077     wxXmlResource::Get()->Load(*xrcfile);
00078     
00079     MainFrame *frame = new MainFrame;
00080     frame->SetTitle(*APP_NAME + wxT(' ') + *APP_VERSION);
00081     frame->Show(true);
00082     SetTopWindow(frame);
00083     
00084     return true;
00085 }
00086 

Generated on Wed Aug 3 20:38:52 2005 for hack4u by  doxygen 1.4.4