Cytopia  0.3
A city building simulation game
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
EventManager Class Reference

#include <EventManager.hxx>

+ Inheritance diagram for EventManager:
+ Collaboration diagram for EventManager:

Public Member Functions

 EventManager ()=default
 
 ~EventManager ()=default
 
void checkEvents (SDL_Event &event)
 
void unHighlightNodes ()
 Unhighlight highlighted Nodes. More...
 
void pickTileUnderCursor (Point mouseIsoCoords)
 

Private Attributes

UIElement * m_lastHoveredElement = nullptr
 
bool m_placementAllowed = false
 remember if placement is allowed from mousemove to mousedown More...
 
bool m_panning = false
 
bool m_tileInfoMode = false
 
bool m_isPuttingTile = false
 determines if putting tile action is being performed More...
 
bool m_cancelTileSelection = false
 determines if a right click should cancel tile selection More...
 
Point m_pinchCenterCoords = {0, 0, 0, 0}
 
Point m_clickDownCoords = {0, 0, 0, 0}
 
std::vector< Pointm_nodesToPlace = {}
 
std::vector< Pointm_nodesToHighlight = {}
 
std::vector< Pointm_transparentBuildings
 

Additional Inherited Members

- Static Public Member Functions inherited from Singleton< EventManager >
static EventManagerinstance (void)
 Get an instance of the singleton. More...
 
- Protected Member Functions inherited from Singleton< EventManager >
 Singleton () noexcept=default
 
 ~Singleton () noexcept=default
 

Detailed Description

Definition at line 12 of file EventManager.hxx.

Constructor & Destructor Documentation

◆ EventManager()

EventManager::EventManager ( )
default

◆ ~EventManager()

EventManager::~EventManager ( )
default

Member Function Documentation

◆ checkEvents()

void EventManager::checkEvents ( SDL_Event &  event)

Definition at line 79 of file EventManager.cxx.

80 {
81 #ifdef MICROPROFILE_ENABLED
82  MICROPROFILE_SCOPEI("EventManager", "checkEvents", MP_BEIGE);
83 #endif
84  // check for UI events first
85  SDL_Point mouseScreenCoords;
86  Point mouseIsoCoords{};
87  auto &uiManager = UIManager::instance();
88 
89  while (SDL_PollEvent(&event))
90  {
91  ImGui_ImplSDL2_ProcessEvent(&event);
92 
93  switch (event.type)
94  {
95  case SDL_QUIT:
97  break;
98 
99  case SDL_KEYDOWN:
100  switch (event.key.keysym.sym)
101  {
102  case SDLK_ESCAPE:
103  if (!tileToPlace.empty())
104  {
105  uiManager.closeOpenMenus();
106  tileToPlace.clear();
107  highlightSelection = false;
108  }
109  else
110  {
111  uiManager.closeOpenMenus();
112 
113  if (uiManager.isAnyMenuOpen())
114  uiManager.closeMenu();
115  else
116  uiManager.openMenu<PauseMenu>();
117  }
118  break;
119 
120  case SDLK_0:
121  break;
122  case SDLK_LCTRL:
125  break;
126  case SDLK_LSHIFT:
128  if (GameStates::instance().placementMode == PlacementMode::LINE)
129  {
131  }
132  break;
133  case SDLK_F11:
134  uiManager.toggleDebugMenu();
135  break;
136  case SDLK_1:
138  break;
139  case SDLK_2:
141  break;
142  case SDLK_3:
144  break;
145  case SDLK_4:
147  break;
148  case SDLK_5:
150  break;
151  case SDLK_6:
153  break;
154  case SDLK_i:
156  break;
157  case SDLK_h:
158  // TODO: This is only temporary until the new UI is ready. Remove this afterwards
160  break;
161  case SDLK_f:
163  break;
164  case SDLK_UP:
165  case SDLK_w:
166  if (MapFunctions::instance().getMap() &&
167  Camera::instance().cameraOffset().y > -2 * Settings::instance().screenHeight * Camera::instance().zoomLevel())
168  {
169  Camera::instance().moveCamera(0, Settings::instance().screenHeight / 16);
170  }
171  break;
172  case SDLK_LEFT:
173  case SDLK_a:
174  if (MapFunctions::instance().getMap() &&
175  Camera::instance().cameraOffset().x > -0.25 * Settings::instance().screenWidth * Camera::instance().zoomLevel())
176  {
177  Camera::instance().moveCamera(Settings::instance().screenWidth / 16, 0);
178  }
179  break;
180  case SDLK_DOWN:
181  case SDLK_s:
182  if (MapFunctions::instance().getMap() &&
183  Camera::instance().cameraOffset().y < 1.25 * Settings::instance().screenHeight * Camera::instance().zoomLevel())
184  {
185  Camera::instance().moveCamera(0, -Settings::instance().screenHeight / 16);
186  }
187  break;
188  case SDLK_RIGHT:
189  case SDLK_d:
190  if (MapFunctions::instance().getMap() &&
191  Camera::instance().cameraOffset().x < 5 * Settings::instance().screenWidth * Camera::instance().zoomLevel())
192  {
193  // check if map exists to see, if we're ingame already.
194  if (MapFunctions::instance().getMap())
195  {
196  Camera::instance().moveCamera(-Settings::instance().screenWidth / 16, 0);
197  }
198  }
199  break;
200 
201  default:
202  break;
203  }
204  break;
205  case SDL_KEYUP:
206  switch (event.key.keysym.sym)
207  {
208  case SDLK_LCTRL:
211  break;
212  case SDLK_LSHIFT:
214  if (GameStates::instance().placementMode == PlacementMode::STRAIGHT_LINE)
215  {
217  }
218  break;
219 
220  default:
221  break;
222  }
223  case SDL_MULTIGESTURE:
224  if (event.mgesture.numFingers == 2)
225  {
226  m_panning = true;
227  // check if we're pinching
228  if (event.mgesture.dDist != 0)
229  {
230  // store pinchCenterCoords so they stay the same for all zoom levels
231  if (m_pinchCenterCoords.x == 0 && m_pinchCenterCoords.y == 0)
232  {
234  convertScreenToIsoCoordinates({static_cast<int>(event.mgesture.x * Settings::instance().screenWidth),
235  static_cast<int>(event.mgesture.y * Settings::instance().screenHeight)});
236  }
238  break;
239  }
240 
241  if (m_panning)
242  {
243  Camera::instance().moveCamera(static_cast<int>(Settings::instance().screenWidth * event.tfinger.dx),
244  static_cast<int>(Settings::instance().screenHeight * event.tfinger.dy));
245  break;
246  }
247  }
248  break;
249  case SDL_MOUSEMOTION:
250  m_placementAllowed = false;
251  m_cancelTileSelection = false;
252 
253  // Game Event Handling
254  if (MapFunctions::instance().getMap())
255  {
256  // clear highlighting
258 
259  // if we're panning, move the camera and break
260  if (m_panning)
261  {
262  if ((event.motion.xrel == 0) && (event.motion.yrel == 0))
263  {
264  return;
265  }
266  Camera::instance().moveCamera(event.motion.xrel, event.motion.yrel);
267  }
268  // check if we should highlight tiles and if we're in placement mode
269  if (highlightSelection)
270  {
271  mouseScreenCoords = {event.button.x, event.button.y};
272  mouseIsoCoords = convertScreenToIsoCoordinates(mouseScreenCoords);
273 
274  // if it's a multi-node tile, get the origin corner point
275  Point origCornerPoint =
277 
278  if (origCornerPoint == Point::INVALID())
279  {
280  origCornerPoint = mouseIsoCoords;
281  }
282 
283  // canceling transparent buildings
284  for (const auto &it : m_transparentBuildings)
285  {
286  if (it != Point::INVALID())
287  {
288  (MapFunctions::instance().getMapNode(it)).setNodeTransparency(0, Layer::BUILDINGS);
289  }
290  }
291  m_transparentBuildings.clear();
292 
293  // if there's no tileToPlace use the current mouse coordinates
294  if (tileToPlace.empty())
295  {
296  m_nodesToHighlight.push_back(mouseIsoCoords);
297  }
298  else
299  {
301  // get all node coordinates the tile we'll place occupies
302 
303  if (m_nodesToHighlight.empty() && mouseIsoCoords.isWithinMapBoundaries())
304  {
305  m_nodesToHighlight.push_back(mouseIsoCoords);
306  }
307  }
308 
309  // if mouse is held down, we need to check for plamentmodes LINE and RECTANGLE
310  if (SDL_GetMouseState(NULL, NULL) & SDL_BUTTON(SDL_BUTTON_LEFT))
311  {
312  switch (GameStates::instance().placementMode)
313  {
315  m_nodesToPlace.push_back(mouseIsoCoords);
316  break;
317  case PlacementMode::LINE:
320  break;
324  break;
328  break;
329  }
330  }
331 
332  // if we haven't any nodes to place yet, use the mouse coordinates
333  if (m_nodesToPlace.empty())
334  {
335  m_nodesToPlace.push_back(mouseIsoCoords);
336  }
337  m_placementAllowed = false;
338  std::vector<Point> nodesToAdd;
340 
341  // if we touch a bigger than 1x1 tile also add all nodes of the building to highlight.
342  for (const auto &coords : m_nodesToHighlight)
343  {
344  // If we place a ground decoration tile, we must add all tiles of bigger than 1x1 buildings from the Layer BUILDINGS
345  Layer layer;
346  if (demolishMode || (tileToPlaceData && tileToPlaceData->tileType == +TileType::GROUNDDECORATION))
347  {
348  layer = Layer::BUILDINGS;
349  }
350  else
351  {
353  }
354  Point currentOriginPoint = MapFunctions::instance().getNodeOrigCornerPoint(coords, layer);
355 
356  std::string currentTileID = MapFunctions::instance().getTileID(currentOriginPoint, layer);
357  for (auto &foundNode : TileManager::instance().getTargetCoordsOfTileID(currentOriginPoint, currentTileID))
358  {
359  // only add the node if it's unique
360  if (std::find(m_nodesToHighlight.begin(), m_nodesToHighlight.end(), foundNode) == m_nodesToHighlight.end())
361  {
362  nodesToAdd.push_back(foundNode);
363  }
364  }
365  }
366  // add the nodes we've found
367  m_nodesToHighlight.insert(m_nodesToHighlight.end(), nodesToAdd.begin(), nodesToAdd.end());
368 
369  // for ground decoration, place all ground decoration files beneath the building
370  if (tileToPlaceData && tileToPlaceData->tileType == +TileType::GROUNDDECORATION)
371  {
373  }
374 
376 
377  // Finally highlight all the tiles we've found
378  // Set highlighted tiles that can be placed and can't be placed different color
379  for (const auto &highlitNode : m_nodesToHighlight)
380  {
381  if (!MapFunctions::instance().isPlacementOnNodeAllowed(highlitNode, tileToPlace) || demolishMode)
382  {
383  // mark red
384  MapFunctions::instance().highlightNode(highlitNode, SpriteHighlightColor::RED);
385  }
386  else
387  {
388  // place allowed tile, mark gray
389  MapFunctions::instance().highlightNode(highlitNode, SpriteHighlightColor::GRAY);
390  }
391  const Point &buildingCoordinates =
393 
394  auto transparentBuildingIt =
395  std::find(m_transparentBuildings.begin(), m_transparentBuildings.end(), buildingCoordinates);
396  if ((transparentBuildingIt == m_transparentBuildings.end()) && (buildingCoordinates != Point::INVALID()))
397  {
398  const TileData *tileData = MapFunctions::instance().getMapNode(buildingCoordinates).getTileData(Layer::BUILDINGS);
399  if (tileData && tileData->category != "Flora")
400  {
402  m_transparentBuildings.push_back(buildingCoordinates);
403  }
404  }
405  }
406  }
407  }
408  break;
409  case SDL_MOUSEBUTTONDOWN:
410  m_placementAllowed = false;
411 
412  if (event.button.button == SDL_BUTTON_RIGHT)
413  {
414  m_panning = true;
415  m_cancelTileSelection = true;
416  }
417  else if (event.button.button == SDL_BUTTON_LEFT)
418  {
419  // game event handling
420  mouseScreenCoords = {event.button.x, event.button.y};
421  mouseIsoCoords = convertScreenToIsoCoordinates(mouseScreenCoords);
422  const std::vector targetObjectNodes = TileManager::instance().getTargetCoordsOfTileID(mouseIsoCoords, tileToPlace);
423 
424  //check if the coords for the click and for the occpuied tiles of the tileID we want to place are within map boundaries
425  bool canPlaceTileID = false;
426  if (mouseIsoCoords.isWithinMapBoundaries())
427  {
428  canPlaceTileID = true;
429  for (auto coordinate : targetObjectNodes)
430  {
431  if (!coordinate.isWithinMapBoundaries())
432  {
433  canPlaceTileID = false;
434  break;
435  }
436  }
437  }
438 
439  if (canPlaceTileID)
440  {
441  m_clickDownCoords = mouseIsoCoords;
442  m_placementAllowed = true;
443 
444  // Nodes to place are collected during the mouse move.
445  // In case of multiple left clicks without moving the mouse, node to place will be the node of the mouse click.
446  if (m_nodesToPlace.empty())
447  {
448  m_nodesToPlace.push_back(mouseIsoCoords);
449  }
450  m_isPuttingTile = true;
451  }
452  }
453  break;
454 
455  case SDL_MOUSEBUTTONUP:
456  {
458  {
459  uiManager.closeOpenMenus();
460  tileToPlace.clear();
461  highlightSelection = false;
462  }
463  if (m_panning)
464  {
465  m_panning = false;
466  }
467 
468  // reset pinchCenterCoords when fingers are released
469  m_pinchCenterCoords = {0, 0, 0, 0};
470 
471  // game event handling
472  mouseScreenCoords = {event.button.x, event.button.y};
473  mouseIsoCoords = convertScreenToIsoCoordinates(mouseScreenCoords);
474  // gather all nodes the objects that'll be placed is going to occupy.
475  std::vector targetObjectNodes = TileManager::instance().getTargetCoordsOfTileID(mouseIsoCoords, tileToPlace);
476 
477  if (event.button.button == SDL_BUTTON_LEFT)
478  {
479  if (m_tileInfoMode)
480  {
481  MapFunctions::instance().getNodeInformation({mouseIsoCoords.x, mouseIsoCoords.y, 0, 0});
482  }
484  {
485  MapFunctions::instance().changeHeight(mouseIsoCoords, true);
486  }
488  {
489  MapFunctions::instance().changeHeight(mouseIsoCoords, false);
490  }
492  {
494  }
495  else if (demolishMode)
496  {
498  }
499  // select the tile our cursor is over
500  else if (!demolishMode && tileToPlace.empty())
501  {
502  pickTileUnderCursor(mouseIsoCoords);
503  // pick the tile in mousemove, player will find mousedown
504  break;
505  }
506  else if (!tileToPlace.empty() && m_placementAllowed)
507  {
508  if (!uiManager.isMouseHovered() && !MapFunctions::instance().setTileID(tileToPlace, m_nodesToPlace))
509  {
510  // If can't put picked tile here,
511  // pick tile under cursor as the new picked tile
512  // Thus the picker would always work without
513  // having to right click or enter Esc(abort tile placing) first
514  pickTileUnderCursor(mouseIsoCoords);
515  }
516  }
517  }
518  // when we're done, reset highlighting
519  m_isPuttingTile = false;
521 
522  if (highlightSelection)
523  {
524  m_nodesToHighlight.push_back(mouseIsoCoords);
525  if (!uiManager.isMouseHovered() && !tileToPlace.empty() &&
526  !MapFunctions::instance().setTileID(tileToPlace, mouseIsoCoords))
527  {
528  MapFunctions::instance().highlightNode(mouseIsoCoords, SpriteHighlightColor::RED);
529  }
530  else
531  {
532  MapFunctions::instance().highlightNode(mouseIsoCoords, SpriteHighlightColor::GRAY);
533  }
534  }
535 
536  break;
537  }
538  case SDL_MOUSEWHEEL:
539  Camera::instance().changeZoomLevel(event.wheel.y > 0);
540  break;
541 
542  default:
543  break;
544  }
545  }
546 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pickTileUnderCursor()

void EventManager::pickTileUnderCursor ( Point  mouseIsoCoords)

Definition at line 45 of file EventManager.cxx.

46 {
47  Layer topMostActiveLayer;
48  std::vector<MapNodeData> mapNodeData;
49  const MapNode &node = MapFunctions::instance().getMapNode(mouseIsoCoords);
50 
51  topMostActiveLayer = node.getTopMostActiveLayer();
52  // all layers are supported except terrain
53  if (topMostActiveLayer == Layer::TERRAIN || topMostActiveLayer == Layer::NONE)
54  return;
55  // update placement mode
56  switch (topMostActiveLayer)
57  {
58  case Layer::BUILDINGS:
60  break;
61  case Layer::ROAD:
62  case Layer::POWERLINES:
63  case Layer::UNDERGROUND:
65  break;
67  case Layer::WATER:
68  case Layer::ZONE:
70  break;
71  default:
72  break;
73  }
74  mapNodeData = node.getMapNodeData();
75  tileToPlace = mapNodeData[topMostActiveLayer].tileID;
76  highlightSelection = true;
77 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unHighlightNodes()

void EventManager::unHighlightNodes ( )

Unhighlight highlighted Nodes.

This sets a node to be unhighlighted.

Definition at line 28 of file EventManager.cxx.

29 {
30  if (!m_isPuttingTile)
31  {
32  for (auto node : m_nodesToPlace)
33  {
35  }
36  m_nodesToPlace.clear();
37  }
38  for (auto node : m_nodesToHighlight)
39  {
41  }
42  m_nodesToHighlight.clear();
43 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_cancelTileSelection

bool EventManager::m_cancelTileSelection = false
private

determines if a right click should cancel tile selection

Definition at line 34 of file EventManager.hxx.

◆ m_clickDownCoords

Point EventManager::m_clickDownCoords = {0, 0, 0, 0}
private

Definition at line 36 of file EventManager.hxx.

◆ m_isPuttingTile

bool EventManager::m_isPuttingTile = false
private

determines if putting tile action is being performed

Definition at line 33 of file EventManager.hxx.

◆ m_lastHoveredElement

UIElement* EventManager::m_lastHoveredElement = nullptr
private

Definition at line 27 of file EventManager.hxx.

◆ m_nodesToHighlight

std::vector<Point> EventManager::m_nodesToHighlight = {}
private

Definition at line 38 of file EventManager.hxx.

◆ m_nodesToPlace

std::vector<Point> EventManager::m_nodesToPlace = {}
private

Definition at line 37 of file EventManager.hxx.

◆ m_panning

bool EventManager::m_panning = false
private

Definition at line 31 of file EventManager.hxx.

◆ m_pinchCenterCoords

Point EventManager::m_pinchCenterCoords = {0, 0, 0, 0}
private

Definition at line 35 of file EventManager.hxx.

◆ m_placementAllowed

bool EventManager::m_placementAllowed = false
private

remember if placement is allowed from mousemove to mousedown

Definition at line 30 of file EventManager.hxx.

◆ m_tileInfoMode

bool EventManager::m_tileInfoMode = false
private

Definition at line 32 of file EventManager.hxx.

◆ m_transparentBuildings

std::vector<Point> EventManager::m_transparentBuildings
private

Definition at line 39 of file EventManager.hxx.


The documentation for this class was generated from the following files:
MapFunctions::getNodeInformation
void getNodeInformation(const Point &isoCoordinates) const
Debug MapNodeData to Console.
Definition: MapFunctions.cxx:518
demolishMode
bool demolishMode
Definition: mapEdit.cxx:5
EventManager::m_cancelTileSelection
bool m_cancelTileSelection
determines if a right click should cancel tile selection
Definition: EventManager.hxx:34
terrainEditMode
TerrainEdit terrainEditMode
Definition: mapEdit.cxx:3
EventManager::m_clickDownCoords
Point m_clickDownCoords
Definition: EventManager.hxx:36
DemolishMode::DE_ZONE
@ DE_ZONE
Remove only zones.
TerrainEdit::RAISE
@ RAISE
WATER
@ WATER
6- Water tiles
Definition: enums.hxx:17
TileData::tileType
TileType tileType
Definition: tileData.hxx:149
TerrainEdit::LOWER
@ LOWER
GameStatesData::placementMode
PlacementMode placementMode
Specifies the placement mode when holding down the mouse.
Definition: GameStates.hxx:18
Camera::moveCamera
void moveCamera(int xOffset, int yOffset)
Move the camera in the given direction.
Definition: Camera.cxx:82
MapFunctions::demolishNode
void demolishNode(const std::vector< Point > &isoCoordinates, bool updateNeighboringTiles=false, Layer layer=Layer::NONE)
Demolish a node.
Definition: MapFunctions.cxx:465
MapFunctions::getNodeOrigCornerPoint
Point getNodeOrigCornerPoint(const Point &isoCoordinates, Layer layer=Layer::NONE)
Get original corner point of given point within building borders.
Definition: MapFunctions.cxx:326
TileManager::getTargetCoordsOfTileID
std::vector< Point > getTargetCoordsOfTileID(const Point &targetCoordinates, const std::string &tileID)
Return a vector of Points on a target node (origin corner) that would be occupied by a given tileID i...
Definition: TileManager.cxx:46
TileData::category
std::string category
The category this item resides in. Categories are used for the building menu in-game and for sorting ...
Definition: tileData.hxx:140
SettingsData::screenHeight
ScreenDimension screenHeight
the screen height
Definition: Settings.hxx:46
POWERLINES
@ POWERLINES
9- Powerlines
Definition: enums.hxx:20
EventManager::m_transparentBuildings
std::vector< Point > m_transparentBuildings
Definition: EventManager.hxx:39
EventManager::m_nodesToPlace
std::vector< Point > m_nodesToPlace
Definition: EventManager.hxx:37
MapNode::getTopMostActiveLayer
Layer getTopMostActiveLayer() const
return topmost active layer.
Definition: MapNode.cxx:105
NONE
@ NONE
0- this must be FIRST !!!
Definition: enums.hxx:11
EventManager::m_pinchCenterCoords
Point m_pinchCenterCoords
Definition: EventManager.hxx:35
DemolishMode::GROUND_DECORATION
@ GROUND_DECORATION
Remove only ground decoration.
PointFunctions::getArea
static std::vector< Point > getArea(const Point &isoCoordinatesStart, const Point &isoCoordinatesEnd)
Gets all nodes in a rectangular area between start and end point.
Definition: PointFunctions.cxx:156
MapNode::getTileData
const TileData * getTileData(Layer layer) const
Definition: MapNode.hxx:84
MapFunctions::highlightNode
void highlightNode(const Point &isoCoordinates, const SpriteRGBColor &rgbColor)
Sets a node to be highlighted.
Definition: MapFunctions.cxx:535
EventManager::m_panning
bool m_panning
Definition: EventManager.hxx:31
MapNode::getMapNodeData
const std::vector< MapNodeData > & getMapNodeData() const
Definition: MapNode.hxx:96
Camera::changeZoomLevel
void changeZoomLevel(bool inc)
Definition: Camera.hxx:35
MapFunctions::levelHeight
void levelHeight(const Point &startCoordinate, const std::vector< Point > levelArea)
level area of map nodes.
Definition: MapFunctions.cxx:63
Point::y
int y
The y coordinate.
Definition: Point.hxx:20
MapLayers::toggleLayer
static void toggleLayer(unsigned int layer)
Toggle Drawing Layer.
Definition: MapLayers.hxx:28
Point::x
int x
The x coordinate.
Definition: Point.hxx:14
MapFunctions::isPlacementOnAreaAllowed
bool isPlacementOnAreaAllowed(const std::vector< Point > &targetCoordinates, const std::string &tileID) const
check if Tile can be placed in an area
Definition: MapFunctions.cxx:270
Camera::setPinchDistance
void setPinchDistance(float pinchDistance, int isoX, int isoY)
Sets the pinch distance for touch screens.
Definition: Camera.cxx:32
convertScreenToIsoCoordinates
Point convertScreenToIsoCoordinates(const SDL_Point &screenCoordinates)
converts screen space coordinates to isometric space coordinates.
Definition: isoMath.cxx:49
SettingsData::screenWidth
ScreenDimension screenWidth
the screen width
Definition: Settings.hxx:40
MapNode
Class that holds map nodes.
Definition: MapNode.hxx:30
EventManager::pickTileUnderCursor
void pickTileUnderCursor(Point mouseIsoCoords)
Definition: EventManager.cxx:45
PlacementMode::STRAIGHT_LINE
@ STRAIGHT_LINE
Place tiles in a straight, rectangular line.
PointFunctions::getLine
static std::vector< Point > getLine(Point isoCoordinatesStart, Point isoCoordinatesEnd)
Creates a line between two points using the Bresenham Line algorithm.
Definition: PointFunctions.cxx:10
MapFunctions::getTileID
std::string getTileID(const Point &isoCoordinates, Layer layer)
get Tile ID of specific layer of specific iso coordinates
Definition: MapFunctions.cxx:545
PointFunctions::getStraightLine
static std::vector< Point > getStraightLine(const Point &isoCoordinatesStart, const Point &isoCoordinatesEnd)
Gets all nodes in a straight line from start and end point.
Definition: PointFunctions.cxx:108
ZONE
@ ZONE
4- Optional layer, zones(Industrial/Residential/Commercial).
Definition: enums.hxx:15
BLUEPRINT
@ BLUEPRINT
1- Optional layer - Map Blueprint
Definition: enums.hxx:12
BUILDINGS
@ BUILDINGS
8- Buildings, Streets and everything that goes on the terrain
Definition: enums.hxx:19
TileManager::getTileLayer
Layer getTileLayer(const std::string &tileID) const
Get the Layer that is associated with a tileID. The Tile will be placed on this layer.
Definition: TileManager.cxx:104
Point::INVALID
static constexpr Point INVALID()
Definition: Point.hxx:35
PlacementMode::LINE
@ LINE
Place tiles in a line from start to end point.
TerrainEdit::LEVEL
@ LEVEL
MapFunctions::unHighlightNode
void unHighlightNode(const Point &isoCoordinates)
Sets a node to be unhighlighred.
Definition: MapFunctions.cxx:550
PlacementMode::SINGLE
@ SINGLE
Place tiles on a single spot.
GameStatesData::rectangularRoads
bool rectangularRoads
place rectangular road tiles instead of diagonal tiles
Definition: GameStates.hxx:15
GameStatesData::demolishMode
DemolishMode demolishMode
Definition: GameStates.hxx:19
PauseMenu
Definition: PauseMenu.hxx:6
highlightSelection
bool highlightSelection
Definition: mapEdit.cxx:6
tileToPlace
std::string tileToPlace
Definition: mapEdit.cxx:4
TileManager::getTileData
TileData * getTileData(const std::string &id) noexcept
Get the TileData struct for this tileID and all information associated with it.
Definition: TileManager.cxx:22
EventManager::m_placementAllowed
bool m_placementAllowed
remember if placement is allowed from mousemove to mousedown
Definition: EventManager.hxx:30
DemolishMode::DEFAULT
@ DEFAULT
Demolish everything, but not.
TERRAIN
@ TERRAIN
3- Terrain tiles, decorations, ... - must always be a "full" tile
Definition: enums.hxx:14
PlacementMode::RECTANGLE
@ RECTANGLE
draw a rectangle between start and end point
MapNode::setNodeTransparency
void setNodeTransparency(const float transparencyFactor, const Layer &layer) const
Sets a node to be Transparent.
Definition: MapNode.cxx:117
EventManager::unHighlightNodes
void unHighlightNodes()
Unhighlight highlighted Nodes.
Definition: EventManager.cxx:28
MapFunctions::findNodeInMap
Point findNodeInMap(const SDL_Point &screenCoordinates, const Layer &layer=Layer::NONE)
Returns the node at given screen coordinates.
Definition: MapFunctions.cxx:558
ROAD
@ ROAD
5- Optional layer, roads.
Definition: enums.hxx:16
MapFunctions::getMapNode
MapNode & getMapNode(Point isoCoords)
Get pointer to a single mapNode at specific iso coordinates.
Definition: MapFunctions.hxx:40
Point
Definition: Point.hxx:7
GROUND_DECORATION
@ GROUND_DECORATION
13- Decoration to place beneath buildings. Like concrete or grass
Definition: enums.hxx:24
Singleton< UIManager >::instance
static UIManager & instance(void)
Get an instance of the singleton.
Definition: Singleton.hxx:15
GameStatesData::drawUI
bool drawUI
Draw UI. This is a temporary variable until the new UI has been implemented.
Definition: GameStates.hxx:14
EventManager::m_nodesToHighlight
std::vector< Point > m_nodesToHighlight
Definition: EventManager.hxx:38
MapFunctions::setTileID
bool setTileID(const std::string &tileID, Point coordinate)
Set the Tile ID Of Node object.
Definition: MapFunctions.cxx:378
EventManager::m_tileInfoMode
bool m_tileInfoMode
Definition: EventManager.hxx:32
Layer
Layer
All Layers we have.
Definition: enums.hxx:9
WindowManager::toggleFullScreen
void toggleFullScreen() const
Definition: WindowManager.cxx:82
string
std::string string
Definition: AudioConfig.hxx:14
UNDERGROUND
@ UNDERGROUND
2- Optional layer - Pipes, Subway-pipes and so onn
Definition: enums.hxx:13
EventManager::m_isPuttingTile
bool m_isPuttingTile
determines if putting tile action is being performed
Definition: EventManager.hxx:33
SignalMediator::signalQuitGame
Signal::Signal< void()> signalQuitGame
Definition: SignalMediator.hxx:22
MapFunctions::changeHeight
void changeHeight(const Point &isoCoordinates, const bool elevate)
Change map node height.
Definition: MapFunctions.cxx:36
convertIsoToScreenCoordinates
SDL_Point convertIsoToScreenCoordinates(const Point &isoCoordinates, bool calcWithoutOffset)
converts coordinates from isometric to screen space
Definition: isoMath.cxx:25
TileData
Holds all releavted information to this specific tile.
Definition: tileData.hxx:135