34 "USAGE: stage [options] <worldfile1> [worldfile2 ... worldfileN]\n" 35 "Available [options] are:\n" 36 " --clock : print simulation time peridically on standard output\n" 37 " -c : equivalent to --clock\n" 38 " --gui : run without a GUI\n" 39 " -g : equivalent to --gui\n" 40 " --help : print this message\n" 41 " --args \"str\" : define an argument string to be passed to all controllers\n" 42 " -a \"str\" : equivalent to --args \"str\"\n" 43 " -h : equivalent to --help\n" 44 " -? : equivalent to --help";
48 {
"gui", optional_argument, NULL,
'g' },
49 {
"clock", optional_argument, NULL,
'c' },
50 {
"help", optional_argument, NULL,
'h' },
51 {
"args", required_argument, NULL,
'a' },
60 printf(
"%s %s ", PROJECT, VERSION );
64 bool showclock =
false;
66 while ((ch = getopt_long(argc, argv,
"cgh?",
longopts, &optindex)) != -1)
71 printf(
"option %s given\n",
longopts[optindex].name );
78 printf(
"[Clock enabled]" );
82 printf(
"[GUI disabled]" );
90 printf(
"unhandled option %c\n", ch );
102 while( optindex < argc )
106 const char* worldfilename = argv[optindex];
107 World* world = ( usegui ?
108 new WorldGui( 400, 300, worldfilename ) :
109 new World( worldfilename ) );
110 world->
Load( worldfilename );
121 puts(
"\n[Stage: done]" );
The Stage library uses its own namespace.
void Init(int *argc, char **argv[])
static struct option longopts[]
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
virtual void Load(const std::string &worldfile_path)