goat3d
view goatview/src/main.cc @ 81:7458b8568463
forgot to add opengl.h/c
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Thu, 08 May 2014 23:05:29 +0300 |
parents | 76dea247f75c |
children | 70b7c41a4f17 |
line source
1 #include <QtWidgets/QtWidgets>
2 #include <QtCore/QtCore>
3 #include "goatview.h"
5 int main(int argc, char **argv)
6 {
7 QApplication app(argc, argv);
8 app.setOrganizationName("Mutant Stargoat");
9 app.setOrganizationDomain("mutantstargoat.com");
10 app.setApplicationName("GoatView");
11 settings = new QSettings;
13 QCommandLineParser argparse;
14 argparse.addHelpOption();
16 argparse.addPositionalArgument("scene", "scene file to open");
17 argparse.addOption(QCommandLineOption("a", "add animation file"));
18 argparse.process(app);
20 const QStringList &args = argparse.positionalArguments();
21 if(!args.isEmpty()) {
22 if(args.count() > 1) {
23 fprintf(stderr, "please specify at most one scene file to open\n");
24 return 1;
25 }
26 std::string fname = args.at(0).toStdString();
27 printf("loading scene file: %s ...\n", fname.c_str());
28 if(!load_scene(fname.c_str())) {
29 fprintf(stderr, "failed to load scene: %s\n", fname.c_str());
30 return 1;
31 }
32 }
34 const QStringList &anims = argparse.values("a");
35 QStringList::const_iterator it = anims.begin();
36 while(it != anims.end()) {
37 std::string fname = it++->toStdString();
38 printf("loading animation file: %s ...\n", fname.c_str());
40 if(goat3d_load_anim(scene, fname.c_str()) == -1) {
41 fprintf(stderr, "failed to load animation: %s\n", fname.c_str());
42 return 1;
43 }
44 }
46 GoatView gview;
47 gview.show();
49 return app.exec();
50 }