Moka Ihm Qt
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
main.cc
Go to the documentation of this file.
1 /*
2  * Moka : Un modeleur de 3-G-cartes.
3  * Copyright (C) 2004, Moka Team, Université de Poitiers, Laboratoire SIC
4  * http://www.sic.sp2mi.univ-poitiers.fr/
5  * Copyright (C) 2009, Guillaume Damiand, CNRS, LIRIS,
6  * guillaume.damiand@liris.cnrs.fr, http://liris.cnrs.fr/
7  *
8  * This file is part of Moka
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  */
23 
24 //******************************************************************************
25 #include <QtGui/QApplication>
26 #include "window.qt.hh"
27 #include <cstring>
28 
29 #ifdef MODULE_SPAMOD
30 #ifdef _WINDOWS
31 #include <windows.h>
32 #endif
33 
34 #ifdef __APPLE__
35 #include <GLUT/glut.h>
36 #else
37 #include <GL/glut.h>
38 #endif
39 
40 #endif // MODULE_SPAMOD
41 
42 //******************************************************************************
43 int main(int argc, char** argv)
44 {
45  Q_INIT_RESOURCE(icones);
46 
47 #ifdef MODULE_SPAMOD
48  glutInit(&argc, argv);
49 #endif // MODULE_SPAMOD
50 
51  // glutInitDisplayMode(AUX_SINGLE | AUX_RGBA | AUX_DEPTH);
52 
53  QApplication appli(argc, argv);
54  Window moka;
55 
56  bool fullscreen = false;
57  bool help = false;
58 
59  for ( int i=1; i<argc; ++i )
60  {
61  if ( !strcmp(argv[i],"-fullscreen" ) )
62  fullscreen=true;
63  else if ( !strcmp( argv [ i ] , "-?") || !strcmp( argv [ i ] , "-h") )
64  help = true;
65  else if ( !strcmp( argv [ i ] , "-i") )
66  {
67  if (i+1==argc) help=true;
68  else moka.getControler()->importOff(argv[++i]);
69  }
70  else moka.getControler()->addMap(argv [ i ]);
71  }
72 
73  if (help)
74  {
75  std::cout<<"Usage : mokaQt [-h -?] [-fullscreen] [-i offfile1] ... [-i offfilek] "
76  "[mokafile1 ... mokafilek]"<<std::endl
77  <<" -h -?: help command."<<std::endl
78  <<" -fullscreen: put moka in fullscreen mode."<<std::endl
79  <<" -i offfilei: import off file."<<std::endl
80  <<" mokafilei: load moka file."<<std::endl;
81  exit(EXIT_FAILURE);
82  }
83 
84  if ( fullscreen ) moka . showFullScreen ( ) ;
85  else moka.show();
86 
87  return appli.exec();
88 }
89 //******************************************************************************