trial

Started by
1 comment, last by Shuger 18 years ago
Hi everyone! I wanted to ask you how to erase trial after moving image in SDL. I've tried do do it this order: 1.move the image(xpos, ypos) 2.draw everything a)redraw background oldxpos, odypos b)draw image xpos, ypos 3 oldxpos=xpos oldypos=ypos And all is looped. The problem is that background is redrawed in exact position of the image, not it last position. Hope you know what i mean. I also wanted to ask if directdraw is better then SDL, and what i need to have to use directX in general(i know about directx sdk but maybe there are some other importan libraries as well)?
Advertisement
Quote:Original post by Shuger
Hi everyone!

I wanted to ask you how to erase trial after moving image in SDL. I've tried do do it this order:

1.move the image(xpos, ypos)
2.draw everything
a)redraw background oldxpos, odypos
b)draw image xpos, ypos
3 oldxpos=xpos
oldypos=ypos

And all is looped. The problem is that background is redrawed in exact position of the image, not it last position.
Hope you know what i mean.

I also wanted to ask if directdraw is better then SDL, and what i need to have to use directX in general(i know about directx sdk but maybe there are some other importan libraries as well)?
I don't see the problem with your first question, it should work fine. If you redraw the entire background, then draw the image, does it work?

As for your second question: Don't use DirectDraw, unless it's just out of curiosity. It's old technology. If anything, go for Direct3D / OpenGL.
SDL uses DirectDraw internally on Windows anyway, so the performance wouldn't differ much. Going 3D (Direct3D or OpenGL) would probably increase your performance and make everything easier in the end (Although it'll take a while to get used to it).
Thanks Evil Steve, since i've checked the whole code many times in order to find what's the problem i'm almost 100% sure that code is good and i thought that maybe i placed functions in wrong order, but if you say it's good i'm gonna check the code again, & again, & again...

I tried to redraw whole background,it works but it slows game 2 times(from 50 to 25fps).


As for your suggestion, I wanted to move to 3d but i wanted to complete current project first so i could get some more experience with C++. But i'll maybe try using 3d if you say it's better.

This topic is closed to new replies.

Advertisement