Add ecs ComponentListener
- Add ecs ComponentListener which listens to Component addition and removal - Add RefCounter class used to keep track of moves and copies
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#include "copium/ecs/System.h"
|
||||
#include "copium/example/Components.h"
|
||||
#include "copium/event/Input.h"
|
||||
|
||||
namespace Copium
|
||||
{
|
||||
class HealthChangeSystem : public System<HealthC>
|
||||
{
|
||||
|
||||
void RunEntity(Entity entity, HealthC& health) override
|
||||
{
|
||||
if (Input::IsKeyPressed(CP_KEY_K))
|
||||
health.current++;
|
||||
if (Input::IsKeyPressed(CP_KEY_J))
|
||||
health.current--;
|
||||
health.current = std::clamp(health.current, 0, health.max);
|
||||
}
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user