Cytopia  0.3
A city building simulation game
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Map.hxx
Go to the documentation of this file.
1 #ifndef MAP_HXX_
2 #define MAP_HXX_
3 
4 #include <vector>
5 #include <random>
6 
9 #include "../game/GamePlay.hxx"
10 #include "PointFunctions.hxx"
11 // #include "basics/signal.hxx"
12 #include <Signal.hxx>
13 #include <SignalMediator.hxx>
14 
16 {
20  NeighborNodesPosition position;
21 };
22 
23 class Map
24 {
25 public:
26  Map(int columns, int rows, const bool generateTerrain);
27  Map(int columns, int rows);
28  ~Map();
29  Map(Map &other) = delete;
30  Map &operator=(const Map &other) = delete;
31  Map(Map &&fp) = delete;
32  Map const &operator=(Map &&fp) = delete;
33 
34  // MapFunction needs to access private functions
35  friend class MapFunctions;
36 
41  void renderMap() const;
42 
43 private:
49  void refresh();
50 
54  MapNode &getMapNode(Point isoCoords) { return mapNodes[isoCoords.toIndex()]; };
55 
58  const std::vector<MapNode> &getMapNodes() { return mapNodes; };
59 
60  // private:
61 
64  void calculateVisibleMap(void);
65 
66  std::vector<MapNode> mapNodes;
67  std::vector<MapNode *> mapNodesInDrawingOrder;
70  int m_columns;
71  int m_rows;
72  std::default_random_engine randomEngine;
74 
75  static const size_t m_saveGameVersion;
76 };
77 
78 #endif
Map::Map
Map(int columns, int rows, const bool generateTerrain)
Definition: Map.cxx:76
Map::mapNodes
std::vector< MapNode > mapNodes
Definition: Map.hxx:66
Map::m_terrainGen
TerrainGenerator m_terrainGen
Definition: Map.hxx:73
Point::toIndex
int toIndex() const
calculates the index (stride) that can be used to access in Map to access mapNodes vector.
Definition: Point.hxx:80
Sprite
Definition: Sprite.hxx:32
Map::m_visibleNodesCount
int m_visibleNodesCount
Definition: Map.hxx:69
Map::getMapNodes
const std::vector< MapNode > & getMapNodes()
Get all mapnodes as a vector.
Definition: Map.hxx:58
Map::renderMap
void renderMap() const
Render the elements contained in the Map.
Definition: Map.cxx:102
Map::m_rows
int m_rows
Definition: Map.hxx:71
MapNode
Class that holds map nodes.
Definition: MapNode.hxx:30
MapNode.hxx
Map::refresh
void refresh()
Refresh all the map tile textures.
Definition: Map.cxx:114
MapFunctions
Definition: MapFunctions.hxx:12
Map::~Map
~Map()
Definition: Map.cxx:100
TerrainGenerator
Definition: TerrainGenerator.hxx:47
PointFunctions.hxx
Map::m_columns
int m_columns
Definition: Map.hxx:70
Map::getMapNode
MapNode & getMapNode(Point isoCoords)
Get pointer to a single mapNode at specific iso coordinates.
Definition: Map.hxx:54
Map::m_saveGameVersion
static const size_t m_saveGameVersion
Definition: Map.hxx:75
Signal.hxx
Map::mapNodesInDrawingOrder
std::vector< MapNode * > mapNodesInDrawingOrder
Definition: Map.hxx:67
Map::calculateVisibleMap
void calculateVisibleMap(void)
For implementing frustum culling, find all map nodes which are visible on the screen....
Definition: Map.cxx:128
Map::randomEngine
std::default_random_engine randomEngine
Definition: Map.hxx:72
SignalMediator.hxx
NeighborNode::position
NeighborNodesPosition position
Enum of the position of this node the origin node.
Definition: Map.hxx:20
Map
Definition: Map.hxx:23
Point
Definition: Point.hxx:7
NeighborNode
Definition: Map.hxx:15
TerrainGenerator.hxx
NeighborNode::pNode
MapNode * pNode
pointer to the mapNode
Definition: Map.hxx:18
Map::operator=
Map & operator=(const Map &other)=delete
Map::pMapNodesVisible
Sprite ** pMapNodesVisible
Definition: Map.hxx:68