screens now run
This commit is contained in:
parent
fdc84789fc
commit
f8b3910483
|
@ -11,7 +11,12 @@ on.initialize = function()
|
|||
load_panes_from_previous_session()
|
||||
if #Panes == 0 then
|
||||
table.insert(Panes, new_pane())
|
||||
Current_pane_index = 1
|
||||
Current_pane = Panes[Current_pane_index]
|
||||
Current_pane.filename = 'main'
|
||||
one_time_load()
|
||||
else
|
||||
Current_pane_index = 1
|
||||
Current_pane = Panes[Current_pane_index]
|
||||
end
|
||||
Current_pane_index = 1
|
||||
Current_pane = Panes[Current_pane_index]
|
||||
end
|
|
@ -8,12 +8,15 @@ run_button = function(x, y)
|
|||
edit.clear(Current_pane.output_editor_state)
|
||||
print = print_to_output
|
||||
-- ## run
|
||||
local status, result = live.eval(buf, 'editor')
|
||||
local error = eval_all()
|
||||
-- ## run: save some stuff, clean up the rest
|
||||
print = Real_print
|
||||
if result then
|
||||
if error == nil then
|
||||
Show_code = nil
|
||||
else
|
||||
print = Real_print
|
||||
clear_handlers()
|
||||
-- could be either output or error
|
||||
table.insert(Current_pane.output_editor_state.lines, {data=tostring(result)})
|
||||
table.insert(Current_pane.output_editor_state.lines, {data=tostring(error)})
|
||||
end
|
||||
if #Current_pane.output_editor_state.lines == 0 then
|
||||
table.insert(Current_pane.output_editor_state.lines, {data=''})
|
||||
|
|
|
@ -6,10 +6,8 @@ previous_pane_button = function()
|
|||
end,
|
||||
onpress1 = function()
|
||||
Show_menu = nil
|
||||
Current_pane.car = car
|
||||
Current_pane_index = Current_pane_index-1
|
||||
Current_pane = Panes[Current_pane_index]
|
||||
car = Current_pane.car or {}
|
||||
end,
|
||||
})
|
||||
end
|
||||
end
|
|
@ -6,10 +6,8 @@ next_pane_button = function(r)
|
|||
end,
|
||||
onpress1 = function()
|
||||
Show_menu = nil
|
||||
Current_pane.car = car
|
||||
Current_pane_index = Current_pane_index+1
|
||||
Current_pane = Panes[Current_pane_index]
|
||||
car = Current_pane.car or {}
|
||||
end,
|
||||
})
|
||||
end
|
||||
end
|
|
@ -2,10 +2,8 @@ new_pane_button = function(x, y, r)
|
|||
return overflowable_button('new', x, y, r,
|
||||
function()
|
||||
Show_menu = nil
|
||||
Current_pane.car = car
|
||||
Current_pane_index = Current_pane_index+1
|
||||
table.insert(Panes, Current_pane_index, new_pane())
|
||||
Current_pane = Panes[Current_pane_index]
|
||||
car = {}
|
||||
end)
|
||||
end
|
|
@ -2,9 +2,6 @@ delete_pane_button = function(x, y, r)
|
|||
return overflowable_button('delete', x, y, r,
|
||||
function()
|
||||
Show_menu = nil
|
||||
if Current_pane.example_name then
|
||||
Deleted_example_panes[Current_pane.example_name] = true
|
||||
end
|
||||
table.remove(Panes, Current_pane_index)
|
||||
if #Panes == 0 then
|
||||
table.insert(Panes, new_pane())
|
||||
|
@ -13,7 +10,6 @@ delete_pane_button = function(x, y, r)
|
|||
Current_pane_index = Current_pane_index-1
|
||||
end
|
||||
Current_pane = Panes[Current_pane_index]
|
||||
car = Current_pane.car or {}
|
||||
-- Don't load the deleted pane in future sessions.
|
||||
-- On mobile devices, we can't depend on on.save_settings() triggering on quit.
|
||||
love.filesystem.write('config', json.encode(settings()))
|
||||
|
|
|
@ -6,4 +6,5 @@ send_errors_to_output = function(err)
|
|||
Text.redraw_all(Current_pane.output_editor_state)
|
||||
Text.insert_text(Current_pane.output_editor_state, error_with_callstack)
|
||||
clear_handlers()
|
||||
Show_code = true
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
eval_all = function()
|
||||
for _,f in ipairs(love.filesystem.getDirectoryItems(Directory)) do
|
||||
local buf = love.filesystem.read(Directory..f)
|
||||
local status, error = live.eval(buf, f)
|
||||
if not status then
|
||||
return error
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,13 @@
|
|||
-- Some abbreviations to reduce typing.
|
||||
g = love.graphics
|
||||
pt, line = g.points, g.line
|
||||
rect, poly = g.rectangle, g.polygon
|
||||
circle, arc, ellipse = g.circle, g.arc, g.ellipse
|
||||
color = g.setColor
|
||||
min, max = math.min, math.max
|
||||
floor, ceil = math.floor, math.ceil
|
||||
abs, rand = math.abs, math.random
|
||||
pi, cos, sin = math.pi, math.cos, math.sin
|
||||
touches = love.touch.getTouches
|
||||
touch = love.touch.getPosition
|
||||
audio = love.audio.newSource
|
Loading…
Reference in New Issue