Leviathan  0.8.0.0
Leviathan game engine
Leviathan::RenderingPositionSystem Class Reference

Moves nodes of entities that have their positions changed. More...

#include <Systems.h>

+ Inheritance diagram for Leviathan::RenderingPositionSystem:

Public Member Functions

template<class GameWorldT >
void Run (GameWorldT &world, const StateHolder< PositionState > &heldstates, int tick, int timeintick)
 
void CreateNodes (const std::vector< std::tuple< RenderNode *, ObjectID >> &firstdata, const std::vector< std::tuple< Position *, ObjectID >> &seconddata, const ComponentHolder< RenderNode > &firstholder, const ComponentHolder< Position > &secondholder)
 Creates nodes if matching ids are found in all data vectors or already existing component holders. More...
 
void DestroyNodes (const std::vector< std::tuple< RenderNode *, ObjectID >> &firstdata, const std::vector< std::tuple< Position *, ObjectID >> &seconddata)
 Destroys nodes if matching ids are found in the removed data data vectors. More...
 
- Public Member Functions inherited from Leviathan::SystemCachedComponentCollectionStorage< std::tuple< RenderNode &, Position & > >
void Clear ()
 
auto GetCachedComponentCollectionCount () const
 

Additional Inherited Members

- Public Types inherited from Leviathan::SystemCachedComponentCollectionStorage< std::tuple< RenderNode &, Position & > >
using HolderType = CachedComponentCollectionHolder< std::tuple< RenderNode &, Position &> >
 
- Static Public Member Functions inherited from Leviathan::SystemCachedComponentCollectionStorage< std::tuple< RenderNode &, Position & > >
static void TupleCachedComponentCollectionHelper (ObjectPool< std::tuple< FirstType &, SecondType & >, ObjectID > &CachedComponentCollections, const std::vector< std::tuple< FirstType *, ObjectID >> &firstdata, const std::vector< std::tuple< SecondType *, ObjectID >> &seconddata, const ComponentHolder< FirstType > &firstholder, const ComponentHolder< SecondType > &secondholder)
 Helper function for creating nodes based on std::tuple. More...
 
static void TupleCachedComponentCollectionHelper (ObjectPool< std::tuple< FirstType &, SecondType &, ThirdType & >, ObjectID > &CachedComponentCollections, const std::vector< std::tuple< FirstType *, ObjectID >> &firstdata, const std::vector< std::tuple< SecondType *, ObjectID >> &seconddata, const std::vector< std::tuple< ThirdType *, ObjectID >> &thirddata, const ComponentHolder< FirstType > &firstholder, const ComponentHolder< SecondType > &secondholder, const ComponentHolder< ThirdType > &thirdholder)
 Tree part component TupleCachedComponentCollectionHelper. More...
 
- Public Attributes inherited from Leviathan::SystemCachedComponentCollectionStorage< std::tuple< RenderNode &, Position & > >
HolderType CachedComponents
 
- Static Protected Member Functions inherited from Leviathan::SystemCachedComponentCollectionStorage< std::tuple< RenderNode &, Position & > >
static T * _TupleHelperGetIfComponentExists (ObjectID id, const std::vector< std::tuple< T *, ObjectID >> &addedlist, const ComponentHolder< T > &holder)
 

Detailed Description

Moves nodes of entities that have their positions changed.

Definition at line 32 of file Systems.h.

Member Function Documentation

◆ CreateNodes()

void Leviathan::RenderingPositionSystem::CreateNodes ( const std::vector< std::tuple< RenderNode *, ObjectID >> &  firstdata,
const std::vector< std::tuple< Position *, ObjectID >> &  seconddata,
const ComponentHolder< RenderNode > &  firstholder,
const ComponentHolder< Position > &  secondholder 
)
inline

Creates nodes if matching ids are found in all data vectors or already existing component holders.

Todo:
This should probably not be templated

Definition at line 75 of file Systems.h.

79  {
81  CachedComponents, firstdata, seconddata, firstholder, secondholder);
82  }
static void TupleCachedComponentCollectionHelper(ObjectPool< std::tuple< FirstType &, SecondType & >, ObjectID > &CachedComponentCollections, const std::vector< std::tuple< FirstType *, ObjectID >> &firstdata, const std::vector< std::tuple< SecondType *, ObjectID >> &seconddata, const ComponentHolder< FirstType > &firstholder, const ComponentHolder< SecondType > &secondholder)
Helper function for creating nodes based on std::tuple.
Definition: System.h:47

◆ DestroyNodes()

void Leviathan::RenderingPositionSystem::DestroyNodes ( const std::vector< std::tuple< RenderNode *, ObjectID >> &  firstdata,
const std::vector< std::tuple< Position *, ObjectID >> &  seconddata 
)
inline

Destroys nodes if matching ids are found in the removed data data vectors.

Definition at line 85 of file Systems.h.

87  {
90  }
void RemoveBasedOnKeyTupleList(const std::vector< std::tuple< Any, KeyType >> &values)
Destroys without releasing elements based on ids in vector.
Definition: ObjectPool.h:163

◆ Run()

template<class GameWorldT >
void Leviathan::RenderingPositionSystem::Run ( GameWorldT &  world,
const StateHolder< PositionState > &  heldstates,
int  tick,
int  timeintick 
)
inline

Definition at line 61 of file Systems.h.

63  {
64  auto& index = CachedComponents.GetIndex();
65  for(auto iter = index.begin(); iter != index.end(); ++iter) {
66 
67  this->ProcessNode(*iter->second, iter->first, heldstates, tick, timeintick);
68  }
69  }
std::unordered_map< KeyType, ElementType * > & GetIndex()
Returns a direct access to Index.
Definition: ObjectPool.h:227

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