mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-06 16:18:58 +00:00
moving around some event handler code
creating inputcommon git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1766 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
b7f1e937bb
commit
90560511c9
11 changed files with 33 additions and 23 deletions
49
Source/Core/InputCommon/Src/EventHandler.h
Normal file
49
Source/Core/InputCommon/Src/EventHandler.h
Normal file
|
@ -0,0 +1,49 @@
|
|||
#ifndef EVENTHANDER_H
|
||||
#define EVENTHANDER_H 1
|
||||
#include "Common.h"
|
||||
#include <queue>
|
||||
#include "Event.hpp"
|
||||
|
||||
typedef bool (*listenFuncPtr) (sf::Event);
|
||||
enum InputType
|
||||
{
|
||||
KeyboardInput,
|
||||
MouseInput,
|
||||
JoystickInput
|
||||
};
|
||||
|
||||
enum Modifiers {
|
||||
UseAlt = 1,
|
||||
UseShift = 2,
|
||||
UseCtrl = 4
|
||||
};
|
||||
|
||||
struct Keys
|
||||
{
|
||||
InputType inputType;
|
||||
sf::Event::EventType eventType;
|
||||
sf::Key::Code keyCode;
|
||||
int mods;
|
||||
sf::Mouse::Button mouseButton;
|
||||
};
|
||||
|
||||
class EventHandler {
|
||||
|
||||
private:
|
||||
listenFuncPtr keys[sf::Key::Count][8];
|
||||
listenFuncPtr mouse[sf::Mouse::Count];
|
||||
listenFuncPtr joys[sf::Joy::Count];
|
||||
std::queue<sf::Event> eventQueue;
|
||||
public:
|
||||
bool RegisterEventListener(listenFuncPtr func, Keys key);
|
||||
bool RemoveEventListener(Keys key);
|
||||
void Update();
|
||||
bool addEvent(sf::Event *e);
|
||||
static bool TestEvent (Keys k, sf::Event e);
|
||||
#if defined HAVE_WX && HAVE_WX
|
||||
static sf::Key::Code wxCharCodeToSF(int id);
|
||||
#endif
|
||||
static void SFKeyToString(sf::Key::Code keycode, char *keyStr);
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue