Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Creating an image  (Read 1313 times)

0 Members and 1 Guest are viewing this topic.

Nolan

  • Newbie
  • *
  • Posts: 6
    • View Profile
Creating an image
« 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]

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Creating an image
« Reply #1 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?
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

 

anything