Template repo for tiny cross-platform apps that can be modified on phone, tablet or computer.
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge text2.love

+8 -12
+8 -8
edit.lua
··· 14 14 local _ -- idiom for unused variables 15 15 16 16 -- some constants people might like to tweak 17 - local Text_color = {r=0, g=0, b=0} 18 - local Cursor_color = {r=1, g=0, b=0} 19 - local Highlight_color = {r=0.7, g=0.7, b=0.9, a=0.4} -- selected text 17 + local Text_color = {0, 0, 0} 18 + local Cursor_color = {1, 0, 0} 19 + local Highlight_color = {0.7, 0.7, 0.9, 0.4} -- selected text 20 20 21 21 local Font_height = require 'font_height' 22 22 ··· 181 181 if I.in_selection(editor, line_index, c.pos, editor.cursor) 182 182 or I.in_search(editor, line_index, c.pos) 183 183 then 184 - t.set_color_from_table(Highlight_color) 184 + love.graphics.setColor(Highlight_color) 185 185 love.graphics.rectangle('fill', editor.left+c.x, y+c.y, c.dx,c.dy) 186 186 end 187 187 end ··· 189 189 for _,s in ipairs(c.draw) do I.draw_shape(s, editor.left, y) end 190 190 end 191 191 if c.data and not c.conceal then 192 - t.set_color_from_table(c.fg or Text_color) 192 + love.graphics.setColor(c.fg or Text_color) 193 193 love.graphics.print(c.data, editor.left+c.x, y+c.y) 194 194 end 195 195 if line_index == editor.cursor.line then ··· 620 620 function I.draw_text_cursor(editor, x, y, dy) 621 621 -- blink every 0.5s 622 622 if math.floor(Cursor_time*2)%2 == 0 then 623 - t.set_color_from_table(Cursor_color) 623 + love.graphics.setColor(Cursor_color) 624 624 love.graphics.rectangle('fill', x,y, 3,dy) 625 625 end 626 626 end ··· 738 738 end 739 739 740 740 function I.draw_shape(shape, left, top) 741 - t.set_color_from_table(shape.fg or Text_color) 741 + love.graphics.setColor(shape.fg or Text_color) 742 742 if shape.type == 'rect' then 743 743 love.graphics.rectangle(shape.mode, left+shape.x, top+shape.y, shape.dx, shape.dy) 744 744 elseif shape.type == 'line' then ··· 801 801 love.graphics.rectangle('fill', 20, y-6, screen_width-40, h+2, 2,2) 802 802 love.graphics.setColor(0.6,0.6,0.6) 803 803 love.graphics.rectangle('line', 20, y-6, screen_width-40, h+2, 2,2) 804 - t.set_color_from_table(Text_color) 804 + love.graphics.setColor(Text_color) 805 805 love.graphics.print(editor.search_term, 25,y-5) 806 806 I.draw_text_cursor(editor, 25+editor.font:getWidth(editor.search_term),y-5, editor.line_height) 807 807 end
-4
utils.lua
··· 17 17 return math.min(a,b), math.max(a,b) 18 18 end 19 19 20 - function utils.set_color_from_table(color) 21 - love.graphics.setColor(color.r, color.g, color.b, color.a) 22 - end 23 - 24 20 function utils.width(s) 25 21 return love.graphics.getFont():getWidth(s) 26 22 end