X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fengineer%2Fengineer.cpp;h=b0296a192d6cbb175b9fd8c3c03e078c14425201;hb=8b7d4054b05002d82338775ac9b4ee764a8560e4;hp=ba92933430ee013690ae1164b7da977c644cd640;hpb=5c45baac3643a3c7ade8ab0dbaa97dfa55b5117d;p=r2c2.git diff --git a/source/engineer/engineer.cpp b/source/engineer/engineer.cpp index ba92933..b0296a1 100644 --- a/source/engineer/engineer.cpp +++ b/source/engineer/engineer.cpp @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include @@ -53,8 +52,8 @@ Engineer::Engineer(int argc, char **argv): window.signal_close.connect(sigc::bind(sigc::mem_fun(this, &Engineer::exit), 0)); root = new GLtk::Root(ui_res, window); - mouse.signal_button_press.connect(sigc::mem_fun(this, &Engineer::button_press)); - mouse.signal_axis_motion.connect(sigc::mem_fun(this, &Engineer::axis_motion)); + mouse.signal_button_press.connect(sigc::bind_return(sigc::mem_fun(this, &Engineer::button_press), false)); + mouse.signal_axis_motion.connect(sigc::bind_return(sigc::mem_fun(this, &Engineer::axis_motion), false)); root->set_visible(true); main_panel = new MainPanel(*this); @@ -231,11 +230,10 @@ void Engineer::tick() camera.apply(); GL::MatrixStack::Push push_mat(GL::MatrixStack::modelview()); - float rot = picking_track->get_endpoint_direction(picking_entry); - Vector pos = picking_track->get_endpoint_position(picking_entry); + Snap sn = picking_track->get_snap_node(picking_entry); - GL::MatrixStack::modelview() *= GL::Matrix::translation(pos.x, pos.y, pos.z+0.03); - GL::MatrixStack::modelview() *= GL::Matrix::rotation(rot+M_PI, 0, 0, 1); + GL::MatrixStack::modelview() *= GL::Matrix::translation(sn.position.x, sn.position.y, sn.position.z+0.03); + GL::MatrixStack::modelview() *= GL::Matrix::rotation(sn.rotation+M_PI, 0, 0, 1); arrow_mesh.draw(); } @@ -417,9 +415,10 @@ void Engineer::train_added(Train &train) for(unsigned i=0; i<10; ++i) { GL::Color color; - color.r = rand()*1.0/RAND_MAX; - color.g = rand()*1.0/RAND_MAX; - color.b = rand()*1.0/RAND_MAX; + unsigned h = rand()%3; + color.r = (h==0 ? 0.0 : rand()*1.0/RAND_MAX); + color.g = (h==1 ? 0.0 : rand()*1.0/RAND_MAX); + color.b = (h==2 ? 0.0 : rand()*1.0/RAND_MAX); color = color*(1/max(max(color.r, color.g), color.b)); float min_d_sq = 3; for(map::const_iterator j=train_colors.begin(); j!=train_colors.end(); ++j)