3 This file is part of R²C²
4 Copyright © 2006-2011 Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
11 #include <msp/core/application.h>
12 #include <msp/gbase/simplewindow.h>
13 #include <msp/gl/camera.h>
14 #include <msp/gl/light.h>
15 #include <msp/gl/lighting.h>
16 #include <msp/gl/pipeline.h>
17 #include <msp/gltk/resources.h>
18 #include <msp/gltk/root.h>
19 #include "libr2c2/catalogue.h"
20 #include "libr2c2/train.h"
21 #include "3d/layout.h"
22 #include "3d/overlay.h"
24 #include "network/server.h"
31 class Engineer: public Msp::Application
34 sigc::signal<void, R2C2::Track *, int> signal_pick_done;
39 Msp::Graphics::SimpleGLWindow window;
40 Msp::GLtk::Resources ui_res;
41 Msp::GLtk::Root *root;
43 R2C2::Catalogue catalogue;
45 R2C2::Layout3D layout_3d;
47 Msp::IO::EventDispatcher event_disp;
48 R2C2::Overlay3D *overlay;
49 std::map<R2C2::Train *, Msp::GL::Color> train_colors;
51 Msp::GL::Camera camera;
52 Msp::GL::Lighting lighting;
54 Msp::GL::Pipeline pipeline;
55 Msp::GL::Mesh arrow_mesh;
57 MainPanel *main_panel;
58 std::list<TrainPanel *> train_panels;
59 std::list<TrainView *> train_views;
60 Msp::Time::TimeStamp status_timeout;
62 R2C2::Track *picking_track;
64 R2C2::Path3D *picking_path;
70 Engineer(int argc, char **argv);
73 const Msp::GLtk::Resources &get_ui_resources() const { return ui_res; }
74 Msp::GLtk::Root &get_root() const { return *root; }
75 const R2C2::Catalogue &get_catalogue() const { return catalogue; }
76 R2C2::Layout &get_layout() { return layout; }
77 R2C2::Layout3D &get_layout_3d() { return layout_3d; }
78 const Msp::GL::Lighting &get_lighting() const { return lighting; }
79 void set_status(const std::string &);
80 void rearrange_panels();
81 void add_train_view(TrainView &);
82 void remove_train_view(TrainView &);
85 void quit() { exit(0); }
88 void button_press(int, int, unsigned, unsigned);
89 void pointer_motion(int, int);
91 void set_block_color(const R2C2::Block &, const Msp::GL::Color &);
92 void reset_block_color(const R2C2::Block &);
93 void sensor_event(unsigned, bool);
94 void block_reserved(const R2C2::Block &, const R2C2::Train *);
95 R2C2::Track *pick_track(int, int);
96 void train_added(R2C2::Train &);
97 virtual void sighandler(int);
99 static Msp::Application::RegApp<Engineer> reg;