@@ -576,16 +576,13 @@ local function updateGame()
576576end
577577
578578local function drawScores ()
579- local bold = gfx .getSystemFont (" bold" )
580579 gfx .drawTextAligned (" *Score*" , (UITimer .value - 2 )* uiBlockSize , 9 * uiBlockSize , kTextAlignment .center )
581580 gfx .drawTextAligned (" *" .. math.floor (score ).. " *" , (UITimer .value - 2 )* uiBlockSize , 11 * uiBlockSize , kTextAlignment .center )
582581 gfx .drawTextAligned (" *Highscore*" , (UITimer .value - 2 )* uiBlockSize , 13 * uiBlockSize , kTextAlignment .center )
583582 gfx .drawTextAligned (" *" .. highscore .. " *" , (UITimer .value - 2 )* uiBlockSize , 15 * uiBlockSize , kTextAlignment .center )
584583end
585584
586585local function drawLevelInfo ()
587- local bold = gfx .getSystemFont (" bold" )
588-
589586 gfx .drawTextAligned (" *Level*" , dwidth - (UITimer .value - 2 )* uiBlockSize , 9 * uiBlockSize ,kTextAlignment .center )
590587 gfx .drawTextAligned (" *" .. level .. " *" , dwidth - (UITimer .value - 2 )* uiBlockSize , 11 * uiBlockSize ,kTextAlignment .center )
591588 gfx .drawTextAligned (" *Lines*" , dwidth - (UITimer .value - 2 )* uiBlockSize , 13 * uiBlockSize , kTextAlignment .center )
@@ -794,6 +791,8 @@ local bold = gfx.getSystemFont("bold")
794791local menuYTimer , menuWidth
795792
796793local function closeMenu ()
794+ menuOpen = false
795+
797796 -- Sorry, I love back easing XD
798797 menuYTimer = time .new (250 , dheight / 2 , dheight , easings .inBack )
799798 patternTimer = time .new (250 , # patterns , 1 ,easings .inBack )
@@ -805,7 +804,6 @@ local menu = {
805804 type = " button" ,
806805 onpress = function ()
807806 closeMenu ()
808- menuOpen = false
809807 end ,
810808 },
811809 {
@@ -887,6 +885,7 @@ local menu = {
887885 onchange = function (val )
888886 musicVolume = val
889887 saveData (" music" , musicVolume )
888+ updateMusicVolume ()
890889 end ,
891890 },
892891 {
@@ -898,6 +897,7 @@ local menu = {
898897 onchange = function (val )
899898 soundsVolume = val
900899 saveData (" sounds" , soundsVolume )
900+ updateSoundVolume ()
901901 end ,
902902 },
903903}
@@ -928,6 +928,11 @@ function updateMenu()
928928
929929 commitSaveData ()
930930 end
931+
932+ if btnp (" b" ) then
933+ menuClickSound :play ()
934+ closeMenu ()
935+ end
931936
932937 if menuItem .type == " slider" then
933938 if btn (" right" ) then
@@ -1019,7 +1024,6 @@ sysmenu:addMenuItem("options", function()
10191024 menuOpen = not menuOpen
10201025 if not menuOpen then closeMenu ()
10211026 else
1022- bold = gfx .getSystemFont (" bold" )
10231027 menuYTimer = time .new (250 , 0 , dheight / 2 , easings .outBack )
10241028 menuHeight = # menu * bold :getHeight ()
10251029 local longestString = " "
@@ -1056,26 +1060,50 @@ sysmenu:addMenuItem("restart", function()
10561060 end
10571061end )
10581062
1059- bgmIntro :play ()
1060-
1061- function playdate .update ()
1062- if not bgmIntro :isPlaying () and not bgmLoop :isPlaying () then
1063- bgmLoop :play (0 )
1064- end
1063+ function updateMusicVolume ()
10651064 for i ,v in ipairs (songs ) do
10661065 if v :getVolume () ~= musicVolume then
10671066 v :setVolume (musicVolume )
10681067 end
10691068 end
1069+ end
1070+
1071+ function updateSoundVolume ()
10701072 for i ,v in ipairs (sfx ) do
10711073 if v :getVolume () ~= soundsVolume then
10721074 v :setVolume (soundsVolume )
10731075 end
10741076 end
1077+ end
1078+
1079+ updateMusicVolume ()
1080+ updateSoundVolume ()
1081+ bgmIntro :play ()
1082+
1083+ function playdate .update ()
1084+ if not bgmIntro :isPlaying () and not bgmLoop :isPlaying () then
1085+ bgmLoop :play (0 )
1086+ end
10751087 _update ()
10761088 _draw ()
10771089end
10781090
1091+ function playdate .gameWillPause ()
1092+
1093+ local img = gfx .image .new (dwidth , dheight , gfx .kColorWhite )
1094+ local text = " Score\n " .. math.floor (score ) .. " \n Highscore\n " .. highscore .. " \n Level\n " .. level .. " \n Lines\n " .. completedLines
1095+
1096+ gfx .lockFocus (img )
1097+ gfx .setFont (bold )
1098+ gfx .drawTextAligned (text , dwidth / 4 , 42 , kTextAlignment .center )
1099+ gfx .unlockFocus ()
1100+
1101+ img :setInverted (darkMode )
1102+
1103+ playdate .setMenuImage (img )
1104+
1105+ end
1106+
10791107function playdate .gameWillTerminate () commitSaveData () end
10801108
10811109function playdate .deviceWillSleep () commitSaveData () end
0 commit comments