Files
Copium/CopiumEngine/src/copium/example/HealthChangeSystem.h
T
Thraix 3ec9bcd152 Add ecs ComponentListener
- Add ecs ComponentListener which listens to Component addition and
  removal
- Add RefCounter class used to keep track of moves and copies
2023-05-29 17:49:37 +02:00

22 lines
472 B
C++

#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);
}
};
}