diff --git a/main.scm b/main.scm index d2c0ece..db5c514 100644 --- a/main.scm +++ b/main.scm @@ -584,6 +584,7 @@ ; not quite perfectly correct (when (and mouse-in-bounds? (button-pressed? 'right)) (square-flagged?-set! mouse-square (not (square-flagged? mouse-square)))) + redraw?) (define (draw-write obj x y size color) @@ -636,12 +637,14 @@ (draw-write `(right released . ,(button-released? 'right)) 1 100 10 color)) (define (draw-game-squares game skin pos) + (define draw-pos (vector2 413 413)) (game-squares-for-each (lambda (x y) - (let ([pos (vector2 (+ (vector2-x pos) (* x square-width)) - (+ (vector2-y pos) (* y square-width)))]) - (blit-square skin (game-square-type-at game x y) pos))) - game)) + (set-vector2-x! draw-pos (+ (vector2-x pos) (* x square-width))) + (set-vector2-y! draw-pos (+ (vector2-y pos) (* y square-width))) + (blit-square skin (game-square-type-at game x y) draw-pos)) + game) + ) (define (game-draw game skin) (draw-game-squares game skin vector2-origin)) @@ -668,6 +671,7 @@ ; methinks it's all those foreign vector2s ; seems so ;; (clear-background BLACK) + ; okay, we could be a bit smarter about what we redraw, but redrawing shouldn't leak *any* memory (game-draw game skin)) #;(draw-mouse-info BLACK) ))