forked from pioneerspacesim/pioneer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
View.h
53 lines (41 loc) · 1.2 KB
/
View.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Copyright © 2008-2018 Pioneer Developers. See AUTHORS.txt for details
// Licensed under the terms of the GPL v3. See licenses/GPL-3.txt
#ifndef _VIEW_H
#define _VIEW_H
#include "libs.h"
#include "gui/Gui.h"
#include "json/json.h"
namespace Graphics { class Renderer; }
class ShipCpanel;
/*
* For whatever draws crap into the main area of the screen.
* Eg:
* game 3d view
* system map
* sector map
*/
class View: public Gui::Fixed {
public:
View();
virtual ~View();
// called before Gui::Draw will call widget ::Draw methods.
virtual void Draw3D() = 0;
// for checking key states, mouse crud
virtual void Update() = 0;
virtual void SaveToJson(Json::Value &jsonObj) {}
virtual void LoadFromJson(const Json::Value &jsonObj) {}
void Attach();
void Detach();
void SetRenderer(Graphics::Renderer *r) { m_renderer = r; }
static void SetCpanel(ShipCpanel* cpan) { s_cpan = cpan; }
protected:
virtual void OnSwitchTo() = 0;
virtual void OnSwitchFrom() {}
// each view can put some buttons in the bottom right of the cpanel
Gui::Fixed *m_rightButtonBar;
Gui::Fixed *m_rightRegion1;
Gui::Fixed *m_rightRegion2;
Graphics::Renderer *m_renderer;
static ShipCpanel* s_cpan;
};
#endif /* _VIEW_H */