[Gambas-user] smooth animation using double buffering

Benoit Minisini gambas at ...1...
Thu Jun 17 19:41:04 CEST 2004


On Thursday 17 June 2004 18:12, Rob wrote:
> I've had a theory for a while that Qt should be fast enough at
> redrawing to let you do double buffered animation, and I was
> right.  Here's the beginnings of a simple space shooter
> (inspired by the old Videopac/Odyssey2 game Freedom Fighters)
> which I mean to use as an example of various gambas game-related
> techniques.  Right now it covers these, albeit not very well
> commented:
>
> - timer-based game "kernel"
> - smooth movement of a "sprite" around the screen using double
> buffering
> - use of regular and static classes with no exposed methods as
> user defined data types
> - scrolling of a background larger than the screen
> - fractional positioning, acceleration, momentum
> - video game style key handling (some are held down, some must be
> pressed and released repeatedly)
>
> There's no enemies or sound effects yet, all you can do is fly
> through space (arrow keys) and shoot (space) and look at the fps
> counter, but I wanted to get it out there to give people some
> ideas.  There's really no reason you couldn't do a whole UI like
> this if you could be sure it were running on a reasonably fast
> box.  I assume some of these techniques will still apply once
> the graphic part of SDL gets into the gb.sdl component, and
> performance ought to be better then too.
>
> Of course, doing this sort of thing in an interpreted language
> has its price, and in this case the price is that I only get 30
> frames a second when my laptop's on battery (running around
> 400-500MHz.) :)
>
> Rob

Cool. It will be a good example.

Can you make it bigger (640 x 480 for example) ?

Regards,

-- 
Benoit Minisini
mailto:gambas at ...1...




More information about the User mailing list