added the Planet Cute images to the (new) 2htdp/planetcute library

This commit is contained in:
Robby Findler 2011-10-27 17:18:31 -05:00
parent 91866f58c7
commit dc24fbf62d
60 changed files with 144 additions and 0 deletions

View 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)

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 697 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 823 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 634 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 968 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View 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))

View File

@ -11,3 +11,4 @@
@include-section["image.scrbl"]
@include-section["universe.scrbl"]
@include-section["port.scrbl"]
@include-section["planetcute.scrbl"]

View File

@ -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])]{

View 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[]