diff --git a/code/editor.lua b/code/editor.lua index a4b3135..8103be0 100644 --- a/code/editor.lua +++ b/code/editor.lua @@ -1,11 +1,15 @@ assert(editor == nil) editor = { + active = false, room_mode = false, - --palette_mode = false, palette = { active = false, scroll = Point:new(0, 0), }, + multiselect = { + active = false, + box = nil, + }, pan = { fixed = false, speed = 3 }, } @@ -89,13 +93,6 @@ function stepEditor() end, }):activate() end - - if Keybind:checkPressed(Keybind.debug.editor) then - editor_mode = not editor_mode - deselectSpawns() - createTileObjects() - restartGame() - end end function scrollEditor(y) diff --git a/code/game.lua b/code/game.lua index 044bf1f..13d4b74 100644 --- a/code/game.lua +++ b/code/game.lua @@ -53,10 +53,6 @@ function stepGame() initMenu("dialog",dialog_sequence.example) end - if Keybind:checkPressed(Keybind.debug.editor) then - editor_mode = true - end - if Keybind:checkPressed(Keybind.debug.recording) then if DemoRecording then Demo:endRecord() diff --git a/main.lua b/main.lua index 2437051..96f284e 100644 --- a/main.lua +++ b/main.lua @@ -6,9 +6,10 @@ function love.load() secs = 0 menu_type = "no" + -- FIXME: this overrides a standard library! debug = false debug_collision = false - editor_mode = false + --editor_mode = false text_size = 1 @@ -103,6 +104,15 @@ function love.update(dt) return end + if Keybind:checkPressed(Keybind.debug.editor) then + if editor.active then + deselectSpawns() + createTileObjects() + restartGame() + end + editor.active = not editor.active + end + if love.keyboard.isDown("f7") then local test_prompt = Prompt:new({ name = "test prompt", @@ -127,7 +137,7 @@ function love.update(dt) if menu_type ~= nil then stepMenu(menu_type) end --editor - if editor_mode then + if editor.active then stepEditor() else stepGame() @@ -136,7 +146,7 @@ end function love.wheelmoved(_, y) - if editor_mode then + if editor.active then scrollEditor(y) end end @@ -150,7 +160,7 @@ function love.draw() game_resize = false end - if editor_mode then + if editor.active then drawEditor() else drawGame()