Skip to content

Commit e03dd58

Browse files
committed
Added a prototype replacement for map()/mget()/mset()
1 parent 8c99550 commit e03dd58

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

‎core.lisp‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,4 +120,20 @@
120120
('draw (lambda ()
121121
(when id (spr id x y w h))))))))
122122

123+
;; replacements for TIC-80's map concept, mget() and map()
124+
(define *MAPBYTES*
125+
(make-vector (list SCREEN-HEIGHT SCREEN-WIDTH) 0))
126+
127+
(define (mget x y)
128+
(*MAPBYTES* (floor y) (floor x)))
129+
130+
(define (mset x y n)
131+
(set! (*MAPBYTES* (floor y) (floor x)) n))
132+
133+
(define (blitmap x0 y0 w h sx sy)
134+
;; scale is ignored
135+
(do ((y 0 (+ y 1))) ((= y h))
136+
(do ((x 0 (+ x 1))) ((= x w))
137+
(spr (mget x y) (+ x0 (* x 16)) (+ y0 (* y 16)) 16 16))))
138+
123139
(display "Core library loaded\n"))

0 commit comments

Comments
 (0)