From b463d97fdd8afd06f987f5f13ab73b9502e2421b Mon Sep 17 00:00:00 2001 From: Javier Sancho Date: Tue, 28 Mar 2017 00:56:26 +0200 Subject: [PATCH] Store all events when lag is produced --- gacela/event.scm | 6 +++++- gacela/game.scm | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gacela/event.scm b/gacela/event.scm index 0422397..720e4fd 100644 --- a/gacela/event.scm +++ b/gacela/event.scm @@ -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? @@ -35,8 +36,11 @@ (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*)))) diff --git a/gacela/game.scm b/gacela/game.scm index e8e635a..fe5f0b3 100644 --- a/gacela/game.scm +++ b/gacela/game.scm @@ -82,6 +82,7 @@ unused accumulator time." (iter (- lag tick-interval) (1+ ticks))) (else lag))) + (clear-events) (iter lag 0)) (define (alpha lag) -- 2.39.5