-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.lua
58 lines (44 loc) · 1.56 KB
/
main.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
-- Main entry of the game (LÖVE default)
local utils = require("src/utils")
local const = require("src/const")
local shaders = require("src/shaders/shaders")
local canvas = love.graphics.newCanvas(const.game.screen.WIDTH, const.game.screen.HEIGHT)
-- Load the game. Called once at the beginning of the game
function love.load()
love.window.setFullscreen(true)
Game = {utils.core.setGameScreen(const.game.screen.WIDTH, const.game.screen.HEIGHT)}
shaders.barrelDistortion:send("strength", 0.05)
end
-- Update the game. Called every frame
function love.update(dt)
end
-- Draw the game. Called every frame
function love.draw()
love.graphics.setCanvas(canvas)
love.graphics.clear()
utils.core.setBaseBgColor(const.color.DEEP_TEAL)
love.graphics.setColor(const.color.SILVER_TASKBAR)
love.graphics.rectangle("fill", 0,const.game.screen.HEIGHT-60, const.game.screen.WIDTH,60)
love.graphics.rectangle("fill", 0,0, 100,100)
love.graphics.setCanvas()
love.graphics.push()
love.graphics.translate(Game[1], Game[2])
love.graphics.scale(Game[3], Game[4])
love.graphics.setShader(shaders.barrelDistortion)
love.graphics.draw(canvas, 0, 0)
love.graphics.setShader()
love.graphics.pop()
end
function love.keyreleased(key, scancode, isrepeat)
if key == "escape" then
love.event.quit()
elseif key == "f11" then
utils.core.toggleFullscreen()
end
end
function love.resize()
Game = {utils.core.setGameScreen(const.game.screen.WIDTH, const.game.screen.HEIGHT)}
end
function love.quit()
return false
end