[ad_1]
I’m trying to develop a platformer-like, but i’m stuck in the way i’m displaying all my textures.
Pseudo-code:
Texture background = bg.png
Texture player = player.png
display(background)
while (run)
if (player.moved)
player.refresh = true
if (player.refresh)
display(player)
Globally i’m doing like this to display my textures.
But when i’m moving my player (left, right etc.) the old texture of this one is always displayed.
everywhere i’m searching how to do it, i see people doing this :
Texture background = bg.png
Texture player = player.png
while (run)
display(background)
display(player)
They always blit all their textures, but it’s absolutely not optimised. they blit texture that havn’t moved.
So can someone tell me the good way to blit and refresh textures ?
[ad_2]