#lang racket

(require 2htdp/universe)
(require 2htdp/image)

;; The onMouse function takes a world and mouse event parameters, and returns a 
new world if a click
;; happened, or the same world if some other event happened (e.g. mouse move) 
(define (onMouse world x y ev)
  (if (equal? ev "button-down")
      (cond
        ((symbol=? world 'a) 'b)
        ((symbol=? world 'b) 'a))
      world))

;; Produce a result to the screen according to the state of the world.
;; This world has two possible states, represented by the 'a and 'b symbols.
;; Use either the drawA or the drawB function accordingly.
(define (draw world)
  (cond
    ((symbol=? world 'a) (drawA))
    ((symbol=? world 'b) (drawB))))

;; Draws a circle, could draw anything else instead (e.g. an image)
(define (drawA) (circle 30 "outline" "red"))

;; Draws a circle, could draw anything else instead (e.g. an image)
(define (drawB) (circle 30 "outline" "green"))

;; Define a function to create a world.
;; This particular world uses an "onMouse" function to handle mouse events and
;; a "draw" function to draw.
(define (main w0)
  (big-bang w0
            (on-mouse onMouse)
            (to-draw draw)))

;; Launch the world!
(launch-many-worlds (main 'a))



in each rectangle in Instead of circles that be images:

;proposito
;crear el juego tres en raya

;incluir libreria grafica
(require (lib "Graphics.ss" "graphics"))

;abrir libreria grafica
(open-graphics)

;crear ventana
(define ventana (open-viewport "tres en uno"  500 500))

;color de fondo 
((draw-viewport ventana) "black")

;Dar un nombre o titulo a el juego en este caso tres en raya
((draw-string ventana) (make-posn 200 75 ) "TRES EN RAYA" "white" )

;dibujar el tablero de juego
((draw-rectangle ventana) (make-posn 100 100) 100 100 "white")
((draw-rectangle ventana) (make-posn 100 200) 100 100 "white")
((draw-rectangle ventana) (make-posn 100 300) 100 100 "white")
((draw-rectangle ventana) (make-posn 200 100) 100 100 "white")
((draw-rectangle ventana) (make-posn 200 200) 100 100 "white")
((draw-rectangle ventana) (make-posn 200 300) 100 100 "white")
((draw-rectangle ventana) (make-posn 300 100) 100 100 "white")
((draw-rectangle ventana) (make-posn 300 200) 100 100 "white")
((draw-rectangle ventana) (make-posn 300 300) 100 100 "white")

;marcos del juego
((draw-rectangle ventana) (make-posn 95 95) 310 310 "white")
((draw-rectangle ventana) (make-posn 50 50) 400 400 "white")
 

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to