responsively increase/decrease font height
Dependencies
- [2]
VEAVIL4Xresize handler - [3]
ZM7NOBRMnew fork: carousel shell - [4]
5RUFNRJOstart of the visual skeleton - [*]
R5QXEHUIsomebody stop me
Change contents
- file addition: 0032-update_font_settings[6.2]
update_font_settings = function(font_height)love.graphics.setFont(love.graphics.newFont(font_height))Line_height = math.floor(love.graphics.getFont():getHeight()*1.3)Line_number_padding = Line_number_width*App.width('m')Menu_height = 5 + Line_height + 5Menu_bottom = Menu_top + Menu_heightEditor_state.top = Menu_bottom + 20Editor_state.left = Menu_left + 50 + Line_number_paddingEditor_state.right = math.min(100+30*App.width('m'), Safe_width*2/3)Editor_state.width = Editor_state.right - Editor_state.leftedit.update_font_settings(Editor_state, font_height)Text.redraw_all(Editor_state)end - edit in 0031-on.resize at line 5
Editor_state.bottom = Safe_height/2-5 - replacement in 0027-Menu_background at line 1
Menu_background = {r=0.2, g=0.2, b=0.2}[3.391]Menu_background = {r=0.6, g=0.8, b=0.6} - replacement in 0021-draw_menu at line 4
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},-- main buttonsbutton(Editor_state, 'run', {x=Menu_left+5, y=Menu_top+5, w=App.width('Run')+10, h=Line_height, bg={r=0.6, g=0.8, b=0.6}, - edit in 0021-draw_menu at line 8
love.graphics.rectangle('line', p.x,p.y, p.w,p.h, 2,2) - edit in 0021-draw_menu at line 13
end,})-- settings button on rightlocal w = App.width('settings')button(Editor_state, 'settings', {x=Safe_width-w-10-5, y=Menu_top+5, w=w+10, h=Line_height, bg={r=0.6, g=0.8, b=0.6},icon = function(p)App.color{r=0,g=0,b=0}love.graphics.rectangle('line', p.x,p.y, p.w,p.h, 2,2)love.graphics.print('settings', p.x+5,p.y+2)end,onpress1 = function()print('settings') - edit in 0021-draw_menu at line 27
-- nav buttons along sidesbutton(Editor_state, 'left', {x=0, y=Menu_bottom, w=Menu_left+30, h=App.screen.height, bg={r=0.5, g=0.5, b=0.5, a=0.2},icon = function(p)App.color{r=0.4,g=0.4,b=0.4}love.graphics.polygon('fill', Menu_left+5, App.screen.height/2, Menu_left+25, App.screen.height/2-10, Menu_left+25, App.screen.height/2+10)end,})local r = Menu_left + Safe_widthbutton(Editor_state, 'left', {x=r-30, y=Menu_bottom, w=100, h=App.screen.height, bg={r=0.5, g=0.5, b=0.5, a=0.2},icon = function(p)App.color{r=0.4,g=0.4,b=0.4}love.graphics.polygon('fill', r-25, App.screen.height/2-10, r-25, App.screen.height/2+10, r-5, App.screen.height/2)end,}) - replacement in 0013-on.keychord_press at line 2
edit.keychord_press(Editor_state, chord, key)if chord == 'C-=' thenupdate_font_settings(Editor_state.font_height+2)elseif chord == 'C--' thenupdate_font_settings(Editor_state.font_height-2)elseif chord == 'C-0' thenupdate_font_settings(20)elseedit.keychord_press(Editor_state, chord, key)end - replacement in 0011-on.initialize at line 11
100, -- leftMenu_left + 50 + Line_number_padding, -- left