SFML community forums

Help => Graphics => Topic started by: Nolan on June 24, 2011, 09:20:59 am

Title: Creating an image
Post by: Nolan on June 24, 2011, 09:20:59 am
Hello, I'm creating a platform game, and i've got everything working so far, but rendering the map is incredibly inefficient. I was wondering how I could speed things up, or just create an image and load that, instead of displaying every piece of the map every single time.

Code: [Select]
void InitBox(int x, int y, int Size,sf::Color Color)
{
Box.AddPoint(0, 0, Color,Color);
Box.AddPoint(Size, 0,Color,Color);
Box.AddPoint(Size, Size,Color,Color);
Box.AddPoint(0, Size,Color,Color);
Box.SetCenter(0,0);
Box.SetPosition(x,y);
Window.Draw(Box);
}


That's the function that I call to display each tile. What can I do to make my game more playable?[/code]
Title: Creating an image
Post by: Nexus on June 24, 2011, 10:47:18 am
What is Box? A sf::Shape object? Do you clear it or create a new object before you draw a tile?