added the Planet Cute images to the (new) 2htdp/planetcute library
14
collects/2htdp/planetcute.rkt
Normal file
|
@ -0,0 +1,14 @@
|
|||
#lang racket/base
|
||||
(require 2htdp/image
|
||||
(for-syntax "private/planetcute-image-list.rkt")
|
||||
(for-syntax racket/base))
|
||||
|
||||
(define-syntax (definitions stx)
|
||||
#`(begin
|
||||
#,@(for/list ([img (in-list images)])
|
||||
(define req (string->symbol (format "2htdp/planetcute/~a" (name->filename img))))
|
||||
#`(begin
|
||||
(provide #,img)
|
||||
(define #,img (bitmap #,req))))))
|
||||
|
||||
(definitions)
|
BIN
collects/2htdp/planetcute/Brown Block.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
collects/2htdp/planetcute/Character Boy.png
Normal file
After Width: | Height: | Size: 7.6 KiB |
BIN
collects/2htdp/planetcute/Character Cat Girl.png
Normal file
After Width: | Height: | Size: 8.4 KiB |
BIN
collects/2htdp/planetcute/Character Horn Girl.png
Normal file
After Width: | Height: | Size: 8.5 KiB |
BIN
collects/2htdp/planetcute/Character Pink Girl.png
Normal file
After Width: | Height: | Size: 8.7 KiB |
BIN
collects/2htdp/planetcute/Character Princess Girl.png
Normal file
After Width: | Height: | Size: 9.5 KiB |
BIN
collects/2htdp/planetcute/Chest Closed.png
Normal file
After Width: | Height: | Size: 6.7 KiB |
BIN
collects/2htdp/planetcute/Chest Lid.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
collects/2htdp/planetcute/Chest Open.png
Normal file
After Width: | Height: | Size: 6.6 KiB |
BIN
collects/2htdp/planetcute/Dirt Block.png
Normal file
After Width: | Height: | Size: 7.7 KiB |
BIN
collects/2htdp/planetcute/Door Tall Closed.png
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
collects/2htdp/planetcute/Door Tall Open.png
Normal file
After Width: | Height: | Size: 4.7 KiB |
BIN
collects/2htdp/planetcute/Enemy Bug.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
collects/2htdp/planetcute/Gem Blue.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
collects/2htdp/planetcute/Gem Green.png
Normal file
After Width: | Height: | Size: 24 KiB |
BIN
collects/2htdp/planetcute/Gem Orange.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
collects/2htdp/planetcute/Grass Block.png
Normal file
After Width: | Height: | Size: 8.4 KiB |
BIN
collects/2htdp/planetcute/Heart.png
Normal file
After Width: | Height: | Size: 6.3 KiB |
BIN
collects/2htdp/planetcute/Key.png
Normal file
After Width: | Height: | Size: 7.3 KiB |
BIN
collects/2htdp/planetcute/Plain Block.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
collects/2htdp/planetcute/Ramp East.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
collects/2htdp/planetcute/Ramp North.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
collects/2htdp/planetcute/Ramp South.png
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
collects/2htdp/planetcute/Ramp West.png
Normal file
After Width: | Height: | Size: 6.3 KiB |
BIN
collects/2htdp/planetcute/Rock.png
Normal file
After Width: | Height: | Size: 9.2 KiB |
BIN
collects/2htdp/planetcute/Roof East.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
collects/2htdp/planetcute/Roof North East.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
collects/2htdp/planetcute/Roof North West.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
collects/2htdp/planetcute/Roof North.png
Normal file
After Width: | Height: | Size: 6.9 KiB |
BIN
collects/2htdp/planetcute/Roof South East.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
collects/2htdp/planetcute/Roof South West.png
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
collects/2htdp/planetcute/Roof South.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
collects/2htdp/planetcute/Roof West.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
collects/2htdp/planetcute/Selector.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
collects/2htdp/planetcute/Shadow East.png
Normal file
After Width: | Height: | Size: 697 B |
BIN
collects/2htdp/planetcute/Shadow North East.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
collects/2htdp/planetcute/Shadow North West.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
collects/2htdp/planetcute/Shadow North.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
collects/2htdp/planetcute/Shadow Side West.png
Normal file
After Width: | Height: | Size: 823 B |
BIN
collects/2htdp/planetcute/Shadow South East.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
collects/2htdp/planetcute/Shadow South West.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
collects/2htdp/planetcute/Shadow South.png
Normal file
After Width: | Height: | Size: 634 B |
BIN
collects/2htdp/planetcute/Shadow West.png
Normal file
After Width: | Height: | Size: 968 B |
BIN
collects/2htdp/planetcute/SpeechBubble.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
collects/2htdp/planetcute/Star.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
collects/2htdp/planetcute/Stone Block Tall.png
Normal file
After Width: | Height: | Size: 7.3 KiB |
BIN
collects/2htdp/planetcute/Stone Block.png
Normal file
After Width: | Height: | Size: 5.9 KiB |
BIN
collects/2htdp/planetcute/Tree Short.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
collects/2htdp/planetcute/Tree Tall.png
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
collects/2htdp/planetcute/Tree Ugly.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
collects/2htdp/planetcute/Wall Block Tall.png
Normal file
After Width: | Height: | Size: 7.8 KiB |
BIN
collects/2htdp/planetcute/Wall Block.png
Normal file
After Width: | Height: | Size: 7.0 KiB |
BIN
collects/2htdp/planetcute/Water Block.png
Normal file
After Width: | Height: | Size: 9.0 KiB |
BIN
collects/2htdp/planetcute/Window Tall.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
collects/2htdp/planetcute/Wood Block.png
Normal file
After Width: | Height: | Size: 4.2 KiB |
67
collects/2htdp/private/planetcute-image-list.rkt
Normal file
|
@ -0,0 +1,67 @@
|
|||
#lang racket/base
|
||||
(provide images name->filename)
|
||||
|
||||
(define (name->filename img)
|
||||
(define-values (_ new-chars)
|
||||
(for/fold ([cap-next? #t]
|
||||
[chars '()])
|
||||
([c (in-string (format "~a" img))])
|
||||
(values (equal? #\- c)
|
||||
(cons (cond
|
||||
[(equal? c #\-) #\space]
|
||||
[cap-next? (char-upcase c)]
|
||||
[else c])
|
||||
chars))))
|
||||
(format "~a.png" (apply string (reverse new-chars))))
|
||||
|
||||
(define images
|
||||
'(brown-block
|
||||
character-boy
|
||||
character-cat-girl
|
||||
character-horn-girl
|
||||
character-pink-girl
|
||||
character-princess-girl
|
||||
chest-closed
|
||||
chest-lid
|
||||
chest-open
|
||||
dirt-block
|
||||
door-tall-closed
|
||||
door-tall-open
|
||||
enemy-bug
|
||||
gem-blue
|
||||
gem-green
|
||||
gem-orange
|
||||
grass-block
|
||||
heart
|
||||
key
|
||||
plain-block
|
||||
ramp-north
|
||||
ramp-south
|
||||
ramp-west
|
||||
roof-east
|
||||
roof-north-east
|
||||
roof-north-west
|
||||
roof-north
|
||||
roof-south-east
|
||||
roof-south-west
|
||||
roof-south
|
||||
roof-west
|
||||
shadow-east
|
||||
shadow-north-east
|
||||
shadow-north-west
|
||||
shadow-north
|
||||
shadow-side-west
|
||||
shadow-south-east
|
||||
shadow-south-west
|
||||
shadow-south
|
||||
shadow-west
|
||||
stone-block-tall
|
||||
stone-block
|
||||
tree-short
|
||||
tree-tall
|
||||
tree-ugly
|
||||
wall-block-tall
|
||||
wall-block
|
||||
water-block
|
||||
window-tall
|
||||
wood-block))
|
|
@ -11,3 +11,4 @@
|
|||
@include-section["image.scrbl"]
|
||||
@include-section["universe.scrbl"]
|
||||
@include-section["port.scrbl"]
|
||||
@include-section["planetcute.scrbl"]
|
||||
|
|
|
@ -1224,6 +1224,8 @@ are represented as bitmaps, i.e., an array of colors (that can be quite large in
|
|||
This means that scaling and rotating them loses fidelity in the image and is significantly
|
||||
more expensive than with the other shapes.
|
||||
|
||||
See also the @racketmodname[2htdp/planetcute] library.
|
||||
|
||||
@defform/subs[(bitmap bitmap-spec)
|
||||
([bitmap-spec rel-string
|
||||
id])]{
|
||||
|
|
60
collects/teachpack/2htdp/scribblings/planetcute.scrbl
Normal file
|
@ -0,0 +1,60 @@
|
|||
#lang scribble/doc
|
||||
|
||||
@(require "shared.rkt"
|
||||
"port.rkt"
|
||||
scribble/manual
|
||||
scribble/eval
|
||||
(for-syntax racket/base)
|
||||
2htdp/image
|
||||
(for-label 2htdp/image
|
||||
2htdp/planetcute))
|
||||
|
||||
@; -----------------------------------------------------------------------------
|
||||
|
||||
@title{Planet Cute Images}
|
||||
|
||||
@defmodule[2htdp/planetcute]
|
||||
|
||||
@(define pc-eval (make-base-eval))
|
||||
@(interaction-eval #:eval pc-eval (require 2htdp/image))
|
||||
@(interaction-eval #:eval pc-eval (require 2htdp/planetcute))
|
||||
|
||||
The @racketmodname[2htdp/planetcute] library contains the
|
||||
Planet Cute images:
|
||||
@url{http://www.lostgarden.com/2007/05/dancs-miraculously-flexible-game.html}.
|
||||
|
||||
The images are designed to be overlaid with each other to build
|
||||
scenes for use in games. Here is an example image taken
|
||||
from the Planet Cute website.
|
||||
|
||||
@racketblock+eval[#:eval
|
||||
pc-eval
|
||||
(define (stack arg . args)
|
||||
(cond
|
||||
[(null? args) arg]
|
||||
[else (overlay/xy arg 0 40
|
||||
(apply stack args))]))]
|
||||
@interaction[#:eval
|
||||
pc-eval
|
||||
(scale
|
||||
1
|
||||
(beside/align
|
||||
"bottom"
|
||||
(stack wall-block-tall stone-block)
|
||||
(stack character-cat-girl
|
||||
stone-block stone-block
|
||||
stone-block stone-block)
|
||||
water-block
|
||||
(stack grass-block dirt-block)
|
||||
(stack grass-block dirt-block dirt-block)))]
|
||||
|
||||
@(close-eval pc-eval)
|
||||
|
||||
@(require (for-syntax 2htdp/private/planetcute-image-list))
|
||||
@(define-syntax (defthings stx)
|
||||
#`(begin
|
||||
#,@(for/list ([img (in-list images)])
|
||||
(define req (string->symbol (format "2htdp/planetcute/~a" (name->filename img))))
|
||||
#`@defthing[#,img image?]{ @(bitmap #,req) })))
|
||||
|
||||
@defthings[]
|