nuclear@73: #include nuclear@75: #include nuclear@73: #include "goatview.h" nuclear@73: nuclear@73: int main(int argc, char **argv) nuclear@73: { nuclear@73: QApplication app(argc, argv); nuclear@75: app.setOrganizationName("Mutant Stargoat"); nuclear@75: app.setOrganizationDomain("mutantstargoat.com"); nuclear@75: app.setApplicationName("GoatView"); nuclear@82: nuclear@82: GoatView gview; nuclear@75: nuclear@75: QCommandLineParser argparse; nuclear@75: argparse.addHelpOption(); nuclear@75: nuclear@75: argparse.addPositionalArgument("scene", "scene file to open"); nuclear@75: argparse.addOption(QCommandLineOption("a", "add animation file")); nuclear@75: argparse.process(app); nuclear@75: nuclear@75: const QStringList &args = argparse.positionalArguments(); nuclear@75: if(!args.isEmpty()) { nuclear@75: if(args.count() > 1) { nuclear@75: fprintf(stderr, "please specify at most one scene file to open\n"); nuclear@75: return 1; nuclear@75: } nuclear@75: std::string fname = args.at(0).toStdString(); nuclear@75: printf("loading scene file: %s ...\n", fname.c_str()); nuclear@82: if(!gview.load_scene(fname.c_str())) { nuclear@75: fprintf(stderr, "failed to load scene: %s\n", fname.c_str()); nuclear@75: return 1; nuclear@75: } nuclear@75: } nuclear@75: nuclear@75: const QStringList &anims = argparse.values("a"); nuclear@75: QStringList::const_iterator it = anims.begin(); nuclear@75: while(it != anims.end()) { nuclear@75: std::string fname = it++->toStdString(); nuclear@75: printf("loading animation file: %s ...\n", fname.c_str()); nuclear@75: nuclear@75: if(goat3d_load_anim(scene, fname.c_str()) == -1) { nuclear@75: fprintf(stderr, "failed to load animation: %s\n", fname.c_str()); nuclear@75: return 1; nuclear@75: } nuclear@75: } nuclear@73: nuclear@73: gview.show(); nuclear@73: nuclear@73: return app.exec(); nuclear@73: }