JniImp.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /****************************************************************************
  2. Copyright (c) 2018 Xiamen Yaji Software Co., Ltd.
  3. http://www.cocos.com
  4. Permission is hereby granted, free of charge, to any person obtaining a copy
  5. of this software and associated engine source code (the "Software"), a limited,
  6. worldwide, royalty-free, non-assignable, revocable and non-exclusive license
  7. to use Cocos Creator solely to develop games on your target platforms. You shall
  8. not use Cocos Creator software for developing other software or tools that's
  9. used for developing games. You are not granted to publish, distribute,
  10. sublicense, and/or sell copies of Cocos Creator.
  11. The software or tools in this License Agreement are licensed, not sold.
  12. Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
  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. #pragma once
  22. #include <string>
  23. typedef void (*EditTextCallback)(const std::string& text, void* ctx);
  24. extern bool getApplicationExited();
  25. extern void restartJSVM();
  26. extern void exitApplication();
  27. extern std::string getApkPathJNI();
  28. extern std::string getPackageNameJNI();
  29. extern int getObbAssetFileDescriptorJNI(const std::string& path, long* startOffset, long* size);
  30. extern void convertEncodingJNI(const std::string& src, int byteSize, const std::string& fromCharset, std::string& dst, const std::string& newCharset);
  31. extern int getDeviceSampleRateJNI();
  32. extern int getDeviceAudioBufferSizeInFramesJNI();
  33. extern std::string getCurrentLanguageJNI();
  34. extern std::string getCurrentLanguageCodeJNI();
  35. extern std::string getSystemVersionJNI();
  36. extern bool openURLJNI(const std::string& url);
  37. extern void copyTextToClipboardJNI(const std::string& text);
  38. extern void setPreferredFramesPerSecondJNI(int fps);
  39. extern void setGameInfoDebugViewTextJNI(int index, const std::string& text);
  40. extern void setJSBInvocationCountJNI(int count);
  41. extern void openDebugViewJNI();
  42. extern void disableBatchGLCommandsToNativeJNI();
  43. extern int getAndroidSDKInt();