summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chickadee/buffer.scm7
1 files changed, 7 insertions, 0 deletions
diff --git a/chickadee/buffer.scm b/chickadee/buffer.scm
index 793215d..a7a22fc 100644
--- a/chickadee/buffer.scm
+++ b/chickadee/buffer.scm
@@ -118,6 +118,7 @@
(define *buffers* '())
(define (current-buffer)
+ "Return the current buffer."
(and (not (null? *buffers*))
(car *buffers*)))
@@ -144,11 +145,14 @@
(set! (buffer-started? new) #t)))))
(define (push-buffer! buffer)
+ "Pause the current buffer and switch to BUFFER."
(let ((old (current-buffer)))
(set! *buffers* (cons buffer *buffers*))
(switch-buffers old buffer)))
(define (pop-buffer!)
+ "Stop the current buffer and switch back to the previously active
+buffer, or terminate the game loop if the buffer stack is empty."
(let ((old (current-buffer)))
(set! *buffers* (cdr *buffers*))
(if (null? *buffers*)
@@ -158,11 +162,14 @@
(switch-buffers old (current-buffer) #t))))
(define (replace-buffer! buffer)
+ "Stop the current buffer and switch to BUFFER."
(let ((old (current-buffer)))
(set! *buffers* (cons buffer (cdr *buffers*)))
(switch-buffers old buffer #t)))
(define (use-buffers! initial-buffer)
+ "Install buffers into the game engine and set the current buffer to
+INITIAL-BUFFER."
(add-hook! load-hook
(lambda ()
(push-buffer! initial-buffer)))