So far I have editors working for code/input/output and display for all 4 panels. Data is going to be more work. But first we need to bolt in the BF interpreter.
GOJ2S3WQ6JYJDM3LTBJI4OPDOW7GJRH2YPONP5UWHSDEMDVB5ADQC
local code = '[->+<]' -- add
local code = '++>++++[<+>-] # now print result\n ++++ ++++ [<+++ +++ > -] < .' -- add 2 to 5
local code = '++>++++[<+>-]<.'
local cp = 1
local data = {}
local dp = 1
function rfind(s, pat, i)
if i == nil then i = #s end
while i > 0 do
if s:sub(i,i) == pat then
return i
end
i = i-1
end
return nil
end
while cp <= #code do
local inst = code:sub(cp,cp)
if inst == '<' then
dp = dp-1
elseif inst == '>' then
dp = dp+1
elseif inst == '+' then
if data[dp] == nil then data[dp] = 0 end
data[dp] = data[dp]+1
elseif inst == '-' then
if data[dp] == nil then data[dp] = 0 end
data[dp] = data[dp]-1
elseif inst == '[' then
if data[dp] == 0 then
cp = code:find(']', cp)
end
elseif inst == ']' then
if data[dp] ~= 0 then
cp = rfind(code, '[', cp)
end
elseif inst == '.' then
--? print(string.char(data[dp]))
print(data[dp])
elseif inst == ',' then
data[dp] = string.byte(io.read(1))
elseif inst == '#' then
cp = code:find('\n', cp)
end
cp = cp+1
end
print('---')
for i,n in ipairs(data) do
print(i,n)
end
on.initialize = function()
local font = love.graphics.newFont(Font_size)
love.graphics.setFont(font)
In = create_editor(1, 1)
Code = create_editor(2, 1)
Data = {}
for i=1,10 do
table.insert(Data, 0)
end
Out = create_editor(3, 1)
end
{"on.keychord_press":65,"on.text_input":66,"fw_app":"bf","Num_panels_horizontal":23,"Data":46,"on.initialize":68,"draw_data":63,"Margin":27,"Font_size":28,"Cursor":38,"on.mouse_press":67,"create_editor":62,"on.draw":49,"Code":31,"on":1,"In":32,"Num_panels_vertical":24,"Out":33,"fw_parent":67}
on.mouse_press = function(x,y, mouse_button)
if x < In.right then
Cursor = In
edit.mouse_press(Cursor, x,y, mouse_button)
elseif x < Code.right then
if y < App.screen.height/2 then
Cursor = Code
edit.mouse_press(Cursor, x,y, mouse_button)
else
Cursor = Data
end
else
Cursor = Out
edit.mouse_press(Cursor, x,y, mouse_button)
end
end
{"create_editor":62,"Code":31,"In":32,"on.text_input":66,"Out":33,"on":1,"Cursor":38,"fw_app":"bf","Num_panels_horizontal":23,"Num_panels_vertical":24,"on.keychord_press":65,"on.initialize":56,"draw_data":63,"fw_parent":66,"Margin":27,"Data":46,"Font_size":28,"on.draw":49,"on.mouse_press":67}
on.text_input = function(t)
if Cursor then
edit.text_input(Cursor, t)
end
end
{"create_editor":62,"Code":31,"In":32,"on.text_input":66,"Out":33,"on":1,"Cursor":38,"fw_app":"bf","Num_panels_horizontal":23,"Num_panels_vertical":24,"on.keychord_press":65,"on.initialize":56,"draw_data":63,"fw_parent":65,"Margin":27,"Data":46,"Font_size":28,"on.draw":49,"on.mouse_press":64}
on.keychord_press = function(chord, key)
if Cursor then
edit.keychord_press(Cursor, chord, key)
end
end
{"create_editor":62,"Code":31,"In":32,"Out":33,"on":1,"Cursor":38,"fw_app":"bf","Num_panels_horizontal":23,"Num_panels_vertical":24,"on.keychord_press":65,"on.initialize":56,"draw_data":63,"fw_parent":64,"Margin":27,"Data":46,"Font_size":28,"on.draw":49,"on.mouse_press":64}
on.mouse_press = function(x,y, mouse_button)
if x < In.right then
Cursor = In
elseif x < Code.right then
if y < App.screen.height/2 then
Cursor = Code
else
Cursor = Data
end
else
Cursor = Out
end
edit.mouse_press(Cursor, x,y, mouse_button)
end
{"create_editor":62,"Code":31,"In":32,"Out":33,"on":1,"Cursor":38,"fw_app":"bf","Num_panels_horizontal":23,"Num_panels_vertical":24,"on.initialize":56,"draw_data":63,"fw_parent":63,"Margin":27,"Data":46,"Font_size":28,"on.draw":49,"on.mouse_press":64}
{"create_editor":62,"Code":31,"In":32,"Out":33,"on":1,"Cursor":38,"fw_app":"bf","Num_panels_horizontal":23,"Num_panels_vertical":24,"on.initialize":56,"draw_data":63,"fw_parent":62,"Margin":27,"Data":46,"Font_size":28,"on.draw":49,"on.mouse_press":48}
draw_data = function(data)
-- assumes data is in middle column, bottom half
local panel_width = (App.screen.width - Margin * (Num_panels_horizontal+1)) / Num_panels_horizontal
local panel_height = (App.screen.height - Margin*3) / 2
local x = Margin + panel_width + Margin + 20
local y = Margin + panel_height + Margin + 20
for i,d in ipairs(data) do
App.color{r=0.5,g=0.5,b=0.5}
love.graphics.rectangle('line', x,y, 60, 30, 2,2)
App.color{r=0,g=0,b=0}
love.graphics.print(d, x+2,y)
x = x+80
if i%5 == 0 then
y = y + 40
x = Margin + panel_width + Margin + 20
end
end
end
{"Cursor":38,"Num_panels_horizontal":23,"on.mouse_press":48,"on.initialize":56,"draw_data":61,"Margin":27,"Font_size":28,"on.draw":49,"create_editor":62,"Code":31,"Data":46,"In":32,"Out":33,"fw_app":"bf","Num_panels_vertical":24,"on":1,"fw_parent":61}
create_editor = function(col, row)
local panel_width = (App.screen.width - Margin * (Num_panels_horizontal + 1)) / Num_panels_horizontal
local left = (col - 1) * (Margin + panel_width) + Margin
local panel_height = (App.screen.height - Margin * (Num_panels_vertical[col]+1)) / Num_panels_vertical[col]
local top = (row - 1) * (Margin + panel_height) + Margin
local result = edit.initialize_state(top+5, left+5, left+panel_width-5, Font_size, math.floor(Font_size*1.3))
Text.redraw_all(result)
return result
end
{"Cursor":38,"Num_panels_horizontal":23,"on.mouse_press":48,"on.initialize":56,"draw_data":61,"Margin":27,"Font_size":28,"on.draw":49,"create_editor":37,"Code":31,"Data":46,"In":32,"Out":33,"fw_app":"bf","Num_panels_vertical":24,"on":1,"fw_parent":60}
draw_data = function(data)
-- assumes data is in middle column, bottom half
local panel_width = (App.screen.width - Margin * (Num_panels_horizontal+1)) / Num_panels_horizontal
local panel_height = (App.screen.height - Margin*3) / 2
local x = Margin + panel_width + Margin + 20
local y = Margin + panel_height + Margin + 20
print(x,y, App.screen.width, App.screen.height, #data)
for i,d in ipairs(data) do
App.color{r=0.5,g=0.5,b=0.5}
love.graphics.rectangle('line', x,y, 60, 30, 2,2)
App.color{r=0,g=0,b=0}
love.graphics.print(d, x+2,y)
x = x+80
if i%5 == 0 then
y = y + 40
x = Margin + panel_width + Margin + 20
end
end
end
{"Cursor":38,"Num_panels_horizontal":23,"on.mouse_press":48,"on.initialize":56,"draw_data":60,"Margin":27,"Font_size":28,"on.draw":49,"create_editor":37,"Code":31,"Data":46,"In":32,"Out":33,"fw_app":"bf","Num_panels_vertical":24,"on":1,"fw_parent":59}
draw_data = function(data)
-- assumes data is in middle column, bottom half
local panel_width = (App.screen.width - Margin * (Num_panels_horizontal+1)) / Num_panels_horizontal
local panel_height = (App.screen.height - Margin*3) / 2
local x = Margin + panel_width + Margin + 20
local y = Margin + panel_height + Margin + 20
print(x,y, App.screen.width, App.screen.height, #data)
for i,d in ipairs(data) do
App.color{r=0.5,g=0.5,b=0.5}
love.graphics.rectangle('line', x,y, 60, 30, 2,2)
App.color{r=0,g=0,b=0}
love.graphics.print(d, x,y)
x = x+80
if i%5 == 0 then
y = y + 40
x = Margin + panel_width + Margin + 20
end
end
end
{"Cursor":38,"Num_panels_horizontal":23,"on.mouse_press":48,"on.initialize":56,"draw_data":59,"Margin":27,"Font_size":28,"on.draw":49,"create_editor":37,"Code":31,"Data":46,"In":32,"Out":33,"fw_app":"bf","Num_panels_vertical":24,"on":1,"fw_parent":58}
draw_data = function(data)
-- assumes data is in middle column, bottom half
local panel_width = (App.screen.width - Margin * (Num_panels_horizontal+1)) / Num_panels_horizontal
local panel_height = (App.screen.height - Margin*3) / 2
local x = Margin + panel_width + Margin + 5
local y = Margin + panel_height + Margin + 5
print(x,y, App.screen.width, App.screen.height, #data)
for i,d in ipairs(data) do
App.color{r=0.5,g=0.5,b=0.5}
love.graphics.rectangle('line', x,y, 60, 30, 2,2)
App.color{r=0,g=0,b=0}
love.graphics.print(d, x,y)
x = x+80
if i%5 == 0 then
y = y + 40
x = Margin + panel_width + Margin + 5
end
end
end
{"Cursor":38,"Num_panels_horizontal":23,"on.mouse_press":48,"on.initialize":56,"draw_data":58,"Margin":27,"Font_size":28,"on.draw":49,"create_editor":37,"Code":31,"Data":46,"In":32,"Out":33,"fw_app":"bf","Num_panels_vertical":24,"on":1,"fw_parent":56}
draw_data = function(data)
-- assumes data is in middle column, bottom half
local panel_width = (App.screen.width - Margin * (Num_panels_horizontal+1)) / Num_panels_horizontal
local panel_height = (App.screen.height - Margin*3) / 2
local x = Margin + panel_width + Margin
local y = Margin + panel_height + Margin
print(x,y, App.screen.width, App.screen.height, #data)
for i,d in ipairs(data) do
App.color{r=0.5,g=0.5,b=0.5}
love.graphics.rectangle('line', x,y, 60, 30, 2,2)
App.color{r=0,g=0,b=0}
love.graphics.print(d, x,y)
x = x+80
if i%5 == 0 then
y = y + 40
x = Margin + panel_width + Margin
end
end
end
{"Cursor":38,"Num_panels_horizontal":23,"on.mouse_press":48,"on.initialize":56,"draw_data":57,"Margin":27,"Font_size":28,"on.draw":49,"create_editor":37,"Code":31,"Data":46,"In":32,"Out":33,"fw_app":"bf","Num_panels_vertical":24,"on":1,"fw_parent":56}
draw_data = function(data)
-- assumes data is in middle column, bottom half
local panel_width = (App.screen.width - Margin * (Num_panels_horizontal+1)) / Num_panels_horizontal
local panel_height = (App.screen.height - Margin*3) / 2
local x = Margin + panel_width + Margin
local y = Margin + panel_height + Margin
print(x,y, App.screen.width, App.screen.height, #data)
for i,d in ipairs(data) do
App.color{r=0.5,g=0.5,b=0.5}
love.graphics.rectangle('line', x,y, 60, 30, 2,2)
App.color{r=0,g=0,b=0}
love.graphics.print(d, x,y)
x = x+80
if i%5 == 0 then
y = y + 40
x = Margin + panel_width + Margin
end
end
on.initialize = function()
local font = love.graphics.newFont(Font_size)
love.graphics.setFont(font)
In = create_editor(1, 1)
Code = create_editor(2, 1)
print(Code)
Data = {}
print('data')
for i=1,10 do
table.insert(Data, 0)
end
Out = create_editor(3, 1)
end
{"Num_panels_vertical":24,"on.mouse_press":48,"on.initialize":56,"draw_data":55,"Margin":27,"Font_size":28,"on.draw":49,"create_editor":37,"Code":31,"Cursor":38,"Out":33,"Data":46,"In":32,"Num_panels_horizontal":23,"fw_parent":55,"on":1,"fw_app":"bf"}
{"Num_panels_vertical":24,"on.mouse_press":48,"on.initialize":47,"draw_data":55,"Margin":27,"Font_size":28,"on.draw":49,"create_editor":37,"Code":31,"Cursor":38,"Out":33,"Data":46,"In":32,"Num_panels_horizontal":23,"fw_parent":54,"on":1,"fw_app":"bf"}
draw_data = function(data)
-- assumes data is in middle column, bottom half
local panel_width = (App.screen.width - Margin * (Num_panels_horizontal+1)) / Num_panels_horizontal
local panel_height = (App.screen.height - Margin*3) / 2
local x = Margin + panel_width + Margin
local y = Margin + panel_height + Margin
print(x,y, App.screen.width, App.screen.height, #data)
for i,d in ipairs(data) do
App.color{r=0.5,g=0.5,b=0.5}
love.graphics.rectangle('line', x,y, 60, 30, 2,2)
App.color{r=0,g=0,b=0}
love.graphics.print(d, x,y)
x = x+80
end
end
{"Num_panels_vertical":24,"on.mouse_press":48,"on.initialize":47,"draw_data":54,"Margin":27,"Font_size":28,"on.draw":49,"create_editor":37,"Code":31,"Cursor":38,"Out":33,"Data":46,"In":32,"Num_panels_horizontal":23,"fw_parent":53,"on":1,"fw_app":"bf"}
draw_data = function(data)
-- assumes data is in middle column, bottom half
local panel_width = (App.screen.width - Margin * (Num_panels_horizontal+1)) / Num_panels_horizontal
local panel_height = (App.screen.height - Margin*3) / 2
local x = Margin + panel_width + Margin
local y = Margin + panel_height + Margin
print(x,y, App.screen.width, App.screen.height)
for i,d in ipairs(data) do
App.color{r=0.5,g=0.5,b=0.5}
love.graphics.rectangle('line', x,y, 60, 30, 2,2)
App.color{r=0,g=0,b=0}
love.graphics.print(d, x,y)
x = x+80
end
end
{"Num_panels_vertical":24,"on.mouse_press":48,"on.initialize":47,"draw_data":53,"Margin":27,"Font_size":28,"on.draw":49,"create_editor":37,"Code":31,"Cursor":38,"Out":33,"Data":46,"In":32,"Num_panels_horizontal":23,"fw_parent":52,"on":1,"fw_app":"bf"}
draw_data = function(data)
-- assumes data is in middle column, bottom half
local panel_width = (App.screen.width - Margin * (Num_panels_horizontal+1)) / Num_panels_horizontal
local panel_height = (App.screen.height - Margin*3) / 2
local x = Margin + panel_width + Margin
local y = Margin + panel_height + Margin
print(x,y)
for i,d in ipairs(data) do
App.color{r=0.5,g=0.5,b=0.5}
love.graphics.rectangle('line', x,y, 60, 30, 2,2)
App.color{r=0,g=0,b=0}
love.graphics.print(d, x,y)
x = x+80
end
end
{"Code":31,"Cursor":38,"on":1,"on.mouse_press":48,"Data":46,"fw_app":"bf","on.draw":49,"Num_panels_horizontal":23,"Num_panels_vertical":24,"on.initialize":47,"Margin":27,"fw_parent":51,"Font_size":28,"draw_data":52,"Out":33,"create_editor":37,"In":32}
draw_data = function(data)
-- assumes data is in middle column, bottom half
local panel_width = (App.screen.width - Margin * (Num_panels_horizontal+1)) / Num_panels_horizontal
local panel_height = (App.screen.height - Margin*3) / 2
local x = Margin + panel_width + Margin
local y = Margin + panel_height + Margin
for i,d in ipairs(data) do
App.color{r=0.5,g=0.5,b=0.5}
love.graphics.rectangle('line', x,y, 60, 30, 2,2)
App.color{r=0,g=0,b=0}
love.graphics.print(d, x,y)
x = x+80
end
end
{"Code":31,"Cursor":38,"on":1,"on.mouse_press":48,"Data":46,"fw_app":"bf","on.draw":49,"Num_panels_horizontal":23,"Num_panels_vertical":24,"on.initialize":47,"Margin":27,"fw_parent":50,"Font_size":28,"draw_data":51,"Out":33,"create_editor":37,"In":32}
draw_data = function(data)
-- assumes data is in middle column, bottom half
local panel_width = (App.screen.width - Margin * (Num_panels_horizontal+1)) / Num_panels_horizontal
local panel_height = (App.screen.height - Margin*3) / 2
local x = Margin + panel_width + Margin
local y = Margin + panel_height + Margin
for i,d in ipairs(data) do
end
end
{"Code":31,"Cursor":38,"on":1,"on.mouse_press":48,"Data":46,"fw_app":"bf","on.draw":49,"Num_panels_horizontal":23,"Num_panels_vertical":24,"on.initialize":47,"Margin":27,"fw_parent":49,"Font_size":28,"draw_data":50,"Out":33,"create_editor":37,"In":32}
draw_data = function(data)
end
on.draw = function()
assert(#Num_panels_vertical == Num_panels_horizontal)
App.color{r=0.5,g=0.5,b=0.5}
local panel_width = (App.screen.width - Margin * (Num_panels_horizontal+1)) / Num_panels_horizontal
local x = 0
for i = 1,Num_panels_horizontal do
local panel_height = (App.screen.height - Margin * (Num_panels_vertical[i]+1)) / Num_panels_vertical[i]
local y = 0
for j = 1,Num_panels_vertical[i] do
love.graphics.rectangle('line', x+Margin, y+Margin, panel_width, panel_height, 5,5)
y = y + Margin + panel_height
end
x = x + Margin + panel_width
end
edit.draw(In, Text_color, Cursor ~= In)
edit.draw(Code, Text_color, Cursor ~= Code)
edit.draw(Out, Text_color, Cursor ~= Out)
draw_data(Data)
end
{"Code":31,"create_editor":37,"Num_panels_horizontal":23,"on.initialize":47,"Num_panels_vertical":24,"Font_size":28,"on":1,"Cursor":38,"on.mouse_press":48,"Data":46,"In":32,"fw_app":"bf","on.draw":49,"Margin":27,"Out":33,"fw_parent":48}
on.mouse_press = function(x,y, mouse_button)
if x < In.right then
Cursor = In
elseif x < Code.right then
if y < App.screen.height/2 then
Cursor = Code
else
Cursor = Data
end
else
Cursor = Out
end
end
{"Code":31,"create_editor":37,"Num_panels_horizontal":23,"on.initialize":47,"Num_panels_vertical":24,"Font_size":28,"on":1,"Cursor":38,"on.mouse_press":48,"Data":46,"In":32,"fw_app":"bf","on.draw":45,"Margin":27,"Out":33,"fw_parent":47}
on.initialize = function()
local font = love.graphics.newFont(Font_size)
love.graphics.setFont(font)
In = create_editor(1, 1)
Code = create_editor(2, 1)
print(Code)
Data = create_editor(2, 2)
Out = create_editor(3, 1)
end
{"Code":31,"Num_panels_horizontal":23,"on.initialize":47,"Num_panels_vertical":24,"Font_size":28,"on":1,"Cursor":38,"create_editor":37,"Data":46,"In":32,"fw_app":"bf","on.draw":45,"Margin":27,"Out":33,"fw_parent":46}
{"Out":33,"Data":46,"In":32,"Num_panels_horizontal":23,"Margin":27,"Cursor":38,"fw_parent":45,"on":1,"fw_app":"bf","create_editor":37,"on.draw":45,"Code":31,"Font_size":28,"Num_panels_vertical":24,"on.initialize":36}
Data = nil -- editor for data
on.draw = function()
assert(#Num_panels_vertical == Num_panels_horizontal)
App.color{r=0.5,g=0.5,b=0.5}
local panel_width = (App.screen.width - Margin * (Num_panels_horizontal+1)) / Num_panels_horizontal
local x = 0
for i = 1,Num_panels_horizontal do
local panel_height = (App.screen.height - Margin * (Num_panels_vertical[i]+1)) / Num_panels_vertical[i]
local y = 0
for j = 1,Num_panels_vertical[i] do
love.graphics.rectangle('line', x+Margin, y+Margin, panel_width, panel_height, 5,5)
y = y + Margin + panel_height
end
x = x + Margin + panel_width
end
edit.draw(In, Text_color, Cursor ~= In)
edit.draw(Code, Text_color, Cursor ~= Code)
edit.draw(Data, Text_color, Cursor ~= Data)
edit.draw(Out, Text_color, Cursor ~= Out)
end
{"Out":33,"In":32,"Num_panels_horizontal":23,"Margin":27,"Cursor":38,"fw_parent":44,"on":1,"fw_app":"bf","create_editor":37,"on.draw":45,"Code":31,"Font_size":28,"Num_panels_vertical":24,"on.initialize":36}
on.draw = function()
assert(#Num_panels_vertical == Num_panels_horizontal)
App.color{r=0.5,g=0.5,b=0.5}
local panel_width = (App.screen.width - Margin * (Num_panels_horizontal+1)) / Num_panels_horizontal
local x = 0
for i = 1,Num_panels_horizontal do
local panel_height = (App.screen.height - Margin * (Num_panels_vertical[i]+1)) / Num_panels_vertical[i]
local y = 0
for j = 1,Num_panels_vertical[i] do
love.graphics.rectangle('line', x+Margin, y+Margin, panel_width, panel_height, 5,5)
y = y + Margin + panel_height
end
x = x + Margin + panel_width
end
edit.draw(In, Text_color, Cursor == In)
edit.draw(Code, Text_color, Cursor == Code)
edit.draw(Data, Text_color, Cursor == Data)
edit.draw(Out, Text_color, Cursor == Out)
end
{"Out":33,"In":32,"Num_panels_horizontal":23,"Margin":27,"Cursor":38,"fw_parent":43,"on":1,"fw_app":"bf","create_editor":37,"on.draw":44,"Code":31,"Font_size":28,"Num_panels_vertical":24,"on.initialize":36}
on.draw = function()
assert(#Num_panels_vertical == Num_panels_horizontal)
App.color{r=0.5,g=0.5,b=0.5}
local panel_width = (App.screen.width - Margin * (Num_panels_horizontal+1)) / Num_panels_horizontal
local x = 0
for i = 1,Num_panels_horizontal do
local panel_height = (App.screen.height - Margin * (Num_panels_vertical[i]+1)) / Num_panels_vertical[i]
local y = 0
for j = 1,Num_panels_vertical[i] do
love.graphics.rectangle('line', x+Margin, y+margin, panel_width, panel_height, 5,5)
y = y + Margin + panel_height
end
x = x + Margin + panel_width
end
edit.draw(In, Text_color, Cursor == In)
edit.draw(Code, Text_color, Cursor == Code)
edit.draw(Data, Text_color, Cursor == Data)
edit.draw(Out, Text_color, Cursor == Out)
end
{"Out":33,"In":32,"Num_panels_horizontal":23,"Margin":27,"Cursor":38,"fw_parent":42,"on":1,"fw_app":"bf","create_editor":37,"on.draw":43,"Code":31,"Font_size":28,"Num_panels_vertical":24,"on.initialize":36}
on.draw = function()
assert(#Num_panels_vertical == Num_panels_horizontal)
App.color{r=0.5,g=0.5,b=0.5}
local panel_width = (App.screen.width - Margin * (Num_panels_horizontal+1)) / Num_panels_horizontal
local x = 0
for i = 1,Num_panels_horizontal do
local panel_height = (App.screen.height - margin * (Num_panels_vertical[i]+1)) / Num_panels_vertical[i]
local y = 0
for j = 1,Num_panels_vertical[i] do
love.graphics.rectangle('line', x+Margin, y+margin, panel_width, panel_height, 5,5)
y = y + Margin + panel_height
end
x = x + Margin + panel_width
end
edit.draw(In, Text_color, Cursor == In)
edit.draw(Code, Text_color, Cursor == Code)
edit.draw(Data, Text_color, Cursor == Data)
edit.draw(Out, Text_color, Cursor == Out)
end
{"Out":33,"In":32,"Num_panels_horizontal":23,"Margin":27,"Cursor":38,"fw_parent":41,"on":1,"fw_app":"bf","create_editor":37,"on.draw":42,"Code":31,"Font_size":28,"Num_panels_vertical":24,"on.initialize":36}
on.draw = function()
assert(#Num_panels_vertical == Num_panels_horizontal)
App.color{r=0.5,g=0.5,b=0.5}
local panel_width = (App.screen.width - Margin * (Num_panels_horizontal+1)) / Num_panels_horizontal
local x = 0
for i = 1,Num_panels_horizontal do
local panel_height = (App.screen.height - margin * (Num_panels_vertical[i]+1)) / Num_panels_vertical[i]
local y = 0
for j = 1,Num_panels_vertical[i] do
love.graphics.rectangle('line', x+margin, y+margin, panel_width, panel_height, 5,5)
y = y + margin + panel_height
end
x = x + margin + panel_width
end
edit.draw(In, Text_color, Cursor == In)
edit.draw(Code, Text_color, Cursor == Code)
edit.draw(Data, Text_color, Cursor == Data)
edit.draw(Out, Text_color, Cursor == Out)
end
{"Out":33,"In":32,"Num_panels_horizontal":23,"Margin":27,"Cursor":38,"fw_parent":40,"on":1,"fw_app":"bf","create_editor":37,"on.draw":41,"Code":31,"Font_size":28,"Num_panels_vertical":24,"on.initialize":36}
on.draw = function()
assert(#Num_panels_vertical == Num_panels_horizontal)
App.color{r=0.5,g=0.5,b=0.5}
local panel_width = (App.screen.width - Margin * (Num_panels_horizontal+1)) / Num_panels_horizontal
local x = 0
for i = 1,num_panels_hor do
local panel_height = (App.screen.height - margin * (num_panels_ver[i]+1)) / num_panels_ver[i]
local y = 0
for j = 1,num_panels_ver[i] do
love.graphics.rectangle('line', x+margin, y+margin, panel_width, panel_height, 5,5)
y = y + margin + panel_height
end
x = x + margin + panel_width
end
edit.draw(In, Text_color, Cursor == In)
edit.draw(Code, Text_color, Cursor == Code)
edit.draw(Data, Text_color, Cursor == Data)
edit.draw(Out, Text_color, Cursor == Out)
end
{"Out":33,"on.initialize":36,"Num_panels_vertical":24,"Margin":27,"fw_app":"bf","Font_size":28,"Cursor":38,"fw_parent":39,"create_editor":37,"on.draw":40,"Code":31,"In":32,"Num_panels_horizontal":23,"on":1}
on.draw = function()
assert(#Num_panels_vertical == num_panels_horizontal)
App.color{r=0.5,g=0.5,b=0.5}
local panel_width = (App.screen.width - Margin * (Num_panels_horizontal+1)) / Num_panels_horizontal
local x = 0
for i = 1,num_panels_hor do
local panel_height = (App.screen.height - margin * (num_panels_ver[i]+1)) / num_panels_ver[i]
local y = 0
for j = 1,num_panels_ver[i] do
love.graphics.rectangle('line', x+margin, y+margin, panel_width, panel_height, 5,5)
y = y + margin + panel_height
end
x = x + margin + panel_width
end
edit.draw(In, Text_color, Cursor == In)
edit.draw(Code, Text_color, Cursor == Code)
edit.draw(Data, Text_color, Cursor == Data)
edit.draw(Out, Text_color, Cursor == Out)
end
{"In":32,"on":1,"Out":33,"on.initialize":36,"Cursor":38,"Num_panels_vertical":24,"Margin":27,"Num_panels_horizontal":23,"Font_size":28,"on.draw":39,"fw_parent":38,"create_editor":37,"fw_app":"bf","Code":31}
{"In":32,"on":1,"Out":33,"on.initialize":36,"Cursor":38,"Num_panels_vertical":24,"Margin":27,"Num_panels_horizontal":23,"Font_size":28,"on.draw":35,"fw_parent":37,"create_editor":37,"fw_app":"bf","Code":31}
Cursor = nil -- editor that has focus
{"on.initialize":36,"on":1,"Margin":27,"Font_size":28,"on.draw":35,"fw_app":"bf","create_editor":37,"Code":31,"fw_parent":36,"In":32,"Num_panels_horizontal":23,"Num_panels_vertical":24,"Out":33}
create_editor = function(col, row)
local panel_width = (App.screen.width - Margin * (Num_panels_horizontal + 1)) / Num_panels_horizontal
local left = (col - 1) * (Margin + panel_width) + Margin
local panel_height = (App.screen.height - Margin * (Num_panels_vertical[col]+1)) / Num_panels_vertical[col]
local top = (row - 1) * (Margin + panel_height) + Margin
local result = edit.initialize_state(top, left, left+panel_width, Font_size, math.floor(Font_size*1.3))
Text.redraw_all(result)
return result
end
on.initialize = function()
local font = love.graphics.newFont(Font_size)
love.graphics.setFont(font)
In = create_editor(1, 1)
Code = create_editor(2, 1)
print(Code)
Data = create_editor(2, 2)
Out = create_editor(3, 1)
end
{"create_editor":30,"on.initialize":36,"on.draw":35,"Num_panels_vertical":24,"Font_size":28,"fw_app":"bf","In":32,"Margin":27,"Code":31,"Out":33,"Num_panels_horizontal":23,"fw_parent":35,"on":1}
on.draw = function()
edit.draw(In)
edit.draw(Code)
edit.draw(Data)
edit.draw(Out)
assert(#Num_panels_vertical == num_panels_horizontal)
App.color{r=0.5,g=0.5,b=0.5}
local panel_width = (App.screen.width - Margin * (Num_panels_horizontal+1)) / Num_panels_horizontal
local x = 0
for i = 1,num_panels_hor do
local panel_height = (App.screen.height - margin * (num_panels_ver[i]+1)) / num_panels_ver[i]
local y = 0
for j = 1,num_panels_ver[i] do
love.graphics.rectangle('line', x+margin, y+margin, panel_width, panel_height, 5,5)
y = y + margin + panel_height
end
x = x + margin + panel_width
end
end
{"create_editor":30,"on.initialize":34,"on.draw":35,"Num_panels_vertical":24,"Font_size":28,"fw_app":"bf","In":32,"Margin":27,"Code":31,"Out":33,"Num_panels_horizontal":23,"fw_parent":34,"on":1}
on.initialize = function()
local font = love.graphics.newFont(Font_size)
love.graphics.setFont(font)
In = create_editor(1, 1)
Code = create_editor(2, 1)
Data = create_editor(2, 2)
Out = create_editor(3, 1)
end
{"create_editor":30,"on.initialize":34,"on.draw":22,"Num_panels_vertical":24,"Font_size":28,"fw_app":"bf","In":32,"Margin":27,"Code":31,"Out":33,"Num_panels_horizontal":23,"fw_parent":33,"on":1}
{"create_editor":30,"on.initialize":29,"on.draw":22,"Num_panels_vertical":24,"Font_size":28,"fw_app":"bf","In":32,"Margin":27,"Code":31,"Out":33,"Num_panels_horizontal":23,"fw_parent":32,"on":1}
Out = nil -- right column
{"create_editor":30,"on.initialize":29,"on.draw":22,"Num_panels_vertical":24,"fw_app":"bf","In":32,"Margin":27,"Code":31,"Font_size":28,"Num_panels_horizontal":23,"fw_parent":31,"on":1}
In = nil -- left column
{"create_editor":30,"on.initialize":29,"on.draw":22,"Num_panels_vertical":24,"fw_app":"bf","Margin":27,"Code":31,"Font_size":28,"Num_panels_horizontal":23,"fw_parent":30,"on":1}
Code = nil -- editor for code editor in middle column, top half
{"create_editor":30,"on.initialize":29,"on.draw":22,"Num_panels_vertical":24,"fw_app":"bf","Margin":27,"Font_size":28,"Num_panels_horizontal":23,"fw_parent":29,"on":1}
create_editor = function(col, row)
local panel_width = (App.screen.width - Margin * (Num_panels_horizontal + 1)) / Num_panels_horizontal
local left = (col - 1) * (Margin + panel_width) + Margin
local panel_height = (App.screen.height - Margin * (Num_panels_vertical[col]+1)) / Num_panels_vertical[col]
local top = (row - 1) * (Margin + panel_height) + Margin
return edit.initialize_state(top, left, left+panel_width, Font_size, math.floor(Font_size*1.3))
end
on.initialize = function()
local font = love.graphics.newFont(Font_size)
love.graphics.setFont(font)
end
{"on.initialize":29,"on.draw":22,"Num_panels_vertical":24,"fw_app":"bf","Margin":27,"Font_size":28,"Num_panels_horizontal":23,"fw_parent":28,"on":1}
{"on.initialize":26,"on.draw":22,"Num_panels_vertical":24,"fw_app":"bf","Margin":27,"Font_size":28,"Num_panels_horizontal":23,"fw_parent":27,"on":1}
Font_size = 20
{"fw_app":"bf","Margin":27,"on":1,"on.initialize":26,"on.draw":22,"Num_panels_vertical":24,"fw_parent":26,"Num_panels_horizontal":23}
Margin = 15
on.initialize = function()
love.graphics.setFont(love.graphics.newFont(20))
end
{"fw_app":"bf","on":1,"on.initialize":26,"on.draw":22,"Num_panels_vertical":24,"fw_parent":25,"Num_panels_horizontal":23}
on.initialize = function()
love.graphics.setFont(20)
end
{"fw_app":"bf","on":1,"on.initialize":25,"on.draw":22,"Num_panels_vertical":24,"fw_parent":24,"Num_panels_horizontal":23}
{"fw_app":"bf","on":1,"on.draw":22,"Num_panels_vertical":24,"fw_parent":23,"Num_panels_horizontal":23}
Num_panels_vertical = {1,2,1}
{"fw_app":"bf","on":1,"on.draw":22,"fw_parent":22,"Num_panels_horizontal":23}
Num_panels_horizontal = 3
on.draw = function()
-- draw a grid of equally-sized columns, each containing some number of equally-sized panels
local num_panels_hor = 3
local num_panels_ver = {1,2,1} -- number of vertical panels by column
assert(#num_panels_ver == num_panels_hor)
App.color{r=0.5,g=0.5,b=0.5}
local margin=15
local panel_width = (App.screen.width - margin * (num_panels_hor+1)) / num_panels_hor
local x = 0
for i = 1,num_panels_hor do
local panel_height = (App.screen.height - margin * (num_panels_ver[i]+1)) / num_panels_ver[i]
local y = 0
for j = 1,num_panels_ver[i] do
love.graphics.rectangle('line', x+margin, y+margin, panel_width, panel_height, 5,5)
y = y + margin + panel_height
end
x = x + margin + panel_width
end
end
{"on.draw":22,"fw_parent":21,"fw_app":"bf","on":1}
on.draw = function()
-- draw a grid of equally-sized columns, each containing some number of equally-sized panels
local num_panels_hor = 3
local num_panels_ver = {3,4,1} -- number of vertical panels by column
assert(#num_panels_ver == num_panels_hor)
App.color{r=0.5,g=0.5,b=0.5}
local margin=15
local panel_width = (App.screen.width - margin * (num_panels_hor+1)) / num_panels_hor
local x = 0
for i = 1,num_panels_hor do
local panel_height = (App.screen.height - margin * (num_panels_ver[i]+1)) / num_panels_ver[i]
local y = 0
for j = 1,num_panels_ver[i] do
love.graphics.rectangle('line', x+margin, y+margin, panel_width, panel_height, 5,5)
y = y + margin + panel_height
end
x = x + margin + panel_width
end
end
{"on.draw":21,"fw_parent":20,"fw_app":"bf","on":1}
on.draw = function()
-- draw a grid of equally-sized panels
local num_panels_hor = 3
local num_panels_ver = {3,4,1} -- number of vertical panels by column
assert(#num_panels_ver == num_panels_hor)
App.color{r=0.5,g=0.5,b=0.5}
local margin=15
local panel_width = (App.screen.width - margin * (num_panels_hor+1)) / num_panels_hor
local x = 0
for i = 1,num_panels_hor do
local panel_height = (App.screen.height - margin * (num_panels_ver[i]+1)) / num_panels_ver[i]
local y = 0
for j = 1,num_panels_ver[i] do
love.graphics.rectangle('line', x+margin, y+margin, panel_width, panel_height, 5,5)
y = y + margin + panel_height
end
x = x + margin + panel_width
end
end
{"on.draw":20,"fw_parent":19,"fw_app":"bf","on":1}
on.draw = function()
-- draw a grid of equally-sized panels
local num_panels_hor = 3
local num_panels_ver = {1,2,1} -- number of vertical panels by column
assert(#num_panels_ver == num_panels_hor)
App.color{r=0.5,g=0.5,b=0.5}
local margin=15
local panel_width = (App.screen.width - margin * (num_panels_hor+1)) / num_panels_hor
local x = 0
for i = 1,num_panels_hor do
local panel_height = (App.screen.height - margin * (num_panels_ver[i]+1)) / num_panels_ver[i]
local y = 0
for j = 1,num_panels_ver[i] do
love.graphics.rectangle('line', x+margin, y+margin, panel_width, panel_height, 5,5)
y = y + margin + panel_height
end
x = x + margin + panel_width
end
end
{"on.draw":19,"fw_parent":18,"fw_app":"bf","on":1}
on.draw = function()
-- draw a grid of equally-sized panels
local num_panels_hor = 3
local num_panels_ver = {1,2,1} -- number of vertical panels by column
assert(#num_panels_ver == num_panels_hor)
App.color{r=0.5,g=0.5,b=0.5}
local margin=15
local panel_width = (App.screen.width - margin * (num_panels_hor+1)) / num_panels_hor
local x = 0
for i = 1,num_panels_hor do
local panel_height = (App.screen.height - margin * (num_panels_ver[i]+1)) / num_panels_ver[i]
local y = 0
for j = 1,num_panels_ver do
love.graphics.rectangle('line', x+margin, y+margin, panel_width, panel_height, 5,5)
y = y + margin + panel_height
end
x = x + margin + panel_width
end
end
{"on.draw":18,"fw_parent":17,"fw_app":"bf","on":1}
on.draw = function()
-- draw a grid of equally-sized panels
local num_panels_hor, num_panels_ver = 3, 1 -- vary this
App.color{r=0.5,g=0.5,b=0.5}
local margin=15
local panel_width = (App.screen.width - margin * (num_panels_hor+1)) / num_panels_hor
local panel_height = (App.screen.height - margin * (num_panels_ver+1)) / num_panels_ver
local x,y = 0, 0
for i = 1,num_panels_hor do
y = 0
for j = 1,num_panels_ver do
love.graphics.rectangle('line', x+margin, y+margin, panel_width, panel_height, 5,5)
y = y + margin + panel_height
end
x = x + margin + panel_width
end
end
{"on.draw":17,"fw_parent":16,"fw_app":"bf","on":1}
on.draw = function()
-- draw a grid of equally-sized panels
local num_panels_hor, num_panels_ver = 3, 6 -- vary this
App.color{r=0.5,g=0.5,b=0.5}
local margin=15
local panel_width = (App.screen.width - margin * (num_panels_hor+1)) / num_panels_hor
local panel_height = (App.screen.height - margin * (num_panels_ver+1)) / num_panels_ver
local x,y = 0, 0
for i = 1,num_panels_hor do
y = 0
for j = 1,num_panels_ver do
love.graphics.rectangle('line', x+margin, y+margin, panel_width, panel_height, 5,5)
y = y + margin + panel_height
end
x = x + margin + panel_width
end
end
{"on.draw":16,"fw_parent":15,"fw_app":"bf","on":1}
on.draw = function()
-- draw a grid of equally-sized panels
local num_panels_hor, num_panels_ver = 3, 1 -- vary this
App.color{r=0.5,g=0.5,b=0.5}
local margin=15
local panel_width = (App.screen.width - margin * (num_panels_hor+1)) / num_panels_hor
local panel_height = (App.screen.height - margin * (num_panels_ver+1)) / num_panels_ver
local x,y = 0, 0
for i = 1,num_panels_hor do
y = 0
for j = 1,num_panels_ver do
love.graphics.rectangle('line', x+margin, y+margin, panel_width, panel_height, 5,5)
y = y + margin + panel_height
end
x = x + margin + panel_width
end
end
{"on.draw":15,"fw_parent":14,"fw_app":"bf","on":1}
on.draw = function()
-- draw a grid of equally-sized panels
local num_panels_hor, num_panels_ver = 3, 1 -- vary this
App.color{r=0.5,g=0.5,b=0.5}
local margin=15
local panel_width = (App.screen.width - margin * (num_panels_hor+1)) / num_panels_hor
local panel_height = (App.screen.height - margin * (num_panels_ver+1)) / num_panels_ver
local x,y = 0, 0
for i = 1,num_panels_ver do
x = 0
for j = 1,num_panels_hor do
love.graphics.rectangle('line', x+margin, y+margin, panel_width, panel_height, 5,5)
x = x + margin + panel_width
end
y = y + margin + panel_height
end
end
{"on.draw":14,"fw_parent":13,"fw_app":"bf","on":1}
on.draw = function()
-- draw a grid of equally-sized panels
local num_panels_hor, num_panels_ver = 5, 2 -- vary this
App.color{r=0.5,g=0.5,b=0.5}
local margin=15
local panel_width = (App.screen.width - margin * (num_panels_hor+1)) / num_panels_hor
local panel_height = (App.screen.height - margin * (num_panels_ver+1)) / num_panels_ver
local x,y = 0, 0
for i = 1,num_panels_ver do
x = 0
for j = 1,num_panels_hor do
love.graphics.rectangle('line', x+margin, y+margin, panel_width, panel_height, 5,5)
x = x + margin + panel_width
end
y = y + margin + panel_height
end
end
{"on.draw":13,"fw_parent":12,"fw_app":"bf","on":1}
on.draw = function()
-- draw a grid of equally-sized panels
local num_panels_hor, num_panels_ver = 3, 2 -- vary this
App.color{r=0.5,g=0.5,b=0.5}
local margin=15
local panel_width = (App.screen.width - margin * (num_panels_hor+1)) / num_panels_hor
local panel_height = (App.screen.height - margin * (num_panels_ver+1)) / num_panels_ver
local x,y = 0, 0
for i = 1,num_panels_ver do
x = 0
for j = 1,num_panels_hor do
love.graphics.rectangle('line', x+margin, y+margin, panel_width, panel_height, 5,5)
x = x + margin + panel_width
end
y = y + margin + panel_height
end
end
{"on.draw":12,"fw_parent":11,"fw_app":"bf","on":1}
on.draw = function()
App.color{r=0.5,g=0.5,b=0.5}
local margin=15
local num_panels_hor, num_panels_ver = 3, 1
local panel_width = (App.screen.width - margin * (num_panels_hor+1)) / num_panels_hor
local panel_height = (App.screen.height - margin * (num_panels_ver+1)) / num_panels_ver
local x,y = 0, 0
for i = 1,num_panels_ver do
x = 0
for j = 1,num_panels_hor do
love.graphics.rectangle('line', x+margin, y+margin, panel_width, panel_height, 5,5)
x = x + margin + panel_width
end
y = y + margin + panel_height
end
end
{"on.draw":11,"fw_parent":10,"fw_app":"bf","on":1}
on.draw = function()
App.color{r=0.5,g=0.5,b=0.5}
local margin=15
local num_panels_hor, num_panels_ver = 3, 1
local panel_width = (App.screen.width - margin * (num_panels_hor+1)) / num_panels_hor
local panel_height = (App.screen.height - margin * (num_panels_ver+1)) / num_panels_ver
local x,y = 0, 0
for i in 1,num_panels_ver do
x = 0
for j in 1,num_panels_hor do
love.graphics.rectangle('line', x+margin, y+margin, panel_width, panel_height, 5,5)
x = x + margin + panel_width
end
y = y + margin + panel_height
end
end
{"on.draw":10,"fw_parent":9,"fw_app":"bf","on":1}
on.draw = function()
App.color{r=0.5,g=0.5,b=0.5}
local margin=15
local num_panels_hor, num_panels_ver = 3, 1
local panel_width = (App.screen.width - margin * (num_panels_hor+1)) / num_panels_hor
local panel_height = (App.screen.height - margin * (num_panels_ver+1)) / num_panels_ver
love.graphics.rectangle('line', margin, margin, panel_width, panel_height, 5,5)
end
{"on.draw":9,"fw_parent":8,"fw_app":"bf","on":1}
on.draw = function()
App.color{r=0.5,g=0.5,b=0.5}
local margin=15
local num_panels_hor, num_panels_ver = 3, 1
local panel_width = (App.screen.width - margin * (num_panels_hor+1)) / num_panels_hor
love.graphics.rectangle('line', margin, margin, panel_width, App.screen.height-margin*2, 5,5)
end
{"on.draw":8,"fw_parent":7,"fw_app":"bf","on":1}
on.draw = function()
App.color{r=0.5,g=0.5,b=0.5}
local margin=15
local num_panels = 3
local panel_width = (App.screen.width - margin * (num_panels+1)) / num_panels
love.graphics.rectangle('line', margin, margin, (App.screen.width-margin*4)/3, App.screen.height-margin*2, 5,5)
end
{"on.draw":7,"fw_parent":6,"fw_app":"bf","on":1}
on.draw = function()
App.color{r=0.5,g=0.5,b=0.5}
local margin=15
love.graphics.rectangle('line', margin, margin, (App.screen.width-margin*4)/3, App.screen.height-margin*2, 5,5)
end
{"on.draw":6,"fw_parent":5,"fw_app":"bf","on":1}
on.draw = function()
App.color{r=0.5,g=0.5,b=0.5}
local margin=15
love.graphics.rectangle('line', margin, margin, App.screen.width-margin*2, App.screen.height-margin*2, 5,5)
end
{"on.draw":5,"fw_parent":4,"fw_app":"bf","on":1}
on.draw = function()
App.color{r=0.5,g=0.5,b=0.5}
local margin=15
love.graphics.rectangle('line', margin, margin, App.screen.width-margin*2, App.screen.height-margin*2)
end
{"on.draw":4,"fw_parent":3,"fw_app":"bf","on":1}
on.draw = function()
local margin=15
love.graphics.rectangle('line', margin, margin, App.screen.width-margin*2, App.screen.height-margin*2)
end
{"on.draw":3,"fw_parent":2,"fw_app":"bf","on":1}
on.draw = function()
local margin=15
love.graphics.rectangle(margin, margin, App.screen.width-margin*2, App.screen.height-margin*2)
end
{"on.draw":2,"fw_parent":1,"fw_app":"bf","on":1}