editor_main.cpp

Go to the documentation of this file.
00001 
00002 //            Copyright (C) 2004-2007 by The Allacrost Project
00003 //                         All Rights Reserved
00004 //
00005 // This code is licensed under the GNU GPL version 2. It is free software 
00006 // and you may modify it and/or redistribute it under the terms of this license.
00007 // See http://www.gnu.org/copyleft/gpl.html for details.
00009 
00010 /*!****************************************************************************
00011  * \file    editor_main.cpp
00012  * \author  Philip Vorsilak, gorzuate@allacrost.org
00013  * \brief   Source file for editor's main() function: from here the editor is
00014  *          started and exited.
00015  *****************************************************************************/
00016 
00017 #ifdef __MACH__
00018   #include <unistd.h>
00019   #include <string>
00020 #endif
00021 
00022 #include "editor.h"
00023 
00024 using namespace std;
00025 using namespace hoa_editor;
00026 
00027 int main(int argc, char **argv)
00028 {
00029 #ifndef _WIN32
00030 #ifndef __MACH__
00031   // Look for data files in DATADIR only if they are not available in the
00032   // current directory.
00033   if (ifstream("./dat/config/settings.lua") == NULL)
00034     chdir(DATADIR);
00035 #endif
00036 #endif
00037 
00038 #ifdef __MACH__
00039   string path;
00040   path = argv[0];
00041   // remove the binary name
00042   path.erase(path.find_last_of('/'));
00043   // remove the MacOS directory
00044   path.erase(path.find_last_of('/'));
00045   // we are now in app/Contents
00046   path.append ( "/Resources/" );
00047   chdir ( path.c_str() );
00048 #endif
00049 
00050   QApplication app(argc, argv);
00051   Editor* editor = new Editor();
00052   editor->setCaption("Hero of Allacrost Level Editor");
00053   hoa_script::ScriptManager = hoa_script::GameScript::SingletonCreate();
00054   hoa_script::ScriptManager->SingletonInitialize();
00055   app.setMainWidget(editor);
00056   editor->show();
00057   return app.exec();
00058 }

Generated on Fri Jul 6 23:11:13 2007 for Hero of Allacrost by  doxygen 1.5.1