|
@@ -23,7 +23,6 @@ PictureEnvironment::PictureEnvironment(std::string& iFilePath, sf::RenderWindow*
|
23
|
23
|
fImage = fTextureImage.copyToImage();
|
24
|
24
|
|
25
|
25
|
//memccpy(&fFilePath, &iFilePath, *iFilePath., 10);
|
26
|
|
- std::cout << "Environement pour " << fFilePath;
|
27
|
26
|
fPlatform = iPlatform;
|
28
|
27
|
fWindow = iWindow;
|
29
|
28
|
float screenScalingFactor = fPlatform->getScreenScalingFactor(fWindow->getSystemHandle());
|
|
@@ -47,19 +46,6 @@ Perception PictureEnvironment::getPerception(int iX, int iY)
|
47
|
46
|
return vPerception;
|
48
|
47
|
}
|
49
|
48
|
|
50
|
|
-void PictureEnvironment::makeAgents(int iNumber)
|
51
|
|
-{
|
52
|
|
- Agent vTmpAgent;
|
53
|
|
- fAgents = std::list<Agent>(iNumber);
|
54
|
|
- fAgentsIterator = fAgents.begin();
|
55
|
|
-
|
56
|
|
- for (int i = 0; i < iNumber; i++)
|
57
|
|
- {
|
58
|
|
- vTmpAgent = Agent(this);
|
59
|
|
- fAgents.insert(fAgentsIterator, vTmpAgent);
|
60
|
|
- }
|
61
|
|
-}
|
62
|
|
-
|
63
|
49
|
bool PictureEnvironment::loop()
|
64
|
50
|
{
|
65
|
51
|
if (fWindow->isOpen())
|
|
@@ -69,13 +55,16 @@ bool PictureEnvironment::loop()
|
69
|
55
|
if (fEvent.type == sf::Event::Closed)
|
70
|
56
|
fWindow->close();
|
71
|
57
|
}
|
72
|
|
-
|
73
|
|
- fAgentsIterator = fAgents.begin();
|
74
|
|
- for (uint i = 0; i < fAgents.size(); i++)
|
|
58
|
+ // fAgentsIterator = fAgents.begin();
|
|
59
|
+ std::list<Agent>::iterator vAgentsIterator = fAgents.begin();
|
|
60
|
+ fAgents.begin();
|
|
61
|
+ while (vAgentsIterator != fAgents.end())
|
75
|
62
|
{
|
76
|
|
- fAgentsIterator->loop();
|
77
|
|
- }
|
78
|
63
|
|
|
64
|
+ //std::cout << "loop" << vAgentsIterator->fColor->toInteger() << " at " << &vAgentsIterator << "\n";
|
|
65
|
+ vAgentsIterator->loop();
|
|
66
|
+ vAgentsIterator++;
|
|
67
|
+ }
|
79
|
68
|
fTextureImage.loadFromImage(fImage);
|
80
|
69
|
fShape.setTexture(&fTextureImage);
|
81
|
70
|
fWindow->clear();
|
|
@@ -90,6 +79,37 @@ bool PictureEnvironment::loop()
|
90
|
79
|
return true;
|
91
|
80
|
}
|
92
|
81
|
|
|
82
|
+int PictureEnvironment::getHeight()
|
|
83
|
+{
|
|
84
|
+ return fImage.getSize().y;
|
|
85
|
+}
|
|
86
|
+
|
|
87
|
+int PictureEnvironment::getWidth()
|
|
88
|
+{
|
|
89
|
+ return fImage.getSize().x;
|
|
90
|
+}
|
|
91
|
+
|
|
92
|
+void PictureEnvironment::makeAgents(int iNumber)
|
|
93
|
+{
|
|
94
|
+
|
|
95
|
+ fAgents = std::list<Agent>();
|
|
96
|
+
|
|
97
|
+ for (int i = 0; i < iNumber; i++)
|
|
98
|
+ {
|
|
99
|
+ Agent vTmpAgent = Agent(this);
|
|
100
|
+ fAgents.push_back(vTmpAgent);
|
|
101
|
+ //std::cout << "pushback" << vTmpAgent.fColor.toInteger() << " at " << &vTmpAgent << "\n"
|
|
102
|
+ // << " size : " << fAgents.size() << "\n";
|
|
103
|
+ }
|
|
104
|
+ std::list<Agent>::iterator vAgentsIterator = fAgents.begin();
|
|
105
|
+ while (vAgentsIterator != fAgents.end())
|
|
106
|
+ {
|
|
107
|
+
|
|
108
|
+ //std::cout << "loop" << vAgentsIterator->fColor->toInteger() << " at " << &vAgentsIterator << "\n";
|
|
109
|
+ vAgentsIterator++;
|
|
110
|
+ }
|
|
111
|
+}
|
|
112
|
+
|
93
|
113
|
void PictureEnvironment::displayLockInput()
|
94
|
114
|
{
|
95
|
115
|
fWindow->create(sf::VideoMode(fInitialSize.x, fInitialSize.y), "Last peek");
|