From c06255abffcaaf77d067bdcf4e2cb86861848c88 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Tue, 20 Jan 2009 21:39:44 +0000 Subject: [PATCH] added main/Scene module; updated main/fart.cc to use getopt_long() git-svn-id: svn://anubis/fart/trunk@19 7f9b0f55-74a9-4bce-be96-3c2cd072584d --- main/Scene.cc | 0 main/Scene.h | 10 ++++++++++ main/fart.cc | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+) create mode 100644 main/Scene.cc create mode 100755 main/Scene.h diff --git a/main/Scene.cc b/main/Scene.cc new file mode 100644 index 0000000..e69de29 diff --git a/main/Scene.h b/main/Scene.h new file mode 100755 index 0000000..c25e9d0 --- /dev/null +++ b/main/Scene.h @@ -0,0 +1,10 @@ + +#ifndef SCENE_H +#define SCENE_H SCENE_H + +class Scene +{ +}; + +#endif + diff --git a/main/fart.cc b/main/fart.cc index bc98d61..66804fc 100644 --- a/main/fart.cc +++ b/main/fart.cc @@ -1,8 +1,56 @@ #include +#include +#include +#include +#include using namespace std; +void usage(const char * progname) +{ + cout << "Usage: " << progname << " [options] " << endl; + cout << " Options:" << endl; + cout << " -w|--width " << endl; + cout << " -h|--height " << endl; + cout << " -m|--multisample " << endl; + exit(42); +} + int main(int argc, char * argv[]) { + int opt; + int option_index; + + static const struct option long_options[] = { + { "width", required_argument, NULL, 'w' }, + { "height", required_argument, NULL, 'h' }, + { "multisample", required_argument, NULL, 'm' }, + { NULL, 0, NULL, 0 } + }; + + while ((opt = getopt_long(argc, argv, "w:h:m:", + long_options, &option_index)) != -1) + { + switch (opt) + { + case 'w': + cout << "width: " << optarg << endl; + break; + case 'h': + cout << "height: " << optarg << endl; + break; + case 'm': + cout << "multisample level: " << optarg << endl; + break; + default: + usage(argv[0]); + } + } + + if (optind >= argc) + { + usage(argv[0]); + } + cout << "hi" << endl; }