- string res;
- bool debug=false;
- string device="/dev/ttyS0";
- unsigned quality=4;
-
- GetOpt getopt;
- getopt.add_option('r', "resolution", res, GetOpt::REQUIRED_ARG);
- getopt.add_option('f', "fullscreen", fullscreen, GetOpt::NO_ARG);
- getopt.add_option('g', "debug", debug, GetOpt::NO_ARG);
- getopt.add_option('d', "device", device, GetOpt::REQUIRED_ARG);
- getopt.add_option('q', "quality", quality, GetOpt::REQUIRED_ARG);
- getopt.add_option('s', "simulate", simulate, GetOpt::NO_ARG);
- getopt.add_option( "no-lighting", no_lighting, GetOpt::NO_ARG);
- getopt(argc, argv);
-
- if(!res.empty())
+ // Setup GUI
+ window.set_title("Railroad Engineer");
+ window.signal_close.connect(sigc::bind(sigc::mem_fun(this, &Engineer::exit), 0));
+
+ DataFile::load(ui_res, "r2c2.res");
+ root = new GLtk::Root(ui_res, window);
+ root->signal_button_press.connect(sigc::mem_fun(this, &Engineer::button_press));
+ root->signal_pointer_motion.connect(sigc::mem_fun(this, &Engineer::pointer_motion));
+ root->set_visible(true);
+
+ main_panel = new MainPanel(*this);
+ root->add(*main_panel);
+ main_panel->set_position(0, window.get_height()-main_panel->get_geometry().h);
+ main_panel->set_visible(true);
+
+ overlay = new Overlay3D(ui_res.get_default_font());
+
+ // Setup railroad control
+ DataFile::load(catalogue, "tracks.dat");
+ DataFile::load(catalogue, "locos.dat");
+ DataFile::load(catalogue, "wagons.dat");
+ DataFile::load(layout, options.layout_fn);
+
+ layout.signal_train_added.connect(sigc::mem_fun(this, &Engineer::train_added));
+ layout.signal_block_reserved.connect(sigc::hide<1>(sigc::mem_fun(this, &Engineer::reset_block_color)));
+ layout.signal_block_state_changed.connect(sigc::hide<1>(sigc::mem_fun(this, &Engineer::reset_block_color)));
+ layout.signal_emergency.connect(sigc::mem_fun(this, &Engineer::set_status));
+
+ if(FS::exists(options.state_fn))
+ DataFile::load(layout, options.state_fn);
+
+ if(options.network)