mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 11:43:49 +00:00
Adds the Systems for the Entity-Component-Systems setup.
This commit is contained in:
parent
2e47c92c16
commit
8bd533e001
7 changed files with 666 additions and 9 deletions
30
Engine/source/T3D/systems/componentSystem.h
Normal file
30
Engine/source/T3D/systems/componentSystem.h
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#pragma once
|
||||
#include "console/engineAPI.h"
|
||||
|
||||
template<typename T>
|
||||
class SystemInterface
|
||||
{
|
||||
public:
|
||||
bool mIsEnabled;
|
||||
bool mIsServer;
|
||||
|
||||
static Vector<T*> all;
|
||||
|
||||
SystemInterface()
|
||||
{
|
||||
all.push_back((T*)this);
|
||||
}
|
||||
|
||||
virtual ~SystemInterface()
|
||||
{
|
||||
for (U32 i = 0; i < all.size(); i++)
|
||||
{
|
||||
if (all[i] == (T*)this)
|
||||
{
|
||||
all.erase(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
template<typename T> Vector<T*> SystemInterface<T>::all(0);
|
||||
Loading…
Add table
Add a link
Reference in a new issue