]> git.tdb.fi Git - r2c2.git/blob - source/designer/terraintool.h
Don't crash if a train has no router
[r2c2.git] / source / designer / terraintool.h
1 #ifndef TERRAINTOOL_H_
2 #define TERRAINTOOL_H_
3
4 #include <msp/gl/mesh.h>
5 #include <msp/gl/renderable.h>
6 #include "libr2c2/terrain.h"
7 #include "tool.h"
8
9 class TerrainTool: public Tool, public Msp::GL::Renderable
10 {
11 private:
12         R2C2::Terrain &terrain;
13         Msp::GL::Mesh marker;
14         R2C2::Terrain::NodeCoordinates highlight_node;
15         unsigned edit_size;
16         R2C2::Vector marker_position;
17         unsigned marker_orientation;
18         bool dragging;
19         float drag_start;
20
21 public:
22         TerrainTool(Designer &, Msp::Input::Keyboard &, Msp::Input::Mouse &, R2C2::Terrain &);
23         virtual ~TerrainTool();
24
25 private:
26         void update_marker();
27
28         virtual void key_press(unsigned);
29         virtual void key_release(unsigned);
30         virtual void button_press(unsigned);
31         virtual void button_release(unsigned);
32         virtual void pointer_motion();
33
34 public:
35         virtual void render(Msp::GL::Renderer &, const Msp::GL::Tag &) const;
36 };
37
38 #endif