Pioneer
View.h
Go to the documentation of this file.
1 // Copyright © 2008-2021 Pioneer Developers. See AUTHORS.txt for details
2 // Licensed under the terms of the GPL v3. See licenses/GPL-3.txt
3 
4 #ifndef _VIEW_H
5 #define _VIEW_H
6 
7 #include "JsonFwd.h"
8 #include "gui/Gui.h"
9 #include "libs.h"
10 
11 namespace Graphics {
12  class Renderer;
13 }
14 
15 /*
16  * For whatever draws crap into the main area of the screen.
17  * Eg:
18  * game 3d view
19  * system map
20  * sector map
21  */
22 class View : public Gui::Fixed {
23 public:
24  View();
25  virtual ~View();
26  // called before Gui::Draw will call widget ::Draw methods.
27  virtual void Draw3D() = 0;
28  // for checking key states, mouse crud
29  virtual void Update() = 0;
30  // Called during the pigui frame to draw UI
31  virtual void DrawPiGui(){};
32  virtual void SaveToJson(Json &jsonObj) {}
33  virtual void LoadFromJson(const Json &jsonObj) {}
34 
35  void Attach();
36  void Detach();
37 
39 
40 protected:
41  virtual void OnSwitchTo() = 0;
42  virtual void OnSwitchFrom() {}
44 };
45 
46 #endif /* _VIEW_H */
nlohmann::json Json
Definition: Json.h:8
Definition: Renderer.h:39
Definition: GuiFixed.h:14
Definition: View.h:22
void Attach()
Definition: View.cpp:17
virtual void Draw3D()=0
Graphics::Renderer * m_renderer
Definition: View.h:43
void Detach()
Definition: View.cpp:26
View()
Definition: View.cpp:7
virtual void DrawPiGui()
Definition: View.h:31
virtual void OnSwitchTo()=0
virtual void SaveToJson(Json &jsonObj)
Definition: View.h:32
virtual void Update()=0
virtual ~View()
Definition: View.cpp:12
virtual void OnSwitchFrom()
Definition: View.h:42
virtual void LoadFromJson(const Json &jsonObj)
Definition: View.h:33
void SetRenderer(Graphics::Renderer *r)
Definition: View.h:38
Definition: Background.h:13