(index ("world-changes" 0) ("run-event-loop" 760) ("world-inits" 1340) ("world-ends" 1479) ("world-changes" 1614) ("world-update-delay" 2011) ("new-doodle" 2180) ("show!" 2650) ("clear-screen" 2732) ("rectangle" 3005) ("filled-rectangle" 3249) ("circle" 3559) ("filled-circle" 3785) ("draw-line" 4071) ("set-font!" 4429) ("text" 4674) ("text-width" 4978) ("save-screenshot" 5236) ("font-color" 5498) ("font-size" 5607) ("current-background" 5710) ("line-width" 5841) ("world-update-delay" 5957) ("define-resource" 6135) ("blit-image" 8011))
(def (sig (procedure "(world-changes (lambda (events dt escape-continuation) ...))" (id world-changes))) (dl (dt "event") (dd "holds the occured list of events of this loop iteration") (dt "dt") (dd "holds the time delta between the last and this iteration") (dt "escape-continuation") (dd "holds the continuation that will exit the loop")) (p "Please see below for a detailed list of supported " (tt "event") " symbols.") (p (tt "dt") " is a flonum which can be used to adjust speed of animations for example.") (p "The game loop is started with the " (tt "(run-event-loop)") " procedure. Usually the game loop will run as fast as it can unless the keyword parameter " (tt "minimum-wait") " has been given which adds that minimum delay between iterations."))
(def (sig (procedure "(run-event-loop #!key (run-in-background #f) (minimum-wait *minimum-wait*))" (id run-event-loop))) (p "Starts the event loop and runs " (tt "world-inits") ". If " (tt "run-in-background") " is #t a new thread is started. Within the event loop the procedure given with " (tt "world-changes") " is called with the time delta of the last call and the events that occured. If " (tt "minimum-wait") " is given and the delta is smaller than " (tt "minimum-wait") " the thread will sleep for the remaining time. " (tt "minimum-wait") " takes a value in seconds."))
(def (sig (procedure "(world-inits (lambda () ...))" (id world-inits))) (p "A thunk that is called once when the event loop is started."))
(def (sig (procedure "(world-ends (lambda () ...))" (id world-ends))) (p "A thunk that is called once when the even loop is exited."))
(def (sig (procedure "(world-changes (lambda (events dt exit-continuation) ...))" (id world-changes))) (p "A procedure that gets called every iteration of the event loop. The " (tt "events") " parameter holds the list of events, " (tt "dt") " is the time difference in milliseconds between the last and current iteration. " (tt "exit-continuation") " can be used to jump out of the event-loop."))
(def (sig (parameter "(world-update-delay flonum)" (id world-update-delay))) (p "The minimum delay between updates. Aka, the minimum-wait property in the event-loop."))
(def (sig (procedure "(new-doodle #!key (width 680) (height 460) (title \"Doodle\") (background solid-black) (fullscreen #f))" (id new-doodle))) (p "Initialises the internal state and createas a window with the given dimensions and title. If background is a string it will be interpreted as a filename pointing to a PNG file which will be loaded as background.") (p "The background parameter can either be a doodle RGBA color list or a string pointing to a PNG file."))
(def (sig (procedure "(show!)" (id show!))) (p "Causes a redraw of the window."))
(def (sig (procedure "(clear-screen #!optional (color (current-background)))" (id clear-screen))) (p "Fills the screen with the " (tt "current-background") " color. Color can also be given as a string representing a filename to a PNG image which will be loaded instead."))
(def (sig (procedure "(rectangle x y width height color)" (id rectangle))) (p "Draws a rectangle at the given coordinates " (tt "(x, y)") " with the dimensions " (tt "width") " and " (tt "height") ". The border is drawn in " (tt "color") "."))
(def (sig (procedure "(filled-rectangle x y width height color)" (id filled-rectangle))) (p "Draws a rectangle at the given coordinates " (tt "(x, y)") " with the dimensions " (tt "width") " and " (tt "height") ". The border is drawn in " (tt "color") ". The rectangle also is filled with " (tt "color") "."))
(def (sig (procedure "(circle x y diameter color)" (id circle))) (p "Draws a circle at the point defined by " (tt "(x,y)") " with the given " (tt "diameter") " and " (tt "color") ". The border is drawn in " (tt "color") "."))
(def (sig (procedure "(filled-circle x y diameter color)" (id filled-circle))) (p "Draws a circle at the point defined by " (tt "(x,y)") " with the given " (tt "diameter") " and " (tt "color") ". The border is drawn in " (tt "color") ". The circle is filled in " (tt "color") " too."))
(def (sig (procedure "(draw-line x1 y1 x2 y2 #!key (color solid-white) (style #:solid))" (id draw-line))) (p "Draw a line between the two points " (tt "(x1,y1)") " and " (tt "(x2,y2)") " in the given style. Valid " (tt "style") "s are either " (tt "#:solid") " (the default) or " (tt "#:dashed") " for dashed lines. The line is drawn in " (tt "color") "."))
(def (sig (procedure "(set-font! font size color)" (id set-font!))) (p "Sets the font to " (tt "font") ", given " (tt "size") " and " (tt "color") ". " (tt "font") " is a string representing the font's name. Every X11 TTF font is applicable."))
(def (sig (procedure "(text x y text #!key (align #:left))" (id text))) (p "Print the given text in one line starting on point " (tt "(x,y)") ". Alignment can be changed with the " (tt "align") " parameter. Supported alignment values are " (tt "#:left") ", " (tt "#:center") " and " (tt "#:right") "."))
(def (sig (procedure "(text-width text)" (id text-width))) (p "Returns multiple values: The " (i "width") " and " (i "height") " in pixels of the given " (i "text") " when rendered with the current font settings. " (i "text") " is assumed to be a string."))
(def (sig (procedure "(save-screenshot filename)" (id save-screenshot))) (p "Saves the current screen content to a file called " (tt "filename") " as a portable network graphics (PNG). It is up to the user to provide an appropriate extension to the filename."))
(def (sig (procedure "(font-color)" (id font-color))) (p "Holds the current font color. Default is black."))
(def (sig (procedure "(font-size)" (id font-size))) (p "Holds the current font-size. Default is 12."))
(def (sig (procedure "(current-background)" (id current-background))) (p "Holds the current background color. Default is black."))
(def (sig (procedure "(line-width)" (id line-width))) (p "Holds the line width used for drawing. Default is 2.0."))
(def (sig (procedure "(world-update-delay)" (id world-update-delay))) (p "Amount of milliseconds that should pass at minimum before calling the world-changes procedure again."))
(def (sig (procedure "(define-resource name type filename . data )" (id define-resource))) (p "Registers a resource under the name " (i "name") ". The resource is read from a file specified with " (i "filename") ". The " (i "type") " argument is a keyword and specifies how the " (i "data") " argument is handled and which form is expected.") (p "The following types are handled:") (pre "* #:image") (p "A single image from a single file. It takes optional argumens " (i "x-offset") ", " (i "y-offset") " and " (i "scale-factor") " to take just a fraction out of the given image file and to be able to scale it.") (p "The following example does this several times:") (highlight scheme "(define-resource 'water #:image \"Water Block.png\" *terrain-xoffset* *terrain-yoffset*)\n(define-resource 'stone #:image \"Stone Block.png\" *terrain-xoffset* *terrain-yoffset*)\n(define-resource 'princess #:image \"Character Princess Girl.png\" 0 -80)\n(define-resource 'bubble #:image \"SpeechBubble.png\" -15 -120)\n(define-resource 'bug #:image \"Enemy Bug.png\" 0 -80)\n(define-resource 'tree #:image \"Tree Tall.png\" 0 -80 )\n(define-resource 'heart #:image \"Heart.png\" 0 0 0.5)") (pre "* #:tileset") (p "This assumes the image to consist of one or more square tiles. Then several images are referenced out of a single image file. The " (i "data") " argument is expected to be a list of two elements: the tile-size and a list consisting of (name number) pairs (proper lists). The following examples makes three tiles accessible through their names: wall, floor and hero. They can be drawn with the " (tt "blit-image") " procedure.") (highlight scheme "(define-resource 'tiles\n                  #:tileset\n                   \"../roguelike/tile.png\"\n                    32\n                    '((wall 2)\n                      (floor 30)\n                      (hero 486)))"))
(def (sig (procedure "(blit-image name x y rotation: angle )" (id blit-image))) (p "Blits in the image " (i "name") " at position (x, y). If angle is given the image is rotated. The angle has to be given in degrees, negative values indicate counter-clockwise rotation."))
