]> git.tdb.fi Git - r2c2.git/blob - source/engineer/engineer.h
Reflect the current state of functions in a newly opened train dialog
[r2c2.git] / source / engineer / engineer.h
1 #ifndef ENGINEER_H_
2 #define ENGINEER_H_
3
4 #include <msp/core/application.h>
5 #include <msp/graphics/simplewindow.h>
6 #include <msp/gl/camera.h>
7 #include <msp/gl/light.h>
8 #include <msp/gl/lighting.h>
9 #include <msp/gl/pipeline.h>
10 #include <msp/input/keyboard.h>
11 #include <msp/input/mouse.h>
12 #include "libr2c2/catalogue.h"
13 #include "libr2c2/train.h"
14 #include "3d/layout.h"
15 #include "3d/overlay.h"
16 #include "3d/path.h"
17 #include "3d/trackchain.h"
18 #include "3d/view.h"
19 #include "network/server.h"
20 #include "options.h"
21 #include "userinterface.h"
22
23 class Engineer: public Msp::RegisteredApplication<Engineer>
24 {
25 private:
26         Options options;
27
28         Msp::Graphics::SimpleGLWindow window;
29         Msp::Input::Keyboard keyboard;
30         Msp::Input::Mouse mouse;
31
32         R2C2::Catalogue catalogue;
33         R2C2::Layout layout;
34         R2C2::Layout3D layout_3d;
35         R2C2::Server *server;
36         Msp::IO::EventDispatcher event_disp;
37         R2C2::Overlay3D *overlay;
38         std::map<R2C2::Train *, Msp::GL::Color> train_colors;
39
40         R2C2::View3D main_view;
41         UserInterface ui;
42
43         std::list<R2C2::Train *> new_trains;
44         R2C2::Vector pointer;
45         std::list<R2C2::TrackChain3D *> emergencies;
46         Msp::Time::TimeStamp emergency_blink_timeout;
47         unsigned emergency_blink_state;
48
49 public:
50         Engineer(int argc, char **argv);
51         ~Engineer();
52
53         const R2C2::Catalogue &get_catalogue() const { return catalogue; }
54         R2C2::Layout &get_layout() { return layout; }
55         R2C2::Layout3D &get_layout_3d() { return layout_3d; }
56         R2C2::View3D &get_main_view() { return main_view; }
57         UserInterface &get_user_interface() { return ui; }
58         int main();
59         void quit() { exit(0); }
60 private:
61         void tick();
62         void button_press(unsigned);
63         void axis_motion(unsigned, float, float);
64         void view_all();
65         R2C2::Object *pick_object(const R2C2::Vector &);
66         void emergency(R2C2::Block *, const std::string &);
67         void halt_event(bool);
68         void train_added(R2C2::Train &);
69         void process_new_train(R2C2::Train &);
70         virtual void sighandler(int);
71 };
72
73 #endif