The path to the interpreter for the bang line is not hardcoded anymore.
[urggr.git] / src / urggr_package / level.lua
blobd806dd57890662d9f8347d11f8d63bee7eb4d15e
1 --[[
2 Urggr - An horizontal scrolling shoot'em up.
3 Copyright 2008 Antoine Chavasse <a.chavasse@gmail.com>
5 This file is part of Urggr.
7 Urggr is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License version 3
9 as published by the Free Software Foundation.
11 Urggr is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18 --]]
20 require 'fail.utils'
21 require 'fail.math'
22 sg = require 'fail.scenegraph'
24 Level = fail.utils.class
26 function( self )
27 self.gameobjects = {}
29 -- The top level container of the rendering scene graph.
30 -- Just a group because there's nothing else currently,
31 -- and this project won't be needing anything more sophisticated
32 -- for a while.
33 self.renderablegroup = sg.Group()
35 self:addGameObject( urggr.Camera() )
36 self:addGameObject( urggr.PlayerShip( self ) )
37 end
40 function Level:addGameObject( gobj )
41 table.insert( self.gameobjects, gobj )
42 end
44 function Level:addRenderable( renderable )
45 self.renderablegroup:add( renderable )
46 end
48 function Level:update( deltatime )
49 for i,v in ipairs( self.gameobjects ) do
50 v:update( deltatime )
51 end
52 end
54 function Level:evaluateRender( renderpass )
55 self.renderablegroup:evaluate( renderpass )
56 end