local Game = require "game" require "util" BASE_RES_W = 248 BASE_RES_H = 257 FONT_CHARACTERS = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" FONT_STANDARD = love.graphics.newImageFont("res/font/VictoriaBold.png", FONT_CHARACTERS, -1) DIGITFONT_CHARACTERS = "0123456789x[].kMG" FONT_DIGITS = love.graphics.newImageFont("res/font/digits.png", DIGITFONT_CHARACTERS, 1) love.keyboard.setKeyRepeat(true) love.graphics.setDefaultFilter("nearest","nearest",0) main_canvas = love.graphics.newCanvas() local game = Game.new() function love.keypressed(key,scancode,isrepeat) game:keypressed(key,scancode,isrepeat) end function love.update(dt) game:update(dt) end function love.draw() love.graphics.setCanvas(main_canvas) love.graphics.clear() love.graphics.setLineWidth(2) game:draw() --draw canvas on the main window love.graphics.setScissor() love.graphics.setCanvas() local w, h = love.graphics.getWidth(), love.graphics.getHeight() local s = math.min(w/BASE_RES_W,h/BASE_RES_H) local s = math.floor(s) love.graphics.translate(math.floor((w-BASE_RES_W*s)/2),math.floor((h-BASE_RES_H*s)/2)) love.graphics.scale(s, s) love.graphics.clear() love.graphics.draw(main_canvas) end