start of the visual skeleton
This commit is contained in:
parent
72210616c7
commit
28f1e113a4
|
@ -2,6 +2,12 @@ on.initialize = function()
|
|||
love.graphics.setFont(love.graphics.newFont(20))
|
||||
Line_height = math.floor(love.graphics.getFont():getHeight()*1.3)
|
||||
Line_number_padding = Line_number_width*App.width('m')
|
||||
Editor_state = edit.initialize_state(100, 300, 100, 400, love.graphics.getFont():getHeight(), Line_height)
|
||||
Menu_left, Menu_top = love.window.getSafeArea()
|
||||
Menu_height = 5 + Line_height + 5
|
||||
Menu_bottom = Menu_top + Menu_height
|
||||
Editor_state = edit.initialize_state(
|
||||
--[[top]] Menu_bottom + 20, --[[bottom]] App.screen.height/2-5,
|
||||
--[[left]] 100, --[[right]] 400,
|
||||
love.graphics.getFont():getHeight(), Line_height)
|
||||
Text.redraw_all(Editor_state)
|
||||
end
|
||||
end
|
|
@ -1,4 +1,8 @@
|
|||
on.draw = function()
|
||||
love.graphics.rectangle('line', 100-5-Line_number_padding,100-5, 400+10, 200+10, 5,5)
|
||||
Editor_state.button_handlers = {}
|
||||
draw_editor_border()
|
||||
-- love.graphics.rectangle('line', 100-5-Line_number_padding,100-5, 300+Line_number_padding+10, 200+10, 5,5)
|
||||
edit.draw(Editor_state)
|
||||
draw_output_border()
|
||||
draw_menu()
|
||||
end
|
|
@ -1,3 +1,6 @@
|
|||
on.mouse_press = function(x,y, mouse_button)
|
||||
if mouse_press_consumed_by_any_button_handler(Editor_state, x,y, mouse_button) then
|
||||
return
|
||||
end
|
||||
edit.mouse_press(Editor_state, x,y, mouse_button)
|
||||
end
|
|
@ -0,0 +1,14 @@
|
|||
draw_editor_border = function()
|
||||
local x1 = Editor_state.left-5-Line_number_padding
|
||||
local y1 = Editor_state.top-5
|
||||
local x2 = Editor_state.right+5
|
||||
local y2 = Editor_state.bottom+5
|
||||
-- upper border
|
||||
love.graphics.line(x1,y1, x2,y1)
|
||||
love.graphics.line(x1,y1, x1,y1+10)
|
||||
love.graphics.line(x2,y1, x2,y1+10)
|
||||
-- lower border
|
||||
love.graphics.line(x1,y2, x2,y2)
|
||||
love.graphics.line(x1,y2, x1,y2-10)
|
||||
love.graphics.line(x2,y2, x2,y2-10)
|
||||
end
|
|
@ -0,0 +1,13 @@
|
|||
draw_menu = function()
|
||||
App.color(Menu_background)
|
||||
love.graphics.rectangle('fill', 0,0, App.screen.width, Menu_bottom)
|
||||
button(Editor_state, 'run', {x=Menu_left+5, y=Menu_top+5, w=App.width('Run')+10, h=Line_height, bg={r=0.5, g=0.8, b=0.5},
|
||||
icon = function(p)
|
||||
App.color{r=0,g=0,b=0}
|
||||
love.graphics.print('Run', p.x+5,p.y+2)
|
||||
end,
|
||||
onpress1 = function()
|
||||
print('run')
|
||||
end,
|
||||
})
|
||||
end
|
|
@ -0,0 +1 @@
|
|||
Menu_top = 0
|
|
@ -0,0 +1 @@
|
|||
Menu_left = 0
|
|
@ -0,0 +1 @@
|
|||
Menu_height = 0
|
|
@ -0,0 +1 @@
|
|||
Menu_bottom = 0
|
|
@ -0,0 +1 @@
|
|||
Menu_background = {r=0.2, g=0.2, b=0.2}
|
|
@ -0,0 +1,10 @@
|
|||
draw_output_border = function()
|
||||
-- hack: computing based on editor before output exists
|
||||
local x1 = Editor_state.left-5-Line_number_padding
|
||||
local x2 = Editor_state.right+5
|
||||
local y1 = Editor_state.bottom+5+10
|
||||
-- upper border
|
||||
love.graphics.line(x1,y1, x2,y1)
|
||||
love.graphics.line(x1,y1, x1,y1+10)
|
||||
love.graphics.line(x2,y1, x2,y1+10)
|
||||
end
|
Loading…
Reference in New Issue