Advertisement
juaniisuar

ej 3 p2

Apr 8th, 2016
367
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Racket 0.76 KB | None | 0 0
  1. (define COLOR "black")
  2. (define FONDO (rectangle 350 350 "solid" COLOR))
  3. (define ALTO 350)
  4. (define ANCHO 350)
  5. (define (pantalla F) (place-image F (/ ANCHO 2) (/ ALTO 2) (empty-scene ANCHO ALTO)))
  6. (define COLORs "white")
  7. (define TAMAÑO 40)
  8. (define STAR (star TAMAÑO "solid" COLORs))
  9. (define (tecla n x y event) (cond ((and (string=? event "button-down") (>= (- ANCHO (+ x (/ (image-width STAR) 2))) 0) (>= x (/ (image-width STAR) 2) ) (>= (- ANCHO (+ y (/ (image-width STAR) 2))) 0) (>= y (/ (image-width STAR) 2) ) ) (place-image (star TAMAÑO "solid" COLORs) x y n))  (else n) ))
  10. (define (backspace n k) (cond ((key=? k " ") FONDO) (else n) ) )
  11.  
  12.  
  13. (big-bang FONDO
  14.           (to-draw pantalla)
  15.           (on-key backspace)
  16.           (on-mouse tecla)
  17.           )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement