-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.lua
94 lines (61 loc) · 2 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
io.stdout:setvbuf('no') --fixes print issues
--//////////////////////////////////--
--//-\\-//-[[- SETTINGS -]]-\\-//-\\--
--\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\--
WWIDTH, WHEIGHT = 1920, 1080 --16/9 aspect ratio
--//////////////////////////////////--
--//-\\-//-[[- INCLUDES -]]-\\-//-\\--
--\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\--
--Libraries
push = require "lib.push"
screen = require "lib.shack" --Screen effects (shake, rotate, shear, scale)
lem = require "lib.lem" --Events
lue = require "lib.lue" --Hue
state = require "lib.stager" --Scenes and transitions
audio = require "lib.wave" --Audio
trail = require "lib.trail" --Trails
soft = require "lib.soft" --Lerp
ease = require "lib.easy" --Easing
--Includes - Custom libraries
--Classes
--///////////////////////////////--
--//-\\-//-[[- SETUP -]]-\\-//-\\--
--\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\--
local os = love.system.getOS()
phoneMode = (os == "iOS" or os == "Android") and true or false --handles mobile platforms
fullscreenMode = phoneMode and true or false --enables fullscreen if on mobile
local windowWidth, windowHeight = love.window.getDesktopDimensions()
if fullscreenMode then
RWIDTH, RHEIGHT = windowWidth, windowHeight
else
RWIDTH = windowWidth*.7 RHEIGHT = windowHeight*.7
end
push:setupScreen(WWIDTH, WHEIGHT, RWIDTH, RHEIGHT, {
fullscreen = fullscreenMode,
resizable = not phoneMode
})
--///////////////////////////////////--
--//-\\-//-[[- FUNCTIONS -]]-\\-//-\\--
--\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\--
function love.load()
screen:setDimensions(push:getDimensions())
state:switch("scenes/game", {})
end
function love.update(dt)
screen:update(dt)
lue:update(dt)
soft:update(dt)
trail:update(dt)
state:update(dt)
end
function love.draw()
push:apply("start")
screen:apply()
state:draw()
push:apply("end")
end
if not phoneMode then
function love.resize(w, h)
return push:resize(w, h)
end
end