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
This commit is contained in:
Josh Holtrop 2009-01-20 21:39:44 +00:00
parent 0c8597f31b
commit c06255abff
3 changed files with 58 additions and 0 deletions

0
main/Scene.cc Normal file
View File

10
main/Scene.h Executable file
View File

@ -0,0 +1,10 @@
#ifndef SCENE_H
#define SCENE_H SCENE_H
class Scene
{
};
#endif

View File

@ -1,8 +1,56 @@
#include <iostream> #include <iostream>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <getopt.h>
using namespace std; using namespace std;
void usage(const char * progname)
{
cout << "Usage: " << progname << " [options] <scene-file>" << endl;
cout << " Options:" << endl;
cout << " -w|--width <image-width>" << endl;
cout << " -h|--height <image-height>" << endl;
cout << " -m|--multisample <level>" << endl;
exit(42);
}
int main(int argc, char * argv[]) 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; cout << "hi" << endl;
} }