-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.lua
64 lines (53 loc) · 1.55 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
math.random = love.math.random
class = require 'middleclass/middleclass'
Scene = require 'Scene'
Entity = require 'Entity'
local TestScene = require "TestScene"
local time = {}
time.fdt = 1/60 --fixed delta time
time.accum = 0
local self = {}
function love.load()
--love.mouse.setVisible(false)
local w,h = love.graphics.getDimensions()
love.graphics.setScissor( 0, 0, w, h)
self.scene = TestScene:new()
end
function love.update(dt)
time.accum = time.accum + dt
while time.accum >= time.fdt do
self.scene:update(time.fdt)
if love.keyboard.isDown('escape') then
love.event.quit()
end
time.accum = time.accum - time.fdt
end
end
function love.draw()
self.scene:draw()
love.graphics.print("Current FPS: "..tostring(love.timer.getFPS( )), 10, 10)
end
function love.keypressed( key, isrepeat )
self.scene:keypressed(key,isrepeat)
end
function love.keyreleased( key, isrepeat )
self.scene:keyreleased(key,isrepeat)
end
function love.mousepressed(x,y,button)
self.scene:mousepressed(x,y,button)
end
function love.mousereleased(x,y,button)
self.scene:mousereleased(x,y,button)
end
function beginContact(a,b,coll)
self.scene:beginContact(a,b,coll)
end
function endContact(a,b,coll)
self.scene:endContact(a,b,coll)
end
function preSolve(a,b,coll)
self.scene:preSolve(a,b,coll)
end
function postSolve(a, b, coll, normalimpulse1, tangentimpulse1, normalimpulse2, tangentimpulse2)
self.scene:postSolve(a, b, coll, normalimpulse1, tangentimpulse1, normalimpulse2, tangentimpulse2)
end