CCApplication-mac.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /****************************************************************************
  2. Copyright (c) 2010-2012 cocos2d-x.org
  3. Copyright (c) 2013-2017 Chukong Technologies Inc.
  4. http://www.cocos2d-x.org
  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. The above copyright notice and this permission notice shall be included in
  12. all copies or substantial portions of the Software.
  13. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19. THE SOFTWARE.
  20. ****************************************************************************/
  21. #ifndef __CC_APPLICATION_MAC_H__
  22. #define __CC_APPLICATION_MAC_H__
  23. #include "platform/CCPlatformConfig.h"
  24. #if CC_TARGET_PLATFORM == CC_PLATFORM_MAC
  25. #include "platform/CCCommon.h"
  26. #include "platform/CCApplicationProtocol.h"
  27. #include <string>
  28. NS_CC_BEGIN
  29. class CC_DLL Application : public ApplicationProtocol
  30. {
  31. public:
  32. /**
  33. * @js ctor
  34. */
  35. Application();
  36. /**
  37. * @js NA
  38. * @lua NA
  39. */
  40. virtual ~Application();
  41. /**
  42. @brief Callback by Director for limit FPS.
  43. @param interval The time, which expressed in second in second, between current frame and next.
  44. */
  45. virtual void setAnimationInterval(float interval) override;
  46. virtual void setAnimationInterval(float interval, SetIntervalReason reason) override;
  47. /**
  48. @brief Run the message loop.
  49. * @js NA
  50. * @lua NA
  51. */
  52. int run();
  53. /**
  54. @brief Get current application instance.
  55. @return Current application instance pointer.
  56. */
  57. static Application* getInstance();
  58. /** @deprecated Use getInstance() instead */
  59. CC_DEPRECATED_ATTRIBUTE static Application* sharedApplication();
  60. /**
  61. @brief Get current language config
  62. @return Current language config
  63. */
  64. virtual LanguageType getCurrentLanguage() override;
  65. /**
  66. @brief Get current language iso 639-1 code
  67. @return Current language iso 639-1 code
  68. */
  69. virtual const char * getCurrentLanguageCode() override;
  70. /**
  71. @brief Get target platform
  72. */
  73. virtual Platform getTargetPlatform() override;
  74. /**
  75. @brief Get application version.
  76. */
  77. virtual std::string getVersion() override;
  78. /**
  79. @brief Open url in default browser
  80. @param String with url to open.
  81. @return true if the resource located by the URL was successfully opened; otherwise false.
  82. */
  83. virtual bool openURL(const std::string &url) override;
  84. /**
  85. * Sets the Resource root path.
  86. * @deprecated Please use FileUtils::getInstance()->setSearchPaths() instead.
  87. */
  88. CC_DEPRECATED_ATTRIBUTE void setResourceRootPath(const std::string& rootResDir);
  89. /**
  90. * Gets the Resource root path.
  91. * @deprecated Please use FileUtils::getInstance()->getSearchPaths() instead.
  92. */
  93. CC_DEPRECATED_ATTRIBUTE const std::string& getResourceRootPath(void);
  94. void setStartupScriptFilename(const std::string& startupScriptFile);
  95. const std::string& getStartupScriptFilename(void);
  96. protected:
  97. static Application * sm_pSharedApplication;
  98. long _animationInterval; //micro second
  99. std::string _resourceRootPath;
  100. std::string _startupScriptFilename;
  101. };
  102. NS_CC_END
  103. #endif // CC_TARGET_PLATFORM == CC_PLATFORM_MAC
  104. #endif // end of __CC_APPLICATION_MAC_H__;