diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2022-05-17 12:58:12 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2022-05-17 18:57:47 -0700 |
commit | 12681b63075cfa0b909e5f815a63c5c7383b48a6 (patch) | |
tree | abf6f804d14d22a0040135c5328d17e627a9730a | |
parent | 76efb6367145635adfbc531f03eb7f909b0fbc2b (diff) | |
download | text.love-12681b63075cfa0b909e5f815a63c5c7383b48a6.tar.gz |
start imposing some organization
-rw-r--r-- | main.lua | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/main.lua b/main.lua index f3618cf..b04e539 100644 --- a/main.lua +++ b/main.lua @@ -94,13 +94,7 @@ function love.draw() line.y = y if line.mode == 'text' and line.data == '' then button('draw', {x=4,y=y+4, w=12,h=12, color={1,1,0}, - icon = function(x,y) - love.graphics.setColor(0.7,0.7,0.7) - love.graphics.rectangle('line', x,y, 12,12) - love.graphics.line(4,y+6, 16,y+6) - love.graphics.line(10,y, 10,y+12) - love.graphics.setColor(0, 0, 0) - end, + icon = icon.insert_drawing, onpress1 = function() table.insert(lines, i, {mode='drawing', y=y, h=256/2, points={}, shapes={}, pending={}}) end}) @@ -1033,6 +1027,14 @@ end icon = {} +function icon.insert_drawing(x, y) + love.graphics.setColor(0.7,0.7,0.7) + love.graphics.rectangle('line', x,y, 12,12) + love.graphics.line(4,y+6, 16,y+6) + love.graphics.line(10,y, 10,y+12) + love.graphics.setColor(0, 0, 0) +end + function icon.freehand(x, y) love.graphics.line(x+4,y+7,x+5,y+5) love.graphics.line(x+5,y+5,x+7,y+4) |