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
|
STRICT = true
DEBUG = true
require 'zoetrope'
--require 'sprite'
require 'version'
require 'player'
GameView = View:extend {
onNew = function (self)
bg = Tile:new{image = 'data/forest1-bg.png'}
fg = Tile:new{image = 'data/forest1-fg.png'}
the.player = Player:new{x = 196, y = 350}
self:add(bg)
self:add(the.player)
self:add(fg)
--self:loadLayers('data/map.lua')
--self.focus = the.player
--self:clampTo(self.map)
end,
draw = function (self, x, y)
View.draw(self, x, y)
love.graphics.print('FPS:' .. love.timer.getFPS(), 20, 20)
end
}
the.app = App:new {
onRun = function (self)
self.view = GameView:new()
if DEBUG then
self.console:watch('VERSION', 'VERSION')
self.console:watch('updateTook', 'the.updateTook')
--self.console:watch('drawTook', 'the.drawTook')
end
end,
onUpdate = function (self, dt)
if the.keys:justPressed('escape') then
self.quit()
end
end,
update = function (self, dt)
the.updateStart = love.timer.getMicroTime()
App.update(self, dt)
if the.updateStart then
the.updateTook = love.timer.getMicroTime() - the.updateStart
end
end
}
|