Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

Controls.h

Go to the documentation of this file.
00001 #ifndef HEADER_CONTROLS_H
00002 #define HEADER_CONTROLS_H
00003 
00004 class V2;
00005 class Unit;
00006 class Cube;
00007 class PhaseLocker;
00008 class KeyStroke;
00009 class InputProvider;
00010 class MouseStroke;
00011 
00012 #include "NoCopy.h"
00013 #include "KeyControl.h"
00014 #include "StepCounter.h"
00015 
00016 #include <vector>
00017 #include <string>
00018 
00019 /**
00020  * Keyboard and mouse controls.
00021  */
00022 class Controls : public StepCounter, public NoCopy {
00023     private:
00024         typedef std::vector<Unit*> t_units;
00025         t_units m_units;
00026         t_units::iterator m_active;
00027         int m_speedup;
00028         KeyControl m_arrows;
00029         bool m_switch;
00030         std::string m_moves;
00031         PhaseLocker *m_locker;
00032         char m_strokeSymbol;
00033     private:
00034         bool useSwitch();
00035         bool useStroke();
00036         bool driveUnit(const InputProvider *input);
00037         void setActive(t_units::iterator active);
00038         int getNeededPhases(int speedup) const;
00039     public:
00040         Controls(PhaseLocker *locker);
00041         ~Controls();
00042         void addUnit(Unit *unit);
00043         const Unit *getActive();
00044 
00045         bool driving(const InputProvider *input);
00046         void lockPhases();
00047 
00048         void checkActive();
00049         void switchActive();
00050         bool makeMove(char move);
00051         bool cannotMove() const;
00052 
00053         void controlEvent(const KeyStroke &stroke);
00054         bool activateSelected(const Cube *occupant);
00055 
00056         virtual int getStepCount() const { return m_moves.size(); }
00057         virtual std::string getMoves() const { return m_moves; }
00058         virtual bool isPowerful() const;
00059 };
00060 
00061 #endif

Generated on Wed Jun 1 09:54:30 2005 for Fish Fillets - Next Generation by  doxygen 1.4.2