Next: , Up: Command Line Interface   [Contents][Index]


3.1 Invoking chickadee play

The chickadee play command is used to open a window and run the Chickadee game contained within a Scheme source file.

chickadee play the-legend-of-emacs.scm

In this file, special procedures may be defined to handle various events from the game loop:

See The Game Loop for complete information on all of these hooks, such as the arguments that each procedure receives.

In additional to evaluating the specified source file, the directory containing that file is added to Guile’s load path so that games can easily be divided into many different files. Furthermore, that directory is entered prior to evaluating the file so that data files (images, sounds, etc.) can be loaded relative to the main source file, regardless of what the current directory was when chickadee play was invoked.

Many aspects of the initial game window and environment can be controlled via the following options:

--title=title
-t title

Set the window title to title.

--width=width
-w width

Set the window width to width pixels.

--height=height
-h height

Set the window height to height pixels.

--fullscreen
-f

Open window in fullscreen mode.

--resizable
-r

Make window resizable.

--update-hz=n
-u n

Update the game n times per second.

--clear-color=color
-c color

Set the screen clear color to color, a hex code in the format #RRGGBB. For example, to set the clear color to black, pass --clear-color=#000000.

--repl

Launch a REPL in the terminal. This will allow the game environment to be debugged and modified without having to stop and restart the game after each change.

--repl-server[=port]

Launch a REPL server on port port, or 37146 by default.

telnet localhost 37146 (or whatever port number was given) will do the trick, but using the Geiser extension for Emacs is by far the best way to develop at the REPL with Guile. Use M-x connect-to-guile to connect to the REPL server.

--language=language

Process the input program using language, the identifier of a language within Guile’s language tower. By default, unsurprisingly, Scheme is used.

For example, to use the neat Wisp language as an alternative to Scheme’s parenthetical syntax, pass --language=wisp. Wisp is not included with Guile and must be installed separately.

-x extension

Add extension to the list of file extensions that Guile will load.

For example, Wisp files canonically use the .w extension. Here’s what a “hello, world” Chickadee program looks like in Wisp:

define : draw alpha
  draw-text "Hello, world!" : vec2 260.0 240.0

Assuming the above code is saved to a hello.w file, chickadee play be invoked as follows:

chickadee play --language=wisp -x .w hello.w

Next: , Up: Command Line Interface   [Contents][Index]