KTech 1.1.0
C++ 2D terminal game engine library
Loading...
Searching...
No Matches
KTech::Map Class Reference

World structure that contains Layers and Cameras. More...

#include <map.hpp>

Public Member Functions

 Map (Engine &engine, std::string name="")
 Construct a Map.
 
virtual ~Map ()
 Remove all Layers and Cameras, then remove itself from Memory.
 
auto AddLayer (const ID< Layer > &layer) -> bool
 Add a Layer.
 
auto AddCamera (const ID< Camera > &camera) -> bool
 Add a Camera.
 
auto RemoveLayer (const ID< Layer > &layer) -> bool
 Remove a Layer.
 
auto RemoveCamera (const ID< Camera > &camera) -> bool
 Remove a Camera.
 
auto RemoveAllLayers () -> bool
 Remove all contained Layers.
 
auto RemoveAllCameras () -> bool
 Remove all contained Cameras.
 

Public Attributes

Engineengine
 Parent Engine.
 
const ID< Mapm_id {ID<Map>::Unique()}
 Personal ID.
 
std::string m_name
 String name.
 
std::vector< ID< Camera > > m_cameras = {}
 Contained Cameras.
 
std::vector< ID< Layer > > m_layers = {}
 Contained Layers.
 

Protected Member Functions

virtual auto OnTick () -> bool
 Virtual function called once each tick.
 

Friends

class KTech::Memory
 

Detailed Description

World structure that contains Layers and Cameras.

Constructor & Destructor Documentation

◆ Map()

KTech::Map::Map ( Engine & engine,
std::string name = "" )

Construct a Map.

Parameters
engineParent Engine.
nameString name.

Member Function Documentation

◆ AddCamera()

auto KTech::Map::AddCamera ( const ID< Camera > & camera) -> bool

Add a Camera.

Parameters
cameraThe ID of the Camera to add.
Returns
true if added the Camera. false if given Camera doesn't exist in Memory, or already in this Map.

◆ AddLayer()

auto KTech::Map::AddLayer ( const ID< Layer > & layer) -> bool

Add a Layer.

Parameters
layerThe ID of the Layer to add.
Returns
true if added the Layer. false if given Layer doesn't exist in Memory, or already in this Map.

◆ OnTick()

auto KTech::Map::OnTick ( ) -> bool
protectedvirtual

Virtual function called once each tick.

You can override this in your inherited class to add whatever functionality you want.

Called by Memory::CallOnTicks().

Returns
bool value, which is explained in Output::ShouldRenderThisTick().
See also
Memory::CallOnTicks()
Output::ShouldRenderThisTick()

◆ RemoveAllCameras()

auto KTech::Map::RemoveAllCameras ( ) -> bool

Remove all contained Cameras.

Returns
true if removed all Cameras. false if there are no Cameras in this Map.

◆ RemoveAllLayers()

auto KTech::Map::RemoveAllLayers ( ) -> bool

Remove all contained Layers.

Returns
true if removed all Layers. false if there are no Layers in this Map.

◆ RemoveCamera()

auto KTech::Map::RemoveCamera ( const ID< Camera > & camera) -> bool

Remove a Camera.

Parameters
cameraThe ID of the Camera to remove.
Returns
true if removed the Camera. false if the given Camera isn't contained by this Map.

◆ RemoveLayer()

auto KTech::Map::RemoveLayer ( const ID< Layer > & layer) -> bool

Remove a Layer.

Parameters
layerThe ID of the Layer to remove.
Returns
true if removed the Layer. false if the given Layer isn't contained by this Map.

The documentation for this class was generated from the following files: