00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef PLAYER_CONTROLLER_H_
00015 #define PLAYER_CONTROLLER_H_
00016
00017 #include "../Config.h"
00018 #include "Constants.h"
00019 #include "../Parse/ListParser.h"
00020 #include "SDL.h"
00021
00022 #include <vector>
00023 #include <list>
00024
00025 namespace Game {
00026
00030 class ReadKey: public Parse::ParseAction {
00031 public:
00032 ReadKey(SDLKey& key);
00033 void getValue(std::istream& in);
00034 private:
00035 SDLKey& key;
00036 };
00037
00039 class PlayerController : public Parse::Parseable {
00040 public:
00045 virtual bool actionIsEnabled(PlayerAction action)=0;
00046 virtual ~PlayerController() { }
00047 };
00048
00050 class KeyboardController : public PlayerController {
00051 public:
00052 bool actionIsEnabled(PlayerAction action);
00053 Parse::Parser* makeParserToParseMe(std::istream& in);
00054 virtual ~KeyboardController() { }
00055 private:
00056 SDLKey right;
00057 SDLKey left;
00058 SDLKey down;
00059 SDLKey up;
00060 SDLKey bomb;
00061 };
00062
00064 class JoystickController : public PlayerController {
00065 public:
00066 virtual ~JoystickController() { }
00067 bool actionIsEnabled(PlayerAction action);
00068 Parse::Parser* makeParserToParseMe(std::istream& in);
00069 void setJoystick(SDL_Joystick* j);
00070 private:
00071 SDL_Joystick* joy;
00072 int bombButton;
00073 };
00074
00075 class JoyPortOpener: public Parse::ParseAction {
00076 public:
00077 JoyPortOpener(JoystickController* jc);
00078 void getValue(std::istream& in);
00079 void finishingAction();
00080 private:
00081 JoystickController* joyController;
00082 int index;
00083 };
00084
00085 };
00086
00087 #endif // ifndef PLAYER_CONTROLLER_H_