change editor_mode to editor.active, minor refactor, and start work on multiselect

This commit is contained in:
binarycat 2022-03-12 11:46:45 -05:00
parent 27f1dc71c0
commit f091fba9f7
3 changed files with 19 additions and 16 deletions

View File

@ -1,11 +1,15 @@
assert(editor == nil) assert(editor == nil)
editor = { editor = {
active = false,
room_mode = false, room_mode = false,
--palette_mode = false,
palette = { palette = {
active = false, active = false,
scroll = Point:new(0, 0), scroll = Point:new(0, 0),
}, },
multiselect = {
active = false,
box = nil,
},
pan = { fixed = false, speed = 3 }, pan = { fixed = false, speed = 3 },
} }
@ -89,13 +93,6 @@ function stepEditor()
end, end,
}):activate() }):activate()
end end
if Keybind:checkPressed(Keybind.debug.editor) then
editor_mode = not editor_mode
deselectSpawns()
createTileObjects()
restartGame()
end
end end
function scrollEditor(y) function scrollEditor(y)

View File

@ -53,10 +53,6 @@ function stepGame()
initMenu("dialog",dialog_sequence.example) initMenu("dialog",dialog_sequence.example)
end end
if Keybind:checkPressed(Keybind.debug.editor) then
editor_mode = true
end
if Keybind:checkPressed(Keybind.debug.recording) then if Keybind:checkPressed(Keybind.debug.recording) then
if DemoRecording then if DemoRecording then
Demo:endRecord() Demo:endRecord()

View File

@ -6,9 +6,10 @@ function love.load()
secs = 0 secs = 0
menu_type = "no" menu_type = "no"
-- FIXME: this overrides a standard library!
debug = false debug = false
debug_collision = false debug_collision = false
editor_mode = false --editor_mode = false
text_size = 1 text_size = 1
@ -103,6 +104,15 @@ function love.update(dt)
return return
end 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 if love.keyboard.isDown("f7") then
local test_prompt = Prompt:new({ local test_prompt = Prompt:new({
name = "test prompt", name = "test prompt",
@ -127,7 +137,7 @@ function love.update(dt)
if menu_type ~= nil then stepMenu(menu_type) end if menu_type ~= nil then stepMenu(menu_type) end
--editor --editor
if editor_mode then if editor.active then
stepEditor() stepEditor()
else else
stepGame() stepGame()
@ -136,7 +146,7 @@ end
function love.wheelmoved(_, y) function love.wheelmoved(_, y)
if editor_mode then if editor.active then
scrollEditor(y) scrollEditor(y)
end end
end end
@ -150,7 +160,7 @@ function love.draw()
game_resize = false game_resize = false
end end
if editor_mode then if editor.active then
drawEditor() drawEditor()
else else
drawGame() drawGame()