SapphireDensetsu / ypsilon

Automatically exported from code.google.com/p/ypsilon
Other
0 stars 0 forks source link

jello sample bad responsiveness #149

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Not a bug really.
Jello example shows bad responsiveness because handle-event function process 
only one input event at a time.
Better would be to process all events, sort of this:

--- jello.orig.scm  2011-04-15 16:37:06.000000000 +0300
+++ jello.scm   2011-04-15 20:07:58.000000000 +0300
@@ -827,6 +827,7 @@

   (define handle-event
     (lambda ()
+     (let loop ()
       (when (> (SDL_PollEvent event) 0)
         (let ((type (SDL_Event-type event)))
           (cond ((= type SDL_MOUSEBUTTONDOWN) (exit-game 0))
@@ -853,7 +854,8 @@
                          ((< x (- 640 paddle-width))
                           (set! paddle-x x))
                          (else
-                          (set! paddle-x (- 640 paddle-width)))))))))))
+                          (set! paddle-x (- 640 paddle-width))))))))
+        (loop)))))

   (define game-main
     (lambda ()

Original issue reported on code.google.com by vladimir...@gmail.com on 15 Apr 2011 at 6:08