moving a bitmap, fast and smooth [Archive] - C Board

PDA

View Full Version : moving a bitmap, fast and smooth


werdy666
05-29-2002, 09:09 AM
hi,

I am having major problems moving a simple bitmap across the screen fast and smooth. I think it has to do with timing but everything i try does not seem to work. I have read tutorials and searched message boards and still can't figure it out. I'm experiemnting with SDL but i don't believe its a problem with SDL. I have attached my code to demonstrate what i can't do!! lol

I want it to move at 1 pixel at a time to keep it smooth, but i would like it to move acroos the screen in like acouple of seconds. the only way i seem to be able to get it moving fast is to increase the pixels by 5 at a time, not 1. But this is way too jerky for my liking, I would like it smooth like most 2d games are!

Any help you can give would be very much appreciatted.

Werdy666:D

no-one
05-31-2002, 06:49 PM
two things,

one use an if statement to make sure it moves so far so fast,

like

if(gettime() > timetest)
move;

this tries to make it time based.

but then what if the system hitches and two timetests would have passed by the time it gets to this point?
what then?
move twice as much? or do a standard move and act like nothing happened? some other solution?

i leave that to you.

two im gonna assume bliting is the same as rasterizing, which IS SLOW!!! it is the one of the least accellerated things on most cards. so, what you will probably end up doing is drawing the 2d images on polygons as textures instead, this will be considerably faster.