Skip to content

Commit 145e136

Browse files
committed
finishing with some good ol' ctrl-shift-f
1 parent 77d4083 commit 145e136

File tree

4 files changed

+293
-230
lines changed

4 files changed

+293
-230
lines changed

include/GameView.h

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,63 +18,59 @@ class GameController;
1818
class ViewElement;
1919
class GameView;
2020

21-
22-
2321
/**
2422
* The class in charge of drawing the view to the screen, using OpenGL calls.
2523
*/
2624
class GameView {
2725
private:
2826
GameBoard& model;
29-
27+
3028
std::map<int, std::unique_ptr<ViewElement>> viewElements;
3129
std::vector<ScreenCoordinate> pointsOfInterest;
3230

3331
void highlightPoint(ScreenCoordinate & coord);
34-
32+
3533
std::string controlStateText;
3634

3735
GameView(const GameView& o) = delete;
3836
GameView& operator=(const GameView& o) = delete;
39-
37+
4038
public:
4139
GameView(GameBoard&);
4240
~GameView();
43-
41+
4442
void render();
4543
bool acceptInput(SDL_Event& event);
46-
47-
void setControlStateText(std::string newText);
4844

45+
void setControlStateText(std::string newText);
4946

5047
void addPointOfInterest(ScreenCoordinate);
5148
void clearPointsOfInterest();
5249
void addElement(std::unique_ptr<ViewElement> element);
5350
void addElement(int priority, std::unique_ptr<ViewElement>);
54-
5551

5652
std::unique_ptr<ViewElement> removeElement(int priority);
5753
std::unique_ptr<ViewElement> removeElement(const ViewElement*);
5854
std::unique_ptr<ViewElement> removeElement(const ViewElement&);
59-
60-
void drawCardCount(std::string font, int fontSize);
55+
56+
void drawCardCount(std::string font, int fontSize);
6157
void drawResourceCount(std::string font, int fontSize);
62-
bool showTotals;
58+
bool showTotals;
6359
};
6460

6561
/**
6662
* A visitor of the GameBoard hierarchy that draws the entire model.
6763
*/
68-
class DrawingGameVisitor : public GameVisitor {
64+
class DrawingGameVisitor: public GameVisitor {
6965
private:
7066
GameView& view;
71-
67+
7268
DrawingGameVisitor(const DrawingGameVisitor& o) = delete;
7369
DrawingGameVisitor& operator=(const DrawingGameVisitor& o) = delete;
7470
public:
7571
DrawingGameVisitor(GameView& view);
7672
~DrawingGameVisitor();
77-
73+
7874
virtual void visit(GameBoard&);
7975
virtual void visit(Road&);
8076
virtual void visit(Settlement&);
@@ -86,5 +82,4 @@ class DrawingGameVisitor : public GameVisitor {
8682
virtual void visit(Wonder&);
8783
};
8884

89-
9085
#endif

include/Renderer.h

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,25 @@
1313
void renderBoard(const GameBoard& board, const Player& perspective);
1414

1515
GLuint loadImageAsTexture(const std::string& name);
16-
GLuint loadTextAsTexture(const std::string& font, int fontSize, const std::string& text);
17-
18-
void renderText(const std::string& font, int fontSize, const std::pair<float, float> bottomLeft, const std::pair<float, float> topRight, const std::string& text);
19-
void renderText(const std::pair<float, float> bottomLeft, const std::pair<float, float> topRight, const GLuint& texture);
20-
void renderRectangle(const std::pair<float, float> bottomLeft, const std::pair<float, float> topRight, const std::tuple<float, float, float> color);
21-
22-
void renderTexturedCircle(const std::pair<float, float> texCenter, const float texRadius, const std::pair<float, float> screenCenter,
16+
GLuint loadTextAsTexture(const std::string& font, int fontSize,
17+
const std::string& text);
18+
19+
void renderText(const std::string& font, int fontSize,
20+
const std::pair<float, float> bottomLeft,
21+
const std::pair<float, float> topRight, const std::string& text);
22+
void renderText(const std::pair<float, float> bottomLeft,
23+
const std::pair<float, float> topRight, const GLuint& texture);
24+
void renderRectangle(const std::pair<float, float> bottomLeft,
25+
const std::pair<float, float> topRight,
26+
const std::tuple<float, float, float> color);
27+
28+
void renderTexturedCircle(const std::pair<float, float> texCenter,
29+
const float texRadius, const std::pair<float, float> screenCenter,
2330
const float screenRadius, const GLuint& texture, int articulation = 20);
24-
void renderTexturedRectangle(const std::pair<float, float> screenBottomLeft, const std::pair<float, float> screenTopRight,
25-
const std::pair<float, float> texBottomLeft, const std::pair<float, float> texTopRight, const GLuint& texture);
31+
void renderTexturedRectangle(const std::pair<float, float> screenBottomLeft,
32+
const std::pair<float, float> screenTopRight,
33+
const std::pair<float, float> texBottomLeft,
34+
const std::pair<float, float> texTopRight, const GLuint& texture);
2635

2736
std::pair<float, float> coordToScreen(const Coordinate& coord);
2837
Coordinate screenToCoord(const std::pair<float, float>&);
@@ -31,6 +40,7 @@ void vertexPair(const Coordinate& coord);
3140

3241
void texCoordPair(const std::pair<float, float>& p);
3342

34-
std::pair<float, float> averagePoint(const std::vector<std::pair<float, float>>& points);
43+
std::pair<float, float> averagePoint(
44+
const std::vector<std::pair<float, float>>& points);
3545

3646
#endif

0 commit comments

Comments
 (0)