OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 #ifndef PHYSICS_LAYER_H_ | 4 #ifndef LEVEL_LAYER_H_ |
5 #define PHYSICS_LAYER_H_ | 5 #define LEVEL_LAYER_H_ |
6 | 6 |
7 #include "cocos2d.h" | 7 #include "cocos2d.h" |
8 #include "CCLuaStack.h" | 8 #include "CCLuaStack.h" |
9 #include "Box2D/Box2D.h" | 9 #include "Box2D/Box2D.h" |
10 | 10 |
11 #ifdef COCOS2D_DEBUG | 11 #ifdef COCOS2D_DEBUG |
12 #include "GLES-Render.h" | 12 #include "GLES-Render.h" |
13 #endif | 13 #endif |
14 | 14 |
15 USING_NS_CC; | 15 USING_NS_CC; |
16 | 16 |
17 typedef std::vector<cocos2d::CCPoint> PointList; | 17 typedef std::vector<cocos2d::CCPoint> PointList; |
18 | 18 |
19 /** | 19 /** |
20 * Physics layer that the user interacts with. | 20 * Lavel layer in which gameplay takes place. This layer contains |
| 21 * the box2d world simulation. |
21 */ | 22 */ |
22 class PhysicsLayer : public CCLayerColor, public b2ContactListener { | 23 class LevelLayer : public CCLayerColor, public b2ContactListener { |
23 public: | 24 public: |
24 PhysicsLayer(int level_number); | 25 LevelLayer(int level_number); |
25 ~PhysicsLayer(); | 26 ~LevelLayer(); |
26 | 27 |
27 static PhysicsLayer* create(int level_number); | 28 static LevelLayer* create(int level_number); |
28 | 29 |
29 virtual bool init(); | 30 virtual bool init(); |
30 virtual void draw(); | 31 virtual void draw(); |
31 virtual bool ccTouchBegan(CCTouch* touch, CCEvent* event); | 32 virtual bool ccTouchBegan(CCTouch* touch, CCEvent* event); |
32 virtual void ccTouchMoved(CCTouch* touch, CCEvent* event); | 33 virtual void ccTouchMoved(CCTouch* touch, CCEvent* event); |
33 virtual void ccTouchEnded(CCTouch* touch, CCEvent* event); | 34 virtual void ccTouchEnded(CCTouch* touch, CCEvent* event); |
34 virtual void registerWithTouchDispatcher(); | 35 virtual void registerWithTouchDispatcher(); |
35 | 36 |
36 b2World* GetWorld() { return box2d_world_; } | 37 b2World* GetWorld() { return box2d_world_; } |
37 | 38 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 float box2d_restitution_; | 106 float box2d_restitution_; |
106 // Friction given to new physics objects | 107 // Friction given to new physics objects |
107 float box2d_friction_; | 108 float box2d_friction_; |
108 | 109 |
109 // The list of points currently being drawn by the user | 110 // The list of points currently being drawn by the user |
110 PointList points_being_drawn_; | 111 PointList points_being_drawn_; |
111 | 112 |
112 CCLuaStack* lua_stack_; | 113 CCLuaStack* lua_stack_; |
113 }; | 114 }; |
114 | 115 |
115 #endif // PHYSICS_LAYER_H_ | 116 #endif // LEVEL_LAYER_H_ |
OLD | NEW |