CCPhysicsDebugNode.h 2.1 KB

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