CCComRender.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /****************************************************************************
  2. Copyright (c) 2013-2017 Chukong Technologies Inc.
  3. http://www.cocos2d-x.org
  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. The above copyright notice and this permission notice shall be included in
  11. all copies or substantial portions of the Software.
  12. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18. THE SOFTWARE.
  19. ****************************************************************************/
  20. #ifndef __CC_EXTENTIONS_CCCOMRENDER_H__
  21. #define __CC_EXTENTIONS_CCCOMRENDER_H__
  22. #include "editor-support/cocostudio/CCComBase.h"
  23. #include "2d/CCComponent.h"
  24. #include "editor-support/cocostudio/CocosStudioExport.h"
  25. namespace cocostudio {
  26. class CC_STUDIO_DLL ComRender : public cocos2d::Component
  27. {
  28. DECLARE_CLASS_COMPONENT_INFO
  29. public:
  30. const static std::string COMPONENT_NAME;
  31. static ComRender* create();
  32. static ComRender* create(cocos2d::Node *node, const char *comName);
  33. /**
  34. * @js NA
  35. * @lua NA
  36. */
  37. virtual void onEnter() override;
  38. /**
  39. * @js NA
  40. * @lua NA
  41. */
  42. virtual void onExit() override;
  43. /**
  44. * @js NA
  45. * @lua NA
  46. */
  47. virtual void onAdd() override;
  48. /**
  49. * @js NA
  50. * @lua NA
  51. */
  52. virtual void onRemove() override;
  53. virtual bool serialize(void* r) override;
  54. virtual cocos2d::Node* getNode();
  55. virtual void setNode(cocos2d::Node *node);
  56. CC_CONSTRUCTOR_ACCESS:
  57. /**
  58. * @js ctor
  59. */
  60. ComRender();
  61. ComRender(cocos2d::Node *node, const char *comName);
  62. /**
  63. * @js NA
  64. * @lua NA
  65. */
  66. virtual ~ComRender();
  67. private:
  68. bool readJson(const std::string &fileName, rapidjson::Document &doc);
  69. cocos2d::Node *_render;
  70. };
  71. }
  72. #endif // __CC_EXTENTIONS_CCCOMRENDER_H__