RTS2D
include/gamestate/PlayingState.h
00001 #ifndef PLAYINGSTATE_H
00002 #include <stack>
00003 #include "State.h"
00004 #include "Game.h"
00005 #include "Graph.h"
00006 #include "Entity.h"
00007 #include "Unit.h"
00008 #include "Building.h"
00009 #include "Gui.h"
00010 #include "nihgui.h"
00011 #include "Mymath.h"
00012 #include "UnitProperty.h"
00013 #include "Collision.h"
00014 #include "AI.h"
00015 #define PLAYINGSTATE_H
00016 
00020 class PlayingState : public State {
00021 public:
00022     PlayingState(ALLEGRO_DISPLAY* display, ALLEGRO_TIMER* timer, ALLEGRO_EVENT_QUEUE* queue);
00023     static PlayingState* getInstance(ALLEGRO_DISPLAY* display, ALLEGRO_TIMER* timer, ALLEGRO_EVENT_QUEUE* queue) {
00024         if (instance == NULL) {
00025             instance = new PlayingState(display, timer, queue);
00026         }
00027         return instance;
00028     }
00029     virtual ~PlayingState();
00030     void init();
00031     void restartGame();
00032     void setGame(Game* game);
00033     void readInput(StateManager* sm);
00034     void update(StateManager* sm);
00035     void render(StateManager* sm);
00036     void executeCommand(std::string com);
00037     void runCommand(std::string com);
00038     void runCommand(std::string com, float px, float py);
00039     void changeState(int newState);
00040 
00041 protected:
00042 private:
00043     static PlayingState* instance;
00044     Game* game_;
00045     Map* map_;
00046     ALLEGRO_FONT* font_gui;
00047     Gui* gui;
00048     Theme* theme;
00049     int fps;
00050     int fps_accum;
00051     double fps_time;
00052     float selectSX;
00053     float selectSY;
00054     float selectFX;
00055     float selectFY;
00056     int mouse;
00057     float mousex, mousey;
00058     float zoom, rotate;
00059     float scroll_x, scroll_y;
00060     Collision* collision;
00061     void updateUnit();
00062     void updateCollision();
00063     void updateAttack();
00064     void updatePointer();
00065     void updateHp();
00066     void updateBuilding();
00067     void updateWorker();
00068     void updateIteration();
00069     void updateProjectile();
00070     Player* getWinner();
00071 
00072     void sharedInput(StateManager* sm, ALLEGRO_EVENT event);
00073     void idleInput(StateManager* sm, ALLEGRO_EVENT event);
00074     void selectUnitInput(StateManager* sm, ALLEGRO_EVENT event);
00075     void selectBuildingInput(StateManager* sm, ALLEGRO_EVENT event);
00076     void targetInput(StateManager* sm, ALLEGRO_EVENT event);
00077 
00078     void renderArrow(int px, int py, int x, int y, ALLEGRO_COLOR color);
00079     std::vector<Unit*> select;
00080     Building* selectBuilding;
00081     std::stack<int> action_state;
00082     int buildingID; // Só ta servindo pra renderizar a construcao no mouseover
00083     std::string command;
00084 
00085     AI** ai;
00086 };
00087 
00088 #endif // PLAYINGSTATE_H
 Todos Classes Funções