33 const char *
USAGE =
"USAGE: stage [options] <worldfile1> [worldfile2 ... worldfileN]\n" 34 "Available [options] are:\n" 35 " --clock : print simulation time peridically on standard output\n" 36 " -c : equivalent to --clock\n" 37 " --gui : run without a GUI\n" 38 " -g : equivalent to --gui\n" 39 " --help : print this message\n" 40 " --args \"str\" : define an argument string to be passed to all " 42 " -a \"str\" : equivalent to --args \"str\"\n" 43 " -h : equivalent to --help\n" 44 " -? : equivalent to --help";
49 {
"gui", optional_argument, NULL,
'g' },
50 {
"clock", optional_argument, NULL,
'c' },
51 {
"help", optional_argument, NULL,
'h' },
52 {
"args", required_argument, NULL,
'a' },
61 printf(
"%s %s ", PROJECT, VERSION);
63 int ch = 0, optindex = 0;
65 bool showclock =
false;
67 while ((ch = getopt_long(argc, argv,
"cgh?",
longopts, &optindex)) != -1) {
70 printf(
"option %s given\n",
longopts[optindex].name);
75 printf(
"[Clock enabled]");
79 printf(
"[GUI disabled]");
87 printf(
"unhandled option %c\n", ch);
99 while (optindex < argc) {
101 const char *worldfilename = argv[optindex];
102 World *world = (usegui ?
new WorldGui(400, 300, worldfilename) :
new World(worldfilename));
103 world->
Load(worldfilename);
114 puts(
"\n[Stage: done]");
The Stage library uses its own namespace.
void Init(int *argc, char **argv[])
static struct option longopts[]
virtual bool Load(const std::string &worldfile_path)
int main(int argc, char *argv[])
bool paused
if true, the simulation is stopped
void ShowClock(bool enable)
Control printing time to stdout.
static std::string ctrlargs