SudokuLua/main.lua

37 lines
1.0 KiB
Lua

require "sudoku.utils"
uiUtils = require "ui.utils"
config = require "config"
SudokuCanvas = require "ui.sudokucanvas"
board = {}
function love.load()
love.window.setTitle("Sudoku!")
love.window.setMode(0, 0)
love.mouse.setGrabbed(false)
love.keyboard.setKeyRepeat(true)
math.randomseed(os.time())
local board = loadBoard("/home/reza/p/lua/22.sudoku/boards/veryhard/27.txt")
local width, height = love.graphics.getDimensions()
sudokuCanvas = SudokuCanvas:new(200, 100, height/1.5, config.SudokuCanvas)
sudokuCanvas:setBoard(board)
myFont = love.graphics.newFont(24)
end
function love.draw()
uiUtils.setBackgroundColor(config.window.bgColor)
sudokuCanvas:draw()
end
function love.keypressed(key)
sudokuCanvas:keypressed(key)
local shift = love.keyboard.isDown('rshift') or love.keyboard.isDown('lshift')
if key == "escape" or key == "q" then
love.event.quit()
end
end
function love.mousepressed(x, y, button, istouch)
sudokuCanvas:mousepressed(x, y, button)
end