summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chickadee.scm4
-rw-r--r--chickadee/cli/play.scm11
-rw-r--r--doc/api.texi4
-rw-r--r--doc/chickadee.texi7
4 files changed, 23 insertions, 3 deletions
diff --git a/chickadee.scm b/chickadee.scm
index 8dc0400..7175f50 100644
--- a/chickadee.scm
+++ b/chickadee.scm
@@ -256,6 +256,7 @@ border is disabled, otherwise it is enabled.")
(window-height 480)
window-fullscreen?
window-resizable?
+ (clear-color %default-clear-color)
(update-hz 60)
(load (const #t))
(update (const #t))
@@ -297,7 +298,8 @@ border is disabled, otherwise it is enabled.")
#:multisample? #f)))
(gfx (make-graphics-engine (window-gl-context window)))
(default-viewport (make-atomic-box
- (make-viewport 0 0 window-width window-height)))
+ (make-viewport 0 0 window-width window-height
+ #:clear-color clear-color)))
(default-projection (make-atomic-box
(orthographic-projection 0 window-width
window-height 0
diff --git a/chickadee/cli/play.scm b/chickadee/cli/play.scm
index db2c0d6..f7c03b5 100644
--- a/chickadee/cli/play.scm
+++ b/chickadee/cli/play.scm
@@ -21,6 +21,8 @@
#:use-module (chickadee async-repl)
#:use-module (chickadee cli)
#:use-module (chickadee config)
+ #:use-module (chickadee graphics color)
+ #:use-module (chickadee graphics viewport)
#:use-module (ice-9 exceptions)
#:use-module (ice-9 format)
#:use-module (ice-9 match)
@@ -53,6 +55,8 @@ Play the game defined in FILE.~%")
(display "
-u, --update-hz=N set update rate to N times per second")
(display "
+ -c, --clear-color=RGB set the clear color to hex color code RGB")
+ (display "
--repl start REPL in this terminal")
(display "
--repl-server=[PORT] start REPL server on PORT or 37146 by default")
@@ -85,6 +89,9 @@ Play the game defined in FILE.~%")
(option '(#\u "update-hz") #t #f
(lambda (opt name arg result)
(alist-cons 'update-hz (string->number arg) result)))
+ (option '(#\c "clear-color") #t #f
+ (lambda (opt name arg result)
+ (alist-cons 'clear-color (string->color arg) result)))
(option '("repl") #f #f
(lambda (opt name arg result)
(alist-cons 'repl #t result)))
@@ -103,12 +110,13 @@ Play the game defined in FILE.~%")
(alist-cons 'extension arg result)))))
(define %default-options
- '((title . "chickadee")
+ `((title . "chickadee")
(width . 640)
(height . 480)
(fullscreen? . #f)
(resizable? . #f)
(update-hz . 60)
+ (clear-color . ,%default-clear-color)
(repl . #f)
(language . scheme)))
@@ -244,6 +252,7 @@ Resume the game loop without entering a debugger."
#:window-fullscreen? (assq-ref opts 'fullscreen?)
#:window-resizable? (assq-ref opts 'resizable?)
#:update-hz (assq-ref opts 'update-hz)
+ #:clear-color (assq-ref opts 'clear-color)
#:load load-game
#:update (let ((update* (trampoline update dt)))
(lambda (dt)
diff --git a/doc/api.texi b/doc/api.texi
index 9d743b4..92d18dc 100644
--- a/doc/api.texi
+++ b/doc/api.texi
@@ -41,6 +41,7 @@ calling @code{run-game} is already taken care of for you.
[#:window-fullscreen? @code{#f}] @
[#:window-resizable? @code{#f}] @
[#:update-hz 60] @
+ [#:clear-color] @
[#:load] [#:update] [#:draw] [#:quit] @
[#:key-press] [#:key-release] [#:text-input] @
[#:mouse-press] [#:mouse-release] [#:mouse-move] @
@@ -53,7 +54,8 @@ A new graphical window will be opened with @var{window-width} x
@var{window-height} as its dimensions, @var{window-title} as its
title, and in fullscreen mode if @var{window-fullscreen?} is
@code{#t}. If @var{window-resizable?} is @code{#t} then the window
-can be resized by the user.
+can be resized by the user. The screen color will be set to
+@var{clear-color}, or a pleasant light blue, by default.
@itemize
@item
diff --git a/doc/chickadee.texi b/doc/chickadee.texi
index c6b2f07..a87a346 100644
--- a/doc/chickadee.texi
+++ b/doc/chickadee.texi
@@ -261,6 +261,13 @@ Make window resizable.
Update the game @var{n} times per second.
+@item --clear-color=@var{color}
+@itemx -c @var{color}
+
+Set the screen clear color to @var{color}, a hex code in the format
+@code{#RRGGBB}. For example, to set the clear color to black, pass
+@code{--clear-color=#000000}.
+
@item --repl
Launch a REPL in the terminal. This will allow the game environment