Nicolas Martyanoff <[EMAIL PROTECTED]> writes:

> 
> 
> Hi,
> 
> Using your advices, and thank to #lisp people, I finally succeeded a
> small lisp demo using the LispBuilder bindings of SDL, SDL-image, and
> SDL-ttf.
> 
> It's really simple, just a bunch of particles flying all over the
> screen, plus a bit of text rendering.
> 

I made a few modifications and managed increase the frame rate quite a bit.

Intel Core 2 1.86Ghz
NVIDIA GeForce 7600 GS

WinXP
Lispworks 5
lispbuilder-sdl 0.9.4

sdl-doublebuf sdl-hw-surface
640x480

Particles   Framerate
---------------------
   0           ~1,300
  10           ~1000
  50           ~460
 100           ~270
 250           133
 500           70
1000           35
2500           14
5000           7


Modifications:
 - Changed (require 'lispbuilder-sdl) to the equivalent ASDF command 
   allowing the code to work on other Common Lisp implementations.
 - Removed the dependency on lispbuilder-sdl-image.
   - Converted the PNG image to BMP.
 - Removed the dependency on lispbuilder-sdl-ttf.
 - Made use of the bitmap font rendering functions in lispbuilder-sdl.
 - Made use of the ability of a FONT object to internally cache a 
   text string rendered to a SDL surface. Drawing the same text to the 
   screen each frame then becomes an efficient blit.
 - Made use of the frames-per-second code built into the WITH-EVENTS macro.
   - These functions reflect a more accurate (and lower) frame rate than the 
     frames-per-second algorithm in your code as the average is 
     calculated over a sliding window of the previous 60 frames.

To run (main) in particles.lisp, change *IMG-PATH* to the location of the 
"particle.bmp" file. Code tested on SBCL Win32 / SBCL Ubuntu and Lispworks 5 on 
win32.

http://www.balooga.com/lisp/particles.zip

- Luke


_______________________________________________
Gardeners mailing list
[email protected]
http://www.lispniks.com/mailman/listinfo/gardeners

Reply via email to