1. Christian Kellermann
  2. doodle


Christian Kellermann  committed e476fbb

Make the world-changes, world-inits, world-ends procedures so they are not thread local anymore.

  • Participants
  • Parent commits b92bcd7
  • Branches master

Comments (0)

Files changed (1)

File doodle.scm

View file
  • Ignore whitespace
     (error "This parameter can be set to procedures only, you gave it " p))
-(define world-ends (make-parameter void expect-procedure))
-(define world-changes (make-parameter void expect-procedure))
-(define world-inits (make-parameter void expect-procedure))
+(define *world-inits* values)
+(define *world-changes* values)
+(define *world-ends* values)
+(define (world-ends f) (set! *world-ends* f))
+(define (world-changes f) (set! *world-changes* f))
+(define (world-inits f) (set! *world-inits* f))
 (define-syntax set-color
   (syntax-rules ()
                    (fprintf (current-error-port) "Exception in world-changes: ~a, disabling world-changes.~%" ((condition-property-accessor 'exn 'message) e))
                    (k (world-changes values)))
                  (lambda ()
-                   ((world-changes)
+                   (*world-changes*
                     (map (cut translate-events <> escape)
                    (fprintf (current-error-port) "Exception in world-ends: ~a, ignoring world-ends.~%" ((condition-property-accessor 'exn 'message) e))
                    (k (world-ends values)))
                  (lambda ()
-                   ((world-ends))))))
+                   (*world-ends*)))))
 (define (run-event-loop #!key
         (fprintf (current-error-port) "Exception in world-inits: ~a, ignoring world-inits.~%" ((condition-property-accessor 'exn 'message) e))
         (k (world-inits values)))
       (lambda ()
-        ((world-inits))))))
+        (*world-inits*)))))
   (sdl-flip *s*)
   (if run-in-background