component controllers
This commit is contained in:
@@ -13,6 +13,7 @@ using Input::InputController;
|
||||
App::App( const AppProperties& props, const DisplayProperties& dispProps )
|
||||
: mDisplay()
|
||||
, mInput(InputController::GetInstance())
|
||||
, mEntityController( )
|
||||
{
|
||||
PushThisAsSink( "ENGINE_DISPLAY_CORE" );
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1,14 +1,47 @@
|
||||
#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>
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -6,10 +6,9 @@
|
||||
namespace EC
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
struct Entity
|
||||
{
|
||||
T id;
|
||||
uint32_t id;
|
||||
|
||||
inline bool operator==( const Entity& rhs )
|
||||
{
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user