CCApplication-linux.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /****************************************************************************
  2. Copyright (c) 2011 Laschweinski
  3. Copyright (c) 2013-2016 Chukong Technologies Inc.
  4. Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
  5. http://www.cocos2d-x.org
  6. Permission is hereby granted, free of charge, to any person obtaining a copy
  7. of this software and associated documentation files (the "Software"), to deal
  8. in the Software without restriction, including without limitation the rights
  9. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10. copies of the Software, and to permit persons to whom the Software is
  11. furnished to do so, subject to the following conditions:
  12. The above copyright notice and this permission notice shall be included in
  13. all copies or substantial portions of the Software.
  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
  20. THE SOFTWARE.
  21. ****************************************************************************/
  22. #ifndef CCAPLICATION_H_
  23. #define CCAPLICATION_H_
  24. #include "platform/CCPlatformConfig.h"
  25. #if CC_TARGET_PLATFORM == CC_PLATFORM_LINUX
  26. #include "platform/CCCommon.h"
  27. #include "platform/CCApplicationProtocol.h"
  28. #include <string>
  29. NS_CC_BEGIN
  30. class Rect;
  31. class Application : public ApplicationProtocol
  32. {
  33. public:
  34. /**
  35. * @js ctor
  36. */
  37. Application();
  38. /**
  39. * @js NA
  40. * @lua NA
  41. */
  42. virtual ~Application();
  43. /**
  44. @brief Callback by Director for limit FPS.
  45. @param interval The time, which expressed in second in second, between current frame and next.
  46. */
  47. virtual void setAnimationInterval(float interval) override;
  48. virtual void setAnimationInterval(float interval, SetIntervalReason reason) override;
  49. /**
  50. @brief Run the message loop.
  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. /* override functions */
  61. virtual LanguageType getCurrentLanguage() 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 Get application version
  69. */
  70. virtual std::string getVersion() override;
  71. /**
  72. @brief Open url in default browser
  73. @param String with url to open.
  74. @return true if the resource located by the URL was successfully opened; otherwise false.
  75. */
  76. virtual bool openURL(const std::string &url) override;
  77. /**
  78. * Sets the Resource root path.
  79. * @deprecated Please use FileUtils::getInstance()->setSearchPaths() instead.
  80. */
  81. CC_DEPRECATED_ATTRIBUTE void setResourceRootPath(const std::string& rootResDir);
  82. /**
  83. * Gets the Resource root path.
  84. * @deprecated Please use FileUtils::getInstance()->getSearchPaths() instead.
  85. */
  86. CC_DEPRECATED_ATTRIBUTE const std::string& getResourceRootPath(void);
  87. /**
  88. @brief Get target platform
  89. */
  90. virtual Platform getTargetPlatform() override;
  91. protected:
  92. long _animationInterval; //micro second
  93. std::string _resourceRootPath;
  94. static Application * sm_pSharedApplication;
  95. };
  96. NS_CC_END
  97. #endif // CC_TARGET_PLATFORM == CC_PLATFORM_LINUX
  98. #endif /* CCAPLICATION_H_ */