CCPhysicsDebugNode.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /* Copyright (c) 2012 Scott Lembcke and Howling Moon Software
  2. * Copyright (c) 2012 cocos2d-x.org
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5. * of this software and associated documentation files (the "Software"), to deal
  6. * in the Software without restriction, including without limitation the rights
  7. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. * copies of the Software, and to permit persons to whom the Software is
  9. * furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  20. * SOFTWARE.
  21. */
  22. #ifndef __PHYSICSNODES_DEBUGNODE_H__
  23. #define __PHYSICSNODES_DEBUGNODE_H__
  24. #include "extensions/ExtensionMacros.h"
  25. #include "2d/CCDrawNode.h"
  26. #include "extensions/ExtensionExport.h"
  27. struct cpSpace;
  28. NS_CC_EXT_BEGIN
  29. /**
  30. * A BaseData that draws the components of a physics engine.
  31. * Supported physics engines:
  32. * - Chipmunk
  33. * - Objective-Chipmunk
  34. * @since v2.1
  35. * @lua NA
  36. */
  37. class CC_EX_DLL PhysicsDebugNode : public DrawNode
  38. {
  39. public:
  40. /** Create a debug node for a regular Chipmunk space. */
  41. static PhysicsDebugNode* create(cpSpace *space);
  42. /**
  43. * @js ctor
  44. */
  45. PhysicsDebugNode();
  46. /**
  47. * @js NA
  48. */
  49. virtual ~PhysicsDebugNode();
  50. cpSpace* getSpace() const;
  51. void setSpace(cpSpace *space);
  52. // Overrides
  53. virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
  54. protected:
  55. cpSpace *_spacePtr;
  56. };
  57. NS_CC_EXT_END
  58. #endif // __PHYSICSNODES_DEBUGNODE_H__