2.9 "world"
(include-book "world" :dir :teachpacks)
This teachpack provides a datatype for images and a framework for interactive animations. It is partially reflected in the ACL2 logic, but some of the primitives cannot be fully reasoned about or executed due by ACL2 to their imperative and platform-specific nature.
2.9.1 Animations
These forms produce an interactive animation that reacts to events. The user must define a World datatype, representing the state of an animation, and functions to update the World in response to events such as keystrokes or mouse buttons. From this, the teachpack can generate an interactive animation.
Events are based on two extra datatypes. A KeyEvent represents a keystroke, and may be either a character or a symbol such as 'left, 'right, 'up, or 'down. A MouseEvent represents an action of the mouse cursor, and may be 'button-down, 'button-up, 'drag, 'move, 'enter, or 'leave.
procedure
(on-tick-event tick) → t
tick : World -> World
procedure
(on-tick-event/state tick) → t
tick : World state -> (mv World state)
procedure
(on-key-event press) → t
press : World KeyEvent -> World
procedure
(on-key-event/state press) → t
press : World KeyEvent State -> (mv World State)
procedure
(on-mouse-event click) → t
click :
World integerp integerp MouseEvent -> World
procedure
(on-mouse-event/state click) → t
click : World integerp integerp MouseEvent State -> (mv World State)
2.9.2 Scenes
These primitives operate on images intended as complete animation frames.
procedure
(empty-scene width height) → image?
width : posp height : posp
2.9.3 Images
These primitives construct images as first-class values.
procedure
w : posp h : posp m : mode? c : image-color?
procedure
r : posp m : mode? c : image-color?
procedure
s : posp m : mode? c : image-color?
procedure
x : integerp y : integerp c : image-color?
procedure
str : stringp size : posp color : image-color?
procedure
i : image?
procedure
(overlay/xy i x y j) → image?
i : image? x : integerp y : integerp j : image?
procedure
(image-width i) → posp
i : image?
procedure
(image-height i) → posp
i : image?
procedure
(put-pinhole i x y) → image?
i : image? x : integerp y : integerp
procedure
(move-pinhole i x y) → image?
i : image? x : integerp y : integerp
procedure
i : image?
procedure
i : image?
2.9.4 Colors and Modes
procedure
(image-color? v) → booleanp
v : t
DarkRed, Red, LightPink, Pink, Brown, DarkOrange, Orange, Yellow, LightYellow, Green, DarkGreen, LightGreen, Cyan, LightBlue, LightCyan, DarkBlue, Blue, Purple, Magenta, DarkMagenta, Violet, White, LightGray, Gray, DarkGray, and Black.
procedure
(make-color r g b) → color?
r : bytep g : bytep b : bytep
procedure
c : color?
procedure
(color-green c) → bytep
c : color?
procedure
(color-blue c) → bytep
c : color?
procedure
v : t
2.9.5 Posns
procedure
x : integerp y : integerp
procedure
p : posn?
procedure
p : posn?
procedure
v : t
procedure
(weak-posn? v) → booleanp
v : t