memory leak fixed or slowed enough

This commit is contained in:
mehbark 2023-12-24 08:44:12 -05:00
parent 2658e75183
commit 08312c5576

View file

@ -584,6 +584,7 @@
; not quite perfectly correct ; not quite perfectly correct
(when (and mouse-in-bounds? (button-pressed? 'right)) (when (and mouse-in-bounds? (button-pressed? 'right))
(square-flagged?-set! mouse-square (not (square-flagged? mouse-square)))) (square-flagged?-set! mouse-square (not (square-flagged? mouse-square))))
redraw?) redraw?)
(define (draw-write obj x y size color) (define (draw-write obj x y size color)
@ -636,12 +637,14 @@
(draw-write `(right released . ,(button-released? 'right)) 1 100 10 color)) (draw-write `(right released . ,(button-released? 'right)) 1 100 10 color))
(define (draw-game-squares game skin pos) (define (draw-game-squares game skin pos)
(define draw-pos (vector2 413 413))
(game-squares-for-each (game-squares-for-each
(lambda (x y) (lambda (x y)
(let ([pos (vector2 (+ (vector2-x pos) (* x square-width)) (set-vector2-x! draw-pos (+ (vector2-x pos) (* x square-width)))
(+ (vector2-y pos) (* y square-width)))]) (set-vector2-y! draw-pos (+ (vector2-y pos) (* y square-width)))
(blit-square skin (game-square-type-at game x y) pos))) (blit-square skin (game-square-type-at game x y) draw-pos))
game)) game)
)
(define (game-draw game skin) (define (game-draw game skin)
(draw-game-squares game skin vector2-origin)) (draw-game-squares game skin vector2-origin))
@ -668,6 +671,7 @@
; methinks it's all those foreign vector2s ; methinks it's all those foreign vector2s
; seems so ; seems so
;; (clear-background BLACK) ;; (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)) (game-draw game skin))
#;(draw-mouse-info BLACK) #;(draw-mouse-info BLACK)
)) ))