2012-07-20 01:08:29 +00:00
|
|
|
#ifndef _INPUTMANAGER_H_
|
|
|
|
#define _INPUTMANAGER_H_
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <SDL/SDL.h>
|
2012-07-22 21:15:55 +00:00
|
|
|
#include <map>
|
|
|
|
#include <string>
|
2012-07-20 01:08:29 +00:00
|
|
|
|
|
|
|
class GuiComponent;
|
|
|
|
|
2012-09-07 21:44:07 +00:00
|
|
|
//The InputManager takes native system input and abstracts it into InputButtons.
|
|
|
|
//GuiComponents can be registered to receive onInput() events.
|
2012-07-20 01:08:29 +00:00
|
|
|
namespace InputManager {
|
|
|
|
void registerComponent(GuiComponent* comp);
|
|
|
|
void unregisterComponent(GuiComponent* comp);
|
|
|
|
|
2012-07-23 23:53:33 +00:00
|
|
|
void loadConfig();
|
2012-07-20 01:08:29 +00:00
|
|
|
|
2012-07-22 21:15:55 +00:00
|
|
|
//enum for identifying input, regardless of configuration
|
2012-11-11 17:48:48 +00:00
|
|
|
enum InputButton { UNKNOWN, UP, DOWN, PAGEUP, PAGEDOWN, LEFT, RIGHT, BUTTON1, BUTTON2, MENU, SELECT};
|
2012-07-20 01:08:29 +00:00
|
|
|
|
|
|
|
void processEvent(SDL_Event* event);
|
|
|
|
|
|
|
|
extern std::vector<GuiComponent*> inputVector;
|
2012-07-22 21:15:55 +00:00
|
|
|
extern SDL_Event* lastEvent; //mostly for GuiInputConfig
|
2012-07-22 22:03:54 +00:00
|
|
|
extern int deadzone;
|
2012-07-23 23:53:33 +00:00
|
|
|
std::string getConfigPath();
|
2012-07-22 21:15:55 +00:00
|
|
|
|
|
|
|
extern std::map<int, InputButton> joystickButtonMap;
|
2012-07-23 17:27:38 +00:00
|
|
|
extern std::map<int, InputButton> joystickAxisPosMap, joystickAxisNegMap;
|
|
|
|
extern std::map<int, int> axisState;
|
2012-07-24 02:10:05 +00:00
|
|
|
extern InputButton hatState;
|
2012-07-20 01:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|