Adding basic keyboard input

This commit is contained in:
Dynamitos
2023-11-17 22:31:26 +01:00
parent 897eda18b0
commit ec760e8deb
18 changed files with 167 additions and 90 deletions
+31
View File
@@ -0,0 +1,31 @@
#pragma once
#include "ComponentSystem.h"
#include "Component/KeyboardInput.h"
namespace Seele
{
namespace System
{
class KeyboardInput : public ComponentSystem<Component::KeyboardInput>
{
public:
KeyboardInput(PScene scene);
virtual ~KeyboardInput();
virtual void update(Component::KeyboardInput& input) override;
void keyCallback(KeyCode code, InputAction action, KeyModifier modifier);
void mouseCallback(double xPos, double yPos);
void mouseButtonCallback(MouseButton button, InputAction action, KeyModifier modifier);
private:
Seele::StaticArray<bool, (size_t)KeyCode::KEY_LAST> keys;
bool mouse1 = false;
bool mouse2 = false;
float lastMouseX = 0;
float lastMouseY = 0;
float mouseX = 0;
float mouseY = 0;
float deltaX = 0;
float deltaY = 0;
};
DEFINE_REF(KeyboardInput)
}
}