some code fix

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1796 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
nakeee
2009-01-05 17:46:36 +00:00
parent a533a9dc3d
commit f156361104
5 changed files with 56 additions and 43 deletions

View File

@ -4,6 +4,9 @@
#include <queue>
#include "Event.hpp"
#define NUMKEYS 300
#define NUMMODS 8
typedef bool (*listenFuncPtr) (sf::Event);
enum InputType
{
@ -18,8 +21,7 @@ enum Modifiers {
UseCtrl = 4
};
struct Keys
{
struct Keys {
InputType inputType;
sf::Event::EventType eventType;
sf::Key::Code keyCode;
@ -30,20 +32,21 @@ struct Keys
class EventHandler {
private:
listenFuncPtr keys[sf::Key::Escape+1][8];
listenFuncPtr keys[NUMKEYS][NUMMODS];
listenFuncPtr mouse[sf::Mouse::Count+1];
listenFuncPtr joys[sf::Joy::Count+1];
std::queue<sf::Event> eventQueue;
public:
static EventHandler *m_Instance;
// protected:
protected:
EventHandler(const EventHandler&);
EventHandler& operator= (const EventHandler&);
EventHandler();
~EventHandler();
public:
bool RegisterEventListener(listenFuncPtr func, Keys key);
bool RemoveEventListener(Keys key);
void Update();