clean up the docs for the Planet Cute images

This commit is contained in:
Robby Findler 2011-10-28 07:45:13 -05:00
parent 2b7fedb79b
commit f48e12240a
7 changed files with 110 additions and 72 deletions

View File

@ -5,7 +5,7 @@
(define-syntax (definitions stx) (define-syntax (definitions stx)
#`(begin #`(begin
#,@(for/list ([img (in-list images)]) #,@(for/list ([img (in-list (apply append (map cdr images)))])
(define req (string->symbol (format "2htdp/planetcute/~a" (name->filename img)))) (define req (string->symbol (format "2htdp/planetcute/~a" (name->filename img))))
#`(begin #`(begin
(provide #,img) (provide #,img)

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -15,29 +15,52 @@
(format "~a.png" (apply string (reverse new-chars)))) (format "~a.png" (apply string (reverse new-chars))))
(define images (define images
'(brown-block '((Characters
character-boy character-boy
character-cat-girl character-cat-girl
character-horn-girl character-horn-girl
character-pink-girl character-pink-girl
character-princess-girl character-princess-girl
enemy-bug
speechbubble)
(Items
chest-closed chest-closed
chest-lid chest-lid
chest-open chest-open
dirt-block
door-tall-closed
door-tall-open
enemy-bug
gem-blue gem-blue
gem-green gem-green
gem-orange gem-orange
grass-block
heart heart
key key
rock
selector
tree-short
tree-tall
tree-ugly
yellow-star)
(Blocks
brown-block
dirt-block
grass-block
plain-block plain-block
stone-block-tall
stone-block
wall-block-tall
wall-block
water-block
wood-block)
(Ramps
ramp-east
ramp-north ramp-north
ramp-south ramp-south
ramp-west ramp-west)
(Buildings
door-tall-closed
door-tall-open
roof-east roof-east
roof-north-east roof-north-east
roof-north-west roof-north-west
@ -46,6 +69,9 @@
roof-south-west roof-south-west
roof-south roof-south
roof-west roof-west
window-tall)
(Shadows
shadow-east shadow-east
shadow-north-east shadow-north-east
shadow-north-west shadow-north-west
@ -54,14 +80,4 @@
shadow-south-east shadow-south-east
shadow-south-west shadow-south-west
shadow-south shadow-south
shadow-west shadow-west)))
stone-block-tall
stone-block
tree-short
tree-tall
tree-ugly
wall-block-tall
wall-block
water-block
window-tall
wood-block))

View File

@ -10,5 +10,5 @@
@include-section["batch-io.scrbl"] @include-section["batch-io.scrbl"]
@include-section["image.scrbl"] @include-section["image.scrbl"]
@include-section["universe.scrbl"] @include-section["universe.scrbl"]
@include-section["port.scrbl"]
@include-section["planetcute.scrbl"] @include-section["planetcute.scrbl"]
@include-section["port.scrbl"]

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

View File

@ -4,8 +4,11 @@
"port.rkt" "port.rkt"
scribble/manual scribble/manual
scribble/eval scribble/eval
(for-syntax racket/base)
2htdp/image 2htdp/image
racket/runtime-path
racket/draw
racket/class
(for-syntax racket/base)
(for-label 2htdp/image (for-label 2htdp/image
2htdp/planetcute)) 2htdp/planetcute))
@ -20,8 +23,8 @@
@(interaction-eval #:eval pc-eval (require 2htdp/planetcute)) @(interaction-eval #:eval pc-eval (require 2htdp/planetcute))
The @racketmodname[2htdp/planetcute] library contains the The @racketmodname[2htdp/planetcute] library contains the
Planet Cute art by Daniel Cook (Lostgarden.com), @link["http://www.lostgarden.com/2007/05/dancs-miraculously-flexible-game.html"]{Planet Cute}
@url{http://www.lostgarden.com/2007/05/dancs-miraculously-flexible-game.html}, art by Daniel Cook (Lostgarden.com).
The images are designed to be overlaid with each other to build The images are designed to be overlaid with each other to build
scenes for use in games. Here is an example image taken scenes for use in games. Here is an example image taken
@ -29,6 +32,8 @@ from the Planet Cute website.
@racketblock+eval[#:eval @racketblock+eval[#:eval
pc-eval pc-eval
(code:comment "stacks its arguments on each")
(code:comment "other, separated by 40 pixels")
(define (stack arg . args) (define (stack arg . args)
(cond (cond
[(null? args) arg] [(null? args) arg]
@ -36,8 +41,6 @@ from the Planet Cute website.
(apply stack args))]))] (apply stack args))]))]
@interaction[#:eval @interaction[#:eval
pc-eval pc-eval
(scale
1
(beside/align (beside/align
"bottom" "bottom"
(stack wall-block-tall stone-block) (stack wall-block-tall stone-block)
@ -46,15 +49,34 @@ from the Planet Cute website.
stone-block stone-block) stone-block stone-block)
water-block water-block
(stack grass-block dirt-block) (stack grass-block dirt-block)
(stack grass-block dirt-block dirt-block)))] (stack grass-block dirt-block dirt-block))]
@(close-eval pc-eval) @(close-eval pc-eval)
The Planet Cute images also include some shadows that can improve the
look of your game; see the @secref["pc:Shadows"] section for an overview
of how to use them.
@(require (for-syntax 2htdp/private/planetcute-image-list)) @(require (for-syntax 2htdp/private/planetcute-image-list))
@(define-syntax (defthings stx) @(define-syntax (defthings stx)
(syntax-case stx ()
[(_ what whatever ...)
(identifier? #'what)
(let* ([sym (syntax-e #'what)]
[sec-title (symbol->string sym)]
[these-images (cdr (assoc sym images))])
#`(begin #`(begin
#,@(for/list ([img (in-list images)]) @section[#:tag #,(format "pc:~a" sec-title) #,sec-title]
whatever ...
#,@(for/list ([img (in-list these-images)])
(define req (string->symbol (format "2htdp/planetcute/~a" (name->filename img)))) (define req (string->symbol (format "2htdp/planetcute/~a" (name->filename img))))
#`@defthing[#,img image?]{ @(bitmap #,req) }))) #`@defthing[#,img image?]{ @(bitmap #,req) })))]))
@defthings[] @(define-runtime-path PlanetCuteShadowTest.png "PlanetCuteShadowTest.png")
@defthings[Characters]{}
@defthings[Blocks]{}
@defthings[Items]{}
@defthings[Ramps]{}
@defthings[Buildings]{}
@defthings[Shadows]{@(make-object bitmap% PlanetCuteShadowTest.png)}