Skip to content

Commit 5528436

Browse files
committed
Added some more comments
1 parent bf503a5 commit 5528436

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/GameView.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,11 @@ void GameView::render() {
121121
DrawingGameVisitor visitor(*this);
122122
model.accept(visitor);
123123

124+
//Render UI items
124125
for(auto it = viewElements.rbegin(); it != viewElements.rend(); it++) {
125126
it->second->render();
126127
}
128+
//Render clicked points
127129
for(auto& it : pointsOfInterest) {
128130
highlightPoint(it);
129131
}
@@ -146,20 +148,34 @@ void GameView::render() {
146148
glFlush();
147149
}
148150

151+
/**
152+
* Pushes a coordinate into the points of interest history to be highlighted on screen
153+
* @param coord the point of interest to add
154+
*/
149155
void GameView::addPointOfInterest(ScreenCoordinate coord){
150156
pointsOfInterest.push_back(coord);
151157
}
152158

159+
/**
160+
* Clears the points of interest history, so those points will no longer be highlighted.
161+
*/
153162
void GameView::clearPointsOfInterest(){
154163
pointsOfInterest.clear();
155164
}
156165

166+
/**
167+
* Highlights a coordinate with a small blue square
168+
* @param coord the coordinate to be highlighted on screen
169+
*/
157170
void GameView::highlightPoint(ScreenCoordinate & coord){
158171
std::tuple<float,float,float> color(0.f,0.f,1.f);
159172
renderRectangle({coord.first - .01, coord.second - .01}, {coord.first + .01, coord.second + .01}, color);
160173
}
161174

162-
175+
/**
176+
* Sets the text to be displayed at the top of the screen
177+
* @param newText the new text to be displayed on screen. An empty string will cause a crash.
178+
*/
163179
void GameView::setControlStateText(std::string newText){
164180
controlStateText = newText;
165181
}

0 commit comments

Comments
 (0)