Made start-of-line spacing all hard tabs

pull/17/head
nightmareci 2021-05-23 11:57:04 -07:00
parent 6b2252e6d9
commit 7f550b629f
1 changed files with 36 additions and 36 deletions

View File

@ -19,8 +19,8 @@ function love.load()
love.window.setMode(love.graphics.getWidth(), love.graphics.getHeight(), {resizable = true}); love.window.setMode(love.graphics.getWidth(), love.graphics.getHeight(), {resizable = true});
-- used for screenshots -- used for screenshots
GLOBAL_CANVAS = love.graphics.newCanvas() GLOBAL_CANVAS = love.graphics.newCanvas()
-- init config -- init config
initConfig() initConfig()
@ -56,10 +56,10 @@ function initModules()
end end
function love.draw() function love.draw()
love.graphics.setCanvas(GLOBAL_CANVAS) love.graphics.setCanvas(GLOBAL_CANVAS)
love.graphics.clear() love.graphics.clear()
love.graphics.push() love.graphics.push()
-- get offset matrix -- get offset matrix
love.graphics.setDefaultFilter("linear", "nearest") love.graphics.setDefaultFilter("linear", "nearest")
@ -75,9 +75,9 @@ function love.draw()
scene:render() scene:render()
love.graphics.pop() love.graphics.pop()
love.graphics.setCanvas() love.graphics.setCanvas()
love.graphics.setColor(1,1,1,1) love.graphics.setColor(1,1,1,1)
love.graphics.draw(GLOBAL_CANVAS) love.graphics.draw(GLOBAL_CANVAS)
end end
function love.keypressed(key, scancode) function love.keypressed(key, scancode)
@ -104,8 +104,8 @@ function love.keypressed(key, scancode)
love.filesystem.remove("ss") love.filesystem.remove("ss")
love.filesystem.createDirectory("ss") love.filesystem.createDirectory("ss")
end end
print("Saving screenshot as "..ss_name) print("Saving screenshot as "..ss_name)
GLOBAL_CANVAS:newImageData():encode("png", ss_name) GLOBAL_CANVAS:newImageData():encode("png", ss_name)
-- function keys are reserved -- function keys are reserved
elseif string.match(scancode, "^f[1-9]$") or string.match(scancode, "^f[1-9][0-9]+$") then elseif string.match(scancode, "^f[1-9]$") or string.match(scancode, "^f[1-9][0-9]+$") then
return return
@ -296,30 +296,30 @@ function love.run()
end end
if love.timer then if love.timer then
processBGMFadeout(love.timer.step()) processBGMFadeout(love.timer.step())
end end
if scene and scene.update and love.timer then if scene and scene.update and love.timer then
scene:update() scene:update()
local frame_duration = 1.0 / TARGET_FPS local frame_duration = 1.0 / TARGET_FPS
if time_accumulator < frame_duration then if time_accumulator < frame_duration then
if love.graphics and love.graphics.isActive() and love.draw then if love.graphics and love.graphics.isActive() and love.draw then
love.graphics.origin() love.graphics.origin()
love.graphics.clear(love.graphics.getBackgroundColor()) love.graphics.clear(love.graphics.getBackgroundColor())
love.draw() love.draw()
love.graphics.present() love.graphics.present()
end end
local end_time = last_time + frame_duration local end_time = last_time + frame_duration
local time = love.timer.getTime() local time = love.timer.getTime()
while time < end_time do while time < end_time do
love.timer.sleep(0.001) love.timer.sleep(0.001)
time = love.timer.getTime() time = love.timer.getTime()
end end
time_accumulator = time_accumulator + time - last_time time_accumulator = time_accumulator + time - last_time
end end
time_accumulator = time_accumulator - frame_duration time_accumulator = time_accumulator - frame_duration
end end
last_time = love.timer.getTime() last_time = love.timer.getTime()
end end
end end