component controllers

This commit is contained in:
benkyd
2022-06-08 15:56:36 +00:00
parent 27c8fe1291
commit 53a838ca20
7 changed files with 59 additions and 13 deletions

View File

@@ -13,6 +13,7 @@ using Input::InputController;
App::App( const AppProperties& props, const DisplayProperties& dispProps )
: mDisplay()
, mInput(InputController::GetInstance())
, mEntityController( )
{
PushThisAsSink( "ENGINE_DISPLAY_CORE" );

View File

@@ -44,10 +44,10 @@ public:
private:
Display mDisplay;
EC::EntityController& mEntityController;
EC::EntityRegistry mEntityController;
Input::InputController& mInput;
// Game layers from z orderxko285132046
// Game layers from z order
std::vector<GameLayer*> mGameLayers;
std::vector<GameLayer*> mTopLayers;
std::vector<GameLayer*> mDebugLayers;

View File

@@ -1,15 +1,48 @@
#ifndef AEON_ENTITY_COMPONENTCONTROLLER_H_
#define AEON_ENTITY_COMPONENTCONTROLLER_H_
#include <Aeon/includes.hpp>
#include <Aeon/Includes.hpp>
namespace EC
{
struct IComponentArr
{
};
template <typename TComponent>
struct ComponentArr : public IComponentArr
{
void Destroy();
};
class ComponentController
{
public:
ComponentController()
{
}
~ComponentController()
{
}
template <typename TComponent>
void Register()
{
const char* name = typeid(TComponent).name();
std::cout << name << std::endl;
}
private:
std::map<std::string, IComponentArr>
};
}

View File

@@ -6,10 +6,9 @@
namespace EC
{
template <typename T>
struct Entity
{
T id;
uint32_t id;
inline bool operator==( const Entity& rhs )
{

View File

@@ -1,4 +0,0 @@

View File

@@ -13,8 +13,14 @@ namespace EC
class EntityRegistry
{
public:
EntityRegistry();
~EntityRegistry();
EntityRegistry()
{
}
~EntityRegistry()
{
}
Entity& Create();
Entity& Copy(const Entity& entity);
@@ -47,7 +53,7 @@ public:
// std::vector<T&> Sort(std::function<;
private:
// std::map<Entity<uint32_t>, std::vector<
// std::map<Entity<uint32_t>, std::vector<g
};

View File

@@ -4,6 +4,8 @@
#include <Aeon/Core/Events.hpp>
#include <Aeon/Rendering/ImGui.hpp>
#include <Aeon/Entity/ComponentController.hpp>
class BackgroundLevel : public Core::GameLayer {
};
@@ -104,8 +106,17 @@ public:
};
struct GenericComponent
{
int x,y;
};
int main( int argc, char** argv )
{
EC::ComponentController cController;
cController.Register<GenericComponent>();
ExampleGame game;
return 0;