{
Layout &layout = *designer.get_layout();
Route *route = new Route(layout, format("Route %d", layout.get_routes().size()+1));
- designer.get_layout()->add_route(*route);
designer.edit_route(*route);
const map<string, Route *> &routes = designer.get_layout()->get_routes();
picking(false),
picking_track(0),
picking_entry(0),
- picking_path(0)
+ picking_path(0),
+ pointer_x(0),
+ pointer_y(0),
+ pointer_moved(false)
{
// Setup GUI
window.set_title("Railroad Engineer");
overlay->render(0);
}
+ if(pointer_moved)
+ {
+ pointer_moved = false;
+
+ if(picking)
+ {
+ Track3D *track = pick_track(pointer_x, window.get_height()-pointer_y-1);
+ if(track && &track->get_track()!=picking_track)
+ {
+ picking_track = &track->get_track();
+ if(picking_entry>=0)
+ picking_entry = 0;
+
+ delete picking_path;
+ picking_path = new Path3D(*track);
+ if(picking_entry>=0)
+ picking_path->set_mask(picking_track->get_type().get_endpoints()[picking_entry].paths);
+ else
+ picking_path->set_mask(picking_track->get_type().get_paths());
+ picking_path->set_color(GL::Color(0));
+ picking_path->set_layer(1);
+ }
+ }
+ }
+
if(picking && picking_track && picking_entry>=0)
{
GL::PushMatrix push_mat;
void Engineer::pointer_motion(int x, int y)
{
- if(picking)
- {
- Track3D *track = pick_track(x, window.get_height()-y-1);
- if(track && &track->get_track()!=picking_track)
- {
- picking_track = &track->get_track();
- if(picking_entry>=0)
- picking_entry = 0;
-
- delete picking_path;
- picking_path = new Path3D(*track);
- if(picking_entry>=0)
- picking_path->set_mask(picking_track->get_type().get_endpoints()[picking_entry].paths);
- else
- picking_path->set_mask(picking_track->get_type().get_paths());
- picking_path->set_color(GL::Color(0));
- picking_path->set_layer(1);
- }
- }
+ pointer_x = x;
+ pointer_y = y;
+ pointer_moved = true;
}
void Engineer::view_all()