Cytopia  0.3
A city building simulation game
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MapLayers.hxx
Go to the documentation of this file.
1 #ifndef MAP_LAYERS_HXX_
2 #define MAP_LAYERS_HXX_
3 
4 #include "../common/enums.hxx"
5 #include <vector>
6 
7 class MapLayers
8 {
9 public:
14  static void enableLayers(std::vector<unsigned int> &&layers);
15 
21  static inline void disableLayer(unsigned int layer) { m_activeLayers &= ~(1U << layer); };
22 
28  static inline void toggleLayer(unsigned int layer) { m_activeLayers ^= (1U << layer); };
29 
34  static inline bool isLayerActive(unsigned int layer) { return (m_activeLayers & (1U << layer)); };
35 
36  static void setLayerEditMode(LayerEditMode layerEditMode);
37 
38 private:
39  MapLayers() = default;
40  ~MapLayers() = default;
41 
42  static unsigned int m_activeLayers;
43 
44  static inline void deactivateAllLayers()
45  {
46  for (auto layer : allLayersOrdered)
47  {
48  disableLayer(layer);
49  }
50  };
51 };
52 
53 #endif
MapLayers::setLayerEditMode
static void setLayerEditMode(LayerEditMode layerEditMode)
Definition: MapLayers.cxx:7
MapLayers::enableLayers
static void enableLayers(std::vector< unsigned int > &&layers)
Enable drawing layers.
Definition: MapLayers.cxx:26
MapLayers
Definition: MapLayers.hxx:7
MapLayers::m_activeLayers
static unsigned int m_activeLayers
Definition: MapLayers.hxx:42
MapLayers::toggleLayer
static void toggleLayer(unsigned int layer)
Toggle Drawing Layer.
Definition: MapLayers.hxx:28
MapLayers::disableLayer
static void disableLayer(unsigned int layer)
Disable Drawing Layer.
Definition: MapLayers.hxx:21
MapLayers::~MapLayers
~MapLayers()=default
MapLayers::isLayerActive
static bool isLayerActive(unsigned int layer)
Check if given Layer is being drawn.
Definition: MapLayers.hxx:34
LayerEditMode
LayerEditMode
This enum is for switching between layers.
Definition: enums.hxx:45
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
MapLayers::MapLayers
MapLayers()=default