[Gambas-user] smooth animation using double buffering
Héctor Fernández López
trorrr at ...397...
Fri Jun 18 10:30:55 CEST 2004
El Jueves, 17 de Junio de 2004 18:12, Rob escribió:
> 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
It's good, but keys doesn't work in my box. Maybe the app is taking so much
processor and doesn't listen to keystrokes. I am running it on a 500 mghz
and i have 50 frame per second, but i can't move the spaceship!! What could
i do?
More information about the User
mailing list