Powerup.hpp 815 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #pragma once
  2. #include <SFML/Graphics.hpp>
  3. using namespace sf;
  4. class Map;
  5. class Player;
  6. class Powerup: public Sprite
  7. {
  8. public:
  9. Powerup(std::vector<Texture>* textures);
  10. const int getType() const;
  11. static const int count = 4;
  12. enum {
  13. Haste = 0, Fatman, Steroids, RateOfFire
  14. };
  15. private:
  16. int _type;
  17. };
  18. class PowerupManager: public Drawable
  19. {
  20. public:
  21. PowerupManager(Map* map);
  22. void registerPlayer(Player* player);
  23. void deregisterPlayer(Player* player);
  24. void logic();
  25. const unsigned getSize() const;
  26. const Powerup& getPowerup(unsigned i) const;
  27. private:
  28. Map* _map;
  29. std::vector<Player*> _ptr;
  30. std::vector<Powerup> _powerups;
  31. std::vector<Texture> _decentlyAllocatedTextures;
  32. void collision();
  33. virtual void draw(RenderTarget& target, RenderStates states) const; /// Rendering is also decently done.
  34. };