fix state thigns and port to love11

This commit is contained in:
Your Name 2026-08-07 20:56:42 -04:00
parent ff5abf6bcd
commit c92c0f6ff7
11 changed files with 130 additions and 96 deletions

View file

@ -29,8 +29,12 @@ function love.load()
inputTimer = Timer.new()
-- Resume the game: prefer the runtime autosave so the last saved position is
-- restored, falling back to the authored source level. Editor room-opens go
-- through their own (source-only) load path, so this only affects resume.
currentRoom = Room:new{
name = gameWorld.lastRoom or "start"
name = gameWorld.lastRoom or "start",
runtime = true
}
gameWorld:setLastRoom(currentRoom.name)
setEditorRoomName(currentRoom.name)
@ -38,6 +42,15 @@ function love.load()
response = ""
end
-- Autosave on close so a position reached by moving within a room (short of a
-- room-to-room transition, which already autosaves in nextRoom) survives.
function love.quit()
if currentRoom then
currentRoom:save()
if gameWorld then gameWorld:setLastRoom(currentRoom.name) end
end
end
function love.update(dt)
if editorView == "world" then
Input:stopMoveRepeat()
@ -70,7 +83,7 @@ function love.draw()
love.graphics.push()
for i = 1, samples do
local c = 65 / (i * 1.75)
local c = 65 / 255 / (i * 1.75)
love.graphics.setColor(c, c, c)
love.graphics.scale(scaleCoefficient, scaleCoefficient)
love.graphics.translate((width / 2 - (width * scaleCoefficient) / 2) + 2, (width / 2 - (height * scaleCoefficient) / 2) + 2)
@ -78,7 +91,7 @@ function love.draw()
end
love.graphics.pop()
love.graphics.setColor(255, 255, 255)
love.graphics.setColor(1, 1, 1)
love.graphics.draw(gameCanvas, 0, 0)
love.graphics.setCanvas()
@ -88,7 +101,7 @@ function love.draw()
love.graphics.setCanvas()
love.graphics.setBlendMode("alpha")
love.graphics.setColor(255, 255, 255, 255)
love.graphics.setColor(1, 1, 1, 1)
love.graphics.draw(finalCanvas, 0, 0)
love.graphics.draw(sideBarCanvas, sideBarBox.x, sideBarBox.y)
love.graphics.print("Current FPS: "..tostring(love.timer.getFPS( )), 10, 10)