Merge lines-mobile.love

This commit is contained in:
Kartik K. Agaram 2023-11-14 00:06:44 -08:00
commit 159aeabe61
2 changed files with 11 additions and 10 deletions

View File

@ -90,6 +90,8 @@ function App.version_check()
end
function App.initialize_globals()
Menu_left, Menu_top = love.window.getSafeArea()
if Current_app == 'run' then
run.initialize_globals()
elseif Current_app == 'source' then

19
run.lua
View File

@ -8,8 +8,7 @@ function run.initialize_globals()
Font_height = 20
Line_height = math.floor(Font_height*1.3)
Ipad_menu_height = 25
Menu_bar_height = Ipad_menu_height + 5 + Line_height + 5
Menu_bar_height = Menu_top + 5 + Line_height + 5
-- state machine:
-- states:
@ -124,8 +123,8 @@ end
function run.draw_buttons()
local button_text = 'clear'
local width = App.width(button_text)
local x=5
button(Editor_state, button_text, {x=x, y=Ipad_menu_height, w=width+10,h=Line_height, bg={r=1,g=0.7,b=1},
local x=Menu_left+5
button(Editor_state, button_text, {x=x, y=Menu_top, w=width+10,h=Line_height, bg={r=1,g=0.7,b=1},
icon = function(button_params)
local x,y = button_params.x, button_params.y
local w,h = button_params.w, button_params.h
@ -145,7 +144,7 @@ function run.draw_buttons()
x = x+width+10 + 10
button_text = 'export'
width = App.width(button_text)
button(Editor_state, button_text, {x=x, y=Ipad_menu_height, w=width+10,h=Line_height, bg={r=1,g=0.7,b=1},
button(Editor_state, button_text, {x=x, y=Menu_top, w=width+10,h=Line_height, bg={r=1,g=0.7,b=1},
icon = function(button_params)
local x,y = button_params.x, button_params.y
local w,h = button_params.w, button_params.h
@ -161,22 +160,22 @@ function run.draw_buttons()
x = x+width+10 + 10
if Current_flash then
App.color{r=0,g=0.4,b=0}
love.graphics.print(Current_flash, x, Ipad_menu_height)
love.graphics.print(Current_flash, x, Menu_top)
end
end
function run.draw_export_filename_bar()
local h = Line_height+2
local y = Ipad_menu_height+10
local y = Menu_top+10
love.graphics.setColor(0.9,0.9,0.9)
love.graphics.rectangle('fill', 0, y-10, App.screen.width-1, h+8)
love.graphics.rectangle('fill', Menu_left, y-10, App.screen.width-1, h+8)
love.graphics.setColor(0.6,0.6,0.6)
love.graphics.line(0, y-10, App.screen.width-1, y-10)
love.graphics.line(Menu_left, y-10, App.screen.width-1, y-10)
App.color(Text_color)
local prompt = 'file name to save to: '
love.graphics.print(prompt, 15, y-5)
love.graphics.setColor(1,1,1)
local text_start_x = App.width(prompt)+20
local text_start_x = Menu_left + App.width(prompt)+20
love.graphics.rectangle('fill', text_start_x-5, y-6, App.screen.width-text_start_x-20, h+2, 2,2)
love.graphics.setColor(0.6,0.6,0.6)
love.graphics.rectangle('line', text_start_x-5, y-6, App.screen.width-text_start_x-20, h+2, 2,2)