[Gambas-user] smooth animation using double buffering

Héctor Fernández López trorrr at ...397...
Fri Jun 18 10:47:35 CEST 2004


El Viernes, 18 de Junio de 2004 10:30, Héctor Fernández López escribió:
> 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?
>
Hello again, i continued with the app and it listen to keystrokes.  I try 
pressing for a long time the right arrow key and ten seconds later the 
spaceship moved!
Then i supposed that the problem was in timer1.delay.  In the last line of the 
Form_open sub in FDblBuf.class i changed timer1.delay from 16 to 60 i now it 
works fine, with less frames per second (15), but it's well playable.
>
> -------------------------------------------------------
> This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
> Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
> Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
> REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user





More information about the User mailing list