Loading [MathJax]/extensions/MathMenu.js
 |
Cytopia
0.3
A city building simulation game
|
Go to the documentation of this file.
13 #include "../services/Randomizer.hxx"
22 #ifdef MICROPROFILE_ENABLED
23 #include "microprofile/microprofile.h"
28 NeighborNodesPosition
operator++(NeighborNodesPosition &nn,
int)
30 NeighborNodesPosition res = nn;
34 case NeighborNodesPosition::BOTTOM_LEFT:
35 nn = NeighborNodesPosition::LEFT;
37 case NeighborNodesPosition::LEFT:
38 nn = NeighborNodesPosition::TOP_LEFT;
40 case NeighborNodesPosition::TOP_LEFT:
41 nn = NeighborNodesPosition::BOTTOM;
43 case NeighborNodesPosition::BOTTOM:
44 nn = NeighborNodesPosition::CENTER;
46 case NeighborNodesPosition::CENTER:
47 nn = NeighborNodesPosition::TOP;
49 case NeighborNodesPosition::TOP:
50 nn = NeighborNodesPosition::BOTTOM_RIGHT;
52 case NeighborNodesPosition::BOTTOM_RIGHT:
53 nn = NeighborNodesPosition::RIGHT;
55 case NeighborNodesPosition::RIGHT:
56 nn = NeighborNodesPosition::TOP_RIGHT;
58 case NeighborNodesPosition::TOP_RIGHT:
59 nn = NeighborNodesPosition::BOTTOM_LEFT;
69 Map::Map(
int columns,
int rows) : pMapNodesVisible(new
Sprite *[columns * rows]), m_columns(columns), m_rows(rows)
76 Map::Map(
int columns,
int rows,
const bool generateTerrain)
77 : pMapNodesVisible(new
Sprite *[columns * rows]), m_columns(columns), m_rows(rows)
104 #ifdef MICROPROFILE_ENABLED
105 MICROPROFILE_SCOPEI(
"Map",
"Render Map", MP_YELLOW);
116 #ifdef MICROPROFILE_ENABLED
117 MICROPROFILE_SCOPEI(
"Map",
"Refresh Map", MP_YELLOW);
134 const int left = topLeft.
x + topLeft.
y - 2;
135 const int right = bottomRight.x + bottomRight.y + 1;
136 const int top = topLeft.
y - topLeft.
x + 1;
145 for (
int x = 0; x <
m_rows; x++)
147 const int xVal = x + y;
148 const int yVal = y - x;
150 if ((xVal >= left) && (xVal <= right) && (yVal <= top) && (yVal >= bottom))
Map(int columns, int rows, const bool generateTerrain)
std::vector< MapNode > mapNodes
TerrainGenerator m_terrainGen
static void enableLayers(std::vector< unsigned int > &&layers)
Enable drawing layers.
Point calculateIsoCoordinates(const SDL_Point &screenCoordinates)
Calculates screen space coordinates to isometric space coordinates.
ScreenDimension screenHeight
the screen height
@ POWERLINES
9- Powerlines
void generateTerrain(std::vector< MapNode > &mapNodes, std::vector< MapNode * > &mapNodesInDrawingOrder)
static const int maxHeight
Maximum height of the node.
NeighborNodesPosition operator++(NeighborNodesPosition &nn, int)
@ GROUND_DECORATION
Remove only ground decoration.
void renderMap() const
Render the elements contained in the Map.
int mapSize
the size of the map
ScreenDimension screenWidth
the screen width
Class that holds map nodes.
void refresh()
Refresh all the map tile textures.
@ ZONE
4- Optional layer, zones(Industrial/Residential/Commercial).
void generateRiver(std::vector< MapNode > &mapNodes)
@ BUILDINGS
8- Buildings, Streets and everything that goes on the terrain
const std::string DEFAULT_TERRAIN
MapNode & getMapNode(Point isoCoords)
Get pointer to a single mapNode at specific iso coordinates.
@ FLORA
10- Trees and other flora/Fauna tiles
std::vector< MapNode * > mapNodesInDrawingOrder
void calculateVisibleMap(void)
For implementing frustum culling, find all map nodes which are visible on the screen....
std::default_random_engine randomEngine
@ ROAD
5- Optional layer, roads.
@ TERRAIN
Default "overworld" edit mode.
void refresh(const Layer &layer=Layer::NONE)
static Settings & instance(void)
Get an instance of the singleton.
Sprite ** pMapNodesVisible