CCApplication-tizen.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /****************************************************************************
  2. Copyright (c) 2014-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. #include "platform/CCPlatformConfig.h"
  21. #if CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN
  22. #ifndef CCAPLICATION_TIZEN_H_
  23. #define CCAPLICATION_TIZEN_H_
  24. #include "platform/CCCommon.h"
  25. #include "platform/CCApplicationProtocol.h"
  26. #include <string>
  27. #include <Elementary.h>
  28. NS_CC_BEGIN
  29. class Rect;
  30. class Application : public ApplicationProtocol
  31. {
  32. public:
  33. /**
  34. * @js ctor
  35. */
  36. Application();
  37. /**
  38. * @js NA
  39. * @lua NA
  40. */
  41. virtual ~Application();
  42. /**
  43. @brief Callback by Director for limit FPS.
  44. @param interval The time, which expressed in second in second, between current frame and next.
  45. */
  46. virtual void setAnimationInterval(float interval) override;
  47. virtual void setAnimationInterval(float interval, SetIntervalReason reason) override;
  48. /**
  49. @brief Run the message loop.
  50. */
  51. int run();
  52. /**
  53. @brief Get current application instance.
  54. @return Current application instance pointer.
  55. */
  56. static Application* getInstance();
  57. /** @deprecated Use getInstance() instead */
  58. CC_DEPRECATED_ATTRIBUTE static Application* sharedApplication();
  59. /* override functions */
  60. virtual LanguageType getCurrentLanguage() override;
  61. std::string getVersion() override;
  62. /**
  63. @brief Get current language iso 639-1 code
  64. @return Current language iso 639-1 code
  65. */
  66. virtual const char * getCurrentLanguageCode() override;
  67. /**
  68. @brief Open url in default browser
  69. @param String with url to open.
  70. @return true if the resource located by the URL was successfully opened; otherwise false.
  71. */
  72. virtual bool openURL(const std::string &url) override;
  73. /**
  74. * Sets the Resource root path.
  75. * @deprecated Please use FileUtils::getInstance()->setSearchPaths() instead.
  76. */
  77. CC_DEPRECATED_ATTRIBUTE void setResourceRootPath(const std::string& rootResDir);
  78. /**
  79. * Gets the Resource root path.
  80. * @deprecated Please use FileUtils::getInstance()->getSearchPaths() instead.
  81. */
  82. CC_DEPRECATED_ATTRIBUTE const std::string& getResourceRootPath(void);
  83. /**
  84. @brief Get target platform
  85. */
  86. virtual Platform getTargetPlatform() override;
  87. void setDeviceOrientation(int orientation);
  88. void setMainArgs(int argc, char **argv);
  89. void setPauseFlag(bool pause){_paused = pause;}
  90. bool isPaused(){return _paused;}
  91. public:
  92. Evas_Object * _win;
  93. Evas_Object * _conform;
  94. Evas_GL * _evasGL;
  95. Evas_GL_Context * _ctx;
  96. Evas_GL_Surface * _sfc;
  97. Ecore_Animator * _ani;
  98. int _orientation;
  99. int _argc;
  100. char **_argv;
  101. protected:
  102. long _animationInterval; //micro second
  103. std::string _resourceRootPath;
  104. bool _paused;
  105. static Application * __instance;
  106. };
  107. NS_CC_END
  108. #endif // CCAPLICATION_TIZEN_H_
  109. #endif /* CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN */