La simu multi-agents qui repeint une image, mais en c++ Boilerplate pompé ici : https://github.com/andrew-r-king/sfml-vscode-boilerplate
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

PictureEnvironment.hpp 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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, bool iDisplayOriginal);
  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. void makeStraightRepaintAgents(int iNumber, int iDotSize, int iMoveSize);
  27. bool paint(int iX, int iY, const sf::Color Color);
  28. sf::Uint32 getCell(int iX, int iY);
  29. sf::Uint32 getCellOriginal(int iX, int iY);
  30. int getWidth();
  31. int getHeight();
  32. bool loop();
  33. void displayLockInput();
  34. private:
  35. bool fDisplayOriginal;
  36. PictureEnvironment();
  37. };
  38. #endif // PICTURE_ENVIRONMENT_H