/* orxonox - the future of 3D-vertical-scrollers Copyright (C) 2004 orx This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ### File Specific: main-programmer: Benjamin Grauer */ #include #include "orxonox_gui.h" #include "orxonox_gui_video.h" #include "orxonox_gui_audio.h" #include "orxonox_gui_exec.h" #include "orxonox_gui_flags.h" #include "orxonox_gui_banner.h" #include "orxonox_gui_keys.h" #include "orxonox_gui_update.h" Window* orxonoxGUI; OrxonoxGuiVideo* video; OrxonoxGuiAudio* audio; OrxonoxGuiExec* exec; OrxonoxGuiFlags* flags; OrxonoxGuiBanner* banner; OrxonoxGuiKeys* keys; OrxonoxGuiUpdate* update; int verbose = 4; int main( int argc, char *argv[] ) { OrxonoxGui* orxonoxgui = new OrxonoxGui(argc, argv); return 0; } /* ORXONOXGUI */ /** \brief Initializes the Gui */ OrxonoxGui::OrxonoxGui (int argc, char *argv[]) { #ifdef HAVE_GTK2 initGTK(argc, argv); #endif /* HAVE_GTK2 */ orxonoxGUI = new Window( "Grafical OrxOnoX loader, "PACKAGE_VERSION); #ifdef HAVE_GTK2 orxonoxGUI->connectSignal ("destroy", orxonoxGUI->orxonox_gui_quit); orxonoxGUI->connectSignal ("delete_event", orxonoxGUI->orxonox_gui_quit); #endif /* HAVE_GTK2 */ Box* windowBox = new Box ('h'); banner = new OrxonoxGuiBanner(); windowBox->fill (banner->getWidget()); Box* optionBox = new Box ('v'); Box* avBox = new Box ('h'); video = new OrxonoxGuiVideo (); avBox->fill (video->getWidget ()); audio = new OrxonoxGuiAudio (); avBox->fill (audio->getWidget ()); optionBox->fill (avBox); keys = new OrxonoxGuiKeys (); optionBox->fill (keys->getWidget ()); exec = new OrxonoxGuiExec (orxonoxGUI); optionBox->fill (exec->getWidget ()); flags = new OrxonoxGuiFlags (orxonoxGUI); optionBox->fill (flags->getWidget ()); windowBox->fill (optionBox); update = new OrxonoxGuiUpdate (); optionBox->fill(update->getWidget()); orxonoxGUI->fill (windowBox); flags->setTextFromFlags (orxonoxGUI); // Reading Values from File exec->setFilename ("~/.orxonox.conf"); exec->readFromFile (orxonoxGUI); // Merging changes to the Options from appended flags. for (int optCount = 1; optCount < argc; optCount++) orxonoxGUI->walkThrough(Widget::flagCheck, argv[optCount], 0); orxonoxGUI->showall (); // Handling special Cases. if (!access(exec->getConfigFile(), F_OK) && static_cast(orxonoxGUI->findWidgetByName("Always Show this Menu", 0))->value == 0) OrxonoxGuiExec::startOrxonox(NULL, NULL); else { #ifdef HAVE_GTK2 mainloopGTK(); #else /* HAVE_GTK2 */ PRINT(0)(" Listing all the Orxonox Options: \n"); PRINT(0)(" #############################\n"); orxonoxGUI->walkThrough(orxonoxGUI->listOptions, 0); PRINT(0)("\nDo you want me to save the the above values now? [Yn] "); char c = getchar(); if ((c == 'y' || c == 'Y' || c== 10) && exec->shouldsave()) exec->writeToFile (Window::mainWindow); #endif /* HAVE_GTK2 */ } }