123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- (define (make-game-file level-list file-id)
- (vector make-game-file level-list file-id))
- (define (game-file? o)
- (and (vector? o)
- (>= (vector-length o) 1)
- (eq? (vector-ref o 0) make-game-file)))
- (define (game-file-level-list game-file)
- (vector-ref game-file 1))
- (define (game-file-id game-file)
- (vector-ref game-file 2))
- (define (make-level rows cols data move-history game-file levnum)
- (vector make-level rows cols data move-history game-file levnum))
- (define (level? o)
- (and (vector? o)
- (>= (vector-length o) 1)
- (eq? (vector-ref o 0) make-level)))
- (define (level-rows level)
- (vector-ref level 1))
- (define (level-cols level)
- (vector-ref level 2))
- (define (level-data level)
- (vector-ref level 3))
- (define (level-move-history level)
- (vector-ref level 4))
- (define (level-move-history-set! level new-h)
- (vector-set! level 4 new-h))
- (define (level-game-file level)
- (vector-ref level 5))
- (define (level-number level)
- (vector-ref level 6))
- (define (make-tile row col type)
- (vector make-tile row col type))
- (define (tile? o)
- (and (vector? o)
- (>= (vector-length o) 1)
- (eq? (vector-ref o 0) make-tile)))
- (define (tile-row tile)
- (vector-ref tile 1))
- (define (tile-col tile)
- (vector-ref tile 2))
- (define (tile-type tile)
- (vector-ref tile 3))
- (define (make-global-state current-level-state in-menu current-progress-tracker current-event-handler)
- (vector make-global-state current-level-state in-menu current-progress-tracker current-event-handler))
- (define (global-state? o)
- (and (vector? o)
- (>= (vector-length o) 1)
- (eq? (vector-ref o 0) make-global-state)))
- (define (global-level global-state)
- (vector-ref global-state 1))
- (define (global-level-set! global-state new-level)
- (vector-set! global-state 1 new-level))
- (define (global-menu global-state)
- (vector-ref global-state 2))
- (define (global-menu-set! global-state new-menu)
- (vector-set! global-state 2 new-menu))
- (define (global-progress global-state)
- (vector-ref global-state 3))
- (define (global-progress-set! global-state new-progress)
- (vector-set! global-state 3 new-progress))
- (define (global-event-handler global-state)
- (vector-ref global-state 4))
- (define (make-menu items top-item cursor callback undo-callback)
- ;; items is a vector of cons - key value pairs, the value which gets sent to the callback
- (vector make-menu items top-item cursor callback undo-callback))
- (define (menu? o)
- (and (vector? o)
- (>= (vector-length o) 1)
- (eq? (vector-ref o 0) make-menu)))
- (define (menu-items menu)
- (vector-ref menu 1))
- (define (menu-top-item menu)
- (vector-ref menu 2))
- (define (menu-top-item-set! menu new-val)
- (vector-set! menu 2 new-val))
- (define (menu-cursor menu)
- (vector-ref menu 3))
- (define (menu-cursor-set! menu new-val)
- (vector-set! menu 3 new-val))
- (define (menu-callback menu)
- (vector-ref menu 4))
- (define (menu-undo-callback menu)
- (vector-ref menu 5))
|