color editable squares differently
This commit is contained in:
parent
fbd2427a19
commit
7860ad4bf8
|
@ -3,6 +3,7 @@ draw_sum_grid = function(g)
|
|||
love.graphics.setLineWidth(3)
|
||||
local x1,y1 = X,Y
|
||||
local x2,y2 = X+Square_side*2, Y+Square_side*2
|
||||
App.color{r=0, g=0, b=0}
|
||||
love.graphics.line(x1,y1, x2,y1)
|
||||
love.graphics.line(x1,y2, x2,y2)
|
||||
love.graphics.line(x1,y1, x1,y2)
|
||||
|
@ -11,14 +12,15 @@ draw_sum_grid = function(g)
|
|||
love.graphics.line(x1,ym, x2,ym)
|
||||
love.graphics.line(xm,y1, xm,y2)
|
||||
-- data
|
||||
draw_cell(g.col_totals[1], x1,y1-Square_side)
|
||||
draw_cell(g.col_totals[2], xm,y1-Square_side)
|
||||
draw_cell(g.row_totals[1], x1-Square_side, y1)
|
||||
draw_cell(g.row_totals[2], x1-Square_side, ym)
|
||||
draw_cell(g.col_totals[1], x1,y1-Square_side, nil, true)
|
||||
draw_cell(g.col_totals[2], xm,y1-Square_side, nil, true)
|
||||
draw_cell(g.row_totals[1], x1-Square_side, y1, nil, true)
|
||||
draw_cell(g.row_totals[2], x1-Square_side, ym, nil, true)
|
||||
for x=1,2 do
|
||||
for y=1,2 do
|
||||
draw_cell(g.data[y][x], x1+(x-1)*Square_side, y1+(y-1)*Square_side,
|
||||
x == Cursor[1] and y == Cursor[2])
|
||||
x == Cursor[1] and y == Cursor[2],
|
||||
x == g.x and y == g.y)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,13 +1,17 @@
|
|||
draw_cell = function(n, x,y, draw_cursor)
|
||||
draw_cell = function(n, x,y, draw_cursor, fixed)
|
||||
local s = tostring(n)
|
||||
local w = App.width(s)
|
||||
local px = (Square_side-w)/2
|
||||
if fixed then
|
||||
App.color{r=0, g=0, b=0}
|
||||
else
|
||||
App.color{r=0.4, g=0.4, b=0.4}
|
||||
end
|
||||
love.graphics.print(s, x+px, y+Padding)
|
||||
if draw_cursor then
|
||||
if math.floor(Cursor_time)%2 == 0 then -- blink
|
||||
App.color(Cursor_color)
|
||||
love.graphics.rectangle('fill', x+px+w, y+15, 3, Square_side-20)
|
||||
App.color{r=0, g=0, b=0}
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue