engineer(e),
train(t),
mode(SIDE),
+ forward(true),
pipeline(280, 280, false),
stale(false)
{
btn->set_geometry(GLtk::Geometry(82, 10, 36, 25));
btn->signal_clicked.connect(sigc::bind(sigc::mem_fun(this, &TrainView::set_mode), HEAD));
+ add(*(tgl_forward = new GLtk::Toggle(res, "Fwd")));
+ tgl_forward->set_geometry(GLtk::Geometry(118, 8, 36, 27));
+ tgl_forward->set_value(true);
+ tgl_forward->signal_toggled.connect(sigc::mem_fun(this, &TrainView::set_forward));
+
add(*(btn = new GLtk::Button(res, "Close")));
btn->set_geometry(GLtk::Geometry(geom.w-46, 10, 36, 25));
btn->signal_clicked.connect(sigc::mem_fun(this, &TrainView::close_clicked));
mode = m;
}
+void TrainView::set_forward(bool f)
+{
+ forward = f;
+}
+
void TrainView::prepare()
{
const Vehicle &veh = train.get_vehicle(0);
const Point &pos = veh.get_position();
float angle = veh.get_direction();
+ if(!forward)
+ angle += M_PI;
float c = cos(angle);
float s = sin(angle);
float l = veh.get_type().get_length();
#include <msp/gl/framebuffer.h>
#include <msp/gl/texture2d.h>
#include <msp/gltk/panel.h>
+#include <msp/gltk/toggle.h>
#include "libmarklin/train.h"
class Engineer;
private:
Engineer &engineer;
const Marklin::Train &train;
+ Msp::GLtk::Toggle *tgl_forward;
Mode mode;
+ bool forward;
Msp::GL::Framebuffer fbo;
Msp::GL::Texture2D tex;
Msp::GL::Renderbuffer depth;
~TrainView();
void set_mode(Mode);
+ void set_forward(bool);
void prepare();
private:
virtual void button_release(int, int, unsigned);