hello everybody!
first, i'd like to thank the creator and contributors of this library. it's really easy to understand, and is helping me a lot in learning on how to make a game.
then, i have a question that i believe it's simple.
i have loaded a texture and then created a sprite. this sprite is a tile, so i draw it a lot of times in the screen. then i update the screen, and draw all over again.
the problem is that the screen blinks every time it draws the tiles. (it blinks all tiles at once, and not one at time)
i don't know what could be wrong.
this is how i made it:
#include "head.h"
int main(){
sf::RenderWindow window(sf::VideoMode (480, 480), "Jogo2");
window.setFramerateLimit(60);
Mapa mapa;
mapa.criarMapa();
for (int i = 0; i<100; i++){
window.clear();
mapa.desMapa(&window); //[b]see note below for this[/b]
sf::sleep(sf::milliseconds(10));
window.display();
}
system("pause");
return 0;
}
note: the line mapa.desMapa(&window) draws the tiles on the screen. it does the following:
window->draw(sChaoPedr); //
draw the sprite sChaoPedr.setPosition(mapX*48, mapY*48); //
set the sprite positionfor each tile.
for some reason, it seems that window.display()
clears the screen! after this comand, the screen turns black. i don't know why.
do i have to create one sprite for each tile?
if anyone thinks the error is somewhere else, please let me know, so i'll put the whole code.
i'm working on windows 7 SP1, SFML 2.0rc, Code::Blocks 10.05 (and the default mingw and gcc shipped with it).
thanks in advance