La simu multi-agents qui repeint une image, mais en c++ Boilerplate pompé ici : https://github.com/andrew-r-king/sfml-vscode-boilerplate
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

PictureEnvironment.hpp 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #ifndef PICTURE_ENVIRONMENT_H
  2. #define PICTURE_ENVIRONMENT_H
  3. #include "Platform/Platform.hpp"
  4. #include <Agents/Perception/Perception.hpp>
  5. class Agent;
  6. class PictureEnvironment
  7. { // The class
  8. public: // Access specifier
  9. std::string fFilePath;
  10. sf::RenderWindow* fWindow;
  11. util::Platform* fPlatform;
  12. const sf::Vector2f fSize;
  13. sf::Vector2f fInitialSize;
  14. sf::Event fEvent;
  15. sf::RectangleShape fShape;
  16. sf::Texture fTextureImage;
  17. sf::Image fImage;
  18. sf::Image fOriginalImage;
  19. std::vector<std::unique_ptr<Agent>> fAgents;
  20. std::list<Agent>::iterator fAgentsIterator;
  21. PictureEnvironment(std::string& iFilePath, sf::RenderWindow* iWindow, util::Platform* iPlatform);
  22. void getPerception(Perception* ioPercept, int iX, int iY);
  23. void makeAgents(int iNumber, int iDotSize, int iMoveSize);
  24. void makeRepaintAgents(int iNumber, int iDotSize, int iMoveSize);
  25. void makePullPaintAgents(int iNumber, int iDotSize, int iMoveSize);
  26. bool paint(int iX, int iY, const sf::Color Color);
  27. sf::Uint32 getCell(int iX, int iY);
  28. sf::Uint32 getCellOriginal(int iX, int iY);
  29. int getWidth();
  30. int getHeight();
  31. bool loop();
  32. void displayLockInput();
  33. private:
  34. PictureEnvironment();
  35. };
  36. #endif // PICTURE_ENVIRONMENT_H