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,53 +15,69 @@
(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
chest-closed enemy-bug
chest-lid speechbubble)
chest-open
dirt-block (Items
door-tall-closed chest-closed
door-tall-open chest-lid
enemy-bug chest-open
gem-blue gem-blue
gem-green gem-green
gem-orange gem-orange
grass-block heart
heart key
key rock
plain-block selector
ramp-north tree-short
ramp-south tree-tall
ramp-west tree-ugly
roof-east yellow-star)
roof-north-east
roof-north-west (Blocks
roof-north brown-block
roof-south-east dirt-block
roof-south-west grass-block
roof-south plain-block
roof-west stone-block-tall
shadow-east stone-block
shadow-north-east wall-block-tall
shadow-north-west wall-block
shadow-north water-block
shadow-side-west wood-block)
shadow-south-east
shadow-south-west (Ramps
shadow-south ramp-east
shadow-west ramp-north
stone-block-tall ramp-south
stone-block ramp-west)
tree-short
tree-tall (Buildings
tree-ugly door-tall-closed
wall-block-tall door-tall-open
wall-block roof-east
water-block roof-north-east
window-tall roof-north-west
wood-block)) roof-north
roof-south-east
roof-south-west
roof-south
roof-west
window-tall)
(Shadows
shadow-east
shadow-north-east
shadow-north-west
shadow-north
shadow-side-west
shadow-south-east
shadow-south-west
shadow-south
shadow-west)))

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,25 +41,42 @@ from the Planet Cute website.
(apply stack args))]))] (apply stack args))]))]
@interaction[#:eval @interaction[#:eval
pc-eval pc-eval
(scale (beside/align
1 "bottom"
(beside/align (stack wall-block-tall stone-block)
"bottom" (stack character-cat-girl
(stack wall-block-tall stone-block) stone-block stone-block
(stack character-cat-girl stone-block stone-block)
stone-block stone-block water-block
stone-block stone-block) (stack grass-block dirt-block)
water-block (stack grass-block dirt-block dirt-block))]
(stack grass-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)
#`(begin (syntax-case stx ()
#,@(for/list ([img (in-list images)]) [(_ what whatever ...)
(define req (string->symbol (format "2htdp/planetcute/~a" (name->filename img)))) (identifier? #'what)
#`@defthing[#,img image?]{ @(bitmap #,req) }))) (let* ([sym (syntax-e #'what)]
[sec-title (symbol->string sym)]
[these-images (cdr (assoc sym images))])
#`(begin
@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))))
#`@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)}