How would I go about displaying an array of shapes. I am trying to make a game of snake and I need to create a grid which can be individually color changeable for obvious reasons. Here is the code with all the irrelevant bits cut out.
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <iostream>
int main()
{
int count = 0;
int count1 = 0;
sf::Shape grid[10][10];
int x1 = 120;
int y1 = 100;
int x2 = 100;
int y2 = 80;
sf::RenderWindow App(sf::VideoMode(800, 600), "Snake");
while (App.IsOpened())
{
App.Clear();
for(int xdot = 0; xdot < 10; xdot++)
for(int ydot = 0; ydot < 10; ydot++)
{
grid[xdot][ydot] = sf::Shape::Rectangle(x1 + xdot * 22, y1 + ydot * 22, x2 + xdot * 22, y2 + 22, sf::Color::Red);
}
App.Draw(grid); //That's really what I want to do though it's giving me a syntax error
App.Display();
}
return EXIT_SUCCESS;
}