]> git.jsancho.org Git - gacela.git/commitdiff
Store all events when lag is produced
authorJavier Sancho <jsf@jsancho.org>
Mon, 27 Mar 2017 22:56:26 +0000 (00:56 +0200)
committerJavier Sancho <jsf@jsancho.org>
Mon, 27 Mar 2017 22:56:26 +0000 (00:56 +0200)
gacela/event.scm
gacela/game.scm

index 04223971108da1a33c1cb4980f41d85aed63b652..720e4fd21c0e1d2a4f283cc9315123fa34494edb 100644 (file)
@@ -18,6 +18,7 @@
 (define-module (gacela event)
   #:use-module ((sdl2 events) #:prefix sdl2:)
   #:export (process-events
+            clear-events
            quit-event?
            key-events
            any-key-down?
          (else
           '()))))
 
+(define (clear-events)
+  (set! *current-events* '()))
+
 (define (process-events)
-  (set! *current-events* (poll-events)))
+  (set! *current-events* (append *current-events* (poll-events))))
 
 (define (quit-event?)
   (not (null? (filter (lambda (e) (sdl2:quit-event? e)) *current-events*))))
index e8e635a51b0ad632dc3662a124702e14f0b979ce..fe5f0b3a1cfdc993d413ee9371f29c02b04a7fc0 100644 (file)
@@ -82,6 +82,7 @@ unused accumulator time."
               (iter (- lag tick-interval) (1+ ticks)))
              (else
               lag)))
+      (clear-events)
       (iter lag 0))
 
     (define (alpha lag)