diff --git a/images/credits/idk.png b/images/credits/idk.png index 2baea58..108de6c 100644 Binary files a/images/credits/idk.png and b/images/credits/idk.png differ diff --git a/states/creditsstate.lua b/states/creditsstate.lua index d558418..7a4d90c 100644 --- a/states/creditsstate.lua +++ b/states/creditsstate.lua @@ -51,10 +51,11 @@ return function() end function state.load() + love.window.setTitle("TaggedEngine: Credits") + local bg = Image("images/menuBG.png") bg.layer = -5 - for index, credit in next, credits do local icon = credit.icon if not icon then goto continue end @@ -71,6 +72,8 @@ return function() function state.keypressed(key) if key == "down" then currentOne = currentOne + 1 > #credits and 1 or currentOne + 1 + elseif key == "escape" then + state.changeState("menustate") end end diff --git a/states/freeplaystate.lua b/states/freeplaystate.lua index 32253aa..f6b9a7a 100644 --- a/states/freeplaystate.lua +++ b/states/freeplaystate.lua @@ -21,6 +21,7 @@ return function() local unparsedData = files.read_file(dataFolder .. "/Data.json") local data = unparsedData and json.parse(unparsedData) or { songs = { bf = {} } } + print(unparsedData, data) local icons = {} @@ -82,6 +83,8 @@ return function() local arrow local function setup() + love.window.setTitle("TaggedEngine: Freeplay") + if not freaky:isPlaying() then freaky:play() end @@ -145,7 +148,7 @@ return function() local gettingKey - local settings = json.parse(files.read_file("settings.json")) + local settings = json.parse(files.read_file(dataFolder.."/Settings.json")) local keybinds = settings.Keybinds local scroll = love.audio.newSource("sounds/ui/scrollMenu.ogg", "static") local confirm = love.audio.newSource("sounds/ui/confirmMenu.ogg", "static") diff --git a/states/menustate.lua b/states/menustate.lua index fb1b0e2..ef7dc66 100644 --- a/states/menustate.lua +++ b/states/menustate.lua @@ -1,4 +1,15 @@ local logging = require "modules.logging" +local files = require "modules.files" +local json = require "modules.json" +local defaultSettings = { -- The way its in the JSON + Downscroll = false, + Keybinds = { + "a", + "b", + "up", + "right" + } +} return function() ---@class StateClass local state = {} @@ -21,6 +32,19 @@ return function() local moving = false function state.load() + love.window.setTitle("TaggedEngine: Main Menu") + + local data = love.filesystem.getSaveDirectory() + print(data) + local settings = files.read_file(data.."/Settings.json") + print(settings) + + if not settings then + os.execute("mkdir "..data) + files.write_file(data.."/Settings.json", json.stringify(defaultSettings)) + print("Written") + end + if not freaky then freaky = love.audio.newSource("sounds/freakyMenu.ogg", "stream") freaky:setVolume(0.25) diff --git a/states/optionsstate.lua b/states/optionsstate.lua index 390d0cc..cfe88eb 100644 --- a/states/optionsstate.lua +++ b/states/optionsstate.lua @@ -2,17 +2,8 @@ local logging = require("modules.logging") local json = require("modules.json") local files= require("modules.files") -local defaultSettings = { -- The way its in the JSON - Downscroll = false, - Keybinds = { - "a", - "b", - "up", - "right" - } -} - local font = love.graphics.newFont("fonts/FridayNightFunkin-Regular.ttf", 60) +local data = love.filesystem.getSaveDirectory() local settingList = { -- Path for the positions in JSON Left = "Keybinds.1", @@ -59,7 +50,7 @@ return function() local currentSetting = 1 local evilCurrentSetting = 1 - local settings = json.parse(files.read_file("settings.json")) or defaultSettings + local settings = json.parse(files.read_file(data.."/Settings.json")) local function getSettingPath(setting) local pathString = settingList[setting]:split(".") @@ -103,13 +94,15 @@ return function() settingPath[settingLast] = not settingPath[settingLast] end elseif key == "escape" then - files.write_file("settings.json", json.stringify(settings)) + files.write_file(data.."/Settings.json", json.stringify(settings)) state.changeState("menustate") end end function state.load() + love.window.setTitle("TaggedEngine: Options") + local bg = Image("images/menuBG.png") bg.layer = -5 end diff --git a/states/playstate.lua b/states/playstate.lua index 0763407..03c0338 100644 --- a/states/playstate.lua +++ b/states/playstate.lua @@ -72,6 +72,8 @@ local function state(songName, songDifficulty, show) local characters = {} local icons = {} + + local data = love.filesystem.getSaveDirectory() local ui = { timebar = true, @@ -245,19 +247,18 @@ local function state(songName, songDifficulty, show) end if save then - local data = love.filesystem.getSaveDirectory() local oldSave = files.read_file(data.."/Data.json") if not oldSave then - oldSave = {} + oldSave = {songs = {}} else oldSave = json.parse(oldSave) end - if not oldSave[curChar] then - oldSave[curChar] = {} + if not oldSave.songs[curChar] then + oldSave.songs[curChar] = {} end - if not oldSave[curChar][songName] then - oldSave[curChar][songName] = {} + if not oldSave.songs[curChar][songName] then + oldSave.songs[curChar][songName] = {} end local rankingWindows = { { @@ -277,14 +278,14 @@ local function state(songName, songDifficulty, show) window = 100 }, } - if oldSave[curChar][songName][songDifficulty] and oldSave[curChar][songName][songDifficulty].score < score or not oldSave[curChar][songName][songDifficulty] then + if oldSave.songs[curChar][songName][songDifficulty] and oldSave.songs[curChar][songName][songDifficulty].score < score or not oldSave.songs[curChar][songName][songDifficulty] then local rank = "Ass" for index, newRank in next, rankingWindows do if accuracy >= newRank.window then rank = newRank.name end end - oldSave[curChar][songName][songDifficulty] = { + oldSave.songs[curChar][songName][songDifficulty] = { accuracy = tostring(accuracy):sub(1, 5), score = score, rank = rank @@ -294,7 +295,8 @@ local function state(songName, songDifficulty, show) end if gameMode == "storymode" then - state.changeState(save and songOrder[currentSong + 1] and "playstate" or "weekstate", songOrder[currentSong + 1], songDifficulty) + currentSong = currentSong + 1 + state.changeState(save and songOrder[currentSong] and "playstate" or "weekstate", songOrder[currentSong], songDifficulty) else state.changeState(save and "resultsstate" or "freeplaystate", score, accuracy, ratings, combo) end @@ -771,7 +773,9 @@ local function state(songName, songDifficulty, show) end function state.load() - settings = json.parse(files.read_file("settings.json")) + love.window.setTitle("TaggedEngine") + + settings = json.parse(files.read_file(data.."/Settings.json")) if not settings then error("Failed to load settings") end diff --git a/states/weekstate.lua b/states/weekstate.lua index 4aedb5c..39227a4 100644 --- a/states/weekstate.lua +++ b/states/weekstate.lua @@ -139,6 +139,8 @@ return function() end function state.load() + love.window.setTitle("TaggedEngine: Week Menu") + if love.graphics:getHeight() ~= 720 then love.window.setMode(1280, 720) end