12 int realWinWidth = windowWidth - (2 * 10);
13 int rectWidth, rectHeight;
14 rectWidth = realWinWidth / 20;
15 rectHeight = windowHeigh / (3 * 8);
17 for (
int y = 10; y < rectHeight * 8; y += rectHeight) {
18 std::vector<std::shared_ptr<Brique>> v1;
19 for (
int x = 10; x < realWinWidth; x += rectWidth) {
20 v1.push_back(std::make_shared<Rectangle>(x,y,rectWidth,rectHeight));
27 int usableWidth = windowWidth - (2 * 10);
28 int hexWidth = windowWidth / 20;
29 int hexSize = hexWidth / 2;
30 int hexHeight = sqrt(3.0) * hexSize;
32 int startPos = 10 + hexSize;
34 int ecart = hexWidth - 5;
36 for (
int y = startPos; y < hexWidth * 5; y += hexWidth) {
37 std::vector<std::shared_ptr<Brique>> v1;
38 for (
int x = startPos+3; x < windowWidth - hexSize; x += (2 * hexWidth)-10) {
39 v1.push_back(std::make_shared<Hexagon>(x,y,hexWidth,hexWidth+4,6));
42 std::vector<std::shared_ptr<Brique>> v2;
43 for (
int x = startPos-3; x < windowWidth - hexSize; x += (2 * hexWidth)-10) {
44 v2.push_back(std::make_shared<Hexagon>( x + hexWidth, y + hexWidth / 2, hexWidth, hexWidth + 4,6));
52 int triHeight = windowHeigh/20, triWidth = (windowWidth)/20;
54 for (
int y=startPos; y<5*triWidth; y+=triWidth) {
55 std::vector<std::shared_ptr<Brique>> v1;
56 for (
int x=startPos; x<windowWidth-20-triWidth; x+=triWidth) {
57 v1.push_back(std::make_shared<Triangle>(x, y, triWidth, triWidth,
true));
58 v1.push_back(std::make_shared<Triangle>(x+triWidth/2, y, triWidth, triWidth,
false));
67 for (
const auto& row :
grille) {
68 for (
const auto& brique : row) {
69 if (!brique->collided){
70 brique->render(renderer,{255,0,0,255},{255,0,0,255});
std::vector< std::vector< std::shared_ptr< Brique > > > grille
The grid of blocks/bricks.
void render(std::shared_ptr< SDL_Renderer > renderer)
Renders the grid of blocks/bricks on the screen.
Grille(int windowWidth, int windowHeight, TYPE type)
Constructs a new Grille object with specified parameters.