1
0
Fork 0

Input: remove InputEvent and InputListener and related code. Those are handled in System/Event

This commit is contained in:
Henrik Hautakoski 2020-02-01 15:47:55 +01:00
parent 3c209ba01b
commit cdaed77bf7
No known key found for this signature in database
GPG key ID: 96765B12FEAC4745
8 changed files with 0 additions and 161 deletions

View file

@ -1,54 +0,0 @@
#ifndef SPECTRE_INPUT_EVENT_H
#define SPECTRE_INPUT_EVENT_H
#include <string>
#include <vector>
#include <Spectre/Input/Mouse.h>
#include <Spectre/Input/Keyboard.h>
namespace sp {
typedef struct InputEvent
{
enum Type
{
None,
Key,
MouseButton,
MousePosition
};
struct KeyEvent {
Keyboard::Key code;
bool pressed; /* true if pressed, false if released. */
std::string getKeyName() const; /* Get the key name */
};
struct MouseButtonEvent {
Mouse::Button button;
bool pressed; /* true if pressed, false if released. */
std::string getName() const;
};
struct MouseEvent {
unsigned int x;
unsigned int y;
};
Type type;
union {
struct KeyEvent key;
struct MouseEvent mouse;
struct MouseButtonEvent mouseButton;
};
InputEvent(Type type = None);
} InputEvent;
} // namespace sp
#endif /* SPECTRE_INPUT_EVENT_H */

View file

@ -1,17 +0,0 @@
#ifndef SPECTRE_INPUT_LISTENER_H
#define SPECTRE_INPUT_LISTENER_H
#include "InputEvent.h"
namespace sp {
class InputListener
{
public :
virtual void onInputEvent(const InputEvent& event);
};
} // namespace sp
#endif /* SPECTRE_INPUT_LISTENER_H */

View file

@ -5,9 +5,6 @@
#include <deque>
#include <vector>
#include "InputListener.h"
#include "InputEvent.h"
namespace sp {
class Mouse;
@ -28,12 +25,6 @@ public :
void addInputDevice(InputDevice *device);
void registerListener(InputListener* listener);
void removeListener(InputListener* listener);
void postInputEvent(const InputEvent& event);
// NOTE: Update devices here! (for winapi, process keyboard/mouse messages)
void update();
@ -48,11 +39,6 @@ protected :
Keyboard *m_keyboard;
// Buffered input queue.
std::deque<InputEvent> m_buffer;
std::vector<InputListener*> m_listeners;
PlatformInput *m_platform;
};