diff options
Diffstat (limited to 'src/pokedex/pokedex.rkt')
-rw-r--r-- | src/pokedex/pokedex.rkt | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/pokedex/pokedex.rkt b/src/pokedex/pokedex.rkt index 5af1710..0adebbf 100644 --- a/src/pokedex/pokedex.rkt +++ b/src/pokedex/pokedex.rkt @@ -22,7 +22,6 @@ ;; API URL (define *POKE-API* "https://pokeapi.co/api/v2/") - (define (get-pokemon id) "queries the api, returns a butt ton of info" (call/input-url (string->url (~a *POKE-API* "pokemon/" id)) ; ~a, like string-append but appends *either* strings or numbers to a string @@ -49,10 +48,11 @@ (display (~a " key: " k "\nvalue: " v "\n=====\n"))))) h) -(inspector (dex-entry 11)) -(inspector (dex-entry "bulbasaur")) +; (inspector (dex-entry 11)) +; (inspector (dex-entry "bulbasaur")) (define (get-image id sprite-file-name) + "download a sprite" (define img (hash-ref (dex-entry id) "sprite")) (define img-url (string->url img)) @@ -65,10 +65,12 @@ (display-image sprite-file-name)) (define (display-image image) + "display a sprite" (define display-image (bitmap (make-object bitmap% image))) (frame (scale display-image 1))) (define (see-pokemon id) + "check to see if we've already got a sprite, if we don't, get it" (define sprite-file-name (~a "imgs/" id ".png")) (if (file-exists? sprite-file-name) @@ -78,4 +80,4 @@ (see-pokemon "bulbasaur") (see-pokemon "butterfree") (see-pokemon "pikachu") -(see-pokemon 124) \ No newline at end of file +(see-pokemon 33) \ No newline at end of file |