change editor_mode to editor.active, minor refactor, and start work on multiselect
This commit is contained in:
parent
27f1dc71c0
commit
f091fba9f7
@ -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)
|
||||
|
@ -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()
|
||||
|
18
main.lua
18
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()
|
||||
|
Loading…
Reference in New Issue
Block a user