Debian Codegraph @

src/game/minimap.hpp

raw symbols SCIP
1 // This file is part of Dust Racing 2D.
2 // Copyright (C) 2017 Jussi Lind <[email protected]>
3 //
4 // Dust Racing 2D is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 // Dust Racing 2D is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with Dust Racing 2D. If not, see <http://www.gnu.org/licenses/>.
15
16 #ifndef MINIMAP_HPP
17 #define MINIMAP_HPP
18
19 #include <map>
20 #include <memory>
21 #include <vector>
22
23 #include "car.hpp"
24
25 #include <MCVector3d>
26
27 class MapBase;
28 class MCSurface;
29 class Race;
30 class TrackTile;
31
32 class Minimap
33 {
34 public:
35 Minimap();
36
37 Minimap(Car & carToFollow, const MapBase & trackMap, int x, int y, size_t size);
38
39 void initialize(Car & carToFollow, const MapBase & trackMap, int x, int y, size_t size);
40
41 using CarVector = std::vector<CarS>;
42 void render(const CarVector & cars, const Race & race);
43
44 private:
45 void renderMap();
46
47 void renderMarkers(const CarVector & cars, const Race & race);
48
49 struct MinimapTile
50 {
51 MCVector3dF pos;
52
53 int rotation;
54 };
55
56 std::map<std::shared_ptr<MCSurface>, std::vector<MinimapTile>> m_map;
57
58 Car * m_carToFollow = nullptr;
59
60 std::shared_ptr<MCSurface> m_markerSurface;
61
62 MCVector3dF m_center;
63
64 MCVector3dF m_size;
65
66 float m_tileW = 0;
67
68 float m_tileH = 0;
69
70 float m_trackWidth = 0;
71
72 float m_trackHeight = 0;
73 };
74
75 #endif // MINIMAP_HPP