-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathWalls.h
41 lines (30 loc) · 914 Bytes
/
Walls.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#pragma once
/*
Class to generate walls for the Grid (maze)
*/
#include <SFML/Graphics.hpp>
#include <vector>
#include "Grid.h"
#define PURPLE sf::Color(148, 0, 211)
class Walls
{
public:
Walls() {}
Walls(Grid* grid, sf::Color color = PURPLE) { Init(grid, color); }
Walls(Grid* grid, sf::Texture& tex) { Init(grid, tex); }
~Walls() {}
// loading coloured rectangles
void Init(Grid* grid, sf::Color color = PURPLE);
// loading textures
void Init(Grid* grid, sf::Texture& tex);
// draws in two parts so that player can go over and under it dpending on position (pseudo 3d effect)
void drawTo1(sf::RenderWindow* app, sf::Vector2f pos);
void drawTo2(sf::RenderWindow* app);
private:
// vector of rects representing the walls
std::vector <sf::RectangleShape> rects;
std::vector <sf::Sprite> sprites;
Grid* grid;
// keeps track of how much is drawn on first draw
int secondDrawStart = 0;
};