Pioneer
Loading...
Searching...
No Matches
View.h
Go to the documentation of this file.
1// Copyright © 2008-2023 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 "libs.h"
9
10namespace Graphics {
11 class Renderer;
12}
13
14/*
15 * For whatever draws crap into the main area of the screen.
16 * Eg:
17 * game 3d view
18 * system map
19 * sector map
20 */
21class View {
22public:
23 View();
24 virtual ~View();
25 virtual void Draw(){};
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
40protected:
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:44
Definition View.h:21
void Attach()
Definition View.cpp:16
virtual void Draw3D()=0
Graphics::Renderer * m_renderer
Definition View.h:43
void Detach()
Definition View.cpp:21
View()
Definition View.cpp:7
virtual void DrawPiGui()
Definition View.h:31
virtual void Draw()
Definition View.h:25
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:14