Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.lua
More file actions
Latest commit
95 lines (77 loc) · 2.41 KB
/
Copy pathmain.lua
File metadata and controls
95 lines (77 loc) · 2.41 KB
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
95
localFont=require("include/font")
Global=require("global")
localWorld=require("world")
Resources=require("resourceHandler")
util=require("include/util")
localapi= {}
--------------------------------------------------
-- Draw
--------------------------------------------------
functionlove.draw()
World.Draw()
end
functionlove.resize(width, height)
World.ViewResize(width, height)
end
--------------------------------------------------
-- Input
--------------------------------------------------
functionlove.mousemoved(x, y, dx, dy, istouch)
World.MouseMoved(x, y, dx, dy)
end
functionlove.mousereleased(x, y, button, istouch, presses)
World.MouseReleased(x, y, button, istouch, presses)
end
functionlove.keypressed(key, scancode, isRepeat)
World.KeyPressed(key, scancode, isRepeat)
end
functionlove.mousepressed(x, y, button, istouch, presses)
World.MousePressed(x, y, button, istouch, presses)
end
--------------------------------------------------
-- Update
--------------------------------------------------
locallongFrames=0
localframes=0
localmissingDt=0
localMAX_DT=0.1
functionlove.update(dt)
localrealDt=dt
frames=frames+1
ifdt>0.05then
longFrames=longFrames+1
end
ifdt>MAX_DTthen
missingDt= (dt-MAX_DT)
dt=MAX_DT
elseifmissingDt>0then
localreturnProp=0.02+0.06*missingDt/ (missingDt+2)
localtoReturn=returnProp*dt
iftoReturn>missingDtthen
toReturn=missingDt
end
dt=dt+toReturn
missingDt=missingDt-toReturn
end
World.Update(dt, realDt)
end
functionGlobal.ResetMissingDt()
missingDt=0
end
localutil=require("include/util")
--------------------------------------------------
-- Loading
--------------------------------------------------
functionlove.load(arg)
ifarg[#arg] =="-debug" thenrequire("mobdebug").start() end
localmajor, minor, revision, codename=love.getVersion()
print(string.format("Version %d.%d.%d - %s", major, minor, revision, codename))
love.window.setTitle("Hourglass Editor")
--love.graphics.setDefaultFilter("nearest", "nearest") -- Removing this helps some things and really hurts others
love.graphics.setBackgroundColor(Global.BACK_COL[1], Global.BACK_COL[2], Global.BACK_COL[3], 1)
love.keyboard.setKeyRepeat(true)
math.randomseed(os.clock())
Resources.LoadResources()
World.Initialize()
--love.window.maximize() -- Do not fullscreen since we lack an exit button.
end