[2581] | 1 | /* |
---|
| 2 | orxonox - the future of 3D-vertical-scrollers |
---|
| 3 | |
---|
| 4 | Copyright (C) 2004 orx |
---|
| 5 | |
---|
| 6 | This program is free software; you can redistribute it and/or modify |
---|
| 7 | it under the terms of the GNU General Public License as published by |
---|
| 8 | the Free Software Foundation; either version 2, or (at your option) |
---|
| 9 | any later version. |
---|
| 10 | |
---|
| 11 | This program is distributed in the hope that it will be useful, |
---|
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 14 | GNU General Public License for more details. |
---|
| 15 | |
---|
| 16 | You should have received a copy of the GNU General Public License |
---|
| 17 | along with this program; if not, write to the Free Software Foundation, |
---|
| 18 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
| 19 | |
---|
| 20 | |
---|
| 21 | ### File Specific: |
---|
| 22 | main-programmer: Benjamin Grauer |
---|
| 23 | |
---|
| 24 | */ |
---|
[3166] | 25 | |
---|
[2018] | 26 | #include "orxonox_gui.h" |
---|
| 27 | #include "orxonox_gui_video.h" |
---|
| 28 | #include "orxonox_gui_audio.h" |
---|
| 29 | #include "orxonox_gui_exec.h" |
---|
| 30 | #include "orxonox_gui_flags.h" |
---|
[2580] | 31 | #include "orxonox_gui_banner.h" |
---|
[2613] | 32 | #include "orxonox_gui_keys.h" |
---|
[3251] | 33 | #include "orxonox_gui_update.h" |
---|
[2018] | 34 | |
---|
| 35 | Window* orxonoxGUI; |
---|
| 36 | OrxonoxGuiVideo* video; |
---|
| 37 | OrxonoxGuiAudio* audio; |
---|
| 38 | OrxonoxGuiExec* exec; |
---|
[2580] | 39 | OrxonoxGuiFlags* flags; |
---|
| 40 | OrxonoxGuiBanner* banner; |
---|
[2613] | 41 | OrxonoxGuiKeys* keys; |
---|
[3251] | 42 | OrxonoxGuiUpdate* update; |
---|
[2018] | 43 | |
---|
| 44 | int main( int argc, char *argv[] ) |
---|
| 45 | { |
---|
| 46 | OrxonoxGui* orxonoxgui = new OrxonoxGui(argc, argv); |
---|
| 47 | return 0; |
---|
| 48 | } |
---|
| 49 | |
---|
| 50 | /* ORXONOXGUI */ |
---|
| 51 | |
---|
[2588] | 52 | /** |
---|
[2623] | 53 | \brief Initializes the Gui |
---|
[2588] | 54 | */ |
---|
[2018] | 55 | OrxonoxGui::OrxonoxGui (int argc, char *argv[]) |
---|
| 56 | { |
---|
[3165] | 57 | #ifdef HAVE_GTK2 |
---|
[3164] | 58 | initGTK(argc, argv); |
---|
[3167] | 59 | #endif /* HAVE_GTK2 */ |
---|
[2740] | 60 | orxonoxGUI = new Window( "Grafical OrxOnoX loader, "PACKAGE_VERSION); |
---|
[3165] | 61 | #ifdef HAVE_GTK2 |
---|
[2018] | 62 | orxonoxGUI->connectSignal ("destroy", orxonoxGUI->orxonox_gui_quit); |
---|
| 63 | orxonoxGUI->connectSignal ("delete_event", orxonoxGUI->orxonox_gui_quit); |
---|
[3165] | 64 | #endif /* HAVE_GTK2 */ |
---|
[2018] | 65 | |
---|
[2024] | 66 | Box* windowBox = new Box ('h'); |
---|
| 67 | |
---|
[2580] | 68 | banner = new OrxonoxGuiBanner(); |
---|
[2595] | 69 | windowBox->fill (banner->getWidget()); |
---|
[2580] | 70 | |
---|
[2024] | 71 | Box* optionBox = new Box ('v'); |
---|
[2018] | 72 | |
---|
| 73 | Box* avBox = new Box ('h'); |
---|
| 74 | |
---|
| 75 | video = new OrxonoxGuiVideo (); |
---|
[2595] | 76 | avBox->fill (video->getWidget ()); |
---|
[2018] | 77 | audio = new OrxonoxGuiAudio (); |
---|
[2595] | 78 | avBox->fill (audio->getWidget ()); |
---|
[2018] | 79 | |
---|
[2024] | 80 | optionBox->fill (avBox); |
---|
[2613] | 81 | |
---|
| 82 | keys = new OrxonoxGuiKeys (); |
---|
| 83 | optionBox->fill (keys->getWidget ()); |
---|
| 84 | |
---|
[2018] | 85 | exec = new OrxonoxGuiExec (orxonoxGUI); |
---|
[2595] | 86 | optionBox->fill (exec->getWidget ()); |
---|
[2018] | 87 | |
---|
| 88 | flags = new OrxonoxGuiFlags (orxonoxGUI); |
---|
[2024] | 89 | |
---|
[2595] | 90 | optionBox->fill (flags->getWidget ()); |
---|
[2024] | 91 | windowBox->fill (optionBox); |
---|
[3251] | 92 | |
---|
| 93 | update = new OrxonoxGuiUpdate (); |
---|
[3252] | 94 | optionBox->fill(update->getWidget()); |
---|
[2018] | 95 | |
---|
| 96 | orxonoxGUI->fill (windowBox); |
---|
| 97 | flags->setTextFromFlags (orxonoxGUI); |
---|
| 98 | |
---|
| 99 | exec->setFilename ("~/.orxonox.conf"); |
---|
| 100 | exec->readFromFile (orxonoxGUI); |
---|
[3251] | 101 | |
---|
[3166] | 102 | // orxonoxGUI->walkThrough(orxonoxGUI->listOptions); |
---|
[2018] | 103 | |
---|
| 104 | orxonoxGUI->showall (); |
---|
| 105 | |
---|
| 106 | |
---|
[3165] | 107 | #ifdef HAVE_GTK2 |
---|
[3164] | 108 | mainloopGTK(); |
---|
[3166] | 109 | #else /* HAVE_GTK2 */ |
---|
| 110 | cout << " Listing all the Orxonox Options: \n"; |
---|
| 111 | cout << " #############################\n"; |
---|
| 112 | orxonoxGUI->walkThrough(orxonoxGUI->listOptions); |
---|
| 113 | |
---|
| 114 | cout << "\nDo you want me to save the the above values now? [Yn] "; |
---|
| 115 | char c = getchar(); |
---|
| 116 | if ((c == 'y' || c == 'Y' || c== 10) && exec->shouldsave()) |
---|
| 117 | exec->writeToFile (Window::mainWindow); |
---|
| 118 | |
---|
| 119 | #endif /* HAVE_GTK2 */ |
---|
| 120 | |
---|
[2018] | 121 | } |
---|