Hosting courtesy of Sourceforge

SourceForge Logo
Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

PlayerController.h

Go to the documentation of this file.
00001 //
00002 //                                 PlayerController.h
00003 //                             -------------------
00004 //    begin                : Fri Apr 26 2002
00005 //    copyright            : (C) 2002 by Rob Renaud
00006 //    email                : rrenaud@eden.rutgers.edu
00007 //
00008 //   This program is free software; you can redistribute it and/or modify
00009 //   it under the terms of the GNU General Public License as published by
00010 //   the Free Software Foundation; either version 2 of the License, or
00011 //   (at your option) any later version.
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 }; // namespace Game
00086 
00087 #endif // ifndef PLAYER_CONTROLLER_H_

Generated on Tue May 21 07:26:51 2002 for BomberLAN by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001