goat3d

view goatview/src/main.cc @ 92:ae6c5941faac

[goatview] makefile rules to create app bundle and dmg archive [goatview] creating multisampling context
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 18 May 2014 01:19:10 +0300
parents 9785847d52d4
children 21319e71117f
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");
12 GoatView gview;
14 QCommandLineParser argparse;
15 argparse.addHelpOption();
17 argparse.addPositionalArgument("scene", "scene file to open");
18 argparse.addOption(QCommandLineOption("a", "add animation file"));
19 argparse.process(app);
21 const QStringList &args = argparse.positionalArguments();
22 if(!args.isEmpty()) {
23 if(args.count() > 1) {
24 fprintf(stderr, "please specify at most one scene file to open\n");
25 return 1;
26 }
27 std::string fname = args.at(0).toStdString();
28 printf("loading scene file: %s ...\n", fname.c_str());
29 if(!gview.load_scene(fname.c_str())) {
30 fprintf(stderr, "failed to load scene: %s\n", fname.c_str());
31 return 1;
32 }
33 }
35 const QStringList &anims = argparse.values("a");
36 QStringList::const_iterator it = anims.begin();
37 while(it != anims.end()) {
38 std::string fname = it++->toStdString();
39 printf("loading animation file: %s ...\n", fname.c_str());
41 if(goat3d_load_anim(scene, fname.c_str()) == -1) {
42 fprintf(stderr, "failed to load animation: %s\n", fname.c_str());
43 return 1;
44 }
45 }
47 gview.show();
49 return app.exec();
50 }