Well, I have cut down the code as much as I possibly can and I have spent...a long time trying to work out what the problem is. I'm not quite sure if this is a C++ problem or an SFML problem. Anyway, here is the cut down version that doesn't work. It's saying it has an access violation at <massive bunch of number>. Tell me if you need the massive bunch of numbers or the exact output of the error thing.
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
int main()
{
int gridx = 10;
int gridy = 10;
int x1 = 120;
int y1 = 100;
int x2 = 100;
int y2 = 80;
sf::Shape grid[10][10]; //The grid on which everything is drawn
sf::RenderWindow App(sf::VideoMode(800, 600), "Snake");
while (App.IsOpened())
{
int xdot = gridx;
int ydot = gridy;
//Draw it
for (xdot = gridx; xdot > 0; xdot--)
for (ydot = gridy; ydot > 0; ydot--)
{
grid[xdot][ydot] = sf::Shape::Rectangle(x1 + xdot * 22, y1 + ydot * 22, x2 + xdot * 22, y2 + ydot * 22, sf::Color::Red);
App.Draw(grid[xdot][ydot]);
}
App.Display();
}
return EXIT_SUCCESS;
}