This is the tcod Reference Manual, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Sep 15 04:31:07 2024 GMT+0.
The main system appears first, followed by any subsystem dependency.
tcod
Common Lisp bindings for libtcod, a truecolour terminal-emulation library written in C.
Paul Sexton <eeeickythump@gmail.com>
cffi
(system).
cffi-libffi
(system).
defstar
(system).
tcod.lisp
(file).
tcod-colours.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
tcod/tcod.lisp
tcod
(system).
tcod
.
*root*
(special variable).
+null+
(special variable).
a*-path
(type).
background-add-alpha
(function).
background-alpha
(function).
background-flag
(type).
bsp-contains?
(function).
bsp-delete
(function).
bsp-father
(function).
bsp-find-node
(function).
bsp-is-leaf?
(function).
bsp-left
(function).
bsp-new-with-size
(function).
bsp-remove-sons
(function).
bsp-resize
(function).
bsp-right
(function).
bsp-split-once
(function).
bsp-split-recursive
(function).
bsp-traverse-in-order
(function).
bsp-traverse-inverted-level-order
(function).
bsp-traverse-level-order
(function).
bsp-traverse-post-order
(function).
bsp-traverse-pre-order
(function).
colctrl
(type).
colctrl->char
(function).
color
(function).
color->grayscale
(function).
color->keyword
(function).
color-add
(function).
color-equals?
(function).
color-get-hsv
(function).
color-get-hue
(function).
color-get-saturation
(function).
color-get-value
(function).
color-hsv
(function).
color-lerp
(function).
color-multiply
(function).
color-multiply-scalar
(function).
color-rgb
(function).
color-set-hsv
(function).
color-set-hue
(function).
color-set-saturation
(function).
color-set-value
(function).
color-shift-hue
(function).
color-subtract
(function).
colour
(function).
colour->grayscale
(function).
colour->keyword
(function).
colour-add
(function).
colour-equals?
(function).
colour-get-hsv
(function).
colour-hsv
(function).
colour-lerp
(function).
colour-multiply
(function).
colour-multiply-scalar
(function).
colour-rgb
(function).
colour-set-hsv
(function).
colour-set-hue
(function).
colour-set-saturation
(function).
colour-set-value
(function).
colour-shift-hue
(function).
colour-subtract
(function).
compose-color
(function).
compose-colour
(function).
console
(type).
console-blit
(function).
console-check-for-keypress
(function).
console-clear
(function).
console-credits
(function).
console-credits-reset
(function).
console-delete
(function).
console-disable-keyboard-repeat
(function).
console-fill-char
(function).
console-flush
(function).
console-get-alignment
(function).
console-get-background-flag
(function).
console-get-char
(function).
console-get-char-background
(function).
console-get-char-foreground
(function).
console-get-default-background
(function).
console-get-default-foreground
(function).
console-get-fade
(function).
console-get-fading-color
(function).
console-get-fading-colour
(function).
console-get-height
(function).
console-get-height-rect
(function).
console-get-width
(function).
console-hline
(function).
console-init-root
(function).
console-initialised?
(function).
console-is-fullscreen?
(function).
console-is-window-closed?
(function).
console-map-ascii-code-to-font
(function).
console-map-ascii-codes-to-font
(function).
console-map-string-to-font
(function).
console-map-string-to-font-utf
(function).
console-new
(function).
console-print
(function).
console-print-double-frame
(function).
console-print-ex
(function).
console-print-ex-utf
(function).
console-print-frame
(function).
console-print-rect
(function).
console-print-rect-ex
(function).
console-print-rect-ex-utf
(function).
console-print-rect-utf
(function).
console-print-utf
(function).
console-put-char
(function).
console-put-char-ex
(function).
console-rect
(function).
console-set-alignment
(function).
console-set-background-flag
(function).
console-set-char
(function).
console-set-char-background
(function).
console-set-char-foreground
(function).
console-set-color-control
(function).
console-set-colour-control
(function).
console-set-custom-font
(function).
console-set-default-background
(function).
console-set-default-foreground
(function).
console-set-dirty
(function).
console-set-fade
(function).
console-set-fullscreen
(function).
console-set-keyboard-repeat
(function).
console-set-window-title
(function).
console-vline
(function).
console-wait-for-keypress
(function).
decompose-color
(function).
decompose-colour
(function).
dijkstra-compute
(function).
dijkstra-delete
(function).
dijkstra-get
(function).
dijkstra-get-distance
(function).
dijkstra-is-empty?
(function).
dijkstra-new
(function).
dijkstra-new-using-function
(function).
dijkstra-path
(type).
dijkstra-path-set
(function).
dijkstra-path-walk
(function).
dijkstra-reverse
(function).
dijkstra-size
(function).
drawing-character
(type).
fov-algorithm
(type).
heightmap-add
(function).
heightmap-add-fbm
(function).
heightmap-add-hill
(function).
heightmap-add-hm
(function).
heightmap-add-voronoi
(function).
heightmap-clamp
(function).
heightmap-clear
(function).
heightmap-copy
(function).
heightmap-count-cells
(function).
heightmap-delete
(function).
heightmap-dig-bezier
(function).
heightmap-dig-hill
(function).
heightmap-dig-line
(function).
heightmap-get-interpolated-value
(function).
heightmap-get-max
(function).
heightmap-get-min
(function).
heightmap-get-normal
(function).
heightmap-get-slope
(function).
heightmap-get-value
(function).
heightmap-has-land-on-border?
(function).
heightmap-islandify
(function).
heightmap-kernel-transform
(function).
heightmap-lerp-hm
(function).
heightmap-multiply-hm
(function).
heightmap-new
(function).
heightmap-normalise
(function).
heightmap-normalize
(function).
heightmap-rain-erosion
(function).
heightmap-scale
(function).
heightmap-scale-fbm
(function).
heightmap-set-value
(function).
hello-world
(function).
image-blit
(function).
image-blit-2x
(function).
image-blit-rect
(function).
image-clear
(function).
image-delete
(function).
image-from-console
(function).
image-get-alpha
(function).
image-get-height
(function).
image-get-mipmap-pixel
(function).
image-get-pixel
(function).
image-get-width
(function).
image-hflip
(function).
image-invert
(function).
image-is-pixel-transparent?
(function).
image-load
(function).
image-new
(function).
image-put-pixel
(function).
image-refresh-console
(function).
image-rotate90
(function).
image-save
(function).
image-scale
(function).
image-set-key-color
(function).
image-set-key-colour
(function).
image-vflip
(function).
invert-color
(function).
invert-colour
(function).
is-key-pressed?
(function).
key
(structure).
key-c
(reader).
(setf key-c)
(writer).
key-lalt
(reader).
(setf key-lalt)
(writer).
key-lctrl
(reader).
(setf key-lctrl)
(writer).
key-lmeta
(reader).
(setf key-lmeta)
(writer).
key-p
(function).
key-pressed
(reader).
(setf key-pressed)
(writer).
key-ralt
(reader).
(setf key-ralt)
(writer).
key-rctrl
(reader).
(setf key-rctrl)
(writer).
key-rmeta
(reader).
(setf key-rmeta)
(writer).
key-shift
(reader).
(setf key-shift)
(writer).
key-state
(type).
key-vk
(reader).
(setf key-vk)
(writer).
keycode
(type).
legal-console-coordinates?
(macro).
line-init
(function).
line-line
(function).
line-step
(function).
make-color
(function).
make-colour
(function).
make-key
(function).
make-mouse
(function).
make-simple-key
(function).
map-clear
(function).
map-compute-fov
(function).
map-copy
(function).
map-delete
(function).
map-get-height
(function).
map-get-nb-cells
(function).
map-get-width
(function).
map-is-in-fov?
(function).
map-is-transparent?
(function).
map-is-walkable?
(function).
map-new
(function).
map-set-in-fov
(function).
map-set-properties
(function).
mapptr
(type).
mouse
(structure).
mouse-cx
(reader).
(setf mouse-cx)
(writer).
mouse-cy
(reader).
(setf mouse-cy)
(writer).
mouse-dx
(reader).
(setf mouse-dx)
(writer).
mouse-dy
(reader).
(setf mouse-dy)
(writer).
mouse-get-status
(function).
mouse-is-cursor-visible?
(function).
mouse-lbutton
(reader).
(setf mouse-lbutton)
(writer).
mouse-lbutton-pressed
(reader).
(setf mouse-lbutton-pressed)
(writer).
mouse-mbutton
(reader).
(setf mouse-mbutton)
(writer).
mouse-mbutton-pressed
(reader).
(setf mouse-mbutton-pressed)
(writer).
mouse-move
(function).
mouse-rbutton
(reader).
(setf mouse-rbutton)
(writer).
mouse-rbutton-pressed
(reader).
(setf mouse-rbutton-pressed)
(writer).
mouse-show-cursor
(function).
mouse-wheel-down
(reader).
(setf mouse-wheel-down)
(writer).
mouse-wheel-up
(reader).
(setf mouse-wheel-up)
(writer).
mouse-x
(reader).
(setf mouse-x)
(writer).
mouse-y
(reader).
(setf mouse-y)
(writer).
namegen-destroy
(function).
namegen-generate
(function).
namegen-generate-custom
(function).
namegen-parse
(function).
noise-delete
(function).
noise-get
(function).
noise-get-ex
(function).
noise-get-fbm
(function).
noise-get-fbm-ex
(function).
noise-get-turbulence
(function).
noise-get-turbulence-ex
(function).
noise-new
(function).
noise-set-type
(function).
path-compute
(function).
path-delete
(function).
path-get
(function).
path-get-destination
(function).
path-get-origin
(function).
path-is-empty?
(function).
path-new-using-function
(function).
path-new-using-map
(function).
path-reverse
(function).
path-size
(function).
path-walk
(function).
random-delete
(function).
random-get-double
(function).
random-get-double-mean
(function).
random-get-float
(function).
random-get-float-mean
(function).
random-get-instance
(function).
random-get-int
(function).
random-get-int-mean
(function).
random-new
(function).
random-new-from-seed
(function).
random-restore
(function).
random-save
(function).
random-set-distribution
(function).
same-keys?
(function).
sdl-get-mouse-state
(function).
start-colors
(function).
start-colours
(function).
sys-check-for-event
(function).
sys-clipboard-get
(function).
sys-clipboard-set
(function).
sys-create-directory
(function).
sys-delete-directory
(function).
sys-elapsed-milli
(function).
sys-elapsed-seconds
(function).
sys-force-fullscreen-resolution
(function).
sys-get-char-size
(function).
sys-get-current-resolution
(function).
sys-get-events
(function).
sys-get-fps
(function).
sys-get-fullscreen-offsets
(function).
sys-get-last-frame-length
(function).
sys-get-renderer
(function).
sys-register-sdl-renderer
(function).
sys-save-screenshot
(function).
sys-set-fps
(function).
sys-set-renderer
(function).
sys-sleep-milli
(function).
sys-update-char
(function).
sys-wait-events
(function).
sys-wait-for-event
(function).
zip-delete
(function).
zip-get-char
(function).
zip-get-color
(function).
zip-get-colour
(function).
zip-get-console
(function).
zip-get-current-bytes
(function).
zip-get-data
(function).
zip-get-float
(function).
zip-get-image
(function).
zip-get-int
(function).
zip-get-remaining-bytes
(function).
zip-get-string
(function).
zip-load-from-file
(function).
zip-new
(function).
zip-put
(function).
zip-put-char
(function).
zip-put-color
(function).
zip-put-colour
(function).
zip-put-console
(function).
zip-put-data
(function).
zip-put-float
(function).
zip-put-image
(function).
zip-put-int
(function).
zip-put-string
(function).
zip-save-to-file
(function).
zip-skip-bytes
(function).
zipptr
(type).
%%%console-map-string-to-font-utf
(function).
%%%heightmap-add-voronoi
(function).
%%%heightmap-get-normal
(function).
%%%heightmap-kernel-transform
(function).
%%bsp-contains?
(function).
%%bsp-delete
(function).
%%bsp-father
(function).
%%bsp-find-node
(function).
%%bsp-is-leaf?
(function).
%%bsp-left
(function).
%%bsp-new-with-size
(function).
%%bsp-remove-sons
(function).
%%bsp-resize
(function).
%%bsp-right
(function).
%%bsp-split-once
(function).
%%bsp-split-recursive
(function).
%%bsp-traverse-in-order
(function).
%%bsp-traverse-inverted-level-order
(function).
%%bsp-traverse-level-order
(function).
%%bsp-traverse-post-order
(function).
%%bsp-traverse-pre-order
(function).
%%colour-add
(function).
%%colour-equals?
(function).
%%colour-lerp
(function).
%%colour-multiply
(function).
%%colour-multiply-scalar
(function).
%%colour-set-hsv
(function).
%%colour-subtract
(function).
%%console-blit
(function).
%%console-clear
(function).
%%console-credits
(function).
%%console-credits-render
(function).
%%console-credits-reset
(function).
%%console-delete
(function).
%%console-disable-keyboard-repeat
(function).
%%console-flush
(function).
%%console-get-alignment
(function).
%%console-get-background-flag
(function).
%%console-get-char
(function).
%%console-get-char-background
(function).
%%console-get-char-foreground
(function).
%%console-get-default-background
(function).
%%console-get-default-foreground
(function).
%%console-get-fade
(function).
%%console-get-fading-color
(function).
%%console-get-height
(function).
%%console-get-width
(function).
%%console-hline
(function).
%%console-is-fullscreen?
(function).
%%console-is-window-closed?
(function).
%%console-map-ascii-code-to-font
(function).
%%console-map-ascii-codes-to-font
(function).
%%console-map-string-to-font
(function).
%%console-new
(function).
%%console-print-return-string
(function).
%%console-put-char
(function).
%%console-put-char-ex
(function).
%%console-rect
(function).
%%console-set-alignment
(function).
%%console-set-background-flag
(function).
%%console-set-char-background
(function).
%%console-set-char-foreground
(function).
%%console-set-colour-control
(function).
%%console-set-default-background
(function).
%%console-set-default-foreground
(function).
%%console-set-dirty
(function).
%%console-set-fade
(function).
%%console-set-fullscreen
(function).
%%console-set-keyboard-repeat
(function).
%%console-set-window-title
(function).
%%console-vline
(function).
%%dijkstra-compute
(function).
%%dijkstra-delete
(function).
%%dijkstra-get-distance
(function).
%%dijkstra-is-empty?
(function).
%%dijkstra-new
(function).
%%dijkstra-new-using-function
(function).
%%dijkstra-path-set
(function).
%%dijkstra-reverse
(function).
%%dijkstra-size
(function).
%%heightmap-add
(function).
%%heightmap-add-fbm
(function).
%%heightmap-add-hill
(function).
%%heightmap-add-hm
(function).
%%heightmap-clamp
(function).
%%heightmap-clear
(function).
%%heightmap-copy
(function).
%%heightmap-count-cells
(function).
%%heightmap-delete
(function).
%%heightmap-dig-hill
(function).
%%heightmap-get-interpolated-value
(function).
%%heightmap-get-slope
(function).
%%heightmap-get-value
(function).
%%heightmap-has-land-on-border?
(function).
%%heightmap-islandify
(function).
%%heightmap-lerp-hm
(function).
%%heightmap-multiply-hm
(function).
%%heightmap-new
(function).
%%heightmap-normalize
(function).
%%heightmap-scale
(function).
%%heightmap-scale-fbm
(function).
%%heightmap-set-value
(function).
%%image-blit
(function).
%%image-blit-2x
(function).
%%image-blit-rect
(function).
%%image-clear
(function).
%%image-delete
(function).
%%image-from-console
(function).
%%image-get-alpha
(function).
%%image-get-mipmap-pixel
(function).
%%image-get-pixel
(function).
%%image-hflip
(function).
%%image-invert
(function).
%%image-is-pixel-transparent?
(function).
%%image-load
(function).
%%image-new
(function).
%%image-put-pixel
(function).
%%image-refresh-console
(function).
%%image-rotate90
(function).
%%image-save
(function).
%%image-scale
(function).
%%image-set-key-color
(function).
%%image-vflip
(function).
%%is-key-pressed?
(function).
%%line-init
(function).
%%line-line
(function).
%%line-step
(function).
%%map-clear
(function).
%%map-compute-fov
(function).
%%map-copy
(function).
%%map-delete
(function).
%%map-get-height
(function).
%%map-get-nb-cells
(function).
%%map-get-width
(function).
%%map-is-in-fov?
(function).
%%map-is-transparent?
(function).
%%map-is-walkable?
(function).
%%map-new
(function).
%%map-set-in-fov
(function).
%%map-set-properties
(function).
%%mouse-is-cursor-visible?
(function).
%%mouse-move
(function).
%%mouse-show-cursor
(function).
%%namegen-destroy
(function).
%%namegen-generate
(function).
%%namegen-generate-custom
(function).
%%namegen-parse
(function).
%%noise-delete
(function).
%%noise-set-type
(function).
%%path-compute
(function).
%%path-delete
(function).
%%path-is-empty?
(function).
%%path-new-using-function
(function).
%%path-new-using-map
(function).
%%path-reverse
(function).
%%path-size
(function).
%%random-delete
(function).
%%random-get-double
(function).
%%random-get-double-mean
(function).
%%random-get-float
(function).
%%random-get-float-mean
(function).
%%random-get-instance
(function).
%%random-get-int
(function).
%%random-get-int-mean
(function).
%%random-new
(function).
%%random-new-from-seed
(function).
%%random-restore
(function).
%%random-save
(function).
%%random-set-distribution
(function).
%%sys-check-for-event
(function).
%%sys-clipboard-get
(function).
%%sys-clipboard-set
(function).
%%sys-create-directory
(function).
%%sys-delete-directory
(function).
%%sys-elapsed-milli
(function).
%%sys-elapsed-seconds
(function).
%%sys-force-fullscreen-resolution
(function).
%%sys-get-fps
(function).
%%sys-get-last-frame-length
(function).
%%sys-get-renderer
(function).
%%sys-register-sdl-renderer
(function).
%%sys-set-fps
(function).
%%sys-set-renderer
(function).
%%sys-sleep-milli
(function).
%%sys-update-char
(function).
%%sys-wait-for-event
(function).
%%zip-delete
(function).
%%zip-get-char
(function).
%%zip-get-console
(function).
%%zip-get-current-bytes
(function).
%%zip-get-data
(function).
%%zip-get-float
(function).
%%zip-get-image
(function).
%%zip-get-int
(function).
%%zip-get-remaining-bytes
(function).
%%zip-get-string
(function).
%%zip-load-from-file
(function).
%%zip-new
(function).
%%zip-put-char
(function).
%%zip-put-console
(function).
%%zip-put-data
(function).
%%zip-put-float
(function).
%%zip-put-image
(function).
%%zip-put-int
(function).
%%zip-put-string
(function).
%%zip-save-to-file
(function).
%%zip-skip-bytes
(function).
%console-get-height-rect
(macro).
%console-get-height-rect-utf
(macro).
%console-init-root
(function).
%console-map-string-to-font-utf
(function).
%console-print
(macro).
%console-print-double-frame
(macro).
%console-print-ex
(macro).
%console-print-ex-utf
(macro).
%console-print-frame
(macro).
%console-print-rect
(macro).
%console-print-rect-ex
(macro).
%console-print-rect-ex-utf
(macro).
%console-print-rect-utf
(macro).
%console-print-utf
(macro).
%console-set-char
(function).
%console-set-custom-font
(function).
%console-wait-for-keypress
(function).
%dijkstra-get
(function).
%dijkstra-path-walk
(function).
%heightmap-add-voronoi
(function).
%heightmap-dig-bezier
(function).
%heightmap-get-minmax
(function).
%heightmap-get-normal
(function).
%heightmap-kernel-transform
(function).
%heightmap-rain-erosion
(function).
%image-get-size
(function).
%mouse-get-status
(function).
%noise-get
(function).
%noise-get-ex
(function).
%noise-get-fbm
(function).
%noise-get-fbm-ex
(function).
%noise-get-turbulence
(function).
%noise-get-turbulence-ex
(function).
%noise-new
(function).
%path-get
(function).
%path-get-destination
(function).
%path-get-origin
(function).
%path-walk
(function).
%sys-get-char-size
(function).
%sys-get-fullscreen-offsets
(function).
%sys-save-screenshot
(function).
*colour-table*
(special variable).
*console-height-table*
(special variable).
*console-width-table*
(special variable).
*initial-colours*
(special variable).
*libsdl2-loaded*
(special variable).
*libtcod-loaded*
(special variable).
*root-console-initialised?*
(special variable).
+noise-default-hurst+
(constant).
+noise-default-lacunarity+
(constant).
alignment
(type).
bsp-ptr
(type).
c-type->lisp-type
(function).
clamp
(macro).
colour-scale-hsv
(function).
colour-struct-tclass
(class).
colournum
(type).
console-credits-render
(function).
console-get-height-rect-utf
(function).
console-print-return-string
(function).
copy-key
(function).
copy-mouse
(function).
custom-font-flags
(type).
custom-font-flags-predicate
(function).
define-c-bitfield
(macro).
define-c-enum
(macro).
define-c-function
(macro).
define-c-type
(macro).
event
(type).
get-bit
(function).
heightmap-ptr
(type).
image
(type).
int
(type).
key->keypress
(function).
key-bitfield->vk
(function).
key-press-tclass
(class).
key-state-predicate
(function).
mouse-dcx
(reader).
(setf mouse-dcx)
(writer).
mouse-dcy
(reader).
(setf mouse-dcy)
(writer).
mouse-p
(function).
mouse-state-tclass
(class).
noise
(type).
noise-type
(type).
parse-mouse-state
(function).
parser
(type).
prepend-percent
(function).
randomptr
(type).
renderer
(type).
rng-algorithm
(type).
rng-distribution
(type).
signed-char
(type).
simple-type?
(function).
sint16
(type).
sys-get-current-resolution-x
(function).
sys-get-current-resolution-y
(function).
uchar
(type).
ucoord
(type).
uint
(type).
uint16
(type).
uint24
(type).
uint32
(type).
uint8
(type).
tcod/tcod-colours.lisp
tcod
(system).
make-rgb.txt-colours
(function).
Packages are listed by definition order.
tcod
* Introduction
Welcome to CL-TCOD, an interface between Common Lisp and the Doryen Library,
AKA ‘libtcod’, a portable truecolour console library intended for use with
roguelike games.
CL-TCOD consists of the following files:
1. =tcod.lisp=, a lisp file which creates lisp bindings for C functions in the
compiled libtcod library, using the =CFFI= lisp foreign function interface.
2. =tcod.asd=, which allows TCOD to be easily loaded and used as a library by
other common lisp programs, via the =ASDF= library-loading facility.
3. =tcod-colours.lisp=, a lisp file containing definitions for all the colours
named in /etc/X11/rgb.txt; autogenerated using ’parse-rgb’ (see below)
4. =parse-rgb.lisp=, a lisp file containing code for parsing =/etc/X11/rgb.txt=
and generating tcod-colours.lisp
5. =parse-rgb.asd=, ASDF system definition file for =parse-rgb.lisp=
CL-TCOD has been tested with SBCL 1.0.36 on Linux and Windows, Clozure 1.5
on Linux and Windows, and CLISP on Windows.
**Note** that it has not been used on a Mac; if you do this you may need to
tell CFFI the name of the compiled libtcod library under MacOS. To do this,
open =tcod.lisp= in an editor, find the =’(define-foreign-library...’= clause,
uncomment the =’(:macintosh...)’= line and change the string on that line to
the name of the libtcod library file.
* License
The CL-TCOD package is placed in the Public Domain by its author.
* Dependencies
=CL-TCOD= depends on the following libraries:
1. ASDF: [[http://common-lisp.net/project/asdf/]]
2. DEFSTAR: [[http://bitbucket.org/eeeickythump/defstar/]]
3. CFFI: [[http://common-lisp.net/project/cffi/]]
* Hints on installation
You need to know your way around your chosen common lisp and how to install and
load lisp libraries before proceeding. You also need to have a version of
libtcod newer than 1.4.1rc2, which is the first version that includes the
=’wrappers.c’= and =’wrappers.h’= source files that allow CL-TCOD to interface
with libtcod.
1. Ensure you have a working common lisp installation.
2. Ensure either [[http://www.quicklisp.org/][Quicklisp]] (recommended) or the
ASDF lisp library is installed.
3. If CFFI or DEFSTAR are not installed, download and install them somewhere
ASDF can find them. CFFI requires several third-party lisp libraries – see
the CFFI documentation for more details. Note that if you have
Quicklisp installed, you can install CFFI and its dependencies
easily using the command =(ql:quickload "cffi")= at the Lisp prompt.
4. Put the CL-TCOD files in a directory where ASDF can find them.
5. Make sure libtcod is installed and compiled. Make sure the libtcod and libSDL
dynamically linked libraries (=.DLL= or =.SO= files) are somewhere your lisp
system can find them. They probably are, but if CFFI complains about being unable
to find the libraries, you can either copy them to an appropriate directory or
add their directory to the list variable =cffi:*foreign-library-directories*=
e.g. by typing the following in the lisp interpreter:
;;; (push #P"/my/libtcod/directory/" cffi:*foreign-library-directories*)
*On windows*, DLL files should be put in one of the directories listed in the
=PATH= environment variable. You will need to put =SDL.dll= in the same place
if you don’t already have SDL installed.
*On Linux*, you can usually put .SO files in =/usr/local/lib/=.
Use your package installer to install =libSDL=.
Try running the libtcod demo programs to check everything works.
6. Start lisp, then load CL-TCOD. Using Quicklisp (recommended):
;;; (ql:quickload :tcod)
Using ASDF:
;;; (load "/path/to/asdf/asdf.lisp")
;;; (asdf:oos ’asdf:load-op :tcod)
7. Type something like the following commands at the lisp prompt to start using
TCOD from within Lisp. Alternatively you can type =(tcod:hello-world)=, which
is a function containing the code below.
;;; (tcod:console-set-custom-font "terminal.png" ’(:font-layout-ascii-in-row) 16 16)
;;; (tcod:console-init-root 80 25 :title "Test")
;;; (tcod:console-clear tcod:*root*)
;;; (tcod:console-print tcod:*root* 1 1 "Hello, world!~%")
;;; (tcod:console-wait-for-keypress t)
* Differences between CL-TCOD and libtcod
** Naming conventions
The C function =TCOD_foobar= corresponds to the lisp function =foobar=, which
is in the =tcod= package (and so requires a prefix of =tcod:= to access in most
situations). Underscores become hyphens. So:
: TCOD_foobar_function(a, b) <===> (tcod:foobar-function a b)
‘Predicate functions’ are functions whose main job is to return a boolean
value, true (non =NIL=) or false (=NIL=), that answers a question. These have a
terminal ’?’ added to their name:
: TCOD_console_is_fullscreen() <===> (tcod:console-is-fullscreen?)
C enums have generally more succinct names. As they are lisp keywords, their
names all begin with =’:’=. THey are named according to the following pattern:
: TCODK_BACKSPACE (etc) <===> :backspace
: TCOD_CHAR_HLINE (etc) <===> :char-hline
: TCOD_COLCTRL_1 (etc) <===> :colctrl-1
: TCOD_BKGND_SET (etc) <===> :set
: TCOD_FONT_LAYOUT_ASCII_INCOL <===> :font-layout-ascii-in-col
: FOV_SHADOW <===> :fov-shadow
: TCOD_KEY_PRESSED <===> :key-pressed
: CENTER <===> :center
In general, most functions exist in both U.S. and non-U.S. spellings, This is
mainly relevant to those functions with colour/color or centre/center in their
names.
** Colournums
In libtcod, colours are represented as structures containing three integer
values: *red*, *green* and *blue* (each 0-255). The name of the structure type is
=TCOD_color_t=.
In CL-TCOD, these colour structs are converted into 3-byte integers using the C
functions =int_to_color(int)= and =color_to_int(TCOD_color_t)=, both defined in
=wrappers.c=. The 3 bytes are red, green and blue in order (blue is 1’s). ie:
: /* C */ ;; lisp ;;
: struct TCOD_color_t {r, g, b} <==> #x00RRGGBB
So, for example, one way to use the function =TCOD_color_multiply_scalar= from
lisp is:
;;; (tcod:color-multiply-scalar (tcod:compose-colour 218 165 32) 0.5)
All C functions that take or return =TCOD_color_t= structs, are wrapped by lisp
functions that take or return integers as described above.
** Colours by keyword
A lisp keyword is any symbol beginning with ’:’. In lisp, keywords (like all
symbols) are first-class values and can be passed around just like any other
value. CL-TCOD uses keywords to refer to particular colours, for example the
keyword =:cyan= refers to the colour #x0056A3CD (or 5678029 in decimal notation).
You can use keywords instead of colournums as arguments to lisp functions, by
using the function =colour= to return the colournum associated with a keyword:
;;; (tcod:colour :cyan) ; returns 5678029
You can also define your own colour names, like so:
;;; (tcod:make-colour :my-goldenrod 218 165 32)
;;; (tcod:color-multiply-scalar (tcod:colour :my-goldenrod) 0.5)
CL-TCOD knows all the colour names defined in the ’rgb.txt’ file under
Xwindows, eg =:navajo-white, :honeydew, :mint-cream=, and so on. There is
nothing special about the fact that rgb.txt comes from Xwindows – the colours
are just named R,G,B values and can be used anywhere that CL-TCOD can be
used. Look in the source file =’tcod-colours.lisp’= to see the available colour
names. If you are using [[http://www.gnu.org/software/emacs/][GNU Emacs]], the
king of lisp IDEs, do =M-x list-colors-display= to see a list of all colours.
** Lisp =format= versus C =printf=
The TCOD functions that accept =printf=-like string-formatting arguments,
have been modified to instead accept arguments to Common Lisp’s =format=
function.’ For example:
#+BEGIN_SRC c
TCOD_console_print (con, x, y, "Printing at %d, %dn", x, y);
#+END_SRC
becomes:
;;; (tcod:console-print con x y "Printing at ~D, ~D~%" x y)
** Miscellaneous extra functions
- [[console-print-double-frame]] is like [[console-print-frame]], but
but draws using ‘double-line’ characters:
;;; (tcod:console-print-double-frame CONSOLE X Y W H EMPTY? STRING...)
** Coverage
Does not provide wrappers for:
- File parser. Using this from lisp would be a very cumbersome way to read
values from a file, as the resulting values are not lisp objects. You would
be better to either consider using the lisp
‘read’ function, or looking into lisp libraries for parser generation.
- =namegen-get-sets= – I haven’t yet implemented this as it will have to
involve converting from libtcod’s bespoke ’linked list’ to a lisp list.
You may be better to write your random name generator in lisp (fairly trivial).
- =sys-get-directory-content=, =sys-file-exists=, =sys-is-directory=,
=sys-delete-file=: Common Lisp already has functions that do the same thing.
* Resources
** Specific to CL-TCOD and libtcod
The latest version of CL-TCOD is available at:
[[http://bitbucket.org/eeeickythump/cl-tcod/]]
Forum for discussion of CL-TCOD and use of lisp in roguelike games:
[[http://doryen.eptalys.net/forum/index.php?board=33.0][Roguecentral Lisp forum]]
The latest version of libtcod is available at:
[[http://doryen.eptalys.net/libtcod/]]
This Common Lisp package depends on CFFI, the Common Foreign Function Interface:
[[http://common-lisp.net/project/cffi/]]
** Learning Common Lisp
Recently written book, ’Practical Common Lisp’. buy hard copy or download free.
Recommended, especially if coming from non-lisp languages.
- [[http://www.gigamonkeys.com/book/]]
[[http://www.quicklisp.org/][Quicklisp]] allows you to very easily install
libraries – it automatically downloads and installs a library and its
dependencies, from within Lisp. If you don’t decide to go with Lisp in a
Box (below), then Quicklisp should be the first thing you install once you have
your lisp running.
*"Lisp in a Box"* – aims to make it easy to start using Common Lisp by
providing a single download with everything set up in advance (Lisp, Emacs,
SLIME, and Quicklisp).
- [[http://common-lisp.net/project/lispbox/]]
Lisp editors and IDEs:
- [[http://www.gnu.org/software/emacs/][GNU Emacs]] (the best; see below)
- [[http://common-lisp.net/project/slime/][SLIME]] is the Emacs interface to
Common Lisp.
- [[http://bitfauna.com/projects/cusp/][Cusp]], a common lisp plugin for Eclipse.
- The [[http://www.franz.com/products/allegrocl/][Allegro]] and
[[http://www.lispworks.com/][LispWorks]] lisp implementations each have a
builtin IDE.
- If you are on a Mac, the free, high-quality [[http://ccl.clozure.com][Clozure CL]]
has a builtin graphical IDE.
- Some editors with good lisp syntax highlighting include jEdit and Notepad++.
** A note on editors and IDEs
Emacs is a very powerful program. It is mainly used as a programmers’ text and
source code editor, but it can do – and plugins exist to make it do – just
about anything you can imagine. It is mostly written in a dialect of lisp, and
this is also its extension language. When combined with SLIME, a plugin
that allows it to communicate directly with a running common lisp
compiler/interpreter, Emacs is not only the best IDE for common lisp, but
one of the best and most advanced IDEs available for any programming language.
The downside: because Emacs + SLIME is so good, common lisp programmers have
put very little effort into getting other popular programming editors/IDEs to
support common lisp, at least beyond simple syntax highlighting. Emacs is an
idiosyncratic program (though development is active, it is about 34 years old)
and despite good efforts to modernise/regularise its interface it still has a
steeper learning curve than many other IDEs, especially when you are also
struggling to set up SLIME and get it to communicate through a socket with
your lisp process...
My advice is that while all roads lead to Emacs, you don’t have to hurry to get
there. Initially you should concentrate on getting common lisp set up and
starting to learn the language. Think about using the trial version of one of
the big commercial implementations (Allegro or LispWorks), as they have
built-in IDEs. Once you are ready to move on from them, install Emacs and
SLIME.
** Commercial Common Lisp implementations
These are both high quality, but painfully expensive. Luckily they have
’trial’ versions that can be downloaded for free, and which I recommend you
use when beginning to learn Common Lisp as they come with integrated
graphical editors/development environments (although if you have a Mac
you may wish to investigate Clozure CL’s IDE – see below).
- [[http://www.franz.com/products/allegrocl/][Allegro]] – starts at $599 USD
- [[http://www.lispworks.com/][LispWorks]] – starts at $900 USD for a
noncommercial license. The trial version quits automatically after 5 hours.
** Full-featured, free Common Lisp implementations
Move on to one of these if and when you outgrow Allegro or LispWorks.
For the title of the best, most robust free multiplatform Common Lisp compiler,
it is currently a very close call between these two:
- [[http://www.sbcl.org][Steel Bank Common Lisp (SBCL)]] Compiles to
machine code, great on Linux/Mac,
still nominally ’experimental’ on Windows but actually seems very stable
on that platform.
- [[http://ccl.clozure.com][Clozure CL]] Compiles to machine code; native to
Mac but recently ported to Linux and Windows. Formerly known as OpenMCL.
The Mac version has a graphical IDE.
Not to be confused with [[http://clojure.org][Clojure]], which is a different
dialect of lisp from Common Lisp.
Other worthwhile free implementations:
- [[http://clisp.cons.org][GNU CLISP]] Bytecode compiler, so programs won’t run
as fast as in the compiled lisps discussed above. However it runs pretty much
everywhere, and is easy to install on Windows.
- [[http://ecls.sourceforge.net/][Embeddable Common Lisp]] Promising, compiles
to C and then passes code to your C compiler. Does this ’on the fly’ when
running as an interpreter. Also designed to be easily embeddable in non-Lisp
applications as a scripting language.
- [[http://common-lisp.net/project/armedbear/][Armed Bear Common Lisp]]
Common Lisp compiler running inside the Java virtual machine, so your
code will run on any platform and can use all the Java libraries. I doubt
you’ll be able to use libtcod with this though.
Help & advice with lisp:
[[http://www.lispforum.com]]
cl-tcod
cffi
.
common-lisp
.
defstar
.
*root*
(special variable).
+null+
(special variable).
a*-path
(type).
background-add-alpha
(function).
background-alpha
(function).
background-flag
(type).
bsp-contains?
(function).
bsp-delete
(function).
bsp-father
(function).
bsp-find-node
(function).
bsp-is-leaf?
(function).
bsp-left
(function).
bsp-new-with-size
(function).
bsp-remove-sons
(function).
bsp-resize
(function).
bsp-right
(function).
bsp-split-once
(function).
bsp-split-recursive
(function).
bsp-traverse-in-order
(function).
bsp-traverse-inverted-level-order
(function).
bsp-traverse-level-order
(function).
bsp-traverse-post-order
(function).
bsp-traverse-pre-order
(function).
colctrl
(type).
colctrl->char
(function).
color
(function).
color->grayscale
(function).
color->keyword
(function).
color-add
(function).
color-equals?
(function).
color-get-hsv
(function).
color-get-hue
(function).
color-get-saturation
(function).
color-get-value
(function).
color-hsv
(function).
color-lerp
(function).
color-multiply
(function).
color-multiply-scalar
(function).
color-rgb
(function).
color-set-hsv
(function).
color-set-hue
(function).
color-set-saturation
(function).
color-set-value
(function).
color-shift-hue
(function).
color-subtract
(function).
colour
(function).
colour->grayscale
(function).
colour->keyword
(function).
colour-add
(function).
colour-equals?
(function).
colour-get-hsv
(function).
colour-hsv
(function).
colour-lerp
(function).
colour-multiply
(function).
colour-multiply-scalar
(function).
colour-rgb
(function).
colour-set-hsv
(function).
colour-set-hue
(function).
colour-set-saturation
(function).
colour-set-value
(function).
colour-shift-hue
(function).
colour-subtract
(function).
compose-color
(function).
compose-colour
(function).
console
(type).
console-blit
(function).
console-check-for-keypress
(function).
console-clear
(function).
console-credits
(function).
console-credits-reset
(function).
console-delete
(function).
console-disable-keyboard-repeat
(function).
console-fill-char
(function).
console-flush
(function).
console-get-alignment
(function).
console-get-background-flag
(function).
console-get-char
(function).
console-get-char-background
(function).
console-get-char-foreground
(function).
console-get-default-background
(function).
console-get-default-foreground
(function).
console-get-fade
(function).
console-get-fading-color
(function).
console-get-fading-colour
(function).
console-get-height
(function).
console-get-height-rect
(function).
console-get-width
(function).
console-hline
(function).
console-init-root
(function).
console-initialised?
(function).
console-is-fullscreen?
(function).
console-is-window-closed?
(function).
console-map-ascii-code-to-font
(function).
console-map-ascii-codes-to-font
(function).
console-map-string-to-font
(function).
console-map-string-to-font-utf
(function).
console-new
(function).
console-print
(function).
console-print-double-frame
(function).
console-print-ex
(function).
console-print-ex-utf
(function).
console-print-frame
(function).
console-print-rect
(function).
console-print-rect-ex
(function).
console-print-rect-ex-utf
(function).
console-print-rect-utf
(function).
console-print-utf
(function).
console-put-char
(function).
console-put-char-ex
(function).
console-rect
(function).
console-set-alignment
(function).
console-set-background-flag
(function).
console-set-char
(function).
console-set-char-background
(function).
console-set-char-foreground
(function).
console-set-color-control
(function).
console-set-colour-control
(function).
console-set-custom-font
(function).
console-set-default-background
(function).
console-set-default-foreground
(function).
console-set-dirty
(function).
console-set-fade
(function).
console-set-fullscreen
(function).
console-set-keyboard-repeat
(function).
console-set-window-title
(function).
console-vline
(function).
console-wait-for-keypress
(function).
decompose-color
(function).
decompose-colour
(function).
dijkstra-compute
(function).
dijkstra-delete
(function).
dijkstra-get
(function).
dijkstra-get-distance
(function).
dijkstra-is-empty?
(function).
dijkstra-new
(function).
dijkstra-new-using-function
(function).
dijkstra-path
(type).
dijkstra-path-set
(function).
dijkstra-path-walk
(function).
dijkstra-reverse
(function).
dijkstra-size
(function).
drawing-character
(type).
fov-algorithm
(type).
heightmap-add
(function).
heightmap-add-fbm
(function).
heightmap-add-hill
(function).
heightmap-add-hm
(function).
heightmap-add-voronoi
(function).
heightmap-clamp
(function).
heightmap-clear
(function).
heightmap-copy
(function).
heightmap-count-cells
(function).
heightmap-delete
(function).
heightmap-dig-bezier
(function).
heightmap-dig-hill
(function).
heightmap-dig-line
(function).
heightmap-get-interpolated-value
(function).
heightmap-get-max
(function).
heightmap-get-min
(function).
heightmap-get-normal
(function).
heightmap-get-slope
(function).
heightmap-get-value
(function).
heightmap-has-land-on-border?
(function).
heightmap-islandify
(function).
heightmap-kernel-transform
(function).
heightmap-lerp-hm
(function).
heightmap-multiply-hm
(function).
heightmap-new
(function).
heightmap-normalise
(function).
heightmap-normalize
(function).
heightmap-rain-erosion
(function).
heightmap-scale
(function).
heightmap-scale-fbm
(function).
heightmap-set-value
(function).
hello-world
(function).
image-blit
(function).
image-blit-2x
(function).
image-blit-rect
(function).
image-clear
(function).
image-delete
(function).
image-from-console
(function).
image-get-alpha
(function).
image-get-height
(function).
image-get-mipmap-pixel
(function).
image-get-pixel
(function).
image-get-width
(function).
image-hflip
(function).
image-invert
(function).
image-is-pixel-transparent?
(function).
image-load
(function).
image-new
(function).
image-put-pixel
(function).
image-refresh-console
(function).
image-rotate90
(function).
image-save
(function).
image-scale
(function).
image-set-key-color
(function).
image-set-key-colour
(function).
image-vflip
(function).
invert-color
(function).
invert-colour
(function).
is-key-pressed?
(function).
key
(structure).
key-c
(reader).
(setf key-c)
(writer).
key-lalt
(reader).
(setf key-lalt)
(writer).
key-lctrl
(reader).
(setf key-lctrl)
(writer).
key-lmeta
(reader).
(setf key-lmeta)
(writer).
key-p
(function).
key-pressed
(reader).
(setf key-pressed)
(writer).
key-ralt
(reader).
(setf key-ralt)
(writer).
key-rctrl
(reader).
(setf key-rctrl)
(writer).
key-rmeta
(reader).
(setf key-rmeta)
(writer).
key-shift
(reader).
(setf key-shift)
(writer).
key-state
(type).
key-vk
(reader).
(setf key-vk)
(writer).
keycode
(type).
legal-console-coordinates?
(macro).
line-init
(function).
line-line
(function).
line-step
(function).
make-color
(function).
make-colour
(function).
make-key
(function).
make-mouse
(function).
make-simple-key
(function).
map-clear
(function).
map-compute-fov
(function).
map-copy
(function).
map-delete
(function).
map-get-height
(function).
map-get-nb-cells
(function).
map-get-width
(function).
map-is-in-fov?
(function).
map-is-transparent?
(function).
map-is-walkable?
(function).
map-new
(function).
map-set-in-fov
(function).
map-set-properties
(function).
mapptr
(type).
mouse
(structure).
mouse-cx
(reader).
(setf mouse-cx)
(writer).
mouse-cy
(reader).
(setf mouse-cy)
(writer).
mouse-dx
(reader).
(setf mouse-dx)
(writer).
mouse-dy
(reader).
(setf mouse-dy)
(writer).
mouse-get-status
(function).
mouse-is-cursor-visible?
(function).
mouse-lbutton
(reader).
(setf mouse-lbutton)
(writer).
mouse-lbutton-pressed
(reader).
(setf mouse-lbutton-pressed)
(writer).
mouse-mbutton
(reader).
(setf mouse-mbutton)
(writer).
mouse-mbutton-pressed
(reader).
(setf mouse-mbutton-pressed)
(writer).
mouse-move
(function).
mouse-rbutton
(reader).
(setf mouse-rbutton)
(writer).
mouse-rbutton-pressed
(reader).
(setf mouse-rbutton-pressed)
(writer).
mouse-show-cursor
(function).
mouse-wheel-down
(reader).
(setf mouse-wheel-down)
(writer).
mouse-wheel-up
(reader).
(setf mouse-wheel-up)
(writer).
mouse-x
(reader).
(setf mouse-x)
(writer).
mouse-y
(reader).
(setf mouse-y)
(writer).
namegen-destroy
(function).
namegen-generate
(function).
namegen-generate-custom
(function).
namegen-parse
(function).
noise-delete
(function).
noise-get
(function).
noise-get-ex
(function).
noise-get-fbm
(function).
noise-get-fbm-ex
(function).
noise-get-turbulence
(function).
noise-get-turbulence-ex
(function).
noise-new
(function).
noise-set-type
(function).
path-compute
(function).
path-delete
(function).
path-get
(function).
path-get-destination
(function).
path-get-origin
(function).
path-is-empty?
(function).
path-new-using-function
(function).
path-new-using-map
(function).
path-reverse
(function).
path-size
(function).
path-walk
(function).
random-delete
(function).
random-get-double
(function).
random-get-double-mean
(function).
random-get-float
(function).
random-get-float-mean
(function).
random-get-instance
(function).
random-get-int
(function).
random-get-int-mean
(function).
random-new
(function).
random-new-from-seed
(function).
random-restore
(function).
random-save
(function).
random-set-distribution
(function).
same-keys?
(function).
sdl-get-mouse-state
(function).
start-colors
(function).
start-colours
(function).
sys-check-for-event
(function).
sys-clipboard-get
(function).
sys-clipboard-set
(function).
sys-create-directory
(function).
sys-delete-directory
(function).
sys-elapsed-milli
(function).
sys-elapsed-seconds
(function).
sys-force-fullscreen-resolution
(function).
sys-get-char-size
(function).
sys-get-current-resolution
(function).
sys-get-events
(function).
sys-get-fps
(function).
sys-get-fullscreen-offsets
(function).
sys-get-last-frame-length
(function).
sys-get-renderer
(function).
sys-register-sdl-renderer
(function).
sys-save-screenshot
(function).
sys-set-fps
(function).
sys-set-renderer
(function).
sys-sleep-milli
(function).
sys-update-char
(function).
sys-wait-events
(function).
sys-wait-for-event
(function).
zip-delete
(function).
zip-get-char
(function).
zip-get-color
(function).
zip-get-colour
(function).
zip-get-console
(function).
zip-get-current-bytes
(function).
zip-get-data
(function).
zip-get-float
(function).
zip-get-image
(function).
zip-get-int
(function).
zip-get-remaining-bytes
(function).
zip-get-string
(function).
zip-load-from-file
(function).
zip-new
(function).
zip-put
(function).
zip-put-char
(function).
zip-put-color
(function).
zip-put-colour
(function).
zip-put-console
(function).
zip-put-data
(function).
zip-put-float
(function).
zip-put-image
(function).
zip-put-int
(function).
zip-put-string
(function).
zip-save-to-file
(function).
zip-skip-bytes
(function).
zipptr
(type).
%%%console-map-string-to-font-utf
(function).
%%%heightmap-add-voronoi
(function).
%%%heightmap-get-normal
(function).
%%%heightmap-kernel-transform
(function).
%%bsp-contains?
(function).
%%bsp-delete
(function).
%%bsp-father
(function).
%%bsp-find-node
(function).
%%bsp-is-leaf?
(function).
%%bsp-left
(function).
%%bsp-new-with-size
(function).
%%bsp-remove-sons
(function).
%%bsp-resize
(function).
%%bsp-right
(function).
%%bsp-split-once
(function).
%%bsp-split-recursive
(function).
%%bsp-traverse-in-order
(function).
%%bsp-traverse-inverted-level-order
(function).
%%bsp-traverse-level-order
(function).
%%bsp-traverse-post-order
(function).
%%bsp-traverse-pre-order
(function).
%%colour-add
(function).
%%colour-equals?
(function).
%%colour-lerp
(function).
%%colour-multiply
(function).
%%colour-multiply-scalar
(function).
%%colour-set-hsv
(function).
%%colour-subtract
(function).
%%console-blit
(function).
%%console-clear
(function).
%%console-credits
(function).
%%console-credits-render
(function).
%%console-credits-reset
(function).
%%console-delete
(function).
%%console-disable-keyboard-repeat
(function).
%%console-flush
(function).
%%console-get-alignment
(function).
%%console-get-background-flag
(function).
%%console-get-char
(function).
%%console-get-char-background
(function).
%%console-get-char-foreground
(function).
%%console-get-default-background
(function).
%%console-get-default-foreground
(function).
%%console-get-fade
(function).
%%console-get-fading-color
(function).
%%console-get-height
(function).
%%console-get-width
(function).
%%console-hline
(function).
%%console-is-fullscreen?
(function).
%%console-is-window-closed?
(function).
%%console-map-ascii-code-to-font
(function).
%%console-map-ascii-codes-to-font
(function).
%%console-map-string-to-font
(function).
%%console-new
(function).
%%console-print-return-string
(function).
%%console-put-char
(function).
%%console-put-char-ex
(function).
%%console-rect
(function).
%%console-set-alignment
(function).
%%console-set-background-flag
(function).
%%console-set-char-background
(function).
%%console-set-char-foreground
(function).
%%console-set-colour-control
(function).
%%console-set-default-background
(function).
%%console-set-default-foreground
(function).
%%console-set-dirty
(function).
%%console-set-fade
(function).
%%console-set-fullscreen
(function).
%%console-set-keyboard-repeat
(function).
%%console-set-window-title
(function).
%%console-vline
(function).
%%dijkstra-compute
(function).
%%dijkstra-delete
(function).
%%dijkstra-get-distance
(function).
%%dijkstra-is-empty?
(function).
%%dijkstra-new
(function).
%%dijkstra-new-using-function
(function).
%%dijkstra-path-set
(function).
%%dijkstra-reverse
(function).
%%dijkstra-size
(function).
%%heightmap-add
(function).
%%heightmap-add-fbm
(function).
%%heightmap-add-hill
(function).
%%heightmap-add-hm
(function).
%%heightmap-clamp
(function).
%%heightmap-clear
(function).
%%heightmap-copy
(function).
%%heightmap-count-cells
(function).
%%heightmap-delete
(function).
%%heightmap-dig-hill
(function).
%%heightmap-get-interpolated-value
(function).
%%heightmap-get-slope
(function).
%%heightmap-get-value
(function).
%%heightmap-has-land-on-border?
(function).
%%heightmap-islandify
(function).
%%heightmap-lerp-hm
(function).
%%heightmap-multiply-hm
(function).
%%heightmap-new
(function).
%%heightmap-normalize
(function).
%%heightmap-scale
(function).
%%heightmap-scale-fbm
(function).
%%heightmap-set-value
(function).
%%image-blit
(function).
%%image-blit-2x
(function).
%%image-blit-rect
(function).
%%image-clear
(function).
%%image-delete
(function).
%%image-from-console
(function).
%%image-get-alpha
(function).
%%image-get-mipmap-pixel
(function).
%%image-get-pixel
(function).
%%image-hflip
(function).
%%image-invert
(function).
%%image-is-pixel-transparent?
(function).
%%image-load
(function).
%%image-new
(function).
%%image-put-pixel
(function).
%%image-refresh-console
(function).
%%image-rotate90
(function).
%%image-save
(function).
%%image-scale
(function).
%%image-set-key-color
(function).
%%image-vflip
(function).
%%is-key-pressed?
(function).
%%line-init
(function).
%%line-line
(function).
%%line-step
(function).
%%map-clear
(function).
%%map-compute-fov
(function).
%%map-copy
(function).
%%map-delete
(function).
%%map-get-height
(function).
%%map-get-nb-cells
(function).
%%map-get-width
(function).
%%map-is-in-fov?
(function).
%%map-is-transparent?
(function).
%%map-is-walkable?
(function).
%%map-new
(function).
%%map-set-in-fov
(function).
%%map-set-properties
(function).
%%mouse-is-cursor-visible?
(function).
%%mouse-move
(function).
%%mouse-show-cursor
(function).
%%namegen-destroy
(function).
%%namegen-generate
(function).
%%namegen-generate-custom
(function).
%%namegen-parse
(function).
%%noise-delete
(function).
%%noise-set-type
(function).
%%path-compute
(function).
%%path-delete
(function).
%%path-is-empty?
(function).
%%path-new-using-function
(function).
%%path-new-using-map
(function).
%%path-reverse
(function).
%%path-size
(function).
%%random-delete
(function).
%%random-get-double
(function).
%%random-get-double-mean
(function).
%%random-get-float
(function).
%%random-get-float-mean
(function).
%%random-get-instance
(function).
%%random-get-int
(function).
%%random-get-int-mean
(function).
%%random-new
(function).
%%random-new-from-seed
(function).
%%random-restore
(function).
%%random-save
(function).
%%random-set-distribution
(function).
%%sys-check-for-event
(function).
%%sys-clipboard-get
(function).
%%sys-clipboard-set
(function).
%%sys-create-directory
(function).
%%sys-delete-directory
(function).
%%sys-elapsed-milli
(function).
%%sys-elapsed-seconds
(function).
%%sys-force-fullscreen-resolution
(function).
%%sys-get-fps
(function).
%%sys-get-last-frame-length
(function).
%%sys-get-renderer
(function).
%%sys-register-sdl-renderer
(function).
%%sys-set-fps
(function).
%%sys-set-renderer
(function).
%%sys-sleep-milli
(function).
%%sys-update-char
(function).
%%sys-wait-for-event
(function).
%%zip-delete
(function).
%%zip-get-char
(function).
%%zip-get-console
(function).
%%zip-get-current-bytes
(function).
%%zip-get-data
(function).
%%zip-get-float
(function).
%%zip-get-image
(function).
%%zip-get-int
(function).
%%zip-get-remaining-bytes
(function).
%%zip-get-string
(function).
%%zip-load-from-file
(function).
%%zip-new
(function).
%%zip-put-char
(function).
%%zip-put-console
(function).
%%zip-put-data
(function).
%%zip-put-float
(function).
%%zip-put-image
(function).
%%zip-put-int
(function).
%%zip-put-string
(function).
%%zip-save-to-file
(function).
%%zip-skip-bytes
(function).
%console-get-height-rect
(macro).
%console-get-height-rect-utf
(macro).
%console-init-root
(function).
%console-map-string-to-font-utf
(function).
%console-print
(macro).
%console-print-double-frame
(macro).
%console-print-ex
(macro).
%console-print-ex-utf
(macro).
%console-print-frame
(macro).
%console-print-rect
(macro).
%console-print-rect-ex
(macro).
%console-print-rect-ex-utf
(macro).
%console-print-rect-utf
(macro).
%console-print-utf
(macro).
%console-set-char
(function).
%console-set-custom-font
(function).
%console-wait-for-keypress
(function).
%dijkstra-get
(function).
%dijkstra-path-walk
(function).
%heightmap-add-voronoi
(function).
%heightmap-dig-bezier
(function).
%heightmap-get-minmax
(function).
%heightmap-get-normal
(function).
%heightmap-kernel-transform
(function).
%heightmap-rain-erosion
(function).
%image-get-size
(function).
%mouse-get-status
(function).
%noise-get
(function).
%noise-get-ex
(function).
%noise-get-fbm
(function).
%noise-get-fbm-ex
(function).
%noise-get-turbulence
(function).
%noise-get-turbulence-ex
(function).
%noise-new
(function).
%path-get
(function).
%path-get-destination
(function).
%path-get-origin
(function).
%path-walk
(function).
%sys-get-char-size
(function).
%sys-get-fullscreen-offsets
(function).
%sys-save-screenshot
(function).
*colour-table*
(special variable).
*console-height-table*
(special variable).
*console-width-table*
(special variable).
*initial-colours*
(special variable).
*libsdl2-loaded*
(special variable).
*libtcod-loaded*
(special variable).
*root-console-initialised?*
(special variable).
+noise-default-hurst+
(constant).
+noise-default-lacunarity+
(constant).
alignment
(type).
bsp-ptr
(type).
c-type->lisp-type
(function).
clamp
(macro).
colour-scale-hsv
(function).
colour-struct-tclass
(class).
colournum
(type).
console-credits-render
(function).
console-get-height-rect-utf
(function).
console-print-return-string
(function).
copy-key
(function).
copy-mouse
(function).
custom-font-flags
(type).
custom-font-flags-predicate
(function).
define-c-bitfield
(macro).
define-c-enum
(macro).
define-c-function
(macro).
define-c-type
(macro).
event
(type).
get-bit
(function).
heightmap-ptr
(type).
image
(type).
int
(type).
key->keypress
(function).
key-bitfield->vk
(function).
key-press-tclass
(class).
key-state-predicate
(function).
make-rgb.txt-colours
(function).
mouse-dcx
(reader).
(setf mouse-dcx)
(writer).
mouse-dcy
(reader).
(setf mouse-dcy)
(writer).
mouse-p
(function).
mouse-state-tclass
(class).
noise
(type).
noise-type
(type).
parse-mouse-state
(function).
parser
(type).
prepend-percent
(function).
randomptr
(type).
renderer
(type).
rng-algorithm
(type).
rng-distribution
(type).
signed-char
(type).
simple-type?
(function).
sint16
(type).
sys-get-current-resolution-x
(function).
sys-get-current-resolution-y
(function).
uchar
(type).
ucoord
(type).
uint
(type).
uint16
(type).
uint24
(type).
uint32
(type).
uint8
(type).
Definitions are sorted by export status, category, package, and then by lexicographic order.
Are the relative coordinates X,Y within the bounds of console CON?
Given a colour keyword such as :GREY, return its corresponding RGB value (#xRRGGBB). If the keyword is unrecognised, then either return a light grey colour, or raise an error (if ‘error?’ is non-nil).
Return a new colour with the given HSV (hue, saturation and value) components.
Return COLOUR with its hue modified to HUE.
Return COLOUR with its saturation modified to SAT.
Return COLOUR with its HSV value modified to VAL.
Given three integer values R, G and B, representing the red, green and blue components of a colour, return a 3 byte integer whose value is #xBBGGRR.
Fill a rectangular area with the character CH.
Declares an area of the =*root*= console to be ’dirty’.
Given a colournum #xBBGGRR, return R, G and B integer values as 3 separate return values.
Compute paths leading to the point at =(ROOTX, ROOTY)=, using the Dijkstra algorithm.
Delete a Dijkstra path object.
Return the INDEXth step in the path from its current origin to its current destination.
Return the number of steps on the path leading from the root node to the point at =(TO-X, TO-Y)=.
Return true if the path object is empty (has zero steps).
Return a new Dijkstra path object which uses =MAP=.
Return a new Dijkstra path object which calls the function =CALLBACK= to calculate movement costs.
Return true if a path can be found leading from the root node to the point at =(TO-X, TO-Y)=.
Move one step along =PATH=. The path becomes one step shorter. Returns the coordinates of the new location.
Swap origin and destination for a Dijkstra path object.
Return the number of steps in the path.
Add =VALUE= to all heights in the heightmap.
Add values from the random noise object =NOISE= to all heights in equivalent positions in =HEIGHTMAP=.
Add the heights in =HM1= to heights in equivalent positions in =HM2=, and store the results in the heightmap =RESULT=.
* Arguments:
- HEIGHTMAP :: pointer to a heightmap object.
- NUM-POINTS :: number of Voronoi sites to create.
- COEFS :: list of floats to use to scale the distance to each site.
- RNG :: pointer to a random number generator object.
If any height in =HEIGHTMAP= is below =MIN= or above =MAX=, set it equal to =MIN= or =MAX= respectively.
Set all the heights in the heightmap to zero.
Copy the heightmap =SOURCE= into the heightmap object =DEST=.
Return the number of cells in =HEIGHTMAP= which contain heights between =MIN= and =MAX=.
Destroy the heightmap object =HEIGHTMAP=.
Carve a path through =HEIGHTMAP= using a cubic Bezier curve.
Calculate the height at position =(X, Y)= in the heightmap, where the coordinates might not be integers.
Return the highest height in =HEIGHTMAP=.
Return the lowest height in =HEIGHTMAP=.
* Returns: a list of 3 floats, representing the normalised normal vector of the point at X, Y.
Return the slope at position =(X, Y)= in the heightmap. The value returned will be between 0 and pi/2.
Return the height at position =(X, Y)= in the heightmap.
Return true if any of the border cells of =HEIGHTMAP= have heights greater than =WATERLEVEL=.
* Arguments:
- HEIGHTMAP :: pointer to a heightmap object.
- COORDS :: a list of (X . Y) cons cells specifying coordinates relative to the
cell being processed. For example (-1 . 0) is the cell to the west, (0 . 1) is
the cell to the south, etc.
- WEIGHTS :: a list of factors by which to scale the values in processed cells.
The list must be the same length as COORDS.
- MIN-LEVEL, MAX-LEVEL :: Cells are only processed if their values lies within
these limits.
Fill the heightmap =RESULT= with the results of a lerp operation between the two heightmaps =HM1= and =HM2=.
Multiply the heights in =HM1= by the heights in equivalent positions in =HM2=, and store the results in the heightmap =RESULT=.
Return a new heightmap with the given dimensions.
Scale all the heights in =HEIGHTMAP= so that the lowest is equal to =MIN= and the highest is equal to =MAX=.
’Erode’ the heightmap =HEIGHTMAP= by dropping =NUM-DROPS= ’raindrops’ in random locations.
Multiply all the heights in the heightmap by =SCALE=.
Set the height at position =(X, Y)= in the heightmap to =VALUE=.
Fill the image =IMAGE= with the colour =COLOUR=.
Return a new image whose contents are a ’screenshot’ of the console =CON=.
Calculate the interpolated colour of the pixel at =(PIXEL-X, PIXEL-Y)= in =IMAGE=.
Return the colour of the pixel at =(PIXEL-X, PIXEL-Y)= in =IMAGE=.
Read an image from a file and return it.
Return a new image, filled with black.
Set the colour of the pixel at =(PIXEL-X, PIXEL-Y)= in =IMAGE= to =COLOUR=.
Write the image =IMAGE= to a file. The filename must end in =.BMP= or =.PNG=.
Set all cells in =MAP= to be neither walkable nor transparent.
Compute field of view information for =MAP=, assuming the player is at =(PLAYER-X, PLAYER-Y)=, and using the field of view algorithm =ALGORITHM=.
Copy the map object =SRC= into the new map object =DEST=.
Return the height of the map object =MAP=.
Return the number of cells in the map object =MAP=.
Return the width of the map object =MAP=.
Return true if position =(X, Y)= on the map is visible.
Return true if position =(X, Y)= on the map is set to be transparent.
Return true if position =(X, Y)= on the map is set to be walkable.
Return a new map object of the given dimensions.
Set whether the cell at X, Y in =MAP= is in field of view.
Set the properties of the map cell at =(X, Y)=. It is walkable if =walkable?= is true, and transparent if =transparent?= is true.
Note that as of libtcod 1.5.1rc1, ‘mouse-get-status’ returns information about the status of the mouse as at the last time ‘sys-check-for-event’ was called. If you want the *current* status of the mouse to be returned instead, UPDATE? should be non-nil.
tcod
.
tcod
.
tcod
.
tcod
.
Returns the flat noise function at the given coordinates.
Returns the flat noise function at the given coordinates, using noise type NOISE-TYPE.
Returns the fractional Brownian motion function at the given coordinates.
Returns the fractional Brownian motion function at the given coordinates, using noise type NOISE-TYPE.
Returns the turbulence function at the given coordinates.
Returns the turbulence function at the given coordinates, using noise type NOISE-TYPE.
Return a new noise object with the given characteristics.
Set the type of noise produced by a noise object.
Compute the path between the two points =(OX,OY)= and =(DX,DY)=, using the A* algorithm.
Return the INDEXth step in the path from its current origin to its current destination.
Return the coordinates of the current destination of the A* path =PATH=.
Return the coordinates of the current origin of the A* path =PATH=.
Return true if the path object is empty (has zero steps).
Return a new A* path object, which will call the function =CALLBACK= to calculate movement costs.
Return a new A* path object, using the map =MAP=.
Swap origin and destination for an A* path object.
Return the number of steps in the path.
Move one step along =PATH=. The path becomes one step shorter. Returns the coordinates of the new location.
Return the dimensions of each character in the current font bitmap.
User-friendly wrapper for the new input event model in libtcod 1.5.1rc1. When called, returns a list of all queued events (calling the function also EMPTIES the queue). Each element in the list is a cons cell of the form (EVENT-TYPE . DATA) where EVENT-TYPE is a member of the ‘event’ enum, and DATA is either a key struct or a mouse-state struct.
Return the currently active renderer.
Change the currently active renderer.
Like the wrapper sys-get-events, but using TCOD_sys_wait_for_event. Takes a filter for what event (‘event’ enum) to wait for as well as whether or not to flush the event buffer of all pending events.
The structure used by CL-TCOD to represent key-press events. Corresponds to the structure used by libtcod.
tcod
.
structure-object
.
keyword
:none
character
#\nul
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
Structure used by CL-TCOD to represent mouse status.
tcod
.
structure-object
.
tcod::uint16
0
tcod::uint16
0
tcod::sint16
0
tcod::sint16
0
tcod::uint16
0
tcod::uint16
0
tcod::sint16
0
tcod::sint16
0
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
Default Hurst exponent for noise functions.
Default lacunarity for noise functions.
Global variable, set to non-nil once libtcod is loaded. This is to avoid crashes which occur in some CL implementations when you load an already-loaded foreign library.
Set to T once ‘console-init-root’ has been called.
Return the numeric value of EXPR, constrained to the range [LOW ... HI].
Defines both the CFFI bitfield, and a lisp type of the same name, which is satisfied by a list containing only bitfield keywords as members.
Defines both the CFFI =enum= type, and a lisp type of the same
name which is satisified by any of the values allowed by the enum type.
Format is similar to =CFFI:DEFCFUN=, except that:
1. The function arguments are wrapped in a set of outer parentheses.
2. Everything after this ‘arguments’ term is considered to be the body
of the wrapper function. Within this body, the macro =(call-it)=
will call the actual C function. If =call-it= is called with no arguments,
it will pass all the arguments given to the wrapper function, to the
C function. Otherwise it will pass whatever arguments it is given, to
the C function (similar to =call-next-method=).
3. If there is nothing after the function arguments, then the wrapper function
body will automatically consist of a single call to the underlying
C function.
Define both a CFFI foreign type, and a corresponding lisp type of the same name.
Given a CFFI foreign type, return an equivalent lisp type.
Return the bit at position POS within the integer N (represented as a bitfield). POS = 1 refers to the 1’s (rightmost) bit.
* Arguments
- SYM :: A symbol.
* Return Value
Boolean.
* Description
Returns =T= if =SYM= names a non-class type, such as can be
defined by [[deftype]].
Jump to: | %
(
B C D F G H I K L M N P R S Z |
---|