| 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 PHYSICS_LAYER_H_ |
| 5 #define PHYSICS_LAYER_H_ | 5 #define PHYSICS_LAYER_H_ |
| 6 | 6 |
| 7 #include "cocos2d.h" | 7 #include "cocos2d.h" |
| 8 #include "Box2D/Box2D.h" | 8 #include "Box2D/Box2D.h" |
| 9 | 9 |
| 10 #ifdef COCOS2D_DEBUG | 10 #ifdef COCOS2D_DEBUG |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 #ifdef COCOS2D_DEBUG | 44 #ifdef COCOS2D_DEBUG |
| 45 void ToggleDebug(); | 45 void ToggleDebug(); |
| 46 #endif | 46 #endif |
| 47 | 47 |
| 48 private: | 48 private: |
| 49 // Called by ccTouchesMoved to draw between two points | 49 // Called by ccTouchesMoved to draw between two points |
| 50 void DrawLine(CCPoint& start, CCPoint& end); | 50 void DrawLine(CCPoint& start, CCPoint& end); |
| 51 // Called by ccTouchesBegan to draw a single point. | 51 // Called by ccTouchesBegan to draw a single point. |
| 52 void DrawPoint(CCPoint& location); | 52 void DrawPoint(CCPoint& location); |
| 53 // Clamp brush location to within the visible area |
| 54 void ClampBrushLocation(CCPoint& point); |
| 53 | 55 |
| 54 void AddLineToBody(b2Body *body, CCPoint start, CCPoint end); | 56 void AddLineToBody(b2Body *body, CCPoint start, CCPoint end); |
| 55 void AddSphereToBody(b2Body *body, CCPoint* location); | 57 void AddSphereToBody(b2Body *body, CCPoint* location); |
| 56 void AddShapeToBody(b2Body *body, b2Shape* shape); | 58 void AddShapeToBody(b2Body *body, b2Shape* shape); |
| 57 | 59 |
| 58 // Create a new render target for drawing into | 60 // Create a new render target for drawing into |
| 59 void CreateRenderTarget(); | 61 void CreateRenderTarget(); |
| 60 | 62 |
| 61 // Create a physics object based on the points that were drawn. | 63 // Create a physics object based on the points that were drawn. |
| 62 b2Body* CreatePhysicsBody(); | 64 b2Body* CreatePhysicsBody(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 99 |
| 98 #ifdef COCOS2D_DEBUG | 100 #ifdef COCOS2D_DEBUG |
| 99 // Debug drawing support for Box2D. | 101 // Debug drawing support for Box2D. |
| 100 GLESDebugDraw* box2d_debug_draw_; | 102 GLESDebugDraw* box2d_debug_draw_; |
| 101 // Flag to enable drawing of Box2D debug data. | 103 // Flag to enable drawing of Box2D debug data. |
| 102 bool debug_enabled_; | 104 bool debug_enabled_; |
| 103 #endif | 105 #endif |
| 104 }; | 106 }; |
| 105 | 107 |
| 106 #endif // PHYSICS_LAYER_H_ | 108 #endif // PHYSICS_LAYER_H_ |
| OLD | NEW |