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

#include <MapLayers.hxx>

+ Collaboration diagram for MapLayers:

Static Public Member Functions

static void enableLayers (std::vector< unsigned int > &&layers)
 Enable drawing layers. More...
 
static void disableLayer (unsigned int layer)
 Disable Drawing Layer. More...
 
static void toggleLayer (unsigned int layer)
 Toggle Drawing Layer. More...
 
static bool isLayerActive (unsigned int layer)
 Check if given Layer is being drawn. More...
 
static void setLayerEditMode (LayerEditMode layerEditMode)
 

Private Member Functions

 MapLayers ()=default
 
 ~MapLayers ()=default
 

Static Private Member Functions

static void deactivateAllLayers ()
 

Static Private Attributes

static unsigned int m_activeLayers = 0
 

Detailed Description

Definition at line 7 of file MapLayers.hxx.

Constructor & Destructor Documentation

◆ MapLayers()

MapLayers::MapLayers ( )
privatedefault

◆ ~MapLayers()

MapLayers::~MapLayers ( )
privatedefault

Member Function Documentation

◆ deactivateAllLayers()

static void MapLayers::deactivateAllLayers ( )
inlinestaticprivate

Definition at line 44 of file MapLayers.hxx.

45  {
46  for (auto layer : allLayersOrdered)
47  {
48  disableLayer(layer);
49  }
50  };
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ disableLayer()

static void MapLayers::disableLayer ( unsigned int  layer)
inlinestatic

Disable Drawing Layer.

Disable Drawing Layer ( Turned off by using bitwise AND with inversed pattern)

Parameters
layeruint32_t from enum "Layer"
See also
Layer

Definition at line 21 of file MapLayers.hxx.

21 { m_activeLayers &= ~(1U << layer); };
+ Here is the caller graph for this function:

◆ enableLayers()

void MapLayers::enableLayers ( std::vector< unsigned int > &&  layers)
static

Enable drawing layers.

Parameters
layersLayers to be enabled.
See also
Layer

Definition at line 26 of file MapLayers.cxx.

27 {
28  unsigned int enLayers = 0U;
29 
30  for (auto layer : layers)
31  {
32  enLayers |= 1U << layer;
33  }
34 
35  m_activeLayers |= enLayers;
36 }
+ Here is the caller graph for this function:

◆ isLayerActive()

static bool MapLayers::isLayerActive ( unsigned int  layer)
inlinestatic

Check if given Layer is being drawn.

Parameters
layeruint32_t from enum "Layer"
See also
Layer

Definition at line 34 of file MapLayers.hxx.

34 { return (m_activeLayers & (1U << layer)); };
+ Here is the caller graph for this function:

◆ setLayerEditMode()

void MapLayers::setLayerEditMode ( LayerEditMode  layerEditMode)
static

Definition at line 7 of file MapLayers.cxx.

8 {
9  switch (layerEditMode)
10  {
13  if (Settings::instance().showBuildingsInBlueprint)
14  {
16  }
18  break;
22  break;
23  }
24 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toggleLayer()

static void MapLayers::toggleLayer ( unsigned int  layer)
inlinestatic

Toggle Drawing Layer.

Toggle Drawing Layer (use bitwise XOR to toggle layer)

Parameters
layeruint32_t from enum "Layer"
See also
Layer

Definition at line 28 of file MapLayers.hxx.

28 { m_activeLayers ^= (1U << layer); };
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_activeLayers

unsigned int MapLayers::m_activeLayers = 0
staticprivate

Definition at line 42 of file MapLayers.hxx.


The documentation for this class was generated from the following files:
WATER
@ WATER
6- Water tiles
Definition: enums.hxx:17
MapLayers::enableLayers
static void enableLayers(std::vector< unsigned int > &&layers)
Enable drawing layers.
Definition: MapLayers.cxx:26
POWERLINES
@ POWERLINES
9- Powerlines
Definition: enums.hxx:20
MapLayers::m_activeLayers
static unsigned int m_activeLayers
Definition: MapLayers.hxx:42
MapLayers::disableLayer
static void disableLayer(unsigned int layer)
Disable Drawing Layer.
Definition: MapLayers.hxx:21
ZONE
@ ZONE
4- Optional layer, zones(Industrial/Residential/Commercial).
Definition: enums.hxx:15
BUILDINGS
@ BUILDINGS
8- Buildings, Streets and everything that goes on the terrain
Definition: enums.hxx:19
FLORA
@ FLORA
10- Trees and other flora/Fauna tiles
Definition: enums.hxx:21
ROAD
@ ROAD
5- Optional layer, roads.
Definition: enums.hxx:16
LayerEditMode::TERRAIN
@ TERRAIN
Default "overworld" edit mode.
MapLayers::deactivateAllLayers
static void deactivateAllLayers()
Definition: MapLayers.hxx:44
allLayersOrdered
static Layer allLayersOrdered[]
This is a ordered list of all relevant layers we need to interact with.
Definition: enums.hxx:29
Singleton< Settings >::instance
static Settings & instance(void)
Get an instance of the singleton.
Definition: Singleton.hxx:15
LayerEditMode::BLUEPRINT
@ BLUEPRINT
Placing water pipes and underground transportation on the Blueprint layer.
UNDERGROUND
@ UNDERGROUND
2- Optional layer - Pipes, Subway-pipes and so onn
Definition: enums.hxx:13