]> git.tdb.fi Git - r2c2.git/blob - source/engineer/trainview.h
Add a forward toggle to TrainView
[r2c2.git] / source / engineer / trainview.h
1 /* $Id$
2
3 This file is part of the MSP Märklin suite
4 Copyright © 2010  Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
6 */
7
8 #ifndef TRAINVIEW_H_
9 #define TRAINVIEW_H_
10
11 #include <msp/gl/renderbuffer.h>
12 #include <msp/gl/framebuffer.h>
13 #include <msp/gl/texture2d.h>
14 #include <msp/gltk/panel.h>
15 #include <msp/gltk/toggle.h>
16 #include "libmarklin/train.h"
17
18 class Engineer;
19
20 class TrainView: public Msp::GLtk::Panel
21 {
22 public:
23         enum Mode
24         {
25                 ROOF,
26                 SIDE,
27                 HEAD
28         };
29
30 private:
31         Engineer &engineer;
32         const Marklin::Train &train;
33         Msp::GLtk::Toggle *tgl_forward;
34         Mode mode;
35         bool forward;
36         Msp::GL::Framebuffer fbo;
37         Msp::GL::Texture2D tex;
38         Msp::GL::Renderbuffer depth;
39         Msp::GL::Camera camera;
40         Msp::GL::Pipeline pipeline;
41         bool stale;
42
43 public:
44         TrainView(Engineer &, const Marklin::Train &);
45         ~TrainView();
46
47         void set_mode(Mode);
48         void set_forward(bool);
49         void prepare();
50 private:
51         virtual void button_release(int, int, unsigned);
52         void close_clicked();
53 };
54
55 #endif