SudokuLua/ui/draw.lua

52 lines
1.6 KiB
Lua

require "ui.globals"
require "ui.colors"
function drawGrid()
love.graphics.setLineWidth(1)
setColor(colors.boardThinLines)
for i = 1, 6 do
love.graphics.line(grid.vline[i].x1, grid.vline[i].y1, grid.vline[i].x2, grid.vline[i].y2)
love.graphics.line(grid.hline[i].x1, grid.hline[i].y1, grid.hline[i].x2, grid.hline[i].y2)
end
love.graphics.setLineWidth(2)
setColor(colors.boardThikLines)
for i = 1, 4 do
love.graphics.line(grid.vbline[i].x1, grid.vbline[i].y1, grid.vbline[i].x2, grid.vbline[i].y2)
love.graphics.line(grid.hbline[i].x1, grid.hbline[i].y1, grid.hbline[i].x2, grid.hbline[i].y2)
end
end
function drawSmallNumbers()
love.graphics.setFont(fonts.smallNum)
for x = 1, 9 do
for y = 1, 9 do
for i = 1, 9 do
local x1 = smallNumbers[x][y][i].x
local y1 = smallNumbers[x][y][i].y
if smallNumbersVal[x][y][i] then
setColor(colors.smallNumbersEnabled)
else
setColor(colors.smallNumbersDisabled)
end
love.graphics.print(tostring(i), x1, y1)
end
end
end
end
function drawCursor()
setColor(colors.boardCursor)
local x = grid[cursor.x][cursor.y].x1
local y = grid[cursor.x][cursor.y].y1
love.graphics.setLineWidth(3)
love.graphics.rectangle("line", x+3, y+3, cell.width-6, cell.height-6, 10, 10)
end
function drawMessages()
setColor(colors.messagesText)
love.graphics.setFont(fonts.info)
for i, msg in ipairs(messages) do
love.graphics.print(msg, 25, 150 + 24 * (i-1))
end
end