5
--__ = require 'underscore'
12
signOf = function(value)
21
GameView = View:extend {
22
onNew = function (self)
25
self:add(Fill:new{x=x*400, y=y*400,
26
width = 32, height = 32,
32
--the.player = CrystalPlayer:new{x=400,y=300}
33
the.player = SpacePlayer:new{x=400,y=300}
36
self:add(Enemy:new{x=400, y=300})
38
love.mouse.setGrab(true)
39
--love.mouse.setVisible(false)
41
--self:loadLayers('data/map.lua')
42
self.focus = the.player
43
--self:clampTo(self.map)
45
draw = function (self, x, y)
47
love.graphics.print('FPS:' .. love.timer.getFPS(), 20, 20)
51
MenuScreen = View:extend {
52
title = Text:new{text = "Press a key to start", font = 48, wordWrap = false},
53
--title = Tile:new{image = 'data/title.png', x = 0, y = 0},
54
onNew = function(self)
56
self.title:centerAround(400, 200)
58
onUpdate = function(self, elapsed)
59
if the.keys:allJustPressed() then
60
the.app.view = GameView:new()
66
onRun = function (self)
67
print('Version: ' .. VERSION)
68
self.view = GameView:new()
70
self.console:watch('VERSION', 'VERSION')
71
self.console:watch('updateTook', 'the.updateTook')
72
--self.console:watch('drawTook', 'the.drawTook')
75
onUpdate = function (self, dt)
76
if the.keys:justPressed('escape') then
80
update = function (self, dt)
81
the.updateStart = love.timer.getMicroTime()
83
if the.updateStart then
84
the.updateTook = love.timer.getMicroTime() - the.updateStart