diff --git a/assets/asteroids.ms b/assets/asteroids.ms index 08019ad..2847390 100644 --- a/assets/asteroids.ms +++ b/assets/asteroids.ms @@ -407,6 +407,12 @@ render = function raylib.DrawFPS end function +unload = function + raylib.UnloadTexture spriteSheetTex + raylib.UnloadFont scoreFont + sounds.unload +end function + run = function init while true @@ -417,7 +423,8 @@ run = function raylib.EndDrawing if raylib.IsKeyPressed(raylib.KEY_ESCAPE) or raylib.IsKeyPressed(raylib.KEY_Q) then break yield - end while + end while + unload end function if locals == globals then run diff --git a/assets/sounds.ms b/assets/sounds.ms index 7647f3e..1b3e397 100644 --- a/assets/sounds.ms +++ b/assets/sounds.ms @@ -92,6 +92,12 @@ boom = makeSound(samples) sounds = [null, wooble, boop, pew, white, hit, boom] +unload = function + for sound in sounds + if sound!=null then raylib.UnloadSound sound + end for +end function + run = function x = 100; y = 100 dx = 10; dy = 10 @@ -112,6 +118,7 @@ run = function raylib.EndDrawing yield end while + unload end function if locals == globals then run