modular/world.ss
#lang scheme/base

(require (prefix-in tp: "../teachpacks/world.ss")
         (for-syntax scheme/base))

(define-syntax (eta stx)
  (syntax-case stx ()
    [(_ f arg ...)
     (syntax/loc stx
       (lambda (arg ...)
         (f arg ...)))]))

(provide (except-out (all-defined-out) eta))

(define make-posn (eta tp:make-posn x y))
(define posn-x (eta tp:posn-x p))
(define posn-y (eta tp:posn-y p))
(define posn? (eta tp:posn? v))
(define weak-posn? (eta tp:weak-posn? v))


;; Type predicates:
(define image? (eta tp:image? v))
(define mode? (eta tp:mode? v))
(define image-color? (eta tp:image-color? v))
(define color? (eta tp:color? v))
(define font-size? (eta tp:font-size? v))
(define bytep (eta tp:bytep v))

;; Color structure:
(define make-color (eta tp:make-color r g b))
(define color-red (eta tp:color-red c))
(define color-green (eta tp:color-green c))
(define color-blue (eta tp:color-blue c))

;; Shape constructors:
(define rectangle (eta tp:rectangle w h m c))
(define circle (eta tp:circle r m c))
(define triangle (eta tp:triangle s m c))
(define star (eta tp:star n o i m c))

;; Other image constructors:
(define text (eta tp:text s f c))
(define line (eta tp:line x y c))
(define empty-scene (eta tp:empty-scene w h))
(define add-line (eta tp:add-line i x y z w c))
(define overlay (eta tp:overlay i j))
(define overlay/xy (eta tp:overlay/xy i x y j))
(define place-image (eta tp:place-image i x y s))

;; Image accessors / operators:
(define image-width (eta tp:image-width i))
(define image-height (eta tp:image-height i))
(define put-pinhole (eta tp:put-pinhole i x y))
(define move-pinhole (eta tp:move-pinhole i x y))
(define pinhole-x (eta tp:pinhole-x i))
(define pinhole-y (eta tp:pinhole-y i))
(define image-inside? (eta tp:image-inside? i j))
(define find-image (eta tp:find-image i j))
(define image->color-list (eta tp:image->color-list i))
(define color-list->image (eta tp:color-list->image i w h x y))

(define key-eventp (eta tp:key-eventp v))
(define mouse-eventp (eta tp:mouse-eventp v))

(define big-bang (eta tp:big-bang w h r x))
(define on-tick-event (eta tp:on-tick-event t))
(define on-key-event (eta tp:on-key-event k))
(define on-mouse-event (eta tp:on-mouse-event m))
(define on-redraw (eta tp:on-redraw r))
(define stop-when (eta tp:stop-when d))