SudokuLua/main.lua
Reza Behzadan 9e7481f75b Did some changes:
1. Moved sudoku.lua to the root
2. Create Makefule
3. Add love binaries in `static-binaries` (they are not static yet)
4. Worked on fullscreen mode. (WIP)
2024-01-29 02:50:42 +03:30

41 lines
1.1 KiB
Lua

sudoku = require "sudoku"
uiUtils = require "ui.utils"
config = require "config"
SudokuCanvas = require "ui.sudokucanvas"
board = {}
function love.load()
love.window.setTitle("Sudoku!")
love.window.fullscreen = true
love.window.setMode(0, 0)
love.mouse.setGrabbed(false)
love.keyboard.setKeyRepeat(true)
math.randomseed(os.time())
board = sudoku.loadBoard(config.board.filePath)
-- local width, height = love.graphics.getDimensions()
local width, height = love.window.getDesktopDimensions()
love.window.setMode(width, height, {fullscreen = true})
sudokuCanvas = SudokuCanvas:new(500, 50, height/1.1, config.SudokuCanvas)
sudokuCanvas:setBoard(board[1])
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