diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 000000000000..dc9b5ea890c8 --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,33 @@ +--- +Checks: > + -*, + performance-faster-string-find, + performance-for-range-copy, + performance-implicit-conversion-in-loop, + performance-inefficient-algorithm, + performance-inefficient-vector-operation, + performance-move-const-arg, + performance-move-constructor-init, + performance-type-promotion-in-math-fn, + performance-unnecessary-copy-initialization, + performance-unnecessary-value-param, + readability-container-size-empty, + readability-delete-null-pointer, + readability-redundant-control-flow, + readability-redundant-string-cstr, + readability-string-compare, + bugprone-argument-comment, + bugprone-bool-pointer-implicit-conversion, + bugprone-dangling-handle, + bugprone-fold-init-type, + bugprone-forward-declaration-namespace, + bugprone-forwarding-reference-overload, + bugprone-inaccurate-erase, + bugprone-incorrect-roundings, + modernize-redundant-void-arg, + modernize-use-emplace, + +WarningsAsErrors: '*' +HeaderFilterRegex: '/(?!external)/.*' +AnalyzeTemporaryDtors: false +FormatStyle: none diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000000..4d19ac374923 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,98 @@ +# This is a basic workflow to help you get started with Actions + +name: CI + +on: + push: + branches: [ v4, v3 ] + pull_request: + branches: [ v4, v3 ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + ubuntu-18_04: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + - run: python download-deps.py --r no + - run: echo -e "y" | bash build/install-deps-linux.sh + - run: cmake -B b -S . + - run: cmake --build b + + # https://github.com/cocos2d/cocos2d-x/issues/20471 + # ubuntu-20_04: + # runs-on: ubuntu-20.04 + # steps: + # - uses: actions/checkout@v2 + # - run: python download-deps.py --r no + # - run: echo -e "y" | bash build/install-deps-linux.sh + # - run: cmake -B b -S . + # - run: cmake --build b + + windows-2019: + runs-on: windows-2019 + steps: + - uses: actions/checkout@v2 + - run: python download-deps.py --r no + - run: cmake -B b -S . -G "Visual Studio 16 2019" -A Win32 + - run: cmake --build b + + windows-2022: + runs-on: windows-2022 + steps: + - uses: actions/checkout@v2 + - run: python download-deps.py --r no + - run: cmake -B b -S . -G "Visual Studio 17 2022" -A Win32 + - run: cmake --build b + + macos-10_15: + runs-on: macos-10.15 + steps: + - uses: actions/checkout@v2 + - run: python download-deps.py --r no + - run: cmake -B b -S . -GXcode + - run: cmake --build b --target cpp-tests + + macos-11: + runs-on: macos-11 + steps: + - uses: actions/checkout@v2 + - run: python download-deps.py --r no + - run: cmake -B b -S . -GXcode + - run: cmake --build b --target cpp-tests + + ios_macos-10_15: + runs-on: macos-10.15 + steps: + - uses: actions/checkout@v2 + - run: python download-deps.py --r no + - run: cmake -B b -S . -GXcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_SYSTEM_PROCESSOR=arm64 + - run: cmake --build b --config Release --target cpp-tests -- -quiet + + ios_macos-11: + runs-on: macos-11 + steps: + - uses: actions/checkout@v2 + - run: python download-deps.py --r no + - run: cmake -B b -S . -GXcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_SYSTEM_PROCESSOR=arm64 + - run: cmake --build b --config Release --target cpp-tests -- -quiet -destination "platform=iOS Simulator,name=iPhone Retina (4-inch)" + + android_windows-2019: + runs-on: windows-2019 + steps: + - uses: actions/checkout@v2 + - run: python download-deps.py --r no + - run: ./gradlew assembleRelease -PPROP_BUILD_TYPE=cmake --info + shell: bash + working-directory: tests/cpp-tests/proj.android + + android_ubuntu-20_04: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - run: python download-deps.py --r no + - run: ./gradlew assembleRelease -PPROP_BUILD_TYPE=cmake --info + shell: bash + working-directory: tests/cpp-tests/proj.android diff --git a/.gitignore b/.gitignore index 0f469c24b0b0..31b95ac76e50 100644 --- a/.gitignore +++ b/.gitignore @@ -168,3 +168,18 @@ tests/lua-tests/project/proj.tizen/res/ cmake-build-*/ .vs cmake_build* + +# tmp android build files +cocos/platform/android/libcocos2dx/.project +tests/lua-tests/project/proj.android/.project +tests/lua-tests/project/proj.android/app/.project +tests/*/proj.android/.settings/org.eclipse.buildship.core.prefs +tests/*/project/proj.android/.settings/org.eclipse.buildship.core.prefs + +# tmp folder for temp usage +tmp/ +temp/ + +# external libs zip +*.zip +**/simulator/ \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 434feab6f0fe..4ba55fcc45d8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,7 @@ matrix: include: # linux - os: linux + dist: xenial env: - BUILD_TARGET=linux - GEN_BINDING_AND_COCOSFILE=true @@ -10,6 +11,12 @@ matrix: - secure: M5lyDs0qai15mWHzJdkh0WPfVJJmVZu6SWtYULxatukGPXVwoQvmEtYAwAW+iz6aM+tXksQ/mk6nW5L8UFbHm+n6yrsa5bZU9sGXjilPE8p8bLFYDmIbPRazU+E6pBP3J2CDoAm0XnWkiYQ8feTxKTo6ysLnHAEjyaHTw0+Q1GM= sudo: required language: cpp + # clang-tidy + - os: linux + dist: xenial + env: BUILD_TARGET=linux_clang_tidy + language: cpp + sudo: required # mac_cmake - os: osx env: BUILD_TARGET=mac_cmake @@ -24,29 +31,52 @@ matrix: sudo: required # android ndk-build - os: linux - env: BUILD_TARGET=android_ndk-build + dist: xenial + env: BUILD_TARGET=android_cpp_ndk-build language: android sudo: required # android_lua ndk-build - os: linux + dist: xenial env: BUILD_TARGET=android_lua_ndk-build language: android sudo: required + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-6 # android cmake - os: linux - env: BUILD_TARGET=android_cmake + dist: xenial + env: BUILD_TARGET=android_cpp_cmake language: android sudo: required # android_lua cmake - os: linux + dist: xenial env: BUILD_TARGET=android_lua_cmake language: android sudo: required + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-6 # android_js cmake - os: linux + dist: xenial env: BUILD_TARGET=android_js_cmake language: android sudo: required + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-6 # mac - os: osx env: BUILD_TARGET=mac @@ -60,11 +90,13 @@ matrix: osx_image: xcode9.3 sudo: required - os: linux - env: BUILD_TARGET=android_cocos_new_test - language: cpp + dist: xenial + env: BUILD_TARGET=android_cocos_new_cpp_test + language: android sudo: required - os: linux - env: BUILD_TARGET=linux_cocos_new_test + dist: xenial + env: BUILD_TARGET=linux_cocos_new_lua_test language: cpp sudo: required @@ -73,6 +105,9 @@ script: before_install: - tools/travis-scripts/before-install.sh +jdk: + - oraclejdk8 + cache: bundler: true diff --git a/CHANGELOG b/CHANGELOG index a9b5d62fdd2a..a89b95ccdb12 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,110 @@ +cocos2d-x-3.17.2 May.21 2019 + +[NEW] Network: added clear requests and responses method to httpclient +[NEW] UI: VideoPlayer added ability to enable/disable looping, resonding user input +[NEW] UI: VideoPlayer added function to set style +[NEW] IMEDispacher: added a function to check if any IME dispatcher is active +[NEW] Renderer: add a function to get current clearing color +[NEW] Lua: added binding codes for `EventDispathcer::addCustomEventListener()` + +[REFINE] Android: added optimization codes for OPPO devcies +[REFINE] Network: improved websocket traces +[REFINE] Android: supported Android P cutout area +[REFINE] FontAtlas: font atlas texture initialization delayed +[REFINE] LOG: CCLOG may block thread on windows + +[FIX] FileUtils:fixed a bug that `listFiles()` can not work correctly if the file path starts with `assets/` on Android +[FIX] AssetsManager: fixed a bug that `_percent` is always be 0 during the update process +[FIX] Texture2D: fixed memory leak if `Texture2D::setAlphaTexture()` is invoked many times +[FIX] FontAtlasCache: avoided crash if a file path is too long +[FIX] Audio: fixed crash on iOS +[FIX] UI: VideoPlayer could not play video in obb file on Android +[FIX] SpriteFrame: fixed performance issue in parsing plist files +[FIX] 3rd: unzip failed to uncompress files + +cocos2d-x-3.17.1 Nov.19 2018 + +[REFINE] Renderer: properly reduce clear buffer times to save energy +[REFINE] Engine: improve the reuse logic of sprite frames cache +[REFINE] Engine: add `GLView::setCursor` for desktop platforms +[REFINE] Engine: add methods to change icons for desktop platforms +[REFINE] UI: improve iPhone X home indicator handling behavior +[REFINE] UI: add line spacing support for system font on iOS and Android +[REFINE] UI: add support for pressed and disabled image in EditBox +[REFINE] UI: shrink extra label text if too long, prevent label too long crash +[REFINE] LUA: add binding code for cocos2d::Downloader +[REFINE] Android: add supporting SafeArea for most edge screens devices +[REFINE] Android: change default value of PROP_BUILD_TYPE from ndk-build to CMake +[REFINE] Android: update project config to gradle 4.6, sdk 28, android gradle plugin 3.1.0 +[REFINE] Android: add ability to not stop music on game start in android +[REFINE] Windows: refine CCDevice-win32 BitmapDC +[REFINE] Windows: improve binary folder structure, copy resources to "Resources/" folder +[REFINE] Action: add ui::LoadingBar support to Progress actions +[REFINE] Network: support multiple parameters in SocketIO emit/send method +[REFINE] FileUtils: improve thread safety (use single recursive_mutex) +[REFINE] FileUtils: add getFileSize impl for Windows +[REFINE] FileUtils: add listFiles impl for Android and Windows platform +[REFINE] FileUtils: exact fullPathForDirectory from fullPathForFilename, fullPathForFilename should not accept directory +[REFINE] CMake: improve libraries link, compile options config +[REFINE] CMake: remove un-elegant prebuilt feature at internal cmake build scripts +[REFINE] 3rd: upgrade libwebsockets to 2.4.2 with libuv enabled +[REFINE] 3rd: improve cmake build scripts for external libs +[REFINE] 3rd: upgrade luajit to 2.1.0-beta3, fix random crash in Android release mode +[REFINE] 3rd: external/lua/lua is not referenced in cmake and it will be removed in the near future +[REFINE] Tests: add websocket latency test +[REFINE] Tests: add download multi task test case +[REFINE] Tests: improve part test cases UI shows +[REFINE] cocos console: disable "gen-libs" command +[REFINE] Others: add another xbox 360 configuration +[REFINE] Others: remove ANT_ROOT env check on setup.py +[REFINE] Others: improve cmake tests in travis CI scripts + +[FIX] Renderer: handle opengl recreate event for CameraBackgroundDepthBrush +[FIX] Renderer: fix some EVENT_RENDERER_RECREATED problem +[FIX] Engine: fix the last update time was not corrected if next delta time was zeroed +[FIX] Engine: be safe to handle operator= in CCData +[FIX] Engine: aviod reading outside of the buffer when print log +[FIX] Engine: avoid duplicate find action when already found +[FIX] Engine: prevent free _bytes when src and dest are identical in CCData +[FIX] Engine: fix Console::loop() consumes 100% of CPU usage +[FIX] Engine: fix Action doesn't work when follow Node added PhysicsBody +[FIX] UI: fix locate image path relative to tsx file error in TiledMap +[FIX] UI: fix several bugs with button's title, include memory leak +[FIX] UI: fix LabelLetter::isVisible always return false +[FIX] UI: fix not support sprite frame when ignoreContentAdaptWithSize is false +[FIX] UI: fix out of range access in Label +[FIX] UI: fix Widget::getAncestorWidget error +[FIX] UI: fix iOS editbox EndAction wrong when single line mode (UITextField) +[FIX] UI: Fix for Label and UIRichEdit text trailing space trimming +[FXI] JavaScript: fix crash if garbage collection runs between TouchStart and TouchEnd event +[FIX] Audio: fix AudioEngine rotateBufferThread crash on iOS +[FIX] Audio: add extra init checks in pcm audio service, avoid crash in PcmAudioService +[FIX] Audio: fix AVAudioSessionErrorCodeCannotStartPlaying error may occur on Apple +[FIX] Audio: fix background music may resumes even the application is on the background on Android +[FIX] Audio: fix AudioCache* holding invalid pointer value +[FIX] Network: fix memory leaks in WebSocket +[FIX] Network: fix websocket memory zereoing size error +[FIX] Network: fix https downloader timeout on win/mac +[FIX] Network: fix "cc.loader.load" convert url error +[FIX] iOS: fix project build warnings in Xcode +[FIX] iOS: fix crash when saving gray colorspace image +[FIX] iOS: `js/lua tests` fix double free issue on app exits. +[FIX] Android: shorten C++ build path, reduce long path error on Windows +[FIX] Android: keep cocos2dx activity at task root by mark "singleTask" in manifest +[FIX] Android: fix crash caused by JNIEnv null pointer in getStringUTFCharsJNI function +[FIX] Android: use 'Binary names' style on JNI for ClassLoader.loadClass +[FIX] Android: allow cleartext HTTP traffic by default for all tests project +[FIX] Windows: Support VS2017 in release mode +[FIX] Action: fix repeat CallFunc for some times, may never stop +[FIX] Physics: fix PhysicsJointMotor setRate and getRate Bad Access Crash +[FIX] FileUtils: fix removeDirectory() failure on win32 +[FIX] FileUtils: let getContents return an error code when the filename is a directory +[FIX] FileUtils: let isFileExistInternal return false when folder as parameter on Linux +[FIX] LUA: performance drop bug introduced in 3.17 +[FIX] CMake: fix project name always be "TemplateCpp" when create a new project +[FIX] Tests: fix auto test stop in cpp-tests project +[FIX] cocos console: do uninstall only when that app is installed for android + cocos2d-x-3.17 May.21 2018 [HIGHLIGHT] Android: support Android Studio 3.0, NDK 16 @@ -1164,7 +1271,7 @@ cocos2d-x-3.7rc0 July.1 2015 [NEW] C++: Added ActionFloat [NEW] C++: Supported physical keyboard on WinRT [NEW] FileUtils: checked filename case characters on windows - [NEW] FileUitls: added supporting loading files that which file path include utf-8 characters + [NEW] FileUtils: added supporting loading files that which file path include utf-8 characters [NEW] PhysicsShape: added sensor property [NEW] Sprite: used triangle command [NEW] 3d: Added `getFarPlane` and `getNearPlane` in `Camera` class diff --git a/CMakeLists.txt b/CMakeLists.txt index f379e71ece8b..33411c9f5031 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,15 +34,28 @@ project(Cocos2d-x) set(COCOS2DX_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}) set(CMAKE_MODULE_PATH ${COCOS2DX_ROOT_PATH}/cmake/Modules/) +# prevent in-source-build +include(PreventInSourceBuilds) + # works before build libcocos2d include(CocosBuildSet) +# build options +option(BUILD_TESTS "Build tests" ON) + # default tests include lua, js test project, so we set those option on to build libs set(BUILD_LUA_LIBS ON) set(BUILD_JS_LIBS ON) -if(NOT USE_COCOS_PREBUILT) - add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos ${ENGINE_BINARY_PATH}/cocos/core) +add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos ${ENGINE_BINARY_PATH}/cocos/core) + +# prevent tests project to build "cocos2d-x/cocos" again +set(BUILD_ENGINE_DONE ON) +# add engine all tests project +if (BUILD_TESTS) + add_subdirectory(${COCOS2DX_ROOT_PATH}/tests/cpp-empty-test ${ENGINE_BINARY_PATH}/tests/cpp-empty-test) + add_subdirectory(${COCOS2DX_ROOT_PATH}/tests/cpp-tests ${ENGINE_BINARY_PATH}/tests/cpp-tests) + add_subdirectory(${COCOS2DX_ROOT_PATH}/tests/js-tests/project ${ENGINE_BINARY_PATH}/tests/js-tests) + add_subdirectory(${COCOS2DX_ROOT_PATH}/tests/lua-empty-test/project ${ENGINE_BINARY_PATH}/tests/lua-empty-test) + add_subdirectory(${COCOS2DX_ROOT_PATH}/tests/lua-tests/project ${ENGINE_BINARY_PATH}/tests/lua-test) endif() -add_subdirectory(${COCOS2DX_ROOT_PATH}/tests ${ENGINE_BINARY_PATH}/tests) - diff --git a/README.md b/README.md index 69792438afd5..57d2c450b31f 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ cocos2d-x [cocos2d-x][1] is a multi-platform framework for building 2d games, interactive books, demos and other graphical applications. -It is based on [cocos2d-iphone][2], but instead of using Objective-C, it uses C++. +It is based on cocos2d-iphone, but instead of using Objective-C, it uses C++. It works on iOS, Android, OS X, Windows, Linux and Web platforms. **Cocos2d-x Framework Architecture**: @@ -44,12 +44,11 @@ Download stable versions ----------------------- * [Cocos2d-x stable versions](http://www.cocos2d-x.org/download) -* [Cocos2d-JS Lite version](http://www.cocos2d-x.org/filecenter/jsbuilder) How to start a new game ----------------------- -1. Download the code from [cocos2d download site][4] or clone this repo (instructions above) +1. Download the code from [cocos2d download site](http://www.cocos2d-x.org/download) or clone this repo (instructions above) 2. Run `setup.py` 3. Run the `cocos` script @@ -65,7 +64,7 @@ You can also create a JS project or Lua project with `-l js` or `-l lua`. ### Build and run a new project for Android ### -Cocos2d-x supports Android Studio. Simple open the `proj.android` directory from within the Android Studio environment. More information can be found in our [documentation](http://www.cocos2d-x.org/docs/cocos2d-x/en/installation/Android-Studio.html). +Cocos2d-x supports Android Studio. Simple open the `proj.android` directory from within the Android Studio environment. More information can be found in our [documentation](https://docs.cocos2d-x.org/cocos2d-x/v3/en/installation/Android-Studio.html). ### Build and run a new project for iOS ### @@ -125,7 +124,7 @@ Documentations and samples ------------- * [All Docs in a single place!](http://cocos2d-x.org/docs/) * [Online API Reference](http://cocos2d-x.org/docs/api-ref/index.html) _Note that Cocos2d-x, Cocos2d-JS and Cocos Creator have different API set_ -* [Programmers Guide](http://cocos2d-x.org/docs/programmers-guide/2/index.html) +* [Programmers Guide](https://docs.cocos2d-x.org/cocos2d-x/v3/en/basic_concepts/) * [Latest Release Note](https://github.com/cocos2d/cocos2d-x/blob/v3/docs/RELEASE_NOTES.md) * [Changelog](https://github.com/cocos2d/cocos2d-x/blob/v3/CHANGELOG) @@ -167,7 +166,7 @@ Build Requirements * Mac OS X 10.7+, Xcode 8+ * or Ubuntu 14.04+, CMake 3.1+ * or Windows 7+, VS 2015 -* Python 2.7.5+(NOT Python 3) +* Python 2.7.5+ (NOT Python 3) * NDK r16+ is required to build Android games * Android Studio 3.0.0+ to build Android games(tested with 3.0.0) * JRE or JDK 1.6+ is required for web publishing @@ -246,8 +245,7 @@ Or you can import the project located at `tests/cpp-empty-test/proj.android` usi Learning Resources -------------------------------- -* [Programmers Guide](http://cocos2d-x.org/docs/programmers-guide/2/index.html) -* [Sonar Systems Videos](https://www.youtube.com/user/sonarsystemslimited/search?query=cocos2d-x) +* [Programmers Guide](https://docs.cocos2d-x.org/cocos2d-x/v3/en/basic_concepts/) * [Android Fundamentals](https://developer.android.com/guide/components/fundamentals.html) * [Make School Tutorials](https://www.makeschool.com/tutorials/) * [Games From Scratch](http://www.gamefromscratch.com/page/Cocos2d-x-CPP-Game-Programming-Tutorial-Series.aspx) @@ -260,13 +258,6 @@ You can help us spread the word about cocos2d-x! We would surely appreciate it! * Talk about us on Facebook! Our [Facebook Page](https://www.facebook.com/cocos2dx/) * Tweet, Tweet! Our [Twitter](https://twitter.com/cocos2dx) * Read our [Blog](http://blog.cocos2d-x.org/) and promote it on your social media. -* Become a [Regional Coordinator](http://discuss.cocos2d-x.org/t/we-need-regional-coordinators/24104) - -See what we are planning! --------------------------------- -You can see exactly what we are planning to do with the Cocos family of products. - -* [Cocos2d-x roadmap](https://trello.com/b/Np6obnuE/cocos2d-x-roadmap) Where to get help -------------------------------- @@ -299,9 +290,6 @@ Contact us * Weibo: [http://t.sina.com.cn/cocos2dx][11] [1]: http://www.cocos2d-x.org "cocos2d-x" -[2]: http://www.cocos2d-iphone.org "cocos2d for iPhone" -[3]: http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Download -[4]: http://www.cocos2d-x.org/download/version#Cocos2d-x [5]: http://www.box2d.org "Box2D" [6]: http://www.chipmunk-physics.net "Chipmunk2D" [7]: http://esotericsoftware.com/ "http://esotericsoftware.com/" diff --git a/build/cocos2d_libs.xcodeproj/project.pbxproj b/build/cocos2d_libs.xcodeproj/project.pbxproj index 5e77ca9c4506..1ce896739759 100644 --- a/build/cocos2d_libs.xcodeproj/project.pbxproj +++ b/build/cocos2d_libs.xcodeproj/project.pbxproj @@ -1286,6 +1286,7 @@ 43015DC01B60DF4000E75161 /* CCComExtensionData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 43015DBD1B60DF4000E75161 /* CCComExtensionData.cpp */; }; 43015DC11B60DF4000E75161 /* CCComExtensionData.h in Headers */ = {isa = PBXBuildFile; fileRef = 43015DBE1B60DF4000E75161 /* CCComExtensionData.h */; }; 43015DC21B60DF4000E75161 /* CCComExtensionData.h in Headers */ = {isa = PBXBuildFile; fileRef = 43015DBE1B60DF4000E75161 /* CCComExtensionData.h */; }; + 4621ED182359A92200E5C937 /* CCInputView-ios.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4621ED172359A92200E5C937 /* CCInputView-ios.mm */; }; 46270FA41E1CC6A200AAA098 /* libcrypto.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 46270FA21E1CC6A100AAA098 /* libcrypto.a */; }; 46270FA51E1CC6A200AAA098 /* libssl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 46270FA31E1CC6A100AAA098 /* libssl.a */; }; 46270FA81E1CC84500AAA098 /* libcrypto.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 46270FA61E1CC84500AAA098 /* libcrypto.a */; }; @@ -2048,6 +2049,7 @@ 507B3B4B1C31BDD30067B53E /* CCBillBoard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B60C5BD219AC68B10056FBDE /* CCBillBoard.cpp */; }; 507B3B4C1C31BDD30067B53E /* Particle3DReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18956BB01A9DFBFD006E9155 /* Particle3DReader.cpp */; }; 507B3B4D1C31BDD30067B53E /* CCSprite3DMaterial.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15AE180319AAD2F700C27E9E /* CCSprite3DMaterial.cpp */; }; + 507B3B4E1C31BDD30067B53E /* ccGLStateCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50ABBD701925AB4100A911A9 /* ccGLStateCache.cpp */; }; 507B3B501C31BDD30067B53E /* CCPUDoEnableComponentEventHandlerTranslator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B665E1021AA80A6500DDB1C5 /* CCPUDoEnableComponentEventHandlerTranslator.cpp */; }; 507B3B511C31BDD30067B53E /* CCTransition.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A5701D8180BCB8C0088DEC7 /* CCTransition.cpp */; }; 507B3B531C31BDD30067B53E /* CCEventAssetsManagerEx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 15B3707019EE414C00ABE682 /* CCEventAssetsManagerEx.cpp */; }; @@ -2532,6 +2534,7 @@ 507B3DEB1C31BDD30067B53E /* CCActionPageTurn3D.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A57005A180BC5A10088DEC7 /* CCActionPageTurn3D.h */; }; 507B3DEC1C31BDD30067B53E /* UIHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 2905F9F518CF08D000240AA3 /* UIHelper.h */; }; 507B3DED1C31BDD30067B53E /* CCNavMeshUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = B677B0C81B18492D006762CB /* CCNavMeshUtils.h */; }; + 507B3DEE1C31BDD30067B53E /* ccGLStateCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 50ABBD711925AB4100A911A9 /* ccGLStateCache.h */; }; 507B3DEF1C31BDD30067B53E /* CCPUBaseForceAffector.h in Headers */ = {isa = PBXBuildFile; fileRef = B665E0DB1AA80A6500DDB1C5 /* CCPUBaseForceAffector.h */; }; 507B3DF01C31BDD30067B53E /* CCPUNoise.h in Headers */ = {isa = PBXBuildFile; fileRef = B665E1591AA80A6500DDB1C5 /* CCPUNoise.h */; }; 507B3DF11C31BDD30067B53E /* CocosGUI.h in Headers */ = {isa = PBXBuildFile; fileRef = 2905F9EA18CF08D000240AA3 /* CocosGUI.h */; }; @@ -3220,6 +3223,10 @@ 50ABBD981925AB4100A911A9 /* CCGLProgramStateCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50ABBD6E1925AB4100A911A9 /* CCGLProgramStateCache.cpp */; }; 50ABBD991925AB4100A911A9 /* CCGLProgramStateCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 50ABBD6F1925AB4100A911A9 /* CCGLProgramStateCache.h */; }; 50ABBD9A1925AB4100A911A9 /* CCGLProgramStateCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 50ABBD6F1925AB4100A911A9 /* CCGLProgramStateCache.h */; }; + 50ABBD9B1925AB4100A911A9 /* ccGLStateCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50ABBD701925AB4100A911A9 /* ccGLStateCache.cpp */; }; + 50ABBD9C1925AB4100A911A9 /* ccGLStateCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50ABBD701925AB4100A911A9 /* ccGLStateCache.cpp */; }; + 50ABBD9D1925AB4100A911A9 /* ccGLStateCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 50ABBD711925AB4100A911A9 /* ccGLStateCache.h */; }; + 50ABBD9E1925AB4100A911A9 /* ccGLStateCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 50ABBD711925AB4100A911A9 /* ccGLStateCache.h */; }; 50ABBD9F1925AB4100A911A9 /* CCGroupCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50ABBD721925AB4100A911A9 /* CCGroupCommand.cpp */; }; 50ABBDA01925AB4100A911A9 /* CCGroupCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50ABBD721925AB4100A911A9 /* CCGroupCommand.cpp */; }; 50ABBDA11925AB4100A911A9 /* CCGroupCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = 50ABBD731925AB4100A911A9 /* CCGroupCommand.h */; }; @@ -5046,6 +5053,8 @@ 3EACC99F19F5014D00EB3C5E /* CCLight.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCLight.h; sourceTree = ""; }; 43015DBD1B60DF4000E75161 /* CCComExtensionData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCComExtensionData.cpp; sourceTree = ""; }; 43015DBE1B60DF4000E75161 /* CCComExtensionData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCComExtensionData.h; sourceTree = ""; }; + 4621ED172359A92200E5C937 /* CCInputView-ios.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = "CCInputView-ios.mm"; sourceTree = ""; }; + 4621ED192359A94700E5C937 /* CCInputView-ios.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CCInputView-ios.h"; sourceTree = ""; }; 46270FA21E1CC6A100AAA098 /* libcrypto.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcrypto.a; path = ../external/openssl/prebuilt/mac/libcrypto.a; sourceTree = ""; }; 46270FA31E1CC6A100AAA098 /* libssl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libssl.a; path = ../external/openssl/prebuilt/mac/libssl.a; sourceTree = ""; }; 46270FA61E1CC84500AAA098 /* libcrypto.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcrypto.a; path = ../external/openssl/prebuilt/ios/libcrypto.a; sourceTree = ""; }; @@ -5394,6 +5403,8 @@ 50ABBD6D1925AB4100A911A9 /* CCGLProgramState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCGLProgramState.h; sourceTree = ""; }; 50ABBD6E1925AB4100A911A9 /* CCGLProgramStateCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCGLProgramStateCache.cpp; sourceTree = ""; }; 50ABBD6F1925AB4100A911A9 /* CCGLProgramStateCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCGLProgramStateCache.h; sourceTree = ""; }; + 50ABBD701925AB4100A911A9 /* ccGLStateCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ccGLStateCache.cpp; sourceTree = ""; }; + 50ABBD711925AB4100A911A9 /* ccGLStateCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ccGLStateCache.h; sourceTree = ""; }; 50ABBD721925AB4100A911A9 /* CCGroupCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCGroupCommand.cpp; sourceTree = ""; }; 50ABBD731925AB4100A911A9 /* CCGroupCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCGroupCommand.h; sourceTree = ""; }; 50ABBD741925AB4100A911A9 /* CCQuadCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCQuadCommand.cpp; sourceTree = ""; }; @@ -7988,6 +7999,8 @@ 50ABBD6D1925AB4100A911A9 /* CCGLProgramState.h */, 50ABBD6E1925AB4100A911A9 /* CCGLProgramStateCache.cpp */, 50ABBD6F1925AB4100A911A9 /* CCGLProgramStateCache.h */, + 50ABBD701925AB4100A911A9 /* ccGLStateCache.cpp */, + 50ABBD711925AB4100A911A9 /* ccGLStateCache.h */, 50ABBD721925AB4100A911A9 /* CCGroupCommand.cpp */, 50ABBD731925AB4100A911A9 /* CCGroupCommand.h */, B29594B21926D5EC003EEF37 /* CCMeshCommand.cpp */, @@ -8097,6 +8110,8 @@ 503DD8DD1926736A00CD74DD /* CCPlatformDefine-ios.h */, 503DD8DE1926736A00CD74DD /* CCStdC-ios.h */, 503DD8DF1926736A00CD74DD /* OpenGL_Internal-ios.h */, + 4621ED172359A92200E5C937 /* CCInputView-ios.mm */, + 4621ED192359A94700E5C937 /* CCInputView-ios.h */, ); path = ios; sourceTree = ""; @@ -9782,6 +9797,7 @@ B665E2641AA80A6500DDB1C5 /* CCPUDoExpireEventHandler.h in Headers */, 1A40D1091E8E56C6002E363A /* allocators.h in Headers */, 50864CE21C7BC1B100B3BAB1 /* cpVect.h in Headers */, + 50ABBD9D1925AB4100A911A9 /* ccGLStateCache.h in Headers */, B665E3241AA80A6500DDB1C5 /* CCPUOnCollisionObserver.h in Headers */, 50ABBEB91925AB6F00A911A9 /* ccUTF8.h in Headers */, 15AE191A19AAD35000C27E9E /* CCSSceneReader.h in Headers */, @@ -10058,6 +10074,7 @@ 5020A1D91D49912500E80C72 /* RegionAttachment.h in Headers */, 507B3DEC1C31BDD30067B53E /* UIHelper.h in Headers */, 507B3DED1C31BDD30067B53E /* CCNavMeshUtils.h in Headers */, + 507B3DEE1C31BDD30067B53E /* ccGLStateCache.h in Headers */, 507B3DEF1C31BDD30067B53E /* CCPUBaseForceAffector.h in Headers */, 507B3DF01C31BDD30067B53E /* CCPUNoise.h in Headers */, 507B3DF11C31BDD30067B53E /* CocosGUI.h in Headers */, @@ -10870,6 +10887,7 @@ 1A570088180BC5A10088DEC7 /* CCActionPageTurn3D.h in Headers */, 15AE1B9319AADA9A00C27E9E /* UIHelper.h in Headers */, B677B0DC1B18492D006762CB /* CCNavMeshUtils.h in Headers */, + 50ABBD9E1925AB4100A911A9 /* ccGLStateCache.h in Headers */, B665E2111AA80A6500DDB1C5 /* CCPUBaseForceAffector.h in Headers */, B665E30D1AA80A6500DDB1C5 /* CCPUNoise.h in Headers */, 15AE1B9619AADA9A00C27E9E /* CocosGUI.h in Headers */, @@ -11566,6 +11584,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, ); mainGroup = 1551A334158F2AB200E66CFE; @@ -12150,6 +12169,7 @@ D0FD03531A3B51AA00825BB5 /* CCAllocatorGlobalNewDelete.cpp in Sources */, B6DD2FE51B04825B00E47F5F /* DetourPathQueue.cpp in Sources */, B665E39A1AA80A6500DDB1C5 /* CCPUPointEmitterTranslator.cpp in Sources */, + 50ABBD9B1925AB4100A911A9 /* ccGLStateCache.cpp in Sources */, 15AE188119AAD33D00C27E9E /* CCBReader.cpp in Sources */, 501216A01AC473AD009A4BEA /* CCMaterial.cpp in Sources */, 50ABBDB91925AB4100A911A9 /* CCTextureAtlas.cpp in Sources */, @@ -12560,6 +12580,7 @@ 507B3B4B1C31BDD30067B53E /* CCBillBoard.cpp in Sources */, 507B3B4C1C31BDD30067B53E /* Particle3DReader.cpp in Sources */, 507B3B4D1C31BDD30067B53E /* CCSprite3DMaterial.cpp in Sources */, + 507B3B4E1C31BDD30067B53E /* ccGLStateCache.cpp in Sources */, 507B3B501C31BDD30067B53E /* CCPUDoEnableComponentEventHandlerTranslator.cpp in Sources */, 507B3B511C31BDD30067B53E /* CCTransition.cpp in Sources */, 507B3B531C31BDD30067B53E /* CCEventAssetsManagerEx.cpp in Sources */, @@ -13228,6 +13249,7 @@ B60C5BD519AC68B10056FBDE /* CCBillBoard.cpp in Sources */, 18956BB31A9DFBFD006E9155 /* Particle3DReader.cpp in Sources */, 15AE184519AAD2F700C27E9E /* CCSprite3DMaterial.cpp in Sources */, + 50ABBD9C1925AB4100A911A9 /* ccGLStateCache.cpp in Sources */, B665E25F1AA80A6500DDB1C5 /* CCPUDoEnableComponentEventHandlerTranslator.cpp in Sources */, 1A5701E7180BCB8C0088DEC7 /* CCTransition.cpp in Sources */, 15B3707D19EE414C00ABE682 /* CCEventAssetsManagerEx.cpp in Sources */, @@ -13545,6 +13567,7 @@ 5020A1F91D49912500E80C72 /* SkeletonJson.c in Sources */, 50ABBEBC1925AB6F00A911A9 /* ccUtils.cpp in Sources */, 50ABBE721925AB6F00A911A9 /* CCEventListenerMouse.cpp in Sources */, + 4621ED182359A92200E5C937 /* CCInputView-ios.mm in Sources */, B665E41B1AA80A6600DDB1C5 /* CCPUTextureRotator.cpp in Sources */, B665E2971AA80A6500DDB1C5 /* CCPUEmitterManager.cpp in Sources */, 50ABC0001926664800A911A9 /* CCFileUtils-apple.mm in Sources */, @@ -13702,7 +13725,7 @@ 1551A34D158F2AB200E66CFE /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = YES; + ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_WEAK = YES; COMBINE_HIDPI_IMAGES = YES; EXECUTABLE_EXTENSION = a; @@ -13743,7 +13766,7 @@ 1551A34E158F2AB200E66CFE /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = YES; + ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_WEAK = YES; COMBINE_HIDPI_IMAGES = YES; EXECUTABLE_EXTENSION = a; @@ -13856,7 +13879,7 @@ A07A4D621783777C0073F6A7 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = YES; + ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_WEAK = YES; ENABLE_BITCODE = NO; EXECUTABLE_PREFIX = ""; @@ -13893,7 +13916,7 @@ A07A4D631783777C0073F6A7 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = YES; + ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ENABLE_OBJC_WEAK = YES; ENABLE_BITCODE = NO; EXECUTABLE_PREFIX = ""; diff --git a/build/cocos2d_tests.xcodeproj/project.pbxproj b/build/cocos2d_tests.xcodeproj/project.pbxproj index c3fb3dd9da83..4bc4c1ae5b41 100644 --- a/build/cocos2d_tests.xcodeproj/project.pbxproj +++ b/build/cocos2d_tests.xcodeproj/project.pbxproj @@ -67,9 +67,7 @@ 156EAE071977D0BD00F53709 /* ActionTimeline in Resources */ = {isa = PBXBuildFile; fileRef = 38FA2E75194AECF800FF2BE4 /* ActionTimeline */; }; 157B08EC1A90864100B7BEA4 /* Particle3D in Resources */ = {isa = PBXBuildFile; fileRef = B63993301A49359F00B07923 /* Particle3D */; }; 157B08ED1A90865600B7BEA4 /* Particle3D in Resources */ = {isa = PBXBuildFile; fileRef = B63993301A49359F00B07923 /* Particle3D */; }; - 15AECE0B195C0F8A00907DB0 /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3EA0FB65191B933000B170C8 /* MediaPlayer.framework */; }; 15AECE0F195C1FDD00907DB0 /* cocosvideo.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 3EA0FB5D191B92F100B170C8 /* cocosvideo.mp4 */; }; - 15AECE25195D467D00907DB0 /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3EA0FB65191B933000B170C8 /* MediaPlayer.framework */; }; 15B0870D195AD52000D6F62B /* ActionTimeline in Resources */ = {isa = PBXBuildFile; fileRef = 38FA2E75194AECF800FF2BE4 /* ActionTimeline */; }; 15B13E5219F0FD4D008A1ADC /* Manifests in Resources */ = {isa = PBXBuildFile; fileRef = 15B3709219EE5D1000ABE682 /* Manifests */; }; 15B3709319EE5D1000ABE682 /* Manifests in Resources */ = {isa = PBXBuildFile; fileRef = 15B3709219EE5D1000ABE682 /* Manifests */; }; @@ -134,7 +132,6 @@ 185663621B4155D3009EF2AE /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1ABCA35418CD9A820087CE3A /* OpenGL.framework */; }; 185663A51B4155DD009EF2AE /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52B47A331A534B2B004E4C60 /* Security.framework */; }; 185663A71B4155DD009EF2AE /* libcocos2d iOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 46A15FBE1807A4F9005B8026 /* libcocos2d iOS.a */; }; - 185663A81B4155DD009EF2AE /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3EA0FB65191B933000B170C8 /* MediaPlayer.framework */; }; 185663A91B4155DD009EF2AE /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 1ABCA3AF18CDA06D0087CE3A /* libz.dylib */; }; 185663AA1B4155DD009EF2AE /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D60AE43317F7FFE100757E4B /* CoreMotion.framework */; }; 185663AB1B4155DD009EF2AE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1ABCA3A818CD9F130087CE3A /* AudioToolbox.framework */; }; @@ -158,7 +155,6 @@ 185664551B42364E009EF2AE /* script in Resources */ = {isa = PBXBuildFile; fileRef = 185664541B42364E009EF2AE /* script */; }; 185664571B423662009EF2AE /* Icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 185664451B423047009EF2AE /* Icon.icns */; }; 185664581B423672009EF2AE /* src in Resources */ = {isa = PBXBuildFile; fileRef = 185663FD1B422EF0009EF2AE /* src */; }; - 185664591B423687009EF2AE /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 185664431B423047009EF2AE /* MainMenu.xib */; }; 1856645A1B423687009EF2AE /* main.js in Resources */ = {isa = PBXBuildFile; fileRef = 185663F71B422ED6009EF2AE /* main.js */; }; 1856645B1B4236A0009EF2AE /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 185664411B423047009EF2AE /* InfoPlist.strings */; }; 1856647A1B423D95009EF2AE /* AppDelegate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 185664021B422F72009EF2AE /* AppDelegate.cpp */; }; @@ -256,7 +252,6 @@ 1AC358EA18CEC1CB00F37B72 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 1AC358D718CEC1CB00F37B72 /* main.m */; }; 1AC358EB18CEC1CB00F37B72 /* RootViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AC358D918CEC1CB00F37B72 /* RootViewController.mm */; }; 1AC358F518CEC1D400F37B72 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1AC358ED18CEC1D400F37B72 /* InfoPlist.strings */; }; - 1AC358F618CEC1D400F37B72 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1AC358EF18CEC1D400F37B72 /* MainMenu.xib */; }; 1AC358F818CEC1D400F37B72 /* Icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1AC358F318CEC1D400F37B72 /* Icon.icns */; }; 1AC358F918CEC1D400F37B72 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC358F418CEC1D400F37B72 /* main.cpp */; }; 1AC3590318CEC1FB00F37B72 /* bang.png in Resources */ = {isa = PBXBuildFile; fileRef = 1AC358FE18CEC1FB00F37B72 /* bang.png */; }; @@ -433,7 +428,6 @@ 1AC35C8718CECF1400F37B72 /* testsAppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35C7218CECF1400F37B72 /* testsAppDelegate.mm */; }; 1AC35C9818CECF1400F37B72 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35C8418CECF1400F37B72 /* main.m */; }; 1AC35CA318CECF1E00F37B72 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1AC35C9B18CECF1E00F37B72 /* InfoPlist.strings */; }; - 1AC35CA418CECF1E00F37B72 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1AC35C9D18CECF1E00F37B72 /* MainMenu.xib */; }; 1AC35CA518CECF1E00F37B72 /* Icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1AC35C9F18CECF1E00F37B72 /* Icon.icns */; }; 1AC35CA618CECF1E00F37B72 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35CA018CECF1E00F37B72 /* main.cpp */; }; 1AC35CCA18CED84500F37B72 /* animations in Resources */ = {isa = PBXBuildFile; fileRef = 1AC35CA918CED84500F37B72 /* animations */; }; @@ -496,7 +490,6 @@ 1AC35D5118CEDE9400F37B72 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35D4218CEDE9400F37B72 /* main.m */; }; 1AC35D5218CEDE9400F37B72 /* RootViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35D4418CEDE9400F37B72 /* RootViewController.mm */; }; 1AC35D5C18CEDE9E00F37B72 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1AC35D5418CEDE9E00F37B72 /* InfoPlist.strings */; }; - 1AC35D5D18CEDE9E00F37B72 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1AC35D5618CEDE9E00F37B72 /* MainMenu.xib */; }; 1AC35D5E18CEDE9E00F37B72 /* Icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1AC35D5918CEDE9E00F37B72 /* Icon.icns */; }; 1AC35D6018CEDE9E00F37B72 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35D5B18CEDE9E00F37B72 /* main.cpp */; }; 1AC35D7918CEE59900F37B72 /* cocosbuilderRes in Resources */ = {isa = PBXBuildFile; fileRef = 1AC35D7818CEE59900F37B72 /* cocosbuilderRes */; }; @@ -510,7 +503,6 @@ 1AC35DA518CEE5D100F37B72 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35D9518CEE5D100F37B72 /* main.m */; }; 1AC35DA618CEE5D100F37B72 /* RootViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35D9718CEE5D100F37B72 /* RootViewController.mm */; }; 1AC35DB118CEE5DA00F37B72 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1AC35DA818CEE5DA00F37B72 /* InfoPlist.strings */; }; - 1AC35DB218CEE5DA00F37B72 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1AC35DAA18CEE5DA00F37B72 /* MainMenu.xib */; }; 1AC35DB318CEE5DA00F37B72 /* Icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1AC35DAC18CEE5DA00F37B72 /* Icon.icns */; }; 1AC35DB518CEE5DA00F37B72 /* LuaObjectCBridgeTest.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35DAF18CEE5DA00F37B72 /* LuaObjectCBridgeTest.mm */; }; 1AC35DB618CEE5DA00F37B72 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC35DB018CEE5DA00F37B72 /* main.cpp */; }; @@ -693,7 +685,6 @@ 3E9E75D0199324CB005B7047 /* Camera3DTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E9E75CE199324CB005B7047 /* Camera3DTest.cpp */; }; 3E9E75D1199324CB005B7047 /* Camera3DTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E9E75CE199324CB005B7047 /* Camera3DTest.cpp */; }; 3EA0FB5E191B92F100B170C8 /* cocosvideo.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 3EA0FB5D191B92F100B170C8 /* cocosvideo.mp4 */; }; - 3EA0FB66191B933000B170C8 /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3EA0FB65191B933000B170C8 /* MediaPlayer.framework */; }; 3EA0FB72191C844400B170C8 /* UIVideoPlayerTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3EA0FB70191C844400B170C8 /* UIVideoPlayerTest.cpp */; }; 400308D820060F12000DFE6D /* strings in Resources */ = {isa = PBXBuildFile; fileRef = 400308D720060F12000DFE6D /* strings */; }; 406023E5208DDFF5008F1C02 /* strings in Resources */ = {isa = PBXBuildFile; fileRef = 400308D720060F12000DFE6D /* strings */; }; @@ -703,6 +694,21 @@ 463D7E7D1D227C6A00EA6BD1 /* Bug-14327.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 463D7E781D227C3800EA6BD1 /* Bug-14327.cpp */; }; 463D7E7E1D227CA400EA6BD1 /* Bug-15776.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 463D7E7A1D227C3800EA6BD1 /* Bug-15776.cpp */; }; 463D7E7F1D227CAB00EA6BD1 /* Bug-15776.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 463D7E7A1D227C3800EA6BD1 /* Bug-15776.cpp */; }; + 467AF5A4231E004C00770112 /* AVKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 467AF5A3231E004C00770112 /* AVKit.framework */; }; + 467AF5A6231E079F00770112 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 467AF5A5231E079F00770112 /* CoreMedia.framework */; }; + 467AF5A9231E4B2500770112 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 467AF5A5231E079F00770112 /* CoreMedia.framework */; }; + 467AF5AA231E4BA600770112 /* AVKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 467AF5A3231E004C00770112 /* AVKit.framework */; }; + 467AF5AB231E4BE500770112 /* AVKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 467AF5A3231E004C00770112 /* AVKit.framework */; }; + 467AF5AC231E4BED00770112 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 467AF5A5231E079F00770112 /* CoreMedia.framework */; }; + 467AF5AD231E4C4300770112 /* AVKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 467AF5A3231E004C00770112 /* AVKit.framework */; }; + 467AF5AE231E4C4900770112 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 467AF5A5231E079F00770112 /* CoreMedia.framework */; }; + 467AF5DF231FA82500770112 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 467AF5DE231FA82500770112 /* WebKit.framework */; }; + 467AF5E0231FA84F00770112 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 467AF5DE231FA82500770112 /* WebKit.framework */; }; + 467AF5E1231FA85D00770112 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 467AF5DE231FA82500770112 /* WebKit.framework */; }; + 467AF5E2231FA87100770112 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 467AF5DE231FA82500770112 /* WebKit.framework */; }; + 467AF5E3231FA88100770112 /* AVKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 467AF5A3231E004C00770112 /* AVKit.framework */; }; + 467AF5E4231FA88700770112 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 467AF5A5231E079F00770112 /* CoreMedia.framework */; }; + 467AF5E5231FA88D00770112 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 467AF5DE231FA82500770112 /* WebKit.framework */; }; 4B5C5BA81CA1147300D55A14 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 826294421AAF071500CB7CF7 /* Security.framework */; }; 4B5C5BA91CA1147F00D55A14 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 826294421AAF071500CB7CF7 /* Security.framework */; }; 4B5C5BAB1CA1149900D55A14 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B5C5BAA1CA1149900D55A14 /* Security.framework */; }; @@ -711,7 +717,6 @@ 4B5C5BAE1CA114B500D55A14 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B5C5BAA1CA1149900D55A14 /* Security.framework */; }; 4B5C5BAF1CA114BB00D55A14 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B5C5BAA1CA1149900D55A14 /* Security.framework */; }; 4B5C5BB01CA114C100D55A14 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B5C5BAA1CA1149900D55A14 /* Security.framework */; }; - 4B5C5BB11CA114C700D55A14 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B5C5BAA1CA1149900D55A14 /* Security.framework */; }; 4B5C5BB21CA114CC00D55A14 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B5C5BAA1CA1149900D55A14 /* Security.framework */; }; 4B5C5BB31CA114D400D55A14 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B5C5BAA1CA1149900D55A14 /* Security.framework */; }; 4B5C5BB51CA114DB00D55A14 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B5C5BB41CA114DB00D55A14 /* Security.framework */; }; @@ -1058,7 +1063,6 @@ 50D6E2511D1D1782000974D4 /* VRTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 504C949A1D1C51BE00E4E9B3 /* VRTest.cpp */; }; 50FC18521C3371C000DD15A3 /* AppDelegate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50FC17C51C3371C000DD15A3 /* AppDelegate.cpp */; }; 50FC188C1C3371C000DD15A3 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 50FC18211C3371C000DD15A3 /* InfoPlist.strings */; }; - 50FC188D1C3371C000DD15A3 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 50FC18231C3371C000DD15A3 /* MainMenu.xib */; }; 50FC188E1C3371C000DD15A3 /* Icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 50FC18251C3371C000DD15A3 /* Icon.icns */; }; 50FC188F1C3371C000DD15A3 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 50FC18261C3371C000DD15A3 /* main.cpp */; }; 50FC18B01C3371D400DD15A3 /* res in Resources */ = {isa = PBXBuildFile; fileRef = 50FC18AE1C3371D400DD15A3 /* res */; }; @@ -1112,7 +1116,6 @@ 50FC3F8B1D74BCC9001C936A /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C64824165F3934007D4F18 /* OpenGL.framework */; }; 50FC3F8C1D74BCC9001C936A /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 15C64822165F391E007D4F18 /* Cocoa.framework */; }; 50FC3F921D74BD5F001C936A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 503FAE1A1D74B6C30036585D /* InfoPlist.strings */; }; - 50FC3F931D74BD65001C936A /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 503FAE1C1D74B6C30036585D /* MainMenu.xib */; }; 50FC3F941D74BD68001C936A /* Icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 503FAE1E1D74B6C30036585D /* Icon.icns */; }; 50FC3F951D74BD6F001C936A /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 503FAE201D74B6C30036585D /* main.cpp */; }; 50FC3F9C1D74C039001C936A /* AppDelegate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E6176B71960FA6300DE83F5 /* AppDelegate.cpp */; }; @@ -1127,8 +1130,10 @@ 527B1F3C19EFACBB000A1F82 /* Default-667h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 527B1F3A19EFACBB000A1F82 /* Default-667h@2x.png */; }; 527B1F3D19EFACBB000A1F82 /* Default-736h@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 527B1F3B19EFACBB000A1F82 /* Default-736h@3x.png */; }; 52B47A341A534B2B004E4C60 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52B47A331A534B2B004E4C60 /* Security.framework */; }; - 52B47A351A53A43A004E4C60 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 52B47A331A534B2B004E4C60 /* Security.framework */; }; 53367D561DC22891005862DE /* WindowTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53367D541DC22891005862DE /* WindowTest.cpp */; }; + 53E6A008218FA06E002BE515 /* InputTest in Resources */ = {isa = PBXBuildFile; fileRef = 53E6A007218FA06D002BE515 /* InputTest */; }; + 53E6A009218FA06E002BE515 /* InputTest in Resources */ = {isa = PBXBuildFile; fileRef = 53E6A007218FA06D002BE515 /* InputTest */; }; + 53E6A00A218FA06E002BE515 /* InputTest in Resources */ = {isa = PBXBuildFile; fileRef = 53E6A007218FA06D002BE515 /* InputTest */; }; 59620E8F1921E5CF002021B6 /* Bug-Child.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59620E8D1921E5CF002021B6 /* Bug-Child.cpp */; }; 59620E901921E5CF002021B6 /* Bug-Child.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59620E8D1921E5CF002021B6 /* Bug-Child.cpp */; }; 59E170151AB42EB10007F2BF /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 826294421AAF071500CB7CF7 /* Security.framework */; }; @@ -1775,7 +1780,6 @@ 185664201B422FFF009EF2AE /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RootViewController.h; sourceTree = ""; }; 185664211B422FFF009EF2AE /* RootViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RootViewController.mm; sourceTree = ""; }; 185664421B423047009EF2AE /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; - 185664441B423047009EF2AE /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainMenu.xib; sourceTree = ""; }; 185664451B423047009EF2AE /* Icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = Icon.icns; sourceTree = ""; }; 185664461B423047009EF2AE /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = ""; }; 185664471B423047009EF2AE /* Test_Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Test_Info.plist; sourceTree = ""; }; @@ -1825,7 +1829,6 @@ 1AC358D818CEC1CB00F37B72 /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RootViewController.h; sourceTree = ""; }; 1AC358D918CEC1CB00F37B72 /* RootViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RootViewController.mm; sourceTree = ""; }; 1AC358EE18CEC1D400F37B72 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; - 1AC358F018CEC1D400F37B72 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainMenu.xib; sourceTree = ""; }; 1AC358F318CEC1D400F37B72 /* Icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = Icon.icns; sourceTree = ""; }; 1AC358F418CEC1D400F37B72 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = ""; }; 1AC358FE18CEC1FB00F37B72 /* bang.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = bang.png; path = "../tests/cpp-empty-test/Resources/bang.png"; sourceTree = ""; }; @@ -2053,7 +2056,6 @@ 1AC35C7218CECF1400F37B72 /* testsAppDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = testsAppDelegate.mm; sourceTree = ""; }; 1AC35C8418CECF1400F37B72 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 1AC35C9C18CECF1E00F37B72 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; - 1AC35C9E18CECF1E00F37B72 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainMenu.xib; sourceTree = ""; }; 1AC35C9F18CECF1E00F37B72 /* Icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = Icon.icns; sourceTree = ""; }; 1AC35CA018CECF1E00F37B72 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = ""; }; 1AC35CA918CED84500F37B72 /* animations */ = {isa = PBXFileReference; lastKnownFileType = folder; name = animations; path = "../tests/cpp-tests/Resources/animations"; sourceTree = ""; }; @@ -2095,7 +2097,6 @@ 1AC35D4318CEDE9400F37B72 /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RootViewController.h; sourceTree = ""; }; 1AC35D4418CEDE9400F37B72 /* RootViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RootViewController.mm; sourceTree = ""; }; 1AC35D5518CEDE9E00F37B72 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; - 1AC35D5718CEDE9E00F37B72 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainMenu.xib; sourceTree = ""; }; 1AC35D5818CEDE9E00F37B72 /* HelloLua_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HelloLua_Prefix.pch; sourceTree = ""; }; 1AC35D5918CEDE9E00F37B72 /* Icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = Icon.icns; sourceTree = ""; }; 1AC35D5A18CEDE9E00F37B72 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -2114,7 +2115,6 @@ 1AC35D9618CEE5D100F37B72 /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RootViewController.h; sourceTree = ""; }; 1AC35D9718CEE5D100F37B72 /* RootViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RootViewController.mm; sourceTree = ""; }; 1AC35DA918CEE5DA00F37B72 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; - 1AC35DAB18CEE5DA00F37B72 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainMenu.xib; sourceTree = ""; }; 1AC35DAC18CEE5DA00F37B72 /* Icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = Icon.icns; sourceTree = ""; }; 1AC35DAD18CEE5DA00F37B72 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 1AC35DAE18CEE5DA00F37B72 /* LuaObjectCBridgeTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LuaObjectCBridgeTest.h; sourceTree = ""; }; @@ -2237,13 +2237,16 @@ 463D7E791D227C3800EA6BD1 /* Bug-14327.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Bug-14327.h"; sourceTree = ""; }; 463D7E7A1D227C3800EA6BD1 /* Bug-15776.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "Bug-15776.cpp"; sourceTree = ""; }; 463D7E7B1D227C3800EA6BD1 /* Bug-15776.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Bug-15776.h"; sourceTree = ""; }; + 467AF5A3231E004C00770112 /* AVKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/AVKit.framework; sourceTree = DEVELOPER_DIR; }; + 467AF5A5231E079F00770112 /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/CoreMedia.framework; sourceTree = DEVELOPER_DIR; }; + 467AF5A7231E4AA500770112 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; }; + 467AF5DE231FA82500770112 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/WebKit.framework; sourceTree = DEVELOPER_DIR; }; 46A15F9C1807A4F8005B8026 /* cocos2d_libs.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = cocos2d_libs.xcodeproj; sourceTree = ""; }; 4B5C5BAA1CA1149900D55A14 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Security.framework; sourceTree = DEVELOPER_DIR; }; 4B5C5BB41CA114DB00D55A14 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/System/Library/Frameworks/Security.framework; sourceTree = DEVELOPER_DIR; }; 500D1CD11CF4A48B00535D35 /* Bug-15594.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "Bug-15594.cpp"; sourceTree = ""; }; 500D1CD21CF4A48B00535D35 /* Bug-15594.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Bug-15594.h"; sourceTree = ""; }; 503FAE1B1D74B6C30036585D /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; - 503FAE1D1D74B6C30036585D /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainMenu.xib; sourceTree = ""; }; 503FAE1E1D74B6C30036585D /* Icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = Icon.icns; sourceTree = ""; }; 503FAE1F1D74B6C30036585D /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 503FAE201D74B6C30036585D /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = ""; }; @@ -2284,7 +2287,6 @@ 50FC181C1C3371C000DD15A3 /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RootViewController.h; sourceTree = ""; }; 50FC181D1C3371C000DD15A3 /* RootViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RootViewController.mm; sourceTree = ""; }; 50FC18221C3371C000DD15A3 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; - 50FC18241C3371C000DD15A3 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainMenu.xib; sourceTree = ""; }; 50FC18251C3371C000DD15A3 /* Icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = Icon.icns; sourceTree = ""; }; 50FC18261C3371C000DD15A3 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = ""; }; 50FC18271C3371C000DD15A3 /* Test_Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Test_Info.plist; sourceTree = ""; }; @@ -2302,6 +2304,7 @@ 52B47A331A534B2B004E4C60 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Security.framework; sourceTree = DEVELOPER_DIR; }; 53367D541DC22891005862DE /* WindowTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WindowTest.cpp; sourceTree = ""; }; 53367D551DC22891005862DE /* WindowTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WindowTest.h; sourceTree = ""; }; + 53E6A007218FA06D002BE515 /* InputTest */ = {isa = PBXFileReference; lastKnownFileType = folder; name = InputTest; path = "../tests/cpp-tests/Resources/InputTest"; sourceTree = ""; }; 59620E8D1921E5CF002021B6 /* Bug-Child.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "Bug-Child.cpp"; sourceTree = ""; }; 59620E8E1921E5CF002021B6 /* Bug-Child.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Bug-Child.h"; sourceTree = ""; }; 5EBEECAE1995247000429821 /* DrawNode3D.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DrawNode3D.cpp; path = Sprite3DTest/DrawNode3D.cpp; sourceTree = ""; }; @@ -2488,14 +2491,15 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 467AF5E2231FA87100770112 /* WebKit.framework in Frameworks */, + 467AF5AE231E4C4900770112 /* CoreMedia.framework in Frameworks */, + 467AF5AD231E4C4300770112 /* AVKit.framework in Frameworks */, C8DE9E491F0EAECD00B48C6B /* GameController.framework in Frameworks */, 294D7D8F1D0E50B2002CE7B7 /* CoreText.framework in Frameworks */, - 4B5C5BB11CA114C700D55A14 /* Security.framework in Frameworks */, 18FC4D5F1B4257CD00B76F95 /* libsqlite3.dylib in Frameworks */, 185663F01B41569E009EF2AE /* libjscocos2d iOS.a in Frameworks */, 185663A51B4155DD009EF2AE /* Security.framework in Frameworks */, 185663A71B4155DD009EF2AE /* libcocos2d iOS.a in Frameworks */, - 185663A81B4155DD009EF2AE /* MediaPlayer.framework in Frameworks */, 185663A91B4155DD009EF2AE /* libz.dylib in Frameworks */, ED545A791B68A1B900C3958E /* libiconv.dylib in Frameworks */, 185663AA1B4155DD009EF2AE /* CoreMotion.framework in Frameworks */, @@ -2553,6 +2557,9 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 467AF5E5231FA88D00770112 /* WebKit.framework in Frameworks */, + 467AF5E4231FA88700770112 /* CoreMedia.framework in Frameworks */, + 467AF5E3231FA88100770112 /* AVKit.framework in Frameworks */, 294D7D8A1D0E5093002CE7B7 /* CoreText.framework in Frameworks */, 4B5C5BAC1CA114A300D55A14 /* Security.framework in Frameworks */, 1A0EE40318CDF775004CD58F /* libcocos2d iOS.a in Frameworks */, @@ -2574,12 +2581,14 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 467AF5E1231FA85D00770112 /* WebKit.framework in Frameworks */, + 467AF5AC231E4BED00770112 /* CoreMedia.framework in Frameworks */, + 467AF5AB231E4BE500770112 /* AVKit.framework in Frameworks */, 294D7D8C1D0E50A0002CE7B7 /* CoreText.framework in Frameworks */, 4B5C5BAE1CA114B500D55A14 /* Security.framework in Frameworks */, ED545A761B68A1B600C3958E /* libiconv.dylib in Frameworks */, 15EFA68B198B3AD8000C57D3 /* libcocos2d iOS.a in Frameworks */, 15EFA68D198B3AD8000C57D3 /* libluacocos2d iOS.a in Frameworks */, - 15AECE25195D467D00907DB0 /* MediaPlayer.framework in Frameworks */, 1A0EE42C18CDF799004CD58F /* libz.dylib in Frameworks */, 1A0EE42D18CDF799004CD58F /* CoreMotion.framework in Frameworks */, 1A0EE42E18CDF799004CD58F /* AudioToolbox.framework in Frameworks */, @@ -2617,12 +2626,13 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 467AF5E0231FA84F00770112 /* WebKit.framework in Frameworks */, + 467AF5AA231E4BA600770112 /* AVKit.framework in Frameworks */, + 467AF5A9231E4B2500770112 /* CoreMedia.framework in Frameworks */, 294D7D8B1D0E509A002CE7B7 /* CoreText.framework in Frameworks */, 4B5C5BAD1CA114AC00D55A14 /* Security.framework in Frameworks */, - 52B47A351A53A43A004E4C60 /* Security.framework in Frameworks */, 15EFA66F198B356E000C57D3 /* libluacocos2d iOS.a in Frameworks */, 15EFA666198B34D7000C57D3 /* libcocos2d iOS.a in Frameworks */, - 15AECE0B195C0F8A00907DB0 /* MediaPlayer.framework in Frameworks */, 1ABCA3B018CDA06D0087CE3A /* libz.dylib in Frameworks */, 1ABCA3AA18CD9F1A0087CE3A /* CoreMotion.framework in Frameworks */, 1ABCA3A918CD9F130087CE3A /* AudioToolbox.framework in Frameworks */, @@ -2840,11 +2850,13 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 467AF5DF231FA82500770112 /* WebKit.framework in Frameworks */, + 467AF5A6231E079F00770112 /* CoreMedia.framework in Frameworks */, + 467AF5A4231E004C00770112 /* AVKit.framework in Frameworks */, 29DC5A201CFFE6E100CF2930 /* CoreText.framework in Frameworks */, 4B5C5BAB1CA1149900D55A14 /* Security.framework in Frameworks */, ED545A731B68A1AC00C3958E /* libiconv.dylib in Frameworks */, 52B47A341A534B2B004E4C60 /* Security.framework in Frameworks */, - 3EA0FB66191B933000B170C8 /* MediaPlayer.framework in Frameworks */, 1AAF5400180E39D4000584C8 /* libcocos2d iOS.a in Frameworks */, D60AE43417F7FFE100757E4B /* CoreMotion.framework in Frameworks */, A07A521E1783A1D20073F6A7 /* libz.dylib in Frameworks */, @@ -3051,7 +3063,6 @@ isa = PBXGroup; children = ( 185664411B423047009EF2AE /* InfoPlist.strings */, - 185664431B423047009EF2AE /* MainMenu.xib */, 185664451B423047009EF2AE /* Icon.icns */, 185664461B423047009EF2AE /* main.cpp */, 185664471B423047009EF2AE /* Test_Info.plist */, @@ -3157,7 +3168,6 @@ 1AC3590D18CEC25300F37B72 /* Info.plist */, 1AC358ED18CEC1D400F37B72 /* InfoPlist.strings */, 1AC358F418CEC1D400F37B72 /* main.cpp */, - 1AC358EF18CEC1D400F37B72 /* MainMenu.xib */, ); name = proj.mac; path = "../tests/cpp-empty-test/proj.mac"; @@ -3940,7 +3950,6 @@ children = ( 1AC35D0C18CED89100F37B72 /* Info.plist */, 1AC35C9B18CECF1E00F37B72 /* InfoPlist.strings */, - 1AC35C9D18CECF1E00F37B72 /* MainMenu.xib */, 1AC35C9F18CECF1E00F37B72 /* Icon.icns */, 1AC35CA018CECF1E00F37B72 /* main.cpp */, ); @@ -3976,6 +3985,7 @@ 1AC35CBC18CED84500F37B72 /* hd */, 1AC35CBD18CED84500F37B72 /* Hello.png */, 1AC35CBE18CED84500F37B72 /* Images */, + 53E6A007218FA06D002BE515 /* InputTest */, 15B3709219EE5D1000ABE682 /* Manifests */, 5046AB5A1AF2C4180060550B /* Materials */, 1AC35CC118CED84500F37B72 /* Misc */, @@ -4049,7 +4059,6 @@ isa = PBXGroup; children = ( 1AC35D5418CEDE9E00F37B72 /* InfoPlist.strings */, - 1AC35D5618CEDE9E00F37B72 /* MainMenu.xib */, 1AC35D5818CEDE9E00F37B72 /* HelloLua_Prefix.pch */, 1AC35D5918CEDE9E00F37B72 /* Icon.icns */, 1AC35D5A18CEDE9E00F37B72 /* Info.plist */, @@ -4124,7 +4133,6 @@ isa = PBXGroup; children = ( 1AC35DA818CEE5DA00F37B72 /* InfoPlist.strings */, - 1AC35DAA18CEE5DA00F37B72 /* MainMenu.xib */, 1AC35DAC18CEE5DA00F37B72 /* Icon.icns */, 1AC35DAD18CEE5DA00F37B72 /* Info.plist */, 1AC35DAE18CEE5DA00F37B72 /* LuaObjectCBridgeTest.h */, @@ -4358,6 +4366,10 @@ 29B97323FDCFA39411CA2CEA /* Frameworks */ = { isa = PBXGroup; children = ( + 467AF5DE231FA82500770112 /* WebKit.framework */, + 467AF5A7231E4AA500770112 /* UIKit.framework */, + 467AF5A5231E079F00770112 /* CoreMedia.framework */, + 467AF5A3231E004C00770112 /* AVKit.framework */, C8DE9E481F0EAECD00B48C6B /* GameController.framework */, 50FC3FA01D74C15B001C936A /* GameController.framework */, 29DC5A1E1CFFE5E700CF2930 /* CoreText.framework */, @@ -4573,7 +4585,6 @@ isa = PBXGroup; children = ( 503FAE1A1D74B6C30036585D /* InfoPlist.strings */, - 503FAE1C1D74B6C30036585D /* MainMenu.xib */, 503FAE1E1D74B6C30036585D /* Icon.icns */, 503FAE1F1D74B6C30036585D /* Info.plist */, 503FAE201D74B6C30036585D /* main.cpp */, @@ -4672,7 +4683,6 @@ isa = PBXGroup; children = ( 50FC18211C3371C000DD15A3 /* InfoPlist.strings */, - 50FC18231C3371C000DD15A3 /* MainMenu.xib */, 50FC18251C3371C000DD15A3 /* Icon.icns */, 50FC18261C3371C000DD15A3 /* main.cpp */, 50FC18271C3371C000DD15A3 /* Test_Info.plist */, @@ -5488,7 +5498,6 @@ buildActionMask = 2147483647; files = ( 1856645B1B4236A0009EF2AE /* InfoPlist.strings in Resources */, - 185664591B423687009EF2AE /* MainMenu.xib in Resources */, 1856645A1B423687009EF2AE /* main.js in Resources */, 185664581B423672009EF2AE /* src in Resources */, 185664571B423662009EF2AE /* Icon.icns in Resources */, @@ -5524,7 +5533,6 @@ 1AC3590B18CEC1FB00F37B72 /* iphone in Resources */, 1AC358F818CEC1D400F37B72 /* Icon.icns in Resources */, 1AC3590518CEC1FB00F37B72 /* fonts in Resources */, - 1AC358F618CEC1D400F37B72 /* MainMenu.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -5533,7 +5541,6 @@ buildActionMask = 2147483647; files = ( 1AC35D5C18CEDE9E00F37B72 /* InfoPlist.strings in Resources */, - 1AC35D5D18CEDE9E00F37B72 /* MainMenu.xib in Resources */, 1AC35D5E18CEDE9E00F37B72 /* Icon.icns in Resources */, 1AC35D2918CEDE7200F37B72 /* res in Resources */, 1AC35D2B18CEDE7200F37B72 /* src in Resources */, @@ -5591,7 +5598,6 @@ 1AC35DE218CEE65900F37B72 /* effect2.ogg in Resources */, 1AC35DB118CEE5DA00F37B72 /* InfoPlist.strings in Resources */, 1AC35DDD18CEE65900F37B72 /* CocosBuilderExample.ccbproj in Resources */, - 1AC35DB218CEE5DA00F37B72 /* MainMenu.xib in Resources */, 1AC35DBF18CEE65100F37B72 /* hd in Resources */, 1AC35DC818CEE65100F37B72 /* TileMaps in Resources */, 1AC35DBE18CEE65100F37B72 /* fonts in Resources */, @@ -5699,6 +5705,7 @@ 5046AB5B1AF2C4180060550B /* Materials in Resources */, B63993311A49359F00B07923 /* Particle3D in Resources */, 1AC35CEC18CED84500F37B72 /* fonts in Resources */, + 53E6A008218FA06E002BE515 /* InputTest in Resources */, 460629781CDB4DBA00B44058 /* ccs-res in Resources */, 1AC35CCA18CED84500F37B72 /* animations in Resources */, 1AC35CEA18CED84500F37B72 /* fileLookup.plist in Resources */, @@ -5712,7 +5719,6 @@ 1AC35CD618CED84500F37B72 /* CocosBuilderExample.ccbproj in Resources */, 3E92EA851921A7720094CD21 /* Sprite3DTest in Resources */, 1AC35CA318CECF1E00F37B72 /* InfoPlist.strings in Resources */, - 1AC35CA418CECF1E00F37B72 /* MainMenu.xib in Resources */, B603F1B41AC8FBFB00A9579C /* TerrainTest in Resources */, 1AC35CD418CED84500F37B72 /* ccb in Resources */, C08689C118D370C90093E810 /* background.caf in Resources */, @@ -5776,6 +5782,7 @@ 507B41211C31BEA60067B53E /* animations in Resources */, 507B41221C31BEA60067B53E /* cocosvideo.mp4 in Resources */, 507B41231C31BEA60067B53E /* Sprite3DTest in Resources */, + 53E6A00A218FA06E002BE515 /* InputTest in Resources */, 507B41251C31BEA60067B53E /* hd in Resources */, 507B41271C31BEA60067B53E /* Misc in Resources */, 507B41281C31BEA60067B53E /* Hello.png in Resources */, @@ -5885,7 +5892,6 @@ buildActionMask = 2147483647; files = ( 50FC18B11C3371D400DD15A3 /* src in Resources */, - 50FC188D1C3371C000DD15A3 /* MainMenu.xib in Resources */, 50FC18B01C3371D400DD15A3 /* res in Resources */, 50FC18B31C33720300DD15A3 /* script in Resources */, 50FC188E1C3371C000DD15A3 /* Icon.icns in Resources */, @@ -5924,7 +5930,6 @@ 50FC3F941D74BD68001C936A /* Icon.icns in Resources */, 50FC3F921D74BD5F001C936A /* InfoPlist.strings in Resources */, 50FC3FA71D74C268001C936A /* iphone in Resources */, - 50FC3F931D74BD65001C936A /* MainMenu.xib in Resources */, 50FC3FA41D74C268001C936A /* fonts in Resources */, 50FC3FA51D74C268001C936A /* ipad in Resources */, ); @@ -5949,6 +5954,7 @@ 1AC35CE918CED84500F37B72 /* extensions in Resources */, 3E2BDAD219BEA3E20055CDCD /* audio in Resources */, 5046AB5C1AF2C4180060550B /* Materials in Resources */, + 53E6A009218FA06E002BE515 /* InputTest in Resources */, C08689C318D370C90093E810 /* background.caf in Resources */, 15B3709419EE5D1000ABE682 /* Manifests in Resources */, 1AC35D0B18CED84500F37B72 /* zwoptex in Resources */, @@ -7132,14 +7138,6 @@ name = InfoPlist.strings; sourceTree = ""; }; - 185664431B423047009EF2AE /* MainMenu.xib */ = { - isa = PBXVariantGroup; - children = ( - 185664441B423047009EF2AE /* en */, - ); - name = MainMenu.xib; - sourceTree = ""; - }; 1AC358ED18CEC1D400F37B72 /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( @@ -7148,14 +7146,6 @@ name = InfoPlist.strings; sourceTree = ""; }; - 1AC358EF18CEC1D400F37B72 /* MainMenu.xib */ = { - isa = PBXVariantGroup; - children = ( - 1AC358F018CEC1D400F37B72 /* en */, - ); - name = MainMenu.xib; - sourceTree = ""; - }; 1AC35C9B18CECF1E00F37B72 /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( @@ -7164,14 +7154,6 @@ name = InfoPlist.strings; sourceTree = ""; }; - 1AC35C9D18CECF1E00F37B72 /* MainMenu.xib */ = { - isa = PBXVariantGroup; - children = ( - 1AC35C9E18CECF1E00F37B72 /* en */, - ); - name = MainMenu.xib; - sourceTree = ""; - }; 1AC35D5418CEDE9E00F37B72 /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( @@ -7180,14 +7162,6 @@ name = InfoPlist.strings; sourceTree = ""; }; - 1AC35D5618CEDE9E00F37B72 /* MainMenu.xib */ = { - isa = PBXVariantGroup; - children = ( - 1AC35D5718CEDE9E00F37B72 /* en */, - ); - name = MainMenu.xib; - sourceTree = ""; - }; 1AC35DA818CEE5DA00F37B72 /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( @@ -7196,14 +7170,6 @@ name = InfoPlist.strings; sourceTree = ""; }; - 1AC35DAA18CEE5DA00F37B72 /* MainMenu.xib */ = { - isa = PBXVariantGroup; - children = ( - 1AC35DAB18CEE5DA00F37B72 /* en */, - ); - name = MainMenu.xib; - sourceTree = ""; - }; 503FAE1A1D74B6C30036585D /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( @@ -7212,14 +7178,6 @@ name = InfoPlist.strings; sourceTree = ""; }; - 503FAE1C1D74B6C30036585D /* MainMenu.xib */ = { - isa = PBXVariantGroup; - children = ( - 503FAE1D1D74B6C30036585D /* en */, - ); - name = MainMenu.xib; - sourceTree = ""; - }; 50FC18211C3371C000DD15A3 /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( @@ -7228,14 +7186,6 @@ name = InfoPlist.strings; sourceTree = ""; }; - 50FC18231C3371C000DD15A3 /* MainMenu.xib */ = { - isa = PBXVariantGroup; - children = ( - 50FC18241C3371C000DD15A3 /* en */, - ); - name = MainMenu.xib; - sourceTree = ""; - }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ @@ -7336,7 +7286,7 @@ ); PRODUCT_NAME = "js-tests Mac"; SCAN_ALL_SOURCE_FILES_FOR_INCLUDES = YES; - USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../external/glfw3/include/mac $(SRCROOT)/../external/spidermonkey/include/mac $(SRCROOT)/.. $(SRCROOT)/../cocos $(SRCROOT)/../extensions $(SRCROOT)/../external"; + USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../external/glfw3/include/mac $(SRCROOT)/../external/spidermonkey/include/mac $(SRCROOT)/.. $(SRCROOT)/../cocos $(SRCROOT)/../extensions $(SRCROOT)/../external $(SRCROOT)/../tests/js-tests/project/Classes"; }; name = Debug; }; @@ -7368,7 +7318,7 @@ ); PRODUCT_NAME = "js-tests Mac"; SCAN_ALL_SOURCE_FILES_FOR_INCLUDES = YES; - USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../external/glfw3/include/mac $(SRCROOT)/../external/spidermonkey/include/mac $(SRCROOT)/.. $(SRCROOT)/../cocos $(SRCROOT)/../extensions $(SRCROOT)/../external"; + USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../external/glfw3/include/mac $(SRCROOT)/../external/spidermonkey/include/mac $(SRCROOT)/.. $(SRCROOT)/../cocos $(SRCROOT)/../extensions $(SRCROOT)/../external $(SRCROOT)/../tests/js-tests/project/Classes"; VALIDATE_PRODUCT = YES; }; name = Release; @@ -7401,7 +7351,7 @@ SDKROOT = iphoneos; STRIP_PNG_TEXT = NO; TARGETED_DEVICE_FAMILY = "1,2"; - USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/.. $(SRCROOT)/../cocos $(SRCROOT)/../extensions $(SRCROOT)/../external $(inherited) $(SRCROOT)/../external/spidermonkey/include/ios $(SRCROOT)/../external/curl/include/ios"; + USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/.. $(SRCROOT)/../cocos $(SRCROOT)/../extensions $(SRCROOT)/../external $(inherited) $(SRCROOT)/../external/spidermonkey/include/ios $(SRCROOT)/../external/curl/include/ios $(SRCROOT)/../tests/js-tests/project/Classes"; VALID_ARCHS = "arm64 armv7"; }; name = Debug; @@ -7435,7 +7385,7 @@ SDKROOT = iphoneos; STRIP_PNG_TEXT = NO; TARGETED_DEVICE_FAMILY = "1,2"; - USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/.. $(SRCROOT)/../cocos $(SRCROOT)/../extensions $(SRCROOT)/../external $(inherited) $(SRCROOT)/../external/spidermonkey/include/ios $(SRCROOT)/../external/curl/include/ios"; + USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/.. $(SRCROOT)/../cocos $(SRCROOT)/../extensions $(SRCROOT)/../external $(inherited) $(SRCROOT)/../external/spidermonkey/include/ios $(SRCROOT)/../external/curl/include/ios $(SRCROOT)/../tests/js-tests/project/Classes"; VALIDATE_PRODUCT = YES; VALID_ARCHS = "arm64 armv7"; }; @@ -7485,7 +7435,7 @@ "-image_base", 100000000, ); - USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/.. $(SRCROOT)/../external/glfw3/include/mac $(SRCROOT)/../external $(SRCROOT)/../external/lua/luajit/include $(SRCROOT)/../external/lua/tolua"; + USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/.. $(SRCROOT)/../external/glfw3/include/mac $(SRCROOT)/../external $(SRCROOT)/../external/lua/luajit/include $(SRCROOT)/../external/lua/tolua $(SRCROOT)/../tests/lua-empty-test/project/Classes"; }; name = Debug; }; @@ -7504,7 +7454,7 @@ "-image_base", 100000000, ); - USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/.. $(SRCROOT)/../external/glfw3/include/mac $(SRCROOT)/../external $(SRCROOT)/../external/lua/luajit/include $(SRCROOT)/../external/lua/tolua"; + USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/.. $(SRCROOT)/../external/glfw3/include/mac $(SRCROOT)/../external $(SRCROOT)/../external/lua/luajit/include $(SRCROOT)/../external/lua/tolua $(SRCROOT)/../tests/lua-empty-test/project/Classes"; VALIDATE_PRODUCT = YES; }; name = Release; @@ -7512,6 +7462,7 @@ 1A0EE41118CDF775004CD58F /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-cpp-empty-test"; CODE_SIGN_IDENTITY = "iPhone Developer"; ENABLE_BITCODE = NO; @@ -7532,6 +7483,7 @@ 1A0EE41218CDF775004CD58F /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-cpp-empty-test"; CODE_SIGN_IDENTITY = "iPhone Developer"; ENABLE_BITCODE = NO; @@ -7560,6 +7512,7 @@ "$(inherited)", CC_TARGET_OS_IPHONE, ); + GCC_TREAT_WARNINGS_AS_ERRORS = NO; INFOPLIST_FILE = "$(SRCROOT)/../tests/lua-empty-test/project/proj.ios/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 6.0; LIBRARY_SEARCH_PATHS = ( @@ -7575,7 +7528,7 @@ SDKROOT = iphoneos; STRIP_PNG_TEXT = NO; TARGETED_DEVICE_FAMILY = "1,2"; - USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/.. $(SRCROOT)/../external $(SRCROOT)/../external/lua/luajit/include $(SRCROOT)/../external/lua/tolua"; + USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/.. $(SRCROOT)/../external $(SRCROOT)/../external/lua/luajit/include $(SRCROOT)/../external/lua/tolua $(SRCROOT)/../tests/lua-empty-test/project/Classes"; VALID_ARCHS = "arm64 armv7"; }; name = Debug; @@ -7590,6 +7543,7 @@ "$(inherited)", CC_TARGET_OS_IPHONE, ); + GCC_TREAT_WARNINGS_AS_ERRORS = NO; INFOPLIST_FILE = "$(SRCROOT)/../tests/lua-empty-test/project/proj.ios/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 6.0; LIBRARY_SEARCH_PATHS = ( @@ -7605,7 +7559,7 @@ SDKROOT = iphoneos; STRIP_PNG_TEXT = NO; TARGETED_DEVICE_FAMILY = "1,2"; - USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/.. $(SRCROOT)/../external $(SRCROOT)/../external/lua/luajit/include $(SRCROOT)/../external/lua/tolua"; + USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/.. $(SRCROOT)/../external $(SRCROOT)/../external/lua/luajit/include $(SRCROOT)/../external/lua/tolua $(SRCROOT)/../tests/lua-empty-test/project/Classes"; VALIDATE_PRODUCT = YES; VALID_ARCHS = "arm64 armv7"; }; @@ -7626,7 +7580,7 @@ "-image_base", 100000000, ); - USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/.. $(SRCROOT)/../external/glfw3/include/mac $(SRCROOT)/../external $(SRCROOT)/../external/lua/luajit/include $(SRCROOT)/../external/lua/tolua"; + USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/.. $(SRCROOT)/../external/glfw3/include/mac $(SRCROOT)/../external $(SRCROOT)/../external/lua/luajit/include $(SRCROOT)/../external/lua/tolua $(SRCROOT)/../tests/lua-tests/project/Classes"; }; name = Debug; }; @@ -7645,7 +7599,7 @@ "-image_base", 100000000, ); - USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/.. $(SRCROOT)/../external/glfw3/include/mac $(SRCROOT)/../external $(SRCROOT)/../external/lua/luajit/include $(SRCROOT)/../external/lua/tolua"; + USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/.. $(SRCROOT)/../external/glfw3/include/mac $(SRCROOT)/../external $(SRCROOT)/../external/lua/luajit/include $(SRCROOT)/../external/lua/tolua $(SRCROOT)/../tests/lua-tests/project/Classes"; VALIDATE_PRODUCT = YES; }; name = Release; @@ -7655,6 +7609,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-lua-tests"; CODE_SIGN_IDENTITY = "iPhone Developer"; + DEVELOPMENT_TEAM = ""; ENABLE_BITCODE = NO; GCC_PREPROCESSOR_DEFINITIONS = ( "$(inherited)", @@ -7675,7 +7630,7 @@ SDKROOT = iphoneos; STRIP_PNG_TEXT = NO; TARGETED_DEVICE_FAMILY = "1,2"; - USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/.. $(SRCROOT)/../external $(SRCROOT)/../external/lua/luajit/include $(SRCROOT)/../external/lua/tolua $(SRCROOT)/../external/curl/include/ios"; + USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/.. $(SRCROOT)/../external $(SRCROOT)/../external/lua/luajit/include $(SRCROOT)/../external/lua/tolua $(SRCROOT)/../external/curl/include/ios $(SRCROOT)/../tests/lua-tests/project/Classes"; VALID_ARCHS = "arm64 armv7"; }; name = Debug; @@ -7685,6 +7640,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-lua-tests"; CODE_SIGN_IDENTITY = "iPhone Developer"; + DEVELOPMENT_TEAM = ""; ENABLE_BITCODE = NO; GCC_PREPROCESSOR_DEFINITIONS = ( "$(inherited)", @@ -7705,7 +7661,7 @@ SDKROOT = iphoneos; STRIP_PNG_TEXT = NO; TARGETED_DEVICE_FAMILY = "1,2"; - USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/.. $(SRCROOT)/../external $(SRCROOT)/../external/lua/luajit/include $(SRCROOT)/../external/lua/tolua $(SRCROOT)/../external/curl/include/ios"; + USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/.. $(SRCROOT)/../external $(SRCROOT)/../external/lua/luajit/include $(SRCROOT)/../external/lua/tolua $(SRCROOT)/../external/curl/include/ios $(SRCROOT)/../tests/lua-tests/project/Classes"; VALIDATE_PRODUCT = YES; VALID_ARCHS = "arm64 armv7"; }; @@ -8240,7 +8196,7 @@ C01FCF4F08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = YES; + ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; CLANG_CXX_LIBRARY = "libc++"; COMBINE_HIDPI_IMAGES = YES; @@ -8255,7 +8211,7 @@ "CC_ENABLE_CHIPMUNK_INTEGRATION=1", ); GCC_SYMBOLS_PRIVATE_EXTERN = YES; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_TREAT_WARNINGS_AS_ERRORS = NO; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES; GCC_WARN_UNUSED_VARIABLE = YES; @@ -8271,7 +8227,7 @@ C01FCF5008A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = YES; + ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; CLANG_CXX_LIBRARY = "libc++"; COMBINE_HIDPI_IMAGES = YES; @@ -8283,7 +8239,7 @@ "CC_ENABLE_CHIPMUNK_INTEGRATION=1", ); GCC_SYMBOLS_PRIVATE_EXTERN = YES; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_TREAT_WARNINGS_AS_ERRORS = NO; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES; GCC_WARN_UNUSED_VARIABLE = YES; diff --git a/build/install-deps-linux.sh b/build/install-deps-linux.sh index 031e5c9b55b8..eb86ba7ae986 100755 --- a/build/install-deps-linux.sh +++ b/build/install-deps-linux.sh @@ -1,8 +1,6 @@ #!/bin/bash -# Change directory to the location of this script echo "This Shell Script will install dependencies for cocos2d-x" -echo "if you execute this shell more than once it will get errors when building libGLFW.so" echo -n "Are you continue? (y/n) " read answer if echo "$answer" | grep -iq "^y" ;then @@ -11,15 +9,6 @@ else exit fi -cd $(dirname ${BASH_SOURCE[0]}) - -if [ ! $(command -v apt-get) ]; then - echo "Not a .deb package system. Please install dependencies manually" - exit 0 -fi - -#install g++-4.9 -sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y > /dev/null sudo apt-get update DEPENDS='libx11-dev' @@ -27,10 +16,8 @@ DEPENDS+=' libxmu-dev' DEPENDS+=' libglu1-mesa-dev' DEPENDS+=' libgl2ps-dev' DEPENDS+=' libxi-dev' -DEPENDS+=' gcc-4.9' -DEPENDS+=' g++-4.9' DEPENDS+=' libzip-dev' -DEPENDS+=' libpng12-dev' +DEPENDS+=' libpng-dev' DEPENDS+=' libcurl4-gnutls-dev' DEPENDS+=' libfontconfig1-dev' DEPENDS+=' libsqlite3-dev' @@ -38,39 +25,6 @@ DEPENDS+=' libglew-dev' DEPENDS+=' libssl-dev' DEPENDS+=' libgtk-3-dev' DEPENDS+=' binutils' +DEPENDS+=' xorg-dev' -MISSING= -echo "Checking for missing packages ..." -for i in $DEPENDS; do - if ! dpkg-query -W --showformat='${Status}\n' $i | grep "install ok installed" > /dev/null; then - MISSING+="$i " - fi -done - -if [ -n "$MISSING" ]; then - TXTCOLOR_DEFAULT="\033[0;m" - TXTCOLOR_GREEN="\033[0;32m" - echo -e $TXTCOLOR_GREEN"Missing packages: $MISSING.\nYou may be asked for your password for package installation."$TXTCOLOR_DEFAULT - CUR_APT_VERSION="$(apt --version | grep -o '[0-9].[0-9]')" - REQ_APT_VERSION="1.1" - if [ 1 -ge "$(echo "${CUR_APT_VERSION} >= ${REQ_APT_VERSION}" | bc)" ] - then - sudo apt-get install --allow-change-held-packages $MISSING -y > /dev/null - else - sudo apt-get install --force-yes --yes $MISSING > /dev/null - fi -fi - - - -sudo update-alternatives --remove-all gcc -sudo update-alternatives --remove-all g++ - -sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 60 -sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 60 - -echo "Cocos uses GCC Version: `gcc --version`" -echo "Cocos uses G++ Version: `g++ --version`" -echo "Cocos uses ld Version: `ld --version`" -echo "Cocos uses /usr/bin/ld Version: `/usr/bin/ld --version`" - +sudo apt-get install --force-yes --yes $DEPENDS > /dev/null diff --git a/cmake/Modules/CocosBuildHelpers.cmake b/cmake/Modules/CocosBuildHelpers.cmake index ad3428a43f88..f9d46060b682 100644 --- a/cmake/Modules/CocosBuildHelpers.cmake +++ b/cmake/Modules/CocosBuildHelpers.cmake @@ -1,14 +1,20 @@ include(CMakeParseArguments) -# copy resource `FILES` and `FOLDERS` to `COPY_TO` folder -function(cocos_copy_res) +# copy resource `FILES` and `FOLDERS` to TARGET_FILE_DIR/Resources +function(cocos_copy_target_res cocos_target) set(oneValueArgs COPY_TO) set(multiValueArgs FILES FOLDERS) cmake_parse_arguments(opt "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + add_custom_command(TARGET ${cocos_target} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E echo "copying resources..." + ) # copy files foreach(cc_file ${opt_FILES}) get_filename_component(file_name ${cc_file} NAME) - configure_file(${cc_file} "${opt_COPY_TO}/${file_name}" COPYONLY) + add_custom_command(TARGET ${cocos_target} POST_BUILD + #COMMAND ${CMAKE_COMMAND} -E echo "copy file into Resources: ${file_name} ..." + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${cc_file} "${opt_COPY_TO}/${file_name}" + ) endforeach() # copy folders files foreach(cc_folder ${opt_FOLDERS}) @@ -17,7 +23,10 @@ function(cocos_copy_res) foreach(res_file ${folder_files}) get_filename_component(res_file_abs_path ${res_file} ABSOLUTE) file(RELATIVE_PATH res_file_relat_path ${folder_abs_path} ${res_file_abs_path}) - configure_file(${res_file} "${opt_COPY_TO}/${res_file_relat_path}" COPYONLY) + add_custom_command(TARGET ${cocos_target} POST_BUILD + #COMMAND ${CMAKE_COMMAND} -E echo "copy file into Resources: ${res_file_relat_path} ..." + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${res_file} "${opt_COPY_TO}/${res_file_relat_path}" + ) endforeach() endforeach() endfunction() @@ -45,54 +54,74 @@ function(cocos_mark_multi_resources res_out) set(${res_out} ${tmp_file_list} PARENT_SCOPE) endfunction() -# get `cocos_target` depend all dlls, save the result in `all_depend_dlls_out` -function(get_target_depends_ext_dlls cocos_target all_depend_dlls_out) - set(all_depend_ext_dlls) +# get all linked libraries including transitive ones, recursive +function(search_depend_libs_recursive cocos_target all_depends_out) + set(all_depends_inner) set(targets_prepare_search ${cocos_target}) - # targets_prepare_search, target need find ext libs - set(have_searched_targets) - set(need_search_targets) while(true) foreach(tmp_target ${targets_prepare_search}) - get_target_property(tmp_depend_libs ${tmp_target} LINK_LIBRARIES) - list(REMOVE_ITEM targets_prepare_search ${tmp_target}) - # target itself use_cocos_pkg - list(APPEND tmp_depend_libs ${tmp_target}) - foreach(depend_lib ${tmp_depend_libs}) - if(TARGET ${depend_lib}) - get_target_property(tmp_dlls ${depend_lib} CC_DEPEND_DLLS) - if(tmp_dlls) - list(APPEND all_depend_ext_dlls ${tmp_dlls}) - endif() - if(NOT (depend_lib STREQUAL tmp_target)) - list(APPEND targets_prepare_search ${depend_lib}) + get_target_property(target_type ${tmp_target} TYPE) + if(${target_type} STREQUAL "SHARED_LIBRARY" OR ${target_type} STREQUAL "STATIC_LIBRARY" OR ${target_type} STREQUAL "MODULE_LIBRARY" OR ${target_type} STREQUAL "EXECUTABLE") + #interface-only libraries do not support certain properties such as LINK_LIBRARIES + get_target_property(tmp_depend_libs ${tmp_target} LINK_LIBRARIES) + list(REMOVE_ITEM targets_prepare_search ${tmp_target}) + list(APPEND tmp_depend_libs ${tmp_target}) + foreach(depend_lib ${tmp_depend_libs}) + if(TARGET ${depend_lib}) + list(APPEND all_depends_inner ${depend_lib}) + if(NOT (depend_lib STREQUAL tmp_target)) + list(APPEND targets_prepare_search ${depend_lib}) + endif() endif() - endif() - endforeach() + endforeach() + else() + list(REMOVE_ITEM targets_prepare_search ${tmp_target}) + endif() endforeach() list(LENGTH targets_prepare_search targets_prepare_search_size) if(targets_prepare_search_size LESS 1) break() endif() endwhile(true) + set(${all_depends_out} ${all_depends_inner} PARENT_SCOPE) +endfunction() + +# get `cocos_target` depend all dlls, save the result in `all_depend_dlls_out` +function(get_target_depends_ext_dlls cocos_target all_depend_dlls_out) + + set(depend_libs) + set(all_depend_ext_dlls) + search_depend_libs_recursive(${cocos_target} depend_libs) + foreach(depend_lib ${depend_libs}) + if(TARGET ${depend_lib}) + get_target_property(target_type ${depend_lib} TYPE) + if(${target_type} STREQUAL "SHARED_LIBRARY" OR ${target_type} STREQUAL "STATIC_LIBRARY" OR ${target_type} STREQUAL "MODULE_LIBRARY" OR ${target_type} STREQUAL "EXECUTABLE") + #interface-only libraries do not support certain properties such as IMPORTED_IMPLIB + get_target_property(found_shared_lib ${depend_lib} IMPORTED_IMPLIB) + if(found_shared_lib) + get_target_property(tmp_dlls ${depend_lib} IMPORTED_LOCATION) + list(APPEND all_depend_ext_dlls ${tmp_dlls}) + endif() + endif() + endif() + endforeach() set(${all_depend_dlls_out} ${all_depend_ext_dlls} PARENT_SCOPE) endfunction() -# copy the `cocos_target` needed dlls into `COPY_TO` folder +# copy the `cocos_target` needed dlls into TARGET_FILE_DIR function(cocos_copy_target_dll cocos_target) - set(oneValueArgs COPY_TO) - cmake_parse_arguments(opt "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) get_target_depends_ext_dlls(${cocos_target} all_depend_dlls) # remove repeat items if(all_depend_dlls) list(REMOVE_DUPLICATES all_depend_dlls) endif() - # todo, add a option to enable/disable debug print - message(STATUS "prepare to copy external dlls for ${cocos_target}:${all_depend_dlls}") foreach(cc_dll_file ${all_depend_dlls}) get_filename_component(cc_dll_name ${cc_dll_file} NAME) - configure_file(${cc_dll_file} "${opt_COPY_TO}/${cc_dll_name}" COPYONLY) + add_custom_command(TARGET ${cocos_target} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E echo "copy dll into target file dir: ${cc_dll_name} ..." + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${cc_dll_file} "$/${cc_dll_name}" + ) endforeach() endfunction() @@ -158,32 +187,21 @@ function(source_group_single_file single_file) source_group("${ide_file_group}" FILES ${single_file}) endfunction() -# setup a cocos application, include "APP_BIN_DIR", "APP_RES_DIR" config +# setup a cocos application function(setup_cocos_app_config app_name) - # set target PROPERTIES, depend different platforms + # put all output app into bin/${app_name} + set_target_properties(${app_name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/${app_name}") if(APPLE) - set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin") - set_target_properties(${app_name} PROPERTIES MACOSX_BUNDLE 1 - ) + # output macOS/iOS .app + set_target_properties(${app_name} PROPERTIES MACOSX_BUNDLE 1) elseif(MSVC) - # only Debug and Release mode was supported when using MSVC. - set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin/${APP_NAME}/$") - set(APP_RES_DIR "${CMAKE_BINARY_DIR}/bin/${APP_NAME}/${CMAKE_BUILD_TYPE}") - #Visual Studio Defaults to wrong type - set_target_properties(${app_name} PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS") - else(LINUX) - set(APP_BIN_DIR "${CMAKE_BINARY_DIR}/bin/${CMAKE_BUILD_TYPE}/${APP_NAME}") - set(APP_RES_DIR "${APP_BIN_DIR}/Resources") + # visual studio default is Console app, but we need Windows app + set_property(TARGET ${app_name} APPEND PROPERTY LINK_FLAGS "/SUBSYSTEM:WINDOWS") endif() - set_target_properties(${app_name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${APP_BIN_DIR}") - # auto mark code files for IDE when mark app if(XCODE OR VS) - cocos_mark_code_files(${APP_NAME}) + cocos_mark_code_files(${app_name}) endif() - - set(APP_BIN_DIR ${APP_BIN_DIR} PARENT_SCOPE) - set(APP_RES_DIR ${APP_RES_DIR} PARENT_SCOPE) endfunction() # if cc_variable not set, then set it cc_value @@ -232,26 +250,18 @@ macro(cocos_pak_xcode cocos_target) set(MACOSX_BUNDLE_LONG_VERSION_STRING ${COCOS_APP_LONG_VERSION_STRING}) set(MACOSX_BUNDLE_SHORT_VERSION_STRING ${COCOS_APP_SHORT_VERSION_STRING}) - message("cocos package: ${cocos_target}, plist file: ${COCOS_APP_INFO_PLIST}") + message(STATUS "cocos package: ${cocos_target}, plist file: ${COCOS_APP_INFO_PLIST}") cocos_config_app_xcode_property(${cocos_target}) endmacro() # set Xcode property for application, include all depend target macro(cocos_config_app_xcode_property cocos_app) - cocos_config_target_xcode_property(${cocos_app}) - # for example, cocos_target: cpp-tests link engine_lib: cocos2d - get_target_property(engine_libs ${cocos_app} LINK_LIBRARIES) - foreach(engine_lib ${engine_libs}) - if(TARGET ${engine_lib}) - cocos_config_target_xcode_property(${engine_lib}) - # for example, engine_lib: cocos2d link external_lib: flatbuffers - get_target_property(external_libs ${engine_lib} LINK_LIBRARIES) - foreach(external_lib ${external_libs}) - if(TARGET ${external_lib}) - cocos_config_target_xcode_property(${external_lib}) - endif() - endforeach() + set(depend_libs) + search_depend_libs_recursive(${cocos_app} depend_libs) + foreach(depend_lib ${depend_libs}) + if(TARGET ${depend_lib}) + cocos_config_target_xcode_property(${depend_lib}) endif() endforeach() endmacro() @@ -259,7 +269,7 @@ endmacro() # custom Xcode property for iOS target macro(cocos_config_target_xcode_property cocos_target) if(IOS) - set_xcode_property(${cocos_target} IPHONEOS_DEPLOYMENT_TARGET "8.0") + set_xcode_property(${cocos_target} IPHONEOS_DEPLOYMENT_TARGET "9.0") set_xcode_property(${cocos_target} ENABLE_BITCODE "NO") set_xcode_property(${cocos_target} ONLY_ACTIVE_ARCH "YES") endif() diff --git a/cmake/Modules/CocosBuildSet.cmake b/cmake/Modules/CocosBuildSet.cmake index 31caf1d93d81..a78100e125f6 100644 --- a/cmake/Modules/CocosBuildSet.cmake +++ b/cmake/Modules/CocosBuildSet.cmake @@ -1,53 +1,38 @@ -# Disable in-source builds to prevent source tree corruption. -if(" ${CMAKE_SOURCE_DIR}" STREQUAL " ${CMAKE_BINARY_DIR}") - message(FATAL_ERROR " - FATAL: In-source builds are not allowed. - You should create a separate directory for build files. - ") -endif() - # print cmake debug info set(CMAKE_DEBUG_TARGET_PROPERTIES # INCLUDE_DIRECTORIES # COMPILE_DEFINITIONS + # COMPILE_OPTIONS + # AUTOUIC_OPTIONS # POSITION_INDEPENDENT_CODE - # CONTAINER_SIZE_REQUIRED - # LIB_VERSION ) -# It ensures that when Find*.cmake files included from cmake's Modules dir -# include another *.cmake file with relative path, that file will be included -# also from cmake's Modules dir, to not clash with per-project files. -cmake_policy(SET CMP0017 NEW) - -# Use new behaviour with cmake >= 3.1: -# Only interpret if() arguments as variables or keywords when unquoted. -cmake_policy(SET CMP0054 NEW) - -# print the info of CMAKE_TOOLCHAIN_FILE, if defined it -if(DEFINED CMAKE_TOOLCHAIN_FILE) - message(STATUS "using toolchain file: ${CMAKE_TOOLCHAIN_FILE}") -endif() # some useful variables for every one cocos project -set(COCOS_EXTERNAL_DIR ${COCOS2DX_ROOT_PATH}/external) set(ENGINE_BINARY_PATH ${PROJECT_BINARY_DIR}/engine) +if(CMAKE_TOOLCHAIN_FILE) + message(STATUS "using toolchain file:" ${CMAKE_TOOLCHAIN_FILE}) +endif() + message(STATUS "PROJECT_NAME:" ${PROJECT_NAME}) message(STATUS "PROJECT_SOURCE_DIR:" ${PROJECT_SOURCE_DIR}) message(STATUS "COCOS2DX_ROOT_PATH:" ${COCOS2DX_ROOT_PATH}) message(STATUS "CMAKE_MODULE_PATH:" ${CMAKE_MODULE_PATH}) -message(STATUS "COCOS_EXTERNAL_DIR:" ${COCOS_EXTERNAL_DIR}) # delete binary dir if you hope a full clean re-build message(STATUS "PROJECT_BINARY_DIR:" ${PROJECT_BINARY_DIR}) message(STATUS "ENGINE_BINARY_PATH:" ${ENGINE_BINARY_PATH}) -# include helper functions for cmake build -include(CocosBuildHelpers) -# select building modules -include(CocosSelectModule) +option(BUILD_LUA_LIBS "Build lua libraries" OFF) +option(BUILD_JS_LIBS "Build js libraries" OFF) + +# include helper functions +include(CocosBuildHelpers) # set common compiler options -include(CocosCompileOptions) +# add target compile define function +# add target compile options function +include(CocosConfigDefine) +# config libraries dependence include(CocosConfigDepend) diff --git a/cmake/Modules/CocosCompileOptions.cmake b/cmake/Modules/CocosCompileOptions.cmake deleted file mode 100644 index aba389de920c..000000000000 --- a/cmake/Modules/CocosCompileOptions.cmake +++ /dev/null @@ -1,191 +0,0 @@ - #cmake has some strange defaults, this should help us a lot - #Please use them everywhere - #WINDOWS = Windows Desktop - #ANDROID = Android - #IOS = iOS - #MACOSX = MacOS X - #LINUX = Linux - if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") - set(WINDOWS TRUE) - set(SYSTEM_STRING "Windows Desktop") - elseif(${CMAKE_SYSTEM_NAME} MATCHES "Android") - set(SYSTEM_STRING "Android") - elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") - if(ANDROID) - set(SYSTEM_STRING "Android") - else() - set(LINUX TRUE) - set(SYSTEM_STRING "Linux") - endif() - elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - if(IOS) - set(APPLE TRUE) - set(SYSTEM_STRING "IOS") - else() - set(APPLE TRUE) - set(MACOSX TRUE) - set(SYSTEM_STRING "Mac OSX") - endif() - endif() - - if(CMAKE_GENERATOR STREQUAL Xcode) - set(XCODE TRUE) - elseif(CMAKE_GENERATOR MATCHES Visual) - set(VS TRUE) - endif() - #Debug is default value - if(NOT CMAKE_BUILD_TYPE) - if(DEBUG_MODE) - set(CMAKE_BUILD_TYPE Debug) - else() - set(CMAKE_BUILD_TYPE Release) - endif() - endif() - # make configurations type keep same to cmake build type. prevent use generate debug project but switch release mode in IDE - if(CMAKE_GENERATOR) - set(CMAKE_CONFIGURATION_TYPES "${CMAKE_BUILD_TYPE}" CACHE STRING "Reset the configurations to what we need" FORCE) - endif() - message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}") - - # check and print compiler infos - if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - set(COMPILER_STRING ${CMAKE_CXX_COMPILER_ID}) - set(CLANG TRUE) - elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - if(MINGW) - set(COMPILER_STRING "Mingw GCC") - else() - set(COMPILER_STRING "GCC") - endif() - elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") - set(COMPILER_STRING "${CMAKE_CXX_COMPILER_ID} C++") - elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") - set(COMPILER_STRING "Visual Studio C++") - else() - set(COMPILER_STRING "${CMAKE_CXX_COMPILER_ID}") - endif() - if(CMAKE_CROSSCOMPILING) - set(BUILDING_STRING "It appears you are cross compiling for ${SYSTEM_STRING} with ${COMPILER_STRING}") - else() - set(BUILDING_STRING "It appears you are building natively for ${SYSTEM_STRING} with ${COMPILER_STRING}") - endif() - message(STATUS ${BUILDING_STRING}) - - # Set compiler options - if(MSVC) - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD") - set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:msvcrt /NODEFAULTLIB:libcmt") - set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:libcmt") - - add_definitions(-DUNICODE -D_UNICODE) - add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS - -wd4251 -wd4244 -wd4334 -wd4005 -wd4820 -wd4710 - -wd4514 -wd4056 -wd4996 -wd4099) - # multi thread compile option - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") - # Use inline Debug info (/Z7) format. Or internal error may occur. - # Errors looks like: "xmemory0(592): error C3130: Internal Compiler Error: failed to write injected code block to PDB" - foreach(lang C CXX) - string(REGEX REPLACE "/Z[iI7]" "" CMAKE_${lang}_FLAGS_DEBUG "${CMAKE_${lang}_FLAGS_DEBUG}") - set(CMAKE_${lang}_FLAGS_DEBUG "${CMAKE_${lang}_FLAGS_DEBUG} /Z7") - endforeach() - else() - set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g -Wall") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${CMAKE_C_FLAGS_DEBUG}") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -fPIC") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-deprecated-declarations -Wno-reorder -Wno-invalid-offsetof -fPIC") - if(CLANG AND NOT ANDROID) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") - endif() - if(LINUX) - add_definitions(-D_GNU_SOURCE) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -lrt") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread -lrt") - endif() - # specail options for android - if(ANDROID) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fexceptions") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsigned-char -fexceptions") - set(CMAKE_CXX_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY} -latomic") - if(CLANG AND ANDROID_ARM_MODE STREQUAL thumb AND ANDROID_ABI STREQUAL armeabi) - string(REPLACE "-mthumb" "-marm" CMAKE_C_FLAGS ${CMAKE_C_FLAGS}) - string(REPLACE "-mthumb" "-marm" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) - endif() - endif() - endif(MSVC) - - # Set common macro definitions - if(CMAKE_BUILD_TYPE STREQUAL "Debug") - add_definitions(-DCOCOS2D_DEBUG=1) - endif() - # Set macro definitions for special platforms - if(WINDOWS) - if(BUILD_SHARED_LIBS) - add_definitions(-D_USRDLL -D_EXPORT_DLL_ -D_USEGUIDLL -D_USREXDLL -D_USRSTUDIODLL) - else() - add_definitions(-DCC_STATIC) - endif() - add_definitions(-DCOCOS2DXWIN32_EXPORTS -D_WINDOWS -DWIN32 -D_WIN32) - set(PLATFORM_FOLDER win32) - elseif(APPLE) - add_definitions(-DUSE_FILE32API) - if(MACOSX) - add_definitions(-DTARGET_OS_MAC) - set(PLATFORM_FOLDER mac) - elseif(IOS) - add_definitions(-DTARGET_OS_IPHONE) - add_definitions(-DTARGET_OS_IOS) - set(PLATFORM_FOLDER ios) - endif(MACOSX) - elseif(LINUX) - add_definitions(-DLINUX) - set(PLATFORM_FOLDER linux) - elseif(ANDROID) - add_definitions(-DUSE_FILE32API) - set(PLATFORM_FOLDER android) - else() - message(FATAL_ERROR "Unsupported platform, CMake will exit") - return() - endif() - - if(CMAKE_FIND_ROOT_PATH) - # Adds cocos2d-x external folder to the list of valid include/library paths when cross-compiling and using prebuilds - set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH} ${COCOS_EXTERNAL_DIR}) - endif() - - # extra config for windows - if(WINDOWS) - # folder much targets - set_property(GLOBAL PROPERTY USE_FOLDERS ON) - # not support other compile tools except MSVC for now - if(MSVC) - # Visual Studio 2015, MSVC_VERSION 1900 (v140 toolset) - # Visual Studio 2017, MSVC_VERSION 1910-1919 (v141 toolset) - if(${MSVC_VERSION} EQUAL 1900 OR ${MSVC_VERSION} GREATER 1900) - message(STATUS "using Windows MSVC generate cocos2d-x project, MSVC_VERSION:${MSVC_VERSION}") - else() - message(FATAL_ERROR "using Windows MSVC generate cocos2d-x project, MSVC_VERSION:${MSVC_VERSION} lower than needed") - endif() - else() - message(FATAL_ERROR "please using Windows MSVC compile cocos2d-x project, support other compile tools not yet") - endif() - endif() - -# custom target property for dll collect -define_property(TARGET - PROPERTY CC_DEPEND_DLLS - BRIEF_DOCS "depend dlls of a target" - FULL_DOCS "use to save depend dlls of a target" -) -# custom target property for lua/js link -define_property(TARGET - PROPERTY CC_JS_DEPEND - BRIEF_DOCS "cocos2d js depend libs" - FULL_DOCS "use to save depend libs of cocos2d js project" -) -define_property(TARGET - PROPERTY CC_LUA_DEPEND - BRIEF_DOCS "cocos2d lua depend libs" - FULL_DOCS "use to save depend libs of cocos2d lua project" -) \ No newline at end of file diff --git a/cmake/Modules/CocosConfigDefine.cmake b/cmake/Modules/CocosConfigDefine.cmake new file mode 100644 index 000000000000..bc7b41a8239c --- /dev/null +++ b/cmake/Modules/CocosConfigDefine.cmake @@ -0,0 +1,120 @@ + #Please use them everywhere + #WINDOWS = Windows Desktop + #ANDROID = Android + #IOS = iOS + #MACOSX = MacOS X + #LINUX = Linux + if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") + set(WINDOWS TRUE) + set(PLATFORM_FOLDER win32) + elseif(${CMAKE_SYSTEM_NAME} MATCHES "Android") + set(PLATFORM_FOLDER android) + elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") + if(ANDROID) + set(PLATFORM_FOLDER android) + else() + set(LINUX TRUE) + set(PLATFORM_FOLDER linux) + endif() + elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + set(APPLE TRUE) + set(MACOSX TRUE) + set(PLATFORM_FOLDER mac) + elseif(${CMAKE_SYSTEM_NAME} MATCHES "iOS") + set(APPLE TRUE) + set(IOS TRUE) + set(PLATFORM_FOLDER ios) + else() + message(FATAL_ERROR "Unsupported platform, CMake will exit") + return() + endif() + +# generators that are capable of organizing into a hierarchy of folders +set_property(GLOBAL PROPERTY USE_FOLDERS ON) +# simplify generator condition, please use them everywhere +if(CMAKE_GENERATOR STREQUAL Xcode) + set(XCODE TRUE) +elseif(CMAKE_GENERATOR MATCHES Visual) + set(VS TRUE) +endif() +message(STATUS "CMAKE_GENERATOR: ${CMAKE_GENERATOR}") + +# custom target property for lua/js link +define_property(TARGET + PROPERTY CC_JS_DEPEND + BRIEF_DOCS "cocos2d js depend libs" + FULL_DOCS "use to save depend libs of cocos2d js project" +) +define_property(TARGET + PROPERTY CC_LUA_DEPEND + BRIEF_DOCS "cocos2d lua depend libs" + FULL_DOCS "use to save depend libs of cocos2d lua project" +) + +# check c++ standard +set(CMAKE_C_STANDARD 99) +set(CMAKE_C_STANDARD_REQUIRED ON) +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +# check visual studio version + if(WINDOWS) + # not support other compile tools except MSVC for now + if(MSVC) + # Visual Studio 2015, MSVC_VERSION 1900 (v140 toolset) + # Visual Studio 2017, MSVC_VERSION 1910-1919 (v141 toolset) + if(${MSVC_VERSION} EQUAL 1900 OR ${MSVC_VERSION} GREATER 1900) + message(STATUS "using Windows MSVC generate cocos2d-x project, MSVC_VERSION:${MSVC_VERSION}") + else() + message(FATAL_ERROR "using Windows MSVC generate cocos2d-x project, MSVC_VERSION:${MSVC_VERSION} lower than needed") + endif() + else() + message(FATAL_ERROR "please using Windows MSVC compile cocos2d-x project, support other compile tools not yet") + endif() +endif() + + # Set macro definitions for special platforms + function(use_cocos2dx_compile_define target) + target_compile_definitions(${target} PUBLIC $<$:COCOS2D_DEBUG=1>) + if(APPLE) + target_compile_definitions(${target} PUBLIC __APPLE__) + target_compile_definitions(${target} PUBLIC USE_FILE32API) + elseif(LINUX) + target_compile_definitions(${target} PUBLIC LINUX) + target_compile_definitions(${target} PUBLIC _GNU_SOURCE) + elseif(ANDROID) + target_compile_definitions(${target} PUBLIC ANDROID) + target_compile_definitions(${target} PUBLIC USE_FILE32API) + elseif(WINDOWS) + target_compile_definitions(${target} + PUBLIC WIN32 + PUBLIC _WIN32 + PUBLIC _WINDOWS + PUBLIC UNICODE + PUBLIC _UNICODE + PUBLIC _CRT_SECURE_NO_WARNINGS + PUBLIC _SCL_SECURE_NO_WARNINGS + ) + if(BUILD_SHARED_LIBS) + target_compile_definitions(${target} + PUBLIC _USRDLL + PUBLIC _EXPORT_DLL_ + PUBLIC _USEGUIDLL + PUBLIC _USREXDLL + PUBLIC _USRSTUDIODLL + PUBLIC _USE3DDLL + ) + else() + target_compile_definitions(${target} PUBLIC CC_STATIC) + endif() + endif() +endfunction() + + # Set compiler options + function(use_cocos2dx_compile_options target) + if(MSVC) + target_compile_options(${target} + PUBLIC /MP + ) + endif() + endfunction() diff --git a/cmake/Modules/CocosConfigDepend.cmake b/cmake/Modules/CocosConfigDepend.cmake index 5602a0dd6d2f..b467c6c9efc2 100644 --- a/cmake/Modules/CocosConfigDepend.cmake +++ b/cmake/Modules/CocosConfigDepend.cmake @@ -65,84 +65,34 @@ macro(cocos2dx_depend) find_library(UIKIT_LIBRARY UIKit) find_library(OPENGLES_LIBRARY OpenGLES) find_library(CORE_MOTION_LIBRARY CoreMotion) - find_library(MEDIA_PLAYER_LIBRARY MediaPlayer) + find_library(AVKIT_LIBRARY AVKit) + find_library(CORE_MEDIA_LIBRARY CoreMedia) find_library(CORE_TEXT_LIBRARY CoreText) find_library(SECURITY_LIBRARY Security) find_library(CORE_GRAPHICS_LIBRARY CoreGraphics) find_library(AV_FOUNDATION_LIBRARY AVFoundation) find_library(Z_LIBRARY z) + find_library(WEBKIT_LIBRARY WebKit) list(APPEND PLATFORM_SPECIFIC_LIBS ${UIKIT_LIBRARY} ${OPENGLES_LIBRARY} ${CORE_MOTION_LIBRARY} - ${MEDIA_PLAYER_LIBRARY} + ${AVKIT_LIBRARY} + ${CORE_MEDIA_LIBRARY} ${CORE_TEXT_LIBRARY} ${SECURITY_LIBRARY} ${CORE_GRAPHICS_LIBRARY} ${AV_FOUNDATION_LIBRARY} ${Z_LIBRARY} + ${WEBKIT_LIBRARY} ${COCOS_APPLE_LIBS} ) endif() endif() endmacro() -macro(cocos2dx_define) - - if(USE_JPEG) - add_definitions(-DCC_USE_JPEG=1) - else() - add_definitions(-DCC_USE_JPEG=0) - endif() - - if(USE_WEBP) - add_definitions(-DCC_USE_WEBP=1) - else() - add_definitions(-DCC_USE_WEBP=0) - endif() - - if(USE_TIFF) - add_definitions(-DCC_USE_TIFF=1) - else() - add_definitions(-DCC_USE_TIFF=0) - endif() - - if(USE_PNG) - add_definitions(-DCC_USE_PNG=1) - else() - add_definitions(-DCC_USE_PNG=0) - endif() - - if(USE_CHIPMUNK) - add_definitions(-DCC_USE_PHYSICS=1) - add_definitions(-DCC_ENABLE_CHIPMUNK_INTEGRATION=1) - else() - add_definitions(-DCC_USE_PHYSICS=0) - add_definitions(-DCC_ENABLE_CHIPMUNK_INTEGRATION=0) - endif() - - if(USE_BOX2D) - add_definitions(-DCC_ENABLE_BOX2D_INTEGRATION=1) - else() - add_definitions(-DCC_ENABLE_BOX2D_INTEGRATION=0) - endif(USE_BOX2D) - - if(USE_BULLET) - add_definitions(-DCC_USE_3D_PHYSICS=1) - add_definitions(-DCC_ENABLE_BULLET_INTEGRATION=1) - else(USE_BULLET) - add_definitions(-DCC_USE_3D_PHYSICS=0) - add_definitions(-DCC_ENABLE_BULLET_INTEGRATION=0) - endif(USE_BULLET) - - # tocheck, libuv option - add_definitions(-DLWS_WITH_LIBUV) -endmacro() - - -macro(target_use_cocos2dx_depend target) +macro(use_cocos2dx_libs_depend target) cocos2dx_depend() - cocos2dx_define() foreach(platform_lib ${PLATFORM_SPECIFIC_LIBS}) target_link_libraries(${target} ${platform_lib}) endforeach() diff --git a/cmake/Modules/CocosSelectModule.cmake b/cmake/Modules/CocosSelectModule.cmake deleted file mode 100644 index bd3918c1ea58..000000000000 --- a/cmake/Modules/CocosSelectModule.cmake +++ /dev/null @@ -1,21 +0,0 @@ -# the default behavior of build module -set(BUILD_LUA_LIBS_DEFAULT OFF) -set(BUILD_JS_LIBS_DEFAULT OFF) - -option(USE_CHIPMUNK "Use chipmunk for physics library" ON) -option(USE_BOX2D "Use box2d for physics library" OFF) -option(USE_BULLET "Use bullet for physics3d library" ON) -option(USE_RECAST "Use Recast for navigation mesh" ON) -option(USE_WEBP "Use WebP codec" ON) -option(USE_PNG "Use PNG codec" ON) -option(USE_TIFF "Use TIFF codec" ON) -option(USE_JPEG "Use JPEG codec" ON) -option(BUILD_SHARED_LIBS "Build shared libraries" OFF) -option(DEBUG_MODE "Debug or Release?" ON) -option(BUILD_EXTENSIONS "Build extension library" ON) -option(BUILD_EDITOR_SPINE "Build editor support for spine" ON) -option(BUILD_EDITOR_COCOSTUDIO "Build editor support for cocostudio" ON) -option(BUILD_EDITOR_COCOSBUILDER "Build editor support for cocosbuilder" ON) -option(BUILD_LUA_LIBS "Build lua libraries" ${BUILD_LUA_LIBS_DEFAULT}) -option(BUILD_JS_LIBS "Build js libraries" ${BUILD_JS_LIBS_DEFAULT}) - diff --git a/cmake/Modules/PreventInSourceBuilds.cmake b/cmake/Modules/PreventInSourceBuilds.cmake new file mode 100644 index 000000000000..12e03009ba60 --- /dev/null +++ b/cmake/Modules/PreventInSourceBuilds.cmake @@ -0,0 +1,47 @@ +# Adapated from ITKv4/CMake/PreventInSourceBuilds.cmake +# +# This function will prevent in-source builds +function(AssureOutOfSourceBuilds) + # make sure the user doesn't play dirty with symlinks + get_filename_component(srcdir "${CMAKE_SOURCE_DIR}" REALPATH) + get_filename_component(bindir "${CMAKE_BINARY_DIR}" REALPATH) + + # disallow in-source builds + if("${srcdir}" STREQUAL "${bindir}") + message("######################################################") + message("# Cocos2d-x should not be configured & built in the Cocos2d-x source directory") + message("# You must run cmake in a build directory.") + message("# For example:") + message("# mkdir Cocos ; cd Cocos") + message("# download & unpack the Cocos2d-x tarball") + message("# mkdir Cocos2d-x-Build") + message("# this will create the following directory structure") + message("#") + message("# Cocos") + message("# +--Cocos2d-x") + message("# +--Cocos2d-x-Build") + message("#") + message("# Then you can proceed to configure and build") + message("# by using the following commands") + message("#") + message("# cd Cocos2d-x-Build") + message("# cmake ../Cocos2d-x # or ccmake, or cmake-gui ") + message("# make") + message("#") + message("# NOTE: Given that you already tried to make an in-source build") + message("# CMake have already created several files & directories") + message("# in your source tree. run 'git status' to find them and") + message("# remove them by doing:") + message("#") + message("# cd Cocos/Cocos2d-x") + message("# git clean -n -d") + message("# git clean -f -d") + message("# git checkout --") + message("#") + message("######################################################") + message(FATAL_ERROR "Quitting configuration") + endif() +endfunction() + +AssureOutOfSourceBuilds() + diff --git a/cmake/Modules/iOSBundleInfo.plist.in b/cmake/Modules/iOSBundleInfo.plist.in index f6b35ef1da01..fa2a779a2d05 100644 --- a/cmake/Modules/iOSBundleInfo.plist.in +++ b/cmake/Modules/iOSBundleInfo.plist.in @@ -38,8 +38,8 @@ LaunchScreen UISupportedInterfaceOrientations - UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight + UIInterfaceOrientationLandscapeLeft NSHumanReadableCopyright ${MACOSX_BUNDLE_COPYRIGHT} diff --git a/cmake/README.md b/cmake/README.md index c5c1c33b1883..8bf6e8c2d80f 100644 --- a/cmake/README.md +++ b/cmake/README.md @@ -8,7 +8,7 @@ CMake is an open-source, cross-platform family of tools designed to build, test ```sh cmake --version ``` -if the CMake version is lower than 3.1, please upgrade. +if the CMake version is lower than 3.6, please upgrade. 2. You should use __out-of-source__ builds, this means you need to create a different directory than __cocos2d-x__ to execute the `cmake` command. @@ -33,7 +33,14 @@ mkdir win32-build && cd win32-build cmake .. -G"Visual Studio 15 2017" -Tv141 ``` -Execute `cmake --build .` to compile, or open __Cocos2d-x.sln__ in Explorer to use the generated project. +Execute `cmake --build .` to compile, +``` +cmake --build . --config Debug +cmake --build . --config Release +``` +or open __Cocos2d-x.sln__ in Explorer to use the generated project. + +If can't found `MSVCR110.dll` issue occurs to you, please install this [Visual C++ Runtime Libraries](https://www.microsoft.com/en-us/download/details.aspx?id=30679), when runing the cpp-tests project ### Generate macOS Project @@ -53,7 +60,9 @@ cmake .. -GXcode -DCMAKE_TOOLCHAIN_FILE=../cmake/ios.toolchain.cmake open Cocos2d-x.xcodeproj ``` -The default build is for running on actual iOS hardware, if you want to run in the simulator, please add `-DIOS_PLATFORM=SIMULATOR` for architecture i386 or `-DIOS_PLATFORM=SIMULATOR64` for x86_64. +The default build is for running on iOS device, if you want to run in the simulator, please add `-DIOS_PLATFORM=SIMULATOR` for architecture i386 or `-DIOS_PLATFORM=SIMULATOR64` for x86_64, but remember you can't run metal-support app in simulator because Apple limitation. + +if you want to sign iOS app in CMake, you will need to fill development team ID into `set_xcode_property(${APP_NAME} DEVELOPMENT_TEAM "")`, or select to sign in Xcode after project files generated. ### Android Studio @@ -91,6 +100,11 @@ If you want to add cmake build arguments, please add it at [external Native Buil * `cmake --build ./msvc_build`, cmake will sellect corresponding build tools. +## Tips + +1. Use `cmake ..` to refersh resources and code files, after you modify `Resources` or `CMakeLists.txt`. +1. Don't need `CMAKE_BUILD_TYPE` options when `-G` Xcode or Visual Studio, CMake scripts will generate both configurations, so you can switch `Debug` and `Release` in IDE. + ## Useful Links * CMake Official website: [cmake.org](https://cmake.org/) diff --git a/cmake/ios.toolchain.cmake b/cmake/ios.toolchain.cmake index 3d4490c2c8c9..3d9bd3050c47 100644 --- a/cmake/ios.toolchain.cmake +++ b/cmake/ios.toolchain.cmake @@ -35,8 +35,9 @@ set(UNIX True) set(APPLE True) set(IOS True) -# Required as of cmake 2.8.10 -set(CMAKE_OSX_DEPLOYMENT_TARGET "" CACHE STRING "Force unset of the deployment target for iOS" FORCE) +# support iOS on cmake 3.11+ +# cmake 3.11 milestone feature, https://gitlab.kitware.com/cmake/cmake/issues/17431 +set(CMAKE_OSX_DEPLOYMENT_TARGET "8.0" CACHE STRING "set of the deployment target for iOS" FORCE) # Determine the cmake host system version so we know where to find the iOS SDKs find_program(CMAKE_UNAME uname /bin /usr/bin /usr/local/bin) @@ -203,4 +204,13 @@ macro(find_host_package) set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) -endmacro(find_host_package) \ No newline at end of file +endmacro(find_host_package) + +# This macro lets you find library on the host system +macro(find_host_library) + set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER) + + find_library(${ARGN}) + + set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +endmacro(find_host_library) diff --git a/cocos/2d/CCAction.h b/cocos/2d/CCAction.h index 7918377fade7..0d1cf6f9ee87 100644 --- a/cocos/2d/CCAction.h +++ b/cocos/2d/CCAction.h @@ -294,7 +294,7 @@ class CC_DLL Speed : public Action CC_CONSTRUCTOR_ACCESS: Speed(); - virtual ~Speed(void); + virtual ~Speed(); /** Initializes the action. */ bool initWithAction(ActionInterval *action, float speed); diff --git a/cocos/2d/CCActionCatmullRom.cpp b/cocos/2d/CCActionCatmullRom.cpp index 4f1eb6d1317f..1bce6132e6ca 100644 --- a/cocos/2d/CCActionCatmullRom.cpp +++ b/cocos/2d/CCActionCatmullRom.cpp @@ -38,7 +38,7 @@ using namespace std; -NS_CC_BEGIN; +NS_CC_BEGIN /* * Implementation of PointArray @@ -526,4 +526,4 @@ CatmullRomBy* CatmullRomBy::reverse() const return CatmullRomBy::create(_duration, reverse); } -NS_CC_END; +NS_CC_END diff --git a/cocos/2d/CCActionCatmullRom.h b/cocos/2d/CCActionCatmullRom.h index 986f3e44ae88..7544943199e0 100644 --- a/cocos/2d/CCActionCatmullRom.h +++ b/cocos/2d/CCActionCatmullRom.h @@ -41,7 +41,7 @@ #include "2d/CCActionInterval.h" #include "math/CCGeometry.h" -NS_CC_BEGIN; +NS_CC_BEGIN class Node; @@ -343,6 +343,6 @@ extern CC_DLL Vec2 ccCardinalSplineAt(const Vec2 &p0, const Vec2 &p1, const Vec2 // end of actions group /// @} -NS_CC_END; +NS_CC_END #endif // __CCACTION_CATMULLROM_H__ diff --git a/cocos/2d/CCActionEase.cpp b/cocos/2d/CCActionEase.cpp index 27117b233055..a6dccb818e0e 100644 --- a/cocos/2d/CCActionEase.cpp +++ b/cocos/2d/CCActionEase.cpp @@ -64,7 +64,7 @@ bool ActionEase::initWithAction(ActionInterval *action) return false; } -ActionEase::~ActionEase(void) +ActionEase::~ActionEase() { CC_SAFE_RELEASE(_inner); } @@ -82,7 +82,7 @@ void ActionEase::startWithTarget(Node *target) } } -void ActionEase::stop(void) +void ActionEase::stop() { if (_inner) _inner->stop(); @@ -159,33 +159,33 @@ ActionEase* CLASSNAME::reverse() const { \ return REVERSE_CLASSNAME::create(_inner->reverse()); \ } -EASE_TEMPLATE_IMPL(EaseExponentialIn, tweenfunc::expoEaseIn, EaseExponentialOut); -EASE_TEMPLATE_IMPL(EaseExponentialOut, tweenfunc::expoEaseOut, EaseExponentialIn); -EASE_TEMPLATE_IMPL(EaseExponentialInOut, tweenfunc::expoEaseInOut, EaseExponentialInOut); -EASE_TEMPLATE_IMPL(EaseSineIn, tweenfunc::sineEaseIn, EaseSineOut); -EASE_TEMPLATE_IMPL(EaseSineOut, tweenfunc::sineEaseOut, EaseSineIn); -EASE_TEMPLATE_IMPL(EaseSineInOut, tweenfunc::sineEaseInOut, EaseSineInOut); -EASE_TEMPLATE_IMPL(EaseBounceIn, tweenfunc::bounceEaseIn, EaseBounceOut); -EASE_TEMPLATE_IMPL(EaseBounceOut, tweenfunc::bounceEaseOut, EaseBounceIn); -EASE_TEMPLATE_IMPL(EaseBounceInOut, tweenfunc::bounceEaseInOut, EaseBounceInOut); -EASE_TEMPLATE_IMPL(EaseBackIn, tweenfunc::backEaseIn, EaseBackOut); -EASE_TEMPLATE_IMPL(EaseBackOut, tweenfunc::backEaseOut, EaseBackIn); -EASE_TEMPLATE_IMPL(EaseBackInOut, tweenfunc::backEaseInOut, EaseBackInOut); -EASE_TEMPLATE_IMPL(EaseQuadraticActionIn, tweenfunc::quadraticIn, EaseQuadraticActionIn); -EASE_TEMPLATE_IMPL(EaseQuadraticActionOut, tweenfunc::quadraticOut, EaseQuadraticActionOut); -EASE_TEMPLATE_IMPL(EaseQuadraticActionInOut, tweenfunc::quadraticInOut, EaseQuadraticActionInOut); -EASE_TEMPLATE_IMPL(EaseQuarticActionIn, tweenfunc::quartEaseIn, EaseQuarticActionIn); -EASE_TEMPLATE_IMPL(EaseQuarticActionOut, tweenfunc::quartEaseOut, EaseQuarticActionOut); -EASE_TEMPLATE_IMPL(EaseQuarticActionInOut, tweenfunc::quartEaseInOut, EaseQuarticActionInOut); -EASE_TEMPLATE_IMPL(EaseQuinticActionIn, tweenfunc::quintEaseIn, EaseQuinticActionIn); -EASE_TEMPLATE_IMPL(EaseQuinticActionOut, tweenfunc::quintEaseOut, EaseQuinticActionOut); -EASE_TEMPLATE_IMPL(EaseQuinticActionInOut, tweenfunc::quintEaseInOut, EaseQuinticActionInOut); -EASE_TEMPLATE_IMPL(EaseCircleActionIn, tweenfunc::circEaseIn, EaseCircleActionIn); -EASE_TEMPLATE_IMPL(EaseCircleActionOut, tweenfunc::circEaseOut, EaseCircleActionOut); -EASE_TEMPLATE_IMPL(EaseCircleActionInOut, tweenfunc::circEaseInOut, EaseCircleActionInOut); -EASE_TEMPLATE_IMPL(EaseCubicActionIn, tweenfunc::cubicEaseIn, EaseCubicActionIn); -EASE_TEMPLATE_IMPL(EaseCubicActionOut, tweenfunc::cubicEaseOut, EaseCubicActionOut); -EASE_TEMPLATE_IMPL(EaseCubicActionInOut, tweenfunc::cubicEaseInOut, EaseCubicActionInOut); +EASE_TEMPLATE_IMPL(EaseExponentialIn, tweenfunc::expoEaseIn, EaseExponentialOut) +EASE_TEMPLATE_IMPL(EaseExponentialOut, tweenfunc::expoEaseOut, EaseExponentialIn) +EASE_TEMPLATE_IMPL(EaseExponentialInOut, tweenfunc::expoEaseInOut, EaseExponentialInOut) +EASE_TEMPLATE_IMPL(EaseSineIn, tweenfunc::sineEaseIn, EaseSineOut) +EASE_TEMPLATE_IMPL(EaseSineOut, tweenfunc::sineEaseOut, EaseSineIn) +EASE_TEMPLATE_IMPL(EaseSineInOut, tweenfunc::sineEaseInOut, EaseSineInOut) +EASE_TEMPLATE_IMPL(EaseBounceIn, tweenfunc::bounceEaseIn, EaseBounceOut) +EASE_TEMPLATE_IMPL(EaseBounceOut, tweenfunc::bounceEaseOut, EaseBounceIn) +EASE_TEMPLATE_IMPL(EaseBounceInOut, tweenfunc::bounceEaseInOut, EaseBounceInOut) +EASE_TEMPLATE_IMPL(EaseBackIn, tweenfunc::backEaseIn, EaseBackOut) +EASE_TEMPLATE_IMPL(EaseBackOut, tweenfunc::backEaseOut, EaseBackIn) +EASE_TEMPLATE_IMPL(EaseBackInOut, tweenfunc::backEaseInOut, EaseBackInOut) +EASE_TEMPLATE_IMPL(EaseQuadraticActionIn, tweenfunc::quadraticIn, EaseQuadraticActionIn) +EASE_TEMPLATE_IMPL(EaseQuadraticActionOut, tweenfunc::quadraticOut, EaseQuadraticActionOut) +EASE_TEMPLATE_IMPL(EaseQuadraticActionInOut, tweenfunc::quadraticInOut, EaseQuadraticActionInOut) +EASE_TEMPLATE_IMPL(EaseQuarticActionIn, tweenfunc::quartEaseIn, EaseQuarticActionIn) +EASE_TEMPLATE_IMPL(EaseQuarticActionOut, tweenfunc::quartEaseOut, EaseQuarticActionOut) +EASE_TEMPLATE_IMPL(EaseQuarticActionInOut, tweenfunc::quartEaseInOut, EaseQuarticActionInOut) +EASE_TEMPLATE_IMPL(EaseQuinticActionIn, tweenfunc::quintEaseIn, EaseQuinticActionIn) +EASE_TEMPLATE_IMPL(EaseQuinticActionOut, tweenfunc::quintEaseOut, EaseQuinticActionOut) +EASE_TEMPLATE_IMPL(EaseQuinticActionInOut, tweenfunc::quintEaseInOut, EaseQuinticActionInOut) +EASE_TEMPLATE_IMPL(EaseCircleActionIn, tweenfunc::circEaseIn, EaseCircleActionIn) +EASE_TEMPLATE_IMPL(EaseCircleActionOut, tweenfunc::circEaseOut, EaseCircleActionOut) +EASE_TEMPLATE_IMPL(EaseCircleActionInOut, tweenfunc::circEaseInOut, EaseCircleActionInOut) +EASE_TEMPLATE_IMPL(EaseCubicActionIn, tweenfunc::cubicEaseIn, EaseCubicActionIn) +EASE_TEMPLATE_IMPL(EaseCubicActionOut, tweenfunc::cubicEaseOut, EaseCubicActionOut) +EASE_TEMPLATE_IMPL(EaseCubicActionInOut, tweenfunc::cubicEaseInOut, EaseCubicActionInOut) // // NOTE: Converting these macros into Templates is desirable, but please see @@ -217,9 +217,9 @@ EaseRateAction* CLASSNAME::reverse() const { \ } // NOTE: the original code used the same class for the `reverse()` method -EASERATE_TEMPLATE_IMPL(EaseIn, tweenfunc::easeIn); -EASERATE_TEMPLATE_IMPL(EaseOut, tweenfunc::easeOut); -EASERATE_TEMPLATE_IMPL(EaseInOut, tweenfunc::easeInOut); +EASERATE_TEMPLATE_IMPL(EaseIn, tweenfunc::easeIn) +EASERATE_TEMPLATE_IMPL(EaseOut, tweenfunc::easeOut) +EASERATE_TEMPLATE_IMPL(EaseInOut, tweenfunc::easeInOut) // // EaseElastic @@ -265,9 +265,9 @@ EaseElastic* CLASSNAME::reverse() const { \ return REVERSE_CLASSNAME::create(_inner->reverse(), _period); \ } -EASEELASTIC_TEMPLATE_IMPL(EaseElasticIn, tweenfunc::elasticEaseIn, EaseElasticOut); -EASEELASTIC_TEMPLATE_IMPL(EaseElasticOut, tweenfunc::elasticEaseOut, EaseElasticIn); -EASEELASTIC_TEMPLATE_IMPL(EaseElasticInOut, tweenfunc::elasticEaseInOut, EaseElasticInOut); +EASEELASTIC_TEMPLATE_IMPL(EaseElasticIn, tweenfunc::elasticEaseIn, EaseElasticOut) +EASEELASTIC_TEMPLATE_IMPL(EaseElasticOut, tweenfunc::elasticEaseOut, EaseElasticIn) +EASEELASTIC_TEMPLATE_IMPL(EaseElasticInOut, tweenfunc::elasticEaseInOut, EaseElasticInOut) // // EaseBezierAction diff --git a/cocos/2d/CCActionEase.h b/cocos/2d/CCActionEase.h index 3c9d73253071..9b650e893988 100644 --- a/cocos/2d/CCActionEase.h +++ b/cocos/2d/CCActionEase.h @@ -136,7 +136,7 @@ public: \ virtual ActionEase* reverse() const override; \ private: \ CC_DISALLOW_COPY_AND_ASSIGN(CLASSNAME); \ -}; +} /** @class EaseExponentialIn @@ -394,7 +394,7 @@ private: \ \f${ time }^{ rate }\f$. @ingroup Actions */ -EASERATE_TEMPLATE_DECL_CLASS(EaseIn); +EASERATE_TEMPLATE_DECL_CLASS(EaseIn) /** @class EaseOut @@ -403,7 +403,7 @@ EASERATE_TEMPLATE_DECL_CLASS(EaseIn); \f${ time }^ { (1/rate) }\f$. @ingroup Actions */ -EASERATE_TEMPLATE_DECL_CLASS(EaseOut); +EASERATE_TEMPLATE_DECL_CLASS(EaseOut) /** @class EaseInOut @@ -414,7 +414,7 @@ EASERATE_TEMPLATE_DECL_CLASS(EaseOut); \f$1.0-0.5*{ 2-time }^{ rate }\f$. @ingroup Actions */ -EASERATE_TEMPLATE_DECL_CLASS(EaseInOut); +EASERATE_TEMPLATE_DECL_CLASS(EaseInOut) /** @class EaseElastic @@ -472,7 +472,7 @@ public: \ virtual EaseElastic* reverse() const override; \ private: \ CC_DISALLOW_COPY_AND_ASSIGN(CLASSNAME); \ -}; +} /** @class EaseElasticIn diff --git a/cocos/2d/CCActionGrid.cpp b/cocos/2d/CCActionGrid.cpp index 4f335da1ed95..38fea5aba27c 100644 --- a/cocos/2d/CCActionGrid.cpp +++ b/cocos/2d/CCActionGrid.cpp @@ -131,7 +131,7 @@ Rect Grid3DAction::getGridRect() const // implementation of TiledGrid3DAction -GridBase* TiledGrid3DAction::getGrid(void) +GridBase* TiledGrid3DAction::getGrid() { return TiledGrid3D::create(_gridSize, _gridNodeTarget->getGridRect()); } diff --git a/cocos/2d/CCActionInterval.cpp b/cocos/2d/CCActionInterval.cpp index bbc54a655461..dd175876a83f 100644 --- a/cocos/2d/CCActionInterval.cpp +++ b/cocos/2d/CCActionInterval.cpp @@ -30,6 +30,8 @@ THE SOFTWARE. #include +#include + #include "2d/CCSprite.h" #include "2d/CCNode.h" #include "2d/CCSpriteFrame.h" @@ -88,8 +90,8 @@ void ExtraAction::step(float /*dt*/) bool ActionInterval::initWithDuration(float d) { - _duration = d; + _duration = std::abs(d) <= MATH_EPSILON ? MATH_EPSILON : d; _elapsed = 0; _firstTick = true; _done = false; @@ -119,7 +121,7 @@ void ActionInterval::step(float dt) if (_firstTick) { _firstTick = false; - _elapsed = 0; + _elapsed = MATH_EPSILON; } else { @@ -481,7 +483,7 @@ Repeat::~Repeat() void Repeat::startWithTarget(Node *target) { _total = 0; - _nextDt = _innerAction->getDuration()/_duration; + _nextDt = _innerAction->getDuration() / _duration; ActionInterval::startWithTarget(target); _innerAction->startWithTarget(target); } @@ -2425,7 +2427,6 @@ DelayTime* DelayTime::clone() const void DelayTime::update(float /*time*/) { - return; } DelayTime* DelayTime::reverse() const @@ -2801,7 +2802,7 @@ void TargetedAction::setForcedTarget(Node* forcedTarget) // ActionFloat -ActionFloat* ActionFloat::create(float duration, float from, float to, ActionFloatCallback callback) +ActionFloat* ActionFloat::create(float duration, float from, float to, const ActionFloatCallback& callback) { auto ref = new (std::nothrow) ActionFloat(); if (ref && ref->initWithDuration(duration, from, to, callback)) @@ -2814,7 +2815,7 @@ ActionFloat* ActionFloat::create(float duration, float from, float to, ActionFlo return nullptr; } -bool ActionFloat::initWithDuration(float duration, float from, float to, ActionFloatCallback callback) +bool ActionFloat::initWithDuration(float duration, float from, float to, const ActionFloatCallback& callback) { if (ActionInterval::initWithDuration(duration)) { diff --git a/cocos/2d/CCActionInterval.h b/cocos/2d/CCActionInterval.h index 59e5254715cb..d327d37032f9 100644 --- a/cocos/2d/CCActionInterval.h +++ b/cocos/2d/CCActionInterval.h @@ -253,12 +253,12 @@ class CC_DLL Repeat : public ActionInterval virtual Repeat* clone() const override; virtual Repeat* reverse() const override; virtual void startWithTarget(Node *target) override; - virtual void stop(void) override; + virtual void stop() override; /** * @param dt In seconds. */ virtual void update(float dt) override; - virtual bool isDone(void) const override; + virtual bool isDone() const override; CC_CONSTRUCTOR_ACCESS: Repeat() {} @@ -321,13 +321,13 @@ class CC_DLL RepeatForever : public ActionInterval // Overrides // virtual RepeatForever* clone() const override; - virtual RepeatForever* reverse(void) const override; + virtual RepeatForever* reverse() const override; virtual void startWithTarget(Node* target) override; /** * @param dt In seconds. */ virtual void step(float dt) override; - virtual bool isDone(void) const override; + virtual bool isDone() const override; CC_CONSTRUCTOR_ACCESS: RepeatForever() @@ -1650,7 +1650,7 @@ class CC_DLL ActionFloat : public ActionInterval * * @return An autoreleased ActionFloat object */ - static ActionFloat* create(float duration, float from, float to, ActionFloatCallback callback); + static ActionFloat* create(float duration, float from, float to, const ActionFloatCallback& callback); /** * Overridden ActionInterval methods @@ -1664,7 +1664,7 @@ class CC_DLL ActionFloat : public ActionInterval ActionFloat() {}; virtual ~ActionFloat() {}; - bool initWithDuration(float duration, float from, float to, ActionFloatCallback callback); + bool initWithDuration(float duration, float from, float to, const ActionFloatCallback& callback); protected: /* From value */ diff --git a/cocos/2d/CCActionProgressTimer.cpp b/cocos/2d/CCActionProgressTimer.cpp index d51a1b7811a9..92595a8c5cc1 100644 --- a/cocos/2d/CCActionProgressTimer.cpp +++ b/cocos/2d/CCActionProgressTimer.cpp @@ -26,13 +26,13 @@ THE SOFTWARE. ****************************************************************************/ #include "2d/CCActionProgressTimer.h" #include "2d/CCProgressTimer.h" +#include "ui/UILoadingBar.h" NS_CC_BEGIN #define kProgressTimerCast ProgressTimer* // implementation of ProgressTo - ProgressTo* ProgressTo::create(float duration, float percent) { ProgressTo *progressTo = new (std::nothrow) ProgressTo(); @@ -41,7 +41,6 @@ ProgressTo* ProgressTo::create(float duration, float percent) progressTo->autorelease(); return progressTo; } - delete progressTo; return nullptr; } @@ -73,12 +72,23 @@ ProgressTo* ProgressTo::reverse() const void ProgressTo::startWithTarget(Node *target) { ActionInterval::startWithTarget(target); - _from = ((kProgressTimerCast)(target))->getPercentage(); + + ui::LoadingBar* loading_bar = dynamic_cast(target); + if (loading_bar){ + _from = loading_bar->getPercent(); + } else { + _from = static_cast(target)->getPercentage(); + }; } void ProgressTo::update(float time) { - ((kProgressTimerCast)(_target))->setPercentage(_from + (_to - _from) * time); + ui::LoadingBar* loading_bar = dynamic_cast(_target); + if (loading_bar){ + loading_bar->setPercent(_from + (_to - _from) * time); + } else { + static_cast(_target)->setPercentage(_from + (_to - _from) * time); + }; } // implementation of ProgressFromTo @@ -90,14 +100,14 @@ ProgressFromTo* ProgressFromTo::create(float duration, float fromPercentage, flo progressFromTo->autorelease(); return progressFromTo; } - + delete progressFromTo; return nullptr; } bool ProgressFromTo::initWithDuration(float duration, float fromPercentage, float toPercentage) { - if (ActionInterval::initWithDuration(duration)) + if (ActionInterval::initWithDuration(duration)) { _to = toPercentage; _from = fromPercentage; @@ -127,7 +137,12 @@ void ProgressFromTo::startWithTarget(Node *target) void ProgressFromTo::update(float time) { - ((kProgressTimerCast)(_target))->setPercentage(_from + (_to - _from) * time); + ui::LoadingBar* loading_bar = dynamic_cast(_target); + if (loading_bar){ + loading_bar->setPercent(_from + (_to - _from) * time); + } else { + static_cast(_target)->setPercentage(_from + (_to - _from) * time); + }; } NS_CC_END diff --git a/cocos/2d/CCActionTiledGrid.cpp b/cocos/2d/CCActionTiledGrid.cpp index 1b34114ca2c4..b24ccd113423 100644 --- a/cocos/2d/CCActionTiledGrid.cpp +++ b/cocos/2d/CCActionTiledGrid.cpp @@ -566,7 +566,7 @@ TurnOffTiles* TurnOffTiles::clone() const return TurnOffTiles::create(_duration, _gridSize, _seed); } -TurnOffTiles::~TurnOffTiles(void) +TurnOffTiles::~TurnOffTiles() { CC_SAFE_DELETE_ARRAY(_tilesOrder); } diff --git a/cocos/2d/CCAnimation.cpp b/cocos/2d/CCAnimation.cpp index 1d335f2926d5..ed9450bf3114 100644 --- a/cocos/2d/CCAnimation.cpp +++ b/cocos/2d/CCAnimation.cpp @@ -156,7 +156,7 @@ Animation::Animation() } -Animation::~Animation(void) +Animation::~Animation() { CCLOGINFO("deallocing Animation: %p", this); } @@ -185,7 +185,7 @@ void Animation::addSpriteFrameWithTexture(Texture2D *pobTexture, const Rect& rec addSpriteFrame(frame); } -float Animation::getDuration(void) const +float Animation::getDuration() const { return _totalDelayUnits * _delayPerUnit; } diff --git a/cocos/2d/CCAnimation.h b/cocos/2d/CCAnimation.h index 86d6c8af4fc8..eaaef2dd4dcc 100644 --- a/cocos/2d/CCAnimation.h +++ b/cocos/2d/CCAnimation.h @@ -170,7 +170,7 @@ class CC_DLL Animation : public Ref, public Clonable /** Creates an animation. * @since v0.99.5 */ - static Animation* create(void); + static Animation* create(); /* Creates an animation with an array of SpriteFrame and a delay between frames in seconds. * The frames will be added with one "delay unit". @@ -284,7 +284,7 @@ class CC_DLL Animation : public Ref, public Clonable CC_CONSTRUCTOR_ACCESS: Animation(); - virtual ~Animation(void); + virtual ~Animation(); /** Initializes a Animation. */ bool init(); diff --git a/cocos/2d/CCAnimationCache.h b/cocos/2d/CCAnimationCache.h index ed082d07f837..204969baff0c 100644 --- a/cocos/2d/CCAnimationCache.h +++ b/cocos/2d/CCAnimationCache.h @@ -81,7 +81,7 @@ class CC_DLL AnimationCache : public Ref /** @deprecated Use destroyInstance() instead. */ CC_DEPRECATED_ATTRIBUTE static void purgeSharedAnimationCache() { return AnimationCache::destroyInstance(); } - bool init(void); + bool init(); /** Adds a Animation with a name. * diff --git a/cocos/2d/CCAtlasNode.cpp b/cocos/2d/CCAtlasNode.cpp index 0c1097c16a9b..f7d0d5003060 100644 --- a/cocos/2d/CCAtlasNode.cpp +++ b/cocos/2d/CCAtlasNode.cpp @@ -71,7 +71,7 @@ AtlasNode * AtlasNode::create(const std::string& tile, int tileWidth, int tileHe bool AtlasNode::initWithTileFile(const std::string& tile, int tileWidth, int tileHeight, int itemsToRender) { - CCASSERT(tile.size() > 0, "file size should not be empty"); + CCASSERT(!tile.empty(), "file size should not be empty"); Texture2D *texture = Director::getInstance()->getTextureCache()->addImage(tile); return initWithTexture(texture, tileWidth, tileHeight, itemsToRender); } diff --git a/cocos/2d/CCAtlasNode.h b/cocos/2d/CCAtlasNode.h index 612fe799d179..a5073837aadd 100644 --- a/cocos/2d/CCAtlasNode.h +++ b/cocos/2d/CCAtlasNode.h @@ -85,7 +85,7 @@ class CC_DLL AtlasNode : public Node, public TextureProtocol virtual void setTexture(Texture2D *texture) override; virtual bool isOpacityModifyRGB() const override; virtual void setOpacityModifyRGB(bool isOpacityModifyRGB) override; - virtual const Color3B& getColor(void) const override; + virtual const Color3B& getColor() const override; virtual void setColor(const Color3B& color) override; virtual void setOpacity(GLubyte opacity) override; /** diff --git a/cocos/2d/CCAutoPolygon.cpp b/cocos/2d/CCAutoPolygon.cpp index a873279b1e71..7da468e3e3c8 100644 --- a/cocos/2d/CCAutoPolygon.cpp +++ b/cocos/2d/CCAutoPolygon.cpp @@ -59,7 +59,7 @@ PolygonInfo::PolygonInfo() triangles.indices = nullptr; triangles.vertCount = 0; triangles.indexCount = 0; -}; +} PolygonInfo::PolygonInfo(const PolygonInfo& other) : triangles() @@ -76,7 +76,7 @@ PolygonInfo::PolygonInfo(const PolygonInfo& other) triangles.indexCount = other.triangles.indexCount; memcpy(triangles.verts, other.triangles.verts, other.triangles.vertCount * sizeof(other.triangles.verts[0])); memcpy(triangles.indices, other.triangles.indices, other.triangles.indexCount * sizeof(other.triangles.indices[0])); -}; +} PolygonInfo& PolygonInfo::operator= (const PolygonInfo& other) { @@ -416,7 +416,7 @@ std::vector AutoPolygon::marchSquare(const Rect& rect, const Vec2 } else { - _points.push_back(Vec2((float)(curx - rect.origin.x) / _scaleFactor, (float)(rect.size.height - cury + rect.origin.y) / _scaleFactor)); + _points.emplace_back((float)(curx - rect.origin.x) / _scaleFactor, (float)(rect.size.height - cury + rect.origin.y) / _scaleFactor); } count++; @@ -569,7 +569,7 @@ std::vector AutoPolygon::expand(const std::vector& points, const coc } for(const auto& pt : p2->Contour) { - outPoints.push_back(Vec2(pt.X/PRECISION, pt.Y/PRECISION)); + outPoints.emplace_back(pt.X/PRECISION, pt.Y/PRECISION); } return outPoints; } diff --git a/cocos/2d/CCCamera.cpp b/cocos/2d/CCCamera.cpp index e1e42ef2c1e8..186e59783f2b 100644 --- a/cocos/2d/CCCamera.cpp +++ b/cocos/2d/CCCamera.cpp @@ -33,6 +33,7 @@ #include "renderer/CCRenderer.h" #include "renderer/CCQuadCommand.h" #include "renderer/CCGLProgramCache.h" +#include "renderer/ccGLStateCache.h" #include "renderer/CCFrameBuffer.h" #include "renderer/CCRenderState.h" diff --git a/cocos/2d/CCCameraBackgroundBrush.cpp b/cocos/2d/CCCameraBackgroundBrush.cpp index 5c8bdf347815..330c2c357cb7 100644 --- a/cocos/2d/CCCameraBackgroundBrush.cpp +++ b/cocos/2d/CCCameraBackgroundBrush.cpp @@ -26,9 +26,9 @@ #include "2d/CCCameraBackgroundBrush.h" #include "2d/CCCamera.h" #include "base/ccMacros.h" -#include "base/ccUtils.h" #include "base/CCConfiguration.h" #include "base/CCDirector.h" +#include "renderer/ccGLStateCache.h" #include "renderer/CCGLProgram.h" #include "renderer/CCGLProgramCache.h" #include "renderer/CCGLProgramState.h" @@ -115,7 +115,7 @@ CameraBackgroundDepthBrush::~CameraBackgroundDepthBrush() if (Configuration::getInstance()->supportsShareableVAO()) { glDeleteVertexArrays(1, &_vao); - glBindVertexArray(0); + GL::bindVAO(0); _vao = 0; } #if CC_ENABLE_CACHE_TEXTURE_DATA @@ -168,7 +168,7 @@ void CameraBackgroundDepthBrush::initBuffer() if (supportVAO) { glGenVertexArrays(1, &_vao); - glBindVertexArray(_vao); + GL::bindVAO(_vao); } glGenBuffers(1, &_vertexBuffer); @@ -196,7 +196,7 @@ void CameraBackgroundDepthBrush::initBuffer() } if (supportVAO) - glBindVertexArray(0); + GL::bindVAO(0); glBindBuffer(GL_ARRAY_BUFFER, 0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); @@ -227,13 +227,11 @@ void CameraBackgroundDepthBrush::drawBackground(Camera* /*camera*/) auto supportVAO = Configuration::getInstance()->supportsShareableVAO(); if (supportVAO) - glBindVertexArray(_vao); + GL::bindVAO(_vao); else { glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_COLOR); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_TEX_COORD); + GL::enableVertexAttribs(GL::VERTEX_ATTRIB_FLAG_POS_COLOR_TEX); // vertices glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 3, GL_FLOAT, GL_FALSE, sizeof(V3F_C4B_T2F), (GLvoid*)offsetof(V3F_C4B_T2F, vertices)); @@ -250,7 +248,7 @@ void CameraBackgroundDepthBrush::drawBackground(Camera* /*camera*/) glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, nullptr); if (supportVAO) - glBindVertexArray(0); + GL::bindVAO(0); else { glBindBuffer(GL_ARRAY_BUFFER, 0); @@ -305,7 +303,7 @@ bool CameraBackgroundColorBrush::init() void CameraBackgroundColorBrush::drawBackground(Camera* camera) { - utils::setBlending(BlendFunc::ALPHA_NON_PREMULTIPLIED.src, BlendFunc::ALPHA_NON_PREMULTIPLIED.dst); + GL::blendFunc(BlendFunc::ALPHA_NON_PREMULTIPLIED.src, BlendFunc::ALPHA_NON_PREMULTIPLIED.dst); CameraBackgroundDepthBrush::drawBackground(camera); } @@ -379,7 +377,7 @@ CameraBackgroundSkyBoxBrush::~CameraBackgroundSkyBoxBrush() if (Configuration::getInstance()->supportsShareableVAO()) { glDeleteVertexArrays(1, &_vao); - glBindVertexArray(0); + GL::bindVAO(0); _vao = 0; } #if CC_ENABLE_CACHE_TEXTURE_DATA @@ -482,11 +480,11 @@ void CameraBackgroundSkyBoxBrush::drawBackground(Camera* camera) if (Configuration::getInstance()->supportsShareableVAO()) { - glBindVertexArray(_vao); + GL::bindVAO(_vao); } else { - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION); + GL::enableVertexAttribs(GL::VERTEX_ATTRIB_FLAG_POSITION); glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer); glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 3, GL_FLOAT, GL_FALSE, sizeof(Vec3), nullptr); @@ -498,7 +496,7 @@ void CameraBackgroundSkyBoxBrush::drawBackground(Camera* camera) if (Configuration::getInstance()->supportsShareableVAO()) { - glBindVertexArray(0); + GL::bindVAO(0); } else { @@ -533,14 +531,14 @@ void CameraBackgroundSkyBoxBrush::initBuffer() if (Configuration::getInstance()->supportsShareableVAO() && _vao) { glDeleteVertexArrays(1, &_vao); - glBindVertexArray(0); + GL::bindVAO(0); _vao = 0; } if (Configuration::getInstance()->supportsShareableVAO()) { glGenVertexArrays(1, &_vao); - glBindVertexArray(_vao); + GL::bindVAO(_vao); } // init vertex buffer object @@ -572,7 +570,7 @@ void CameraBackgroundSkyBoxBrush::initBuffer() glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION); _glProgramState->applyAttributes(false); - glBindVertexArray(0); + GL::bindVAO(0); } } diff --git a/cocos/2d/CCClippingNode.cpp b/cocos/2d/CCClippingNode.cpp index ed3563cde980..82d4522e00f3 100644 --- a/cocos/2d/CCClippingNode.cpp +++ b/cocos/2d/CCClippingNode.cpp @@ -29,6 +29,7 @@ #include "2d/CCClippingNode.h" #include "2d/CCDrawingPrimitives.h" #include "renderer/CCGLProgramCache.h" +#include "renderer/ccGLStateCache.h" #include "renderer/CCRenderer.h" #include "renderer/CCRenderState.h" #include "base/CCDirector.h" @@ -331,7 +332,7 @@ void ClippingNode::setStencil(Node *stencil) bool ClippingNode::hasContent() const { - return _children.size() > 0; + return !_children.empty(); } GLfloat ClippingNode::getAlphaThreshold() const diff --git a/cocos/2d/CCDrawNode.cpp b/cocos/2d/CCDrawNode.cpp index 53a9f6df6bfa..1da0662539fd 100644 --- a/cocos/2d/CCDrawNode.cpp +++ b/cocos/2d/CCDrawNode.cpp @@ -26,6 +26,7 @@ #include "base/CCEventType.h" #include "base/CCConfiguration.h" #include "renderer/CCRenderer.h" +#include "renderer/ccGLStateCache.h" #include "renderer/CCGLProgramState.h" #include "renderer/CCGLProgramCache.h" #include "base/CCDirector.h" @@ -33,69 +34,140 @@ #include "base/CCEventDispatcher.h" #include "2d/CCActionCatmullRom.h" #include "platform/CCGL.h" -#include "base/ccUtils.h" NS_CC_BEGIN -// Vec2 == CGPoint in 32-bits, but not in 64-bits (OS X) -// that's why the "v2f" functions are needed -static Vec2 v2fzero(0.0f,0.0f); - -static inline Vec2 v2f(float x, float y) +static inline Tex2F v2ToTex2F(const Vec2 &v) { - Vec2 ret(x, y); - return ret; + return {v.x, v.y}; } -static inline Vec2 v2fadd(const Vec2 &v0, const Vec2 &v1) +static const float EPSILON=0.0000000001f; +float Triangulate::computeArea(const Vec2 *verts,int n) { - return v2f(v0.x+v1.x, v0.y+v1.y); + float A=0.0f; + for(int p=n-1,q=0; q= 0.0f) && (bCROSScp >= 0.0f) && (cCROSSap >= 0.0f)); } -static inline float v2fdot(const Vec2 &p0, const Vec2 &p1) +bool Triangulate::checkSnip(const Vec2 *verts,int u,int v,int w,int n,int *V) { - return p0.x * p1.x + p0.y * p1.y; -} + int p; + float Ax, Ay, Bx, By, Cx, Cy, Px, Py; -static inline Vec2 v2fnormalize(const Vec2 &p) -{ - Vec2 r(p.x, p.y); - r.normalize(); - return v2f(r.x, r.y); -} + Ax = verts[V[u]].x; + Ay = verts[V[u]].y; -static inline Vec2 __v2f(const Vec2 &v) -{ -//#ifdef __LP64__ - return v2f(v.x, v.y); -// #else -// return * ((Vec2*) &v); -// #endif + Bx = verts[V[v]].x; + By = verts[V[v]].y; + + Cx = verts[V[w]].x; + Cy = verts[V[w]].y; + + if ( EPSILON > (((Bx-Ax)*(Cy-Ay)) - ((By-Ay)*(Cx-Ax))) ) return false; + + for (p=0;p V(n); + /* we want a counter-clockwise polygon in V */ + if ( 0.0f < computeArea(verts,n) ) + { + for (int v=0; v2; ) + { + /* if we loop, it is probably a non-simple polygon */ + if (0 >= (count--)) + { + //** Triangulate: ERROR - probable bad polygon! + return triangles; + } + /* three consecutive vertices in current polygon, */ + int u = v ; if (nv <= u) u = 0; /* previous */ + v = u+1; if (nv <= v) v = 0; /* new v */ + int w = v+1; if (nv <= w) w = 0; /* next */ + + if ( checkSnip(verts,u,v,w,nv,V.data()) ) + { + int a,b,c,s,t; + /* true names of the vertices */ + a = V[u]; b = V[v]; c = V[w]; + + V2F_C4B_T2F_Triangle tmp = { + {verts[a], Color4B(fillColor), v2ToTex2F(Vec2::ZERO)}, + {verts[b], Color4B(fillColor), v2ToTex2F(Vec2::ZERO)}, + {verts[c], Color4B(fillColor), v2ToTex2F(Vec2::ZERO)}, + }; + *triangles++ = tmp; + m++; + /* remove v from remaining polygon */ + for(s=v,t=v+1;tsupportsShareableVAO()) { - glBindVertexArray(0); + GL::bindVAO(0); glDeleteVertexArrays(1, &_vao); glDeleteVertexArrays(1, &_vaoGLLine); glDeleteVertexArrays(1, &_vaoGLPoint); @@ -153,14 +225,14 @@ DrawNode* DrawNode::create(GLfloat defaultLineWidth) { CC_SAFE_DELETE(ret); } - + return ret; } void DrawNode::ensureCapacity(int count) { CCASSERT(count>=0, "capacity must be >= 0"); - + if(_bufferCount + count > _bufferCapacity) { _bufferCapacity += MAX(_bufferCapacity, count); @@ -171,7 +243,7 @@ void DrawNode::ensureCapacity(int count) void DrawNode::ensureCapacityGLPoint(int count) { CCASSERT(count>=0, "capacity must be >= 0"); - + if(_bufferCountGLPoint + count > _bufferCapacityGLPoint) { _bufferCapacityGLPoint += MAX(_bufferCapacityGLPoint, count); @@ -182,7 +254,7 @@ void DrawNode::ensureCapacityGLPoint(int count) void DrawNode::ensureCapacityGLLine(int count) { CCASSERT(count>=0, "capacity must be >= 0"); - + if(_bufferCountGLLine + count > _bufferCapacityGLLine) { _bufferCapacityGLLine += MAX(_bufferCapacityGLLine, count); @@ -195,7 +267,7 @@ void DrawNode::setupBuffer() if (Configuration::getInstance()->supportsShareableVAO()) { glGenVertexArrays(1, &_vao); - glBindVertexArray(_vao); + GL::bindVAO(_vao); glGenBuffers(1, &_vbo); glBindBuffer(GL_ARRAY_BUFFER, _vbo); glBufferData(GL_ARRAY_BUFFER, sizeof(V2F_C4B_T2F)* _bufferCapacity, _buffer, GL_STREAM_DRAW); @@ -210,7 +282,7 @@ void DrawNode::setupBuffer() glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_TEX_COORD, 2, GL_FLOAT, GL_FALSE, sizeof(V2F_C4B_T2F), (GLvoid *)offsetof(V2F_C4B_T2F, texCoords)); glGenVertexArrays(1, &_vaoGLLine); - glBindVertexArray(_vaoGLLine); + GL::bindVAO(_vaoGLLine); glGenBuffers(1, &_vboGLLine); glBindBuffer(GL_ARRAY_BUFFER, _vboGLLine); glBufferData(GL_ARRAY_BUFFER, sizeof(V2F_C4B_T2F)*_bufferCapacityGLLine, _bufferGLLine, GL_STREAM_DRAW); @@ -225,7 +297,7 @@ void DrawNode::setupBuffer() glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_TEX_COORD, 2, GL_FLOAT, GL_FALSE, sizeof(V2F_C4B_T2F), (GLvoid *)offsetof(V2F_C4B_T2F, texCoords)); glGenVertexArrays(1, &_vaoGLPoint); - glBindVertexArray(_vaoGLPoint); + GL::bindVAO(_vaoGLPoint); glGenBuffers(1, &_vboGLPoint); glBindBuffer(GL_ARRAY_BUFFER, _vboGLPoint); glBufferData(GL_ARRAY_BUFFER, sizeof(V2F_C4B_T2F)*_bufferCapacityGLPoint, _bufferGLPoint, GL_STREAM_DRAW); @@ -239,7 +311,7 @@ void DrawNode::setupBuffer() glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_TEX_COORD); glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_TEX_COORD, 2, GL_FLOAT, GL_FALSE, sizeof(V2F_C4B_T2F), (GLvoid *)offsetof(V2F_C4B_T2F, texCoords)); - glBindVertexArray(0); + GL::bindVAO(0); glBindBuffer(GL_ARRAY_BUFFER, 0); } @@ -268,16 +340,16 @@ bool DrawNode::init() _blendFunc = BlendFunc::ALPHA_PREMULTIPLIED; setGLProgramState(GLProgramState::getOrCreateWithGLProgramName(GLProgram::SHADER_NAME_POSITION_LENGTH_TEXTURE_COLOR)); - + ensureCapacity(512); ensureCapacityGLPoint(64); ensureCapacityGLLine(256); - + setupBuffer(); - + _dirty = true; _dirtyGLLine = true; - _dirtyGLPoint = true; + _dirtyGLPoint = true; return true; } @@ -289,14 +361,14 @@ void DrawNode::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) _customCommand.func = CC_CALLBACK_0(DrawNode::onDraw, this, transform, flags); renderer->addCommand(&_customCommand); } - + if(_bufferCountGLPoint) { _customCommandGLPoint.init(_globalZOrder, transform, flags); _customCommandGLPoint.func = CC_CALLBACK_0(DrawNode::onDrawGLPoint, this, transform, flags); renderer->addCommand(&_customCommandGLPoint); } - + if(_bufferCountGLLine) { _customCommandGLLine.init(_globalZOrder, transform, flags); @@ -310,24 +382,22 @@ void DrawNode::onDraw(const Mat4 &transform, uint32_t /*flags*/) getGLProgramState()->apply(transform); auto glProgram = this->getGLProgram(); glProgram->setUniformLocationWith1f(glProgram->getUniformLocation("u_alpha"), _displayedOpacity / 255.0); - utils::setBlending(_blendFunc.src, _blendFunc.dst); + GL::blendFunc(_blendFunc.src, _blendFunc.dst); if (_dirty) { glBindBuffer(GL_ARRAY_BUFFER, _vbo); glBufferData(GL_ARRAY_BUFFER, sizeof(V2F_C4B_T2F)*_bufferCapacity, _buffer, GL_STREAM_DRAW); - + _dirty = false; } if (Configuration::getInstance()->supportsShareableVAO()) { - glBindVertexArray(_vao); + GL::bindVAO(_vao); } else { - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_COLOR); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_TEX_COORD); + GL::enableVertexAttribs(GL::VERTEX_ATTRIB_FLAG_POS_COLOR_TEX); glBindBuffer(GL_ARRAY_BUFFER, _vbo); // vertex @@ -340,12 +410,12 @@ void DrawNode::onDraw(const Mat4 &transform, uint32_t /*flags*/) glDrawArrays(GL_TRIANGLES, 0, _bufferCount); glBindBuffer(GL_ARRAY_BUFFER, 0); - + if (Configuration::getInstance()->supportsShareableVAO()) { - glBindVertexArray(0); + GL::bindVAO(0); } - + CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, _bufferCount); CHECK_GL_ERROR_DEBUG(); } @@ -357,7 +427,7 @@ void DrawNode::onDrawGLLine(const Mat4 &transform, uint32_t /*flags*/) glProgram->setUniformsForBuiltins(transform); glProgram->setUniformLocationWith1f(glProgram->getUniformLocation("u_alpha"), _displayedOpacity / 255.0); - utils::setBlending(_blendFunc.src, _blendFunc.dst); + GL::blendFunc(_blendFunc.src, _blendFunc.dst); if (_dirtyGLLine) { @@ -367,14 +437,12 @@ void DrawNode::onDrawGLLine(const Mat4 &transform, uint32_t /*flags*/) } if (Configuration::getInstance()->supportsShareableVAO()) { - glBindVertexArray(_vaoGLLine); + GL::bindVAO(_vaoGLLine); } else { glBindBuffer(GL_ARRAY_BUFFER, _vboGLLine); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_COLOR); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_TEX_COORD); + GL::enableVertexAttribs(GL::VERTEX_ATTRIB_FLAG_POS_COLOR_TEX); // vertex glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, sizeof(V2F_C4B_T2F), (GLvoid *)offsetof(V2F_C4B_T2F, vertices)); // color @@ -385,12 +453,12 @@ void DrawNode::onDrawGLLine(const Mat4 &transform, uint32_t /*flags*/) glLineWidth(_lineWidth); glDrawArrays(GL_LINES, 0, _bufferCountGLLine); - + if (Configuration::getInstance()->supportsShareableVAO()) { - glBindVertexArray(0); + GL::bindVAO(0); } - + glBindBuffer(GL_ARRAY_BUFFER, 0); CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1,_bufferCountGLLine); @@ -404,40 +472,38 @@ void DrawNode::onDrawGLPoint(const Mat4 &transform, uint32_t /*flags*/) glProgram->setUniformsForBuiltins(transform); glProgram->setUniformLocationWith1f(glProgram->getUniformLocation("u_alpha"), _displayedOpacity / 255.0); - utils::setBlending(_blendFunc.src, _blendFunc.dst); + GL::blendFunc(_blendFunc.src, _blendFunc.dst); if (_dirtyGLPoint) { glBindBuffer(GL_ARRAY_BUFFER, _vboGLPoint); glBufferData(GL_ARRAY_BUFFER, sizeof(V2F_C4B_T2F)*_bufferCapacityGLPoint, _bufferGLPoint, GL_STREAM_DRAW); - + _dirtyGLPoint = false; } - + if (Configuration::getInstance()->supportsShareableVAO()) { - glBindVertexArray(_vaoGLPoint); + GL::bindVAO(_vaoGLPoint); } else { glBindBuffer(GL_ARRAY_BUFFER, _vboGLPoint); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_COLOR); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_TEX_COORD); + GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POS_COLOR_TEX); glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, sizeof(V2F_C4B_T2F), (GLvoid *)offsetof(V2F_C4B_T2F, vertices)); glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(V2F_C4B_T2F), (GLvoid *)offsetof(V2F_C4B_T2F, colors)); glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_TEX_COORD, 2, GL_FLOAT, GL_FALSE, sizeof(V2F_C4B_T2F), (GLvoid *)offsetof(V2F_C4B_T2F, texCoords)); } - + glDrawArrays(GL_POINTS, 0, _bufferCountGLPoint); - + if (Configuration::getInstance()->supportsShareableVAO()) { - glBindVertexArray(0); + GL::bindVAO(0); } - + glBindBuffer(GL_ARRAY_BUFFER, 0); - + CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1,_bufferCountGLPoint); CHECK_GL_ERROR_DEBUG(); } @@ -445,11 +511,10 @@ void DrawNode::onDrawGLPoint(const Mat4 &transform, uint32_t /*flags*/) void DrawNode::drawPoint(const Vec2& position, const float pointSize, const Color4F &color) { ensureCapacityGLPoint(1); - - V2F_C4B_T2F *point = (V2F_C4B_T2F*)(_bufferGLPoint + _bufferCountGLPoint); - V2F_C4B_T2F a = {position, Color4B(color), Tex2F(pointSize,0)}; - *point = a; - + + V2F_C4B_T2F *point = _bufferGLPoint + _bufferCountGLPoint; + *point = {position, Color4B(color), Tex2F(pointSize,0)}; + _bufferCountGLPoint += 1; _dirtyGLPoint = true; } @@ -462,15 +527,14 @@ void DrawNode::drawPoints(const Vec2 *position, unsigned int numberOfPoints, con void DrawNode::drawPoints(const Vec2 *position, unsigned int numberOfPoints, const float pointSize, const Color4F &color) { ensureCapacityGLPoint(numberOfPoints); - - V2F_C4B_T2F *point = (V2F_C4B_T2F*)(_bufferGLPoint + _bufferCountGLPoint); - + + V2F_C4B_T2F *point = _bufferGLPoint + _bufferCountGLPoint; + for(unsigned int i=0; i < numberOfPoints; i++,point++) { - V2F_C4B_T2F a = {position[i], Color4B(color), Tex2F(pointSize,0)}; - *point = a; + *point = {position[i], Color4B(color), Tex2F(pointSize,0)}; } - + _bufferCountGLPoint += numberOfPoints; _dirtyGLPoint = true; } @@ -478,25 +542,22 @@ void DrawNode::drawPoints(const Vec2 *position, unsigned int numberOfPoints, con void DrawNode::drawLine(const Vec2 &origin, const Vec2 &destination, const Color4F &color) { ensureCapacityGLLine(2); - - V2F_C4B_T2F *point = (V2F_C4B_T2F*)(_bufferGLLine + _bufferCountGLLine); - - V2F_C4B_T2F a = {origin, Color4B(color), Tex2F(0.0, 0.0)}; - V2F_C4B_T2F b = {destination, Color4B(color), Tex2F(0.0, 0.0)}; - - *point = a; - *(point+1) = b; - + + V2F_C4B_T2F *point = _bufferGLLine + _bufferCountGLLine; + + *point = {origin, Color4B(color), Tex2F(0.0, 0.0)}; + *(point + 1) = {destination, Color4B(color), Tex2F(0.0, 0.0)}; + _bufferCountGLLine += 2; _dirtyGLLine = true; } void DrawNode::drawRect(const Vec2 &origin, const Vec2 &destination, const Color4F &color) { - drawLine(Vec2(origin.x, origin.y), Vec2(destination.x, origin.y), color); - drawLine(Vec2(destination.x, origin.y), Vec2(destination.x, destination.y), color); - drawLine(Vec2(destination.x, destination.y), Vec2(origin.x, destination.y), color); - drawLine(Vec2(origin.x, destination.y), Vec2(origin.x, origin.y), color); + drawLine(origin, Vec2(destination.x, origin.y), color); + drawLine(Vec2(destination.x, origin.y), destination, color); + drawLine(destination, Vec2(origin.x, destination.y), color); + drawLine(Vec2(origin.x, destination.y), origin, color); } void DrawNode::drawPoly(const Vec2 *poli, unsigned int numberOfPoints, bool closePolygon, const Color4F &color) @@ -512,43 +573,39 @@ void DrawNode::drawPoly(const Vec2 *poli, unsigned int numberOfPoints, bool clos vertex_count = 2 * (numberOfPoints - 1); ensureCapacityGLLine(vertex_count); } - - V2F_C4B_T2F *point = (V2F_C4B_T2F*)(_bufferGLLine + _bufferCountGLLine); - + + V2F_C4B_T2F *point = _bufferGLLine + _bufferCountGLLine; + unsigned int i = 0; - for(; icount(); - + for( unsigned int i=0; i < segments+1;i++) { - + float dt = (float)i / segments; - + // border if( dt == 1 ) { p = config->count() - 1; @@ -633,20 +690,20 @@ void DrawNode::drawCardinalSpline(PointArray *config, float tension, unsigned i p = dt / deltaT; lt = (dt - deltaT * (float)p) / deltaT; } - + // Interpolate Vec2 pp0 = config->getControlPointAtIndex(p-1); Vec2 pp1 = config->getControlPointAtIndex(p+0); Vec2 pp2 = config->getControlPointAtIndex(p+1); Vec2 pp3 = config->getControlPointAtIndex(p+2); - + Vec2 newPos = ccCardinalSplineAt( pp0, pp1, pp2, pp3, tension, lt); vertices[i].x = newPos.x; vertices[i].y = newPos.y; } - + drawPoly(vertices, segments+1, false, color); - + CC_SAFE_DELETE_ARRAY(vertices); } @@ -659,175 +716,164 @@ void DrawNode::drawDot(const Vec2 &pos, float radius, const Color4F &color) { unsigned int vertex_count = 2*3; ensureCapacity(vertex_count); - + V2F_C4B_T2F a = {Vec2(pos.x - radius, pos.y - radius), Color4B(color), Tex2F(-1.0, -1.0) }; V2F_C4B_T2F b = {Vec2(pos.x - radius, pos.y + radius), Color4B(color), Tex2F(-1.0, 1.0) }; V2F_C4B_T2F c = {Vec2(pos.x + radius, pos.y + radius), Color4B(color), Tex2F( 1.0, 1.0) }; V2F_C4B_T2F d = {Vec2(pos.x + radius, pos.y - radius), Color4B(color), Tex2F( 1.0, -1.0) }; - + V2F_C4B_T2F_Triangle *triangles = (V2F_C4B_T2F_Triangle *)(_buffer + _bufferCount); V2F_C4B_T2F_Triangle triangle0 = {a, b, c}; V2F_C4B_T2F_Triangle triangle1 = {a, c, d}; triangles[0] = triangle0; triangles[1] = triangle1; - + _bufferCount += vertex_count; - + _dirty = true; } void DrawNode::drawRect(const Vec2 &p1, const Vec2 &p2, const Vec2 &p3, const Vec2& p4, const Color4F &color) { - drawLine(Vec2(p1.x, p1.y), Vec2(p2.x, p2.y), color); - drawLine(Vec2(p2.x, p2.y), Vec2(p3.x, p3.y), color); - drawLine(Vec2(p3.x, p3.y), Vec2(p4.x, p4.y), color); - drawLine(Vec2(p4.x, p4.y), Vec2(p1.x, p1.y), color); + drawLine(p1, p2, color); + drawLine(p2, p3, color); + drawLine(p3, p4, color); + drawLine(p4, p1, color); } void DrawNode::drawSegment(const Vec2 &from, const Vec2 &to, float radius, const Color4F &color) { unsigned int vertex_count = 6*3; ensureCapacity(vertex_count); - - Vec2 a = __v2f(from); - Vec2 b = __v2f(to); - - - Vec2 n = v2fnormalize(v2fperp(v2fsub(b, a))); - Vec2 t = v2fperp(n); - - Vec2 nw = v2fmult(n, radius); - Vec2 tw = v2fmult(t, radius); - Vec2 v0 = v2fsub(b, v2fadd(nw, tw)); - Vec2 v1 = v2fadd(b, v2fsub(nw, tw)); - Vec2 v2 = v2fsub(b, nw); - Vec2 v3 = v2fadd(b, nw); - Vec2 v4 = v2fsub(a, nw); - Vec2 v5 = v2fadd(a, nw); - Vec2 v6 = v2fsub(a, v2fsub(nw, tw)); - Vec2 v7 = v2fadd(a, v2fadd(nw, tw)); - - + + Vec2 a = from; + Vec2 b = to; + + + Vec2 n = ((b - a).getPerp()).getNormalized(); + Vec2 t = n.getPerp(); + + Vec2 nw = n * radius; + Vec2 tw = t * radius; + Vec2 v0 = b - (nw + tw); + Vec2 v1 = b + (nw - tw); + Vec2 v2 = b - nw; + Vec2 v3 = b + nw; + Vec2 v4 = a - nw; + Vec2 v5 = a + nw; + Vec2 v6 = a - (nw - tw); + Vec2 v7 = a + (nw + tw); + + V2F_C4B_T2F_Triangle *triangles = (V2F_C4B_T2F_Triangle *)(_buffer + _bufferCount); - + V2F_C4B_T2F_Triangle triangles0 = { - {v0, Color4B(color), __t(v2fneg(v2fadd(n, t)))}, - {v1, Color4B(color), __t(v2fsub(n, t))}, - {v2, Color4B(color), __t(v2fneg(n))}, + {v0, Color4B(color), v2ToTex2F(-(n + t))}, + {v1, Color4B(color), v2ToTex2F(n - t)}, + {v2, Color4B(color), v2ToTex2F(-n)}, }; triangles[0] = triangles0; - + V2F_C4B_T2F_Triangle triangles1 = { - {v3, Color4B(color), __t(n)}, - {v1, Color4B(color), __t(v2fsub(n, t))}, - {v2, Color4B(color), __t(v2fneg(n))}, + {v3, Color4B(color), v2ToTex2F(n)}, + {v1, Color4B(color), v2ToTex2F(n - t)}, + {v2, Color4B(color), v2ToTex2F(-n)}, }; triangles[1] = triangles1; - + V2F_C4B_T2F_Triangle triangles2 = { - {v3, Color4B(color), __t(n)}, - {v4, Color4B(color), __t(v2fneg(n))}, - {v2, Color4B(color), __t(v2fneg(n))}, + {v3, Color4B(color), v2ToTex2F(n)}, + {v4, Color4B(color), v2ToTex2F(-n)}, + {v2, Color4B(color), v2ToTex2F(-n)}, }; triangles[2] = triangles2; V2F_C4B_T2F_Triangle triangles3 = { - {v3, Color4B(color), __t(n)}, - {v4, Color4B(color), __t(v2fneg(n))}, - {v5, Color4B(color), __t(n) }, + {v3, Color4B(color), v2ToTex2F(n)}, + {v4, Color4B(color), v2ToTex2F(-n)}, + {v5, Color4B(color), v2ToTex2F(n) }, }; triangles[3] = triangles3; V2F_C4B_T2F_Triangle triangles4 = { - {v6, Color4B(color), __t(v2fsub(t, n))}, - {v4, Color4B(color), __t(v2fneg(n)) }, - {v5, Color4B(color), __t(n)}, + {v6, Color4B(color), v2ToTex2F(t - n)}, + {v4, Color4B(color), v2ToTex2F(-n) }, + {v5, Color4B(color), v2ToTex2F(n)}, }; triangles[4] = triangles4; V2F_C4B_T2F_Triangle triangles5 = { - {v6, Color4B(color), __t(v2fsub(t, n))}, - {v7, Color4B(color), __t(v2fadd(n, t))}, - {v5, Color4B(color), __t(n)}, + {v6, Color4B(color), v2ToTex2F(t - n)}, + {v7, Color4B(color), v2ToTex2F(t + n)}, + {v5, Color4B(color), v2ToTex2F(n)}, }; triangles[5] = triangles5; - + _bufferCount += vertex_count; - + _dirty = true; } void DrawNode::drawPolygon(const Vec2 *verts, int count, const Color4F &fillColor, float borderWidth, const Color4F &borderColor) { CCASSERT(count >= 0, "invalid count value"); - + bool outline = (borderColor.a > 0.0f && borderWidth > 0.0f); - + auto triangle_count = outline ? (3*count - 2) : (count - 2); auto vertex_count = 3*triangle_count; ensureCapacity(vertex_count); - + V2F_C4B_T2F_Triangle *triangles = (V2F_C4B_T2F_Triangle *)(_buffer + _bufferCount); V2F_C4B_T2F_Triangle *cursor = triangles; - - for (int i = 0; i < count-2; i++) - { - V2F_C4B_T2F_Triangle tmp = { - {verts[0], Color4B(fillColor), __t(v2fzero)}, - {verts[i+1], Color4B(fillColor), __t(v2fzero)}, - {verts[i+2], Color4B(fillColor), __t(v2fzero)}, - }; - - *cursor++ = tmp; - } + + cursor = Triangulate::processTriangles(verts,cursor,count,fillColor); if(outline) { struct ExtrudeVerts {Vec2 offset, n;}; - struct ExtrudeVerts* extrude = (struct ExtrudeVerts*)malloc(sizeof(struct ExtrudeVerts)*count); - memset(extrude, 0, sizeof(struct ExtrudeVerts)*count); + ExtrudeVerts* extrude = (ExtrudeVerts *)malloc(sizeof(ExtrudeVerts) * count); for (int i = 0; i < count; i++) { - Vec2 v0 = __v2f(verts[(i-1+count)%count]); - Vec2 v1 = __v2f(verts[i]); - Vec2 v2 = __v2f(verts[(i+1)%count]); + Vec2 v0 = verts[(i-1+count)%count]; + Vec2 v1 = verts[i]; + Vec2 v2 = verts[(i+1)%count]; - Vec2 n1 = v2fnormalize(v2fperp(v2fsub(v1, v0))); - Vec2 n2 = v2fnormalize(v2fperp(v2fsub(v2, v1))); + Vec2 n1 = ((v1 - v0).getPerp()).getNormalized(); + Vec2 n2 = ((v2 - v1).getPerp()).getNormalized(); - Vec2 offset = v2fmult(v2fadd(n1, n2), 1.0f / (v2fdot(n1, n2) + 1.0f)); - struct ExtrudeVerts tmp = {offset, n2}; - extrude[i] = tmp; + Vec2 offset = (n1 + n2) * (1.0f / (Vec2::dot(n1, n2) + 1.0f)); + extrude[i] = {offset, n2}; } for(int i = 0; i < count; i++) { int j = (i+1)%count; - Vec2 v0 = __v2f(verts[i]); - Vec2 v1 = __v2f(verts[j]); + Vec2 v0 = verts[i]; + Vec2 v1 = verts[j]; Vec2 n0 = extrude[i].n; Vec2 offset0 = extrude[i].offset; Vec2 offset1 = extrude[j].offset; - Vec2 inner0 = v2fsub(v0, v2fmult(offset0, borderWidth)); - Vec2 inner1 = v2fsub(v1, v2fmult(offset1, borderWidth)); - Vec2 outer0 = v2fadd(v0, v2fmult(offset0, borderWidth)); - Vec2 outer1 = v2fadd(v1, v2fmult(offset1, borderWidth)); + Vec2 inner0 = v0 - offset0 * borderWidth; + Vec2 inner1 = v1 - offset1 * borderWidth; + Vec2 outer0 = v0 + offset0 * borderWidth; + Vec2 outer1 = v1 + offset1 * borderWidth; V2F_C4B_T2F_Triangle tmp1 = { - {inner0, Color4B(borderColor), __t(v2fneg(n0))}, - {inner1, Color4B(borderColor), __t(v2fneg(n0))}, - {outer1, Color4B(borderColor), __t(n0)} + {inner0, Color4B(borderColor), v2ToTex2F(-n0)}, + {inner1, Color4B(borderColor), v2ToTex2F(-n0)}, + {outer1, Color4B(borderColor), v2ToTex2F(n0)} }; *cursor++ = tmp1; V2F_C4B_T2F_Triangle tmp2 = { - {inner0, Color4B(borderColor), __t(v2fneg(n0))}, - {outer0, Color4B(borderColor), __t(n0)}, - {outer1, Color4B(borderColor), __t(n0)} + {inner0, Color4B(borderColor), v2ToTex2F(-n0)}, + {outer0, Color4B(borderColor), v2ToTex2F(n0)}, + {outer1, Color4B(borderColor), v2ToTex2F(n0)} }; *cursor++ = tmp2; } @@ -849,12 +895,12 @@ void DrawNode::drawSolidRect(const Vec2 &origin, const Vec2 &destination, const Vec2(origin.x, destination.y) }; - drawSolidPoly(vertices, 4, color ); + drawSolidPoly(vertices, 4, color); } void DrawNode::drawSolidPoly(const Vec2 *poli, unsigned int numberOfPoints, const Color4F &color) { - drawPolygon(poli, numberOfPoints, color, 0.0, Color4F(0.0, 0.0, 0.0, 0.0)); + drawPolygon(poli, numberOfPoints, color, 0.0, Color4F()); } void DrawNode::drawSolidCircle(const Vec2& center, float radius, float angle, unsigned int segments, float scaleX, float scaleY, const Color4F &color) @@ -891,9 +937,9 @@ void DrawNode::drawTriangle(const Vec2 &p1, const Vec2 &p2, const Vec2 &p3, cons ensureCapacity(vertex_count); Color4B col = Color4B(color); - V2F_C4B_T2F a = {Vec2(p1.x, p1.y), col, Tex2F(0.0, 0.0) }; - V2F_C4B_T2F b = {Vec2(p2.x, p2.y), col, Tex2F(0.0, 0.0) }; - V2F_C4B_T2F c = {Vec2(p3.x, p3.y), col, Tex2F(0.0, 0.0) }; + V2F_C4B_T2F a = {p1, col, Tex2F(0.0, 0.0) }; + V2F_C4B_T2F b = {p2, col, Tex2F(0.0, 0.0) }; + V2F_C4B_T2F c = {p3, col, Tex2F(0.0, 0.0) }; V2F_C4B_T2F_Triangle *triangles = (V2F_C4B_T2F_Triangle *)(_buffer + _bufferCount); V2F_C4B_T2F_Triangle triangle = {a, b, c}; diff --git a/cocos/2d/CCDrawNode.h b/cocos/2d/CCDrawNode.h index 53bb157143d1..1607719ac8b1 100644 --- a/cocos/2d/CCDrawNode.h +++ b/cocos/2d/CCDrawNode.h @@ -41,6 +41,32 @@ NS_CC_BEGIN static const int DEFAULT_LINE_WIDTH = 2; +/* + * Code of Triangulate copied & pasted from http://www.flipcode.com/archives/Efficient_Polygon_Triangulation.shtml, + * Added some changes for cocos2d + */ +class Triangulate +{ +public: + + // triangulate a contour/polygon, places results in STL vector + // as series of triangles. + static V2F_C4B_T2F_Triangle * processTriangles(const Vec2 *verts,V2F_C4B_T2F_Triangle * triangles,int n,const Color4F &fillColor); + + // compute area of a contour/polygon + static float computeArea(const Vec2 *verts,int n); + + // decide if point Px/Py is inside triangle defined by + // (Ax,Ay) (Bx,By) (Cx,Cy) + static bool isInsideTriangle(float Ax, float Ay, + float Bx, float By, + float Cx, float Cy, + float Px, float Py); + +private: + static bool checkSnip(const Vec2 *verts,int u,int v,int w,int n,int *V); +}; + class PointArray; /** * @addtogroup _2d diff --git a/cocos/2d/CCDrawingPrimitives.cpp b/cocos/2d/CCDrawingPrimitives.cpp index fd445afd0f49..aa1bd06c9976 100644 --- a/cocos/2d/CCDrawingPrimitives.cpp +++ b/cocos/2d/CCDrawingPrimitives.cpp @@ -44,6 +44,7 @@ THE SOFTWARE. #include "2d/CCActionCatmullRom.h" #include "base/CCDirector.h" +#include "renderer/ccGLStateCache.h" #include "renderer/CCGLProgramCache.h" #include "renderer/CCRenderer.h" #include "platform/CCGL.h" @@ -110,7 +111,7 @@ void drawPoint(const Vec2& point) p.x = point.x; p.y = point.y; - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION); + GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION ); s_shader->use(); s_shader->setUniformsForBuiltins(); @@ -128,7 +129,7 @@ void drawPoints( const Vec2 *points, unsigned int numberOfPoints ) { lazy_init(); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION); + GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION ); s_shader->use(); s_shader->setUniformsForBuiltins(); s_shader->setUniformLocationWith4fv(s_colorLocation, (GLfloat*) &s_color.r, 1); @@ -154,7 +155,7 @@ void drawLine(const Vec2& origin, const Vec2& destination) s_shader->setUniformsForBuiltins(); s_shader->setUniformLocationWith4fv(s_colorLocation, (GLfloat*) &s_color.r, 1); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION); + GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION ); glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices); glDrawArrays(GL_LINES, 0, 2); @@ -189,7 +190,8 @@ void drawPoly(const Vec2 *poli, unsigned int numberOfPoints, bool closePolygon) s_shader->setUniformsForBuiltins(); s_shader->setUniformLocationWith4fv(s_colorLocation, (GLfloat*) &s_color.r, 1); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION); + GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION ); + glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, poli); if( closePolygon ) @@ -208,7 +210,8 @@ void drawSolidPoly(const Vec2 *poli, unsigned int numberOfPoints, Color4F color) s_shader->setUniformsForBuiltins(); s_shader->setUniformLocationWith4fv(s_colorLocation, (GLfloat*) &color.r, 1); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION); + GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION ); + glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, poli); glDrawArrays(GL_TRIANGLE_FAN, 0, (GLsizei) numberOfPoints); @@ -244,7 +247,8 @@ void drawCircle( const Vec2& center, float radius, float angle, unsigned int seg s_shader->setUniformsForBuiltins(); s_shader->setUniformLocationWith4fv(s_colorLocation, (GLfloat*) &s_color.r, 1); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION); + GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION ); + glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices); glDrawArrays(GL_LINE_STRIP, 0, (GLsizei) segments+additionalSegment); @@ -283,7 +287,8 @@ void drawSolidCircle( const Vec2& center, float radius, float angle, unsigned in s_shader->setUniformsForBuiltins(); s_shader->setUniformLocationWith4fv(s_colorLocation, (GLfloat*) &s_color.r, 1); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION); + GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION ); + glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices); glDrawArrays(GL_TRIANGLE_FAN, 0, (GLsizei) segments+1); @@ -318,7 +323,8 @@ void drawQuadBezier(const Vec2& origin, const Vec2& control, const Vec2& destina s_shader->setUniformsForBuiltins(); s_shader->setUniformLocationWith4fv(s_colorLocation, (GLfloat*) &s_color.r, 1); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION); + GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION ); + glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices); glDrawArrays(GL_LINE_STRIP, 0, (GLsizei) segments + 1); CC_SAFE_DELETE_ARRAY(vertices); @@ -369,7 +375,8 @@ void drawCardinalSpline( PointArray *config, float tension, unsigned int segmen s_shader->setUniformsForBuiltins(); s_shader->setUniformLocationWith4fv(s_colorLocation, (GLfloat*)&s_color.r, 1); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION); + GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION ); + glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices); glDrawArrays(GL_LINE_STRIP, 0, (GLsizei) segments + 1); @@ -397,7 +404,8 @@ void drawCubicBezier(const Vec2& origin, const Vec2& control1, const Vec2& contr s_shader->setUniformsForBuiltins(); s_shader->setUniformLocationWith4fv(s_colorLocation, (GLfloat*) &s_color.r, 1); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION); + GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION ); + glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices); glDrawArrays(GL_LINE_STRIP, 0, (GLsizei) segments + 1); CC_SAFE_DELETE_ARRAY(vertices); diff --git a/cocos/2d/CCDrawingPrimitives.h b/cocos/2d/CCDrawingPrimitives.h index f972a27411c8..b77bf19c9f10 100644 --- a/cocos/2d/CCDrawingPrimitives.h +++ b/cocos/2d/CCDrawingPrimitives.h @@ -263,7 +263,7 @@ namespace DrawPrimitives */ CC_DEPRECATED_ATTRIBUTE void CC_DLL setPointSize(GLfloat pointSize); -}; +} // end of global group /** @} */ diff --git a/cocos/2d/CCFastTMXLayer.cpp b/cocos/2d/CCFastTMXLayer.cpp index 5f7d0b6cae96..cc69a334b502 100644 --- a/cocos/2d/CCFastTMXLayer.cpp +++ b/cocos/2d/CCFastTMXLayer.cpp @@ -36,11 +36,13 @@ THE SOFTWARE. */ #include "2d/CCFastTMXLayer.h" +#include #include "2d/CCFastTMXTiledMap.h" #include "2d/CCSprite.h" #include "2d/CCCamera.h" #include "renderer/CCTextureCache.h" #include "renderer/CCGLProgramCache.h" +#include "renderer/ccGLStateCache.h" #include "renderer/CCRenderer.h" #include "renderer/CCVertexIndexBuffer.h" #include "base/CCDirector.h" @@ -151,8 +153,9 @@ void TMXLayer::draw(Renderer *renderer, const Mat4& transform, uint32_t flags) if( flags != 0 || _dirty || _quadsDirty || isViewProjectionUpdated) { Size s = Director::getInstance()->getVisibleSize(); - auto rect = Rect(Camera::getVisitingCamera()->getPositionX() - s.width * 0.5f, - Camera::getVisitingCamera()->getPositionY() - s.height * 0.5f, + const Vec2 &anchor = getAnchorPoint(); + auto rect = Rect(Camera::getVisitingCamera()->getPositionX() - s.width * (anchor.x == 0.0f ? 0.5f : anchor.x), + Camera::getVisitingCamera()->getPositionY() - s.height * (anchor.y == 0.0f ? 0.5f : anchor.y), s.width, s.height); @@ -186,11 +189,10 @@ void TMXLayer::draw(Renderer *renderer, const Mat4& transform, uint32_t flags) void TMXLayer::onDraw(Primitive *primitive) { - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, _texture->getName()); + GL::bindTexture2D(_texture->getName()); getGLProgramState()->apply(_modelViewTransform); - glBindVertexArray(0); + GL::bindVAO(0); primitive->draw(); glBindBuffer(GL_ARRAY_BUFFER, 0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); @@ -209,10 +211,10 @@ void TMXLayer::updateTiles(const Rect& culledRect) visibleTiles.origin.y += 1; // if x=0.7, width=9.5, we need to draw number 0~10 of tiles, and so is height. - visibleTiles.size.width = ceil(visibleTiles.origin.x + visibleTiles.size.width) - floor(visibleTiles.origin.x); - visibleTiles.size.height = ceil(visibleTiles.origin.y + visibleTiles.size.height) - floor(visibleTiles.origin.y); - visibleTiles.origin.x = floor(visibleTiles.origin.x); - visibleTiles.origin.y = floor(visibleTiles.origin.y); + visibleTiles.size.width = std::ceil(visibleTiles.origin.x + visibleTiles.size.width) - std::floor(visibleTiles.origin.x); + visibleTiles.size.height = std::ceil(visibleTiles.origin.y + visibleTiles.size.height) - std::floor(visibleTiles.origin.y); + visibleTiles.origin.x = std::floor(visibleTiles.origin.x); + visibleTiles.origin.y = std::floor(visibleTiles.origin.y); // for the bigger tiles. int tilesOverX = 0; @@ -221,8 +223,8 @@ void TMXLayer::updateTiles(const Rect& culledRect) float tileSizeMax = std::max(tileSize.width, tileSize.height); if (_layerOrientation == FAST_TMX_ORIENTATION_ORTHO) { - tilesOverX = ceil(tileSizeMax / mapTileSize.width) - 1; - tilesOverY = ceil(tileSizeMax / mapTileSize.height) - 1; + tilesOverX = std::ceil(tileSizeMax / mapTileSize.width) - 1; + tilesOverY = std::ceil(tileSizeMax / mapTileSize.height) - 1; if (tilesOverX < 0) tilesOverX = 0; if (tilesOverY < 0) tilesOverY = 0; @@ -234,8 +236,8 @@ void TMXLayer::updateTiles(const Rect& culledRect) if (overTileRect.size.height < 0) overTileRect.size.height = 0; overTileRect = RectApplyTransform(overTileRect, nodeToTileTransform); - tilesOverX = ceil(overTileRect.origin.x + overTileRect.size.width) - floor(overTileRect.origin.x); - tilesOverY = ceil(overTileRect.origin.y + overTileRect.size.height) - floor(overTileRect.origin.y); + tilesOverX = std::ceil(overTileRect.origin.x + overTileRect.size.width) - std::floor(overTileRect.origin.x); + tilesOverY = std::ceil(overTileRect.origin.y + overTileRect.size.height) - std::floor(overTileRect.origin.y); } else { @@ -292,7 +294,7 @@ void TMXLayer::updateTiles(const Rect& culledRect) void TMXLayer::updateVertexBuffer() { - glBindVertexArray(0); + GL::bindVAO(0); if(nullptr == _vData) { _vertexBuffer = VertexBuffer::create(sizeof(V3F_C4B_T2F), (int)_totalQuads.size() * 4); @@ -346,15 +348,15 @@ void TMXLayer::setupTiles() switch (_layerOrientation) { case FAST_TMX_ORIENTATION_ORTHO: - _screenGridSize.width = ceil(screenSize.width / _mapTileSize.width) + 1; - _screenGridSize.height = ceil(screenSize.height / _mapTileSize.height) + 1; + _screenGridSize.width = std::ceil(screenSize.width / _mapTileSize.width) + 1; + _screenGridSize.height = std::ceil(screenSize.height / _mapTileSize.height) + 1; // tiles could be bigger than the grid, add additional rows if needed _screenGridSize.height += _tileSet->_tileSize.height / _mapTileSize.height; break; case FAST_TMX_ORIENTATION_ISO: - _screenGridSize.width = ceil(screenSize.width / _mapTileSize.width) + 2; - _screenGridSize.height = ceil(screenSize.height / (_mapTileSize.height/2)) + 4; + _screenGridSize.width = std::ceil(screenSize.width / _mapTileSize.width) + 2; + _screenGridSize.height = std::ceil(screenSize.height / (_mapTileSize.height/2)) + 4; break; case FAST_TMX_ORIENTATION_HEX: default: @@ -441,6 +443,11 @@ void TMXLayer::updatePrimitives() } } +void TMXLayer::setOpacity(GLubyte opacity) { + Node::setOpacity(opacity); + _quadsDirty = true; +} + void TMXLayer::updateTotalQuads() { if(_quadsDirty) @@ -452,6 +459,15 @@ void TMXLayer::updateTotalQuads() _indices.resize(6 * int(_layerSize.width * _layerSize.height)); _tileToQuadIndex.resize(int(_layerSize.width * _layerSize.height),-1); _indicesVertexZOffsets.clear(); + + auto color = Color4B::WHITE; + color.a = getDisplayedOpacity(); + + if (_texture->hasPremultipliedAlpha()) { + color.r *= color.a / 255.0f; + color.g *= color.a / 255.0f; + color.b *= color.a / 255.0f; + } int quadIndex = 0; for(int y = 0; y < _layerSize.height; ++y) @@ -550,11 +566,11 @@ void TMXLayer::updateTotalQuads() quad.tl.texCoords.v = top; quad.tr.texCoords.u = right; quad.tr.texCoords.v = top; - - quad.bl.colors = Color4B::WHITE; - quad.br.colors = Color4B::WHITE; - quad.tl.colors = Color4B::WHITE; - quad.tr.colors = Color4B::WHITE; + + quad.bl.colors = color; + quad.br.colors = color; + quad.tl.colors = color; + quad.tr.colors = color; ++quadIndex; } diff --git a/cocos/2d/CCFastTMXLayer.h b/cocos/2d/CCFastTMXLayer.h index 7c71636ec060..eb289d67e86b 100644 --- a/cocos/2d/CCFastTMXLayer.h +++ b/cocos/2d/CCFastTMXLayer.h @@ -297,6 +297,8 @@ class CC_DLL TMXLayer : public Node void updateVertexBuffer(); void updateIndexBuffer(); void updatePrimitives(); + + virtual void setOpacity(GLubyte opacity) override; protected: //! name of the layer diff --git a/cocos/2d/CCFastTMXTiledMap.cpp b/cocos/2d/CCFastTMXTiledMap.cpp index 7a29a3bb1827..f578ef59f584 100644 --- a/cocos/2d/CCFastTMXTiledMap.cpp +++ b/cocos/2d/CCFastTMXTiledMap.cpp @@ -60,7 +60,7 @@ TMXTiledMap* TMXTiledMap::createWithXML(const std::string& tmxString, const std: bool TMXTiledMap::initWithTMXFile(const std::string& tmxFile) { - CCASSERT(tmxFile.size()>0, "FastTMXTiledMap: tmx file should not be empty"); + CCASSERT(!tmxFile.empty(), "FastTMXTiledMap: tmx file should not be empty"); setContentSize(Size::ZERO); @@ -198,14 +198,14 @@ void TMXTiledMap::buildWithMapInfo(TMXMapInfo* mapInfo) // public TMXLayer * TMXTiledMap::getLayer(const std::string& layerName) const { - CCASSERT(layerName.size() > 0, "Invalid layer name!"); + CCASSERT(!layerName.empty(), "Invalid layer name!"); for (auto& child : _children) { TMXLayer* layer = dynamic_cast(child); if(layer) { - if(layerName.compare( layer->getLayerName()) == 0) + if(layerName == layer->getLayerName()) { return layer; } @@ -218,9 +218,9 @@ TMXLayer * TMXTiledMap::getLayer(const std::string& layerName) const TMXObjectGroup * TMXTiledMap::getObjectGroup(const std::string& groupName) const { - CCASSERT(groupName.size() > 0, "Invalid group name!"); + CCASSERT(!groupName.empty(), "Invalid group name!"); - if (_objectGroups.size()>0) + if (!_objectGroups.empty()) { for (const auto& objectGroup : _objectGroups) { diff --git a/cocos/2d/CCFontAtlas.cpp b/cocos/2d/CCFontAtlas.cpp index b03bd37e8534..5f9e73c25712 100644 --- a/cocos/2d/CCFontAtlas.cpp +++ b/cocos/2d/CCFontAtlas.cpp @@ -71,8 +71,12 @@ FontAtlas::FontAtlas(Font &theFont) { _letterPadding += 2 * FontFreeType::DistanceMapSpread; } - - reinit(); + + auto outlineSize = _fontFreeType->getOutlineSize(); + if (outlineSize > 0) + { + _lineHeight += 2 * outlineSize; + } #if CC_ENABLE_CACHE_TEXTURE_DATA auto eventDispatcher = Director::getInstance()->getEventDispatcher(); @@ -98,7 +102,6 @@ void FontAtlas::reinit() auto outlineSize = _fontFreeType->getOutlineSize(); if(outlineSize > 0) { - _lineHeight += 2 * outlineSize; _currentPageDataSize *= 2; } @@ -343,7 +346,10 @@ bool FontAtlas::prepareLetterDefinitions(const std::u32string& utf32Text) { return false; } - + + if (!_currentPageData) + reinit(); + std::unordered_map codeMapOfNewChar; findNewCharacters(utf32Text, codeMapOfNewChar); if (codeMapOfNewChar.empty()) @@ -430,10 +436,10 @@ bool FontAtlas::prepareLetterDefinitions(const std::u32string& utf32Text) tempDef.height = tempDef.height / scaleFactor; tempDef.U = tempDef.U / scaleFactor; tempDef.V = tempDef.V / scaleFactor; + tempDef.rotated = false; } else{ - if(bitmap) - delete[] bitmap; + delete[] bitmap; if (tempDef.xAdvance) tempDef.validDefinition = true; else @@ -446,6 +452,7 @@ bool FontAtlas::prepareLetterDefinitions(const std::u32string& utf32Text) tempDef.offsetX = 0; tempDef.offsetY = 0; tempDef.textureID = 0; + tempDef.rotated = false; _currentPageOrigX += 1; } @@ -486,9 +493,9 @@ std::string FontAtlas::getFontName() const { std::string fontName = _fontFreeType ? _fontFreeType->getFontName() : ""; if(fontName.empty()) return fontName; - auto idx = fontName.rfind("/"); + auto idx = fontName.rfind('/'); if (idx != std::string::npos) { return fontName.substr(idx + 1); } - idx = fontName.rfind("\\"); + idx = fontName.rfind('\\'); if (idx != std::string::npos) { return fontName.substr(idx + 1); } return fontName; } diff --git a/cocos/2d/CCFontAtlas.h b/cocos/2d/CCFontAtlas.h index 5d05bcd13ba6..04ad3767a3b0 100644 --- a/cocos/2d/CCFontAtlas.h +++ b/cocos/2d/CCFontAtlas.h @@ -55,6 +55,7 @@ struct FontLetterDefinition int textureID; bool validDefinition; int xAdvance; + bool rotated; }; class CC_DLL FontAtlas : public Ref diff --git a/cocos/2d/CCFontAtlasCache.cpp b/cocos/2d/CCFontAtlasCache.cpp index 8913ec734b05..a70e69462151 100644 --- a/cocos/2d/CCFontAtlasCache.cpp +++ b/cocos/2d/CCFontAtlasCache.cpp @@ -36,7 +36,7 @@ NS_CC_BEGIN std::unordered_map FontAtlasCache::_atlasMap; -#define ATLAS_MAP_KEY_BUFFER 255 +#define ATLAS_MAP_KEY_PREFIX_BUFFER_SIZE 255 void FontAtlasCache::purgeCachedData() { @@ -60,15 +60,11 @@ FontAtlas* FontAtlasCache::getFontAtlasTTF(const _ttfConfig* config) useDistanceField = false; } - char tmp[ATLAS_MAP_KEY_BUFFER]; - if (useDistanceField) { - snprintf(tmp, ATLAS_MAP_KEY_BUFFER, "df %.2f %d %s", config->fontSize, config->outlineSize, - realFontFilename.c_str()); - } else { - snprintf(tmp, ATLAS_MAP_KEY_BUFFER, "%.2f %d %s", config->fontSize, config->outlineSize, - realFontFilename.c_str()); - } - std::string atlasName = tmp; + std::string key; + char keyPrefix[ATLAS_MAP_KEY_PREFIX_BUFFER_SIZE]; + snprintf(keyPrefix, ATLAS_MAP_KEY_PREFIX_BUFFER_SIZE, useDistanceField ? "df %.2f %d " : "%.2f %d ", config->fontSize, config->outlineSize); + std::string atlasName(keyPrefix); + atlasName += realFontFilename; auto it = _atlasMap.find(atlasName); @@ -92,21 +88,53 @@ FontAtlas* FontAtlasCache::getFontAtlasTTF(const _ttfConfig* config) return nullptr; } -FontAtlas* FontAtlasCache::getFontAtlasFNT(const std::string& fontFileName, const Vec2& imageOffset /* = Vec2::ZERO */) +FontAtlas* FontAtlasCache::getFontAtlasFNT(const std::string& fontFileName) +{ + return getFontAtlasFNT(fontFileName, Rect::ZERO, false); +} + +FontAtlas* FontAtlasCache::getFontAtlasFNT(const std::string& fontFileName, const std::string& subTextureKey) +{ + const auto realFontFilename = FileUtils::getInstance()->getNewFilename(fontFileName); // resolves real file path, to prevent storing multiple atlases for the same file. + std::string atlasName = subTextureKey + " " + realFontFilename; + + const auto it = _atlasMap.find(atlasName); + if (it == _atlasMap.end()) + { + const auto font = FontFNT::create(realFontFilename, subTextureKey); + + if (font) + { + const auto tempAtlas = font->createFontAtlas(); + if (tempAtlas) + { + _atlasMap[atlasName] = tempAtlas; + return _atlasMap[atlasName]; + } + } + } + else + return it->second; + + return nullptr; +} + +FontAtlas* FontAtlasCache::getFontAtlasFNT(const std::string& fontFileName, const Rect& imageRect, bool imageRotated) { - auto realFontFilename = FileUtils::getInstance()->getNewFilename(fontFileName); // resolves real file path, to prevent storing multiple atlases for the same file. - char tmp[ATLAS_MAP_KEY_BUFFER]; - snprintf(tmp, ATLAS_MAP_KEY_BUFFER, "%.2f %.2f %s", imageOffset.x, imageOffset.y, realFontFilename.c_str()); - std::string atlasName = tmp; + const auto realFontFilename = FileUtils::getInstance()->getNewFilename(fontFileName); // resolves real file path, to prevent storing multiple atlases for the same file. + char keyPrefix[ATLAS_MAP_KEY_PREFIX_BUFFER_SIZE]; + snprintf(keyPrefix, ATLAS_MAP_KEY_PREFIX_BUFFER_SIZE, "%.2f %.2f ", imageRect.origin.x, imageRect.origin.y); + std::string atlasName(keyPrefix); + atlasName += realFontFilename; - auto it = _atlasMap.find(atlasName); + const auto it = _atlasMap.find(atlasName); if ( it == _atlasMap.end() ) { - auto font = FontFNT::create(realFontFilename, imageOffset); + const auto font = FontFNT::create(realFontFilename, imageRect, imageRotated); if(font) { - auto tempAtlas = font->createFontAtlas(); + const auto tempAtlas = font->createFontAtlas(); if (tempAtlas) { _atlasMap[atlasName] = tempAtlas; @@ -120,9 +148,14 @@ FontAtlas* FontAtlasCache::getFontAtlasFNT(const std::string& fontFileName, cons return nullptr; } +FontAtlas* FontAtlasCache::getFontAtlasFNT(const std::string& fontFileName, const Vec2& imageOffset) +{ + return getFontAtlasFNT(fontFileName, Rect(imageOffset.x, imageOffset.y, 0, 0), false); +} + FontAtlas* FontAtlasCache::getFontAtlasCharMap(const std::string& plistFile) { - std::string atlasName = plistFile; + const std::string& atlasName = plistFile; auto it = _atlasMap.find(atlasName); if ( it == _atlasMap.end() ) @@ -147,9 +180,9 @@ FontAtlas* FontAtlasCache::getFontAtlasCharMap(const std::string& plistFile) FontAtlas* FontAtlasCache::getFontAtlasCharMap(Texture2D* texture, int itemWidth, int itemHeight, int startCharMap) { - char tmp[30]; - sprintf(tmp,"name:%u_%d_%d_%d",texture->getName(),itemWidth,itemHeight,startCharMap); - std::string atlasName = tmp; + char key[ATLAS_MAP_KEY_PREFIX_BUFFER_SIZE]; + sprintf(key,"name:%u_%d_%d_%d",texture->getName(),itemWidth,itemHeight,startCharMap); + std::string atlasName = key; auto it = _atlasMap.find(atlasName); if ( it == _atlasMap.end() ) @@ -174,9 +207,10 @@ FontAtlas* FontAtlasCache::getFontAtlasCharMap(Texture2D* texture, int itemWidth FontAtlas* FontAtlasCache::getFontAtlasCharMap(const std::string& charMapFile, int itemWidth, int itemHeight, int startCharMap) { - char tmp[ATLAS_MAP_KEY_BUFFER]; - snprintf(tmp, ATLAS_MAP_KEY_BUFFER, "%d %d %d %s", itemWidth, itemHeight, startCharMap, charMapFile.c_str()); - std::string atlasName = tmp; + char keyPrefix[ATLAS_MAP_KEY_PREFIX_BUFFER_SIZE]; + snprintf(keyPrefix, ATLAS_MAP_KEY_PREFIX_BUFFER_SIZE, "%d %d %d ", itemWidth, itemHeight, startCharMap); + std::string atlasName(keyPrefix); + atlasName += charMapFile; auto it = _atlasMap.find(atlasName); if ( it == _atlasMap.end() ) @@ -222,11 +256,12 @@ bool FontAtlasCache::releaseFontAtlas(FontAtlas *atlas) return false; } -void FontAtlasCache::reloadFontAtlasFNT(const std::string& fontFileName, const Vec2& imageOffset/* = Vec2::ZERO*/) +void FontAtlasCache::reloadFontAtlasFNT(const std::string& fontFileName, const Rect& imageRect, bool imageRotated) { - char tmp[ATLAS_MAP_KEY_BUFFER]; - snprintf(tmp, ATLAS_MAP_KEY_BUFFER, "%.2f %.2f %s", imageOffset.x, imageOffset.y, fontFileName.c_str()); - std::string atlasName = tmp; + char keyPrefix[ATLAS_MAP_KEY_PREFIX_BUFFER_SIZE]; + snprintf(keyPrefix, ATLAS_MAP_KEY_PREFIX_BUFFER_SIZE, "%.2f %.2f ", imageRect.origin.x, imageRect.origin.y); + std::string atlasName(keyPrefix); + atlasName += fontFileName; auto it = _atlasMap.find(atlasName); if (it != _atlasMap.end()) @@ -235,7 +270,7 @@ void FontAtlasCache::reloadFontAtlasFNT(const std::string& fontFileName, const V _atlasMap.erase(it); } FontFNT::reloadBMFontResource(fontFileName); - auto font = FontFNT::create(fontFileName, imageOffset); + auto font = FontFNT::create(fontFileName, imageRect, imageRotated); if (font) { auto tempAtlas = font->createFontAtlas(); @@ -244,7 +279,11 @@ void FontAtlasCache::reloadFontAtlasFNT(const std::string& fontFileName, const V _atlasMap[atlasName] = tempAtlas; } } +} +void FontAtlasCache::reloadFontAtlasFNT(const std::string& fontFileName, const Vec2& imageOffset) +{ + reloadFontAtlasFNT(fontFileName, Rect(imageOffset.x, imageOffset.y, 0, 0), false); } void FontAtlasCache::unloadFontAtlasTTF(const std::string& fontFileName) diff --git a/cocos/2d/CCFontAtlasCache.h b/cocos/2d/CCFontAtlasCache.h index 9ef267651b7a..2479d80c8615 100644 --- a/cocos/2d/CCFontAtlasCache.h +++ b/cocos/2d/CCFontAtlasCache.h @@ -42,7 +42,11 @@ class CC_DLL FontAtlasCache { public: static FontAtlas* getFontAtlasTTF(const _ttfConfig* config); - static FontAtlas* getFontAtlasFNT(const std::string& fontFileName, const Vec2& imageOffset = Vec2::ZERO); + + static FontAtlas* getFontAtlasFNT(const std::string& fontFileName); + static FontAtlas* getFontAtlasFNT(const std::string& fontFileName, const std::string& subTextureKey); + static FontAtlas* getFontAtlasFNT(const std::string& fontFileName, const Rect& imageRect, bool imageRotated); + CC_DEPRECATED_ATTRIBUTE static FontAtlas* getFontAtlasFNT(const std::string& fontFileName, const Vec2& imageOffset); static FontAtlas* getFontAtlasCharMap(const std::string& charMapFile, int itemWidth, int itemHeight, int startCharMap); static FontAtlas* getFontAtlasCharMap(Texture2D* texture, int itemWidth, int itemHeight, int startCharMap); @@ -59,7 +63,9 @@ class CC_DLL FontAtlasCache CAUTION : All component use this font texture should be reset font name, though the file name is same! otherwise, it will cause program crash! */ - static void reloadFontAtlasFNT(const std::string& fontFileName, const Vec2& imageOffset = Vec2::ZERO); + static void reloadFontAtlasFNT(const std::string& fontFileName, const Rect& imageRect, bool imageRotated); + + CC_DEPRECATED_ATTRIBUTE static void reloadFontAtlasFNT(const std::string& fontFileName, const Vec2& imageOffset = Vec2::ZERO); /** Unload all texture atlas texture create by special file name. CAUTION : All component use this font texture should be reset font name, though the file name is same! diff --git a/cocos/2d/CCFontCharMap.cpp b/cocos/2d/CCFontCharMap.cpp index 0b08dc238e2c..2a1f14b27272 100644 --- a/cocos/2d/CCFontCharMap.cpp +++ b/cocos/2d/CCFontCharMap.cpp @@ -35,7 +35,7 @@ NS_CC_BEGIN FontCharMap * FontCharMap::create(const std::string& plistFile) { std::string pathStr = FileUtils::getInstance()->fullPathForFilename(plistFile); - std::string relPathStr = pathStr.substr(0, pathStr.find_last_of("/"))+"/"; + std::string relPathStr = pathStr.substr(0, pathStr.find_last_of('/'))+"/"; ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(pathStr); @@ -126,6 +126,7 @@ FontAtlas * FontCharMap::createFontAtlas() tempDefinition.width = _itemWidth / contentScaleFactor; tempDefinition.height = _itemHeight / contentScaleFactor; tempDefinition.xAdvance = _itemWidth; + tempDefinition.rotated = false; int charId = _mapStartChar; for (int row = 0; row < itemsPerColumn; ++row) diff --git a/cocos/2d/CCFontFNT.cpp b/cocos/2d/CCFontFNT.cpp index d04437233ac8..a7e731da1e08 100644 --- a/cocos/2d/CCFontFNT.cpp +++ b/cocos/2d/CCFontFNT.cpp @@ -26,6 +26,7 @@ #include "2d/CCFontFNT.h" #include "2d/CCFontAtlas.h" +#include "2d/CCSpriteFrameCache.h" #include "platform/CCFileUtils.h" #include "base/CCConfiguration.h" #include "base/CCDirector.h" @@ -34,8 +35,6 @@ #include "renderer/CCTextureCache.h" #include -#include -#include NS_CC_BEGIN @@ -52,99 +51,6 @@ enum { struct _FontDefHashElement; -/** -@struct BMFontDef -BMFont definition -*/ -typedef struct _BMFontDef { - //! ID of the character - unsigned int charID; - //! origin and size of the font - Rect rect; - //! The X amount the image should be offset when drawing the image (in pixels) - short xOffset; - //! The Y amount the image should be offset when drawing the image (in pixels) - short yOffset; - //! The amount to move the current position after drawing the character (in pixels) - short xAdvance; -} BMFontDef; - -/** @struct BMFontPadding -BMFont padding -@since v0.8.2 -*/ -typedef struct _BMFontPadding { - /// padding left - int left; - /// padding top - int top; - /// padding right - int right; - /// padding bottom - int bottom; -} BMFontPadding; - -/** @brief BMFontConfiguration has parsed configuration of the .fnt file -@since v0.8 -*/ -class CC_DLL BMFontConfiguration : public Ref -{ - // FIXME: Creating a public interface so that the bitmapFontArray[] is accessible -public://@public - // BMFont definitions - std::unordered_map _fontDefDictionary; - - //! FNTConfig: Common Height Should be signed (issue #1343) - int _commonHeight; - //! Padding - BMFontPadding _padding; - //! atlas name - std::string _atlasName; - //! values for kerning - std::unordered_map _kerningDictionary; - - // Character Set defines the letters that actually exist in the font - std::set *_characterSet; - //! Font Size - int _fontSize; -public: - /** - * @js ctor - */ - BMFontConfiguration(); - /** - * @js NA - * @lua NA - */ - virtual ~BMFontConfiguration(); - /** - * @js NA - * @lua NA - */ - std::string description() const; - - /** allocates a BMFontConfiguration with a FNT file */ - static BMFontConfiguration * create(const std::string& FNTfile); - - /** initializes a BitmapFontConfiguration with a FNT file */ - bool initWithFNTfile(const std::string& FNTfile); - - const std::string& getAtlasName() { return _atlasName; } - void setAtlasName(const std::string& atlasName) { _atlasName = atlasName; } - - std::set* getCharacterSet() const; -private: - std::set* parseConfigFile(const std::string& controlFile); - std::set* parseBinaryConfigFile(unsigned char* pData, unsigned long size, const std::string& controlFile); - unsigned int parseCharacterDefinition(const char* line); - void parseInfoArguments(const char* line); - void parseCommonArguments(const char* line); - void parseImageFileName(const char* line, const std::string& fntFile); - void parseKerningEntry(const char* line); - void purgeKerningDictionary(); - void purgeFontDefDictionary(); -}; - // //FNTConfig Cache - free functions // @@ -222,7 +128,7 @@ BMFontConfiguration::~BMFontConfiguration() CC_SAFE_DELETE(_characterSet); } -std::string BMFontConfiguration::description(void) const +std::string BMFontConfiguration::description() const { return StringUtils::format( "", @@ -488,9 +394,10 @@ void BMFontConfiguration::parseImageFileName(const char* line, const std::string int pageId; sscanf(line, "page id=%d", &pageId); CCASSERT(pageId == 0, "LabelBMFont file could not be found"); + // file char fileName[255]; - sscanf(strchr(line,'"') + 1, "%[^\"]", fileName); + sscanf(strstr(line, "file=\"") + 6, "%[^\"]", fileName); _atlasName = FileUtils::getInstance()->fullPathFromRelativeFile(fileName, fntFile); } @@ -603,20 +510,59 @@ void BMFontConfiguration::parseKerningEntry(const char* line) _kerningDictionary[key] = amount; } -FontFNT * FontFNT::create(const std::string& fntFilePath, const Vec2& imageOffset /* = Vec2::ZERO */) +FontFNT * FontFNT::create(const std::string& fntFilePath, const Rect& imageRect, bool imageRotated) { - BMFontConfiguration *newConf = FNTConfigLoadFile(fntFilePath); + const auto newConf = FNTConfigLoadFile(fntFilePath); if (!newConf) return nullptr; + const auto tempFont = new FontFNT(newConf, imageRect, imageRotated); + + if (!tempFont) + { + return nullptr; + } + tempFont->setFontSize(newConf->_fontSize); + tempFont->autorelease(); + return tempFont; +} + +FontFNT* FontFNT::create(const std::string& fntFilePath, const std::string& subTextureKey) +{ + const auto newConf = FNTConfigLoadFile(fntFilePath); + if (!newConf) + return nullptr; + + const auto frame = SpriteFrameCache::getInstance()->getSpriteFrameByName(subTextureKey); + if (!frame) + { + return nullptr; + } + auto tempFont = new FontFNT(newConf, frame->getRectInPixels(), frame->isRotated()); + + if (!tempFont) + { + return nullptr; + } + tempFont->setFontSize(newConf->_fontSize); + tempFont->autorelease(); + return tempFont; +} + +FontFNT* FontFNT::create(const std::string& fntFilePath) +{ + const auto newConf = FNTConfigLoadFile(fntFilePath); + if (!newConf) + return nullptr; + // add the texture - Texture2D *tempTexture = Director::getInstance()->getTextureCache()->addImage(newConf->getAtlasName()); + const auto tempTexture = Director::getInstance()->getTextureCache()->addImage(newConf->getAtlasName()); if (!tempTexture) { return nullptr; } - - FontFNT *tempFont = new FontFNT(newConf,imageOffset); + FontFNT* tempFont = new FontFNT(newConf); + tempFont->setFontSize(newConf->_fontSize); if (!tempFont) { @@ -626,13 +572,26 @@ FontFNT * FontFNT::create(const std::string& fntFilePath, const Vec2& imageOffse return tempFont; } -FontFNT::FontFNT(BMFontConfiguration *theContfig, const Vec2& imageOffset /* = Vec2::ZERO */) -:_configuration(theContfig) -,_imageOffset(CC_POINT_PIXELS_TO_POINTS(imageOffset)) +FontFNT* FontFNT::create(const std::string& fntFilePath, const Vec2& imageOffset) +{ + return create(fntFilePath, Rect(imageOffset.x, imageOffset.y, 0, 0), false); +} + +FontFNT::FontFNT(BMFontConfiguration *theContfig, const Rect& imageRect, bool imageRotated) +: _configuration(theContfig) +, _imageRectInPoints(CC_RECT_PIXELS_TO_POINTS(imageRect)) +, _imageRotated(imageRotated) { _configuration->retain(); } +FontFNT::FontFNT(BMFontConfiguration* theContfig) +: _configuration(theContfig) +, _imageRectInPoints(Rect::ZERO) +, _imageRotated(false) +{ +} + FontFNT::~FontFNT() { _configuration->release(); @@ -722,24 +681,39 @@ FontAtlas * FontFNT::createFontAtlas() } tempAtlas->setLineHeight(originalLineHeight * factor); - + + auto rw = _imageRectInPoints.size.width; + auto rh = _imageRectInPoints.size.height; + + if (_imageRotated) + std::swap(rw, rh); + + const auto left = _imageRectInPoints.origin.x; + const auto right = _imageRectInPoints.origin.x + rw; + const auto top = _imageRectInPoints.origin.y; + for (auto&& e : _configuration->_fontDefDictionary) { BMFontDef& fontDef = e.second; - + FontLetterDefinition tempDefinition; - Rect tempRect; - - tempRect = fontDef.rect; - tempRect = CC_RECT_PIXELS_TO_POINTS(tempRect); + const auto tempRect = CC_RECT_PIXELS_TO_POINTS(fontDef.rect); tempDefinition.offsetX = fontDef.xOffset; tempDefinition.offsetY = fontDef.yOffset; - - tempDefinition.U = tempRect.origin.x + _imageOffset.x; - tempDefinition.V = tempRect.origin.y + _imageOffset.y; - + + if (_imageRotated) + { + tempDefinition.U = right - tempRect.origin.y - tempRect.size.height; + tempDefinition.V = tempRect.origin.x + top; + } + else + { + tempDefinition.U = tempRect.origin.x + left; + tempDefinition.V = tempRect.origin.y + top; + } + tempDefinition.width = tempRect.size.width; tempDefinition.height = tempRect.size.height; @@ -748,6 +722,8 @@ FontAtlas * FontFNT::createFontAtlas() tempDefinition.validDefinition = true; tempDefinition.xAdvance = fontDef.xAdvance; + tempDefinition.rotated = _imageRotated; + // add the new definition if (65535 < fontDef.charID) { CCLOGWARN("Warning: 65535 < fontDef.charID (%u), ignored", fontDef.charID); @@ -783,12 +759,12 @@ void FontFNT::reloadBMFontResource(const std::string& fntFilePath) { s_configurations->erase(fntFilePath); } + ret = BMFontConfiguration::create(fntFilePath); if (ret) { s_configurations->insert(fntFilePath, ret); Director::getInstance()->getTextureCache()->reloadTexture(ret->getAtlasName()); - } } diff --git a/cocos/2d/CCFontFNT.h b/cocos/2d/CCFontFNT.h index d0b932fd4f86..83a07f1634c9 100644 --- a/cocos/2d/CCFontFNT.h +++ b/cocos/2d/CCFontFNT.h @@ -30,43 +30,154 @@ /// @cond DO_NOT_SHOW #include "2d/CCFont.h" +#include +#include NS_CC_BEGIN -class BMFontConfiguration; +/** +@struct BMFontDef +BMFont definition +*/ +typedef struct _BMFontDef { + //! ID of the character + unsigned int charID; + //! origin and size of the font + Rect rect; + //! The X amount the image should be offset when drawing the image (in pixels) + short xOffset; + //! The Y amount the image should be offset when drawing the image (in pixels) + short yOffset; + //! The amount to move the current position after drawing the character (in pixels) + short xAdvance; +} BMFontDef; + +/** @struct BMFontPadding +BMFont padding +@since v0.8.2 +*/ +typedef struct _BMFontPadding { + /// padding left + int left; + /// padding top + int top; + /// padding right + int right; + /// padding bottom + int bottom; +} BMFontPadding; + +/** @brief BMFontConfiguration has parsed configuration of the .fnt file +@since v0.8 +*/ +class CC_DLL BMFontConfiguration : public Ref +{ + // FIXME: Creating a public interface so that the bitmapFontArray[] is accessible +public://@public + // BMFont definitions + std::unordered_map _fontDefDictionary; + + //! FNTConfig: Common Height Should be signed (issue #1343) + int _commonHeight; + + //! Padding + BMFontPadding _padding; + + //! atlas name + std::string _atlasName; + + //! values for kerning + std::unordered_map _kerningDictionary; + + // Character Set defines the letters that actually exist in the font + std::set* _characterSet; + + //! Font Size + int _fontSize; +public: + /** + * @js ctor + */ + BMFontConfiguration(); + /** + * @js NA + * @lua NA + */ + virtual ~BMFontConfiguration(); + /** + * @js NA + * @lua NA + */ + std::string description() const; + + /** allocates a BMFontConfiguration with a FNT file */ + static BMFontConfiguration* create(const std::string& FNTfile); + + /** initializes a BitmapFontConfiguration with a FNT file */ + bool initWithFNTfile(const std::string& FNTfile); + + const std::string& getAtlasName() { return _atlasName; } + void setAtlasName(const std::string& atlasName) { _atlasName = atlasName; } + + std::set* getCharacterSet() const; + +protected: + virtual std::set* parseConfigFile(const std::string& controlFile); + virtual std::set* parseBinaryConfigFile(unsigned char* pData, unsigned long size, const std::string& controlFile); + +private: + unsigned int parseCharacterDefinition(const char* line); + void parseInfoArguments(const char* line); + void parseCommonArguments(const char* line); + void parseImageFileName(const char* line, const std::string& fntFile); + void parseKerningEntry(const char* line); + void purgeKerningDictionary(); + void purgeFontDefDictionary(); +}; class CC_DLL FontFNT : public Font { public: - static FontFNT * create(const std::string& fntFilePath, const Vec2& imageOffset = Vec2::ZERO); + static FontFNT* create(const std::string& fntFilePath, const Rect& imageRect, bool imageRotated); + static FontFNT* create(const std::string& fntFilePath, const std::string& subTextureKey); + static FontFNT* create(const std::string& fntFilePath); + + CC_DEPRECATED_ATTRIBUTE static FontFNT* create(const std::string& fntFilePath, const Vec2& imageOffset = Vec2::ZERO); + /** Purges the cached data. Removes from memory the cached configurations and the atlas name dictionary. */ static void purgeCachedData(); virtual int* getHorizontalKerningForTextUTF32(const std::u32string& text, int &outNumLetters) const override; virtual FontAtlas *createFontAtlas() override; + void setFontSize(float fontSize); + float getFontSize() const { return _fontSize; } + int getOriginalFontSize()const; static void reloadBMFontResource(const std::string& fntFilePath); protected: - FontFNT(BMFontConfiguration *theContfig, const Vec2& imageOffset = Vec2::ZERO); + FontFNT(BMFontConfiguration* theContfig, const Rect& imageRect, bool imageRotated); + FontFNT(BMFontConfiguration* theContfig); + /** * @js NA * @lua NA */ virtual ~FontFNT(); - -private: - + + BMFontConfiguration* _configuration; + int getHorizontalKerningForChars(char32_t firstChar, char32_t secondChar) const; - - BMFontConfiguration * _configuration; - Vec2 _imageOffset; + + Rect _imageRectInPoints; + bool _imageRotated; + //User defined font size float _fontSize; }; diff --git a/cocos/2d/CCFontFreeType.h b/cocos/2d/CCFontFreeType.h index 1ba97a585493..970051468c43 100644 --- a/cocos/2d/CCFontFreeType.h +++ b/cocos/2d/CCFontFreeType.h @@ -32,7 +32,7 @@ #include "2d/CCFont.h" #include -#include +#include "ft2build.h" #if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) #define generic GenericFromFreeTypeLibrary diff --git a/cocos/2d/CCGrabber.cpp b/cocos/2d/CCGrabber.cpp index 5c397efe796a..4af843017422 100644 --- a/cocos/2d/CCGrabber.cpp +++ b/cocos/2d/CCGrabber.cpp @@ -30,7 +30,7 @@ THE SOFTWARE. NS_CC_BEGIN -Grabber::Grabber(void) +Grabber::Grabber() : _FBO(0) , _oldFBO(0) { diff --git a/cocos/2d/CCGrabber.h b/cocos/2d/CCGrabber.h index a0d732ec1d9f..aa77a3c1e955 100644 --- a/cocos/2d/CCGrabber.h +++ b/cocos/2d/CCGrabber.h @@ -47,13 +47,13 @@ class Grabber : public Ref Constructor. * @js ctor */ - Grabber(void); + Grabber(); /** Destructor. * @js NA * @lua NA */ - ~Grabber(void); + ~Grabber(); /**Init the grab structure, will set the texture as the FBO color attachment.*/ void grab(Texture2D *texture); /**Begin capture the screen, which will save the old FBO, clear color, and set the new FBO, clear the background.*/ diff --git a/cocos/2d/CCGrid.cpp b/cocos/2d/CCGrid.cpp index bc6f20487935..da3a60044e7f 100644 --- a/cocos/2d/CCGrid.cpp +++ b/cocos/2d/CCGrid.cpp @@ -32,6 +32,7 @@ THE SOFTWARE. #include "2d/CCGrabber.h" #include "renderer/CCGLProgram.h" #include "renderer/CCGLProgramCache.h" +#include "renderer/ccGLStateCache.h" #include "renderer/CCRenderer.h" #include "renderer/CCRenderState.h" #include "renderer/CCTexture2D.h" @@ -166,7 +167,7 @@ bool GridBase::initWithSize(const Size& gridSize, Texture2D *texture, bool flipp return ret; } -GridBase::~GridBase(void) +GridBase::~GridBase() { CCLOGINFO("deallocing GridBase: %p", this); @@ -208,6 +209,8 @@ void GridBase::set2DProjection() director->multiplyMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION, orthoMatrix); director->loadIdentityMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); + + GL::setProjectionMatrixDirty(); } void GridBase::setGridRect(const cocos2d::Rect &rect) @@ -215,7 +218,7 @@ void GridBase::setGridRect(const cocos2d::Rect &rect) _gridRect = rect; } -void GridBase::beforeDraw(void) +void GridBase::beforeDraw() { // save projection Director *director = Director::getInstance(); @@ -253,8 +256,7 @@ void GridBase::afterDraw(cocos2d::Node * /*target*/) // kmGLTranslatef(-offset.x, -offset.y, 0); // } - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, _texture->getName()); + GL::bindTexture2D(_texture->getName()); // restore projection for default FBO .fixed bug #543 #544 //TODO: Director::getInstance()->setProjection(Director::getInstance()->getProjection()); @@ -264,17 +266,17 @@ void GridBase::afterDraw(cocos2d::Node * /*target*/) afterBlit(); } -void GridBase::blit(void) +void GridBase::blit() { CCASSERT(0, "Subclass should implement it."); } -void GridBase::reuse(void) +void GridBase::reuse() { CCASSERT(0, "Subclass should implement it!"); } -void GridBase::calculateVertexPoints(void) +void GridBase::calculateVertexPoints() { CCASSERT(0, "Subclass should implement it."); } @@ -372,7 +374,7 @@ Grid3D::Grid3D() } -Grid3D::~Grid3D(void) +Grid3D::~Grid3D() { CC_SAFE_FREE(_texCoordinates); CC_SAFE_FREE(_vertices); @@ -413,12 +415,11 @@ void Grid3D::afterBlit() } } -void Grid3D::blit(void) +void Grid3D::blit() { int n = _gridSize.width * _gridSize.height; - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_TEX_COORD); + GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION | GL::VERTEX_ATTRIB_FLAG_TEX_COORD ); _shaderProgram->use(); _shaderProgram->setUniformsForBuiltins(); @@ -435,7 +436,7 @@ void Grid3D::blit(void) glDrawElements(GL_TRIANGLES, (GLsizei) n*6, GL_UNSIGNED_SHORT, _indices); } -void Grid3D::calculateVertexPoints(void) +void Grid3D::calculateVertexPoints() { float width = (float)_texture->getPixelsWide(); float height = (float)_texture->getPixelsHigh(); @@ -545,7 +546,7 @@ void Grid3D::setVertex(const Vec2& pos, const Vec3& vertex) vertArray[index+2] = vertex.z; } -void Grid3D::reuse(void) +void Grid3D::reuse() { if (_reuseGrid > 0) { @@ -565,7 +566,7 @@ TiledGrid3D::TiledGrid3D() } -TiledGrid3D::~TiledGrid3D(void) +TiledGrid3D::~TiledGrid3D() { CC_SAFE_FREE(_texCoordinates); CC_SAFE_FREE(_vertices); @@ -653,7 +654,7 @@ TiledGrid3D* TiledGrid3D::create(const Size& gridSize, Texture2D *texture, bool return ret; } -void TiledGrid3D::blit(void) +void TiledGrid3D::blit() { int n = _gridSize.width * _gridSize.height; @@ -664,8 +665,7 @@ void TiledGrid3D::blit(void) // // Attributes // - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_TEX_COORD); + GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION | GL::VERTEX_ATTRIB_FLAG_TEX_COORD ); // position glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 3, GL_FLOAT, GL_FALSE, 0, _vertices); @@ -678,7 +678,7 @@ void TiledGrid3D::blit(void) CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1,n*6); } -void TiledGrid3D::calculateVertexPoints(void) +void TiledGrid3D::calculateVertexPoints() { float width = (float)_texture->getPixelsWide(); float height = (float)_texture->getPixelsHigh(); @@ -789,7 +789,7 @@ Quad3 TiledGrid3D::getTile(const Vec2& pos) const return ret; } -void TiledGrid3D::reuse(void) +void TiledGrid3D::reuse() { if (_reuseGrid > 0) { diff --git a/cocos/2d/CCGrid.h b/cocos/2d/CCGrid.h index 2af22597fbcd..aa058571d3d0 100644 --- a/cocos/2d/CCGrid.h +++ b/cocos/2d/CCGrid.h @@ -57,7 +57,7 @@ class CC_DLL GridBase : public Ref * @js NA * @lua NA */ - virtual ~GridBase(void); + virtual ~GridBase(); /**@{ Init the Grid base. @@ -102,7 +102,7 @@ class CC_DLL GridBase : public Ref /**@{ Init and reset the status when render effects by using the grid. */ - void beforeDraw(void); + void beforeDraw(); void afterDraw(Node *target); /**@}*/ @@ -115,14 +115,14 @@ class CC_DLL GridBase : public Ref /**@}*/ /**Interface used to blit the texture with grid to screen.*/ - virtual void blit(void); + virtual void blit(); /**Interface, Reuse the grid vertices.*/ - virtual void reuse(void); + virtual void reuse(); /**Interface, Calculate the vertices used for the blit.*/ - virtual void calculateVertexPoints(void); + virtual void calculateVertexPoints(); /**Change projection to 2D for grabbing.*/ - void set2DProjection(void); + void set2DProjection(); /** * @brief Set the effect grid rect. @@ -172,7 +172,7 @@ class CC_DLL Grid3D : public GridBase * @js NA * @lua NA */ - ~Grid3D(void); + ~Grid3D(); /** Returns the vertex at a given position. * @js NA diff --git a/cocos/2d/CCLabel.cpp b/cocos/2d/CCLabel.cpp index 468f175eea8c..c07c0a67b346 100644 --- a/cocos/2d/CCLabel.cpp +++ b/cocos/2d/CCLabel.cpp @@ -38,11 +38,11 @@ #include "base/ccUTF8.h" #include "platform/CCFileUtils.h" #include "renderer/CCRenderer.h" +#include "renderer/ccGLStateCache.h" #include "base/CCDirector.h" #include "base/CCEventListenerCustom.h" #include "base/CCEventDispatcher.h" #include "base/CCEventCustom.h" -#include "base/ccUtils.h" #include "2d/CCFontFNT.h" NS_CC_BEGIN @@ -243,11 +243,11 @@ Label* Label::createWithTTF(const TTFConfig& ttfConfig, const std::string& text, return nullptr; } -Label* Label::createWithBMFont(const std::string& bmfontFilePath, const std::string& text,const TextHAlignment& hAlignment /* = TextHAlignment::LEFT */, int maxLineWidth /* = 0 */, const Vec2& imageOffset /* = Vec2::ZERO */) +Label* Label::createWithBMFont(const std::string& bmfontPath, const std::string& text, const TextHAlignment& hAlignment, int maxLineWidth) { auto ret = new (std::nothrow) Label(hAlignment); - if (ret && ret->setBMFontFilePath(bmfontFilePath,imageOffset)) + if (ret && ret->setBMFontFilePath(bmfontPath)) { ret->setMaxLineWidth(maxLineWidth); ret->setString(text); @@ -255,11 +255,50 @@ Label* Label::createWithBMFont(const std::string& bmfontFilePath, const std::str return ret; } - + delete ret; return nullptr; } +Label* Label::createWithBMFont(const std::string& bmfontPath, const std::string& text, const TextHAlignment& hAlignment, int maxLineWidth, const Rect& imageRect, bool imageRotated) +{ + auto ret = new (std::nothrow) Label(hAlignment); + + if (ret && ret->setBMFontFilePath(bmfontPath, imageRect, imageRotated)) + { + ret->setMaxLineWidth(maxLineWidth); + ret->setString(text); + ret->autorelease(); + + return ret; + } + + delete ret; + return nullptr; +} + +Label* Label::createWithBMFont(const std::string& bmfontPath, const std::string& text, const TextHAlignment& hAlignment, int maxLineWidth, const std::string& subTextureKey) +{ + auto ret = new (std::nothrow) Label(hAlignment); + + if (ret && ret->setBMFontFilePath(bmfontPath, subTextureKey)) + { + ret->setMaxLineWidth(maxLineWidth); + ret->setString(text); + ret->autorelease(); + + return ret; + } + + delete ret; + return nullptr; +} + +Label* Label::createWithBMFont(const std::string& bmfontPath, const std::string& text, const TextHAlignment& hAlignment, int maxLineWidth, const Vec2& imageOffset) +{ + return createWithBMFont(bmfontPath, text, hAlignment, maxLineWidth, Rect(imageOffset.x, imageOffset.y, 0, 0), false); +} + Label* Label::createWithCharMap(const std::string& plistFile) { auto ret = new (std::nothrow) Label(); @@ -481,7 +520,12 @@ void Label::reset() TTFConfig temp; _fontConfig = temp; _outlineSize = 0.f; + _bmFontPath = ""; + _bmSubTextureKey = ""; + _bmRect = Rect::ZERO; + _bmRotated = false; + _systemFontDirty = false; _systemFont = "Helvetica"; _systemFontSize = CC_DEFAULT_FONT_LABEL_SIZE; @@ -634,9 +678,40 @@ bool Label::setTTFConfig(const TTFConfig& ttfConfig) return setTTFConfigInternal(ttfConfig); } -bool Label::setBMFontFilePath(const std::string& bmfontFilePath, const Vec2& imageOffset, float fontSize) +bool Label::setBMFontFilePath(const std::string& bmfontFilePath, float fontSize) { - FontAtlas *newAtlas = FontAtlasCache::getFontAtlasFNT(bmfontFilePath,imageOffset); + FontAtlas* newAtlas = FontAtlasCache::getFontAtlasFNT(bmfontFilePath); + + if (!newAtlas) + { + reset(); + return false; + } + + //assign the default fontSize + if (std::abs(fontSize) < FLT_EPSILON) { + FontFNT* bmFont = (FontFNT*)newAtlas->getFont(); + if (bmFont) { + float originalFontSize = bmFont->getOriginalFontSize(); + _bmFontSize = originalFontSize / CC_CONTENT_SCALE_FACTOR(); + } + } + + if (fontSize > 0.0f) { + _bmFontSize = fontSize; + } + + _bmFontPath = bmfontFilePath; + + _currentLabelType = LabelType::BMFONT; + setFontAtlas(newAtlas); + + return true; +} + +bool Label::setBMFontFilePath(const std::string& bmfontFilePath, const Rect& imageRect, bool imageRotated, float fontSize) +{ + FontAtlas *newAtlas = FontAtlasCache::getFontAtlasFNT(bmfontFilePath, imageRect, imageRotated); if (!newAtlas) { @@ -658,6 +733,40 @@ bool Label::setBMFontFilePath(const std::string& bmfontFilePath, const Vec2& ima } _bmFontPath = bmfontFilePath; + _bmRect = imageRect; + _bmRotated = imageRotated; + + _currentLabelType = LabelType::BMFONT; + setFontAtlas(newAtlas); + + return true; +} + +bool Label::setBMFontFilePath(const std::string& bmfontFilePath, const std::string& subTextureKey, float fontSize) +{ + FontAtlas* newAtlas = FontAtlasCache::getFontAtlasFNT(bmfontFilePath, subTextureKey); + + if (!newAtlas) + { + reset(); + return false; + } + + //assign the default fontSize + if (std::abs(fontSize) < FLT_EPSILON) { + FontFNT* bmFont = (FontFNT*)newAtlas->getFont(); + if (bmFont) { + float originalFontSize = bmFont->getOriginalFontSize(); + _bmFontSize = originalFontSize / CC_CONTENT_SCALE_FACTOR(); + } + } + + if (fontSize > 0.0f) { + _bmFontSize = fontSize; + } + + _bmFontPath = bmfontFilePath; + _bmSubTextureKey = subTextureKey; _currentLabelType = LabelType::BMFONT; setFontAtlas(newAtlas); @@ -665,9 +774,14 @@ bool Label::setBMFontFilePath(const std::string& bmfontFilePath, const Vec2& ima return true; } +bool Label::setBMFontFilePath(const std::string& bmfontFilePath, const Vec2& imageOffset, float fontSize) +{ + return setBMFontFilePath(bmfontFilePath, Rect(imageOffset.x, imageOffset.y, 0, 0), false); +} + void Label::setString(const std::string& text) { - if (text.compare(_utf8Text)) + if (text != _utf8Text) { _utf8Text = text; _contentDirty = true; @@ -677,6 +791,13 @@ void Label::setString(const std::string& text) { _utf32Text = utf32String; } + + CCASSERT(_utf32Text.length() <= CC_LABEL_MAX_LENGTH, "Length of text should be less then 16384"); + if (_utf32Text.length() > CC_LABEL_MAX_LENGTH) + { + cocos2d::log("Error: Label text is too long %d > %d and it will be truncated!", _utf32Text.length(), CC_LABEL_MAX_LENGTH); + _utf32Text = _utf32Text.substr(0, CC_LABEL_MAX_LENGTH); + } } } @@ -783,7 +904,7 @@ void Label::updateLabelLetters() } else { - letterSprite->setTextureRect(uvRect, false, uvRect.size); + letterSprite->setTextureRect(uvRect, letterDef.rotated, uvRect.size); letterSprite->setTextureAtlas(_batchNodes.at(letterDef.textureID)->getTextureAtlas()); letterSprite->setAtlasIndex(_lettersInfo[letterIndex].atlasIndex); } @@ -964,7 +1085,7 @@ bool Label::updateQuads() if (_reusedRect.size.height > 0.f && _reusedRect.size.width > 0.f) { - _reusedLetter->setTextureRect(_reusedRect, false, _reusedRect.size); + _reusedLetter->setTextureRect(_reusedRect, letterDef.rotated, _reusedRect.size); float letterPositionX = _lettersInfo[ctr].positionX + _linesOffsetX[_lettersInfo[ctr].lineIndex]; _reusedLetter->setPosition(letterPositionX, py); auto index = static_cast(_batchNodes.at(letterDef.textureID)->getTextureAtlas()->getTotalQuads()); @@ -1024,8 +1145,16 @@ bool Label::setTTFConfigInternal(const TTFConfig& ttfConfig) void Label::setBMFontSizeInternal(float fontSize) { - if(_currentLabelType == LabelType::BMFONT){ - this->setBMFontFilePath(_bmFontPath, Vec2::ZERO, fontSize); + if(_currentLabelType == LabelType::BMFONT) + { + if (!_bmSubTextureKey.empty()) + { + this->setBMFontFilePath(_bmFontPath, _bmSubTextureKey, fontSize); + } + else + { + this->setBMFontFilePath(_bmFontPath, _bmRect, _bmRotated, fontSize); + } _contentDirty = true; } } @@ -1539,7 +1668,7 @@ void Label::onDraw(const Mat4& transform, bool /*transformUpdated*/) { auto glprogram = getGLProgram(); glprogram->use(); - utils::setBlending(_blendFunc.src, _blendFunc.dst); + GL::blendFunc(_blendFunc.src, _blendFunc.dst); if (_shadowEnabled) { @@ -1792,7 +1921,7 @@ Sprite* Label::getLetter(int letterIndex) else { this->updateBMFontScale(); - letter = LabelLetter::createWithTexture(_fontAtlas->getTexture(textureID), uvRect); + letter = LabelLetter::createWithTexture(_fontAtlas->getTexture(textureID), uvRect, letterDef.rotated); letter->setTextureAtlas(_batchNodes.at(textureID)->getTextureAtlas()); letter->setAtlasIndex(letterInfo.atlasIndex); auto px = letterInfo.positionX + _bmfontScale * uvRect.size.width / 2 + _linesOffsetX[letterInfo.lineIndex]; @@ -2092,6 +2221,7 @@ FontDefinition Label::_getFontDefinition() const systemFontDef._fontSize = _systemFontSize; systemFontDef._alignment = _hAlignment; systemFontDef._vertAlignment = _vAlignment; + systemFontDef._lineSpacing = _lineSpacing; systemFontDef._dimensions.width = _labelWidth; systemFontDef._dimensions.height = _labelHeight; systemFontDef._fontFillColor.r = _textColor.r; diff --git a/cocos/2d/CCLabel.h b/cocos/2d/CCLabel.h index bf451b04e169..5ea86068c6c6 100644 --- a/cocos/2d/CCLabel.h +++ b/cocos/2d/CCLabel.h @@ -197,14 +197,58 @@ class CC_DLL Label : public Node, public LabelProtocol, public BlendProtocol * @param text The initial text. * @param hAlignment Text horizontal alignment. * @param maxLineWidth The max line width. - * @param imageOffset * * @return An automatically released Label object. * @see setBMFontFilePath setMaxLineWidth */ static Label* createWithBMFont(const std::string& bmfontPath, const std::string& text, - const TextHAlignment& hAlignment = TextHAlignment::LEFT, int maxLineWidth = 0, - const Vec2& imageOffset = Vec2::ZERO); + const TextHAlignment& hAlignment = TextHAlignment::LEFT, int maxLineWidth = 0); + + /** + * Allocates and initializes a Label, with a bitmap font file. + * + * @param bmfontPath A bitmap font file, it's a FNT format. + * @param text The initial text. + * @param hAlignment Text horizontal alignment. + * @param maxLineWidth The max line width. + * @param imageRect + * @param imageRotated + * + * @return An automatically released Label object. + * @see setBMFontFilePath setMaxLineWidth + */ + static Label* createWithBMFont(const std::string& bmfontPath, const std::string& text, + const TextHAlignment& hAlignment, int maxLineWidth, const Rect& imageRect, bool imageRotated); + + /** + * Allocates and initializes a Label, with a bitmap font file. + * + * @param bmfontPath A bitmap font file, it's a FNT format. + * @param text The initial text. + * @param hAlignment Text horizontal alignment. + * @param maxLineWidth The max line width. + * @param subTextureKey Name of entry in PLIST texture atlas/sprite sheet + * + * @return An automatically released Label object. + * @see setBMFontFilePath setMaxLineWidth + */ + static Label* createWithBMFont(const std::string& bmfontPath, const std::string& text, + const TextHAlignment& hAlignment, int maxLineWidth, const std::string& subTextureKey); + + /** + * Allocates and initializes a Label, with a bitmap font file. + * + * @param bmfontPath A bitmap font file, it's a FNT format. + * @param text The initial text. + * @param hAlignment Text horizontal alignment. + * @param maxLineWidth The max line width. + * @param imageOffset Offset into larger texture + * + * @return An automatically released Label object. + * @see setBMFontFilePath setMaxLineWidth + */ + CC_DEPRECATED_ATTRIBUTE static Label* createWithBMFont(const std::string& bmfontPath, const std::string& text, + const TextHAlignment& hAlignment, int maxLineWidth, const Vec2& imageOffset); /** * Allocates and initializes a Label, with char map configuration. @@ -258,7 +302,16 @@ class CC_DLL Label : public Node, public LabelProtocol, public BlendProtocol virtual const TTFConfig& getTTFConfig() const { return _fontConfig;} /** Sets a new bitmap font to Label */ - virtual bool setBMFontFilePath(const std::string& bmfontFilePath, const Vec2& imageOffset = Vec2::ZERO, float fontSize = 0); + virtual bool setBMFontFilePath(const std::string& bmfontFilePath, float fontSize = 0); + + /** Sets a new bitmap font to Label */ + virtual bool setBMFontFilePath(const std::string& bmfontFilePath, const Rect& imageRect, bool imageRotated, float fontSize = 0); + + /** Sets a new bitmap font to Label */ + virtual bool setBMFontFilePath(const std::string& bmfontFilePath, const std::string& subTextureKey, float fontSize = 0); + + /** Sets a new bitmap font to Label */ + CC_DEPRECATED_ATTRIBUTE virtual bool setBMFontFilePath(const std::string& bmfontFilePath, const Vec2& imageOffset, float fontSize = 0); /** Returns the bitmap font used by the Label.*/ const std::string& getBMFontFilePath() const { return _bmFontPath;} @@ -559,7 +612,7 @@ class CC_DLL Label : public Node, public LabelProtocol, public BlendProtocol @warning Not support system font. @return the type of label - @since v3.18.0 + @since v3.17.1 */ LabelType getLabelType() const { return _currentLabelType; } @@ -660,7 +713,7 @@ class CC_DLL Label : public Node, public LabelProtocol, public BlendProtocol bool multilineTextWrapByChar(); bool multilineTextWrapByWord(); bool multilineTextWrap(const std::function& lambda); - void shrinkLabelToContentSize(const std::function& lambda); + void shrinkLabelToContentSize(const std::function& lambda); bool isHorizontalClamp(); bool isVerticalClamp(); void rescaleWithOriginalFontSize(); @@ -702,6 +755,10 @@ class CC_DLL Label : public Node, public LabelProtocol, public BlendProtocol int _numberOfLines; std::string _bmFontPath; + std::string _bmSubTextureKey; + Rect _bmRect; + bool _bmRotated; + TTFConfig _fontConfig; float _outlineSize; diff --git a/cocos/2d/CCLabelAtlas.cpp b/cocos/2d/CCLabelAtlas.cpp index 70eaed844771..27b40f9061d7 100644 --- a/cocos/2d/CCLabelAtlas.cpp +++ b/cocos/2d/CCLabelAtlas.cpp @@ -105,7 +105,7 @@ LabelAtlas* LabelAtlas::create(const std::string& string, const std::string& fnt bool LabelAtlas::initWithString(const std::string& theString, const std::string& fntFile) { std::string pathStr = FileUtils::getInstance()->fullPathForFilename(fntFile); - std::string relPathStr = pathStr.substr(0, pathStr.find_last_of("/"))+"/"; + std::string relPathStr = pathStr.substr(0, pathStr.find_last_of('/'))+"/"; ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(pathStr); @@ -222,7 +222,7 @@ void LabelAtlas::setString(const std::string &label) _quadsToDraw = len; } -const std::string& LabelAtlas::getString(void) const +const std::string& LabelAtlas::getString() const { return _string; } diff --git a/cocos/2d/CCLabelAtlas.h b/cocos/2d/CCLabelAtlas.h index 0f3643364624..eb2f59965a01 100644 --- a/cocos/2d/CCLabelAtlas.h +++ b/cocos/2d/CCLabelAtlas.h @@ -84,7 +84,7 @@ class CC_DLL LabelAtlas : public AtlasNode, public LabelProtocol bool initWithString(const std::string& string, Texture2D* texture, int itemWidth, int itemHeight, int startCharMap); virtual void setString(const std::string &label) override; - virtual const std::string& getString(void) const override; + virtual const std::string& getString() const override; virtual void updateAtlasValues() override; /** diff --git a/cocos/2d/CCLabelBMFont.cpp b/cocos/2d/CCLabelBMFont.cpp index 73cd97ffcb81..5f6f6439b22d 100644 --- a/cocos/2d/CCLabelBMFont.cpp +++ b/cocos/2d/CCLabelBMFont.cpp @@ -65,10 +65,10 @@ LabelBMFont * LabelBMFont::create() } //LabelBMFont - Creation & Init -LabelBMFont *LabelBMFont::create(const std::string& str, const std::string& fntFile, float width /* = 0 */, TextHAlignment alignment /* = TextHAlignment::LEFT */,const Vec2& imageOffset /* = Vec2::ZERO */) +LabelBMFont* LabelBMFont::create(const std::string& str, const std::string& fntFile, float width, TextHAlignment alignment, const Vec2& imageOffset) { - LabelBMFont *ret = new (std::nothrow) LabelBMFont(); - if(ret && ret->initWithString(str, fntFile, width, alignment,imageOffset)) + LabelBMFont* ret = new (std::nothrow) LabelBMFont(); + if (ret && ret->initWithString(str, fntFile, width, alignment, imageOffset)) { ret->autorelease(); return ret; @@ -77,9 +77,10 @@ LabelBMFont *LabelBMFont::create(const std::string& str, const std::string& fntF return nullptr; } -bool LabelBMFont::initWithString(const std::string& str, const std::string& fntFile, float width /* = 0 */, TextHAlignment alignment /* = TextHAlignment::LEFT */,const Vec2& imageOffset /* = Vec2::ZERO */) +bool LabelBMFont::initWithString(const std::string& str, const std::string& fntFile, float width /* = 0 */, TextHAlignment alignment /* = TextHAlignment::LEFT */, + const Vec2& imageOffset /* = Vec2::ZERO */) { - if (_label->setBMFontFilePath(fntFile,imageOffset)) + if (_label->setBMFontFilePath(fntFile, Rect(imageOffset.x, imageOffset.y, 0, 0), false)) { _fntFile = fntFile; _label->setMaxLineWidth(width); @@ -132,6 +133,7 @@ void LabelBMFont::setOpacityModifyRGB(bool var) child->setOpacityModifyRGB(var); } } + bool LabelBMFont::isOpacityModifyRGB() const { return _label->isOpacityModifyRGB(); @@ -156,13 +158,18 @@ void LabelBMFont::setLineBreakWithoutSpace( bool breakWithoutSpace ) this->setContentSize(_label->getContentSize()); } +void LabelBMFont::setFntFile(const std::string& fntFile, const Vec2& imageOffset) +{ + setFntFile(fntFile, Rect(imageOffset.x, imageOffset.y, 0, 0), false); +} + // LabelBMFont - FntFile -void LabelBMFont::setFntFile(const std::string& fntFile, const Vec2& imageOffset /* = Vec2::ZERO */) +void LabelBMFont::setFntFile(const std::string& fntFile, const Rect& imageRect, bool imageRotated) { - if (_fntFile.compare(fntFile) != 0) + if (_fntFile != fntFile) { _fntFile = fntFile; - _label->setBMFontFilePath(fntFile,imageOffset); + _label->setBMFontFilePath(fntFile, imageRect, imageRotated); } } diff --git a/cocos/2d/CCLabelBMFont.h b/cocos/2d/CCLabelBMFont.h index 7bc0adc2b2c2..6d5dd90ff61a 100644 --- a/cocos/2d/CCLabelBMFont.h +++ b/cocos/2d/CCLabelBMFont.h @@ -95,14 +95,14 @@ class CC_DLL CC_DEPRECATED_ATTRIBUTE LabelBMFont : public Node, public LabelProt virtual ~LabelBMFont(); /** creates a bitmap font atlas with an initial string and the FNT file */ - static LabelBMFont * create(const std::string& str, const std::string& fntFile, float width = 0, TextHAlignment alignment = TextHAlignment::LEFT,const Vec2& imageOffset = Vec2::ZERO); + static LabelBMFont* create(const std::string& str, const std::string& fntFile, float width = 0, TextHAlignment alignment = TextHAlignment::LEFT, const Vec2& imageOffset = Vec2::ZERO); /** Creates an label. */ static LabelBMFont * create(); /** init a bitmap font atlas with an initial string and the FNT file */ - bool initWithString(const std::string& str, const std::string& fntFile, float width = 0, TextHAlignment alignment = TextHAlignment::LEFT,const Vec2& imageOffset = Vec2::ZERO); + bool initWithString(const std::string& str, const std::string& fntFile, float width = 0, TextHAlignment alignment = TextHAlignment::LEFT, const Vec2& imageOffset = Vec2::ZERO); // super method virtual void setString(const std::string& newString) override; @@ -118,6 +118,7 @@ class CC_DLL CC_DEPRECATED_ATTRIBUTE LabelBMFont : public Node, public LabelProt virtual void setOpacityModifyRGB(bool isOpacityModifyRGB) override; void setFntFile(const std::string& fntFile, const Vec2& imageOffset = Vec2::ZERO); + void setFntFile(const std::string& fntFile, const Rect& imageRect, bool imageRotated); const std::string& getFntFile() const; virtual void setBlendFunc(const BlendFunc &blendFunc) override; diff --git a/cocos/2d/CCLabelTTF.h b/cocos/2d/CCLabelTTF.h index fd3e457f2a51..38184700b9a4 100644 --- a/cocos/2d/CCLabelTTF.h +++ b/cocos/2d/CCLabelTTF.h @@ -128,7 +128,7 @@ class CC_DLL CC_DEPRECATED_ATTRIBUTE LabelTTF : public Node, public LabelProtoco * @warning Changing the string is as expensive as creating a new LabelTTF. To obtain better performance use LabelAtlas */ virtual void setString(const std::string &label) override; - virtual const std::string& getString(void) const override ; + virtual const std::string& getString() const override ; TextHAlignment getHorizontalAlignment() const; void setHorizontalAlignment(TextHAlignment alignment); diff --git a/cocos/2d/CCLabelTextFormatter.cpp b/cocos/2d/CCLabelTextFormatter.cpp index 168401a65cf8..c5196df342d5 100644 --- a/cocos/2d/CCLabelTextFormatter.cpp +++ b/cocos/2d/CCLabelTextFormatter.cpp @@ -369,7 +369,7 @@ bool Label::isHorizontalClamp() return letterClamp; } -void Label::shrinkLabelToContentSize(const std::function& lambda) +void Label::shrinkLabelToContentSize(const std::function& lambda) { float fontSize = this->getRenderingFontSize(); diff --git a/cocos/2d/CCLayer.cpp b/cocos/2d/CCLayer.cpp index 697b69c6653b..bfa99679a7ea 100644 --- a/cocos/2d/CCLayer.cpp +++ b/cocos/2d/CCLayer.cpp @@ -29,9 +29,9 @@ THE SOFTWARE. #include #include "2d/CCLayer.h" #include "base/CCScriptSupport.h" -#include "base/ccUtils.h" #include "platform/CCDevice.h" #include "renderer/CCRenderer.h" +#include "renderer/ccGLStateCache.h" #include "renderer/CCGLProgramState.h" #include "base/CCDirector.h" #include "base/CCEventDispatcher.h" @@ -125,7 +125,7 @@ int Layer::executeScriptTouchesHandler(EventTouch::EventCode eventType, const st return 0; } -bool Layer::ccTouchBegan(Touch* /*pTouch*/, Event* /*pEvent*/) {return false;}; +bool Layer::ccTouchBegan(Touch* /*pTouch*/, Event* /*pEvent*/) {return false;} void Layer::ccTouchMoved(Touch* /*pTouch*/, Event* /*pEvent*/) {} void Layer::ccTouchEnded(Touch* /*pTouch*/, Event* /*pEvent*/) {} void Layer::ccTouchCancelled(Touch* /*pTouch*/, Event* /*pEvent*/) {} @@ -620,8 +620,7 @@ void LayerColor::onDraw(const Mat4& transform, uint32_t /*flags*/) getGLProgram()->use(); getGLProgram()->setUniformsForBuiltins(transform); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_COLOR); + GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION | GL::VERTEX_ATTRIB_FLAG_COLOR ); // // Attributes @@ -630,7 +629,7 @@ void LayerColor::onDraw(const Mat4& transform, uint32_t /*flags*/) glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 3, GL_FLOAT, GL_FALSE, 0, _noMVPVertices); glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_COLOR, 4, GL_FLOAT, GL_FALSE, 0, _squareColors); - utils::setBlending(_blendFunc.src, _blendFunc.dst); + GL::blendFunc( _blendFunc.src, _blendFunc.dst ); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); @@ -951,7 +950,7 @@ void LayerRadialGradient::onDraw(const Mat4& transform, uint32_t /*flags*/) program->setUniformLocationWith1f(_uniformLocationExpand, _expand); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION); + GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION); // // Attributes @@ -959,7 +958,7 @@ void LayerRadialGradient::onDraw(const Mat4& transform, uint32_t /*flags*/) glBindBuffer(GL_ARRAY_BUFFER, 0); glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, _vertices); - utils::setBlending(_blendFunc.src, _blendFunc.dst); + GL::blendFunc(_blendFunc.src, _blendFunc.dst); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); diff --git a/cocos/2d/CCLight.cpp b/cocos/2d/CCLight.cpp index c47998bdfc0a..07331f31eae0 100644 --- a/cocos/2d/CCLight.cpp +++ b/cocos/2d/CCLight.cpp @@ -23,6 +23,7 @@ ****************************************************************************/ #include "2d/CCLight.h" +#include #include "2d/CCScene.h" NS_CC_BEGIN @@ -60,7 +61,7 @@ void BaseLight::onExit() void BaseLight::setRotationFromDirection( const Vec3 &direction ) { - float projLen = sqrt(direction.x * direction.x + direction.z * direction.z); + float projLen = std::sqrt(direction.x * direction.x + direction.z * direction.z); float rotY = CC_RADIANS_TO_DEGREES(atan2f(-direction.x, -direction.z)); float rotX = -CC_RADIANS_TO_DEGREES(atan2f(-direction.y, projLen)); setRotation3D(Vec3(rotX, rotY, 0.0f)); @@ -205,4 +206,4 @@ AmbientLight::~AmbientLight() } -NS_CC_END \ No newline at end of file +NS_CC_END diff --git a/cocos/2d/CCMenu.cpp b/cocos/2d/CCMenu.cpp index c59d559c3613..a1579176a291 100644 --- a/cocos/2d/CCMenu.cpp +++ b/cocos/2d/CCMenu.cpp @@ -345,7 +345,7 @@ void Menu::alignItemsVerticallyWithPadding(float padding) } } -void Menu::alignItemsHorizontally(void) +void Menu::alignItemsHorizontally() { this->alignItemsHorizontallyWithPadding(kDefaultPadding); } diff --git a/cocos/2d/CCMenu.h b/cocos/2d/CCMenu.h index d79ff0a24fa7..ebbbff94b730 100644 --- a/cocos/2d/CCMenu.h +++ b/cocos/2d/CCMenu.h @@ -173,7 +173,7 @@ class CC_DLL Menu : public Layer virtual void onEnter() override; virtual void onExit() override; virtual void setOpacityModifyRGB(bool value) override; - virtual bool isOpacityModifyRGB(void) const override; + virtual bool isOpacityModifyRGB() const override; virtual std::string getDescription() const override; diff --git a/cocos/2d/CCMenuItem.cpp b/cocos/2d/CCMenuItem.cpp index 1e74cf151b6d..c35074ac3201 100644 --- a/cocos/2d/CCMenuItem.cpp +++ b/cocos/2d/CCMenuItem.cpp @@ -334,7 +334,7 @@ bool MenuItemAtlasFont::initWithString(const std::string& value, const std::stri bool MenuItemAtlasFont::initWithString(const std::string& value, const std::string& charMapFile, int itemWidth, int itemHeight, char startCharMap, const ccMenuCallback& callback) { - CCASSERT( value.size() != 0, "value length must be greater than 0"); + CCASSERT( !value.empty(), "value length must be greater than 0"); LabelAtlas *label = LabelAtlas::create(); label->initWithString(value, charMapFile, itemWidth, itemHeight, startCharMap); if (MenuItemLabel::initWithLabel(label, callback)) @@ -667,7 +667,7 @@ MenuItemImage* MenuItemImage::create() return nullptr; } -bool MenuItemImage::init(void) +bool MenuItemImage::init() { return initWithNormalImage("", "", "", (const ccMenuCallback&)nullptr); } @@ -736,17 +736,17 @@ bool MenuItemImage::initWithNormalImage(const std::string& normalImage, const st Node *selectedSprite = nullptr; Node *disabledSprite = nullptr; - if (normalImage.size() >0) + if (!normalImage.empty()) { normalSprite = Sprite::create(normalImage); } - if (selectedImage.size() >0) + if (!selectedImage.empty()) { selectedSprite = Sprite::create(selectedImage); } - if(disabledImage.size() >0) + if(!disabledImage.empty()) { disabledSprite = Sprite::create(disabledImage); } @@ -952,7 +952,7 @@ void MenuItemToggle::cleanup() void MenuItemToggle::setSelectedIndex(unsigned int index) { - if( index != _selectedIndex && _subItems.size() > 0 ) + if( index != _selectedIndex && !_subItems.empty() ) { _selectedIndex = index; if (_selectedItem) diff --git a/cocos/2d/CCMotionStreak.cpp b/cocos/2d/CCMotionStreak.cpp index 308102a81966..d951195b4832 100644 --- a/cocos/2d/CCMotionStreak.cpp +++ b/cocos/2d/CCMotionStreak.cpp @@ -28,8 +28,8 @@ THE SOFTWARE. #include "2d/CCMotionStreak.h" #include "math/CCVertex.h" #include "base/CCDirector.h" -#include "base/ccUtils.h" #include "renderer/CCTextureCache.h" +#include "renderer/ccGLStateCache.h" #include "renderer/CCTexture2D.h" #include "renderer/CCRenderer.h" #include "renderer/CCGLProgramState.h" @@ -208,7 +208,7 @@ void MotionStreak::tintWithColor(const Color3B& colors) } } -Texture2D* MotionStreak::getTexture(void) const +Texture2D* MotionStreak::getTexture() const { return _texture; } @@ -228,7 +228,7 @@ void MotionStreak::setBlendFunc(const BlendFunc &blendFunc) _blendFunc = blendFunc; } -const BlendFunc& MotionStreak::getBlendFunc(void) const +const BlendFunc& MotionStreak::getBlendFunc() const { return _blendFunc; } @@ -238,7 +238,7 @@ void MotionStreak::setOpacity(GLubyte /*opacity*/) CCASSERT(false, "Set opacity no supported"); } -GLubyte MotionStreak::getOpacity(void) const +GLubyte MotionStreak::getOpacity() const { CCASSERT(false, "Opacity no supported"); return 0; @@ -248,7 +248,7 @@ void MotionStreak::setOpacityModifyRGB(bool /*bValue*/) { } -bool MotionStreak::isOpacityModifyRGB(void) const +bool MotionStreak::isOpacityModifyRGB() const { return false; } @@ -383,13 +383,10 @@ void MotionStreak::onDraw(const Mat4 &transform, uint32_t /*flags*/) getGLProgram()->use(); getGLProgram()->setUniformsForBuiltins(transform); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_TEX_COORD); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_COLOR); - utils::setBlending(_blendFunc.src, _blendFunc.dst); + GL::enableVertexAttribs(GL::VERTEX_ATTRIB_FLAG_POS_COLOR_TEX ); + GL::blendFunc( _blendFunc.src, _blendFunc.dst ); - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, _texture->getName()); + GL::bindTexture2D( _texture ); glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, _vertices); glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_TEX_COORD, 2, GL_FLOAT, GL_FALSE, 0, _texCoords); diff --git a/cocos/2d/CCMotionStreak.h b/cocos/2d/CCMotionStreak.h index fc8e09a23be1..d3fc3bdc8bcc 100644 --- a/cocos/2d/CCMotionStreak.h +++ b/cocos/2d/CCMotionStreak.h @@ -119,8 +119,8 @@ class CC_DLL MotionStreak : public Node, public TextureProtocol virtual void getPosition(float* x, float* y) const override; virtual void setPositionX(float x) override; virtual void setPositionY(float y) override; - virtual float getPositionX(void) const override; - virtual float getPositionY(void) const override; + virtual float getPositionX() const override; + virtual float getPositionY() const override; virtual Vec3 getPosition3D() const override; /** * @js NA diff --git a/cocos/2d/CCNode.cpp b/cocos/2d/CCNode.cpp index 1f266b699027..350b97fca346 100644 --- a/cocos/2d/CCNode.cpp +++ b/cocos/2d/CCNode.cpp @@ -420,7 +420,7 @@ void Node::setRotationSkewY(float rotationY) } /// scale getter -float Node::getScale(void) const +float Node::getScale() const { CCASSERT( _scaleX == _scaleY, "CCNode#scale. ScaleX != ScaleY. Don't know which one to return"); return _scaleX; @@ -812,13 +812,13 @@ Node* Node::getChildByName(const std::string& name) const for (const auto& child : _children) { // Different strings may have the same hash code, but can use it to compare first for speed - if(child->_hashOfName == hash && child->_name.compare(name) == 0) + if(child->_hashOfName == hash && child->_name == name) return child; } return nullptr; } -void Node::enumerateChildren(const std::string &name, std::function callback) const +void Node::enumerateChildren(const std::string &name, const std::function& callback) const { CCASSERT(!name.empty(), "Invalid name"); CCASSERT(callback != nullptr, "Invalid callback function"); @@ -850,26 +850,31 @@ void Node::enumerateChildren(const std::string &name, std::functiondoEnumerateRecursive(target, newName, callback); } else { // name is xxx - doEnumerate(newName, callback); + target->doEnumerate(newName, callback); } } -bool Node::doEnumerateRecursive(const Node* node, const std::string &name, std::function callback) const +bool Node::doEnumerateRecursive(const Node* node, const std::string &name, const std::function& callback) const { bool ret =false; @@ -894,7 +899,7 @@ bool Node::doEnumerateRecursive(const Node* node, const std::string &name, std:: return ret; } -bool Node::doEnumerate(std::string name, std::function callback) const +bool Node::doEnumerate(std::string name, const std::function& callback) const { // name may be xxx/yyy, should find its parent size_t pos = name.find('/'); @@ -1992,7 +1997,7 @@ void Node::removeAllComponents() // MARK: Opacity and Color -GLubyte Node::getOpacity(void) const +GLubyte Node::getOpacity() const { return _realOpacity; } @@ -2023,7 +2028,7 @@ void Node::updateDisplayedOpacity(GLubyte parentOpacity) } } -bool Node::isCascadeOpacityEnabled(void) const +bool Node::isCascadeOpacityEnabled() const { return _cascadeOpacityEnabled; } @@ -2077,7 +2082,7 @@ bool Node::isOpacityModifyRGB() const return false; } -const Color3B& Node::getColor(void) const +const Color3B& Node::getColor() const { return _realColor; } @@ -2110,7 +2115,7 @@ void Node::updateDisplayedColor(const Color3B& parentColor) } } -bool Node::isCascadeColorEnabled(void) const +bool Node::isCascadeColorEnabled() const { return _cascadeColorEnabled; } diff --git a/cocos/2d/CCNode.h b/cocos/2d/CCNode.h index b16ed3839d95..972a86dd8486 100644 --- a/cocos/2d/CCNode.h +++ b/cocos/2d/CCNode.h @@ -410,7 +410,7 @@ class CC_DLL Node : public Ref * * @return The x coordinate of the node. */ - virtual float getPositionX(void) const; + virtual float getPositionX() const; /** Sets the y coordinate of the node in its parent's coordinate system. * * @param y The y coordinate of the node. @@ -420,7 +420,7 @@ class CC_DLL Node : public Ref * * @return The y coordinate of the node. */ - virtual float getPositionY(void) const; + virtual float getPositionY() const; /** * Sets the position (X, Y, and Z) in its parent's coordinate system. @@ -812,7 +812,7 @@ class CC_DLL Node : public Ref * @param name The name to search for, supports c++11 regular expression. * Search syntax options: * `//`: Can only be placed at the begin of the search string. This indicates that it will search recursively. - * `..`: The search should move up to the node's parent. Can only be placed at the end of string. + * `/..`: The search should move up to the node's parent. Can only be placed at the end of string. * `/` : When placed anywhere but the start of the search string, this indicates that the search should move to the node's children. * * @code @@ -834,7 +834,7 @@ class CC_DLL Node : public Ref * * @since v3.2 */ - virtual void enumerateChildren(const std::string &name, std::function callback) const; + virtual void enumerateChildren(const std::string &name, const std::function& callback) const; /** * Returns the array of the node's children. * @@ -967,7 +967,7 @@ class CC_DLL Node : public Ref * * @return An integer that identifies the node. * - * Please use `getTag()` instead. + * Please use `getName()` instead. */ virtual int getTag() const; /** @@ -1363,7 +1363,7 @@ class CC_DLL Node : public Ref * Only one "update" method could be scheduled per node. * @lua NA */ - void scheduleUpdate(void); + void scheduleUpdate(); /** * Schedules the "update" method with a custom priority. @@ -1381,7 +1381,7 @@ class CC_DLL Node : public Ref * Unschedules the "update" method. * @see scheduleUpdate(); */ - void unscheduleUpdate(void); + void unscheduleUpdate(); /** * Schedules a custom selector. @@ -1502,12 +1502,12 @@ class CC_DLL Node : public Ref * Resumes all scheduled selectors, actions and event listeners. * This method is called internally by onEnter. */ - virtual void resume(void); + virtual void resume(); /** * Pauses all scheduled selectors, actions and event listeners. * This method is called internally by onExit. */ - virtual void pause(void); + virtual void pause(); /** * Resumes all scheduled selectors, actions and event listeners. @@ -1866,7 +1866,7 @@ class CC_DLL Node : public Ref protected: /// lazy allocs - void childrenAlloc(void); + void childrenAlloc(); /// helper that reorder a child void insertChild(Node* child, int z); @@ -1886,8 +1886,8 @@ class CC_DLL Node : public Ref virtual void disableCascadeColor(); virtual void updateColor() {} - bool doEnumerate(std::string name, std::function callback) const; - bool doEnumerateRecursive(const Node* node, const std::string &name, std::function callback) const; + bool doEnumerate(std::string name, const std::function& callback) const; + bool doEnumerateRecursive(const Node* node, const std::string &name, const std::function& callback) const; //check whether this camera mask is visible by the current visiting camera bool isVisitableByVisitingCamera() const; @@ -2081,7 +2081,7 @@ class CC_DLL __NodeRGBA : public Node, public __RGBAProtocol virtual bool isCascadeOpacityEnabled() const override { return Node::isCascadeOpacityEnabled(); } virtual void setCascadeOpacityEnabled(bool cascadeOpacityEnabled) override { return Node::setCascadeOpacityEnabled(cascadeOpacityEnabled); } - virtual const Color3B& getColor(void) const override { return Node::getColor(); } + virtual const Color3B& getColor() const override { return Node::getColor(); } virtual const Color3B& getDisplayedColor() const override { return Node::getDisplayedColor(); } virtual void setColor(const Color3B& color) override { return Node::setColor(color); } virtual void updateDisplayedColor(const Color3B& parentColor) override { return Node::updateDisplayedColor(parentColor); } diff --git a/cocos/2d/CCParticleBatchNode.h b/cocos/2d/CCParticleBatchNode.h index b1cc594bcabd..ed98f6eb70f0 100644 --- a/cocos/2d/CCParticleBatchNode.h +++ b/cocos/2d/CCParticleBatchNode.h @@ -130,7 +130,7 @@ class CC_DLL ParticleBatchNode : public Node, public TextureProtocol virtual void removeChild(Node* child, bool cleanup) override; virtual void reorderChild(Node * child, int zOrder) override; virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override; - virtual Texture2D* getTexture(void) const override; + virtual Texture2D* getTexture() const override; virtual void setTexture(Texture2D *texture) override; /** * @code @@ -144,7 +144,7 @@ class CC_DLL ParticleBatchNode : public Node, public TextureProtocol * @js NA * @lua NA */ - virtual const BlendFunc& getBlendFunc(void) const override; + virtual const BlendFunc& getBlendFunc() const override; CC_CONSTRUCTOR_ACCESS: /** @@ -170,7 +170,7 @@ class CC_DLL ParticleBatchNode : public Node, public TextureProtocol void getCurrentIndex(int* oldIndex, int* newIndex, Node* child, int z); int addChildHelper(ParticleSystem* child, int z, int aTag, const std::string &name, bool setTag); void addChildByTagOrName(ParticleSystem* child, int z, int tag, const std::string &name, bool setTag); - void updateBlendFunc(void); + void updateBlendFunc(); /** the texture atlas used for drawing the quads */ TextureAtlas* _textureAtlas; diff --git a/cocos/2d/CCParticleSystem.cpp b/cocos/2d/CCParticleSystem.cpp index 9d63c2d070aa..4c826b33ad45 100644 --- a/cocos/2d/CCParticleSystem.cpp +++ b/cocos/2d/CCParticleSystem.cpp @@ -1038,7 +1038,7 @@ void ParticleSystem::update(float dt) CC_PROFILER_STOP_CATEGORY(kProfilerCategoryParticles , "CCParticleSystem - update"); } -void ParticleSystem::updateWithNoTime(void) +void ParticleSystem::updateWithNoTime() { this->update(0.0f); } @@ -1327,7 +1327,7 @@ void ParticleSystem::setAutoRemoveOnFinish(bool var) // ParticleSystem - methods for batchNode rendering -ParticleBatchNode* ParticleSystem::getBatchNode(void) const +ParticleBatchNode* ParticleSystem::getBatchNode() const { return _batchNode; } diff --git a/cocos/2d/CCParticleSystemQuad.cpp b/cocos/2d/CCParticleSystemQuad.cpp index a14e4540d97f..1b392f3e34d1 100644 --- a/cocos/2d/CCParticleSystemQuad.cpp +++ b/cocos/2d/CCParticleSystemQuad.cpp @@ -35,6 +35,7 @@ THE SOFTWARE. #include "2d/CCSpriteFrame.h" #include "2d/CCParticleBatchNode.h" #include "renderer/CCTextureAtlas.h" +#include "renderer/ccGLStateCache.h" #include "renderer/CCRenderer.h" #include "base/CCDirector.h" #include "base/CCEventType.h" @@ -63,7 +64,7 @@ ParticleSystemQuad::~ParticleSystemQuad() if (Configuration::getInstance()->supportsShareableVAO()) { glDeleteVertexArrays(1, &_VAOname); - glBindVertexArray(0); + GL::bindVAO(0); } } } @@ -544,13 +545,18 @@ void ParticleSystemQuad::setTotalParticles(int tp) void ParticleSystemQuad::setupVBOandVAO() { - // clean VAO glDeleteBuffers(2, &_buffersVBO[0]); - glDeleteVertexArrays(1, &_VAOname); - glBindVertexArray(0); + + // clean VAO + if (_VAOname) + { + glDeleteVertexArrays(1, &_VAOname); + GL::bindVAO(0); + _VAOname = 0; + } glGenVertexArrays(1, &_VAOname); - glBindVertexArray(_VAOname); + GL::bindVAO(_VAOname); #define kQuadSize sizeof(_quads[0].bl) @@ -575,7 +581,7 @@ void ParticleSystemQuad::setupVBOandVAO() glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(_indices[0]) * _totalParticles * 6, _indices, GL_STATIC_DRAW); // Must unbind the VAO before changing the element buffer. - glBindVertexArray(0); + GL::bindVAO(0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); glBindBuffer(GL_ARRAY_BUFFER, 0); @@ -679,7 +685,7 @@ void ParticleSystemQuad::setBatchNode(ParticleBatchNode * batchNode) if (Configuration::getInstance()->supportsShareableVAO()) { glDeleteVertexArrays(1, &_VAOname); - glBindVertexArray(0); + GL::bindVAO(0); _VAOname = 0; } } diff --git a/cocos/2d/CCProgressTimer.cpp b/cocos/2d/CCProgressTimer.cpp index 66cddbcf049f..9d05c0452740 100644 --- a/cocos/2d/CCProgressTimer.cpp +++ b/cocos/2d/CCProgressTimer.cpp @@ -31,8 +31,8 @@ THE SOFTWARE. #include "base/ccMacros.h" #include "base/CCDirector.h" #include "2d/CCSprite.h" +#include "renderer/ccGLStateCache.h" #include "renderer/CCRenderer.h" -#include "base/ccUtils.h" NS_CC_BEGIN @@ -83,7 +83,7 @@ bool ProgressTimer::initWithSprite(Sprite* sp) return true; } -ProgressTimer::~ProgressTimer(void) +ProgressTimer::~ProgressTimer() { CC_SAFE_FREE(_vertexData); CC_SAFE_RELEASE(_sprite); @@ -189,7 +189,7 @@ Vec2 ProgressTimer::vertexFromAlphaPoint(Vec2 alpha) return ret; } -void ProgressTimer::updateColor(void) +void ProgressTimer::updateColor() { if (!_sprite) { return; @@ -205,7 +205,7 @@ void ProgressTimer::updateColor(void) } } -void ProgressTimer::updateProgress(void) +void ProgressTimer::updateProgress() { switch (_type) { @@ -266,7 +266,7 @@ void ProgressTimer::setMidpoint(const Vec2& midPoint) // It now deals with flipped texture. If you run into this problem, just use the // sprite property and enable the methods flipX, flipY. /// -void ProgressTimer::updateRadial(void) +void ProgressTimer::updateRadial() { if (!_sprite) { return; @@ -398,7 +398,7 @@ void ProgressTimer::updateRadial(void) // It now deals with flipped texture. If you run into this problem, just use the // sprite property and enable the methods flipX, flipY. /// -void ProgressTimer::updateBar(void) +void ProgressTimer::updateBar() { if (!_sprite) { return; @@ -509,14 +509,11 @@ void ProgressTimer::onDraw(const Mat4 &transform, uint32_t /*flags*/) getGLProgram()->use(); getGLProgram()->setUniformsForBuiltins(transform); - utils::setBlending(_sprite->getBlendFunc().src, _sprite->getBlendFunc().dst); + GL::blendFunc( _sprite->getBlendFunc().src, _sprite->getBlendFunc().dst ); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_TEX_COORD); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_COLOR); + GL::enableVertexAttribs(GL::VERTEX_ATTRIB_FLAG_POS_COLOR_TEX ); - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, _sprite->getTexture()->getName()); + GL::bindTexture2D( _sprite->getTexture() ); glVertexAttribPointer( GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, sizeof(_vertexData[0]) , &_vertexData[0].vertices); glVertexAttribPointer( GLProgram::VERTEX_ATTRIB_TEX_COORD, 2, GL_FLOAT, GL_FALSE, sizeof(_vertexData[0]), &_vertexData[0].texCoords); diff --git a/cocos/2d/CCProgressTimer.h b/cocos/2d/CCProgressTimer.h index f19b0bcc21e0..fa531ee847e0 100644 --- a/cocos/2d/CCProgressTimer.h +++ b/cocos/2d/CCProgressTimer.h @@ -181,10 +181,10 @@ class CC_DLL ProgressTimer : public Node Tex2F textureCoordFromAlphaPoint(Vec2 alpha); Vec2 vertexFromAlphaPoint(Vec2 alpha); - void updateProgress(void); - void updateBar(void); - void updateRadial(void); - virtual void updateColor(void) override; + void updateProgress(); + void updateBar(); + void updateRadial(); + virtual void updateColor() override; Vec2 boundaryTexCoord(char index); Type _type; diff --git a/cocos/2d/CCProtectedNode.cpp b/cocos/2d/CCProtectedNode.cpp index 4736bed2862c..d02e0f0f1d8b 100644 --- a/cocos/2d/CCProtectedNode.cpp +++ b/cocos/2d/CCProtectedNode.cpp @@ -44,7 +44,7 @@ ProtectedNode::~ProtectedNode() removeAllProtectedChildren(); } -ProtectedNode * ProtectedNode::create(void) +ProtectedNode * ProtectedNode::create() { ProtectedNode * ret = new (std::nothrow) ProtectedNode(); if (ret && ret->init()) diff --git a/cocos/2d/CCProtectedNode.h b/cocos/2d/CCProtectedNode.h index 01bfa5f2ae7a..eb411ee728cc 100644 --- a/cocos/2d/CCProtectedNode.h +++ b/cocos/2d/CCProtectedNode.h @@ -51,7 +51,7 @@ class CC_DLL ProtectedNode : public Node * Creates a ProtectedNode with no argument. *@return A instance of ProtectedNode. */ - static ProtectedNode * create(void); + static ProtectedNode * create(); /// @{ /// @name Children and Parent diff --git a/cocos/2d/CCRenderTexture.cpp b/cocos/2d/CCRenderTexture.cpp index fb63b9cac6cd..42613e8b07d6 100644 --- a/cocos/2d/CCRenderTexture.cpp +++ b/cocos/2d/CCRenderTexture.cpp @@ -27,6 +27,8 @@ THE SOFTWARE. #include "2d/CCRenderTexture.h" +#include + #include "base/ccUtils.h" #include "platform/CCFileUtils.h" #include "base/CCEventType.h" @@ -251,7 +253,7 @@ bool RenderTexture::initWithWidthAndHeight(int w, int h, Texture2D::PixelFormat _texture = new (std::nothrow) Texture2D(); if (_texture) { - _texture->initWithData(data, dataLen, (Texture2D::PixelFormat)_pixelFormat, powW, powH, Size((float)w, (float)h)); + _texture->initWithData(data, dataLen, (Texture2D::PixelFormat)_pixelFormat, powW, powH, Size((float)w, (float)h), CC_ENABLE_PREMULTIPLIED_ALPHA != 0); } else { @@ -265,7 +267,7 @@ bool RenderTexture::initWithWidthAndHeight(int w, int h, Texture2D::PixelFormat _textureCopy = new (std::nothrow) Texture2D(); if (_textureCopy) { - _textureCopy->initWithData(data, dataLen, (Texture2D::PixelFormat)_pixelFormat, powW, powH, Size((float)w, (float)h)); + _textureCopy->initWithData(data, dataLen, (Texture2D::PixelFormat)_pixelFormat, powW, powH, Size((float)w, (float)h), CC_ENABLE_PREMULTIPLIED_ALPHA != 0); } else { @@ -301,8 +303,13 @@ bool RenderTexture::initWithWidthAndHeight(int w, int h, Texture2D::PixelFormat _texture->release(); _sprite->setFlippedY(true); - _sprite->setBlendFunc( BlendFunc::ALPHA_PREMULTIPLIED ); +#if CC_ENABLE_PREMULTIPLIED_ALPHA != 0 + _sprite->setBlendFunc(BlendFunc::ALPHA_PREMULTIPLIED); _sprite->setOpacityModifyRGB(true); +#else + _sprite->setBlendFunc(BlendFunc::ALPHA_NON_PREMULTIPLIED); + _sprite->setOpacityModifyRGB(false); +#endif glBindRenderbuffer(GL_RENDERBUFFER, oldRBO); glBindFramebuffer(GL_FRAMEBUFFER, _oldFBO); @@ -506,7 +513,29 @@ void RenderTexture::visit(Renderer *renderer, const Mat4 &parentTransform, uint3 // setOrderOfArrival(0); } -bool RenderTexture::saveToFile(const std::string& filename, bool isRGBA, std::function callback) +bool RenderTexture::saveToFileAsNonPMA(const std::string& filename, bool isRGBA, const std::function& callback) +{ + std::string basename(filename); + std::transform(basename.begin(), basename.end(), basename.begin(), ::tolower); + + if (basename.find(".png") != std::string::npos) + { + return saveToFileAsNonPMA(filename, Image::Format::PNG, isRGBA, callback); + } + else if (basename.find(".jpg") != std::string::npos) + { + if (isRGBA) CCLOG("RGBA is not supported for JPG format."); + return saveToFileAsNonPMA(filename, Image::Format::JPG, false, callback); + } + else + { + CCLOG("Only PNG and JPG format are supported now!"); + } + + return saveToFileAsNonPMA(filename, Image::Format::JPG, false, callback); +} + +bool RenderTexture::saveToFile(const std::string& filename, bool isRGBA, const std::function& callback) { std::string basename(filename); std::transform(basename.begin(), basename.end(), basename.begin(), ::tolower); @@ -528,7 +557,23 @@ bool RenderTexture::saveToFile(const std::string& filename, bool isRGBA, std::fu return saveToFile(filename, Image::Format::JPG, false, callback); } -bool RenderTexture::saveToFile(const std::string& fileName, Image::Format format, bool isRGBA, std::function callback) +bool RenderTexture::saveToFileAsNonPMA(const std::string& fileName, Image::Format format, bool isRGBA, const std::function& callback) +{ + CCASSERT(format == Image::Format::JPG || format == Image::Format::PNG, + "the image can only be saved as JPG or PNG format"); + if (isRGBA && format == Image::Format::JPG) CCLOG("RGBA is not supported for JPG format"); + + _saveFileCallback = callback; + + std::string fullpath = FileUtils::getInstance()->getWritablePath() + fileName; + _saveToFileCommand.init(_globalZOrder); + _saveToFileCommand.func = CC_CALLBACK_0(RenderTexture::onSaveToFile, this, fullpath, isRGBA, true); + + Director::getInstance()->getRenderer()->addCommand(&_saveToFileCommand); + return true; +} + +bool RenderTexture::saveToFile(const std::string& fileName, Image::Format format, bool isRGBA, const std::function& callback) { CCASSERT(format == Image::Format::JPG || format == Image::Format::PNG, "the image can only be saved as JPG or PNG format"); @@ -538,17 +583,21 @@ bool RenderTexture::saveToFile(const std::string& fileName, Image::Format format std::string fullpath = FileUtils::getInstance()->getWritablePath() + fileName; _saveToFileCommand.init(_globalZOrder); - _saveToFileCommand.func = CC_CALLBACK_0(RenderTexture::onSaveToFile, this, fullpath, isRGBA); + _saveToFileCommand.func = CC_CALLBACK_0(RenderTexture::onSaveToFile, this, fullpath, isRGBA, false); Director::getInstance()->getRenderer()->addCommand(&_saveToFileCommand); return true; } -void RenderTexture::onSaveToFile(const std::string& filename, bool isRGBA) +void RenderTexture::onSaveToFile(const std::string& filename, bool isRGBA, bool forceNonPMA) { Image *image = newImage(true); if (image) { + if (forceNonPMA && image->hasPremultipliedAlpha()) + { + image->reversePremultipliedAlpha(); + } image->saveToFile(filename, !isRGBA); } if(_saveFileCallback) @@ -620,11 +669,11 @@ Image* RenderTexture::newImage(bool flipImage) savedBufferWidth * 4); } - image->initWithRawData(buffer, savedBufferWidth * savedBufferHeight * 4, savedBufferWidth, savedBufferHeight, 8); + image->initWithRawData(buffer, savedBufferWidth * savedBufferHeight * 4, savedBufferWidth, savedBufferHeight, 8, _texture->hasPremultipliedAlpha()); } else { - image->initWithRawData(tempData, savedBufferWidth * savedBufferHeight * 4, savedBufferWidth, savedBufferHeight, 8); + image->initWithRawData(tempData, savedBufferWidth * savedBufferHeight * 4, savedBufferWidth, savedBufferHeight, 8, _texture->hasPremultipliedAlpha()); } } while (0); diff --git a/cocos/2d/CCRenderTexture.h b/cocos/2d/CCRenderTexture.h index 03a27ab334e4..83591dd24b83 100644 --- a/cocos/2d/CCRenderTexture.h +++ b/cocos/2d/CCRenderTexture.h @@ -159,7 +159,32 @@ class CC_DLL RenderTexture : public Node * @param callback When the file is save finished,it will callback this function. * @return Returns true if the operation is successful. */ - bool saveToFile(const std::string& filename, bool isRGBA = true, std::function callback = nullptr); + bool saveToFileAsNonPMA(const std::string& filename, bool isRGBA = true, const std::function& callback = nullptr); + + + /** Saves the texture into a file using JPEG format. The file will be saved in the Documents folder. + * Returns true if the operation is successful. + * + * @param filename The file name. + * @param isRGBA The file is RGBA or not. + * @param callback When the file is save finished,it will callback this function. + * @return Returns true if the operation is successful. + */ + bool saveToFile(const std::string& filename, bool isRGBA = true, const std::function& callback = nullptr); + + /** saves the texture into a file in non-PMA. The format could be JPG or PNG. The file will be saved in the Documents folder. + Returns true if the operation is successful. + * Notes: since v3.x, saveToFile will generate a custom command, which will be called in the following render->render(). + * So if this function is called in a event handler, the actual save file will be called in the next frame. If we switch to a different scene, the game will crash. + * To solve this, add Director::getInstance()->getRenderer()->render(); after this function. + * + * @param filename The file name. + * @param format The image format. + * @param isRGBA The file is RGBA or not. + * @param callback When the file is save finished,it will callback this function. + * @return Returns true if the operation is successful. + */ + bool saveToFileAsNonPMA(const std::string& fileName, Image::Format format, bool isRGBA, const std::function& callback); /** saves the texture into a file. The format could be JPG or PNG. The file will be saved in the Documents folder. Returns true if the operation is successful. @@ -173,7 +198,7 @@ class CC_DLL RenderTexture : public Node * @param callback When the file is save finished,it will callback this function. * @return Returns true if the operation is successful. */ - bool saveToFile(const std::string& filename, Image::Format format, bool isRGBA = true, std::function callback = nullptr); + bool saveToFile(const std::string& filename, Image::Format format, bool isRGBA = true, const std::function& callback = nullptr); /** Listen "come to background" message, and save render texture. * It only has effect on Android. @@ -363,7 +388,7 @@ class CC_DLL RenderTexture : public Node void onClear(); void onClearDepth(); - void onSaveToFile(const std::string& fileName, bool isRGBA = true); + void onSaveToFile(const std::string& fileName, bool isRGBA = true, bool forceNonPMA = false); void setupDepthAndStencil(int powW, int powH); diff --git a/cocos/2d/CCScene.cpp b/cocos/2d/CCScene.cpp index 419483851c3d..ec30342b5f94 100644 --- a/cocos/2d/CCScene.cpp +++ b/cocos/2d/CCScene.cpp @@ -34,6 +34,7 @@ THE SOFTWARE. #include "base/ccUTF8.h" #include "renderer/CCRenderer.h" #include "renderer/CCFrameBuffer.h" +#include "platform/CCDataManager.h" #if CC_USE_PHYSICS #include "physics/CCPhysicsWorld.h" @@ -51,31 +52,32 @@ THE SOFTWARE. NS_CC_BEGIN Scene::Scene() +: _defaultCamera(Camera::create()) +, _event(Director::getInstance()->getEventDispatcher()->addCustomEventListener(Director::EVENT_PROJECTION_CHANGED, std::bind(&Scene::onProjectionChanged, this, std::placeholders::_1))) { -#if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION - _physics3DWorld = nullptr; - _physics3dDebugCamera = nullptr; -#endif -#if CC_USE_NAVMESH - _navMesh = nullptr; - _navMeshDebugCamera = nullptr; -#endif -#if CC_USE_PHYSICS - _physicsWorld = nullptr; -#endif _ignoreAnchorPointForPosition = true; setAnchorPoint(Vec2(0.5f, 0.5f)); - _cameraOrderDirty = true; - //create default camera - _defaultCamera = Camera::create(); + addChild(_defaultCamera); - _event = Director::getInstance()->getEventDispatcher()->addCustomEventListener(Director::EVENT_PROJECTION_CHANGED, std::bind(&Scene::onProjectionChanged, this, std::placeholders::_1)); _event->retain(); Camera::_visitingCamera = nullptr; + +#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID + DataManager::onSceneLoaderBegin(); +#endif +} + +void Scene::onEnter() +{ + Node::onEnter(); + +#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID + DataManager::onSceneLoaderEnd(); +#endif } Scene::~Scene() diff --git a/cocos/2d/CCScene.h b/cocos/2d/CCScene.h index 41e5c05d3632..aa610740a950 100644 --- a/cocos/2d/CCScene.h +++ b/cocos/2d/CCScene.h @@ -126,6 +126,15 @@ class CC_DLL Scene : public Node /** override function */ virtual void removeAllChildren() override; + /** + * Event callback that is invoked every time when Node enters the 'stage'. + * If the Node enters the 'stage' with a transition, this event is called when the transition starts. + * During onEnter you can't access a "sister/brother" node. + * If you override onEnter, you shall call its parent's one, e.g., Node::onEnter(). + * @lua NA + */ + virtual void onEnter() override; + CC_CONSTRUCTOR_ACCESS: Scene(); virtual ~Scene(); @@ -146,9 +155,9 @@ class CC_DLL Scene : public Node friend class Renderer; std::vector _cameras; //weak ref to Camera - Camera* _defaultCamera; //weak ref, default camera created by scene, _cameras[0], Caution that the default camera can not be added to _cameras before onEnter is called - bool _cameraOrderDirty; // order is dirty, need sort - EventListenerCustom* _event; + Camera* _defaultCamera = nullptr; //weak ref, default camera created by scene, _cameras[0], Caution that the default camera can not be added to _cameras before onEnter is called + bool _cameraOrderDirty = true; // order is dirty, need sort + EventListenerCustom* _event = nullptr; std::vector _lights; @@ -192,12 +201,12 @@ class CC_DLL Scene : public Node void addChildToPhysicsWorld(Node* child); #if CC_USE_PHYSICS - PhysicsWorld* _physicsWorld; + PhysicsWorld* _physicsWorld = nullptr; #endif #if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION - Physics3DWorld* _physics3DWorld; - Camera* _physics3dDebugCamera; // + Physics3DWorld* _physics3DWorld = nullptr; + Camera* _physics3dDebugCamera = nullptr; #endif #endif // (CC_USE_PHYSICS || CC_USE_3D_PHYSICS) @@ -213,8 +222,8 @@ class CC_DLL Scene : public Node void setNavMeshDebugCamera(Camera *camera); protected: - NavMesh* _navMesh; - Camera * _navMeshDebugCamera; + NavMesh* _navMesh = nullptr; + Camera * _navMeshDebugCamera = nullptr; #endif #if (CC_USE_PHYSICS || (CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION) || CC_USE_NAVMESH) diff --git a/cocos/2d/CCSprite.cpp b/cocos/2d/CCSprite.cpp index 3c1f7ae0d229..810d23e8a18c 100644 --- a/cocos/2d/CCSprite.cpp +++ b/cocos/2d/CCSprite.cpp @@ -269,10 +269,6 @@ bool Sprite::initWithTexture(Texture2D *texture, const Rect& rect, bool rotated) _recursiveDirty = false; setDirty(false); - _opacityModifyRGB = true; - - _blendFunc = BlendFunc::ALPHA_PREMULTIPLIED; - _flippedX = _flippedY = false; // default transform anchor: center @@ -399,11 +395,14 @@ void Sprite::setTexture(Texture2D *texture) } } - if ((_renderMode != RenderMode::QUAD_BATCHNODE) && (_texture != texture)) + if (_renderMode != RenderMode::QUAD_BATCHNODE) { - CC_SAFE_RETAIN(texture); - CC_SAFE_RELEASE(_texture); - _texture = texture; + if (_texture != texture) + { + CC_SAFE_RETAIN(texture); + CC_SAFE_RELEASE(_texture); + _texture = texture; + } updateBlendFunc(); } } @@ -953,7 +952,7 @@ void Sprite::populateTriangle(int quadIndex, const V3F_C4B_T2F_Quad& quad) // MARK: visit, draw, transform -void Sprite::updateTransform(void) +void Sprite::updateTransform() { CCASSERT(_renderMode == RenderMode::QUAD_BATCHNODE, "updateTransform is only valid when Sprite is being rendered using an SpriteBatchNode"); @@ -1220,7 +1219,7 @@ void Sprite::sortAllChildren() // used only when parent is SpriteBatchNode // -void Sprite::setReorderChildDirtyRecursively(void) +void Sprite::setReorderChildDirtyRecursively() { //only set parents flag the first time if ( ! _reorderChildDirty ) @@ -1438,7 +1437,7 @@ void Sprite::setFlippedX(bool flippedX) } } -bool Sprite::isFlippedX(void) const +bool Sprite::isFlippedX() const { return _flippedX; } @@ -1452,7 +1451,7 @@ void Sprite::setFlippedY(bool flippedY) } } -bool Sprite::isFlippedY(void) const +bool Sprite::isFlippedY() const { return _flippedY; } @@ -1499,7 +1498,7 @@ void Sprite::flipY() { // MARK: RGBA protocol // -void Sprite::updateColor(void) +void Sprite::updateColor() { Color4B color4( _displayedColor.r, _displayedColor.g, _displayedColor.b, _displayedOpacity ); @@ -1548,7 +1547,7 @@ void Sprite::setOpacityModifyRGB(bool modify) } } -bool Sprite::isOpacityModifyRGB(void) const +bool Sprite::isOpacityModifyRGB() const { return _opacityModifyRGB; } @@ -1691,7 +1690,7 @@ void Sprite::setBatchNode(SpriteBatchNode *spriteBatchNode) // MARK: Texture protocol -void Sprite::updateBlendFunc(void) +void Sprite::updateBlendFunc() { CCASSERT(_renderMode != RenderMode::QUAD_BATCHNODE, "CCSprite: updateBlendFunc doesn't work when the sprite is rendered using a SpriteBatchNode"); diff --git a/cocos/2d/CCSprite.h b/cocos/2d/CCSprite.h index 10adf3ae3aa8..192a44a72302 100644 --- a/cocos/2d/CCSprite.h +++ b/cocos/2d/CCSprite.h @@ -184,7 +184,7 @@ class CC_DLL Sprite : public Node, public TextureProtocol * A SpriteFrame will be fetched from the SpriteFrameCache by spriteFrameName param. * If the SpriteFrame doesn't exist it will raise an exception. * - * @param spriteFrameName A null terminated string which indicates the sprite frame name. + * @param spriteFrameName The name of sprite frame. * @return An autoreleased sprite object. */ static Sprite* createWithSpriteFrameName(const std::string& spriteFrameName); @@ -712,7 +712,7 @@ CC_CONSTRUCTOR_ACCESS : PolygonInfo _polyInfo; // opacity and RGB protocol - bool _opacityModifyRGB; + bool _opacityModifyRGB = false; // image is flipped bool _flippedX; /// Whether the sprite is flipped horizontally or not diff --git a/cocos/2d/CCSpriteBatchNode.cpp b/cocos/2d/CCSpriteBatchNode.cpp index 877de6124352..f26fa9b32634 100644 --- a/cocos/2d/CCSpriteBatchNode.cpp +++ b/cocos/2d/CCSpriteBatchNode.cpp @@ -467,7 +467,7 @@ ssize_t SpriteBatchNode::lowestAtlasIndexInChild(Sprite *sprite) { auto& children = sprite->getChildren(); - if (children.size() == 0) + if (children.empty()) { return sprite->getAtlasIndex(); } diff --git a/cocos/2d/CCSpriteFrameCache.cpp b/cocos/2d/CCSpriteFrameCache.cpp index 9eac614a751d..60428fe091ee 100644 --- a/cocos/2d/CCSpriteFrameCache.cpp +++ b/cocos/2d/CCSpriteFrameCache.cpp @@ -39,6 +39,7 @@ THE SOFTWARE. #include "base/CCNS.h" #include "base/ccMacros.h" #include "base/ccUTF8.h" +#include "base/ccUtils.h" #include "base/CCDirector.h" #include "renderer/CCTexture2D.h" #include "renderer/CCTextureCache.h" @@ -77,27 +78,6 @@ SpriteFrameCache::~SpriteFrameCache() { } -void SpriteFrameCache::parseIntegerList(const std::string &string, std::vector &res) -{ - std::string delim(" "); - - size_t n = std::count(string.begin(), string.end(), ' '); - res.resize(n+1); - - size_t start = 0U; - size_t end = string.find(delim); - - int i=0; - while (end != std::string::npos) - { - res[i++] = atoi(string.substr(start, end - start).c_str()); - start = end + delim.length(); - end = string.find(delim, start); - } - - res[i] = atoi(string.substr(start, end).c_str()); -} - void SpriteFrameCache::initializePolygonInfo(const Size &textureSize, const Size &spriteSize, const std::vector &vertices, @@ -263,12 +243,10 @@ void SpriteFrameCache::addSpriteFramesWithDictionary(ValueMap& dictionary, Textu if(frameDict.find("vertices") != frameDict.end()) { - std::vector vertices; - parseIntegerList(frameDict["vertices"].asString(), vertices); - std::vector verticesUV; - parseIntegerList(frameDict["verticesUV"].asString(), verticesUV); - std::vector indices; - parseIntegerList(frameDict["triangles"].asString(), indices); + using cocos2d::utils::parseIntegerList; + std::vector vertices = parseIntegerList(frameDict["vertices"].asString()); + std::vector verticesUV = parseIntegerList(frameDict["verticesUV"].asString()); + std::vector indices = parseIntegerList(frameDict["triangles"].asString()); PolygonInfo info; initializePolygonInfo(textureSize, spriteSourceSize, vertices, verticesUV, indices, info); @@ -293,6 +271,7 @@ void SpriteFrameCache::addSpriteFramesWithDictionary(ValueMap& dictionary, Textu // add sprite frame _spriteFramesCache.insertFrame(plist, spriteFrameName, spriteFrame); } + _spriteFramesCache.markPlistFull(plist, true); CC_SAFE_DELETE(image); } @@ -350,11 +329,6 @@ void SpriteFrameCache::addSpriteFramesWithDictionary(ValueMap& dict, const std:: void SpriteFrameCache::addSpriteFramesWithFile(const std::string& plist, Texture2D *texture) { - if (_spriteFramesCache.hasPlist(plist)) - { - return; // We already added it - } - std::string fullPath = FileUtils::getInstance()->fullPathForFilename(plist); ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(fullPath); @@ -369,11 +343,7 @@ void SpriteFrameCache::addSpriteFramesWithFileContent(const std::string& plist_c void SpriteFrameCache::addSpriteFramesWithFile(const std::string& plist, const std::string& textureFileName) { - CCASSERT(textureFileName.size()>0, "texture name should not be null"); - if (_spriteFramesCache.hasPlist(plist)) - { - return; // We already added it - } + CCASSERT(!textureFileName.empty(), "texture name should not be null"); const std::string fullPath = FileUtils::getInstance()->fullPathForFilename(plist); ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(fullPath); addSpriteFramesWithDictionary(dict, textureFileName, plist); @@ -383,6 +353,11 @@ void SpriteFrameCache::addSpriteFramesWithFile(const std::string& plist) { CCASSERT(!plist.empty(), "plist filename should not be nullptr"); + if (_spriteFramesCache.isPlistFull(plist)) + { + return; + } + std::string fullPath = FileUtils::getInstance()->fullPathForFilename(plist); if (fullPath.empty()) { @@ -391,45 +366,45 @@ void SpriteFrameCache::addSpriteFramesWithFile(const std::string& plist) return; } - if (!_spriteFramesCache.hasPlist(plist)) - { - ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(fullPath); + ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(fullPath); - string texturePath(""); + string texturePath(""); - if (dict.find("metadata") != dict.end()) - { - ValueMap& metadataDict = dict["metadata"].asValueMap(); - // try to read texture file name from meta data - texturePath = metadataDict["textureFileName"].asString(); - } + if (dict.find("metadata") != dict.end()) + { + ValueMap& metadataDict = dict["metadata"].asValueMap(); + // try to read texture file name from meta data + texturePath = metadataDict["textureFileName"].asString(); + } - if (!texturePath.empty()) - { - // build texture path relative to plist file - texturePath = FileUtils::getInstance()->fullPathFromRelativeFile(texturePath, plist); - } - else - { - // build texture path by replacing file extension - texturePath = plist; + if (!texturePath.empty()) + { + // build texture path relative to plist file + texturePath = FileUtils::getInstance()->fullPathFromRelativeFile(texturePath, plist); + } + else + { + // build texture path by replacing file extension + texturePath = plist; - // remove .xxx - size_t startPos = texturePath.find_last_of("."); + // remove .xxx + size_t startPos = texturePath.find_last_of('.'); + if(startPos != string::npos) + { texturePath = texturePath.erase(startPos); + } - // append .png - texturePath = texturePath.append(".png"); + // append .png + texturePath = texturePath.append(".png"); - CCLOG("cocos2d: SpriteFrameCache: Trying to use file %s as texture", texturePath.c_str()); - } - addSpriteFramesWithDictionary(dict, texturePath, plist); + CCLOG("cocos2d: SpriteFrameCache: Trying to use file %s as texture", texturePath.c_str()); } + addSpriteFramesWithDictionary(dict, texturePath, plist); } bool SpriteFrameCache::isSpriteFramesWithFileLoaded(const std::string& plist) const { - return _spriteFramesCache.hasPlist(plist); + return _spriteFramesCache.isPlistUsed(plist) && _spriteFramesCache.isPlistFull(plist); } void SpriteFrameCache::addSpriteFrame(SpriteFrame* frame, const std::string& frameName) @@ -684,9 +659,9 @@ void SpriteFrameCache::reloadSpriteFramesWithDictionary(ValueMap& dictionary, Te bool SpriteFrameCache::reloadTexture(const std::string& plist) { - CCASSERT(plist.size()>0, "plist filename should not be nullptr"); + CCASSERT(!plist.empty(), "plist filename should not be nullptr"); - if (_spriteFramesCache.hasPlist(plist)) { + if (_spriteFramesCache.isPlistUsed(plist)) { _spriteFramesCache.erasePlistIndex(plist); } else @@ -718,9 +693,12 @@ bool SpriteFrameCache::reloadTexture(const std::string& plist) texturePath = plist; // remove .xxx - size_t startPos = texturePath.find_last_of("."); - texturePath = texturePath.erase(startPos); - + size_t startPos = texturePath.find_last_of('.'); + if(startPos != string::npos) + { + texturePath = texturePath.erase(startPos); + } + // append .png texturePath = texturePath.append(".png"); } @@ -749,21 +727,21 @@ void SpriteFrameCache::PlistFramesCache::insertFrame(const std::string &plist, c _indexFrame2plist[frame] = plist; //insert index frameName->plist } -bool SpriteFrameCache::PlistFramesCache::isPlistUsed(const std::string &plist) const -{ - //plist loaded && not empty - auto it = _indexPlist2Frames.find(plist); - return it != _indexPlist2Frames.end() && !it->second.empty(); -} - bool SpriteFrameCache::PlistFramesCache::eraseFrame(const std::string &frame) { _spriteFrames.erase(frame); //drop SpriteFrame auto itFrame = _indexFrame2plist.find(frame); if (itFrame != _indexFrame2plist.end()) { - _indexPlist2Frames[itFrame->second].erase(frame); //update index plist->[frameNames] + auto plist = itFrame->second; + markPlistFull(plist, false); + _indexPlist2Frames[plist].erase(frame); //update index plist->[frameNames] _indexFrame2plist.erase(itFrame); //update index frame->plist + // erase plist index if all frames was erased + if (_indexFrame2plist.empty()) + { + _indexPlist2Frames.erase(plist); + } return true; } return false; @@ -785,13 +763,14 @@ bool SpriteFrameCache::PlistFramesCache::erasePlistIndex(const std::string &plis if (it == _indexPlist2Frames.end()) return false; auto &frames = it->second; - for (auto f : frames) + for (const auto& f : frames) { // !!do not!! call `_spriteFrames.erase(f);` to erase SpriteFrame // only erase index here _indexFrame2plist.erase(f); //erase plist frame frameName->plist } _indexPlist2Frames.erase(plist); //update index plist->[frameNames] + _isPlistFull.erase(plist); //erase full status return true; } @@ -800,6 +779,7 @@ void SpriteFrameCache::PlistFramesCache::clear() _indexPlist2Frames.clear(); _indexFrame2plist.clear(); _spriteFrames.clear(); + _isPlistFull.clear(); } bool SpriteFrameCache::PlistFramesCache::hasFrame(const std::string &frame) const @@ -807,10 +787,11 @@ bool SpriteFrameCache::PlistFramesCache::hasFrame(const std::string &frame) cons return _indexFrame2plist.find(frame) != _indexFrame2plist.end(); } -bool SpriteFrameCache::PlistFramesCache::hasPlist(const std::string &plist) const +bool SpriteFrameCache::PlistFramesCache::isPlistUsed(const std::string &plist) const { - return _indexPlist2Frames.find(plist) != _indexPlist2Frames.end(); -} + auto frames = _indexPlist2Frames.find(plist); + return frames != _indexPlist2Frames.end() && !frames->second.empty(); +} SpriteFrame * SpriteFrameCache::PlistFramesCache::at(const std::string &frame) { diff --git a/cocos/2d/CCSpriteFrameCache.h b/cocos/2d/CCSpriteFrameCache.h index ca8e48ab1255..260ef95f59fb 100644 --- a/cocos/2d/CCSpriteFrameCache.h +++ b/cocos/2d/CCSpriteFrameCache.h @@ -116,17 +116,22 @@ class CC_DLL SpriteFrameCache : public Ref void clear(); inline bool hasFrame(const std::string &frame) const; - inline bool hasPlist(const std::string &plist) const; + inline bool isPlistUsed(const std::string &plist) const; inline SpriteFrame *at(const std::string &frame); inline Map& getSpriteFrames(); - inline bool isPlistUsed(const std::string &plist) const; - + void markPlistFull(const std::string &plist, bool full) { _isPlistFull[plist] = full; } + bool isPlistFull(const std::string &plist) const + { + auto it = _isPlistFull.find(plist); + return it == _isPlistFull.end() ? false : it->second; + } private: Map _spriteFrames; std::unordered_map> _indexPlist2Frames; std::unordered_map _indexFrame2plist; + std::unordered_map _isPlistFull; }; public: @@ -299,9 +304,6 @@ class CC_DLL SpriteFrameCache : public Ref */ void removeSpriteFramesFromDictionary(ValueMap& dictionary); - /** Parses list of space-separated integers */ - void parseIntegerList(const std::string &string, std::vector &res); - /** Configures PolygonInfo class with the passed sizes + triangles */ void initializePolygonInfo(const Size &textureSize, const Size &spriteSize, diff --git a/cocos/2d/CCTMXLayer.cpp b/cocos/2d/CCTMXLayer.cpp index e1bc3ec2ffeb..552d17dee777 100644 --- a/cocos/2d/CCTMXLayer.cpp +++ b/cocos/2d/CCTMXLayer.cpp @@ -51,7 +51,7 @@ TMXLayer * TMXLayer::create(TMXTilesetInfo *tilesetInfo, TMXLayerInfo *layerInfo return nullptr; } bool TMXLayer::initWithTilesetInfo(TMXTilesetInfo *tilesetInfo, TMXLayerInfo *layerInfo, TMXMapInfo *mapInfo) -{ +{ // FIXME:: is 35% a good estimate ? Size size = layerInfo->_layerSize; float totalNumberOfTiles = size.width * size.height; @@ -74,7 +74,7 @@ bool TMXLayer::initWithTilesetInfo(TMXTilesetInfo *tilesetInfo, TMXLayerInfo *la _tiles = layerInfo->_tiles; _opacity = layerInfo->_opacity; setProperties(layerInfo->getProperties()); - _contentScaleFactor = Director::getInstance()->getContentScaleFactor(); + _contentScaleFactor = Director::getInstance()->getContentScaleFactor(); // tilesetInfo _tileSet = tilesetInfo; @@ -111,7 +111,7 @@ bool TMXLayer::initWithTilesetInfo(TMXTilesetInfo *tilesetInfo, TMXLayerInfo *la _useAutomaticVertexZ = false; _vertexZvalue = 0; - + return true; } return false; @@ -166,7 +166,7 @@ void TMXLayer::releaseMap() // TMXLayer - setup Tiles void TMXLayer::setupTiles() -{ +{ // Optimization: quick hack that sets the image size on the tileset _tileSet->_imageSize = _textureAtlas->getTexture()->getContentSizeInPixels(); @@ -215,12 +215,21 @@ void TMXLayer::setupTiles() /* We support little endian.*/ // FIXME:: gid == 0 --> empty tile - if (gid != 0) + if (gid != 0) { this->appendTileForGID(gid, Vec2(newX, y)); + if(_tileSet->_animationInfo.at(gid)) + { + _animTileCoord[gid].push_back(Vec2(newX, y)); + } } } } + if(hasTileAnimation()) + { + _tileAnimManager = TMXTileAnimManager::create(this); + CC_SAFE_RETAIN(_tileAnimManager); + } } // TMXLayer - Properties @@ -228,7 +237,7 @@ Value TMXLayer::getProperty(const std::string& propertyName) const { if (_properties.find(propertyName) != _properties.end()) return _properties.at(propertyName); - + return Value(); } @@ -251,7 +260,7 @@ void TMXLayer::parseInternalProperties() GLint alphaValueLocation = glGetUniformLocation(getGLProgram()->getProgram(), GLProgram::UNIFORM_NAME_ALPHA_TEST_VALUE); // NOTE: alpha test shader is hard-coded to use the equivalent of a glAlphaFunc(GL_GREATER) comparison - + // use shader program to set uniform getGLProgram()->use(); getGLProgram()->setUniformLocationWith1f(alphaValueLocation, alphaFuncValue); @@ -323,7 +332,7 @@ void TMXLayer::setupTileSprite(Sprite* sprite, const Vec2& pos, uint32_t gid) Sprite* TMXLayer::reusedTileWithRect(const Rect& rect) { - if (! _reusedTile) + if (! _reusedTile) { _reusedTile = Sprite::createWithTexture(_textureAtlas->getTexture(), rect); _reusedTile->setBatchNode(this); @@ -334,10 +343,10 @@ Sprite* TMXLayer::reusedTileWithRect(const Rect& rect) // FIXME: HACK: Needed because if "batch node" is nil, // then the Sprite'squad will be reset _reusedTile->setBatchNode(nullptr); - + // Re-init the sprite _reusedTile->setTextureRect(rect, false, rect.size); - + // restore the batch node _reusedTile->setBatchNode(this); } @@ -355,13 +364,13 @@ Sprite * TMXLayer::getTileAt(const Vec2& pos) int gid = this->getTileGIDAt(pos); // if GID == 0, then no tile is present - if (gid) + if (gid) { int z = (int)(pos.x + pos.y * _layerSize.width); tile = static_cast(this->getChildByTag(z)); // tile not created yet. create it - if (! tile) + if (! tile) { Rect rect = _tileSet->getRectForGID(gid); rect = CC_RECT_PIXELS_TO_POINTS(rect); @@ -377,7 +386,7 @@ Sprite * TMXLayer::getTileAt(const Vec2& pos) this->addSpriteWithoutQuad(tile, static_cast(indexForZ), z); } } - + return tile; } @@ -391,11 +400,11 @@ uint32_t TMXLayer::getTileGIDAt(const Vec2& pos, TMXTileFlags* flags/* = nullptr uint32_t tile = _tiles[idx]; // issue1264, flipped tiles can be changed dynamically - if (flags) + if (flags) { *flags = (TMXTileFlags)(tile & kTMXFlipedAll); } - + return (tile & kTMXFlippedMask); } @@ -406,24 +415,24 @@ Sprite * TMXLayer::insertTileForGID(uint32_t gid, const Vec2& pos) { Rect rect = _tileSet->getRectForGID(gid); rect = CC_RECT_PIXELS_TO_POINTS(rect); - + intptr_t z = (intptr_t)((int) pos.x + (int) pos.y * _layerSize.width); - + Sprite *tile = reusedTileWithRect(rect); - + setupTileSprite(tile, pos, gid); - + // get atlas index ssize_t indexForZ = atlasIndexForNewZ(static_cast(z)); - + // Optimization: add the quad without adding a child this->insertQuadFromSprite(tile, indexForZ); - + // insert it into the local atlasindex array ccCArrayInsertValueAtIndex(_atlasIndexArray, (void*)z, indexForZ); - + // update possible children - + for(const auto &child : _children) { Sprite* sp = static_cast(child); ssize_t ai = sp->getAtlasIndex(); @@ -432,11 +441,11 @@ Sprite * TMXLayer::insertTileForGID(uint32_t gid, const Vec2& pos) sp->setAtlasIndex(ai+1); } } - + _tiles[z] = gid; return tile; } - + return nullptr; } @@ -506,17 +515,17 @@ Sprite * TMXLayer::appendTileForGID(uint32_t gid, const Vec2& pos) intptr_t z = getZForPos(pos); Sprite *tile = reusedTileWithRect(rect); - + setupTileSprite(tile ,pos ,gid); - + // optimization: // The difference between appendTileForGID and insertTileforGID is that append is faster, since // it appends the tile at the end of the texture atlas ssize_t indexForZ = _atlasIndexArray->num; - + // don't add it using the "standard" way. insertQuadFromSprite(tile, indexForZ); - + // append should be after addQuadFromSprite since it modifies the quantity values ccCArrayInsertValueAtIndex(_atlasIndexArray, (void*)z, indexForZ); @@ -526,7 +535,7 @@ Sprite * TMXLayer::appendTileForGID(uint32_t gid, const Vec2& pos) return tile; } - + return nullptr; } @@ -553,15 +562,15 @@ ssize_t TMXLayer::atlasIndexForNewZ(int z) { // FIXME:: This can be improved with a sort of binary search ssize_t i=0; - for (i=0; i< _atlasIndexArray->num ; i++) + for (i=0; i< _atlasIndexArray->num ; i++) { ssize_t val = (size_t) _atlasIndexArray->arr[i]; if (z < val) { break; } - } - + } + return i; } @@ -580,7 +589,7 @@ void TMXLayer::setTileGID(uint32_t gid, const Vec2& pos, TMXTileFlags flags) TMXTileFlags currentFlags; uint32_t currentGID = getTileGIDAt(pos, ¤tFlags); - if (currentGID != gid || currentFlags != flags) + if (currentGID != gid || currentFlags != flags) { uint32_t gidAndFlags = gid | flags; @@ -595,7 +604,7 @@ void TMXLayer::setTileGID(uint32_t gid, const Vec2& pos, TMXTileFlags flags) insertTileForGID(gidAndFlags, pos); } // modifying an existing tile with a non-empty tile - else + else { int z = (int) pos.x + (int) pos.y * _layerSize.width; Sprite *sprite = static_cast(getChildByTag(z)); @@ -605,13 +614,13 @@ void TMXLayer::setTileGID(uint32_t gid, const Vec2& pos, TMXTileFlags flags) rect = CC_RECT_PIXELS_TO_POINTS(rect); sprite->setTextureRect(rect, false, rect.size); - if (flags) + if (flags) { setupTileSprite(sprite, sprite->getPosition(), gidAndFlags); } _tiles[z] = gidAndFlags; - } - else + } + else { updateTileForGID(gidAndFlags, pos); } @@ -649,7 +658,7 @@ void TMXLayer::removeTileAt(const Vec2& pos) int gid = getTileGIDAt(pos); - if (gid) + if (gid) { int z = pos.x + pos.y * _layerSize.width; ssize_t atlasIndex = atlasIndexForExistantZ(z); @@ -666,7 +675,7 @@ void TMXLayer::removeTileAt(const Vec2& pos) { SpriteBatchNode::removeChild(sprite, true); } - else + else { _textureAtlas->removeQuadAtIndex(atlasIndex); @@ -722,7 +731,7 @@ Vec2 TMXLayer::calculateLayerOffset(const Vec2& pos) } break; } - return ret; + return ret; } Vec2 TMXLayer::getPositionAt(const Vec2& pos) @@ -778,7 +787,7 @@ Vec2 TMXLayer::getPositionForHexAt(const Vec2& pos) (_layerSize.height - pos.y - 1) * (_mapTileSize.height-(_mapTileSize.height-_hexSideLength)/2)-offset.y); break; } - + case TMXStaggerAxis_X: { float diffY = 0; @@ -786,7 +795,7 @@ Vec2 TMXLayer::getPositionForHexAt(const Vec2& pos) { diffY = _mapTileSize.height/2 * -odd_even; } - + xy = Vec2(pos.x * (_mapTileSize.width-(_mapTileSize.width-_hexSideLength)/2)+offset.x, (_layerSize.height - pos.y - 1) * _mapTileSize.height + diffY-offset.y); break; @@ -812,7 +821,7 @@ int TMXLayer::getVertexZForPos(const Vec2& pos) int maxVal = 0; if (_useAutomaticVertexZ) { - switch (_layerOrientation) + switch (_layerOrientation) { case TMXOrientationIso: maxVal = static_cast(_layerSize.width + _layerSize.height); @@ -831,12 +840,12 @@ int TMXLayer::getVertexZForPos(const Vec2& pos) CCASSERT(0, "TMX invalid value"); break; } - } + } else { ret = _vertexZvalue; } - + return ret; } @@ -845,5 +854,97 @@ std::string TMXLayer::getDescription() const return StringUtils::format("", _tag, (int)_mapTileSize.width, (int)_mapTileSize.height); } +TMXTileAnimManager::TMXTileAnimManager(TMXLayer *layer) +{ + _layer = layer; + for(const auto &p : *_layer->getAnimTileCoord()) + { + for(auto tilePos : p.second) + { + _tasks.pushBack(TMXTileAnimTask::create(_layer, _layer->getTileSet()->_animationInfo.at(p.first), tilePos)); + } + } +} + +TMXTileAnimManager *TMXTileAnimManager::create(TMXLayer *layer) +{ + TMXTileAnimManager *ret = new (std::nothrow) TMXTileAnimManager(layer); + if (ret) + { + ret->autorelease(); + return ret; + } + CC_SAFE_DELETE(ret); + return nullptr; +} + +void TMXTileAnimManager::startAll() +{ + if(_started || _tasks.empty()) + return; + _started = true; + for(auto &task : _tasks) + { + task->start(); + } +} + +void TMXTileAnimManager::stopAll() +{ + if(!_started) + return; + _started = false; + for(auto &task : _tasks) + { + task->stop(); + } +} + +TMXTileAnimTask::TMXTileAnimTask(TMXLayer *layer, TMXTileAnimInfo *animation, const Vec2 &tilePos) +{ + _layer = layer; + _animation = animation; + _frameCount = static_cast(_animation->_frames.size()); + _tilePosition = tilePos; + std::stringstream ss; + ss << "TickAnimOnTilePos(" << _tilePosition.x << "," << _tilePosition.y << ")"; + _key = ss.str(); +} + +void TMXTileAnimTask::tickAndScheduleNext(float dt) +{ + setCurrFrame(); + _layer->getParent()->scheduleOnce(CC_CALLBACK_1(TMXTileAnimTask::tickAndScheduleNext, this), _animation->_frames[_currentFrame]._duration/1000.0f, _key); +} + +void TMXTileAnimTask::start() +{ + _isRunning = true; + tickAndScheduleNext(0.0f); +} + +void TMXTileAnimTask::stop() +{ + _isRunning = false; + _layer->getParent()->unschedule(_key); +} + +void TMXTileAnimTask::setCurrFrame() +{ + _layer->setTileGID(_animation->_frames[_currentFrame]._tileID, _tilePosition); + _currentFrame = (_currentFrame + 1) % _frameCount; +} + +TMXTileAnimTask *TMXTileAnimTask::create(TMXLayer *layer, TMXTileAnimInfo *animation, const Vec2 &tilePos) +{ + TMXTileAnimTask *ret = new (std::nothrow) TMXTileAnimTask(layer, animation, tilePos); + if (ret) + { + ret->autorelease(); + return ret; + } + CC_SAFE_DELETE(ret); + return nullptr; +} NS_CC_END diff --git a/cocos/2d/CCTMXLayer.h b/cocos/2d/CCTMXLayer.h index 0115291a8a95..fbce2de7d01a 100644 --- a/cocos/2d/CCTMXLayer.h +++ b/cocos/2d/CCTMXLayer.h @@ -36,6 +36,7 @@ NS_CC_BEGIN class TMXMapInfo; class TMXLayerInfo; class TMXTilesetInfo; +class TMXTileAnimManager; struct _ccCArray; /** @@ -294,6 +295,22 @@ class CC_DLL TMXLayer : public SpriteBatchNode */ virtual std::string getDescription() const override; + /** Map from gid of animated tile to its instance. + * + * @return Map from gid of animated tile to its instance. + */ + const std::map>* getAnimTileCoord() { + return &_animTileCoord; + } + + bool hasTileAnimation() const { + return !_animTileCoord.empty(); + } + + TMXTileAnimManager* getTileAnimManager() const { + return _tileAnimManager; + } + protected: Vec2 getPositionForIsoAt(const Vec2& pos); Vec2 getPositionForOrthoAt(const Vec2& pos); @@ -353,6 +370,71 @@ class CC_DLL TMXLayer : public SpriteBatchNode int _hexSideLength; /** properties from the layer. They can be added using Tiled */ ValueMap _properties; + + /** map from gid of animated tile to its instance. Also useful for optimization*/ + std::map> _animTileCoord; + /** pointer to the tile animation manager of this layer */ + TMXTileAnimManager *_tileAnimManager = nullptr; +}; + +/** @brief TMXTileAnimTask represents the frame-tick task of an animated tile. + * It is a assistant class for TMXTileAnimTicker. + */ +class CC_DLL TMXTileAnimTask : public Ref +{ +public: + TMXTileAnimTask(TMXLayer *layer, TMXTileAnimInfo *animation, const Vec2 &tilePos); + static TMXTileAnimTask * create(TMXLayer *layer, TMXTileAnimInfo *animation, const Vec2 &tilePos); + /** start the animation task */ + void start(); + /** stop the animation task */ + void stop(); + bool isRunning() const { + return _isRunning; + } + +protected: + /** set texture of tile to current frame */ + void setCurrFrame(); + /** tick to next frame and schedule next tick */ + void tickAndScheduleNext(float dt); + + bool _isRunning = false; + /** key of schedule task for specific animated tile */ + std::string _key; + TMXLayer *_layer = nullptr; + /** position of the animated tile */ + Vec2 _tilePosition; + /** AnimationInfo on this tile */ + TMXTileAnimInfo *_animation = nullptr; + /** Index of the frame that should be drawn currently */ + uint32_t _currentFrame = 0; + uint32_t _frameCount = 0; +}; + +/** @brief TMXTileAnimManager controls all tile animation of a layer. + */ +class CC_DLL TMXTileAnimManager : public Ref +{ +public: + static TMXTileAnimManager * create(TMXLayer *layer); + explicit TMXTileAnimManager(TMXLayer *layer); + + /** start all tile animations */ + void startAll(); + /** stop all tile animations */ + void stopAll(); + + /** get vector of tasks */ + const Vector& getTasks() const { + return _tasks; + } + +protected: + bool _started = false; + /** vector contains all tasks of this layer */ + Vector _tasks; + TMXLayer* _layer = nullptr; }; // end of tilemap_parallax_nodes group @@ -361,4 +443,3 @@ class CC_DLL TMXLayer : public SpriteBatchNode NS_CC_END #endif //__CCTMX_LAYER_H__ - diff --git a/cocos/2d/CCTMXTiledMap.cpp b/cocos/2d/CCTMXTiledMap.cpp index bfe6a04b5fff..23ae5ab260b4 100644 --- a/cocos/2d/CCTMXTiledMap.cpp +++ b/cocos/2d/CCTMXTiledMap.cpp @@ -61,7 +61,7 @@ TMXTiledMap* TMXTiledMap::createWithXML(const std::string& tmxString, const std: bool TMXTiledMap::initWithTMXFile(const std::string& tmxFile) { - CCASSERT(tmxFile.size()>0, "TMXTiledMap: tmx file should not be empty"); + CCASSERT(!tmxFile.empty(), "TMXTiledMap: tmx file should not be empty"); _tmxFile = tmxFile; @@ -203,14 +203,14 @@ void TMXTiledMap::buildWithMapInfo(TMXMapInfo* mapInfo) // public TMXLayer * TMXTiledMap::getLayer(const std::string& layerName) const { - CCASSERT(layerName.size() > 0, "Invalid layer name!"); + CCASSERT(!layerName.empty(), "Invalid layer name!"); for (auto& child : _children) { TMXLayer* layer = dynamic_cast(child); if(layer) { - if(layerName.compare( layer->getLayerName()) == 0) + if(layerName == layer->getLayerName()) { return layer; } @@ -223,7 +223,7 @@ TMXLayer * TMXTiledMap::getLayer(const std::string& layerName) const TMXObjectGroup * TMXTiledMap::getObjectGroup(const std::string& groupName) const { - CCASSERT(groupName.size() > 0, "Invalid group name!"); + CCASSERT(!groupName.empty(), "Invalid group name!"); for (const auto objectGroup : _objectGroups) { @@ -273,4 +273,22 @@ int TMXTiledMap::getLayerNum() return _tmxLayerNum; } +void TMXTiledMap::setTileAnimEnabled(bool enabled) +{ + for (auto& child : _children) + { + TMXLayer* layer = dynamic_cast(child); + if(layer) + { + if(layer->hasTileAnimation()) + { + if(enabled) + layer->getTileAnimManager()->startAll(); + else + layer->getTileAnimManager()->stopAll(); + } + } + } +} + NS_CC_END diff --git a/cocos/2d/CCTMXTiledMap.h b/cocos/2d/CCTMXTiledMap.h index 8d5aafc784e2..21662c13716b 100644 --- a/cocos/2d/CCTMXTiledMap.h +++ b/cocos/2d/CCTMXTiledMap.h @@ -276,6 +276,11 @@ class CC_DLL TMXTiledMap : public Node int getLayerNum(); const std::string& getResourceFile() const { return _tmxFile; } + /** Set all tile animations enabled or not. + * animations are not enabled by default + */ + void setTileAnimEnabled(bool enabled); + CC_CONSTRUCTOR_ACCESS: /** * @js ctor diff --git a/cocos/2d/CCTMXXMLParser.cpp b/cocos/2d/CCTMXXMLParser.cpp index 0ab60cea728b..1931ace3f4bb 100644 --- a/cocos/2d/CCTMXXMLParser.cpp +++ b/cocos/2d/CCTMXXMLParser.cpp @@ -28,13 +28,14 @@ THE SOFTWARE. ****************************************************************************/ #include "2d/CCTMXXMLParser.h" -#include -#include #include "2d/CCTMXTiledMap.h" +#include "base/CCDirector.h" #include "base/ZipUtils.h" #include "base/base64.h" -#include "base/CCDirector.h" #include "platform/CCFileUtils.h" +#include +#include +#include using namespace std; @@ -63,7 +64,7 @@ ValueMap& TMXLayerInfo::getProperties() return _properties; } -void TMXLayerInfo::setProperties(ValueMap var) +void TMXLayerInfo::setProperties(const ValueMap& var) { _properties = var; } @@ -211,8 +212,9 @@ bool TMXMapInfo::parseXMLFile(const std::string& xmlFilename) } parser.setDelegator(this); - - return parser.parse(FileUtils::getInstance()->fullPathForFilename(xmlFilename)); + auto fullPath = FileUtils::getInstance()->fullPathForFilename(xmlFilename); + CCASSERT(FileUtils::getInstance()->isFileExist(fullPath), "TMXMapInfo::parseXMLFile xml file not exists"); + return parser.parse(fullPath); } // the XML parser calls here with all the elements @@ -292,14 +294,14 @@ void TMXMapInfo::startElement(void* /*ctx*/, const char *name, const char **atts { // If this is an external tileset then start parsing that std::string externalTilesetFilename = attributeDict["source"].asString(); - if (externalTilesetFilename != "") + if (!externalTilesetFilename.empty()) { _externalTilesetFilename = externalTilesetFilename; // Tileset file will be relative to the map file. So we need to convert it to an absolute path - if (_TMXFileName.find_last_of("/") != string::npos) + if (_TMXFileName.find_last_of('/') != string::npos) { - string dir = _TMXFileName.substr(0, _TMXFileName.find_last_of("/") + 1); + string dir = _TMXFileName.substr(0, _TMXFileName.find_last_of('/') + 1); externalTilesetFilename = dir + externalTilesetFilename; } else @@ -314,7 +316,7 @@ void TMXMapInfo::startElement(void* /*ctx*/, const char *name, const char **atts _currentFirstGID = 0; } _recordFirstGID = false; - + _externalTilesetFullPath = externalTilesetFilename; tmxMapInfo->parseXMLFile(externalTilesetFilename); } else @@ -431,14 +433,19 @@ void TMXMapInfo::startElement(void* /*ctx*/, const char *name, const char **atts std::string imagename = attributeDict["source"].asString(); tileset->_originSourceImage = imagename; - if (_TMXFileName.find_last_of("/") != string::npos) + if (!_externalTilesetFullPath.empty()) { - string dir = _TMXFileName.substr(0, _TMXFileName.find_last_of("/") + 1); + string dir = _externalTilesetFullPath.substr(0, _externalTilesetFullPath.find_last_of('/') + 1); + tileset->_sourceImage = dir + imagename; + } + else if (_TMXFileName.find_last_of('/') != string::npos) + { + string dir = _TMXFileName.substr(0, _TMXFileName.find_last_of('/') + 1); tileset->_sourceImage = dir + imagename; } else { - tileset->_sourceImage = _resources + (_resources.size() ? "/" : "") + imagename; + tileset->_sourceImage = _resources + (!_resources.empty() ? "/" : "") + imagename; } } else if (elementName == "data") @@ -446,7 +453,7 @@ void TMXMapInfo::startElement(void* /*ctx*/, const char *name, const char **atts std::string encoding = attributeDict["encoding"].asString(); std::string compression = attributeDict["compression"].asString(); - if (encoding == "") + if (encoding.empty()) { tmxMapInfo->setLayerAttribs(tmxMapInfo->getLayerAttribs() | TMXLayerAttribNone); @@ -476,7 +483,7 @@ void TMXMapInfo::startElement(void* /*ctx*/, const char *name, const char **atts layerAttribs = tmxMapInfo->getLayerAttribs(); tmxMapInfo->setLayerAttribs(layerAttribs | TMXLayerAttribZlib); } - CCASSERT( compression == "" || compression == "gzip" || compression == "zlib", "TMX: unsupported compression method" ); + CCASSERT( compression.empty() || compression == "gzip" || compression == "zlib", "TMX: unsupported compression method" ); } else if (encoding == "csv") { @@ -665,6 +672,19 @@ void TMXMapInfo::startElement(void* /*ctx*/, const char *name, const char **atts dict["polylinePoints"] = Value(pointsArray); } } + else if(elementName == "animation") + { + TMXTilesetInfo* info = tmxMapInfo->getTilesets().back(); + info->_animationInfo.insert(tmxMapInfo->getParentGID(), TMXTileAnimInfo::create(tmxMapInfo->getParentGID())); + tmxMapInfo->setParentElement(TMXPropertyAnimation); + } + else if(elementName == "frame") + { + TMXTilesetInfo* info = tmxMapInfo->getTilesets().back(); + auto animInfo = info->_animationInfo.at(tmxMapInfo->getParentGID()); + // calculate gid of frame + animInfo->_frames.emplace_back(TMXTileAnimFrame(info->_firstGid + attributeDict["tileid"].asInt(), attributeDict["duration"].asFloat())); + } } void TMXMapInfo::endElement(void* /*ctx*/, const char *name) @@ -746,7 +766,7 @@ void TMXMapInfo::endElement(void* /*ctx*/, const char *name) } uint32_t* bufferPtr = reinterpret_cast(buffer); - for(auto gidToken : gidTokens) { + for(const auto& gidToken : gidTokens) { auto tileGid = (uint32_t)strtoul(gidToken.c_str(), nullptr, 10); *bufferPtr = tileGid; bufferPtr++; @@ -785,6 +805,10 @@ void TMXMapInfo::endElement(void* /*ctx*/, const char *name) { _recordFirstGID = true; } + else if (elementName == "animation") + { + tmxMapInfo->setParentElement(TMXPropertyNone); + } } void TMXMapInfo::textHandler(void* /*ctx*/, const char *ch, size_t len) @@ -800,4 +824,27 @@ void TMXMapInfo::textHandler(void* /*ctx*/, const char *ch, size_t len) } } +TMXTileAnimFrame::TMXTileAnimFrame(uint32_t tileID, float duration) +: _tileID(tileID) +, _duration(duration) +{ +} + +TMXTileAnimInfo::TMXTileAnimInfo(uint32_t tileID) +: _tileID(tileID) +{ +} + +TMXTileAnimInfo *TMXTileAnimInfo::create(uint32_t tileID) +{ + TMXTileAnimInfo *ret = new (std::nothrow) TMXTileAnimInfo(tileID); + if (ret) + { + ret->autorelease(); + return ret; + } + CC_SAFE_DELETE(ret); + return nullptr; +} + NS_CC_END diff --git a/cocos/2d/CCTMXXMLParser.h b/cocos/2d/CCTMXXMLParser.h index 4f9824dac0c9..454896f4455e 100644 --- a/cocos/2d/CCTMXXMLParser.h +++ b/cocos/2d/CCTMXXMLParser.h @@ -36,6 +36,7 @@ THE SOFTWARE. #include "platform/CCSAXParser.h" #include "base/CCVector.h" #include "base/CCValue.h" +#include "base/CCMap.h" #include "2d/CCTMXObjectGroup.h" // needed for Vector for binding #include @@ -72,7 +73,8 @@ enum { TMXPropertyLayer, TMXPropertyObjectGroup, TMXPropertyObject, - TMXPropertyTile + TMXPropertyTile, + TMXPropertyAnimation }; typedef enum TMXTileFlags_ { @@ -106,7 +108,7 @@ class CC_DLL TMXLayerInfo : public Ref */ virtual ~TMXLayerInfo(); - void setProperties(ValueMap properties); + void setProperties(const ValueMap& properties); ValueMap& getProperties(); ValueMap _properties; @@ -119,6 +121,35 @@ class CC_DLL TMXLayerInfo : public Ref Vec2 _offset; }; +/** @brief TMXTileAnimFrame contains the information about the frame of a animated tile like: +- Frame gid +- duration of this frame + +This information is obtained from the TMX file. +*/ +struct CC_DLL TMXTileAnimFrame +{ + TMXTileAnimFrame(uint32_t tileID, float duration); + /** gid of the frame */ + uint32_t _tileID = 0; + /** duration of the frame */ + float _duration = 0.0f; +}; + +/** @brief TMXTileAnimInfo contains the information about the animated tile like: +- Animated Tile gid +- frames the animated tile contains + +This information is obtained from the TMX file. +*/ +struct CC_DLL TMXTileAnimInfo : public Ref +{ + static TMXTileAnimInfo * create(uint32_t tileID); + explicit TMXTileAnimInfo(uint32_t tileID); + uint32_t _tileID = 0; + std::vector _frames; +}; + /** @brief TMXTilesetInfo contains the information about the tilesets like: - Tileset name - Tileset spacing @@ -144,6 +175,9 @@ class CC_DLL TMXTilesetInfo : public Ref Size _imageSize; std::string _originSourceImage; + //! map from gid of animated tile to its animation info + Map _animationInfo; + public: /** * @js ctor @@ -343,6 +377,7 @@ class CC_DLL TMXMapInfo : public Ref, public SAXDelegator int _currentFirstGID; bool _recordFirstGID; std::string _externalTilesetFilename; + std::string _externalTilesetFullPath; }; // end of tilemap_parallax_nodes group diff --git a/cocos/2d/CCTextFieldTTF.cpp b/cocos/2d/CCTextFieldTTF.cpp index ed870d00fd5f..5279a5a5aec0 100644 --- a/cocos/2d/CCTextFieldTTF.cpp +++ b/cocos/2d/CCTextFieldTTF.cpp @@ -114,7 +114,7 @@ TextFieldTTF * TextFieldTTF::textFieldWithPlaceHolder(const std::string& placeho if(ret && ret->initWithPlaceHolder("", dimensions, alignment, fontName, fontSize)) { ret->autorelease(); - if (placeholder.size()>0) + if (!placeholder.empty()) { ret->setPlaceHolder(placeholder); } @@ -130,7 +130,7 @@ TextFieldTTF * TextFieldTTF::textFieldWithPlaceHolder(const std::string& placeho if(ret && ret->initWithPlaceHolder("", fontName, fontSize)) { ret->autorelease(); - if (placeholder.size()>0) + if (!placeholder.empty()) { ret->setPlaceHolder(placeholder); } @@ -387,7 +387,7 @@ void TextFieldTTF::setCursorFromPoint(const Vec2 &point, const Camera* camera) auto sprite = getLetter(latterPosition); if (sprite) { - rect.size = sprite->getContentSize(); + rect.size = Size(sprite->getContentSize().width, _lineHeight); if (isScreenPointInRect(point, camera, sprite->getWorldToNodeTransform(), rect, nullptr)) { setCursorPosition(latterPosition); diff --git a/cocos/2d/CCTransition.h b/cocos/2d/CCTransition.h index 9b7f5c233bf9..509771be61da 100644 --- a/cocos/2d/CCTransition.h +++ b/cocos/2d/CCTransition.h @@ -97,11 +97,11 @@ class CC_DLL TransitionScene : public Scene /** Called after the transition finishes. */ - void finish(void); + void finish(); /** Used by some transitions to hide the outer scene. */ - void hideOutShowIn(void); + void hideOutShowIn(); Scene* getInScene() const{ return _inScene; } float getDuration() const { return _duration; } @@ -240,7 +240,7 @@ class CC_DLL TransitionMoveInL : public TransitionScene, public TransitionEaseSc * * @return The action that will be performed. */ - virtual ActionInterval* action(void); + virtual ActionInterval* action(); virtual ActionInterval* easeActionWithAction(ActionInterval * action) override; @@ -360,7 +360,7 @@ class CC_DLL TransitionSlideInL : public TransitionScene, public TransitionEaseS * * @return The action that will be performed by the incoming and outgoing scene. */ - virtual ActionInterval* action(void); + virtual ActionInterval* action(); // // Overrides @@ -373,7 +373,7 @@ class CC_DLL TransitionSlideInL : public TransitionScene, public TransitionEaseS protected: /** initializes the scenes */ - virtual void initScenes(void); + virtual void initScenes(); virtual void sceneOrder() override; @@ -397,7 +397,7 @@ class CC_DLL TransitionSlideInR : public TransitionSlideInL static TransitionSlideInR* create(float t, Scene* scene); /** Returns the action that will be performed by the incoming and outgoing scene. */ - virtual ActionInterval* action(void) override; + virtual ActionInterval* action() override; CC_CONSTRUCTOR_ACCESS: TransitionSlideInR(); @@ -405,7 +405,7 @@ class CC_DLL TransitionSlideInR : public TransitionSlideInL protected: /** initializes the scenes */ - virtual void initScenes(void) override; + virtual void initScenes() override; virtual void sceneOrder() override; @@ -429,7 +429,7 @@ class CC_DLL TransitionSlideInB : public TransitionSlideInL static TransitionSlideInB* create(float t, Scene* scene); /** returns the action that will be performed by the incoming and outgoing scene */ - virtual ActionInterval* action(void) override; + virtual ActionInterval* action() override; CC_CONSTRUCTOR_ACCESS: TransitionSlideInB(); @@ -461,7 +461,7 @@ class CC_DLL TransitionSlideInT : public TransitionSlideInL static TransitionSlideInT* create(float t, Scene* scene); /** returns the action that will be performed by the incoming and outgoing scene */ - virtual ActionInterval* action(void) override; + virtual ActionInterval* action() override; CC_CONSTRUCTOR_ACCESS: TransitionSlideInT(); @@ -469,7 +469,7 @@ class CC_DLL TransitionSlideInT : public TransitionSlideInL protected: /** initializes the scenes */ - virtual void initScenes(void) override; + virtual void initScenes() override; virtual void sceneOrder() override; @@ -942,7 +942,7 @@ class CC_DLL TransitionSplitRows : public TransitionSplitCols // // Overrides // - virtual ActionInterval* action(void) override; + virtual ActionInterval* action() override; CC_CONSTRUCTOR_ACCESS: TransitionSplitRows(); diff --git a/cocos/2d/CCTweenFunction.cpp b/cocos/2d/CCTweenFunction.cpp index dd65234b341b..f445b380f426 100644 --- a/cocos/2d/CCTweenFunction.cpp +++ b/cocos/2d/CCTweenFunction.cpp @@ -24,6 +24,7 @@ THE SOFTWARE. ****************************************************************************/ #include "2d/CCTweenFunction.h" +#include #define _USE_MATH_DEFINES // needed for M_PI and M_PI2 #include // M_PI @@ -316,20 +317,20 @@ float expoEaseInOut(float time) // Circ Ease float circEaseIn(float time) { - return -1 * (sqrt(1 - time * time) - 1); + return -1 * (std::sqrt(1 - time * time) - 1); } float circEaseOut(float time) { time = time - 1; - return sqrt(1 - time * time); + return std::sqrt(1 - time * time); } float circEaseInOut(float time) { time = time * 2; if (time < 1) - return -0.5f * (sqrt(1 - time * time) - 1); + return -0.5f * (std::sqrt(1 - time * time) - 1); time -= 2; - return 0.5f * (sqrt(1 - time * time) + 1); + return 0.5f * (std::sqrt(1 - time * time) + 1); } diff --git a/cocos/2d/libcocos2d.vcxproj b/cocos/2d/libcocos2d.vcxproj index b92c7cada5ef..de4daaa5f1fa 100644 --- a/cocos/2d/libcocos2d.vcxproj +++ b/cocos/2d/libcocos2d.vcxproj @@ -15,6 +15,7 @@ {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E} cocos2d-x.win32 Win32Proj + 10.0.17134.0 @@ -112,7 +113,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\OpenalSoft\prebuilt\*.*" xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\MP3Decoder\prebuilt\*.*" "$(OutDir)" xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\OggDecoder\prebuilt\*.*" "$(OutDir)" xcopy /Y /Q "$(ProjectDir)..\..\external\sqlite3\libraries\win32\*.*" "$(OutDir)" -xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*" "$(OutDir)" +xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\debug-lib\*.*" "$(OutDir)" xcopy /Y /Q "$(ProjectDir)..\..\external\bullet\prebuilt\win32\debug\*.*" "$(OutDir)" xcopy /Y /Q "$(ProjectDir)..\..\external\Box2D\prebuilt\win32\debug\*.*" "$(OutDir)" xcopy /Y /Q "$(ProjectDir)..\..\external\openssl\prebuilt\win32\*.*" "$(OutDir)" @@ -646,6 +647,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\uv\prebuilt\win32\*.*" "$(OutDir)" + @@ -1286,6 +1288,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\uv\prebuilt\win32\*.*" "$(OutDir)" + diff --git a/cocos/2d/libcocos2d.vcxproj.filters b/cocos/2d/libcocos2d.vcxproj.filters index 3441f613000a..adcbd4a8658b 100644 --- a/cocos/2d/libcocos2d.vcxproj.filters +++ b/cocos/2d/libcocos2d.vcxproj.filters @@ -670,6 +670,9 @@ renderer + + renderer + renderer @@ -2415,6 +2418,9 @@ renderer + + renderer + renderer diff --git a/cocos/2d/libcocos2d_win10/libcocos2d.vcxproj b/cocos/2d/libcocos2d_win10/libcocos2d.vcxproj index 07188708b904..1aee25122917 100644 --- a/cocos/2d/libcocos2d_win10/libcocos2d.vcxproj +++ b/cocos/2d/libcocos2d_win10/libcocos2d.vcxproj @@ -643,6 +643,7 @@ + @@ -1329,6 +1330,7 @@ + @@ -1505,9 +1507,6 @@ - - {0c32d479-46d5-46c3-9aa9-0a8ff8320516} - {f551524d-8a70-4b2f-a7c2-28ae61150022} diff --git a/cocos/2d/libcocos2d_win10/libcocos2d.vcxproj.filters b/cocos/2d/libcocos2d_win10/libcocos2d.vcxproj.filters index 9b2610df4d8c..cd4f8e646761 100644 --- a/cocos/2d/libcocos2d_win10/libcocos2d.vcxproj.filters +++ b/cocos/2d/libcocos2d_win10/libcocos2d.vcxproj.filters @@ -1581,6 +1581,9 @@ renderer + + renderer + renderer @@ -3479,6 +3482,9 @@ renderer + + renderer + renderer diff --git a/cocos/3d/CCAABB.cpp b/cocos/3d/CCAABB.cpp index 856a8d117cec..389c09a93c97 100755 --- a/cocos/3d/CCAABB.cpp +++ b/cocos/3d/CCAABB.cpp @@ -37,11 +37,6 @@ AABB::AABB(const Vec3& min, const Vec3& max) set(min, max); } -AABB::AABB(const AABB& box) -{ - set(box._min,box._max); -} - Vec3 AABB::getCenter() { Vec3 center; diff --git a/cocos/3d/CCAABB.h b/cocos/3d/CCAABB.h index 3cb40148fd9e..295a4c077bf9 100644 --- a/cocos/3d/CCAABB.h +++ b/cocos/3d/CCAABB.h @@ -55,11 +55,6 @@ class CC_DLL AABB */ AABB(const Vec3& min, const Vec3& max); - /** - * Constructor. - */ - AABB(const AABB& box); - /** * Gets the center point of the bounding box. */ diff --git a/cocos/3d/CCAnimate3D.cpp b/cocos/3d/CCAnimate3D.cpp index 6074c8b49c54..dd72df1463c6 100644 --- a/cocos/3d/CCAnimate3D.cpp +++ b/cocos/3d/CCAnimate3D.cpp @@ -392,7 +392,7 @@ void Animate3D::update(float t) float prekeyTime = lastTime * getDuration() * _frameRate; float keyTime = t * getDuration() * _frameRate; std::vector eventInfos; - for (auto keyFrame : _keyFrameUserInfos) + for (const auto& keyFrame : _keyFrameUserInfos) { if ((!_playReverse && keyFrame.first >= prekeyTime && keyFrame.first < keyTime) || (_playReverse && keyFrame.first >= keyTime && keyFrame.first < prekeyTime)) diff --git a/cocos/3d/CCAnimation3D.cpp b/cocos/3d/CCAnimation3D.cpp index 4ee4eefa18d4..b4e870d7803c 100644 --- a/cocos/3d/CCAnimation3D.cpp +++ b/cocos/3d/CCAnimation3D.cpp @@ -87,8 +87,9 @@ Animation3D::Animation3D() Animation3D::~Animation3D() { - for (auto itor : _boneCurves) { - CC_SAFE_DELETE(itor.second); + for (const auto& itor : _boneCurves) { + Curve* curve = itor.second; + CC_SAFE_DELETE(curve); } } @@ -119,7 +120,7 @@ bool Animation3D::init(const Animation3DData &data) _boneCurves[iter.first] = curve; } - if(iter.second.size() == 0) continue; + if(iter.second.empty()) continue; std::vector keys; std::vector values; for(const auto& keyIter : iter.second) @@ -143,7 +144,7 @@ bool Animation3D::init(const Animation3DData &data) _boneCurves[iter.first] = curve; } - if(iter.second.size() == 0) continue; + if(iter.second.empty()) continue; std::vector keys; std::vector values; for(const auto& keyIter : iter.second) @@ -168,7 +169,7 @@ bool Animation3D::init(const Animation3DData &data) _boneCurves[iter.first] = curve; } - if(iter.second.size() == 0) continue; + if(iter.second.empty()) continue; std::vector keys; std::vector values; for(const auto& keyIter : iter.second) diff --git a/cocos/3d/CCBundle3D.cpp b/cocos/3d/CCBundle3D.cpp index 4686e7fe6d54..b6f0b2c5654a 100644 --- a/cocos/3d/CCBundle3D.cpp +++ b/cocos/3d/CCBundle3D.cpp @@ -225,7 +225,7 @@ bool Bundle3D::loadObj(MeshDatas& meshdatas, MaterialDatas& materialdatas, NodeD int i = 0; char str[20]; std::string dir = ""; - auto last = fullPath.rfind("/"); + auto last = fullPath.rfind('/'); if (last != std::string::npos) dir = fullPath.substr(0, last + 1); for (auto& material : materials) { @@ -253,7 +253,7 @@ bool Bundle3D::loadObj(MeshDatas& meshdatas, MaterialDatas& materialdatas, NodeD attrib.size = 3; attrib.type = GL_FLOAT; - if (mesh.positions.size()) + if (!mesh.positions.empty()) { attrib.vertexAttrib = GLProgram::VERTEX_ATTRIB_POSITION; attrib.attribSizeBytes = attrib.size * sizeof(float); @@ -261,14 +261,14 @@ bool Bundle3D::loadObj(MeshDatas& meshdatas, MaterialDatas& materialdatas, NodeD } bool hasnormal = false, hastex = false; - if (mesh.normals.size()) + if (!mesh.normals.empty()) { hasnormal = true; attrib.vertexAttrib = GLProgram::VERTEX_ATTRIB_NORMAL; attrib.attribSizeBytes = attrib.size * sizeof(float); meshdata->attribs.push_back(attrib); } - if (mesh.texcoords.size()) + if (!mesh.texcoords.empty()) { hastex = true; attrib.size = 2; @@ -314,7 +314,7 @@ bool Bundle3D::loadObj(MeshDatas& meshdatas, MaterialDatas& materialdatas, NodeD meshdata->subMeshIndices.push_back(submesh.second); meshdata->subMeshAABB.push_back(calculateAABB(meshdata->vertex, meshdata->getPerVertexSize(), submesh.second)); sprintf(str, "%d", ++i); - meshdata->subMeshIds.push_back(str); + meshdata->subMeshIds.emplace_back(str); auto modelnode = new (std::nothrow) ModelData(); modelnode->materialId = submesh.first == -1 ? "" : materials[submesh.first].name; @@ -474,7 +474,7 @@ bool Bundle3D::loadMeshDatasBinary(MeshDatas& meshdatas) CCLOG("warning: Failed to read meshdata: aabb '%s'.", _path.c_str()); goto FAILED; } - meshData->subMeshAABB.push_back(AABB(Vec3(aabb[0], aabb[1], aabb[2]), Vec3(aabb[3], aabb[4], aabb[5]))); + meshData->subMeshAABB.emplace_back(Vec3(aabb[0], aabb[1], aabb[2]), Vec3(aabb[3], aabb[4], aabb[5])); } else { @@ -774,7 +774,7 @@ bool Bundle3D::loadMeshDatasJson(MeshDatas& meshdatas) { std::vector indexArray; const rapidjson::Value& mesh_part = mesh_part_array[i]; - meshData->subMeshIds.push_back(mesh_part[ID].GetString()); + meshData->subMeshIds.emplace_back(mesh_part[ID].GetString()); // index_number const rapidjson::Value& indices_val_array = mesh_part[INDICES]; for (rapidjson::SizeType j = 0, indices_val_array_size = indices_val_array.Size(); j < indices_val_array_size; ++j) @@ -792,7 +792,7 @@ bool Bundle3D::loadMeshDatasJson(MeshDatas& meshdatas) mesh_part_aabb[(rapidjson::SizeType)1].GetDouble(), mesh_part_aabb[(rapidjson::SizeType)2].GetDouble()); Vec3 max(mesh_part_aabb[(rapidjson::SizeType)3].GetDouble(), mesh_part_aabb[(rapidjson::SizeType)4].GetDouble(), mesh_part_aabb[(rapidjson::SizeType)5].GetDouble()); - meshData->subMeshAABB.push_back(AABB(min, max)); + meshData->subMeshAABB.emplace_back(min, max); } else { @@ -1321,7 +1321,7 @@ bool Bundle3D::loadSkinDataBinary(SkinData* skindata) CCLOG("warning: Failed to load SkinData: bindpos '%s'.", _path.c_str()); return false; } - skindata->inverseBindPoseMatrices.push_back(bindpos); + skindata->inverseBindPoseMatrices.emplace_back(bindpos); } skindata->skinBoneOriginMatrices.resize(boneNum); @@ -1335,7 +1335,7 @@ bool Bundle3D::loadSkinDataBinary(SkinData* skindata) { skindata->addNodeBoneNames(boneName); rootIndex = skindata->getBoneNameIndex(boneName); - skindata->nodeBoneOriginMatrices.push_back(bindShape); + skindata->nodeBoneOriginMatrices.emplace_back(bindShape); } else { @@ -1367,7 +1367,7 @@ bool Bundle3D::loadSkinDataBinary(SkinData* skindata) { skindata->addNodeBoneNames(id); index = skindata->getBoneNameIndex(id); - skindata->nodeBoneOriginMatrices.push_back(transform); + skindata->nodeBoneOriginMatrices.emplace_back(transform); } else { @@ -1544,7 +1544,7 @@ bool Bundle3D::loadAnimationDataBinary(const std::string& id, Animation3DData* a { // if id is not a null string, we need to add a suffix of "animation" for seeding. std::string id_ = id; - if(id != "") id_ = id + "animation"; + if(!id.empty()) id_ = id + "animation"; if (!seekToFirstType(BUNDLE_TYPE_ANIMATIONS, id_)) return false; @@ -1730,7 +1730,7 @@ NodeData* Bundle3D::parseNodesRecursivelyJson(const rapidjson::Value& jvalue, bo modelnodedata->subMeshId = part[MESHPARTID].GetString(); modelnodedata->materialId = part[MATERIALID].GetString(); - if (modelnodedata->subMeshId == "" || modelnodedata->materialId == "") + if (modelnodedata->subMeshId.empty() || modelnodedata->materialId.empty()) { CCLOG("warning: Node %s part is missing meshPartId or materialId", nodedata->id.c_str()); CC_SAFE_DELETE(modelnodedata); @@ -1755,7 +1755,7 @@ NodeData* Bundle3D::parseNodesRecursivelyJson(const rapidjson::Value& jvalue, bo return nullptr; } - modelnodedata->bones.push_back(bone[NODE].GetString()); + modelnodedata->bones.emplace_back(bone[NODE].GetString()); Mat4 invbindpos; const rapidjson::Value& jinvbindpos = bone[TRANSFORM]; @@ -1874,7 +1874,7 @@ NodeData* Bundle3D::parseNodesRecursivelyBinary(bool& skeleton, bool singleSprit modelnodedata->subMeshId = _binaryReader.readString(); modelnodedata->materialId = _binaryReader.readString(); - if (modelnodedata->subMeshId == "" || modelnodedata->materialId == "") + if (modelnodedata->subMeshId.empty() || modelnodedata->materialId.empty()) { std::string err = "Node " + nodedata->id + " part is missing meshPartId or materialId"; CCLOG("Node %s part is missing meshPartId or materialId", nodedata->id.c_str()); @@ -2158,7 +2158,7 @@ Reference* Bundle3D::seekToFirstType(unsigned int type, const std::string& id) if (ref->type == type) { // if id is not a null string, we also need to check the Reference's id. - if (id != "" && id != ref->id) + if (!id.empty() && id != ref->id) { continue; } @@ -2210,9 +2210,9 @@ std::vector Bundle3D::getTrianglesList(const std::string& path) Bundle3D::destroyBundle(bundle); for (auto iter : meshs.meshDatas){ int preVertexSize = iter->getPerVertexSize() / sizeof(float); - for (auto indexArray : iter->subMeshIndices){ + for (const auto& indexArray : iter->subMeshIndices){ for (auto i : indexArray){ - trianglesList.push_back(Vec3(iter->vertex[i * preVertexSize], iter->vertex[i * preVertexSize + 1], iter->vertex[i * preVertexSize + 2])); + trianglesList.emplace_back(iter->vertex[i * preVertexSize], iter->vertex[i * preVertexSize + 1], iter->vertex[i * preVertexSize + 2]); } } } diff --git a/cocos/3d/CCBundle3DData.h b/cocos/3d/CCBundle3DData.h index 6158fd219f96..3a46777044fa 100644 --- a/cocos/3d/CCBundle3DData.h +++ b/cocos/3d/CCBundle3DData.h @@ -64,10 +64,8 @@ struct ModelData std::vector bones; std::vector invBindPose; - virtual ~ModelData() - { - resetData(); - } + virtual ~ModelData() {} + virtual void resetData() { bones.clear(); @@ -188,10 +186,6 @@ struct MeshData , attribCount(0) { } - ~MeshData() - { - resetData(); - } }; /** mesh datas @@ -326,7 +320,7 @@ struct NTextureData Usage type; GLenum wrapS; GLenum wrapT; -} ; +}; struct NMaterialData { std::vector textures; @@ -440,14 +434,9 @@ struct Animation3DData */ struct Reference { -public: std::string id; unsigned int type; unsigned int offset; - - Reference(){} - - ~Reference(){} }; NS_CC_END diff --git a/cocos/3d/CCBundleReader.cpp b/cocos/3d/CCBundleReader.cpp index 3ac6ff1c5fc3..c6b5af907fdd 100644 --- a/cocos/3d/CCBundleReader.cpp +++ b/cocos/3d/CCBundleReader.cpp @@ -33,12 +33,12 @@ BundleReader::BundleReader() _buffer = nullptr; _position = 0; _length = 0; -}; +} BundleReader::~BundleReader() { -}; +} void BundleReader::init(char* buffer, ssize_t length) { diff --git a/cocos/3d/CCMesh.cpp b/cocos/3d/CCMesh.cpp index b6d36ab3e662..726f883f7c54 100644 --- a/cocos/3d/CCMesh.cpp +++ b/cocos/3d/CCMesh.cpp @@ -182,19 +182,19 @@ Mesh* Mesh::create(const std::vector& positions, const std::vector att.type = GL_FLOAT; att.attribSizeBytes = att.size * sizeof(float); - if (positions.size()) + if (!positions.empty()) { perVertexSizeInFloat += 3; att.vertexAttrib = GLProgram::VERTEX_ATTRIB_POSITION; attribs.push_back(att); } - if (normals.size()) + if (!normals.empty()) { perVertexSizeInFloat += 3; att.vertexAttrib = GLProgram::VERTEX_ATTRIB_NORMAL; attribs.push_back(att); } - if (texs.size()) + if (!texs.empty()) { perVertexSizeInFloat += 2; att.vertexAttrib = GLProgram::VERTEX_ATTRIB_TEX_COORD; @@ -203,8 +203,8 @@ Mesh* Mesh::create(const std::vector& positions, const std::vector attribs.push_back(att); } - bool hasNormal = (normals.size() != 0); - bool hasTexCoord = (texs.size() != 0); + bool hasNormal = (!normals.empty()); + bool hasTexCoord = (!texs.empty()); //position, normal, texCoordinate into _vertexs size_t vertexNum = positions.size() / 3; for(size_t i = 0; i < vertexNum; i++) @@ -235,7 +235,7 @@ Mesh* Mesh::create(const std::vector& vertices, int /*perVertexSizeInFloa meshdata.attribs = attribs; meshdata.vertex = vertices; meshdata.subMeshIndices.push_back(indices); - meshdata.subMeshIds.push_back(""); + meshdata.subMeshIds.emplace_back(""); auto meshvertexdata = MeshVertexData::create(meshdata); auto indexData = meshvertexdata->getMeshIndexDataByIndex(0); @@ -416,7 +416,7 @@ void Mesh::draw(Renderer* renderer, float globalZOrder, const Mat4& transform, u if (_skin) programState->setUniformVec4v("u_matrixPalette", (GLsizei)_skin->getMatrixPaletteSize(), _skin->getMatrixPalette()); - if (scene && scene->getLights().size() > 0) + if (scene && !scene->getLights().empty()) setLightUniforms(pass, scene, color, lightMask); } @@ -472,7 +472,7 @@ void Mesh::calculateAABB() //get skin root Bone3D* root = nullptr; Mat4 invBindPose; - if (_skin->_skinBones.size()) + if (!_skin->_skinBones.empty()) { root = _skin->_skinBones.at(0); while (root) { diff --git a/cocos/3d/CCMeshSkin.cpp b/cocos/3d/CCMeshSkin.cpp index 09476bea21e4..e62fad6c56b7 100644 --- a/cocos/3d/CCMeshSkin.cpp +++ b/cocos/3d/CCMeshSkin.cpp @@ -138,7 +138,7 @@ void MeshSkin::addSkinBone(Bone3D* bone) Bone3D* MeshSkin::getRootBone() const { Bone3D* root = nullptr; - if (_skinBones.size()) + if (!_skinBones.empty()) { root = _skinBones.at(0); while (root->getParentBone()) { diff --git a/cocos/3d/CCMeshVertexIndexData.cpp b/cocos/3d/CCMeshVertexIndexData.cpp index 9c683184e924..61e07471af82 100644 --- a/cocos/3d/CCMeshVertexIndexData.cpp +++ b/cocos/3d/CCMeshVertexIndexData.cpp @@ -40,6 +40,7 @@ #include "base/CCEventDispatcher.h" #include "base/CCEventType.h" #include "base/CCDirector.h" +#include "renderer/ccGLStateCache.h" using namespace std; diff --git a/cocos/3d/CCMotionStreak3D.cpp b/cocos/3d/CCMotionStreak3D.cpp index 1fabab46a0bc..4cf92bff0b00 100644 --- a/cocos/3d/CCMotionStreak3D.cpp +++ b/cocos/3d/CCMotionStreak3D.cpp @@ -28,8 +28,8 @@ THE SOFTWARE. #include "3d/CCMotionStreak3D.h" #include "math/CCVertex.h" #include "base/CCDirector.h" -#include "base/ccUtils.h" #include "renderer/CCTextureCache.h" +#include "renderer/ccGLStateCache.h" #include "renderer/CCTexture2D.h" #include "renderer/CCRenderer.h" #include "renderer/CCGLProgramState.h" @@ -223,7 +223,7 @@ void MotionStreak3D::tintWithColor(const Color3B& colors) } } -Texture2D* MotionStreak3D::getTexture(void) const +Texture2D* MotionStreak3D::getTexture() const { return _texture; } @@ -243,7 +243,7 @@ void MotionStreak3D::setBlendFunc(const BlendFunc &blendFunc) _blendFunc = blendFunc; } -const BlendFunc& MotionStreak3D::getBlendFunc(void) const +const BlendFunc& MotionStreak3D::getBlendFunc() const { return _blendFunc; } @@ -253,7 +253,7 @@ void MotionStreak3D::setOpacity(GLubyte /*opacity*/) CCASSERT(false, "Set opacity no supported"); } -GLubyte MotionStreak3D::getOpacity(void) const +GLubyte MotionStreak3D::getOpacity() const { CCASSERT(false, "Opacity no supported"); return 0; @@ -263,7 +263,7 @@ void MotionStreak3D::setOpacityModifyRGB(bool /*bValue*/) { } -bool MotionStreak3D::isOpacityModifyRGB(void) const +bool MotionStreak3D::isOpacityModifyRGB() const { return false; } @@ -387,13 +387,10 @@ void MotionStreak3D::onDraw(const Mat4 &transform, uint32_t /*flags*/) getGLProgram()->use(); getGLProgram()->setUniformsForBuiltins(transform); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_TEX_COORD); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_COLOR); - utils::setBlending(_blendFunc.src, _blendFunc.dst); + GL::enableVertexAttribs(GL::VERTEX_ATTRIB_FLAG_POS_COLOR_TEX ); + GL::blendFunc( _blendFunc.src, _blendFunc.dst ); - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, _texture->getName()); + GL::bindTexture2D( _texture->getName() ); glDisable(GL_CULL_FACE); RenderState::StateBlock::_defaultState->setCullFace(false); diff --git a/cocos/3d/CCMotionStreak3D.h b/cocos/3d/CCMotionStreak3D.h index 091e6307637f..5028f78cd4fc 100644 --- a/cocos/3d/CCMotionStreak3D.h +++ b/cocos/3d/CCMotionStreak3D.h @@ -111,8 +111,8 @@ class CC_DLL MotionStreak3D : public Node, public TextureProtocol virtual void getPosition(float* x, float* y) const override; virtual void setPositionX(float x) override; virtual void setPositionY(float y) override; - virtual float getPositionX(void) const override; - virtual float getPositionY(void) const override; + virtual float getPositionX() const override; + virtual float getPositionY() const override; virtual Vec3 getPosition3D() const override; /** * @js NA diff --git a/cocos/3d/CCOBB.cpp b/cocos/3d/CCOBB.cpp index a5cd8ac09409..1306b63f2e05 100755 --- a/cocos/3d/CCOBB.cpp +++ b/cocos/3d/CCOBB.cpp @@ -24,6 +24,7 @@ ****************************************************************************/ #include "3d/CCOBB.h" +#include NS_CC_BEGIN @@ -109,7 +110,7 @@ static void _getEigenVectors(Mat4* vout, Vec3* dout, Mat4 a) for(i = 0; i < 50; i++) { sm = 0.0; - for(ip = 0; ip < n; ip++) for(iq = ip+1; iq < n; iq++) sm += fabs(a.m[ip + 4 * iq]); + for(ip = 0; ip < n; ip++) for(iq = ip+1; iq < n; iq++) sm += std::fabs(a.m[ip + 4 * iq]); if( fabs(sm) < FLT_EPSILON ) { v.transpose(); @@ -127,15 +128,15 @@ static void _getEigenVectors(Mat4* vout, Vec3* dout, Mat4 a) { for(iq = ip + 1; iq < n; iq++) { - g = 100.0 * fabs(a.m[ip + iq * 4]); + g = 100.0 * std::fabs(a.m[ip + iq * 4]); float dmip = _getElement(d, ip); float dmiq = _getElement(d, iq); - if( i>3 && fabs(dmip) + g == fabs(dmip) && fabs(dmiq) + g == fabs(dmiq) ) + if( i>3 && std::fabs(dmip) + g == std::fabs(dmip) && std::fabs(dmiq) + g == std::fabs(dmiq) ) { a.m[ip + 4 * iq] = 0.0; } - else if (fabs(a.m[ip + 4 * iq]) > tresh) + else if (std::fabs(a.m[ip + 4 * iq]) > tresh) { h = dmiq - dmip; if (fabs(h) + g == fabs(h)) @@ -177,7 +178,6 @@ static void _getEigenVectors(Mat4* vout, Vec3* dout, Mat4 a) v.transpose(); *vout = v; *dout = d; - return; } static Mat4 _getOBBOrientation(const Vec3* vertPos, int num) diff --git a/cocos/3d/CCObjLoader.cpp b/cocos/3d/CCObjLoader.cpp index 2397ed76ff86..1b0d4d84c839 100644 --- a/cocos/3d/CCObjLoader.cpp +++ b/cocos/3d/CCObjLoader.cpp @@ -436,11 +436,11 @@ namespace tinyobj { std::string linebuf(&buf[0]); // Trim newline '\r\n' or '\n' - if (linebuf.size() > 0) { + if (!linebuf.empty()) { if (linebuf[linebuf.size() - 1] == '\n') linebuf.erase(linebuf.size() - 1); } - if (linebuf.size() > 0) { + if (!linebuf.empty()) { if (linebuf[linebuf.size() - 1] == '\r') linebuf.erase(linebuf.size() - 1); } @@ -700,11 +700,11 @@ namespace tinyobj { std::string linebuf(&buf[0]); // Trim newline '\r\n' or '\n' - if (linebuf.size() > 0) { + if (!linebuf.empty()) { if (linebuf[linebuf.size() - 1] == '\n') linebuf.erase(linebuf.size() - 1); } - if (linebuf.size() > 0) { + if (!linebuf.empty()) { if (linebuf[linebuf.size() - 1] == '\r') linebuf.erase(linebuf.size() - 1); } @@ -850,7 +850,7 @@ namespace tinyobj { token += strspn(token, " \t\r"); // skip tag } - assert(names.size() > 0); + assert(!names.empty()); // names[0] must be 'g', so skip the 0th element. if (names.size() > 1) { diff --git a/cocos/3d/CCSkeleton3D.cpp b/cocos/3d/CCSkeleton3D.cpp index e8595cc13b14..dae0a8b28852 100644 --- a/cocos/3d/CCSkeleton3D.cpp +++ b/cocos/3d/CCSkeleton3D.cpp @@ -196,13 +196,13 @@ Bone3D::~Bone3D() void Bone3D::updateLocalMat() { - if (_blendStates.size()) + if (!_blendStates.empty()) { Vec3 translate, scale; Quaternion quat(Quaternion::ZERO); float total = 0.f; - for (auto it: _blendStates) { + for (const auto& it: _blendStates) { total += it.weight; } if (total) diff --git a/cocos/3d/CCSkybox.cpp b/cocos/3d/CCSkybox.cpp index 84aafd4a6af7..64eda3132c2e 100644 --- a/cocos/3d/CCSkybox.cpp +++ b/cocos/3d/CCSkybox.cpp @@ -26,6 +26,7 @@ #include "base/ccMacros.h" #include "base/CCConfiguration.h" #include "base/CCDirector.h" +#include "renderer/ccGLStateCache.h" #include "renderer/CCGLProgram.h" #include "renderer/CCGLProgramCache.h" #include "renderer/CCGLProgramState.h" @@ -56,7 +57,7 @@ Skybox::~Skybox() if (Configuration::getInstance()->supportsShareableVAO()) { glDeleteVertexArrays(1, &_vao); - glBindVertexArray(0); + GL::bindVAO(0); _vao = 0; } @@ -107,7 +108,7 @@ void Skybox::initBuffers() if (Configuration::getInstance()->supportsShareableVAO()) { glGenVertexArrays(1, &_vao); - glBindVertexArray(_vao); + GL::bindVAO(_vao); } // The skybox is rendered using a purpose-built shader which makes use of // the shader language's inherent support for cubemaps. Hence there is no @@ -152,7 +153,7 @@ void Skybox::initBuffers() glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION); getGLProgramState()->applyAttributes(false); - glBindVertexArray(0); + GL::bindVAO(0); } } @@ -200,11 +201,11 @@ void Skybox::onDraw(const Mat4& transform, uint32_t /*flags*/) if (Configuration::getInstance()->supportsShareableVAO()) { - glBindVertexArray(_vao); + GL::bindVAO(_vao); } else { - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION); + GL::enableVertexAttribs(GL::VERTEX_ATTRIB_FLAG_POSITION); glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer); glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 3, GL_FLOAT, GL_FALSE, sizeof(Vec3), nullptr); @@ -216,7 +217,7 @@ void Skybox::onDraw(const Mat4& transform, uint32_t /*flags*/) if (Configuration::getInstance()->supportsShareableVAO()) { - glBindVertexArray(0); + GL::bindVAO(0); } else { diff --git a/cocos/3d/CCSprite3D.cpp b/cocos/3d/CCSprite3D.cpp index 9f96f9fe1f0e..fd04cef0962e 100644 --- a/cocos/3d/CCSprite3D.cpp +++ b/cocos/3d/CCSprite3D.cpp @@ -162,7 +162,7 @@ void Sprite3D::afterAsyncLoad(void* param) CC_SAFE_DELETE(materialdatas); CC_SAFE_DELETE(nodeDatas); - if (asyncParam->texPath != "") + if (!asyncParam->texPath.empty()) { setTexture(asyncParam->texPath); } @@ -367,13 +367,13 @@ Sprite3D* Sprite3D::createSprite3DNode(NodeData* nodedata,ModelData* modeldata,c sprite->setName(nodedata->id); auto mesh = Mesh::create(nodedata->id, getMeshIndexData(modeldata->subMeshId)); - if (_skeleton && modeldata->bones.size()) + if (_skeleton && !modeldata->bones.empty()) { auto skin = MeshSkin::create(_skeleton, modeldata->bones, modeldata->invBindPose); mesh->setSkin(skin); } - if (modeldata->materialId == "" && materialdatas.materials.size()) + if (modeldata->materialId.empty() && !materialdatas.materials.empty()) { const NTextureData* textureData = materialdatas.materials[0].getTextureData(NTextureData::Usage::Diffuse); mesh->setTexture(textureData->filename); @@ -522,7 +522,7 @@ void Sprite3D::createNode(NodeData* nodedata, Node* root, const MaterialDatas& m { if(it) { - if(it->bones.size() > 0 || singleSprite) + if(!it->bones.empty() || singleSprite) { if(singleSprite && root!=nullptr) root->setName(nodedata->id); @@ -530,14 +530,14 @@ void Sprite3D::createNode(NodeData* nodedata, Node* root, const MaterialDatas& m if(mesh) { _meshes.pushBack(mesh); - if (_skeleton && it->bones.size()) + if (_skeleton && !it->bones.empty()) { auto skin = MeshSkin::create(_skeleton, it->bones, it->invBindPose); mesh->setSkin(skin); } mesh->_visibleChanged = std::bind(&Sprite3D::onAABBDirty, this); - if (it->materialId == "" && materialdatas.materials.size()) + if (it->materialId.empty() && !materialdatas.materials.empty()) { const NTextureData* textureData = materialdatas.materials[0].getTextureData(NTextureData::Usage::Diffuse); mesh->setTexture(textureData->filename); @@ -608,7 +608,7 @@ void Sprite3D::createNode(NodeData* nodedata, Node* root, const MaterialDatas& m } } } - if(nodedata->modelNodeDatas.size() ==0 ) + if(nodedata->modelNodeDatas.empty() ) { node= Node::create(); if(node) @@ -760,7 +760,7 @@ void Sprite3D::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) { #if CC_USE_CULLING // camera clipping - if(_children.size() == 0 && Camera::getVisitingCamera() && !Camera::getVisitingCamera()->isVisibleInFrustum(&getAABB())) + if(_children.empty() && Camera::getVisitingCamera() && !Camera::getVisitingCamera()->isVisibleInFrustum(&getAABB())) return; #endif @@ -776,7 +776,7 @@ void Sprite3D::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) // Don't override GLProgramState if using manually set Material if (_usingAutogeneratedGLProgram && scene) { - const auto lights = scene->getLights(); + const auto& lights = scene->getLights(); bool usingLight = false; for (const auto light : lights) { usingLight = light->isEnabled() && ((static_cast(light->getLightFlag()) & _lightMask) > 0); @@ -849,9 +849,9 @@ const AABB& Sprite3D::getAABB() const else { _aabb.reset(); - if (_meshes.size()) + if (!_meshes.empty()) { - Mat4 transform(nodeToWorldTransform); + const Mat4& transform(nodeToWorldTransform); for (const auto& it : _meshes) { if (it->isVisible()) _aabb.merge(it->getAABB()); diff --git a/cocos/3d/CCSprite3DMaterial.cpp b/cocos/3d/CCSprite3DMaterial.cpp index 8ff6ae888a83..b41d3a14dd2c 100644 --- a/cocos/3d/CCSprite3DMaterial.cpp +++ b/cocos/3d/CCSprite3DMaterial.cpp @@ -215,7 +215,7 @@ Sprite3DMaterial* Sprite3DMaterial::createBuiltInMaterial(MaterialType type, boo Sprite3DMaterial* Sprite3DMaterial::createWithFilename(const std::string& path) { auto validfilename = FileUtils::getInstance()->fullPathForFilename(path); - if (validfilename.size() > 0) { + if (!validfilename.empty()) { auto it = _materials.find(validfilename); if (it != _materials.end()) return (Sprite3DMaterial*)it->second->clone(); diff --git a/cocos/3d/CCTerrain.cpp b/cocos/3d/CCTerrain.cpp index 634a914b8397..0c12d3260ee5 100644 --- a/cocos/3d/CCTerrain.cpp +++ b/cocos/3d/CCTerrain.cpp @@ -34,6 +34,8 @@ USING_NS_CC; #include "renderer/CCGLProgramState.h" #include "renderer/CCRenderer.h" #include "renderer/CCGLProgramStateCache.h" +#include "renderer/ccGLStateCache.h" +#include "renderer/CCRenderState.h" #include "base/CCDirector.h" #include "base/CCEventType.h" #include "2d/CCCamera.h" @@ -148,26 +150,21 @@ void Terrain::onDraw(const Mat4 &transform, uint32_t /*flags*/) _stateBlock->bind(); - glEnableVertexAttribArray(_positionLocation); - glEnableVertexAttribArray(_texcoordLocation); - glEnableVertexAttribArray(_normalLocation); + GL::enableVertexAttribs(1<<_positionLocation | 1 << _texcoordLocation | 1<<_normalLocation); glProgram->setUniformsForBuiltins(transform); _glProgramState->applyUniforms(); glUniform3f(_lightDirLocation,_lightDir.x,_lightDir.y,_lightDir.z); if(!_alphaMap) { - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, _detailMapTextures[0]->getName()); + GL::bindTexture2D(_detailMapTextures[0]->getName()); //getGLProgramState()->setUniformTexture("") glUniform1i(_detailMapLocation[0],0); glUniform1i(_alphaIsHasAlphaMapLocation,0); - } - else + }else { for(int i =0;i<_maxDetailMapValue;++i) { - glActiveTexture(GL_TEXTURE0 + i); - glBindTexture(GL_TEXTURE_2D, _detailMapTextures[i]->getName()); + GL::bindTexture2DN(i,_detailMapTextures[i]->getName()); glUniform1i(_detailMapLocation[i],i); glUniform1f(_detailMapSizeLocation[i],_terrainData._detailMaps[i]._detailMapSize); @@ -175,15 +172,13 @@ void Terrain::onDraw(const Mat4 &transform, uint32_t /*flags*/) glUniform1i(_alphaIsHasAlphaMapLocation,1); - glActiveTexture(GL_TEXTURE0 + 4); - glBindTexture(GL_TEXTURE_2D, _alphaMap->getName()); + GL::bindTexture2DN(4, _alphaMap->getName()); glUniform1i(_alphaMapLocation,4); } if (_lightMap) { glUniform1i(_lightMapCheckLocation, 1); - glActiveTexture(GL_TEXTURE0 + 5); - glBindTexture(GL_TEXTURE_2D, _lightMap->getName()); + GL::bindTexture2DN(5, _lightMap->getName()); glUniform1i(_lightMapLocation, 5); }else { @@ -705,7 +700,7 @@ void Terrain::setAlphaMap(cocos2d::Texture2D * newAlphaMapTexture) _alphaMap = newAlphaMapTexture; } -void Terrain::setDetailMap(unsigned int index, DetailMap detailMap) +void Terrain::setDetailMap(unsigned int index, const DetailMap& detailMap) { if(index>4) { @@ -1340,7 +1335,7 @@ bool Terrain::Chunk::getIntersectPointWithRay(const Ray& ray, Vec3& intersectPoi float minDist = FLT_MAX; bool isFind = false; - for (auto triangle : _trianglesList) + for (const auto& triangle : _trianglesList) { Vec3 p; if (triangle.getIntersectPoint(ray, p)) @@ -1588,10 +1583,10 @@ void Terrain::QuadTree::preCalculateAABB(const Mat4 & worldTransform) Terrain::QuadTree::~QuadTree() { - if(_tl) delete _tl; - if(_tr) delete _tr; - if(_bl) delete _bl; - if(_br) delete _br; + delete _tl; + delete _tr; + delete _bl; + delete _br; } Terrain::TerrainData::TerrainData(const std::string& heightMapsrc , const std::string& textureSrc, const Size & chunksize, float height, float scale) diff --git a/cocos/3d/CCTerrain.h b/cocos/3d/CCTerrain.h index bfa7a4aca9e8..f385b995b0b2 100644 --- a/cocos/3d/CCTerrain.h +++ b/cocos/3d/CCTerrain.h @@ -369,7 +369,7 @@ class CC_DLL Terrain : public Node /** set the alpha map*/ void setAlphaMap(cocos2d::Texture2D * newAlphaMapTexture); /**set the Detail Map */ - void setDetailMap(unsigned int index, DetailMap detailMap); + void setDetailMap(unsigned int index, const DetailMap& detailMap); // Overrides, internal use only virtual void draw(cocos2d::Renderer* renderer, const cocos2d::Mat4 &transform, uint32_t flags) override; diff --git a/cocos/3d/CMakeLists.txt b/cocos/3d/CMakeLists.txt index fadfdcccfdaf..92ddd5fb3760 100644 --- a/cocos/3d/CMakeLists.txt +++ b/cocos/3d/CMakeLists.txt @@ -1,8 +1,3 @@ - -if(WINDOWS AND BUILD_SHARED_LIBS) - add_definitions(-D_USE3DDLL) -endif() - set(COCOS_3D_HEADER 3d/CCBillBoard.h diff --git a/cocos/Android.mk b/cocos/Android.mk index d21c4e910d0a..4dfb82d45c3c 100644 --- a/cocos/Android.mk +++ b/cocos/Android.mk @@ -89,6 +89,7 @@ cocos2d.cpp \ 2d/CCAutoPolygon.cpp \ 3d/CCFrustum.cpp \ 3d/CCPlane.cpp \ +platform/CCDataManager.cpp \ platform/CCFileUtils.cpp \ platform/CCGLView.cpp \ platform/CCImage.cpp \ @@ -185,6 +186,7 @@ renderer/CCTrianglesCommand.cpp \ renderer/CCVertexAttribBinding.cpp \ renderer/CCVertexIndexBuffer.cpp \ renderer/CCVertexIndexData.cpp \ +renderer/ccGLStateCache.cpp \ renderer/CCFrameBuffer.cpp \ renderer/ccShaders.cpp \ vr/CCVRDistortion.cpp \ diff --git a/cocos/CMakeLists.txt b/cocos/CMakeLists.txt index 871e17d7585a..410a24e03034 100644 --- a/cocos/CMakeLists.txt +++ b/cocos/CMakeLists.txt @@ -30,14 +30,10 @@ # build jscocos2d if BUILD_JS_LIBS=ON # The version number -set(COCOS2D_X_VERSION 3.18) +set(COCOS2D_X_VERSION 3.17.2) set(COCOS_CORE_LIB cocos2d) -if(WINDOWS) - add_definitions(-DUNICODE -D_UNICODE) -endif() - include(2d/CMakeLists.txt) include(3d/CMakeLists.txt) include(platform/CMakeLists.txt) @@ -54,6 +50,12 @@ include(network/CMakeLists.txt) include(audio/CMakeLists.txt) include(storage/CMakeLists.txt) +# default value for cocos2dx extensions modules build +option(BUILD_EDITOR_COCOSBUILDER "Build editor support for cocosbuilder" ON) +option(BUILD_EDITOR_COCOSTUDIO "Build editor support for cocostudio" ON) +option(BUILD_EDITOR_SPINE "Build editor support for spine" ON) +option(BUILD_EXTENSIONS "Build extension library" ON) + if(BUILD_EDITOR_COCOSBUILDER) include(editor-support/cocosbuilder/CMakeLists.txt) set(COCOS_EDITOR_SUPPORT_SRC ${COCOS_EDITOR_SUPPORT_SRC} ${COCOS_CCB_SRC} ${COCOS_CCB_HEADER}) @@ -121,8 +123,12 @@ add_library(cocos2d ${COCOS_SRC}) add_subdirectory(${COCOS2DX_ROOT_PATH}/external ${ENGINE_BINARY_PATH}/external) target_link_libraries(cocos2d external) +# add base macro define and compile options +use_cocos2dx_compile_define(cocos2d) +use_cocos2dx_compile_options(cocos2d) + # use all platform related system libs -target_use_cocos2dx_depend(cocos2d) +use_cocos2dx_libs_depend(cocos2d) target_include_directories(cocos2d PUBLIC ${COCOS2DX_ROOT_PATH} @@ -155,3 +161,9 @@ endif() if(XCODE OR VS) cocos_mark_code_files("cocos2d") endif() + +if(${CMAKE_VERSION} VERSION_GREATER "3.16.0") + message("CMake 3.16 target_precompile_headers") + target_precompile_headers(cocos2d PRIVATE + "$<$:cocos2d.h>") +endif() diff --git a/cocos/audio/AudioEngine.cpp b/cocos/audio/AudioEngine.cpp index f4f7d98767a0..2b893f4b509a 100644 --- a/cocos/audio/AudioEngine.cpp +++ b/cocos/audio/AudioEngine.cpp @@ -90,9 +90,10 @@ class AudioEngine::AudioEngineThreadPool AudioEngineThreadPool(int threads = 4) : _stop(false) { + _workers.reserve(threads); for (int index = 0; index < threads; ++index) { - _workers.emplace_back(std::thread(std::bind(&AudioEngineThreadPool::threadFunc, this))); + _workers.emplace_back(std::bind(&AudioEngineThreadPool::threadFunc, this)); } } @@ -138,7 +139,9 @@ class AudioEngine::AudioEngineThreadPool } } - task(); + if (task) { + task(); + } } } @@ -152,11 +155,8 @@ class AudioEngine::AudioEngineThreadPool void AudioEngine::end() { - if (s_threadPool) - { - delete s_threadPool; - s_threadPool = nullptr; - } + delete s_threadPool; + s_threadPool = nullptr; delete _audioEngineImpl; _audioEngineImpl = nullptr; @@ -349,7 +349,7 @@ void AudioEngine::remove(int audioID) it->second.profileHelper->audioIDs.remove(audioID); } _audioPathIDMap[*it->second.filePath].remove(audioID); - _audioIDInfoMap.erase(audioID); + _audioIDInfoMap.erase(it); } } @@ -394,16 +394,13 @@ void AudioEngine::uncache(const std::string &filePath) { itInfo->second.profileHelper->audioIDs.remove(audioID); } - _audioIDInfoMap.erase(audioID); + _audioIDInfoMap.erase(itInfo); } } _audioPathIDMap.erase(filePath); } - if (_audioEngineImpl) - { - _audioEngineImpl->uncache(filePath); - } + _audioEngineImpl->uncache(filePath); } void AudioEngine::uncacheAll() @@ -533,7 +530,7 @@ AudioProfile* AudioEngine::getProfile(const std::string &name) } } -void AudioEngine::preload(const std::string& filePath, std::function callback) +void AudioEngine::preload(const std::string& filePath, const std::function& callback) { if (!isEnabled()) { diff --git a/cocos/audio/android/AudioEngine-inl.cpp b/cocos/audio/android/AudioEngine-inl.cpp index 81bd20f3358a..a7e73c7435f9 100644 --- a/cocos/audio/android/AudioEngine-inl.cpp +++ b/cocos/audio/android/AudioEngine-inl.cpp @@ -97,7 +97,8 @@ static int fdGetter(const std::string& url, off_t* start, off_t* length) { fd = getObbAssetFileDescriptorJNI(url.c_str(), start, length); } - else + + if (fd <= 0) { auto asset = AAssetManager_open(cocos2d::FileUtilsAndroid::getAssetManager(), url.c_str(), AASSET_MODE_UNKNOWN); // open asset as file descriptor diff --git a/cocos/audio/apple/AudioCache.mm b/cocos/audio/apple/AudioCache.mm index 67df4a2481e9..901c9a1b0f0d 100644 --- a/cocos/audio/apple/AudioCache.mm +++ b/cocos/audio/apple/AudioCache.mm @@ -51,22 +51,6 @@ of this software and associated documentation files (the "Software"), to deal #define INVALID_AL_BUFFER_ID 0xFFFFFFFF #define PCMDATA_CACHEMAXSIZE 1048576 -typedef ALvoid AL_APIENTRY (*alBufferDataStaticProcPtr) (const ALint bid, ALenum format, ALvoid* data, ALsizei size, ALsizei freq); -static ALvoid alBufferDataStaticProc(const ALint bid, ALenum format, ALvoid* data, ALsizei size, ALsizei freq) -{ - static alBufferDataStaticProcPtr proc = nullptr; - - if (proc == nullptr) { - proc = (alBufferDataStaticProcPtr) alcGetProcAddress(nullptr, (const ALCchar*) "alBufferDataStatic"); - } - - if (proc){ - proc(bid, format, data, size, freq); - } - - return; -} - @interface NSTimerWrapper : NSObject { std::function _timeoutCallback; @@ -104,11 +88,6 @@ -(void) dealloc @end -static void setTimeout(double seconds, const std::function& cb) -{ - [[[NSTimerWrapper alloc] initWithTimeInterval:seconds callback:cb] autorelease]; -} - using namespace cocos2d; using namespace cocos2d::experimental; @@ -150,35 +129,19 @@ static void setTimeout(double seconds, const std::function& cb) } //wait for the 'readDataTask' task to exit _readDataTaskMutex.lock(); - _readDataTaskMutex.unlock(); - if (_pcmData) + if (_state == State::READY) { - if (_state == State::READY) - { - if (_alBufferId != INVALID_AL_BUFFER_ID && alIsBuffer(_alBufferId)) - { - ALOGV("~AudioCache(id=%u), delete buffer: %u", _id, _alBufferId); - alDeleteBuffers(1, &_alBufferId); - _alBufferId = INVALID_AL_BUFFER_ID; - } - } - else + if (_alBufferId != INVALID_AL_BUFFER_ID && alIsBuffer(_alBufferId)) { - ALOGW("AudioCache (%p), id=%u, buffer isn't ready, state=%d", this, _id, _state); + ALOGV("~AudioCache(id=%u), delete buffer: %u", _id, _alBufferId); + alDeleteBuffers(1, &_alBufferId); + _alBufferId = INVALID_AL_BUFFER_ID; } - - // fixed #17494: CrashIfClientProvidedBogusAudioBufferList - // We're using 'alBufferDataStaticProc' for speeding up - // the performance of playing audio without preload, but we need to manage the memory by ourself carefully. - // It's probably that '_pcmData' is freed before OpenAL finishes the audio render task, - // then 'CrashIfClientProvidedBogusAudioBufferList' may be triggered. - // 'cpp-tests/NewAudioEngineTest/AudioSwitchStateTest' can reproduce this issue without the following fix. - // The workaround is delaying 200ms to free pcm data. - char* data = _pcmData; - setTimeout(0.2, [data](){ - free(data); - }); + } + else + { + ALOGW("AudioCache (%p), id=%u, buffer isn't ready, state=%d", this, _id, _state); } if (_queBufferFrames > 0) @@ -189,6 +152,7 @@ static void setTimeout(double seconds, const std::function& cb) } } ALOGVV("~AudioCache() %p, id=%u, end", this, _id); + _readDataTaskMutex.unlock(); } void AudioCache::readDataTask(unsigned int selfId) @@ -261,24 +225,16 @@ static void setTimeout(double seconds, const std::function& cb) _pcmData = (char*)malloc(dataSize); memset(_pcmData, 0x00, dataSize); + ALOGV(" id=%u _pcmData alloc: %p", selfId, _pcmData); if (adjustFrames > 0) { memcpy(_pcmData + (dataSize - adjustFrameBuf.size()), adjustFrameBuf.data(), adjustFrameBuf.size()); } - alGenBuffers(1, &_alBufferId); - auto alError = alGetError(); - if (alError != AL_NO_ERROR) { - ALOGE("%s: attaching audio to buffer fail: %x", __PRETTY_FUNCTION__, alError); - break; - } - if (*_isDestroyed) break; - alBufferDataStaticProc(_alBufferId, _format, _pcmData, (ALsizei)dataSize, (ALsizei)sampleRate); - framesRead = decoder.readFixedFrames(std::min(framesToReadOnce, remainingFrames), _pcmData + _framesRead * bytesPerFrame); _framesRead += framesRead; remainingFrames -= framesRead; @@ -286,10 +242,6 @@ static void setTimeout(double seconds, const std::function& cb) if (*_isDestroyed) break; - _state = State::READY; - - invokingPlayCallbacks(); - uint32_t frames = 0; while (!*_isDestroyed && _framesRead < originalTotalFrames) { @@ -309,9 +261,22 @@ static void setTimeout(double seconds, const std::function& cb) { memset(_pcmData + _framesRead * bytesPerFrame, 0x00, (totalFrames - _framesRead) * bytesPerFrame); } - ALOGV("pcm buffer was loaded successfully, total frames: %u, total read frames: %u, adjust frames: %u, remainingFrames: %u", totalFrames, _framesRead, adjustFrames, remainingFrames); + ALOGV("pcm buffer was loaded successfully, total frames: %u, total read frames: %u, adjust frames: %u, remainingFrames: %u", totalFrames, _framesRead, adjustFrames, remainingFrames); _framesRead += adjustFrames; + + alGenBuffers(1, &_alBufferId); + auto alError = alGetError(); + if (alError != AL_NO_ERROR) { + ALOGE("%s: attaching audio to buffer fail: %x", __PRETTY_FUNCTION__, alError); + break; + } + ALOGV(" id=%u generated alGenBuffers: %u for _pcmData: %p", selfId, _alBufferId, _pcmData); + ALOGV(" id=%u _pcmData alBufferData: %p", selfId, _pcmData); + alBufferData(_alBufferId, _format, _pcmData, (ALsizei)dataSize, (ALsizei)sampleRate); + _state = State::READY; + invokingPlayCallbacks(); + } else { @@ -333,6 +298,10 @@ static void setTimeout(double seconds, const std::function& cb) } while (false); + if (_pcmData != nullptr){ + CC_SAFE_FREE(_pcmData); + } + decoder.close(); //FIXME: Why to invoke play callback first? Should it be after 'load' callback? @@ -345,7 +314,7 @@ static void setTimeout(double seconds, const std::function& cb) _state = State::FAILED; if (_alBufferId != INVALID_AL_BUFFER_ID && alIsBuffer(_alBufferId)) { - ALOGV("readDataTask failed, delete buffer: %u", _alBufferId); + ALOGV(" id=%u readDataTask failed, delete buffer: %u", selfId, _alBufferId); alDeleteBuffers(1, &_alBufferId); _alBufferId = INVALID_AL_BUFFER_ID; } diff --git a/cocos/audio/apple/AudioEngine-inl.mm b/cocos/audio/apple/AudioEngine-inl.mm index 81b8b86a8973..4c53db0e6ca4 100644 --- a/cocos/audio/apple/AudioEngine-inl.mm +++ b/cocos/audio/apple/AudioEngine-inl.mm @@ -677,6 +677,7 @@ AL_API ALvoid AL_APIENTRY alGenBuffers(ALsizei n, ALuint *bids) if (player->_finishCallbak) { auto& audioInfo = AudioEngine::_audioIDInfoMap[audioID]; filePath = *audioInfo.filePath; + player->setCache(nullptr); // it's safe for player didn't free audio cache } AudioEngine::remove(audioID); @@ -710,6 +711,11 @@ AL_API ALvoid AL_APIENTRY alGenBuffers(ALsizei n, ALuint *bids) void AudioEngineImpl::uncacheAll() { _audioCaches.clear(); + for(auto&& player : _audioPlayers) + { + // prevent player hold invalid AudioCache* pointer, since all audio caches purged + player.second->setCache(nullptr); + } } #endif diff --git a/cocos/audio/include/AudioEngine.h b/cocos/audio/include/AudioEngine.h index 81bd3668a897..5be98e2c1dd2 100644 --- a/cocos/audio/include/AudioEngine.h +++ b/cocos/audio/include/AudioEngine.h @@ -291,7 +291,7 @@ class EXPORT_DLL AudioEngine * @param filePath The file path of an audio. * @param callback A callback which will be called after loading is finished. */ - static void preload(const std::string& filePath, std::function callback); + static void preload(const std::string& filePath, const std::function& callback); /** * Gets playing audio count. diff --git a/cocos/audio/linux/AudioEngine-linux.cpp b/cocos/audio/linux/AudioEngine-linux.cpp index e17ca36294b0..a51f13e298c8 100644 --- a/cocos/audio/linux/AudioEngine-linux.cpp +++ b/cocos/audio/linux/AudioEngine-linux.cpp @@ -72,8 +72,6 @@ AudioEngineImpl::AudioEngineImpl() AudioEngineImpl::~AudioEngineImpl() { FMOD_RESULT result; - result = pSystem->close(); - ERRCHECKWITHEXIT(result); result = pSystem->release(); ERRCHECKWITHEXIT(result); } @@ -109,7 +107,8 @@ int AudioEngineImpl::play2d(const std::string &fileFullPath, bool loop, float vo int id = preload(fileFullPath, nullptr); if (id >= 0) { mapChannelInfo[id].loop=loop; - mapChannelInfo[id].channel->setPaused(true); + // channel is null here. Don't dereference it. It's only set in resume(id). + //mapChannelInfo[id].channel->setPaused(true); mapChannelInfo[id].volume = volume; AudioEngine::_audioIDInfoMap[id].state = AudioEngine::AudioState::PAUSED; resume(id); @@ -287,8 +286,7 @@ void AudioEngineImpl::uncache(const std::string& path) } mapSound.erase(it); } - if (mapId.find(path) != mapId.end()) - mapId.erase(path); + mapId.erase(path); } void AudioEngineImpl::uncacheAll() @@ -303,7 +301,7 @@ void AudioEngineImpl::uncacheAll() mapId.clear(); } -int AudioEngineImpl::preload(const std::string& filePath, std::function callback) +int AudioEngineImpl::preload(const std::string& filePath, const std::function& callback) { FMOD::Sound * sound = findSound(filePath); if (!sound) { @@ -320,10 +318,9 @@ int AudioEngineImpl::preload(const std::string& filePath, std::function(mapChannelInfo.size()) + 1; - if (mapId.find(filePath) == mapId.end()) - mapId.insert({filePath, id}); - else - id = mapId.at(filePath); + // std::map::insert returns std::pair + auto channelInfoIter = mapId.insert({filePath, id}); + id = channelInfoIter.first->second; auto& chanelInfo = mapChannelInfo[id]; chanelInfo.sound = sound; diff --git a/cocos/audio/linux/AudioEngine-linux.h b/cocos/audio/linux/AudioEngine-linux.h index d52a152e5b89..272af7d70f02 100644 --- a/cocos/audio/linux/AudioEngine-linux.h +++ b/cocos/audio/linux/AudioEngine-linux.h @@ -65,7 +65,7 @@ class CC_DLL AudioEngineImpl : public cocos2d::Ref void uncacheAll(); - int preload(const std::string& filePath, std::function callback); + int preload(const std::string& filePath, const std::function& callback); void update(float dt); diff --git a/cocos/audio/linux/SimpleAudioEngine.cpp b/cocos/audio/linux/SimpleAudioEngine.cpp index acd9676b49a8..eaf8daa1b529 100644 --- a/cocos/audio/linux/SimpleAudioEngine.cpp +++ b/cocos/audio/linux/SimpleAudioEngine.cpp @@ -84,7 +84,7 @@ void SimpleAudioEngine::stopBackgroundMusic(bool releaseData) { AudioEngine::stop(g_SimpleAudioEngineLinux->musicid); if (releaseData) { - AudioEngine::uncache(g_SimpleAudioEngineLinux->musicpath.c_str()); + AudioEngine::uncache(g_SimpleAudioEngineLinux->musicpath); } } diff --git a/cocos/audio/mac/CDAudioManager.m b/cocos/audio/mac/CDAudioManager.m index ced152e4e915..57a99456d45b 100644 --- a/cocos/audio/mac/CDAudioManager.m +++ b/cocos/audio/mac/CDAudioManager.m @@ -325,8 +325,9 @@ + (void) configure: (tAudioManagerMode) mode { -(BOOL) isOtherAudioPlaying { UInt32 isPlaying = 0; - UInt32 varSize = sizeof(isPlaying); - AudioSessionGetProperty (kAudioSessionProperty_OtherAudioIsPlaying, &varSize, &isPlaying); + //UInt32 varSize = sizeof(isPlaying); + //AudioSessionGetProperty (kAudioSessionProperty_OtherAudioIsPlaying, &varSize, &isPlaying); + isPlaying = [[AVAudioSession sharedInstance] isOtherAudioPlaying]; return (isPlaying != 0); } @@ -405,9 +406,9 @@ - (id) init: (tAudioManagerMode) mode { if ((self = [super init])) { //Initialise the audio session - AVAudioSession* session = [AVAudioSession sharedInstance]; - session.delegate = self; - + //AVAudioSession* session = [AVAudioSession sharedInstance]; + //session.delegate = self; + [[AVAudioSession sharedInstance] setActive:YES error:nil]; _mode = mode; backgroundMusicCompletionSelector = nil; _isObservingAppEvents = FALSE; @@ -474,33 +475,13 @@ -(BOOL) isBackgroundMusicPlaying { //however, on a 3gs running 3.1.2 no route change is generated when the user switches the //ringer mute switch to off (i.e. enables sound) therefore polling is the only reliable way to //determine ringer switch state --(BOOL) isDeviceMuted { + -(BOOL) isDeviceMuted { #if TARGET_IPHONE_SIMULATOR //Calling audio route stuff on the simulator causes problems return NO; -#else - CFStringRef newAudioRoute; - UInt32 propertySize = sizeof (CFStringRef); - - AudioSessionGetProperty ( - kAudioSessionProperty_AudioRoute, - &propertySize, - &newAudioRoute - ); - - if (newAudioRoute == NULL) { - //Don't expect this to happen but playing safe otherwise a null in the CFStringCompare will cause a crash - return YES; - } else { - CFComparisonResult newDeviceIsMuted = CFStringCompare ( - newAudioRoute, - (CFStringRef) @"", - 0 - ); - - return (newDeviceIsMuted == kCFCompareEqualTo); - } +#else + return NO; #endif } diff --git a/cocos/audio/mac/CDXMacOSXSupport.h b/cocos/audio/mac/CDXMacOSXSupport.h index eaa97f2e3465..7aad68cced26 100644 --- a/cocos/audio/mac/CDXMacOSXSupport.h +++ b/cocos/audio/mac/CDXMacOSXSupport.h @@ -40,10 +40,10 @@ #import #import -enum AudioSessionProperties { - kAudioSessionProperty_OtherAudioIsPlaying, - kAudioSessionProperty_AudioRoute -}; +// enum AudioSessionProperties { +// kAudioSessionProperty_OtherAudioIsPlaying, +// kAudioSessionProperty_AudioRoute +// }; #ifdef __cplusplus extern "C" { #endif diff --git a/cocos/audio/tizen/AudioEngine-tizen.cpp b/cocos/audio/tizen/AudioEngine-tizen.cpp index 2a45684508c1..49de68616b1d 100644 --- a/cocos/audio/tizen/AudioEngine-tizen.cpp +++ b/cocos/audio/tizen/AudioEngine-tizen.cpp @@ -64,7 +64,7 @@ class AudioEngineThreadPool std::thread _threads; std::queue< std::function > _tasks; - void threadFunc(void) { + void threadFunc() { while (true) { std::function task = nullptr; diff --git a/cocos/audio/win32/AudioEngine-win32.cpp b/cocos/audio/win32/AudioEngine-win32.cpp index f779f4276e4b..3fb0ffc8734c 100644 --- a/cocos/audio/win32/AudioEngine-win32.cpp +++ b/cocos/audio/win32/AudioEngine-win32.cpp @@ -482,6 +482,7 @@ void AudioEngineImpl::update(float dt) if (player->_finishCallbak) { auto& audioInfo = AudioEngine::_audioIDInfoMap[audioID]; filePath = *audioInfo.filePath; + player->setCache(nullptr); // it's safe for player didn't free audio cache } AudioEngine::remove(audioID); @@ -515,6 +516,11 @@ void AudioEngineImpl::uncache(const std::string &filePath) void AudioEngineImpl::uncacheAll() { _audioCaches.clear(); + for(auto&& player : _audioPlayers) + { + // prevent player hold invalid AudioCache* pointer, since all audio caches purged + player.second->setCache(nullptr); + } } #endif diff --git a/cocos/base/CCConfiguration.h b/cocos/base/CCConfiguration.h index 91bce875ca3f..e2175bd39c24 100644 --- a/cocos/base/CCConfiguration.h +++ b/cocos/base/CCConfiguration.h @@ -229,6 +229,15 @@ class CC_DLL Configuration : public Ref * @return The Configuration info. */ std::string getInfo() const; + + /** + Returns the configuration as value map + @return the configuration map + @since 3.18 + @js NA + @lua NA + */ + const ValueMap& getInfoAsMap()const { return _valueDict; } /** Gathers OpenGL / GPU information. */ @@ -243,7 +252,7 @@ class CC_DLL Configuration : public Ref static const char* CONFIG_FILE_LOADED; private: - Configuration(void); + Configuration(); static Configuration *s_sharedConfiguration; static std::string s_configfile; diff --git a/cocos/base/CCConsole.cpp b/cocos/base/CCConsole.cpp index 133d62cb15a9..31e482dd89d3 100644 --- a/cocos/base/CCConsole.cpp +++ b/cocos/base/CCConsole.cpp @@ -71,7 +71,7 @@ #include "base/allocator/CCAllocatorDiagnostics.h" NS_CC_BEGIN -extern const char* cocos2dVersion(void); +extern const char* cocos2dVersion(); #define PROMPT "> " #define DEFAULT_COMMAND_SEPARATOR '|' @@ -166,8 +166,12 @@ void log(const char * format, ...) delete[] buf; } } while (true); +#if CC_TARGET_PLATFORM != CC_PLATFORM_WIN32 buf[nret] = '\n'; buf[++nret] = '\0'; +#else + buf[nret] = '\0'; +#endif #if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID __android_log_print(ANDROID_LOG_DEBUG, "cocos2d-x debug info", "%s", buf); @@ -181,16 +185,21 @@ void log(const char * format, ...) do { - std::copy(buf + pos, buf + pos + MAX_LOG_LENGTH, tempBuf); + int dataSize = std::min(MAX_LOG_LENGTH, len - pos); + std::copy(buf + pos, buf + pos + dataSize, tempBuf); - tempBuf[MAX_LOG_LENGTH] = 0; + tempBuf[dataSize] = 0; MultiByteToWideChar(CP_UTF8, 0, tempBuf, -1, wszBuf, sizeof(wszBuf)); OutputDebugStringW(wszBuf); + OutputDebugStringW(L"\n"); WideCharToMultiByte(CP_ACP, 0, wszBuf, -1, tempBuf, sizeof(tempBuf), nullptr, FALSE); +#if CC_TARGET_PLATFORM != CC_PLATFORM_WIN32 printf("%s", tempBuf); - - pos += MAX_LOG_LENGTH; +#else + printf("%s\n", tempBuf); +#endif + pos += dataSize; } while (pos < len); SendLogToWindow(buf); @@ -453,7 +462,7 @@ void Console::Command::commandGeneric(int fd, const std::string& args) { // The first argument (including the empty) std::string key(args); - auto pos = args.find(" "); + auto pos = args.find(' '); if ((pos != std::string::npos) && (0 < pos)) { key = args.substr(0, pos); } @@ -714,7 +723,7 @@ void Console::log(const char* buf) { if( _sendDebugStrings ) { _DebugStringsMutex.lock(); - _DebugStrings.push_back(buf); + _DebugStrings.emplace_back(buf); _DebugStringsMutex.unlock(); } } @@ -1164,7 +1173,7 @@ void Console::commandDebugMsg(int fd, const std::string& /*args*/) void Console::commandDebugMsgSubCommandOnOff(int /*fd*/, const std::string& args) { - _sendDebugStrings = (args.compare("on") == 0); + _sendDebugStrings = (args == "on"); } void Console::commandDirectorSubCommandPause(int /*fd*/, const std::string& /*args*/) @@ -1232,7 +1241,7 @@ void Console::commandFps(int fd, const std::string& /*args*/) void Console::commandFpsSubCommandOnOff(int /*fd*/, const std::string& args) { - bool state = (args.compare("on") == 0); + bool state = (args == "on"); Director *dir = Director::getInstance(); Scheduler *sched = dir->getScheduler(); sched->performFunctionInCocosThread( std::bind(&Director::setDisplayStats, dir, state)); diff --git a/cocos/base/CCController-linux-win32.cpp b/cocos/base/CCController-linux-win32.cpp index 9324b64a2a4e..a30e57203de8 100644 --- a/cocos/base/CCController-linux-win32.cpp +++ b/cocos/base/CCController-linux-win32.cpp @@ -4740,7 +4740,7 @@ class CC_DLL ControllerImpl // Check if we already have an available input controller profile. If so, attach it it to the controller. for (const auto & it : s_controllerProfiles) { - if ( deviceName.compare(it.first) == 0 ) + if ( deviceName == it.first ) { // Found controller profile. Attach it to the controller: CCLOG("ControllerImpl: Found input profile for controller: %s", deviceName.c_str()); diff --git a/cocos/base/CCData.cpp b/cocos/base/CCData.cpp index 27e11a3c9745..1fe7ece35556 100644 --- a/cocos/base/CCData.cpp +++ b/cocos/base/CCData.cpp @@ -108,8 +108,8 @@ ssize_t Data::getSize() const ssize_t Data::copy(const unsigned char* bytes, const ssize_t size) { - CCASSERT(size >= 0, "copy size should be non-negative"); - CCASSERT(bytes, "bytes should not be nullptr"); + //CCASSERT(size >= 0, "copy size should be non-negative"); + //CCASSERT(bytes, "bytes should not be nullptr"); if (size <= 0) return 0; diff --git a/cocos/base/CCDataVisitor.cpp b/cocos/base/CCDataVisitor.cpp index ae2d20142dac..fd1e494f3238 100644 --- a/cocos/base/CCDataVisitor.cpp +++ b/cocos/base/CCDataVisitor.cpp @@ -203,7 +203,7 @@ void PrettyPrinter::visit(const __Set *p) if (i > 0) { _result += "\n"; } - _result += _indentStr.c_str(); + _result += _indentStr; PrettyPrinter v(_indentLevel); //FIXME:james (*it)->acceptVisitor(v); _result += v.getResult(); diff --git a/cocos/base/CCDirector.cpp b/cocos/base/CCDirector.cpp index 496e89e7f5d6..c1407a7e41d6 100644 --- a/cocos/base/CCDirector.cpp +++ b/cocos/base/CCDirector.cpp @@ -46,12 +46,12 @@ THE SOFTWARE. #include "renderer/CCGLProgramCache.h" #include "renderer/CCGLProgramStateCache.h" #include "renderer/CCTextureCache.h" +#include "renderer/ccGLStateCache.h" #include "renderer/CCRenderer.h" #include "renderer/CCRenderState.h" #include "renderer/CCFrameBuffer.h" #include "2d/CCCamera.h" #include "base/CCUserDefault.h" -#include "base/ccUtils.h" #include "base/ccFPSImages.h" #include "base/CCScheduler.h" #include "base/ccMacros.h" @@ -68,10 +68,6 @@ THE SOFTWARE. #include "base/CCScriptSupport.h" #endif -#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID -#include "platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxEngineDataManager.h" -#endif - /** Position of the FPS @@ -90,7 +86,7 @@ NS_CC_BEGIN static Director *s_SharedDirector = nullptr; #define kDefaultFPS 60 // 60 frames per second -extern const char* cocos2dVersion(void); +extern const char* cocos2dVersion(); const char *Director::EVENT_BEFORE_SET_NEXT_SCENE = "director_before_set_next_scene"; const char *Director::EVENT_AFTER_SET_NEXT_SCENE = "director_after_set_next_scene"; @@ -118,7 +114,7 @@ Director::Director() { } -bool Director::init(void) +bool Director::init() { setDefaultValues(); @@ -161,13 +157,10 @@ bool Director::init(void) _renderer = new (std::nothrow) Renderer; RenderState::initialize(); -#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID - EngineDataManager::init(); -#endif return true; } -Director::~Director(void) +Director::~Director() { CCLOGINFO("deallocing Director: %p", this); @@ -199,9 +192,17 @@ Director::~Director(void) ObjectFactory::destroyInstance(); s_SharedDirector = nullptr; + +#if CC_ENABLE_SCRIPT_BINDING + ScriptEngineManager::destroyInstance(); +#endif + +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) + exit(0); +#endif } -void Director::setDefaultValues(void) +void Director::setDefaultValues() { Configuration *conf = Configuration::getInstance(); @@ -683,11 +684,12 @@ void Director::setProjection(Projection projection) } _projection = projection; + GL::setProjectionMatrixDirty(); _eventDispatcher->dispatchEvent(_eventProjectionChanged); } -void Director::purgeCachedData(void) +void Director::purgeCachedData() { FontFNT::purgeCachedData(); FontAtlasCache::purgeCachedData(); @@ -704,7 +706,7 @@ void Director::purgeCachedData(void) FileUtils::getInstance()->purgeCachedEntries(); } -float Director::getZEye(void) const +float Director::getZEye() const { return (_winSizeInPoints.height / 1.154700538379252f);//(2 * tanf(M_PI/6)) } @@ -713,11 +715,11 @@ void Director::setAlphaBlending(bool on) { if (on) { - utils::setBlending(CC_BLEND_SRC, CC_BLEND_DST); + GL::blendFunc(CC_BLEND_SRC, CC_BLEND_DST); } else { - utils::setBlending(GL_ONE, GL_ZERO); + GL::blendFunc(GL_ONE, GL_ZERO); } CHECK_GL_ERROR_DEBUG(); @@ -733,6 +735,11 @@ void Director::setClearColor(const Color4F& clearColor) _renderer->setClearColor(clearColor); } +const Color4F& Director::getClearColor() const +{ + return _renderer->getClearColor(); +} + static void GLToClipTransform(Mat4 *transformOut) { if(nullptr == transformOut) return; @@ -740,8 +747,8 @@ static void GLToClipTransform(Mat4 *transformOut) Director* director = Director::getInstance(); CCASSERT(nullptr != director, "Director is null when setting matrix stack"); - auto projection = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION); - auto modelview = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); + const auto& projection = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION); + const auto& modelview = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); *transformOut = projection * modelview; } @@ -775,24 +782,24 @@ Vec2 Director::convertToUI(const Vec2& glPoint) Vec4 glCoord(glPoint.x, glPoint.y, 0.0, 1); transform.transformVector(glCoord, &clipCoord); - /* - BUG-FIX #5506 + /* + BUG-FIX #5506 - a = (Vx, Vy, Vz, 1) - b = (a×M)T - Out = 1 ⁄ bw(bx, by, bz) - */ + a = (Vx, Vy, Vz, 1) + b = (a×M)T + Out = 1 ⁄ bw(bx, by, bz) + */ - clipCoord.x = clipCoord.x / clipCoord.w; - clipCoord.y = clipCoord.y / clipCoord.w; - clipCoord.z = clipCoord.z / clipCoord.w; + clipCoord.x = clipCoord.x / clipCoord.w; + clipCoord.y = clipCoord.y / clipCoord.w; + clipCoord.z = clipCoord.z / clipCoord.w; Size glSize = _openGLView->getDesignResolutionSize(); float factor = 1.0f / glCoord.w; return Vec2(glSize.width * (clipCoord.x * 0.5f + 0.5f) * factor, glSize.height * (-clipCoord.y * 0.5f + 0.5f) * factor); } -const Size& Director::getWinSize(void) const +const Size& Director::getWinSize() const { return _winSizeInPoints; } @@ -905,7 +912,7 @@ void Director::pushScene(Scene *scene) _nextScene = scene; } -void Director::popScene(void) +void Director::popScene() { CCASSERT(_runningScene != nullptr, "running scene should not null"); @@ -930,7 +937,7 @@ void Director::popScene(void) } } -void Director::popToRootScene(void) +void Director::popToRootScene() { popToSceneStackLevel(1); } @@ -1058,7 +1065,11 @@ void Director::reset() } } #endif // CC_ENABLE_GC_FOR_NATIVE_OBJECTS - _scenesStack.clear(); + + while (!_scenesStack.empty()) + { + _scenesStack.popBack(); + } stopAnimation(); @@ -1099,7 +1110,9 @@ void Director::reset() // cocos2d-x specific data structures UserDefault::destroyInstance(); - resetMatrixStack(); + + GL::invalidateStateCache(); + RenderState::finalize(); destroyTextureCache(); @@ -1117,10 +1130,7 @@ void Director::purgeDirector() _openGLView->end(); _openGLView = nullptr; } - -#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID - EngineDataManager::destroy(); -#endif + // delete Director release(); } @@ -1202,7 +1212,7 @@ void Director::pause() _oldAnimationInterval = _animationInterval; // when paused, don't consume CPU - setAnimationInterval(1 / 4.0, SetIntervalReason::BY_DIRECTOR_PAUSE); + setAnimationInterval(1 / 4.0); _paused = true; } @@ -1213,7 +1223,7 @@ void Director::resume() return; } - setAnimationInterval(_oldAnimationInterval, SetIntervalReason::BY_ENGINE); + setAnimationInterval(_oldAnimationInterval); _paused = false; _deltaTime = 0; @@ -1333,8 +1343,7 @@ void Director::createStatsLabel() Image* image = new (std::nothrow) Image(); bool isOK = image ? image->initWithImageData(data, dataLength) : false; if (! isOK) { - if(image) - delete image; + delete image; CCLOGERROR("%s", "Fails: init fps_images"); return; } @@ -1392,18 +1401,19 @@ void Director::setContentScaleFactor(float scaleFactor) void Director::setNotificationNode(Node *node) { - if (_notificationNode != nullptr){ - _notificationNode->onExitTransitionDidStart(); - _notificationNode->onExit(); - _notificationNode->cleanup(); - } - CC_SAFE_RELEASE(_notificationNode); - - _notificationNode = node; - if (node == nullptr) - return; - _notificationNode->onEnter(); - _notificationNode->onEnterTransitionDidFinish(); + if (_notificationNode != nullptr) + { + _notificationNode->onExitTransitionDidStart(); + _notificationNode->onExit(); + _notificationNode->cleanup(); + } + CC_SAFE_RELEASE(_notificationNode); + + _notificationNode = node; + if (node == nullptr) + return; + _notificationNode->onEnter(); + _notificationNode->onEnterTransitionDidFinish(); CC_SAFE_RETAIN(_notificationNode); } @@ -1438,11 +1448,6 @@ void Director::setEventDispatcher(EventDispatcher* dispatcher) } void Director::startAnimation() -{ - startAnimation(SetIntervalReason::BY_ENGINE); -} - -void Director::startAnimation(SetIntervalReason reason) { _lastUpdate = std::chrono::steady_clock::now(); @@ -1450,7 +1455,7 @@ void Director::startAnimation(SetIntervalReason reason) _cocos2d_thread_id = std::this_thread::get_id(); - Application::getInstance()->setAnimationInterval(_animationInterval, reason); + Application::getInstance()->setAnimationInterval(_animationInterval); // fix issue #3509, skip one fps to avoid incorrect time calculation. setNextDeltaTimeZero(true); @@ -1490,17 +1495,12 @@ void Director::stopAnimation() } void Director::setAnimationInterval(float interval) -{ - setAnimationInterval(interval, SetIntervalReason::BY_GAME); -} - -void Director::setAnimationInterval(float interval, SetIntervalReason reason) { _animationInterval = interval; if (! _invalid) { stopAnimation(); - startAnimation(reason); + startAnimation(); } } diff --git a/cocos/base/CCDirector.h b/cocos/base/CCDirector.h index 6aaef8341e1b..48fd373dd754 100644 --- a/cocos/base/CCDirector.h +++ b/cocos/base/CCDirector.h @@ -320,7 +320,7 @@ class CC_DLL Director : public Ref If level is 1, it will pop all scenes until it reaches to root scene. If level is <= than the current stack level, it won't do anything. */ - void popToSceneStackLevel(int level); + void popToSceneStackLevel(int level); /** Replaces the running scene with a new one. The running scene is terminated. * ONLY call it if there is a running scene. @@ -375,7 +375,7 @@ class CC_DLL Director : public Ref */ void purgeCachedData(); - /** Sets the default values based on the Configuration info. */ + /** Sets the default values based on the Configuration info. */ void setDefaultValues(); // OpenGL Helper @@ -395,6 +395,11 @@ class CC_DLL Director : public Ref */ void setClearColor(const Color4F& clearColor); + /** Gets clear values for the color buffers. + * @js NA + */ + const Color4F& getClearColor() const; + /** Enables/disables OpenGL depth test. */ void setDepthTest(bool on); @@ -585,10 +590,6 @@ class CC_DLL Director : public Ref protected: void reset(); - - - virtual void startAnimation(SetIntervalReason reason); - virtual void setAnimationInterval(float interval, SetIntervalReason reason); void purgeDirector(); bool _purgeDirectorInNextLoop = false; // this flag will be set to true in end() diff --git a/cocos/base/CCEventDispatcher.cpp b/cocos/base/CCEventDispatcher.cpp index 812a29cd3fb8..ebf6c26c345f 100644 --- a/cocos/base/CCEventDispatcher.cpp +++ b/cocos/base/CCEventDispatcher.cpp @@ -1005,7 +1005,7 @@ void EventDispatcher::dispatchTouchEvent(EventTouch* event) } } } - else if (listener->_claimedTouches.size() > 0 + else if (!listener->_claimedTouches.empty() && ((removedIter = std::find(listener->_claimedTouches.begin(), listener->_claimedTouches.end(), touches)) != listener->_claimedTouches.end())) { isClaimed = true; @@ -1082,7 +1082,7 @@ void EventDispatcher::dispatchTouchEvent(EventTouch* event) // // process standard handlers 2nd // - if (allAtOnceListeners && mutableTouches.size() > 0) + if (allAtOnceListeners && !mutableTouches.empty()) { auto onTouchesEvent = [&](EventListener* l) -> bool{ diff --git a/cocos/base/CCEventMouse.cpp b/cocos/base/CCEventMouse.cpp index 8e3f17f5d0ae..6ea631317d97 100644 --- a/cocos/base/CCEventMouse.cpp +++ b/cocos/base/CCEventMouse.cpp @@ -39,7 +39,7 @@ EventMouse::EventMouse(MouseEventType mouseEventCode) , _scrollY(0.0f) , _startPointCaptured(false) { -}; +} // returns the current touch location in screen coordinates Vec2 EventMouse::getLocationInView() const diff --git a/cocos/base/CCIMEDelegate.h b/cocos/base/CCIMEDelegate.h index 3c73ba2d96f6..8c10edcb527a 100644 --- a/cocos/base/CCIMEDelegate.h +++ b/cocos/base/CCIMEDelegate.h @@ -46,12 +46,12 @@ extern const std::string CC_DLL STD_STRING_EMPTY; /** * Keyboard notification event type. */ -typedef struct +struct IMEKeyboardNotificationInfo { Rect begin; // the soft keyboard rectangle when animation begins Rect end; // the soft keyboard rectangle when animation ends float duration; // the soft keyboard animation duration -} IMEKeyboardNotificationInfo; +}; /** *@brief Input method editor delegate. @@ -60,21 +60,21 @@ class CC_DLL IMEDelegate { public: /** - * Default constructor. + * Destructor. * @js NA * @lua NA */ virtual ~IMEDelegate(); /** - * Default destructor. + * Attach the delegate to IME. Return true if succesful. * @js NA * @lua NA */ virtual bool attachWithIME(); /** - * Determine whether the IME is detached or not. + * Detach the delegate from IME. Return true if succesful. * @js NA * @lua NA */ @@ -166,6 +166,7 @@ class CC_DLL IMEDelegate protected: /** + * Default constructor. * @js NA * @lua NA */ diff --git a/cocos/base/CCIMEDispatcher.cpp b/cocos/base/CCIMEDispatcher.cpp index a0f674dc3b8b..8afd81a6e166 100644 --- a/cocos/base/CCIMEDispatcher.cpp +++ b/cocos/base/CCIMEDispatcher.cpp @@ -63,32 +63,19 @@ typedef std::list< IMEDelegate * >::iterator DelegateIter; // Delegate List manage class ////////////////////////////////////////////////////////////////////////// -class IMEDispatcher::Impl +struct IMEDispatcher::Impl { -public: - Impl() + Impl() : _delegateWithIme(nullptr) { } - ~Impl() - { - - } - - void init() - { - _delegateWithIme = 0; - } - DelegateIter findDelegate(IMEDelegate* delegate) { DelegateIter end = _delegateList.end(); for (DelegateIter iter = _delegateList.begin(); iter != end; ++iter) { if (delegate == *iter) - { return iter; - } } return end; } @@ -104,7 +91,6 @@ class IMEDispatcher::Impl IMEDispatcher::IMEDispatcher() : _impl(new IMEDispatcher::Impl) { - _impl->init(); } IMEDispatcher::~IMEDispatcher() @@ -137,11 +123,8 @@ bool IMEDispatcher::attachDelegateWithIME(IMEDelegate * delegate) { CC_BREAK_IF(! _impl || ! delegate); - DelegateIter end = _impl->_delegateList.end(); - DelegateIter iter = _impl->findDelegate(delegate); - // if pDelegate is not in delegate list, return - CC_BREAK_IF(end == iter); + CC_BREAK_IF(_impl->findDelegate(delegate) == _impl->_delegateList.end()); if (_impl->_delegateWithIme) { @@ -155,10 +138,9 @@ bool IMEDispatcher::attachDelegateWithIME(IMEDelegate * delegate) // detach first IMEDelegate * oldDelegate = _impl->_delegateWithIme; - _impl->_delegateWithIme = 0; oldDelegate->didDetachWithIME(); - _impl->_delegateWithIme = *iter; + _impl->_delegateWithIme = delegate; delegate->didAttachWithIME(); } ret = true; @@ -168,7 +150,7 @@ bool IMEDispatcher::attachDelegateWithIME(IMEDelegate * delegate) // delegate hasn't attached to IME yet CC_BREAK_IF(! delegate->canAttachWithIME()); - _impl->_delegateWithIme = *iter; + _impl->_delegateWithIme = delegate; delegate->didAttachWithIME(); ret = true; } while (0); @@ -204,8 +186,6 @@ void IMEDispatcher::removeDelegate(IMEDelegate* delegate) DelegateIter end = _impl->_delegateList.end(); CC_BREAK_IF(end == iter); - if (_impl->_delegateWithIme) - if (*iter == _impl->_delegateWithIme) { _impl->_delegateWithIme = 0; @@ -266,6 +246,11 @@ const std::string& IMEDispatcher::getContentText() return STD_STRING_EMPTY; } +bool IMEDispatcher::isAnyDelegateAttachedWithIME() const +{ + return _impl ? _impl->_delegateWithIme != nullptr : false; +} + ////////////////////////////////////////////////////////////////////////// // dispatch keyboard message ////////////////////////////////////////////////////////////////////////// @@ -274,15 +259,10 @@ void IMEDispatcher::dispatchKeyboardWillShow(IMEKeyboardNotificationInfo& info) { if (_impl) { - IMEDelegate * delegate = nullptr; - DelegateIter last = _impl->_delegateList.end(); - for (DelegateIter first = _impl->_delegateList.begin(); first != last; ++first) + for (IMEDelegate *delegate : _impl->_delegateList) { - delegate = *(first); if (delegate) - { delegate->keyboardWillShow(info); - } } } } @@ -291,15 +271,10 @@ void IMEDispatcher::dispatchKeyboardDidShow(IMEKeyboardNotificationInfo& info) { if (_impl) { - IMEDelegate * delegate = nullptr; - DelegateIter last = _impl->_delegateList.end(); - for (DelegateIter first = _impl->_delegateList.begin(); first != last; ++first) + for (IMEDelegate *delegate : _impl->_delegateList) { - delegate = *(first); if (delegate) - { delegate->keyboardDidShow(info); - } } } } @@ -308,15 +283,10 @@ void IMEDispatcher::dispatchKeyboardWillHide(IMEKeyboardNotificationInfo& info) { if (_impl) { - IMEDelegate * delegate = nullptr; - DelegateIter last = _impl->_delegateList.end(); - for (DelegateIter first = _impl->_delegateList.begin(); first != last; ++first) + for (IMEDelegate *delegate : _impl->_delegateList) { - delegate = *(first); if (delegate) - { delegate->keyboardWillHide(info); - } } } } @@ -325,15 +295,10 @@ void IMEDispatcher::dispatchKeyboardDidHide(IMEKeyboardNotificationInfo& info) { if (_impl) { - IMEDelegate * delegate = nullptr; - DelegateIter last = _impl->_delegateList.end(); - for (DelegateIter first = _impl->_delegateList.begin(); first != last; ++first) + for (IMEDelegate *delegate : _impl->_delegateList) { - delegate = *(first); if (delegate) - { delegate->keyboardDidHide(info); - } } } } diff --git a/cocos/base/CCIMEDispatcher.h b/cocos/base/CCIMEDispatcher.h index d56bb920b009..bb6aa10fa89c 100644 --- a/cocos/base/CCIMEDispatcher.h +++ b/cocos/base/CCIMEDispatcher.h @@ -78,6 +78,11 @@ class CC_DLL IMEDispatcher * @lua NA */ const std::string& getContentText(); + + /** + *@brief Returns if any delegate is attached with IME. + */ + bool isAnyDelegateAttachedWithIME() const; ////////////////////////////////////////////////////////////////////////// // dispatch keyboard notification @@ -133,7 +138,7 @@ class CC_DLL IMEDispatcher private: IMEDispatcher(); - class Impl; + struct Impl; Impl * _impl; }; diff --git a/cocos/base/CCProfiling.cpp b/cocos/base/CCProfiling.cpp index 10803eb2d61d..85a89df8a234 100644 --- a/cocos/base/CCProfiling.cpp +++ b/cocos/base/CCProfiling.cpp @@ -51,7 +51,7 @@ Profiler* Profiler::getInstance() } // FIXME:: deprecated -Profiler* Profiler::sharedProfiler(void) +Profiler* Profiler::sharedProfiler() { return Profiler::getInstance(); } @@ -81,7 +81,7 @@ bool Profiler::init() return true; } -Profiler::~Profiler(void) +Profiler::~Profiler() { } @@ -112,7 +112,7 @@ bool ProfilingTimer::initWithName(const char* timerName) return true; } -ProfilingTimer::~ProfilingTimer(void) +ProfilingTimer::~ProfilingTimer() { } diff --git a/cocos/base/CCProfiling.h b/cocos/base/CCProfiling.h index cb0ddecc4319..de331e563c61 100644 --- a/cocos/base/CCProfiling.h +++ b/cocos/base/CCProfiling.h @@ -57,30 +57,30 @@ class CC_DLL Profiler : public Ref * @js NA * @lua NA */ - ~Profiler(void); + ~Profiler(); /** display the timers * @js NA * @lua NA */ - void displayTimers(void); + void displayTimers(); /** * @js NA * @lua NA */ - bool init(void); + bool init(); public: /** returns the singleton * @js NA * @lua NA */ - static Profiler* getInstance(void); + static Profiler* getInstance(); /** * @js NA * @lua NA */ - CC_DEPRECATED_ATTRIBUTE static Profiler* sharedProfiler(void); + CC_DEPRECATED_ATTRIBUTE static Profiler* sharedProfiler(); /** Creates and adds a new timer * @js NA @@ -113,7 +113,7 @@ class ProfilingTimer : public Ref * @js NA * @lua NA */ - ~ProfilingTimer(void); + ~ProfilingTimer(); /** * @js NA * @lua NA diff --git a/cocos/base/CCProperties.cpp b/cocos/base/CCProperties.cpp index a2babc24a561..a60be805b5ab 100644 --- a/cocos/base/CCProperties.cpp +++ b/cocos/base/CCProperties.cpp @@ -88,14 +88,14 @@ Properties::Properties(Data* data, ssize_t* dataIdx, const std::string& name, co Properties* Properties::createNonRefCounted(const std::string& url) { - if (url.size() == 0) + if (url.empty()) { CCLOGERROR("Attempting to create a Properties object from an empty URL!"); return nullptr; } // Calculate the file and full namespace path from the specified url. - std::string urlString = url; + const std::string& urlString = url; std::string fileString; std::vector namespacePath; calculateNamespacePath(urlString, fileString, namespacePath); @@ -139,8 +139,8 @@ static bool isVariable(const char* str, char* outName, size_t outSize) size_t size = len - 3; if (size > (outSize - 1)) size = outSize - 1; - strncpy(outName, str + 2, len - 3); - outName[len - 3] = 0; + strncpy(outName, str + 2, size); + outName[size] = 0; return true; } @@ -235,7 +235,7 @@ void Properties::readProperties() else { // Normal name/value pair - _properties.push_back(Property(name, value)); + _properties.emplace_back(name, value); } } else @@ -383,11 +383,11 @@ void Properties::readProperties() // Store "name value" as a name/value pair, or even just "name". if (value != NULL) { - _properties.push_back(Property(name, value)); + _properties.emplace_back(name, value); } else { - _properties.push_back(Property(name, "")); + _properties.emplace_back(name, ""); } } } @@ -832,7 +832,7 @@ bool Properties::setString(const char* name, const char* value) } // There is no property with this name, so add one - _properties.push_back(Property(name, value ? value : "")); + _properties.emplace_back(name, value ? value : ""); } else { @@ -1117,12 +1117,12 @@ void calculateNamespacePath(const std::string& urlString, std::string& fileStrin { // If the url references a specific namespace within the file, // calculate the full namespace path to the final namespace. - size_t loc = urlString.rfind("#"); + size_t loc = urlString.rfind('#'); if (loc != std::string::npos) { fileString = urlString.substr(0, loc); std::string namespacePathString = urlString.substr(loc + 1); - while ((loc = namespacePathString.find("/")) != std::string::npos) + while ((loc = namespacePathString.find('/')) != std::string::npos) { namespacePath.push_back(namespacePathString.substr(0, loc)); namespacePathString = namespacePathString.substr(loc + 1); @@ -1139,7 +1139,7 @@ Properties* getPropertiesFromNamespacePath(Properties* properties, const std::ve { // If the url references a specific namespace within the file, // return the specified namespace or notify the user if it cannot be found. - if (namespacePath.size() > 0) + if (!namespacePath.empty()) { size_t size = namespacePath.size(); properties->rewind(); diff --git a/cocos/base/CCProtocols.h b/cocos/base/CCProtocols.h index 7501a802854a..ae8c9b3b3170 100644 --- a/cocos/base/CCProtocols.h +++ b/cocos/base/CCProtocols.h @@ -236,7 +236,7 @@ class CC_DLL LabelProtocol /** * Sets a new label using a string * - * @param label A null terminated string + * @param label The name of the new label. * @js NA * @lua NA */ diff --git a/cocos/base/CCRef.cpp b/cocos/base/CCRef.cpp index d64b2181cc25..342582913ffc 100644 --- a/cocos/base/CCRef.cpp +++ b/cocos/base/CCRef.cpp @@ -64,15 +64,15 @@ Ref::Ref() Ref::~Ref() { #if CC_ENABLE_SCRIPT_BINDING - // if the object is referenced by Lua engine, remove it - if (_luaID) + ScriptEngineProtocol* pEngine = ScriptEngineManager::getInstance()->getScriptEngine(); + if (pEngine != nullptr && _luaID) { - ScriptEngineManager::getInstance()->getScriptEngine()->removeScriptObjectByObject(this); + // if the object is referenced by Lua engine, remove it + pEngine->removeScriptObjectByObject(this); } #if !CC_ENABLE_GC_FOR_NATIVE_OBJECTS else { - ScriptEngineProtocol* pEngine = ScriptEngineManager::getInstance()->getScriptEngine(); if (pEngine != nullptr && pEngine->getScriptType() == kScriptTypeJavascript) { pEngine->removeScriptObjectByObject(this); diff --git a/cocos/base/CCScheduler.cpp b/cocos/base/CCScheduler.cpp index 34e4805a6535..270742f8635c 100644 --- a/cocos/base/CCScheduler.cpp +++ b/cocos/base/CCScheduler.cpp @@ -250,7 +250,7 @@ const int Scheduler::PRIORITY_SYSTEM = INT_MIN; // Minimum priority level for user scheduling. const int Scheduler::PRIORITY_NON_SYSTEM_MIN = PRIORITY_SYSTEM + 1; -Scheduler::Scheduler(void) +Scheduler::Scheduler() : _timeScale(1.0f) , _updatesNegList(nullptr) , _updates0List(nullptr) @@ -268,7 +268,7 @@ Scheduler::Scheduler(void) _functionsToPerform.reserve(30); } -Scheduler::~Scheduler(void) +Scheduler::~Scheduler() { unscheduleAll(); } @@ -570,7 +570,7 @@ void Scheduler::unscheduleUpdate(void *target) this->removeUpdateFromHash(element->entry); } -void Scheduler::unscheduleAll(void) +void Scheduler::unscheduleAll() { unscheduleAllWithMinPriority(PRIORITY_SYSTEM); } diff --git a/cocos/base/CCScheduler.h b/cocos/base/CCScheduler.h index e10b72aeee4c..9b62a4305934 100644 --- a/cocos/base/CCScheduler.h +++ b/cocos/base/CCScheduler.h @@ -473,7 +473,7 @@ class CC_DLL Scheduler : public Ref @since v0.99.3 */ template - CC_DEPRECATED_ATTRIBUTE void scheduleUpdateForTarget(T* target, int priority, bool paused) { scheduleUpdate(target, priority, paused); }; + CC_DEPRECATED_ATTRIBUTE void scheduleUpdateForTarget(T* target, int priority, bool paused) { scheduleUpdate(target, priority, paused); } /** Unschedule a selector for a given target. If you want to unschedule the "update", use unscheduleUpdateForTarget. @@ -488,13 +488,13 @@ class CC_DLL Scheduler : public Ref @since v0.99.3 @js NA */ - CC_DEPRECATED_ATTRIBUTE bool isScheduledForTarget(Ref *target, SEL_SCHEDULE selector) { return isScheduled(selector, target); }; + CC_DEPRECATED_ATTRIBUTE bool isScheduledForTarget(Ref *target, SEL_SCHEDULE selector) { return isScheduled(selector, target); } /** Unschedules the update selector for a given target @deprecated Please use 'Scheduler::unscheduleUpdate' instead. @since v0.99.3 */ - CC_DEPRECATED_ATTRIBUTE void unscheduleUpdateForTarget(Ref *target) { return unscheduleUpdate(target); }; + CC_DEPRECATED_ATTRIBUTE void unscheduleUpdateForTarget(Ref *target) { return unscheduleUpdate(target); } protected: diff --git a/cocos/base/CCScriptSupport.cpp b/cocos/base/CCScriptSupport.cpp index bb101abca41f..f6feca315508 100644 --- a/cocos/base/CCScriptSupport.cpp +++ b/cocos/base/CCScriptSupport.cpp @@ -53,7 +53,7 @@ ScriptHandlerEntry* ScriptHandlerEntry::create(int handler) return entry; } -ScriptHandlerEntry::~ScriptHandlerEntry(void) +ScriptHandlerEntry::~ScriptHandlerEntry() { if (_handler != 0 ) { @@ -83,7 +83,7 @@ bool SchedulerScriptHandlerEntry::init(float interval, bool paused) return true; } -SchedulerScriptHandlerEntry::~SchedulerScriptHandlerEntry(void) +SchedulerScriptHandlerEntry::~SchedulerScriptHandlerEntry() { _timer->release(); LUALOG("[LUA] DEL script schedule %d, entryID: %d", _handler, _entryId); @@ -104,7 +104,7 @@ TouchScriptHandlerEntry* TouchScriptHandlerEntry::create(int handler, return entry; } -TouchScriptHandlerEntry::~TouchScriptHandlerEntry(void) +TouchScriptHandlerEntry::~TouchScriptHandlerEntry() { } @@ -123,7 +123,7 @@ bool TouchScriptHandlerEntry::init(bool isMultiTouches, int priority, bool swall static ScriptEngineManager* s_pSharedScriptEngineManager = nullptr; -ScriptEngineManager::~ScriptEngineManager(void) +ScriptEngineManager::~ScriptEngineManager() { removeScriptEngine(); } @@ -137,7 +137,7 @@ void ScriptEngineManager::setScriptEngine(ScriptEngineProtocol *scriptEngine) } } -void ScriptEngineManager::removeScriptEngine(void) +void ScriptEngineManager::removeScriptEngine() { if (_scriptEngine) { diff --git a/cocos/base/CCScriptSupport.h b/cocos/base/CCScriptSupport.h index 68792e5a71c7..f18e0b334ed2 100644 --- a/cocos/base/CCScriptSupport.h +++ b/cocos/base/CCScriptSupport.h @@ -92,7 +92,7 @@ class ScriptHandlerEntry : public Ref * @lua NA * @js NA */ - int getHandler(void) { + int getHandler() { return _handler; } @@ -103,7 +103,7 @@ class ScriptHandlerEntry : public Ref * @lua NA * @js NA */ - int getEntryId(void) { + int getEntryId() { return _entryId; } @@ -154,7 +154,7 @@ class SchedulerScriptHandlerEntry : public ScriptHandlerEntry * @js NA * @lua NA */ - TimerScriptHandler* getTimer(void) { + TimerScriptHandler* getTimer() { return _timer; } @@ -165,7 +165,7 @@ class SchedulerScriptHandlerEntry : public ScriptHandlerEntry * @js NA * @lua NA */ - bool isPaused(void) { + bool isPaused() { return _paused; } /** @@ -173,7 +173,7 @@ class SchedulerScriptHandlerEntry : public ScriptHandlerEntry * @js NA * @lua NA */ - void markedForDeletion(void) { + void markedForDeletion() { _markedForDeletion = true; } /** @@ -183,7 +183,7 @@ class SchedulerScriptHandlerEntry : public ScriptHandlerEntry * @js NA * @lua NA */ - bool isMarkedForDeletion(void) { + bool isMarkedForDeletion() { return _markedForDeletion; } @@ -215,15 +215,15 @@ class TouchScriptHandlerEntry : public ScriptHandlerEntry virtual ~TouchScriptHandlerEntry(); - bool isMultiTouches(void) { + bool isMultiTouches() { return _isMultiTouches; } - int getPriority(void) { + int getPriority() { return _priority; } - bool getSwallowsTouches(void) { + bool getSwallowsTouches() { return _swallowsTouches; } @@ -824,7 +824,7 @@ class CC_DLL ScriptEngineManager * @lua NA * @js NA */ - ~ScriptEngineManager(void); + ~ScriptEngineManager(); /** * Get the ScriptEngineProtocol object. * @@ -833,7 +833,7 @@ class CC_DLL ScriptEngineManager * @lua NA * @js NA */ - ScriptEngineProtocol* getScriptEngine(void) { + ScriptEngineProtocol* getScriptEngine() { return _scriptEngine; } /** @@ -853,7 +853,7 @@ class CC_DLL ScriptEngineManager * @lua NA * @js NA */ - void removeScriptEngine(void); + void removeScriptEngine(); /** * Get the instance of ScriptEngineManager object. * @@ -917,7 +917,7 @@ class CC_DLL ScriptEngineManager CC_DEPRECATED_ATTRIBUTE static void purgeSharedManager() { ScriptEngineManager::destroyInstance(); }; private: - ScriptEngineManager(void) + ScriptEngineManager() : _scriptEngine(nullptr) { } diff --git a/cocos/base/CCStencilStateManager.cpp b/cocos/base/CCStencilStateManager.cpp index c5742fa0a0f2..2747fed9c0b8 100644 --- a/cocos/base/CCStencilStateManager.cpp +++ b/cocos/base/CCStencilStateManager.cpp @@ -27,6 +27,7 @@ #include "base/CCStencilStateManager.h" #include "base/CCDirector.h" #include "renderer/CCGLProgramCache.h" +#include "renderer/ccGLStateCache.h" #include "renderer/CCRenderer.h" #include "renderer/CCRenderState.h" #if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 || CC_TARGET_PLATFORM == CC_PLATFORM_LINUX) @@ -88,7 +89,7 @@ void StencilStateManager::drawFullScreenQuadClearStencil() glProgram->setUniformLocationWith4fv(colorLocation, (GLfloat*) &color.r, 1); glBindBuffer(GL_ARRAY_BUFFER, 0); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION); + GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION ); glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices); glDrawArrays(GL_TRIANGLE_FAN, 0, 4); diff --git a/cocos/base/CCUserDefault.cpp b/cocos/base/CCUserDefault.cpp index 37467017beab..ff88a3ec29df 100644 --- a/cocos/base/CCUserDefault.cpp +++ b/cocos/base/CCUserDefault.cpp @@ -195,7 +195,7 @@ bool UserDefault::getBoolForKey(const char* pKey, bool defaultValue) ret = (! strcmp(value, "true")); } - if (doc) delete doc; + delete doc; return ret; } @@ -225,10 +225,7 @@ int UserDefault::getIntegerForKey(const char* pKey, int defaultValue) ret = atoi(value); } - if(doc) - { - delete doc; - } + delete doc; return ret; @@ -271,7 +268,7 @@ double UserDefault::getDoubleForKey(const char* pKey, double defaultValue) ret = utils::atof(value); } - if (doc) delete doc; + delete doc; return ret; } @@ -301,7 +298,7 @@ string UserDefault::getStringForKey(const char* pKey, const std::string & defaul ret = string(value); } - if (doc) delete doc; + delete doc; return ret; } @@ -324,7 +321,7 @@ Data UserDefault::getDataForKey(const char* pKey, const Data& defaultValue) encodedData = (const char*)(node->FirstChild()->Value()); } - Data ret = defaultValue; + Data ret; if (encodedData) { @@ -335,8 +332,12 @@ Data UserDefault::getDataForKey(const char* pKey, const Data& defaultValue) ret.fastSet(decodedData, decodedDataLen); } } + else + { + ret = defaultValue; + } - if (doc) delete doc; + delete doc; return ret; } @@ -447,8 +448,7 @@ void UserDefault::destroyInstance() void UserDefault::setDelegate(UserDefault *delegate) { - if (_userDefault) - delete _userDefault; + delete _userDefault; _userDefault = delegate; } diff --git a/cocos/base/CMakeLists.txt b/cocos/base/CMakeLists.txt index 4187875d5423..26ce44668d55 100644 --- a/cocos/base/CMakeLists.txt +++ b/cocos/base/CMakeLists.txt @@ -10,7 +10,7 @@ elseif(ANDROID) base/CCUserDefault-android.cpp base/CCController-android.cpp ) -elseif(LINUX) +elseif(LINUX OR WINDOWS) set(COCOS_BASE_SPECIFIC_SRC base/CCController-linux-win32.cpp ) diff --git a/cocos/base/ObjectFactory.cpp b/cocos/base/ObjectFactory.cpp index 744aebcace9f..07962851994b 100644 --- a/cocos/base/ObjectFactory.cpp +++ b/cocos/base/ObjectFactory.cpp @@ -23,70 +23,28 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ -#include #include "base/ObjectFactory.h" +#include NS_CC_BEGIN -ObjectFactory::TInfo::TInfo(void) -:_class("") -,_fun(nullptr) -,_func(nullptr) -{ -} - ObjectFactory::TInfo::TInfo(const std::string& type, Instance ins) :_class(type) ,_fun(ins) -,_func(nullptr) { ObjectFactory::getInstance()->registerType(*this); } -ObjectFactory::TInfo::TInfo(const std::string& type, InstanceFunc ins) - :_class(type) - ,_fun(nullptr) - ,_func(ins) +ObjectFactory::TInfo::TInfo(const std::string& type, const InstanceFunc& ins) +:_class(type) +,_func(ins) { ObjectFactory::getInstance()->registerType(*this); } -ObjectFactory::TInfo::TInfo(const TInfo &t) -{ - _class = t._class; - _fun = t._fun; - _func = t._func; -} - -ObjectFactory::TInfo::~TInfo(void) -{ - _class = ""; - _fun = nullptr; - _func = nullptr; -} - -ObjectFactory::TInfo& ObjectFactory::TInfo::operator= (const TInfo &t) -{ - _class = t._class; - _fun = t._fun; - _func = t._func; - return *this; -} - - ObjectFactory* ObjectFactory::_sharedFactory = nullptr; -ObjectFactory::ObjectFactory(void) -{ - -} - -ObjectFactory::~ObjectFactory(void) -{ - _typeMap.clear(); -} - ObjectFactory* ObjectFactory::getInstance() { if ( nullptr == _sharedFactory) @@ -103,20 +61,14 @@ void ObjectFactory::destroyInstance() Ref* ObjectFactory::createObject(const std::string &name) { - Ref *o = nullptr; - do - { - const TInfo t = _typeMap[name]; - if (t._fun != nullptr) - { - o = t._fun(); - }else if (t._func != nullptr) - { - o = t._func(); - } - } while (0); - - return o; + const TInfo t = _typeMap[name]; + if (t._fun != nullptr) { + return t._fun(); + } + if (t._func != nullptr) { + return t._func(); + } + return nullptr; } void ObjectFactory::registerType(const TInfo &t) diff --git a/cocos/base/ObjectFactory.h b/cocos/base/ObjectFactory.h index c29cc94c1624..84de53faa5a5 100644 --- a/cocos/base/ObjectFactory.h +++ b/cocos/base/ObjectFactory.h @@ -26,46 +26,41 @@ THE SOFTWARE. #ifndef __TRIGGERFACTORY_H__ #define __TRIGGERFACTORY_H__ -#include -#include -#include #include "base/CCRef.h" #include "platform/CCPlatformMacros.h" +#include +#include +#include NS_CC_BEGIN class CC_DLL ObjectFactory { public: - typedef cocos2d::Ref* (*Instance)(void); - typedef std::function InstanceFunc; + typedef cocos2d::Ref* (*Instance)(); + typedef std::function InstanceFunc; struct CC_DLL TInfo { - TInfo(void); - TInfo(const std::string& type, Instance ins = nullptr); - TInfo(const std::string& type, InstanceFunc ins = nullptr); - TInfo(const TInfo &t); - ~TInfo(void); - TInfo& operator= (const TInfo &t); + TInfo() = default; + TInfo(const std::string& type, Instance ins); + TInfo(const std::string& type, const InstanceFunc& ins); std::string _class; - Instance _fun; + Instance _fun = nullptr; InstanceFunc _func; }; - typedef std::unordered_map FactoryMap; static ObjectFactory* getInstance(); static void destroyInstance(); - cocos2d::Ref* createObject(const std::string &name); + cocos2d::Ref* createObject(const std::string &name); void registerType(const TInfo &t); - void removeAll(); protected: - ObjectFactory(void); - virtual ~ObjectFactory(void); + ObjectFactory() = default; + virtual ~ObjectFactory() = default; private: static ObjectFactory *_sharedFactory; - FactoryMap _typeMap; + std::unordered_map _typeMap; }; NS_CC_END diff --git a/cocos/base/ZipUtils.cpp b/cocos/base/ZipUtils.cpp index 8f9fa583cc17..f69c263b7bbc 100644 --- a/cocos/base/ZipUtils.cpp +++ b/cocos/base/ZipUtils.cpp @@ -31,6 +31,8 @@ #else // from our embedded sources #include "unzip.h" #endif +#include "ioapi_mem.h" +#include #include #include @@ -42,11 +44,9 @@ #include "platform/CCFileUtils.h" #include -// FIXME: Other platforms should use upstream minizip like mingw-w64 -#ifdef MINIZIP_FROM_SYSTEM +// minizip 1.2.0 is same with other platforms #define unzGoToFirstFile64(A,B,C,D) unzGoToFirstFile2(A,B,C,D, NULL, 0, NULL, 0) #define unzGoToNextFile64(A,B,C,D) unzGoToNextFile2(A,B,C,D, NULL, 0, NULL, 0) -#endif NS_CC_BEGIN @@ -267,7 +267,7 @@ int ZipUtils::inflateGZipFile(const char *path, unsigned char **out) unsigned int totalBufferSize = bufferSize; *out = (unsigned char*)malloc( bufferSize ); - if( ! out ) + if(*out == NULL) { CCLOG("cocos2d: ZipUtils: out of memory"); return -1; @@ -511,6 +511,7 @@ class ZipFilePrivate { public: unzFile zipFile; + std::unique_ptr memfs; // std::unordered_map is faster if available on the platform typedef std::unordered_map FileListContainer; @@ -523,7 +524,7 @@ ZipFile *ZipFile::createWithBuffer(const void* buffer, uLong size) if (zip && zip->initWithBuffer(buffer, size)) { return zip; } else { - if (zip) delete zip; + delete zip; return nullptr; } } @@ -627,7 +628,7 @@ std::vector ZipFile::listFiles(const std::string &pathname) const if(filename.substr(0, dirname.length()) == dirname) { std::string suffix = filename.substr(dirname.length()); - auto pos = suffix.find("/"); + auto pos = suffix.find('/'); if (pos == std::string::npos) { fileSet.insert(suffix); @@ -741,10 +742,17 @@ int ZipFile::getCurrentFileInfo(std::string *filename, unz_file_info *info) bool ZipFile::initWithBuffer(const void *buffer, uLong size) { if (!buffer || size == 0) return false; + + zlib_filefunc_def memory_file = { 0 }; - _data->zipFile = unzOpenBuffer(buffer, size); - if (!_data->zipFile) return false; + std::unique_ptr memfs(new(std::nothrow) ourmemory_t{ (char*)const_cast(buffer), static_cast(size), 0, 0, 0 }); + if (!memfs) return false; + fill_memory_filefunc(&memory_file, memfs.get()); + _data->zipFile = unzOpen2(nullptr, &memory_file); + if (!_data->zipFile) return false; + _data->memfs = std::move(memfs); + setFilter(emptyFilename); return true; } diff --git a/cocos/base/base64.h b/cocos/base/base64.h index 419b6d47b037..abd3369138ea 100644 --- a/cocos/base/base64.h +++ b/cocos/base/base64.h @@ -29,10 +29,6 @@ THE SOFTWARE. /// @cond DO_NOT_SHOW #include "platform/CCPlatformMacros.h" - -#ifdef __cplusplus -extern "C" { -#endif namespace cocos2d { @@ -62,9 +58,6 @@ int CC_DLL base64Encode(const unsigned char *in, unsigned int inLength, char **o }//namespace cocos2d -#ifdef __cplusplus -} -#endif /// @endcond #endif // __SUPPORT_BASE64_H__ diff --git a/cocos/base/ccCArray.cpp b/cocos/base/ccCArray.cpp index 4dab19579416..089cec332f02 100644 --- a/cocos/base/ccCArray.cpp +++ b/cocos/base/ccCArray.cpp @@ -72,9 +72,9 @@ void ccArrayEnsureExtraCapacity(ccArray *arr, ssize_t extra) { while (arr->max < arr->num + extra) { - CCLOGINFO("cocos2d: ccCArray: resizing ccArray capacity from [%d] to [%d].", - static_cast(arr->max), - static_cast(arr->max*2)); + CCLOGINFO("cocos2d: ccCArray: resizing ccArray capacity from [%zd] to [%zd].", + arr->max, + arr->max*2); ccArrayDoubleCapacity(arr); } diff --git a/cocos/base/ccConfig.h b/cocos/base/ccConfig.h index cd21a413c24b..767ee4904429 100644 --- a/cocos/base/ccConfig.h +++ b/cocos/base/ccConfig.h @@ -257,6 +257,18 @@ THE SOFTWARE. #define CC_USE_PHYSICS 1 #endif +#if (CC_USE_PHYSICS) +/** Use chipmunk physics 2d engine. */ +#ifndef CC_ENABLE_CHIPMUNK_INTEGRATION +#define CC_ENABLE_CHIPMUNK_INTEGRATION 1 +#endif + +/** or use box2d physics 2d engine. */ +#ifndef CC_ENABLE_BOX2D_INTEGRATION +#define CC_ENABLE_BOX2D_INTEGRATION 0 +#endif +#endif // CC_USE_PHYSICS + /** Use 3d physics integration API. */ #ifndef CC_USE_3D_PHYSICS #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_LINUX /*|| CC_TARGET_PLATFORM == CC_PLATFORM_WINRT*/) @@ -405,4 +417,6 @@ THE SOFTWARE. #define CC_STRIP_FPS 0 #endif +#define CC_LABEL_MAX_LENGTH ((1<<16)/4) + #endif // __CCCONFIG_H__ diff --git a/cocos/base/ccFPSImages.c b/cocos/base/ccFPSImages.c index ac255b68b6e0..456920a1d057 100644 --- a/cocos/base/ccFPSImages.c +++ b/cocos/base/ccFPSImages.c @@ -2375,7 +2375,7 @@ unsigned char cc_fps_images_png[] = { 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 }; -unsigned int cc_fps_images_len(void) +unsigned int cc_fps_images_len() { return sizeof(cc_fps_images_png); } diff --git a/cocos/base/ccMacros.h b/cocos/base/ccMacros.h index 19ecd29eb688..0c96838b9694 100644 --- a/cocos/base/ccMacros.h +++ b/cocos/base/ccMacros.h @@ -276,7 +276,7 @@ CC_ASSERT(__gl_error_code == GL_NO_ERROR, "Error"); \ /*********************************/ /** 64bits Program Sense Macros **/ /*********************************/ -#if defined(_M_X64) || defined(_WIN64) || defined(__LP64__) || defined(_LP64) || defined(__x86_64) +#if defined(_M_X64) || defined(_WIN64) || defined(__LP64__) || defined(_LP64) || defined(__x86_64) || defined(__arm64__) || defined(__aarch64__) #define CC_64BITS 1 #else #define CC_64BITS 0 diff --git a/cocos/base/ccRandom.h b/cocos/base/ccRandom.h index 4822600a4019..108d54e15ac1 100644 --- a/cocos/base/ccRandom.h +++ b/cocos/base/ccRandom.h @@ -90,7 +90,7 @@ inline double random(double min, double max) { */ inline int random() { return cocos2d::random(0, RAND_MAX); -}; +} /** * Returns a random float between -1 and 1. @@ -104,7 +104,7 @@ inline float rand_minus1_1() { return ((std::rand() / (float)RAND_MAX) * 2) -1; // return cocos2d::random(-1.f, 1.f); -}; +} /** * Returns a random float between 0 and 1. @@ -118,7 +118,7 @@ inline float rand_0_1() { return std::rand() / (float)RAND_MAX; // return cocos2d::random(0.f, 1.f); -}; +} NS_CC_END diff --git a/cocos/base/ccTypes.h b/cocos/base/ccTypes.h index ae30d7939be5..cde02353c859 100644 --- a/cocos/base/ccTypes.h +++ b/cocos/base/ccTypes.h @@ -561,6 +561,7 @@ struct CC_DLL FontDefinition : _fontSize(0) , _alignment(TextHAlignment::CENTER) , _vertAlignment(TextVAlignment::TOP) + , _lineSpacing(0.0f) , _dimensions(Size::ZERO) , _fontFillColor(Color3B::WHITE) , _fontAlpha(255) @@ -575,7 +576,9 @@ struct CC_DLL FontDefinition /// horizontal alignment TextHAlignment _alignment; /// vertical alignment - TextVAlignment _vertAlignment; + TextVAlignment _vertAlignment; + /// line spacing + float _lineSpacing; /// rendering box Size _dimensions; /// font color @@ -631,15 +634,6 @@ class CC_DLL Acceleration extern const std::string CC_DLL STD_STRING_EMPTY; extern const ssize_t CC_DLL CC_INVALID_INDEX; -enum class SetIntervalReason : char -{ - BY_GAME = 0, - BY_ENGINE, - BY_SYSTEM, - BY_SCENE_CHANGE, - BY_DIRECTOR_PAUSE -}; - NS_CC_END // end group /// @} diff --git a/cocos/base/ccUTF8.cpp b/cocos/base/ccUTF8.cpp index b4714493f93a..5b579814e42a 100644 --- a/cocos/base/ccUTF8.cpp +++ b/cocos/base/ccUTF8.cpp @@ -272,7 +272,7 @@ bool utfConvert( to = std::move(working); return true; -}; +} bool UTF8ToUTF16(const std::string& utf8, std::u16string& outUtf16) @@ -526,6 +526,7 @@ long cc_utf8_strlen (const char * p, int /*max*/) unsigned int cc_utf8_find_last_not_char(const std::vector& str, unsigned short c) { std::vector char16Vector; + char16Vector.reserve(str.size()); for (const auto& e : str) { char16Vector.push_back(e); diff --git a/cocos/base/ccUtils.cpp b/cocos/base/ccUtils.cpp index 7d35ab5b7f1f..23c8dfd1e83c 100644 --- a/cocos/base/ccUtils.cpp +++ b/cocos/base/ccUtils.cpp @@ -34,10 +34,10 @@ THE SOFTWARE. #include "base/CCAsyncTaskPool.h" #include "base/CCEventDispatcher.h" #include "base/base64.h" +#include "base/ccUTF8.h" #include "renderer/CCCustomCommand.h" #include "renderer/CCRenderer.h" #include "renderer/CCTextureCache.h" -#include "renderer/CCRenderState.h" #include "platform/CCImage.h" #include "platform/CCFileUtils.h" @@ -125,7 +125,7 @@ void onCaptureScreen(const std::function& afterC } else { - CCASSERT(filename.find("/") == std::string::npos, "The existence of a relative path is not guaranteed!"); + CCASSERT(filename.find('/') == std::string::npos, "The existence of a relative path is not guaranteed!"); outputFile = FileUtils::getInstance()->getWritablePath() + filename; } @@ -527,22 +527,22 @@ LanguageType getLanguageTypeByISO2(const char* code) return ret; } -void setBlending(GLenum sfactor, GLenum dfactor) -{ - if (sfactor == GL_ONE && dfactor == GL_ZERO) - { - glDisable(GL_BLEND); - RenderState::StateBlock::_defaultState->setBlend(false); - } - else - { - glEnable(GL_BLEND); - glBlendFunc(sfactor, dfactor); +std::vector parseIntegerList(const std::string &intsString) { + std::vector result; + + const char *cStr = intsString.c_str(); + char *endptr; - RenderState::StateBlock::_defaultState->setBlend(true); - RenderState::StateBlock::_defaultState->setBlendSrc((RenderState::Blend)sfactor); - RenderState::StateBlock::_defaultState->setBlendDst((RenderState::Blend)dfactor); + for (long int i = strtol(cStr, &endptr, 10); endptr != cStr; i = strtol(cStr, &endptr, 10)) { + if (errno == ERANGE) { + errno = 0; + CCLOGWARN("%s contains out of range integers", intsString.c_str()); + } + result.push_back(static_cast(i)); + cStr= endptr; } + + return result; } } diff --git a/cocos/base/ccUtils.h b/cocos/base/ccUtils.h index a3d11a4872f1..1d34ae3eacfc 100644 --- a/cocos/base/ccUtils.h +++ b/cocos/base/ccUtils.h @@ -189,7 +189,13 @@ namespace utils */ CC_DLL LanguageType getLanguageTypeByISO2(const char* code); - CC_DLL void setBlending(GLenum sfactor, GLenum dfactor); + /** + @brief Parses a list of space-separated integers. + @return Vector of ints. + * @js NA + * @lua NA + */ + CC_DLL std::vector parseIntegerList(const std::string &intsString); } NS_CC_END diff --git a/cocos/cocos2d.cpp b/cocos/cocos2d.cpp index 9e3de492d2cc..6927faea0d7f 100644 --- a/cocos/cocos2d.cpp +++ b/cocos/cocos2d.cpp @@ -32,7 +32,7 @@ NS_CC_BEGIN CC_DLL const char* cocos2dVersion() { - return "cocos2d-x-3.17"; + return "cocos2d-x-3.17.2"; } NS_CC_END diff --git a/cocos/cocos2d.h b/cocos/cocos2d.h index 185c4a4d46d1..f10912b97a28 100644 --- a/cocos/cocos2d.h +++ b/cocos/cocos2d.h @@ -31,7 +31,7 @@ THE SOFTWARE. // 0x00 HI ME LO // 00 03 08 00 -#define COCOS2D_VERSION 0x00031700 +#define COCOS2D_VERSION 0x00031702 // // all cocos2d include files @@ -175,6 +175,7 @@ THE SOFTWARE. #include "renderer/CCVertexIndexBuffer.h" #include "renderer/CCVertexIndexData.h" #include "renderer/CCFrameBuffer.h" +#include "renderer/ccGLStateCache.h" #include "renderer/ccShaders.h" // physics @@ -211,13 +212,6 @@ THE SOFTWARE. //Enhance modification end #endif // CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID -#if (CC_TARGET_PLATFORM == CC_PLATFORM_BLACKBERRY) - #include "platform/blackberry/CCApplication.h" - #include "platform/blackberry/CCGLViewImpl.h" - #include "platform/blackberry/CCGL.h" - #include "platform/blackberry/CCStdC.h" -#endif // CC_TARGET_PLATFORM == CC_PLATFORM_BLACKBERRY - #if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) #include "platform/win32/CCApplication-win32.h" #include "platform/desktop/CCGLViewImpl-desktop.h" @@ -239,20 +233,6 @@ THE SOFTWARE. #include "platform/linux/CCStdC-linux.h" #endif // CC_TARGET_PLATFORM == CC_PLATFORM_LINUX -#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) - #include "platform/winrt/CCApplication.h" - #include "platform/winrt/CCGLViewImpl-winrt.h" - #include "platform/winrt/CCGL.h" - #include "platform/winrt/CCStdC.h" -#endif // CC_TARGET_PLATFORM == CC_PLATFORM_WINRT - -#if (CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN) - #include "platform/tizen/CCApplication-tizen.h" - #include "platform/tizen/CCGLViewImpl-tizen.h" - #include "platform/tizen/CCGL-tizen.h" - #include "platform/tizen/CCStdC-tizen.h" -#endif - // script_support #include "base/CCScriptSupport.h" diff --git a/cocos/deprecated/CCDeprecated.cpp b/cocos/deprecated/CCDeprecated.cpp index 45378c9f9688..fc101c841fef 100644 --- a/cocos/deprecated/CCDeprecated.cpp +++ b/cocos/deprecated/CCDeprecated.cpp @@ -194,17 +194,17 @@ void ccPointSize( GLfloat pointSize ) MATRIX_STACK_TYPE currentActiveStackType = MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW; -void CC_DLL kmGLFreeAll(void) +void CC_DLL kmGLFreeAll() { Director::getInstance()->resetMatrixStack(); } -void CC_DLL kmGLPushMatrix(void) +void CC_DLL kmGLPushMatrix() { Director::getInstance()->pushMatrix(currentActiveStackType); } -void CC_DLL kmGLPopMatrix(void) +void CC_DLL kmGLPopMatrix() { Director::getInstance()->popMatrix(currentActiveStackType); } @@ -223,7 +223,7 @@ void CC_DLL kmGLMatrixMode(unsigned int mode) } } -void CC_DLL kmGLLoadIdentity(void) +void CC_DLL kmGLLoadIdentity() { Director::getInstance()->loadIdentityMatrix(currentActiveStackType); } diff --git a/cocos/deprecated/CCDeprecated.h b/cocos/deprecated/CCDeprecated.h index 8eaa72fb3f15..ca03451bd5c8 100644 --- a/cocos/deprecated/CCDeprecated.h +++ b/cocos/deprecated/CCDeprecated.h @@ -92,6 +92,7 @@ #include "renderer/CCGLProgram.h" #include "renderer/CCGLProgramCache.h" #include "renderer/CCTextureAtlas.h" +#include "renderer/ccGLStateCache.h" NS_CC_BEGIN @@ -904,6 +905,12 @@ CC_DEPRECATED_ATTRIBUTE extern const char* kCCAttributeNameColor; CC_DEPRECATED_ATTRIBUTE extern const char* kCCAttributeNamePosition; CC_DEPRECATED_ATTRIBUTE extern const char* kCCAttributeNameTexCoord; +CC_DEPRECATED_ATTRIBUTE const int kCCVertexAttribFlag_None = GL::VERTEX_ATTRIB_FLAG_NONE; +CC_DEPRECATED_ATTRIBUTE const int kCCVertexAttribFlag_Position = GL::VERTEX_ATTRIB_FLAG_POSITION; +CC_DEPRECATED_ATTRIBUTE const int kCCVertexAttribFlag_Color = GL::VERTEX_ATTRIB_FLAG_COLOR; +CC_DEPRECATED_ATTRIBUTE const int kCCVertexAttribFlag_TexCoords = GL::VERTEX_ATTRIB_FLAG_TEX_COORD; +CC_DEPRECATED_ATTRIBUTE const int kCCVertexAttribFlag_PosColorTex = GL::VERTEX_ATTRIB_FLAG_POS_COLOR_TEX; + CC_DEPRECATED_ATTRIBUTE const ProgressTimer::Type kCCProgressTimerTypeRadial = ProgressTimer::Type::RADIAL; CC_DEPRECATED_ATTRIBUTE const ProgressTimer::Type kCCProgressTimerTypeBar = ProgressTimer::Type::BAR; CC_DEPRECATED_ATTRIBUTE typedef ProgressTimer::Type ProgressTimerType; @@ -1064,7 +1071,19 @@ CC_DEPRECATED_ATTRIBUTE void CC_DLL ccDrawColor4F( GLfloat r, GLfloat g, GLfloat CC_DEPRECATED_ATTRIBUTE void CC_DLL ccPointSize( GLfloat pointSize ); -CC_DEPRECATED_ATTRIBUTE inline void CC_DLL ccGLEnable( int flags ) { /* ignore */ }; +CC_DEPRECATED_ATTRIBUTE inline void CC_DLL ccGLInvalidateStateCache() { GL::invalidateStateCache(); } +CC_DEPRECATED_ATTRIBUTE inline void CC_DLL ccGLUseProgram(GLuint program) { GL::useProgram(program); } +CC_DEPRECATED_ATTRIBUTE inline void CC_DLL ccGLDeleteProgram(GLuint program){ GL::deleteProgram(program); } +CC_DEPRECATED_ATTRIBUTE inline void CC_DLL ccGLBlendFunc(GLenum sfactor, GLenum dfactor) { GL::blendFunc(sfactor, dfactor); } +CC_DEPRECATED_ATTRIBUTE inline void CC_DLL ccGLBlendResetToCache() { GL::blendResetToCache(); } +CC_DEPRECATED_ATTRIBUTE inline void CC_DLL ccSetProjectionMatrixDirty() { GL::setProjectionMatrixDirty(); } +CC_DEPRECATED_ATTRIBUTE inline void CC_DLL ccGLEnableVertexAttribs(unsigned int flags) { GL::enableVertexAttribs(flags); } +CC_DEPRECATED_ATTRIBUTE inline void CC_DLL ccGLBindTexture2D(GLuint textureId) { GL::bindTexture2D(textureId); } +CC_DEPRECATED_ATTRIBUTE inline void CC_DLL ccGLBindTexture2DN(GLuint textureUnit, GLuint textureId) { GL::bindTexture2DN(textureUnit, textureId); } +CC_DEPRECATED_ATTRIBUTE inline void CC_DLL ccGLDeleteTexture(GLuint textureId) { GL::deleteTexture(textureId); } +CC_DEPRECATED_ATTRIBUTE inline void CC_DLL ccGLDeleteTextureN(GLuint textureUnit, GLuint textureId) { GL::deleteTexture(textureId); } +CC_DEPRECATED_ATTRIBUTE inline void CC_DLL ccGLBindVAO(GLuint vaoId) { GL::bindVAO(vaoId); } +CC_DEPRECATED_ATTRIBUTE inline void CC_DLL ccGLEnable( int flags ) { /* ignore */ } CC_DEPRECATED_ATTRIBUTE typedef int ccGLServerState; CC_DEPRECATED_ATTRIBUTE typedef Data CCData; @@ -1103,11 +1122,11 @@ CC_DEPRECATED_ATTRIBUTE const unsigned int KM_GL_MODELVIEW = 0x1700; CC_DEPRECATED_ATTRIBUTE const unsigned int KM_GL_PROJECTION = 0x1701; CC_DEPRECATED_ATTRIBUTE const unsigned int KM_GL_TEXTURE = 0x1702; -CC_DEPRECATED_ATTRIBUTE void CC_DLL kmGLFreeAll(void); -CC_DEPRECATED_ATTRIBUTE void CC_DLL kmGLPushMatrix(void); -CC_DEPRECATED_ATTRIBUTE void CC_DLL kmGLPopMatrix(void); +CC_DEPRECATED_ATTRIBUTE void CC_DLL kmGLFreeAll(); +CC_DEPRECATED_ATTRIBUTE void CC_DLL kmGLPushMatrix(); +CC_DEPRECATED_ATTRIBUTE void CC_DLL kmGLPopMatrix(); CC_DEPRECATED_ATTRIBUTE void CC_DLL kmGLMatrixMode(unsigned int mode); -CC_DEPRECATED_ATTRIBUTE void CC_DLL kmGLLoadIdentity(void); +CC_DEPRECATED_ATTRIBUTE void CC_DLL kmGLLoadIdentity(); CC_DEPRECATED_ATTRIBUTE void CC_DLL kmGLLoadMatrix(const Mat4* pIn); CC_DEPRECATED_ATTRIBUTE void CC_DLL kmGLMultMatrix(const Mat4* pIn); CC_DEPRECATED_ATTRIBUTE void CC_DLL kmGLTranslatef(float x, float y, float z); diff --git a/cocos/deprecated/CCNotificationCenter.cpp b/cocos/deprecated/CCNotificationCenter.cpp index 77a814130c5a..6a1619ee3e91 100644 --- a/cocos/deprecated/CCNotificationCenter.cpp +++ b/cocos/deprecated/CCNotificationCenter.cpp @@ -65,13 +65,13 @@ void __NotificationCenter::destroyInstance() } // FIXME:: deprecated -__NotificationCenter *__NotificationCenter::sharedNotificationCenter(void) +__NotificationCenter *__NotificationCenter::sharedNotificationCenter() { return __NotificationCenter::getInstance(); } // FIXME:: deprecated -void __NotificationCenter::purgeNotificationCenter(void) +void __NotificationCenter::purgeNotificationCenter() { __NotificationCenter::destroyInstance(); } diff --git a/cocos/deprecated/CCNotificationCenter.h b/cocos/deprecated/CCNotificationCenter.h index 2e4a61e886ad..3a183ecdd609 100644 --- a/cocos/deprecated/CCNotificationCenter.h +++ b/cocos/deprecated/CCNotificationCenter.h @@ -64,10 +64,10 @@ class CC_DLL __NotificationCenter : public Ref static void destroyInstance(); /** @deprecated use getInstance() instead */ - CC_DEPRECATED_ATTRIBUTE static __NotificationCenter *sharedNotificationCenter(void); + CC_DEPRECATED_ATTRIBUTE static __NotificationCenter *sharedNotificationCenter(); /** @deprecated use destroyInstance() instead */ - CC_DEPRECATED_ATTRIBUTE static void purgeNotificationCenter(void); + CC_DEPRECATED_ATTRIBUTE static void purgeNotificationCenter(); /** @brief Adds an observer for the specified target. diff --git a/cocos/deprecated/CCSet.cpp b/cocos/deprecated/CCSet.cpp index e602d1de5af5..280c3c74f602 100644 --- a/cocos/deprecated/CCSet.cpp +++ b/cocos/deprecated/CCSet.cpp @@ -30,7 +30,7 @@ using namespace std; NS_CC_BEGIN -__Set::__Set(void) +__Set::__Set() { _set = new (std::nothrow) set; } @@ -52,7 +52,7 @@ __Set::__Set(const __Set &other) } } -__Set::~__Set(void) +__Set::~__Set() { removeAllObjects(); CC_SAFE_DELETE(_set); @@ -75,19 +75,19 @@ __Set * __Set::create() return pRet; } -__Set* __Set::copy(void) +__Set* __Set::copy() { __Set *p__Set = new (std::nothrow) __Set(*this); return p__Set; } -__Set* __Set::mutableCopy(void) +__Set* __Set::mutableCopy() { return copy(); } -int __Set::count(void) +int __Set::count() { return (int)_set->size(); } @@ -135,12 +135,12 @@ bool __Set::containsObject(Ref *pObject) return _set->find(pObject) != _set->end(); } -__SetIterator __Set::begin(void) +__SetIterator __Set::begin() { return _set->begin(); } -__SetIterator __Set::end(void) +__SetIterator __Set::end() { return _set->end(); } diff --git a/cocos/deprecated/CCSet.h b/cocos/deprecated/CCSet.h index f920cf3b345f..f7c2cae7d207 100644 --- a/cocos/deprecated/CCSet.h +++ b/cocos/deprecated/CCSet.h @@ -47,13 +47,13 @@ class CC_DLL __Set : public Ref /** * @js ctor */ - __Set(void); + __Set(); __Set(const __Set &rSetObject); /** * @js NA * @lua NA */ - virtual ~__Set(void); + virtual ~__Set(); /** * @brief Create and return a new empty set. diff --git a/cocos/deprecated/CCString.cpp b/cocos/deprecated/CCString.cpp index 143fb73b678d..753f335f4802 100644 --- a/cocos/deprecated/CCString.cpp +++ b/cocos/deprecated/CCString.cpp @@ -210,7 +210,7 @@ bool __String::isEqual(const Ref* pObject) const __String* pStr = dynamic_cast(pObject); if (pStr != nullptr) { - if (0 == _string.compare(pStr->_string)) + if (pStr->_string == _string) { bRet = true; } @@ -260,7 +260,7 @@ __String* __String::createWithFormat(const char* format, ...) __String* __String::createWithContentsOfFile(const std::string &filename) { std::string str = FileUtils::getInstance()->getStringFromFile(filename); - return __String::create(std::move(str)); + return __String::create(str); } void __String::acceptVisitor(DataVisitor &visitor) diff --git a/cocos/editor-support/cocosbuilder/CCBAnimationManager.cpp b/cocos/editor-support/cocosbuilder/CCBAnimationManager.cpp index 2905d876418d..4560c6907c39 100644 --- a/cocos/editor-support/cocosbuilder/CCBAnimationManager.cpp +++ b/cocos/editor-support/cocosbuilder/CCBAnimationManager.cpp @@ -140,7 +140,7 @@ void CCBAnimationManager::addDocumentCallbackNode(Node *node) _documentCallbackNodes.pushBack(node); } -void CCBAnimationManager::addDocumentCallbackName(std::string name) +void CCBAnimationManager::addDocumentCallbackName(const std::string& name) { _documentCallbackNames.push_back(Value(name)); } @@ -170,7 +170,7 @@ void CCBAnimationManager::addDocumentOutletNode(Node *node) _documentOutletNodes.pushBack(node); } -void CCBAnimationManager::addDocumentOutletName(std::string name) +void CCBAnimationManager::addDocumentOutletName(const std::string& name) { _documentOutletNames.push_back(Value(name)); } @@ -284,7 +284,7 @@ int CCBAnimationManager::getSequenceId(const char* pSequenceName) string seqName(pSequenceName); for (auto& seq : _sequences) { - if (seqName.compare(seq->getName()) == 0) + if (seqName == seq->getName()) { return seq->getSequenceId(); } @@ -722,7 +722,7 @@ Sequence* CCBAnimationManager::actionForCallbackChannel(CCBSequenceProperty* ch } } } - if(actions.size() < 1) return nullptr; + if(actions.empty()) return nullptr; return Sequence::create(actions); } @@ -764,7 +764,7 @@ Sequence* CCBAnimationManager::actionForSoundChannel(CCBSequenceProperty* chann actions.pushBack(CCBSoundEffect::actionWithSoundFile(soundFile, pitch, pan, gain)); } - if(actions.size() < 1) return nullptr; + if(actions.empty()) return nullptr; return Sequence::create(actions); } diff --git a/cocos/editor-support/cocosbuilder/CCBAnimationManager.h b/cocos/editor-support/cocosbuilder/CCBAnimationManager.h index 474e8449f1e0..b0bb8c6426ce 100644 --- a/cocos/editor-support/cocosbuilder/CCBAnimationManager.h +++ b/cocos/editor-support/cocosbuilder/CCBAnimationManager.h @@ -76,11 +76,11 @@ class CC_DLL CCBAnimationManager : public cocos2d::Ref void addDocumentCallbackNode(cocos2d::Node *node); - void addDocumentCallbackName(std::string name); + void addDocumentCallbackName(const std::string& name); void addDocumentCallbackControlEvents(cocos2d::extension::Control::EventType eventType); void addDocumentOutletNode(cocos2d::Node *node); - void addDocumentOutletName(std::string name); + void addDocumentOutletName(const std::string& name); void setDocumentControllerName(const std::string &name); diff --git a/cocos/editor-support/cocosbuilder/CCBReader.cpp b/cocos/editor-support/cocosbuilder/CCBReader.cpp index 2a2cc68f5611..32492ad73c2c 100644 --- a/cocos/editor-support/cocosbuilder/CCBReader.cpp +++ b/cocos/editor-support/cocosbuilder/CCBReader.cpp @@ -31,16 +31,17 @@ #include "2d/CCSpriteFrameCache.h" #include "renderer/CCTextureCache.h" +#include "editor-support/cocosbuilder/CCBAnimationManager.h" +#include "editor-support/cocosbuilder/CCBKeyframe.h" +#include "editor-support/cocosbuilder/CCBMemberVariableAssigner.h" #include "editor-support/cocosbuilder/CCBReader.h" +#include "editor-support/cocosbuilder/CCBSelectorResolver.h" +#include "editor-support/cocosbuilder/CCBSequenceProperty.h" #include "editor-support/cocosbuilder/CCNodeLoader.h" #include "editor-support/cocosbuilder/CCNodeLoaderLibrary.h" #include "editor-support/cocosbuilder/CCNodeLoaderListener.h" -#include "editor-support/cocosbuilder/CCBMemberVariableAssigner.h" -#include "editor-support/cocosbuilder/CCBSelectorResolver.h" -#include "editor-support/cocosbuilder/CCBAnimationManager.h" -#include "editor-support/cocosbuilder/CCBSequenceProperty.h" -#include "editor-support/cocosbuilder/CCBKeyframe.h" #include +#include using namespace cocos2d; using namespace cocos2d::extension; @@ -191,7 +192,7 @@ CCBReader::CCBAnimationManagerMapPtr CCBReader::getAnimationManagers() return _animationManagers; } -void CCBReader::setAnimationManagers(CCBAnimationManagerMapPtr x) +void CCBReader::setAnimationManagers(const CCBAnimationManagerMapPtr& x) { _animationManagers = x; } @@ -255,7 +256,7 @@ Node* CCBReader::readNodeGraphFromFile(const char *pCCBFileName, Ref *pOwner, co Node* CCBReader::readNodeGraphFromData(std::shared_ptr data, Ref *pOwner, const Size &parentSize) { - _data = data; + _data = std::move(data); _bytes =_data->getBytes(); _currentByte = 0; _currentBit = 0; @@ -320,7 +321,7 @@ void CCBReader::cleanUpNodeGraph(Node *node) } } -Node* CCBReader::readFileWithCleanUp(bool bCleanUp, CCBAnimationManagerMapPtr am) +Node* CCBReader::readFileWithCleanUp(bool bCleanUp, const CCBAnimationManagerMapPtr& am) { if (! readHeader()) { @@ -951,7 +952,7 @@ bool CCBReader::readSequences() std::string CCBReader::lastPathComponent(const char* pPath) { std::string path(pPath); - size_t slashPos = path.find_last_of("/"); + size_t slashPos = path.find_last_of('/'); if(slashPos != std::string::npos) { return path.substr(slashPos + 1, path.length() - slashPos); } @@ -960,7 +961,7 @@ std::string CCBReader::lastPathComponent(const char* pPath) { std::string CCBReader::deletePathExtension(const char* pPath) { std::string path(pPath); - size_t dotPos = path.find_last_of("."); + size_t dotPos = path.find_last_of('.'); if(dotPos != std::string::npos) { return path.substr(0, dotPos); } @@ -1069,7 +1070,7 @@ Vector& CCBReader::getAnimationManagersForNodes() return _animationManagersForNodes; } -void CCBReader::addOwnerOutletName(std::string name) +void CCBReader::addOwnerOutletName(const std::string& name) { _ownerOutletNames.push_back(name); } @@ -1098,4 +1099,4 @@ void CCBReader::setResolutionScale(float scale) __ccbResolutionScale = scale; } -}; +} diff --git a/cocos/editor-support/cocosbuilder/CCBReader.h b/cocos/editor-support/cocosbuilder/CCBReader.h index 22208f88fe46..e2de7b0717c5 100644 --- a/cocos/editor-support/cocosbuilder/CCBReader.h +++ b/cocos/editor-support/cocosbuilder/CCBReader.h @@ -337,7 +337,7 @@ class CC_DLL CCBReader : public cocos2d::Ref * @js NA * @lua NA */ - void setAnimationManagers(CCBAnimationManagerMapPtr x); + void setAnimationManagers(const CCBAnimationManagerMapPtr& x); /** * @js NA * @lua NA @@ -370,9 +370,9 @@ class CC_DLL CCBReader : public cocos2d::Ref * @js NA * @lua NA */ - cocos2d::Node* readFileWithCleanUp(bool bCleanUp, CCBAnimationManagerMapPtr am); + cocos2d::Node* readFileWithCleanUp(bool bCleanUp, const CCBAnimationManagerMapPtr& am); - void addOwnerOutletName(std::string name); + void addOwnerOutletName(const std::string& name); void addOwnerOutletNode(cocos2d::Node *node); private: diff --git a/cocos/editor-support/cocosbuilder/CCControlButtonLoader.cpp b/cocos/editor-support/cocosbuilder/CCControlButtonLoader.cpp index f621f0176022..e28156c52f6e 100644 --- a/cocos/editor-support/cocosbuilder/CCControlButtonLoader.cpp +++ b/cocos/editor-support/cocosbuilder/CCControlButtonLoader.cpp @@ -27,7 +27,7 @@ using namespace cocos2d; using namespace cocos2d::extension; -namespace cocosbuilder {; +namespace cocosbuilder { #define PROPERTY_ZOOMONTOUCHDOWN "zoomOnTouchDown" #define PROPERTY_TITLE_NORMAL "title|1" @@ -139,4 +139,4 @@ void ControlButtonLoader::onHandlePropTypeColor3(Node * pNode, Node * pParent, c } } -}; +} diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.cpp index 6d749a8dc2bd..46f8ecfad138 100644 --- a/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.cpp +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.cpp @@ -25,6 +25,8 @@ THE SOFTWARE. #include "editor-support/cocostudio/ActionTimeline/CCActionTimeline.h" +#include + #include "editor-support/cocostudio/CCComExtensionData.h" USING_NS_CC; @@ -94,7 +96,7 @@ bool ActionTimeline::init() return true; } -void ActionTimeline::play(std::string name, bool loop) +void ActionTimeline::play(const std::string& name, bool loop) { if (_animationInfos.find(name) == _animationInfos.end()) { @@ -176,7 +178,7 @@ ActionTimeline* ActionTimeline::clone() const newAction->setDuration(_duration); newAction->setTimeSpeed(_timeSpeed); - for (auto timelines : _timelineMap) + for (const auto& timelines : _timelineMap) { for(auto timeline : timelines.second) { @@ -185,7 +187,7 @@ ActionTimeline* ActionTimeline::clone() const } } - for( auto info : _animationInfos) + for(const auto& info : _animationInfos) { newAction->addAnimationInfo(info.second); } @@ -194,7 +196,7 @@ ActionTimeline* ActionTimeline::clone() const void ActionTimeline::step(float delta) { - if (!_playing || _timelineMap.size() == 0 || _duration == 0) + if (!_playing || _timelineMap.empty() || _duration == 0) { return; } @@ -233,7 +235,7 @@ void ActionTimeline::step(float delta) } typedef std::function tCallBack; -void foreachNodeDescendant(Node* parent, tCallBack callback) +void foreachNodeDescendant(Node* parent, const tCallBack& callback) { callback(parent); @@ -312,7 +314,7 @@ void ActionTimeline::addAnimationInfo(const AnimationInfo& animationInfo) addFrameEndCallFunc(animationInfo.endIndex, animationInfo.name, animationInfo.clipEndCallBack); } -void ActionTimeline::removeAnimationInfo(std::string animationName) +void ActionTimeline::removeAnimationInfo(const std::string& animationName) { auto clipIter = _animationInfos.find(animationName); if (clipIter == _animationInfos.end()) @@ -335,7 +337,7 @@ const AnimationInfo& ActionTimeline::getAnimationInfo(const std::string &animati return _animationInfos.find(animationName)->second; } -void ActionTimeline::setAnimationEndCallFunc(const std::string animationName, std::function func) +void ActionTimeline::setAnimationEndCallFunc(const std::string& animationName, const std::function& func) { auto clipIter = _animationInfos.find(animationName); if (clipIter == _animationInfos.end()) @@ -347,7 +349,7 @@ void ActionTimeline::setAnimationEndCallFunc(const std::string animationName, st addFrameEndCallFunc(clipIter->second.endIndex, animationName, func); } -void ActionTimeline::setFrameEventCallFunc(std::function listener) +void ActionTimeline::setFrameEventCallFunc(const std::function& listener) { _frameEventListener = listener; } @@ -357,7 +359,7 @@ void ActionTimeline::clearFrameEventCallFunc() _frameEventListener = nullptr; } -void ActionTimeline::setLastFrameCallFunc(std::function listener) +void ActionTimeline::setLastFrameCallFunc(const std::function& listener) { _lastFrameListener = listener; } @@ -375,7 +377,7 @@ void ActionTimeline::emitFrameEvent(Frame* frame) } } -void ActionTimeline::addFrameEndCallFunc(int frameIndex, const std::string& funcKey, std::function func) +void ActionTimeline::addFrameEndCallFunc(int frameIndex, const std::string& funcKey, const std::function& func) { if (func != nullptr) { @@ -416,7 +418,7 @@ void ActionTimeline::emitFrameEndCallFuncs(int frameIndex) if (clipEndCallsIter != _frameEndCallFuncs.end()) { auto clipEndCalls = (*clipEndCallsIter).second; - for (auto call : clipEndCalls) + for (const auto& call : clipEndCalls) (call).second(); } } diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.h b/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.h index 04182d2003d7..fb7376ce2559 100644 --- a/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.h +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.h @@ -82,7 +82,7 @@ class CC_STUDIO_DLL ActionTimeline : public cocos2d::Action, public cocos2d::Pla ActionTimeline(); virtual ~ActionTimeline(); - virtual void play(std::string animationName, bool loop); + virtual void play(const std::string& animationName, bool loop); virtual bool init(); @@ -155,21 +155,21 @@ class CC_STUDIO_DLL ActionTimeline : public cocos2d::Action, public cocos2d::Pla /** AnimationInfo*/ virtual void addAnimationInfo(const AnimationInfo& animationInfo); - virtual void removeAnimationInfo(std::string animationName); + virtual void removeAnimationInfo(const std::string& animationName); virtual bool IsAnimationInfoExists(const std::string& animationName); virtual const AnimationInfo& getAnimationInfo(const std::string& animationName); /**add a frame end call back to animation's end frame * @param animationName @addFrameEndCallFunc, make the animationName as funcKey * @param func the callback function */ - virtual void setAnimationEndCallFunc(const std::string animationName, std::function func); + virtual void setAnimationEndCallFunc(const std::string& animationName, const std::function& func); /** Set ActionTimeline's frame event callback function */ - void setFrameEventCallFunc(std::function listener); + void setFrameEventCallFunc(const std::function& listener); void clearFrameEventCallFunc(); /** Last frame callback will call when arriving last frame */ - void setLastFrameCallFunc(std::function listener); + void setLastFrameCallFunc(const std::function& listener); void clearLastFrameCallFunc(); /** add a callback function after played frameIndex @@ -177,7 +177,7 @@ class CC_STUDIO_DLL ActionTimeline : public cocos2d::Action, public cocos2d::Pla * @param funcKey for identity the callback function * @param func the callback function */ - virtual void addFrameEndCallFunc(int frameIndex, const std::string& funcKey, std::function func); + virtual void addFrameEndCallFunc(int frameIndex, const std::string& funcKey, const std::function& func); // remove callback function after frameIndex which identified with funcKey virtual void removeFrameEndCallFunc(int frameIndex, const std::string& funcKey); // clear callback functions after frameIndex diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimelineCache.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimelineCache.cpp index 1f62595425ab..ca482d3bc184 100644 --- a/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimelineCache.cpp +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimelineCache.cpp @@ -135,7 +135,7 @@ void ActionTimelineCache::removeAction(const std::string& fileName) ActionTimeline* ActionTimelineCache::createAction(const std::string& filename) { - std::string path = filename; + const std::string& path = filename; size_t pos = path.find_last_of('.'); std::string suffix = path.substr(pos + 1, path.length()); @@ -423,7 +423,7 @@ ActionTimeline* ActionTimelineCache::createActionWithFlatBuffersFile(const std:: return action->clone(); } -ActionTimeline* ActionTimelineCache::createActionWithDataBuffer(Data data, const std::string &fileName) +ActionTimeline* ActionTimelineCache::createActionWithDataBuffer(const Data& data, const std::string &fileName) { ActionTimeline* action = _animationActions.at(fileName); if (action == NULL) @@ -440,7 +440,7 @@ ActionTimeline* ActionTimelineCache::loadAnimationActionWithFlatBuffersFile(cons if (action) return action; - std::string path = fileName; + const std::string& path = fileName; std::string fullPath = FileUtils::getInstance()->fullPathForFilename(fileName); @@ -460,7 +460,7 @@ ActionTimeline* ActionTimelineCache::loadAnimationWithDataBuffer(const cocos2d:: if (action) return action; - std::string path = fileName; + const std::string& path = fileName; std::string fullPath = FileUtils::getInstance()->fullPathForFilename(fileName); @@ -522,11 +522,11 @@ Timeline* ActionTimelineCache::loadTimelineWithFlatBuffers(const flatbuffers::Ti // property std::string property = flatbuffers->property()->c_str(); - if(property == "") + if(property.empty()) return nullptr; - if(property != "") + if(!property.empty()) { timeline = Timeline::create(); @@ -800,7 +800,7 @@ Frame* ActionTimelineCache::loadEventFrameWithFlatBuffers(const flatbuffers::Eve std::string event = flatbuffers->value()->c_str(); - if (event != "") + if (!event.empty()) frame->setEvent(event); int frameIndex = flatbuffers->frameIndex(); diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimelineCache.h b/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimelineCache.h index f315dae17e8a..21a2762581cd 100644 --- a/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimelineCache.h +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimelineCache.h @@ -85,7 +85,7 @@ class CC_STUDIO_DLL ActionTimelineCache ActionTimeline* loadAnimationActionWithContent(const std::string&fileName, const std::string& content); ActionTimeline* createActionWithFlatBuffersFile(const std::string& fileName); - ActionTimeline* createActionWithDataBuffer(cocos2d::Data data, const std::string &fileName); + ActionTimeline* createActionWithDataBuffer(const cocos2d::Data& data, const std::string &fileName); ActionTimeline* loadAnimationActionWithFlatBuffersFile(const std::string& fileName); ActionTimeline* loadAnimationWithDataBuffer(const cocos2d::Data& data, const std::string& fileName); diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCBoneNode.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CCBoneNode.cpp index 4cbf29f59289..3885a950cd9d 100644 --- a/cocos/editor-support/cocostudio/ActionTimeline/CCBoneNode.cpp +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCBoneNode.cpp @@ -24,8 +24,8 @@ THE SOFTWARE. ****************************************************************************/ #include "base/CCDirector.h" -#include "base/ccUtils.h" #include "renderer/CCRenderer.h" +#include "renderer/ccGLStateCache.h" #include "renderer/CCGLProgram.h" #include "renderer/CCGLProgramState.h" @@ -485,14 +485,13 @@ void BoneNode::onDraw(const cocos2d::Mat4 &transform, uint32_t /*flags*/) getGLProgram()->use(); getGLProgram()->setUniformsForBuiltins(transform); - glEnableVertexAttribArray(cocos2d::GLProgram::VERTEX_ATTRIB_POSITION); - glEnableVertexAttribArray(cocos2d::GLProgram::VERTEX_ATTRIB_COLOR); + cocos2d::GL::enableVertexAttribs(cocos2d::GL::VERTEX_ATTRIB_FLAG_POSITION | cocos2d::GL::VERTEX_ATTRIB_FLAG_COLOR); glBindBuffer(GL_ARRAY_BUFFER, 0); glVertexAttribPointer(cocos2d::GLProgram::VERTEX_ATTRIB_POSITION, 3, GL_FLOAT, GL_FALSE, 0, _noMVPVertices); glVertexAttribPointer(cocos2d::GLProgram::VERTEX_ATTRIB_COLOR, 4, GL_FLOAT, GL_FALSE, 0, _squareColors); - cocos2d::utils::setBlending(_blendFunc.src, _blendFunc.dst); + cocos2d::GL::blendFunc(_blendFunc.src, _blendFunc.dst); glDrawArrays(GL_TRIANGLE_FAN, 0, 4); @@ -519,7 +518,7 @@ cocos2d::Vector BoneNode::getAllSubBones() const boneStack.push(bone); } - while (boneStack.size() > 0) + while (!boneStack.empty()) { auto top = boneStack.top(); allBones.pushBack(top); diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCSkeletonNode.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CCSkeletonNode.cpp index 2e3ad5599885..9ff74472d984 100644 --- a/cocos/editor-support/cocostudio/ActionTimeline/CCSkeletonNode.cpp +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCSkeletonNode.cpp @@ -27,10 +27,12 @@ THE SOFTWARE. #include "base/CCDirector.h" #include "math/TransformUtils.h" #include "renderer/CCRenderer.h" +#include "renderer/ccGLStateCache.h" #include "renderer/CCGLProgramState.h" -#include "base/ccUtils.h" #include +using namespace cocos2d::GL; + NS_TIMELINE_BEGIN SkeletonNode* SkeletonNode::create() @@ -234,14 +236,13 @@ void SkeletonNode::batchDrawAllSubBones(const cocos2d::Mat4 &transform) getGLProgram()->use(); getGLProgram()->setUniformsForBuiltins(transform); - glEnableVertexAttribArray(cocos2d::GLProgram::VERTEX_ATTRIB_POSITION); - glEnableVertexAttribArray(cocos2d::GLProgram::VERTEX_ATTRIB_COLOR); + cocos2d::GL::enableVertexAttribs(cocos2d::GL::VERTEX_ATTRIB_FLAG_POSITION | cocos2d::GL::VERTEX_ATTRIB_FLAG_COLOR); glBindBuffer(GL_ARRAY_BUFFER, 0); glVertexAttribPointer(cocos2d::GLProgram::VERTEX_ATTRIB_POSITION, 3, GL_FLOAT, GL_FALSE, 0, vetices); glVertexAttribPointer(cocos2d::GLProgram::VERTEX_ATTRIB_COLOR, 4, GL_FLOAT, GL_FALSE, 0, veticesColor); - cocos2d::utils::setBlending(_blendFunc.src, _blendFunc.dst); + cocos2d::GL::blendFunc(_blendFunc.src, _blendFunc.dst); #ifdef CC_STUDIO_ENABLED_VIEW glLineWidth(1); @@ -268,14 +269,13 @@ void SkeletonNode::onDraw(const cocos2d::Mat4 &transform, uint32_t /*flags*/) getGLProgram()->use(); getGLProgram()->setUniformsForBuiltins(transform); - glEnableVertexAttribArray(cocos2d::GLProgram::VERTEX_ATTRIB_POSITION); - glEnableVertexAttribArray(cocos2d::GLProgram::VERTEX_ATTRIB_COLOR); + cocos2d::GL::enableVertexAttribs(cocos2d::GL::VERTEX_ATTRIB_FLAG_POSITION | cocos2d::GL::VERTEX_ATTRIB_FLAG_COLOR); glBindBuffer(GL_ARRAY_BUFFER, 0); glVertexAttribPointer(cocos2d::GLProgram::VERTEX_ATTRIB_POSITION, 3, GL_FLOAT, GL_FALSE, 0, _noMVPVertices); glVertexAttribPointer(cocos2d::GLProgram::VERTEX_ATTRIB_COLOR, 4, GL_FLOAT, GL_FALSE, 0, _squareColors); - cocos2d::utils::setBlending(_blendFunc.src, _blendFunc.dst); + cocos2d::GL::blendFunc(_blendFunc.src, _blendFunc.dst); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); glDrawArrays(GL_TRIANGLE_STRIP, 4, 4); @@ -317,7 +317,7 @@ const cocos2d::Map& SkeletonNode::getAllSubBonesMap() co return _subBonesMap; } -void SkeletonNode::addSkinGroup(std::string groupName, std::map boneSkinNameMap) +void SkeletonNode::addSkinGroup(const std::string& groupName, const std::map& boneSkinNameMap) { _skinGroupMap.emplace(groupName, boneSkinNameMap); } @@ -348,7 +348,7 @@ void SkeletonNode::updateOrderedAllbones() boneStack.push(bone); } - while (boneStack.size() > 0) + while (!boneStack.empty()) { auto top = boneStack.top(); _subOrderedAllBones.pushBack(top); diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCSkeletonNode.h b/cocos/editor-support/cocostudio/ActionTimeline/CCSkeletonNode.h index dac5dba72c47..db3b47946191 100644 --- a/cocos/editor-support/cocostudio/ActionTimeline/CCSkeletonNode.h +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCSkeletonNode.h @@ -69,7 +69,7 @@ class CC_STUDIO_DLL SkeletonNode : public BoneNode *@param: groupName, key *@param: boneSkinNameMap, map */ - void addSkinGroup(std::string groupName, std::map boneSkinNameMap); + void addSkinGroup(const std::string& groupName, const std::map& boneSkinNameMap); cocos2d::Rect getBoundingBox() const override; diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCTimeLine.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CCTimeLine.cpp index ae1c331901f5..1f89e32e3c57 100644 --- a/cocos/editor-support/cocostudio/ActionTimeline/CCTimeLine.cpp +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCTimeLine.cpp @@ -60,7 +60,7 @@ Timeline::~Timeline() void Timeline::gotoFrame(int frameIndex) { - if(_frames.size() == 0) + if(_frames.empty()) return; binarySearchKeyFrame(frameIndex); @@ -69,7 +69,7 @@ void Timeline::gotoFrame(int frameIndex) void Timeline::stepToFrame(int frameIndex) { - if(_frames.size() == 0) + if(_frames.empty()) return; updateCurrentKeyFrame(frameIndex); diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCTimelineMacro.h b/cocos/editor-support/cocostudio/ActionTimeline/CCTimelineMacro.h index 138e08f2a403..60fd699d0240 100644 --- a/cocos/editor-support/cocostudio/ActionTimeline/CCTimelineMacro.h +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCTimelineMacro.h @@ -29,7 +29,7 @@ Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. #ifdef __cplusplus #define NS_TIMELINE_BEGIN namespace cocostudio { namespace timeline{ #define NS_TIMELINE_END }} -#define USING_NS_TIMELINE using namespace cocostudio::timeline; +#define USING_NS_TIMELINE using namespace cocostudio::timeline #else #define NS_TIMELINE_BEGIN #define NS_TIMELINE_END diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.cpp index ac7a550a21e2..f26db5b14506 100644 --- a/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.cpp +++ b/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.cpp @@ -270,7 +270,7 @@ void CSLoader::init() Node* CSLoader::createNode(const std::string& filename) { - std::string path = filename; + const std::string& path = filename; size_t pos = path.find_last_of('.'); std::string suffix = path.substr(pos + 1, path.length()); @@ -290,7 +290,7 @@ Node* CSLoader::createNode(const std::string& filename) Node* CSLoader::createNode(const std::string &filename, const ccNodeLoadCallback &callback) { - std::string path = filename; + const std::string& path = filename; size_t pos = path.find_last_of('.'); std::string suffix = path.substr(pos + 1, path.length()); @@ -330,7 +330,7 @@ Node* CSLoader::createNodeWithVisibleSize(const std::string &filename, const ccN std::string CSLoader::getExtentionName(const std::string& name) { - std::string path = name; + const std::string& path = name; size_t pos = path.find_last_of('.'); std::string result = path.substr(pos + 1, path.length()); @@ -1019,7 +1019,7 @@ Node* CSLoader::nodeWithFlatBuffers(const flatbuffers::NodeTree *nodetree, const std::string filePath = projectNodeOptions->fileName()->c_str(); cocostudio::timeline::ActionTimeline* action = nullptr; - if (filePath != "" && FileUtils::getInstance()->isFileExist(filePath)) + if (!filePath.empty() && FileUtils::getInstance()->isFileExist(filePath)) { Data buf = FileUtils::getInstance()->getDataFromFile(filePath); node = createNode(buf, callback); @@ -1052,7 +1052,7 @@ Node* CSLoader::nodeWithFlatBuffers(const flatbuffers::NodeTree *nodetree, const else { std::string customClassName = nodetree->customClassName()->c_str(); - if (customClassName != "") + if (!customClassName.empty()) { classname = customClassName; } @@ -1366,7 +1366,7 @@ Node* CSLoader::nodeWithFlatBuffersForSimulator(const flatbuffers::NodeTree *nod std::string filePath = projectNodeOptions->fileName()->c_str(); cocostudio::timeline::ActionTimeline* action = nullptr; - if (filePath != "" && FileUtils::getInstance()->isFileExist(filePath)) + if (!filePath.empty() && FileUtils::getInstance()->isFileExist(filePath)) { node = createNodeWithFlatBuffersForSimulator(filePath); action = cocostudio::timeline::ActionTimelineCache::getInstance()->createActionWithFlatBuffersForSimulator(filePath); diff --git a/cocos/editor-support/cocostudio/CCActionManagerEx.cpp b/cocos/editor-support/cocostudio/CCActionManagerEx.cpp index 8898ae7aaf56..2c0e71524306 100644 --- a/cocos/editor-support/cocostudio/CCActionManagerEx.cpp +++ b/cocos/editor-support/cocostudio/CCActionManagerEx.cpp @@ -63,7 +63,7 @@ void ActionManagerEx::initWithDictionary(const char* jsonName,const rapidjson::V { std::string path = jsonName; this->_studioVersionNumber = version; - ssize_t pos = path.find_last_of("/"); + ssize_t pos = path.find_last_of('/'); std::string fileName = path.substr(pos+1,path.length()); cocos2d::Vector actionList; int actionCount = DICTOOL->getArrayCount_json(dic, "actionlist"); @@ -83,7 +83,7 @@ void ActionManagerEx::initWithDictionary(const char* jsonName,const rapidjson::V stExpCocoNode* pCocoNode) { std::string path = file; - ssize_t pos = path.find_last_of("/"); + ssize_t pos = path.find_last_of('/'); std::string fileName = path.substr(pos+1,path.length()); cocos2d::Vector actionList; @@ -116,7 +116,7 @@ void ActionManagerEx::initWithDictionary(const char* jsonName,const rapidjson::V ActionObject* ActionManagerEx::getActionByName(const char* jsonName,const char* actionName) { std::string path = jsonName; - ssize_t pos = path.find_last_of("/"); + ssize_t pos = path.find_last_of('/'); std::string fileName = path.substr(pos+1,path.length()); auto iterator = _actionDic.find(fileName); if (iterator == _actionDic.end()) diff --git a/cocos/editor-support/cocostudio/CCActionNode.cpp b/cocos/editor-support/cocostudio/CCActionNode.cpp index ed903b973a0f..c37baf5803d1 100644 --- a/cocos/editor-support/cocostudio/CCActionNode.cpp +++ b/cocos/editor-support/cocostudio/CCActionNode.cpp @@ -450,7 +450,7 @@ Spawn * ActionNode::refreshActionProperty() for (int n = 0; n < _frameArrayNum; n++) { auto cArray = _frameArray.at(n); - if (cArray->size() <= 0) + if (cArray->empty()) { continue; } diff --git a/cocos/editor-support/cocostudio/CCArmature.cpp b/cocos/editor-support/cocostudio/CCArmature.cpp index 11b6c928a763..b3ab55770bc9 100644 --- a/cocos/editor-support/cocostudio/CCArmature.cpp +++ b/cocos/editor-support/cocostudio/CCArmature.cpp @@ -94,7 +94,7 @@ Armature::Armature() } -Armature::~Armature(void) +Armature::~Armature() { _boneDic.clear(); _topBoneList.clear(); @@ -153,7 +153,7 @@ bool Armature::init(const std::string& name) CC_BREAK_IF(!movData); MovementBoneData *movBoneData = movData->getMovementBoneData(bone->getName()); - CC_BREAK_IF(!movBoneData || movBoneData->frameList.size() <= 0); + CC_BREAK_IF(!movBoneData || movBoneData->frameList.empty()); FrameData *frameData = movBoneData->getFrameData(0); CC_BREAK_IF(!frameData); @@ -717,7 +717,7 @@ void Armature::setBody(cpBody *body) { detector->setBody(body); } - }); + } } } } diff --git a/cocos/editor-support/cocostudio/CCArmature.h b/cocos/editor-support/cocostudio/CCArmature.h index 6fa0305f40b6..5205474710e6 100644 --- a/cocos/editor-support/cocostudio/CCArmature.h +++ b/cocos/editor-support/cocostudio/CCArmature.h @@ -99,7 +99,7 @@ class CC_STUDIO_DLL Armature : public cocos2d::Node, public cocos2d::BlendProtoc * @js NA * @lua NA */ - virtual ~Armature(void); + virtual ~Armature(); /** * Init the empty armature @@ -176,7 +176,7 @@ class CC_STUDIO_DLL Armature : public cocos2d::Node, public cocos2d::BlendProtoc * @js NA * @lua NA */ - inline const cocos2d::BlendFunc &getBlendFunc(void) const override{ return _blendFunc; } + inline const cocos2d::BlendFunc &getBlendFunc() const override{ return _blendFunc; } /** diff --git a/cocos/editor-support/cocostudio/CCArmatureAnimation.cpp b/cocos/editor-support/cocostudio/CCArmatureAnimation.cpp index 6d33d0dfbd67..b37e4b9a5cf3 100644 --- a/cocos/editor-support/cocostudio/CCArmatureAnimation.cpp +++ b/cocos/editor-support/cocostudio/CCArmatureAnimation.cpp @@ -24,11 +24,13 @@ THE SOFTWARE. ****************************************************************************/ #include "editor-support/cocostudio/CCArmatureAnimation.h" + #include "editor-support/cocostudio/CCArmature.h" -#include "editor-support/cocostudio/CCBone.h" #include "editor-support/cocostudio/CCArmatureDefine.h" -#include "editor-support/cocostudio/CCUtilMath.h" +#include "editor-support/cocostudio/CCBone.h" #include "editor-support/cocostudio/CCDatas.h" +#include "editor-support/cocostudio/CCUtilMath.h" +#include using namespace cocos2d; @@ -72,7 +74,7 @@ ArmatureAnimation::ArmatureAnimation() } -ArmatureAnimation::~ArmatureAnimation(void) +ArmatureAnimation::~ArmatureAnimation() { CC_SAFE_RELEASE_NULL(_animationData); @@ -229,7 +231,7 @@ void ArmatureAnimation::play(const std::string& animationName, int durationTo, movementBoneData = static_cast(_movementData->movBoneDataDic.at(bone->getName())); Tween *tween = bone->getTween(); - if(movementBoneData && movementBoneData->frameList.size() > 0) + if(movementBoneData && !movementBoneData->frameList.empty()) { _tweenList.push_back(tween); movementBoneData->duration = _movementData->duration; @@ -353,13 +355,13 @@ void ArmatureAnimation::update(float dt) tween->update(dt); } - if(_frameEventQueue.size() > 0 || _movementEventQueue.size() > 0) + if(!_frameEventQueue.empty() || !_movementEventQueue.empty()) { _armature->retain(); _armature->autorelease(); } - while (_frameEventQueue.size() > 0) + while (!_frameEventQueue.empty()) { FrameEvent *event = _frameEventQueue.front(); _frameEventQueue.pop(); @@ -382,7 +384,7 @@ void ArmatureAnimation::update(float dt) CC_SAFE_DELETE(event); } - while (_movementEventQueue.size() > 0) + while (!_movementEventQueue.empty()) { MovementEvent *event = _movementEventQueue.front(); _movementEventQueue.pop(); @@ -482,11 +484,11 @@ void ArmatureAnimation::setFrameEventCallFunc(Ref *target, SEL_FrameEventCallFun _frameEventCallFunc = callFunc; } -void ArmatureAnimation::setMovementEventCallFunc(std::function listener) +void ArmatureAnimation::setMovementEventCallFunc(const std::function& listener) { _movementEventListener = listener; } -void ArmatureAnimation::setFrameEventCallFunc(std::function listener) +void ArmatureAnimation::setFrameEventCallFunc(const std::function& listener) { _frameEventListener = listener; } diff --git a/cocos/editor-support/cocostudio/CCArmatureAnimation.h b/cocos/editor-support/cocostudio/CCArmatureAnimation.h index b2c44d0ede31..3eb39dad4985 100644 --- a/cocos/editor-support/cocostudio/CCArmatureAnimation.h +++ b/cocos/editor-support/cocostudio/CCArmatureAnimation.h @@ -84,7 +84,7 @@ class CC_STUDIO_DLL ArmatureAnimation : public ProcessBase * @js NA * @lua NA */ - virtual ~ArmatureAnimation(void); + virtual ~ArmatureAnimation(); /** * Init with a Armature @@ -194,8 +194,8 @@ class CC_STUDIO_DLL ArmatureAnimation : public ProcessBase */ CC_DEPRECATED_ATTRIBUTE void setFrameEventCallFunc(cocos2d::Ref *target, SEL_FrameEventCallFunc callFunc); - void setMovementEventCallFunc(std::function listener); - void setFrameEventCallFunc(std::function listener); + void setMovementEventCallFunc(const std::function& listener); + void setFrameEventCallFunc(const std::function& listener); virtual void setAnimationData(AnimationData *data) { diff --git a/cocos/editor-support/cocostudio/CCArmatureDataManager.cpp b/cocos/editor-support/cocostudio/CCArmatureDataManager.cpp index b91903ce6010..6ec41f2f6a3b 100644 --- a/cocos/editor-support/cocostudio/CCArmatureDataManager.cpp +++ b/cocos/editor-support/cocostudio/CCArmatureDataManager.cpp @@ -56,7 +56,7 @@ void ArmatureDataManager::destroyInstance() CC_SAFE_RELEASE_NULL(s_sharedArmatureDataManager); } -ArmatureDataManager::ArmatureDataManager(void) +ArmatureDataManager::ArmatureDataManager() { _armarureDatas.clear(); _animationDatas.clear(); @@ -65,7 +65,7 @@ ArmatureDataManager::ArmatureDataManager(void) } -ArmatureDataManager::~ArmatureDataManager(void) +ArmatureDataManager::~ArmatureDataManager() { _animationDatas.clear(); _armarureDatas.clear(); @@ -95,22 +95,22 @@ void ArmatureDataManager::removeArmatureFileInfo(const std::string& configFilePa { if (RelativeData *data = getRelativeData(configFilePath)) { - for (std::string str : data->armatures) + for (const std::string& str : data->armatures) { removeArmatureData(str); } - for (std::string str : data->animations) + for (const std::string& str : data->animations) { removeAnimationData(str); } - for (std::string str : data->textures) + for (const std::string& str : data->textures) { removeTextureData(str); } - for (std::string str : data->plistFiles) + for (const std::string& str : data->plistFiles) { SpriteFrameCacheHelper::getInstance()->removeSpriteFrameFromFile(str); } diff --git a/cocos/editor-support/cocostudio/CCArmatureDataManager.h b/cocos/editor-support/cocostudio/CCArmatureDataManager.h index 8abdf72cb778..577202ae2a4e 100644 --- a/cocos/editor-support/cocostudio/CCArmatureDataManager.h +++ b/cocos/editor-support/cocostudio/CCArmatureDataManager.h @@ -59,12 +59,12 @@ class CC_STUDIO_DLL ArmatureDataManager : public cocos2d::Ref /** * @js ctor */ - ArmatureDataManager(void); + ArmatureDataManager(); /** * @js NA * @lua NA */ - ~ArmatureDataManager(void); + ~ArmatureDataManager(); public: diff --git a/cocos/editor-support/cocostudio/CCBone.cpp b/cocos/editor-support/cocostudio/CCBone.cpp index c2c28e42276f..56bd4487dfab 100644 --- a/cocos/editor-support/cocostudio/CCBone.cpp +++ b/cocos/editor-support/cocostudio/CCBone.cpp @@ -82,7 +82,7 @@ Bone::Bone() } -Bone::~Bone(void) +Bone::~Bone() { CC_SAFE_DELETE(_tweenData); CC_SAFE_DELETE(_tween); @@ -96,16 +96,14 @@ Bone::~Bone(void) bool Bone::init() { - return Bone::init(nullptr); + return Bone::init(""); } - bool Bone::init(const std::string& name) { bool bRet = false; do { - _name = name; CC_SAFE_DELETE(_tweenData); diff --git a/cocos/editor-support/cocostudio/CCBone.h b/cocos/editor-support/cocostudio/CCBone.h index b89352d2cb1a..bf317fca9c0a 100644 --- a/cocos/editor-support/cocostudio/CCBone.h +++ b/cocos/editor-support/cocostudio/CCBone.h @@ -64,7 +64,7 @@ class CC_STUDIO_DLL Bone : public cocos2d::Node * @js NA * @lua NA */ - virtual ~Bone(void); + virtual ~Bone(); /** * Initializes an empty Bone with nothing init. @@ -199,13 +199,13 @@ class CC_STUDIO_DLL Bone : public cocos2d::Node * Set blend function */ virtual void setBlendFunc(const cocos2d::BlendFunc& blendFunc); - virtual cocos2d::BlendFunc getBlendFunc(void) { return _blendFunc; } + virtual cocos2d::BlendFunc getBlendFunc() { return _blendFunc; } /* * Set if blend function is dirty */ virtual void setBlendDirty(bool dirty) { _blendDirty = dirty; } - virtual bool isBlendDirty(void) { return _blendDirty; } + virtual bool isBlendDirty() { return _blendDirty; } virtual FrameData *getTweenData() const { return _tweenData; } diff --git a/cocos/editor-support/cocostudio/CCColliderDetector.cpp b/cocos/editor-support/cocostudio/CCColliderDetector.cpp index fe99e60892b7..f869434c7463 100644 --- a/cocos/editor-support/cocostudio/CCColliderDetector.cpp +++ b/cocos/editor-support/cocostudio/CCColliderDetector.cpp @@ -194,9 +194,10 @@ void ColliderDetector::addContourData(ContourData *contourData) std::vector &calculatedVertexList = colliderBody->_calculatedVertexList; unsigned long num = contourData->vertexList.size(); + calculatedVertexList.reserve(num); for (unsigned long i = 0; i < num; i++) { - calculatedVertexList.push_back(Vec2()); + calculatedVertexList.emplace_back(); } #endif } diff --git a/cocos/editor-support/cocostudio/CCColliderDetector.h b/cocos/editor-support/cocostudio/CCColliderDetector.h index e4d56ca1a50a..c611da42d6cc 100644 --- a/cocos/editor-support/cocostudio/CCColliderDetector.h +++ b/cocos/editor-support/cocostudio/CCColliderDetector.h @@ -146,7 +146,7 @@ class CC_STUDIO_DLL ColliderDetector : public cocos2d::Ref * @js NA * @lua NA */ - ~ColliderDetector(void); + ~ColliderDetector(); virtual bool init(); virtual bool init(Bone *bone); diff --git a/cocos/editor-support/cocostudio/CCComAttribute.h b/cocos/editor-support/cocostudio/CCComAttribute.h index ce17de36e403..9bfc83507a27 100644 --- a/cocos/editor-support/cocostudio/CCComAttribute.h +++ b/cocos/editor-support/cocostudio/CCComAttribute.h @@ -40,17 +40,17 @@ class CC_STUDIO_DLL ComAttribute : public cocos2d::Component /** * @js ctor */ - ComAttribute(void); + ComAttribute(); /** * @js NA * @lua NA */ - virtual ~ComAttribute(void); + virtual ~ComAttribute(); public: const static std::string COMPONENT_NAME; - static ComAttribute* create(void); + static ComAttribute* create(); virtual bool init() override; virtual bool serialize(void* r) override; diff --git a/cocos/editor-support/cocostudio/CCComBase.h b/cocos/editor-support/cocostudio/CCComBase.h index e108f75fb4f8..364154ea379f 100644 --- a/cocos/editor-support/cocostudio/CCComBase.h +++ b/cocos/editor-support/cocostudio/CCComBase.h @@ -36,10 +36,10 @@ THE SOFTWARE. #define DECLARE_CLASS_COMPONENT_INFO \ public: \ static cocos2d::ObjectFactory::TInfo Type; \ - static cocos2d::Ref* createInstance(void); \ + static cocos2d::Ref* createInstance(); \ #define IMPLEMENT_CLASS_COMPONENT_INFO(className) \ - cocos2d::Ref* className::createInstance(void) \ + cocos2d::Ref* className::createInstance() \ { \ return className::create(); \ } \ diff --git a/cocos/editor-support/cocostudio/CCComRender.cpp b/cocos/editor-support/cocostudio/CCComRender.cpp index 05ab8ad72bea..55d1f8a97401 100644 --- a/cocos/editor-support/cocostudio/CCComRender.cpp +++ b/cocos/editor-support/cocostudio/CCComRender.cpp @@ -245,7 +245,7 @@ bool ComRender::serialize(void* r) for (int i = 0; i < count; ++i) { std::string key = tpChildArray[i].GetName(&tCocoLoader); - if (key.compare("armature_data") == 0) + if (key == "armature_data") { int length = tpChildArray[i].GetChildNum(); stExpCocoNode *armature_dataArray = tpChildArray[i].GetChildArray(&tCocoLoader); @@ -260,7 +260,7 @@ bool ComRender::serialize(void* r) { std::string key1 = armature_data[j].GetName(&tCocoLoader); const char *str1 = armature_data[j].GetValue(&tCocoLoader); - if (key.compare("name") == 0) + if (key == "name") { if (str1 != nullptr) { diff --git a/cocos/editor-support/cocostudio/CCDataReaderHelper.cpp b/cocos/editor-support/cocostudio/CCDataReaderHelper.cpp index 87d90b8652ce..60456ef3ed97 100644 --- a/cocos/editor-support/cocostudio/CCDataReaderHelper.cpp +++ b/cocos/editor-support/cocostudio/CCDataReaderHelper.cpp @@ -150,7 +150,7 @@ static std::string readFileContent(const std::string& filename, bool binary) { else s = fs->getStringFromFile(filename); return s; -}; +} namespace cocostudio { @@ -296,7 +296,7 @@ void DataReaderHelper::addDataFromFile(const std::string& filePath) //! find the base file path std::string basefilePath = filePath; - size_t pos = basefilePath.find_last_of("/"); + size_t pos = basefilePath.find_last_of('/'); if (pos != std::string::npos) { @@ -362,7 +362,7 @@ void DataReaderHelper::addDataFromFileAsync(const std::string& imagePath, const //! find the base file path std::string basefilePath = filePath; - size_t pos = basefilePath.find_last_of("/"); + size_t pos = basefilePath.find_last_of('/'); if (pos != std::string::npos) { @@ -462,7 +462,7 @@ void DataReaderHelper::addDataAsyncCallBack(float /*dt*/) AsyncStruct *pAsyncStruct = pDataInfo->asyncStruct; - if (pAsyncStruct->imagePath != "" && pAsyncStruct->plistPath != "") + if (!pAsyncStruct->imagePath.empty() && !pAsyncStruct->plistPath.empty()) { _getFileMutex.lock(); ArmatureDataManager::getInstance()->addSpriteFrameFromFile(pAsyncStruct->plistPath, pAsyncStruct->imagePath, pDataInfo->filename); @@ -1305,7 +1305,7 @@ void DataReaderHelper::addDataFromJsonCache(const std::string& fileContent, Data } std::string filePath = path; - filePath = filePath.erase(filePath.find_last_of(".")); + filePath = filePath.erase(filePath.find_last_of('.')); if (dataInfo->asyncStruct) { @@ -1586,7 +1586,7 @@ MovementBoneData *DataReaderHelper::decodeMovementBone(const rapidjson::Value& j if (dataInfo->cocoStudioVersion < VERSION_COMBINED) { - if (movementBoneData->frameList.size() > 0) + if (!movementBoneData->frameList.empty()) { FrameData *frameData = new (std::nothrow) FrameData(); frameData->copy((FrameData *)movementBoneData->frameList.back()); @@ -1756,12 +1756,12 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json, for (int i = 0; i < nCount; ++i) { key = tpChildArray[i].GetName(&tCocoLoader); - if (key.compare(CONTENT_SCALE) == 0) + if (key == CONTENT_SCALE) { std::string value = tpChildArray[i].GetValue(&tCocoLoader); dataInfo->contentScale = utils::atof(value.c_str()); } - else if ( 0 == key.compare(ARMATURE_DATA)) + else if ( ARMATURE_DATA == key) { pDataArray = tpChildArray[i].GetChildArray(&tCocoLoader); length = tpChildArray[i].GetChildNum(); @@ -1781,7 +1781,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json, } } } - else if ( 0 == key.compare(ANIMATION_DATA)) + else if ( ANIMATION_DATA == key) { pDataArray = tpChildArray[i].GetChildArray(&tCocoLoader); length = tpChildArray[i].GetChildNum(); @@ -1801,7 +1801,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json, } } } - else if (key.compare(TEXTURE_DATA) == 0) + else if (key == TEXTURE_DATA) { pDataArray = tpChildArray[i].GetChildArray(&tCocoLoader); length = tpChildArray[i].GetChildNum(); @@ -1828,7 +1828,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json, for (int i = 0; i < nCount; ++i) { key = tpChildArray[i].GetName(&tCocoLoader); - if( 0 != key.compare(CONFIG_FILE_PATH)) + if( CONFIG_FILE_PATH != key) { continue; } @@ -1844,7 +1844,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json, } std::string filePath = path; - filePath = filePath.erase(filePath.find_last_of(".")); + filePath = filePath.erase(filePath.find_last_of('.')); if (dataInfo->asyncStruct) { @@ -1910,7 +1910,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json, child = &pBoneChildren[i]; key = child->GetName(cocoLoader); str = child->GetValue(cocoLoader); - if (key.compare(A_NAME) == 0) + if (key == A_NAME) { //DICTOOL->getStringValue_json(json, A_NAME); if(str != nullptr) @@ -1918,7 +1918,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json, boneData->name = str; } } - else if (key.compare(A_PARENT) == 0) + else if (key == A_PARENT) { //DICTOOL->getStringValue_json(json, A_PARENT); if(str != nullptr) @@ -1926,7 +1926,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json, boneData->parentName = str; } } - else if (key.compare(DISPLAY_DATA) == 0) + else if (key == DISPLAY_DATA) { int count = child->GetChildNum(); stExpCocoNode *pDisplayData = child->GetChildArray(cocoLoader); @@ -1952,7 +1952,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json, std::string key = child->GetName(cocoLoader); const char *str = child->GetValue(cocoLoader); DisplayData *displayData = nullptr; - if (key.compare(A_DISPLAY_TYPE) == 0) + if (key == A_DISPLAY_TYPE) { str = child->GetValue(cocoLoader); DisplayType displayType = (DisplayType)(atoi(str)); @@ -1982,27 +1982,27 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json, { key = SkinDataValue[i].GetName(cocoLoader); str = SkinDataValue[i].GetValue(cocoLoader); - if (key.compare(A_X) == 0) + if (key == A_X) { sdd->skinData.x = utils::atof(str) * s_PositionReadScale; } - else if (key.compare(A_Y) == 0) + else if (key == A_Y) { sdd->skinData.y = utils::atof(str) * s_PositionReadScale; } - else if (key.compare(A_SCALE_X) == 0) + else if (key == A_SCALE_X) { sdd->skinData.scaleX = utils::atof(str); } - else if (key.compare(A_SCALE_Y) == 0) + else if (key == A_SCALE_Y) { sdd->skinData.scaleY = utils::atof(str); } - else if (key.compare(A_SKEW_X) == 0) + else if (key == A_SKEW_X) { sdd->skinData.skewX = utils::atof(str); } - else if (key.compare(A_SKEW_Y) == 0) + else if (key == A_SKEW_Y) { sdd->skinData.skewY = utils::atof(str); } @@ -2035,7 +2035,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json, { key = pDisplayData[i].GetName(cocoLoader); str = pDisplayData[i].GetValue(cocoLoader); - if (key.compare(A_PLIST) == 0) + if (key == A_PLIST) { const char *plist = str; if(plist != nullptr) @@ -2078,14 +2078,14 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json, child = &pAnimationData[i]; key = child->GetName(cocoLoader); str = child->GetValue(cocoLoader); - if (key.compare(A_NAME) == 0) + if (key == A_NAME) { if(str != nullptr) { aniData->name = str; } } - else if (key.compare(MOVEMENT_DATA) == 0) + else if (key == MOVEMENT_DATA) { int movcount = child->GetChildNum(); stExpCocoNode* movArray = child->GetChildArray(cocoLoader); @@ -2116,14 +2116,14 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json, child = &pMoveDataArray[i]; key = child->GetName(cocoLoader); str = child->GetValue(cocoLoader); - if (key.compare(A_NAME) == 0) + if (key == A_NAME) { if(str != nullptr) { movementData->name = str; } } - else if (key.compare(A_LOOP) == 0) + else if (key == A_LOOP) { movementData->loop = true; if(str != nullptr) @@ -2134,7 +2134,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json, } } } - else if (key.compare(A_DURATION_TWEEN) == 0) + else if (key == A_DURATION_TWEEN) { movementData->durationTween = 0; if(str != nullptr) @@ -2142,7 +2142,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json, movementData->durationTween = atoi(str); } } - else if (key.compare(A_DURATION_TO) == 0) + else if (key == A_DURATION_TO) { movementData->durationTo = 0; if(str != nullptr) @@ -2150,7 +2150,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json, movementData->durationTo = atoi(str); } } - else if (key.compare(A_DURATION) == 0) + else if (key == A_DURATION) { movementData->duration = 0; if(str != nullptr) @@ -2158,7 +2158,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json, movementData->duration = atoi(str); } } - else if (key.compare(A_MOVEMENT_SCALE) == 0) + else if (key == A_MOVEMENT_SCALE) { movementData->scale = 1.0; if(str != nullptr) @@ -2166,7 +2166,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json, movementData->scale = utils::atof(str); } } - else if (key.compare(A_TWEEN_EASING) == 0) + else if (key == A_TWEEN_EASING) { movementData->tweenEasing = cocos2d::tweenfunc::Linear; if(str != nullptr) @@ -2174,7 +2174,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json, movementData->tweenEasing = (TweenType)(atoi(str)); } } - else if (key.compare(MOVEMENT_BONE_DATA) == 0) + else if (key == MOVEMENT_BONE_DATA) { int count = child->GetChildNum(); stExpCocoNode *pMoveBoneData = child->GetChildArray(cocoLoader); @@ -2204,21 +2204,21 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json, movebonechild = &pMovementBoneDataArray[i]; std::string key = movebonechild->GetName(cocoLoader); str = movebonechild->GetValue(cocoLoader); - if (key.compare(A_NAME) == 0) + if (key == A_NAME) { if(str != nullptr) { movementBoneData->name = str; } } - else if (key.compare(A_MOVEMENT_DELAY) == 0) + else if (key == A_MOVEMENT_DELAY) { if(str != nullptr) { movementBoneData->delay = utils::atof(str); } } - else if (key.compare(FRAME_DATA) == 0) + else if (key == FRAME_DATA) { int count =movebonechild->GetChildNum(); stExpCocoNode *pFrameDataArray = movebonechild->GetChildArray(cocoLoader); @@ -2271,7 +2271,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json, if (dataInfo->cocoStudioVersion < VERSION_COMBINED) { - if (movementBoneData->frameList.size() > 0) + if (!movementBoneData->frameList.empty()) { auto frameData = movementBoneData->frameList.at(framesizemusone); movementBoneData->addFrameData(frameData); @@ -2296,7 +2296,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json, { std::string key = pFrameDataArray[i].GetName(cocoLoader); str = pFrameDataArray[i].GetValue(cocoLoader); - if (key.compare(A_TWEEN_EASING) == 0) + if (key == A_TWEEN_EASING) { frameData->tweenEasing = cocos2d::tweenfunc::Linear; if(str != nullptr) @@ -2304,28 +2304,28 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json, frameData->tweenEasing = (TweenType)(atoi(str)); } } - else if (key.compare(A_DISPLAY_INDEX) == 0) + else if (key == A_DISPLAY_INDEX) { if(str != nullptr) { frameData->displayIndex = atoi(str); } } - else if (key.compare(A_BLEND_SRC) == 0) + else if (key == A_BLEND_SRC) { if(str != nullptr) { frameData->blendFunc.src = (GLenum)(atoi(str)); } } - else if (key.compare(A_BLEND_DST) == 0) + else if (key == A_BLEND_DST) { if(str != nullptr) { frameData->blendFunc.dst = (GLenum)(atoi(str)); } } - else if (key.compare(A_TWEEN_FRAME) == 0) + else if (key == A_TWEEN_FRAME) { frameData->isTween = true; if(str != nullptr) @@ -2336,14 +2336,14 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json, } } } - else if (key.compare(A_EVENT) == 0) + else if (key == A_EVENT) { if(str != nullptr) { frameData->strEvent = str; } } - else if (key.compare(A_DURATION) == 0) + else if (key == A_DURATION) { if (dataInfo->cocoStudioVersion < VERSION_COMBINED) { @@ -2354,7 +2354,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json, } } } - else if (key.compare(A_FRAME_INDEX) == 0) + else if (key == A_FRAME_INDEX) { if (dataInfo->cocoStudioVersion >= VERSION_COMBINED) { @@ -2364,7 +2364,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json, } } } - else if (key.compare(A_EASING_PARAM) == 0) + else if (key == A_EASING_PARAM) { int count = pFrameDataArray[i].GetChildNum(); if (count != 0 ) @@ -2404,42 +2404,42 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json, { std::string key = pTextureDataArray[i].GetName(cocoLoader); str = pTextureDataArray[i].GetValue(cocoLoader); - if (key.compare(A_NAME) == 0) + if (key == A_NAME) { if(str != nullptr) { textureData->name = str; } } - else if (key.compare(A_WIDTH) == 0) + else if (key == A_WIDTH) { if(str != nullptr) { textureData->width = utils::atof(str); } } - else if (key.compare(A_HEIGHT) == 0) + else if (key == A_HEIGHT) { if(str != nullptr) { textureData->height = utils::atof(str); } } - else if (key.compare(A_PIVOT_X) == 0) + else if (key == A_PIVOT_X) { if(str != nullptr) { textureData->pivotX = utils::atof(str); } } - else if (key.compare(A_PIVOT_Y) == 0) + else if (key == A_PIVOT_Y) { if(str != nullptr) { textureData->pivotY = utils::atof(str); } } - else if (key.compare(CONTOUR_DATA) == 0) + else if (key == CONTOUR_DATA) { int count = pTextureDataArray[i].GetChildNum(); stExpCocoNode *pContourArray = pTextureDataArray[i].GetChildArray(cocoLoader); @@ -2466,7 +2466,7 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json, { std::string key = verTexPointArray[i].GetName(cocoLoader); str = verTexPointArray[i].GetValue(cocoLoader); - if (key.compare(VERTEX_POINT) == 0) + if (key == VERTEX_POINT) { int count = verTexPointArray[i].GetChildNum(); stExpCocoNode *pVerTexPointArray = verTexPointArray[i].GetChildArray(cocoLoader); @@ -2497,35 +2497,35 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json, child = &NodeArray[i]; std::string key = child->GetName(cocoLoader); str = child->GetValue(cocoLoader); - if (key.compare(A_X) == 0) + if (key == A_X) { node->x = utils::atof(str) * dataInfo->contentScale; } - else if (key.compare(A_Y) == 0) + else if (key == A_Y) { node->y = utils::atof(str) * dataInfo->contentScale; } - else if (key.compare(A_Z) == 0) + else if (key == A_Z) { node->zOrder = atoi(str); } - else if (key.compare(A_SKEW_X) == 0) + else if (key == A_SKEW_X) { node->skewX = utils::atof(str); } - else if (key.compare(A_SKEW_Y) == 0) + else if (key == A_SKEW_Y) { node->skewY = utils::atof(str); } - else if (key.compare(A_SCALE_X) == 0) + else if (key == A_SCALE_X) { node->scaleX = utils::atof(str); } - else if (key.compare(A_SCALE_Y) == 0) + else if (key == A_SCALE_Y) { node->scaleY = utils::atof(str); } - else if (key.compare(COLOR_INFO) == 0) + else if (key == COLOR_INFO) { if (!isVersionL) { diff --git a/cocos/editor-support/cocostudio/CCDatas.cpp b/cocos/editor-support/cocostudio/CCDatas.cpp index b3572e2db3d9..935a5a332690 100644 --- a/cocos/editor-support/cocostudio/CCDatas.cpp +++ b/cocos/editor-support/cocostudio/CCDatas.cpp @@ -147,7 +147,7 @@ std::string DisplayData::changeDisplayToTexture(const std::string& displayName) { // remove .xxx std::string textureName = displayName; - size_t startPos = textureName.find_last_of("."); + size_t startPos = textureName.find_last_of('.'); if(startPos != std::string::npos) { @@ -157,7 +157,7 @@ std::string DisplayData::changeDisplayToTexture(const std::string& displayName) return textureName; } -DisplayData::DisplayData(void) +DisplayData::DisplayData() : displayType(CS_DISPLAY_MAX) , displayName("") { @@ -169,7 +169,7 @@ void DisplayData::copy(DisplayData *displayData) displayType = displayData->displayType; } -SpriteDisplayData::SpriteDisplayData(void) +SpriteDisplayData::SpriteDisplayData() { displayType = CS_DISPLAY_SPRITE; } @@ -185,25 +185,25 @@ void SpriteDisplayData::copy(DisplayData *displayData) } } -ArmatureDisplayData::ArmatureDisplayData(void) +ArmatureDisplayData::ArmatureDisplayData() { displayType = CS_DISPLAY_ARMATURE; } -ParticleDisplayData::ParticleDisplayData(void) +ParticleDisplayData::ParticleDisplayData() { displayType = CS_DISPLAY_PARTICLE; } -BoneData::BoneData(void) +BoneData::BoneData() : name("") , parentName("") { } -BoneData::~BoneData(void) +BoneData::~BoneData() { } @@ -247,7 +247,7 @@ BoneData *ArmatureData::getBoneData(const std::string& boneName) return static_cast(boneDataDic.at(boneName)); } -FrameData::FrameData(void) +FrameData::FrameData() : frameID(0) , duration(1) , tweenEasing(cocos2d::tweenfunc::Linear) @@ -264,9 +264,9 @@ FrameData::FrameData(void) { } -FrameData::~FrameData(void) +FrameData::~FrameData() { - CC_SAFE_DELETE(easingParams); + CC_SAFE_DELETE_ARRAY(easingParams); } void FrameData::copy(const BaseData *baseData) @@ -281,7 +281,7 @@ void FrameData::copy(const BaseData *baseData) tweenEasing = frameData->tweenEasing; easingParamNumber = frameData->easingParamNumber; - CC_SAFE_DELETE(easingParams); + CC_SAFE_DELETE_ARRAY(easingParams); if (easingParamNumber != 0) { easingParams = new (std::nothrow) float[easingParamNumber]; @@ -304,7 +304,7 @@ MovementBoneData::MovementBoneData() { } -MovementBoneData::~MovementBoneData(void) +MovementBoneData::~MovementBoneData() { } @@ -325,7 +325,7 @@ FrameData *MovementBoneData::getFrameData(int index) -MovementData::MovementData(void) +MovementData::MovementData() : name("") , duration(0) , scale(1.0f) @@ -336,7 +336,7 @@ MovementData::MovementData(void) { } -MovementData::~MovementData(void) +MovementData::~MovementData() { } @@ -352,11 +352,11 @@ MovementBoneData *MovementData::getMovementBoneData(const std::string& boneName) -AnimationData::AnimationData(void) +AnimationData::AnimationData() { } -AnimationData::~AnimationData(void) +AnimationData::~AnimationData() { } diff --git a/cocos/editor-support/cocostudio/CCDatas.h b/cocos/editor-support/cocostudio/CCDatas.h index 7f6f4fa74fde..b3ccde47ae9e 100644 --- a/cocos/editor-support/cocostudio/CCDatas.h +++ b/cocos/editor-support/cocostudio/CCDatas.h @@ -39,7 +39,7 @@ THE SOFTWARE. #define CC_CREATE_NO_PARAM_NO_INIT(varType)\ public: \ - static inline varType *create(void){ \ + static inline varType *create(){ \ varType *var = new (std::nothrow) varType();\ if (var)\ {\ @@ -52,7 +52,7 @@ public: \ #define CC_CREATE_NO_PARAM(varType)\ public: \ - static inline varType *create(void){ \ + static inline varType *create(){ \ varType *var = new (std::nothrow) varType();\ if (var && var->init())\ {\ @@ -83,7 +83,7 @@ class CC_STUDIO_DLL BaseData : public cocos2d::Ref * @js NA * @lua NA */ - ~BaseData(void); + ~BaseData(); /* * Copy data from node @@ -154,7 +154,7 @@ class CC_STUDIO_DLL DisplayData : public cocos2d::Ref * @js NA * @lua NA */ - virtual ~DisplayData(void) {} + virtual ~DisplayData() {} virtual void copy(DisplayData *displayData); @@ -244,12 +244,12 @@ class CC_STUDIO_DLL BoneData : public BaseData /** * @js ctor */ - BoneData(void); + BoneData(); /** * @js NA * @lua NA */ - ~BoneData(void); + ~BoneData(); virtual bool init(); @@ -376,7 +376,7 @@ class CC_STUDIO_DLL MovementBoneData : public cocos2d::Ref * @js NA * @lua NA */ - ~MovementBoneData(void); + ~MovementBoneData(); virtual bool init(); @@ -403,12 +403,12 @@ class CC_STUDIO_DLL MovementData : public cocos2d::Ref /** * @js ctor */ - MovementData(void); + MovementData(); /** * @js NA * @lua NA */ - ~MovementData(void); + ~MovementData(); void addMovementBoneData(MovementBoneData *movBoneData); MovementBoneData *getMovementBoneData(const std::string& boneName); @@ -465,12 +465,12 @@ class CC_STUDIO_DLL AnimationData : public cocos2d::Ref /** * @js ctor */ - AnimationData(void); + AnimationData(); /** * @js NA * @lua NA */ - ~AnimationData(void); + ~AnimationData(); void addMovement(MovementData *movData); MovementData *getMovement(const std::string& movementName); @@ -501,7 +501,7 @@ class CC_STUDIO_DLL ContourData : public cocos2d::Ref * @js NA * @lua NA */ - ~ContourData(void); + ~ContourData(); virtual bool init(); virtual void addVertex(cocos2d::Vec2 &vertex); @@ -530,7 +530,7 @@ class CC_STUDIO_DLL TextureData : public cocos2d::Ref * @js NA * @lua NA */ - ~TextureData(void); + ~TextureData(); virtual bool init(); diff --git a/cocos/editor-support/cocostudio/CCDecorativeDisplay.cpp b/cocos/editor-support/cocostudio/CCDecorativeDisplay.cpp index 72f61a1c0b3f..f05a62935021 100644 --- a/cocos/editor-support/cocostudio/CCDecorativeDisplay.cpp +++ b/cocos/editor-support/cocostudio/CCDecorativeDisplay.cpp @@ -53,7 +53,7 @@ DecorativeDisplay::DecorativeDisplay() } -DecorativeDisplay::~DecorativeDisplay(void) +DecorativeDisplay::~DecorativeDisplay() { CC_SAFE_RELEASE_NULL(_displayData); CC_SAFE_RELEASE_NULL(_display); diff --git a/cocos/editor-support/cocostudio/CCDecorativeDisplay.h b/cocos/editor-support/cocostudio/CCDecorativeDisplay.h index 3be7b4ec615c..22e669396963 100644 --- a/cocos/editor-support/cocostudio/CCDecorativeDisplay.h +++ b/cocos/editor-support/cocostudio/CCDecorativeDisplay.h @@ -50,8 +50,8 @@ class CC_STUDIO_DLL DecorativeDisplay: public cocos2d::Ref public: static DecorativeDisplay *create(); public: - DecorativeDisplay(void); - ~DecorativeDisplay(void); + DecorativeDisplay(); + ~DecorativeDisplay(); virtual bool init(); diff --git a/cocos/editor-support/cocostudio/CCDisplayFactory.cpp b/cocos/editor-support/cocostudio/CCDisplayFactory.cpp index c9156b9ca10d..476e072d28a6 100644 --- a/cocos/editor-support/cocostudio/CCDisplayFactory.cpp +++ b/cocos/editor-support/cocostudio/CCDisplayFactory.cpp @@ -144,7 +144,7 @@ void DisplayFactory::createSpriteDisplay(Bone *bone, DecorativeDisplay *decoDisp SpriteDisplayData *displayData = (SpriteDisplayData *)decoDisplay->getDisplayData(); std::string textureName = displayData->displayName; - size_t startPos = textureName.find_last_of("."); + size_t startPos = textureName.find_last_of('.'); if(startPos != std::string::npos) { @@ -191,7 +191,7 @@ void DisplayFactory::initSpriteDisplay(Bone *bone, DecorativeDisplay *decoDispla { //! remove .xxx std::string textureName = displayName; - size_t startPos = textureName.find_last_of("."); + size_t startPos = textureName.find_last_of('.'); if(startPos != std::string::npos) { @@ -207,7 +207,7 @@ void DisplayFactory::initSpriteDisplay(Bone *bone, DecorativeDisplay *decoDispla #if ENABLE_PHYSICS_BOX2D_DETECT || ENABLE_PHYSICS_CHIPMUNK_DETECT || ENABLE_PHYSICS_SAVE_CALCULATED_VERTEX - if (textureData && textureData->contourDataList.size() > 0) + if (textureData && !textureData->contourDataList.empty()) { //! create ContourSprite diff --git a/cocos/editor-support/cocostudio/CCInputDelegate.cpp b/cocos/editor-support/cocostudio/CCInputDelegate.cpp index af918dc85baa..a0907d463434 100644 --- a/cocos/editor-support/cocostudio/CCInputDelegate.cpp +++ b/cocos/editor-support/cocostudio/CCInputDelegate.cpp @@ -35,7 +35,7 @@ using namespace cocos2d; namespace cocostudio { -InputDelegate::InputDelegate(void) +InputDelegate::InputDelegate() : _touchEnabled(false) , _touchListener(nullptr) , _accelerometerEnabled(false) @@ -48,7 +48,7 @@ InputDelegate::InputDelegate(void) } -InputDelegate::~InputDelegate(void) +InputDelegate::~InputDelegate() { auto dispatcher = Director::getInstance()->getEventDispatcher(); dispatcher->removeEventListener(_touchListener); diff --git a/cocos/editor-support/cocostudio/CCInputDelegate.h b/cocos/editor-support/cocostudio/CCInputDelegate.h index 8e485f5b8c59..c95ad352ddb0 100644 --- a/cocos/editor-support/cocostudio/CCInputDelegate.h +++ b/cocos/editor-support/cocostudio/CCInputDelegate.h @@ -49,11 +49,11 @@ class CC_STUDIO_DLL InputDelegate /** * @js ctor */ - InputDelegate(void); + InputDelegate(); /** * @js NA */ - virtual ~InputDelegate(void); + virtual ~InputDelegate(); public: virtual bool isTouchEnabled() const; diff --git a/cocos/editor-support/cocostudio/CCProcessBase.cpp b/cocos/editor-support/cocostudio/CCProcessBase.cpp index f6c168568c17..3f20b67d65da 100644 --- a/cocos/editor-support/cocostudio/CCProcessBase.cpp +++ b/cocos/editor-support/cocostudio/CCProcessBase.cpp @@ -30,7 +30,7 @@ using namespace cocos2d; namespace cocostudio { -ProcessBase::ProcessBase(void) +ProcessBase::ProcessBase() : _processScale(1) , _isPause(true) , _isComplete(true) @@ -48,7 +48,7 @@ ProcessBase::ProcessBase(void) } -ProcessBase::~ProcessBase(void) +ProcessBase::~ProcessBase() { } diff --git a/cocos/editor-support/cocostudio/CCProcessBase.h b/cocos/editor-support/cocostudio/CCProcessBase.h index 7b22c9505d5e..10181db6fa57 100644 --- a/cocos/editor-support/cocostudio/CCProcessBase.h +++ b/cocos/editor-support/cocostudio/CCProcessBase.h @@ -55,8 +55,8 @@ enum AnimationType class CC_STUDIO_DLL ProcessBase : public cocos2d::Ref { public: - ProcessBase(void); - virtual ~ProcessBase(void); + ProcessBase(); + virtual ~ProcessBase(); /** * Play animation by animation name. diff --git a/cocos/editor-support/cocostudio/CCSGUIReader.cpp b/cocos/editor-support/cocostudio/CCSGUIReader.cpp index df70a788a7f6..73afa4fcd744 100644 --- a/cocos/editor-support/cocostudio/CCSGUIReader.cpp +++ b/cocos/editor-support/cocostudio/CCSGUIReader.cpp @@ -24,13 +24,14 @@ THE SOFTWARE. ****************************************************************************/ #include "editor-support/cocostudio/CCSGUIReader.h" -#include -#include -#include "ui/CocosGUI.h" -#include "platform/CCFileUtils.h" #include "2d/CCSpriteFrameCache.h" #include "base/CCDirector.h" #include "base/ccUtils.h" +#include "platform/CCFileUtils.h" +#include "ui/CocosGUI.h" +#include +#include +#include #include "editor-support/cocostudio/CCActionManagerEx.h" #include "editor-support/cocostudio/WidgetReader/ButtonReader/ButtonReader.h" @@ -117,19 +118,19 @@ int GUIReader::getVersionInteger(const char *str) { return 0; } - size_t pos = strVersion.find_first_of("."); + size_t pos = strVersion.find_first_of('.'); std::string t = strVersion.substr(0,pos); strVersion = strVersion.substr(pos+1,strVersion.length()-1); - pos = strVersion.find_first_of("."); + pos = strVersion.find_first_of('.'); std::string h = strVersion.substr(0,pos); strVersion = strVersion.substr(pos+1,strVersion.length()-1); - pos = strVersion.find_first_of("."); + pos = strVersion.find_first_of('.'); std::string te = strVersion.substr(0,pos); strVersion = strVersion.substr(pos+1,strVersion.length()-1); - pos = strVersion.find_first_of("."); + pos = strVersion.find_first_of('.'); std::string s = strVersion.substr(0,pos); int it = atoi(t.c_str()); @@ -186,7 +187,7 @@ void GUIReader::registerTypeAndCallBack(const std::string& classType, } void GUIReader::registerTypeAndCallBack(const std::string& classType, - ObjectFactory::InstanceFunc ins, + const ObjectFactory::InstanceFunc& ins, Ref *object, SEL_ParseEvent callBack) { diff --git a/cocos/editor-support/cocostudio/CCSGUIReader.h b/cocos/editor-support/cocostudio/CCSGUIReader.h index 8c64dc0970af..024ba838e7a4 100644 --- a/cocos/editor-support/cocostudio/CCSGUIReader.h +++ b/cocos/editor-support/cocostudio/CCSGUIReader.h @@ -86,7 +86,7 @@ class CC_STUDIO_DLL GUIReader : public cocos2d::Ref SEL_ParseEvent callBack); void registerTypeAndCallBack(const std::string& classType, - cocos2d::ObjectFactory::InstanceFunc ins, + const cocos2d::ObjectFactory::InstanceFunc& ins, Ref* object, SEL_ParseEvent callBack); protected: diff --git a/cocos/editor-support/cocostudio/CCSSceneReader.cpp b/cocos/editor-support/cocostudio/CCSSceneReader.cpp index bb98286e0451..f3282de3cf5c 100644 --- a/cocos/editor-support/cocostudio/CCSSceneReader.cpp +++ b/cocos/editor-support/cocostudio/CCSSceneReader.cpp @@ -211,7 +211,7 @@ Node* SceneReader::nodeByTag(Node *parent, int tag) return _retNode; } -cocos2d::Component* SceneReader::createComponent(const std::string classname) +cocos2d::Component* SceneReader::createComponent(const std::string& classname) { std::string name = this->getComponentClassName(classname); Ref *object = ObjectFactory::getInstance()->createObject(name); diff --git a/cocos/editor-support/cocostudio/CCSSceneReader.h b/cocos/editor-support/cocostudio/CCSSceneReader.h index 01eb2fe0f4ac..857f9c63816a 100644 --- a/cocos/editor-support/cocostudio/CCSSceneReader.h +++ b/cocos/editor-support/cocostudio/CCSSceneReader.h @@ -67,13 +67,13 @@ class CC_STUDIO_DLL SceneReader cocos2d::Node* getNodeByTag(int nTag); inline AttachComponentType getAttachComponentType(){return _attachComponent;} CC_CONSTRUCTOR_ACCESS: - SceneReader(void); - virtual ~SceneReader(void); + SceneReader(); + virtual ~SceneReader(); private: std::string getComponentClassName(const std::string& name); - cocos2d::Component* createComponent(const std::string classname); + cocos2d::Component* createComponent(const std::string& classname); cocos2d::Node* createObject(const rapidjson::Value& dict, cocos2d::Node* parent, AttachComponentType attachComponent); diff --git a/cocos/editor-support/cocostudio/CCSkin.cpp b/cocos/editor-support/cocostudio/CCSkin.cpp index 57e6f8b160c4..ee1ffa2293e1 100644 --- a/cocos/editor-support/cocostudio/CCSkin.cpp +++ b/cocos/editor-support/cocostudio/CCSkin.cpp @@ -89,7 +89,7 @@ Skin::Skin() bool Skin::initWithSpriteFrameName(const std::string& spriteFrameName) { - CCAssert(spriteFrameName != "", ""); + CCAssert(!spriteFrameName.empty(), ""); SpriteFrame *pFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName(spriteFrameName); bool ret = true; diff --git a/cocos/editor-support/cocostudio/CCTransformHelp.cpp b/cocos/editor-support/cocostudio/CCTransformHelp.cpp index e27529d1694a..bfc311fd2c90 100644 --- a/cocos/editor-support/cocostudio/CCTransformHelp.cpp +++ b/cocos/editor-support/cocostudio/CCTransformHelp.cpp @@ -24,6 +24,7 @@ THE SOFTWARE. ****************************************************************************/ #include "editor-support/cocostudio/CCTransformHelp.h" +#include #include "editor-support/cocostudio/CCUtilMath.h" using namespace cocos2d; @@ -99,8 +100,8 @@ void TransformHelp::nodeToMatrix(const BaseData &node, AffineTransform &matrix) { if (node.skewX == -node.skewY) { - double sine = sin(node.skewX); - double cosine = cos(node.skewX); + double sine = std::sin(node.skewX); + double cosine = std::cos(node.skewX); matrix.a = node.scaleX * cosine; matrix.b = node.scaleX * -sine; @@ -109,10 +110,10 @@ void TransformHelp::nodeToMatrix(const BaseData &node, AffineTransform &matrix) } else { - matrix.a = node.scaleX * cos(node.skewY); - matrix.b = node.scaleX * sin(node.skewY); - matrix.c = node.scaleY * sin(node.skewX); - matrix.d = node.scaleY * cos(node.skewX); + matrix.a = node.scaleX * std::cos(node.skewY); + matrix.b = node.scaleX * std::sin(node.skewY); + matrix.c = node.scaleY * std::sin(node.skewX); + matrix.d = node.scaleY * std::cos(node.skewX); } matrix.tx = node.x; @@ -125,8 +126,8 @@ void TransformHelp::nodeToMatrix(const BaseData &node, Mat4 &matrix) if (node.skewX == -node.skewY) { - double sine = sin(node.skewX); - double cosine = cos(node.skewX); + double sine = std::sin(node.skewX); + double cosine = std::cos(node.skewX); matrix.m[0] = node.scaleX * cosine; matrix.m[1] = node.scaleX * -sine; @@ -135,10 +136,10 @@ void TransformHelp::nodeToMatrix(const BaseData &node, Mat4 &matrix) } else { - matrix.m[0] = node.scaleX * cos(node.skewY); - matrix.m[1] = node.scaleX * sin(node.skewY); - matrix.m[4] = node.scaleY * sin(node.skewX); - matrix.m[5] = node.scaleY * cos(node.skewX); + matrix.m[0] = node.scaleX * std::cos(node.skewY); + matrix.m[1] = node.scaleX * std::sin(node.skewY); + matrix.m[4] = node.scaleY * std::sin(node.skewX); + matrix.m[5] = node.scaleY * std::cos(node.skewX); } matrix.m[12] = node.x; @@ -166,8 +167,8 @@ void TransformHelp::matrixToNode(const AffineTransform &matrix, BaseData &node) node.skewX = -(atan2f(helpPoint1.y, helpPoint1.x) - 1.5707964f); node.skewY = atan2f(helpPoint2.y, helpPoint2.x); - node.scaleX = sqrt(matrix.a * matrix.a + matrix.b * matrix.b); - node.scaleY = sqrt(matrix.c * matrix.c + matrix.d * matrix.d); + node.scaleX = std::sqrt(matrix.a * matrix.a + matrix.b * matrix.b); + node.scaleY = std::sqrt(matrix.c * matrix.c + matrix.d * matrix.d); node.x = matrix.tx; node.y = matrix.ty; } @@ -192,8 +193,8 @@ void TransformHelp::matrixToNode(const Mat4 &matrix, BaseData &node) node.skewX = -(atan2f(helpPoint1.y, helpPoint1.x) - 1.5707964f); node.skewY = atan2f(helpPoint2.y, helpPoint2.x); - node.scaleX = sqrt(matrix.m[0] * matrix.m[0] + matrix.m[1] * matrix.m[1]); - node.scaleY = sqrt(matrix.m[4] * matrix.m[4] + matrix.m[5] * matrix.m[5]); + node.scaleX = std::sqrt(matrix.m[0] * matrix.m[0] + matrix.m[1] * matrix.m[1]); + node.scaleY = std::sqrt(matrix.m[4] * matrix.m[4] + matrix.m[5] * matrix.m[5]); node.x = matrix.m[12]; node.y = matrix.m[13]; } diff --git a/cocos/editor-support/cocostudio/CCTween.cpp b/cocos/editor-support/cocostudio/CCTween.cpp index eee00fef69f9..f372057ab3d4 100644 --- a/cocos/editor-support/cocostudio/CCTween.cpp +++ b/cocos/editor-support/cocostudio/CCTween.cpp @@ -69,7 +69,7 @@ Tween::Tween() } -Tween::~Tween(void) +Tween::~Tween() { CC_SAFE_DELETE( _from ); CC_SAFE_DELETE( _between ); diff --git a/cocos/editor-support/cocostudio/CCTween.h b/cocos/editor-support/cocostudio/CCTween.h index 848f046ee67c..125a9faf08c9 100644 --- a/cocos/editor-support/cocostudio/CCTween.h +++ b/cocos/editor-support/cocostudio/CCTween.h @@ -50,8 +50,8 @@ class CC_STUDIO_DLL Tween : public ProcessBase */ static Tween *create(Bone *bone); public: - Tween(void); - virtual ~Tween(void); + Tween(); + virtual ~Tween(); /** * Init with a Bone diff --git a/cocos/editor-support/cocostudio/CCUtilMath.cpp b/cocos/editor-support/cocostudio/CCUtilMath.cpp index 971e78f4b225..fcd40aa91690 100644 --- a/cocos/editor-support/cocostudio/CCUtilMath.cpp +++ b/cocos/editor-support/cocostudio/CCUtilMath.cpp @@ -24,6 +24,7 @@ THE SOFTWARE. ****************************************************************************/ #include "editor-support/cocostudio/CCUtilMath.h" +#include using namespace cocos2d; @@ -72,8 +73,8 @@ Vec2 circleTo(float t, Vec2 ¢er, float radius, float fromRadian, float radia { Vec2 p; - p.x = center.x + radius * cos(fromRadian + radianDif * t); - p.y = center.y + radius * sin(fromRadian + radianDif * t); + p.x = center.x + radius * std::cos(fromRadian + radianDif * t); + p.y = center.y + radius * std::sin(fromRadian + radianDif * t); return p; } diff --git a/cocos/editor-support/cocostudio/CMakeLists.txt b/cocos/editor-support/cocostudio/CMakeLists.txt index da192aaa51b1..30d7ee7163d7 100644 --- a/cocos/editor-support/cocostudio/CMakeLists.txt +++ b/cocos/editor-support/cocostudio/CMakeLists.txt @@ -1,10 +1,3 @@ - -if(WINDOWS AND BUILD_SHARED_LIBS) - add_definitions(-D_USRSTUDIODLL) -endif() - -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ") - set(COCOS_CS_HEADER editor-support/cocostudio/CCProcessBase.h diff --git a/cocos/editor-support/cocostudio/FlatBuffersSerialize.cpp b/cocos/editor-support/cocostudio/FlatBuffersSerialize.cpp index 4af5afc8cee2..2fe8be3c26f0 100644 --- a/cocos/editor-support/cocostudio/FlatBuffersSerialize.cpp +++ b/cocos/editor-support/cocostudio/FlatBuffersSerialize.cpp @@ -325,7 +325,7 @@ std::string FlatBuffersSerialize::serializeFlatBuffersWithXMLFile(const std::str // NodeTree Offset FlatBuffersSerialize::createNodeTree(const tinyxml2::XMLElement *objectData, - std::string classType) + const std::string& classType) { std::string classname = classType.substr(0, classType.find("ObjectData")); // CCLOG("classname = %s", classname.c_str()); @@ -434,7 +434,7 @@ Offset FlatBuffersSerialize::createNodeTree(const tinyxml2::XMLElement } -int FlatBuffersSerialize::getResourceType(std::string key) +int FlatBuffersSerialize::getResourceType(const std::string& key) { if(key == "Normal" || key == "Default") { @@ -577,7 +577,7 @@ Offset FlatBuffersSerialize::createNodeAction(const tinyxml2::XMLEle } else if (name == "ActivedAnimationName") { - currentAnimationName = value.c_str(); + currentAnimationName = value; } attribute = attribute->Next(); @@ -1410,7 +1410,7 @@ FlatBufferBuilder* FlatBuffersSerialize::createFlatBuffersWithXMLFileForSimulato } Offset FlatBuffersSerialize::createNodeTreeForSimulator(const tinyxml2::XMLElement *objectData, - std::string classType) + const std::string& classType) { std::string classname = classType.substr(0, classType.find("ObjectData")); // CCLOG("classname = %s", classname.c_str()); diff --git a/cocos/editor-support/cocostudio/FlatBuffersSerialize.h b/cocos/editor-support/cocostudio/FlatBuffersSerialize.h index 994eaa268158..87de82219ea8 100644 --- a/cocos/editor-support/cocostudio/FlatBuffersSerialize.h +++ b/cocos/editor-support/cocostudio/FlatBuffersSerialize.h @@ -116,7 +116,7 @@ class CC_STUDIO_DLL FlatBuffersSerialize // NodeTree flatbuffers::Offset createNodeTree(const tinyxml2::XMLElement* objectData, - std::string classType); + const std::string& classType); // NodeAction flatbuffers::Offset createNodeAction(const tinyxml2::XMLElement* objectData); @@ -137,14 +137,14 @@ class CC_STUDIO_DLL FlatBuffersSerialize flatbuffers::Offset createAnimationInfo(const tinyxml2::XMLElement* objectData); /**/ - int getResourceType(std::string key); + int getResourceType(const std::string& key); std::string getGUIClassName(const std::string &name); std::string getWidgetReaderClassName(cocos2d::ui::Widget *widget); /* create flat buffers with XML */ flatbuffers::FlatBufferBuilder* createFlatBuffersWithXMLFileForSimulator(const std::string& xmlFileName); flatbuffers::Offset createNodeTreeForSimulator(const tinyxml2::XMLElement* objectData, - std::string classType); + const std::string& classType); flatbuffers::Offset createProjectNodeOptionsForSimulator(const tinyxml2::XMLElement* objectData); /**/ std::string getCsdVersion() { return _csdVersion; } diff --git a/cocos/editor-support/cocostudio/TriggerBase.h b/cocos/editor-support/cocostudio/TriggerBase.h index 5c9383e43992..ec6b3646fd6b 100755 --- a/cocos/editor-support/cocostudio/TriggerBase.h +++ b/cocos/editor-support/cocostudio/TriggerBase.h @@ -36,10 +36,10 @@ THE SOFTWARE. #define DECLARE_CLASS_INFO \ public: \ static cocos2d::ObjectFactory::TInfo Type; \ - static cocos2d::Ref* createInstance(void); \ + static cocos2d::Ref* createInstance(); \ #define IMPLEMENT_CLASS_INFO(className) \ - cocos2d::Ref* className::createInstance(void) \ + cocos2d::Ref* className::createInstance() \ { \ auto ret = new (std::nothrow) className; \ ret->autorelease(); \ diff --git a/cocos/editor-support/cocostudio/TriggerMng.cpp b/cocos/editor-support/cocostudio/TriggerMng.cpp index f61ed9651014..469fcf13862a 100755 --- a/cocos/editor-support/cocostudio/TriggerMng.cpp +++ b/cocos/editor-support/cocostudio/TriggerMng.cpp @@ -24,6 +24,7 @@ THE SOFTWARE. ****************************************************************************/ #include "editor-support/cocostudio/TriggerMng.h" +#include #include "json/prettywriter.h" #include "json/stringbuffer.h" #include "base/CCDirector.h" @@ -37,14 +38,14 @@ namespace cocostudio { TriggerMng* TriggerMng::_sharedTriggerMng = nullptr; -TriggerMng::TriggerMng(void) +TriggerMng::TriggerMng() : _movementDispatches(new std::unordered_map) { _eventDispatcher = Director::getInstance()->getEventDispatcher(); _eventDispatcher->retain(); } -TriggerMng::~TriggerMng(void) +TriggerMng::~TriggerMng() { removeAll(); _triggerObjs.clear(); @@ -157,7 +158,7 @@ TriggerObj* TriggerMng::getTriggerObj(unsigned int id) const return iter->second; } -void TriggerMng::removeAll(void) +void TriggerMng::removeAll() { auto etIter = _triggerObjs.begin(); for (;etIter != _triggerObjs.end(); ++etIter) @@ -189,7 +190,7 @@ bool TriggerMng::removeTriggerObj(unsigned int id) return true; } -bool TriggerMng::isEmpty(void) const +bool TriggerMng::isEmpty() const { return _triggerObjs.empty(); } @@ -220,7 +221,7 @@ void TriggerMng::buildJson(rapidjson::Document &document, cocostudio::CocoLoader std::string key1 = pTriggerArray[i1].GetName(pCocoLoader); const char *str1 = pTriggerArray[i1].GetValue(pCocoLoader); - if (key1.compare("actions") == 0) + if (key1 == "actions") { rapidjson::Value actionsItem(rapidjson::kArrayType); @@ -236,14 +237,14 @@ void TriggerMng::buildJson(rapidjson::Document &document, cocostudio::CocoLoader { std::string key2 = pActionArray[i3].GetName(pCocoLoader); const char *str2 = pActionArray[i3].GetValue(pCocoLoader); - if (key2.compare("classname") == 0) + if (key2 == "classname") { if (str2 != nullptr) { action.AddMember("classname", rapidjson::Value(str2,allocator), allocator); } } - else if (key2.compare("dataitems") == 0) + else if (key2 == "dataitems") { rapidjson::Value dataitems(rapidjson::kArrayType); size = pActionArray[i3].GetChildNum(); @@ -257,7 +258,7 @@ void TriggerMng::buildJson(rapidjson::Document &document, cocostudio::CocoLoader { std::string key3 = pDataItemArray[i5].GetName(pCocoLoader); const char *str3 = pDataItemArray[i5].GetValue(pCocoLoader); - if (key3.compare("key") == 0) + if (key3 == "key") { if (str3 != nullptr) { @@ -275,7 +276,7 @@ void TriggerMng::buildJson(rapidjson::Document &document, cocostudio::CocoLoader { int nV = atoi(str3); float fV = utils::atof(str3); - if (fabs(nV - fV) < 0.0000001) + if (std::fabs(nV - fV) < 0.0000001) { dataitem.AddMember("value", nV, allocator); } @@ -296,7 +297,7 @@ void TriggerMng::buildJson(rapidjson::Document &document, cocostudio::CocoLoader vElemItem.AddMember("actions", actionsItem, allocator); } - else if (key1.compare("conditions") == 0) + else if (key1 == "conditions") { rapidjson::Value condsItem(rapidjson::kArrayType); @@ -312,14 +313,14 @@ void TriggerMng::buildJson(rapidjson::Document &document, cocostudio::CocoLoader { std::string key4 = pConditionArray[i7].GetName(pCocoLoader); const char *str4 = pConditionArray[i7].GetValue(pCocoLoader); - if (key4.compare("classname") == 0) + if (key4 == "classname") { if (str4 != nullptr) { cond.AddMember("classname", rapidjson::Value(str4,allocator), allocator); } } - else if (key4.compare("dataitems") == 0) + else if (key4 == "dataitems") { rapidjson::Value dataitems(rapidjson::kArrayType); size = pConditionArray[i7].GetChildNum(); @@ -333,7 +334,7 @@ void TriggerMng::buildJson(rapidjson::Document &document, cocostudio::CocoLoader { std::string key5 = pDataItemArray[i9].GetName(pCocoLoader); const char *str5 = pDataItemArray[i9].GetValue(pCocoLoader); - if (key5.compare("key") == 0) + if (key5 == "key") { if (str5 != nullptr) { @@ -351,7 +352,7 @@ void TriggerMng::buildJson(rapidjson::Document &document, cocostudio::CocoLoader { int nV = atoi(str5); float fV = utils::atof(str5); - if (fabs(nV - fV) < 0.0000001) + if (std::fabs(nV - fV) < 0.0000001) { dataitem.AddMember("value", nV, allocator); } @@ -372,7 +373,7 @@ void TriggerMng::buildJson(rapidjson::Document &document, cocostudio::CocoLoader vElemItem.AddMember("conditions", condsItem, allocator); } - else if (key1.compare("events") == 0) + else if (key1 == "events") { rapidjson::Value eventsItem(rapidjson::kArrayType); @@ -384,7 +385,7 @@ void TriggerMng::buildJson(rapidjson::Document &document, cocostudio::CocoLoader stExpCocoNode *pEventArray = pEventsArray->GetChildArray(pCocoLoader); std::string key6 = pEventArray[0].GetName(pCocoLoader); const char *str6 = pEventArray[0].GetValue(pCocoLoader); - if (key6.compare("id") == 0 && str6 != nullptr) + if (key6 == "id" && str6 != nullptr) { event.AddMember("id", atoi(str6), allocator); eventsItem.PushBack(event, allocator); @@ -392,7 +393,7 @@ void TriggerMng::buildJson(rapidjson::Document &document, cocostudio::CocoLoader } vElemItem.AddMember("events", eventsItem, allocator); } - else if (key1.compare("id") == 0) + else if (key1 == "id") { if (str1 != nullptr) { @@ -492,13 +493,13 @@ void TriggerMng::addEventListenerWithFixedPriority(cocos2d::EventListener* liste _eventDispatcher->addEventListenerWithFixedPriority(listener, fixedPriority); } -ArmatureMovementDispatcher::ArmatureMovementDispatcher(void) +ArmatureMovementDispatcher::ArmatureMovementDispatcher() : _mapEventAnimation(nullptr) { _mapEventAnimation = new (std::nothrow) std::unordered_map ; } -ArmatureMovementDispatcher::~ArmatureMovementDispatcher(void) +ArmatureMovementDispatcher::~ArmatureMovementDispatcher() { _mapEventAnimation->clear(); CC_SAFE_DELETE(_mapEventAnimation); diff --git a/cocos/editor-support/cocostudio/TriggerMng.h b/cocos/editor-support/cocostudio/TriggerMng.h index 6673bd357406..88a63fad2755 100755 --- a/cocos/editor-support/cocostudio/TriggerMng.h +++ b/cocos/editor-support/cocostudio/TriggerMng.h @@ -39,8 +39,8 @@ class TriggerObj; class CC_STUDIO_DLL ArmatureMovementDispatcher : public cocos2d::Ref { public: - ArmatureMovementDispatcher(void); - ~ArmatureMovementDispatcher(void); + ArmatureMovementDispatcher(); + ~ArmatureMovementDispatcher(); public: void addAnimationEventCallBack(cocos2d::Ref*pTarget, SEL_MovementEventCallFunc mecf); void removeAnnimationEventCallBack(cocos2d::Ref*pTarget, SEL_MovementEventCallFunc mecf); @@ -54,8 +54,8 @@ class CC_STUDIO_DLL ArmatureMovementDispatcher : public cocos2d::Ref class CC_STUDIO_DLL TriggerMng { public: - TriggerMng(void); - virtual ~TriggerMng(void); + TriggerMng(); + virtual ~TriggerMng(); public: static TriggerMng* getInstance(); @@ -65,12 +65,12 @@ class CC_STUDIO_DLL TriggerMng public: void parse(const rapidjson::Value &root); void parse(cocostudio::CocoLoader *pCocoLoader, cocostudio::stExpCocoNode *pCocoNode); - void removeAll(void); + void removeAll(); cocos2d::Vector* get(unsigned int event) const; TriggerObj* getTriggerObj(unsigned int id) const; bool removeTriggerObj(TriggerObj *Obj); bool removeTriggerObj(unsigned int id); - bool isEmpty(void) const; + bool isEmpty() const; void addArmatureMovementCallBack(Armature *pAr, cocos2d::Ref *pTarget, SEL_MovementEventCallFunc mecf); void removeArmatureMovementCallBack(Armature *pAr, cocos2d::Ref *pTarget, SEL_MovementEventCallFunc mecf); diff --git a/cocos/editor-support/cocostudio/TriggerObj.cpp b/cocos/editor-support/cocostudio/TriggerObj.cpp index fe649000ff7f..2a72ba1dde6c 100755 --- a/cocos/editor-support/cocostudio/TriggerObj.cpp +++ b/cocos/editor-support/cocostudio/TriggerObj.cpp @@ -29,11 +29,11 @@ using namespace cocos2d; namespace cocostudio { -BaseTriggerCondition::BaseTriggerCondition(void) +BaseTriggerCondition::BaseTriggerCondition() { } -BaseTriggerCondition::~BaseTriggerCondition(void) +BaseTriggerCondition::~BaseTriggerCondition() { } @@ -60,11 +60,11 @@ void BaseTriggerCondition::removeAll() { } -BaseTriggerAction::BaseTriggerAction(void) +BaseTriggerAction::BaseTriggerAction() { } -BaseTriggerAction::~BaseTriggerAction(void) +BaseTriggerAction::~BaseTriggerAction() { } @@ -90,13 +90,13 @@ void BaseTriggerAction::removeAll() { } -TriggerObj::TriggerObj(void) +TriggerObj::TriggerObj() :_id(UINT_MAX) ,_enabled(true) { } -TriggerObj::~TriggerObj(void) +TriggerObj::~TriggerObj() { } @@ -252,14 +252,14 @@ void TriggerObj::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stEx { std::string key = pTriggerObjArray[i0].GetName(pCocoLoader); const char* str0 = pTriggerObjArray[i0].GetValue(pCocoLoader); - if (key.compare("id") == 0) + if (key == "id") { if (str0 != nullptr) { _id = atoi(str0); } } - else if (key.compare("conditions") == 0) + else if (key == "conditions") { count = pTriggerObjArray[i0].GetChildNum(); stExpCocoNode *pConditionsArray = pTriggerObjArray[i0].GetChildArray(pCocoLoader); @@ -279,7 +279,7 @@ void TriggerObj::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stEx _cons.pushBack(con); } } - else if (key.compare("actions") == 0) + else if (key == "actions") { count = pTriggerObjArray[i0].GetChildNum(); stExpCocoNode *pActionsArray = pTriggerObjArray[i0].GetChildArray(pCocoLoader); @@ -299,7 +299,7 @@ void TriggerObj::serialize(cocostudio::CocoLoader *pCocoLoader, cocostudio::stEx _acts.pushBack(act); } } - else if (key.compare("events") == 0) + else if (key == "events") { count = pTriggerObjArray[i0].GetChildNum(); stExpCocoNode *pEventsArray = pTriggerObjArray[i0].GetChildArray(pCocoLoader); diff --git a/cocos/editor-support/cocostudio/TriggerObj.h b/cocos/editor-support/cocostudio/TriggerObj.h index 846b81d2c168..efd4ebeb2ff3 100755 --- a/cocos/editor-support/cocostudio/TriggerObj.h +++ b/cocos/editor-support/cocostudio/TriggerObj.h @@ -36,9 +36,9 @@ namespace cocostudio { class CC_STUDIO_DLL BaseTriggerCondition : public cocos2d::Ref { protected: - BaseTriggerCondition(void); + BaseTriggerCondition(); public: - virtual ~BaseTriggerCondition(void); + virtual ~BaseTriggerCondition(); virtual bool init(); virtual bool detect(); virtual void serialize(const rapidjson::Value &val); @@ -49,9 +49,9 @@ class CC_STUDIO_DLL BaseTriggerCondition : public cocos2d::Ref class CC_STUDIO_DLL BaseTriggerAction : public cocos2d::Ref { protected: - BaseTriggerAction(void); + BaseTriggerAction(); public: - virtual ~BaseTriggerAction(void); + virtual ~BaseTriggerAction(); virtual bool init(); virtual void done(); virtual void serialize(const rapidjson::Value &val); @@ -63,10 +63,10 @@ class CC_STUDIO_DLL BaseTriggerAction : public cocos2d::Ref class CC_STUDIO_DLL TriggerObj : public cocos2d::Ref { public: - TriggerObj(void); - virtual ~TriggerObj(void); + TriggerObj(); + virtual ~TriggerObj(); virtual bool init(); - static TriggerObj* create(void); + static TriggerObj* create(); virtual bool detect(); virtual void done(); diff --git a/cocos/editor-support/cocostudio/WidgetReader/ArmatureNodeReader/ArmatureNodeReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/ArmatureNodeReader/ArmatureNodeReader.cpp index 75f01a4e2b78..c2bd3cb0b605 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/ArmatureNodeReader/ArmatureNodeReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/ArmatureNodeReader/ArmatureNodeReader.cpp @@ -160,7 +160,7 @@ void ArmatureNodeReader::setPropsWithFlatBuffers(cocos2d::Node *node, std::string fullpath = FileUtils::getInstance()->fullPathForFilename(filepath); - std::string dirpath = fullpath.substr(0, fullpath.find_last_of("/")); + std::string dirpath = fullpath.substr(0, fullpath.find_last_of('/')); FileUtils::getInstance()->addSearchPath(dirpath); ArmatureDataManager::getInstance()->addArmatureFileInfo(fullpath); @@ -201,9 +201,9 @@ cocos2d::Node* ArmatureNodeReader::createNodeWithFlatBuffers(const flatbuffers: std::string ArmatureNodeReader::getArmatureName(const std::string& exporJsonPath) { //FileUtils.getFileData(exporJsonPath, "r", size) // need read armature name in exportJsonPath - size_t end = exporJsonPath.find_last_of("."); - size_t start = exporJsonPath.find_last_of("\\") + 1; - size_t start1 = exporJsonPath.find_last_of("/") + 1; + size_t end = exporJsonPath.find_last_of('.'); + size_t start = exporJsonPath.find_last_of('\\') + 1; + size_t start1 = exporJsonPath.find_last_of('/') + 1; if (start < start1) start = start1; diff --git a/cocos/editor-support/cocostudio/WidgetReader/ButtonReader/ButtonReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/ButtonReader/ButtonReader.cpp index 88430fe280be..6a7dcd6f69e7 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/ButtonReader/ButtonReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/ButtonReader/ButtonReader.cpp @@ -878,9 +878,7 @@ namespace cocostudio Color3B titleColor(textColor->r(), textColor->g(), textColor->b()); button->setTitleColor(titleColor); - int titleFontSize = options->fontSize(); - button->setTitleFontSize(titleFontSize); - + std::string titleFontName = options->fontName()->c_str(); button->setTitleFontName(titleFontName); @@ -888,7 +886,7 @@ namespace cocostudio bool fileExist = false; std::string errorFilePath = ""; std::string path = resourceData->path()->c_str(); - if (path != "") + if (!path.empty()) { if (FileUtils::getInstance()->isFileExist(path)) { @@ -905,6 +903,9 @@ namespace cocostudio } } + int titleFontSize = options->fontSize(); + button->setTitleFontSize(titleFontSize); + bool displaystate = options->displaystate() != 0; button->setBright(displaystate); button->setEnabled(displaystate); @@ -966,7 +967,7 @@ namespace cocostudio return button; } - int ButtonReader::getResourceType(std::string key) + int ButtonReader::getResourceType(const std::string& key) { if(key == "Normal" || key == "Default") { diff --git a/cocos/editor-support/cocostudio/WidgetReader/ButtonReader/ButtonReader.h b/cocos/editor-support/cocostudio/WidgetReader/ButtonReader/ButtonReader.h index 231d811b76d8..454894fd663c 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/ButtonReader/ButtonReader.h +++ b/cocos/editor-support/cocostudio/WidgetReader/ButtonReader/ButtonReader.h @@ -53,7 +53,7 @@ namespace cocostudio void setPropsWithFlatBuffers(cocos2d::Node* node, const flatbuffers::Table* buttonOptions); cocos2d::Node* createNodeWithFlatBuffers(const flatbuffers::Table* buttonOptions); - int getResourceType(std::string key); + int getResourceType(const std::string& key); }; } diff --git a/cocos/editor-support/cocostudio/WidgetReader/CheckBoxReader/CheckBoxReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/CheckBoxReader/CheckBoxReader.cpp index 7a1bf1acb61b..08e820e5af1d 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/CheckBoxReader/CheckBoxReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/CheckBoxReader/CheckBoxReader.cpp @@ -775,7 +775,7 @@ namespace cocostudio return checkBox; } - int CheckBoxReader::getResourceType(std::string key) + int CheckBoxReader::getResourceType(const std::string& key) { if(key == "Normal" || key == "Default") { diff --git a/cocos/editor-support/cocostudio/WidgetReader/CheckBoxReader/CheckBoxReader.h b/cocos/editor-support/cocostudio/WidgetReader/CheckBoxReader/CheckBoxReader.h index d1a3ccd61b9e..0cebc7633951 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/CheckBoxReader/CheckBoxReader.h +++ b/cocos/editor-support/cocostudio/WidgetReader/CheckBoxReader/CheckBoxReader.h @@ -50,7 +50,7 @@ namespace cocostudio flatbuffers::FlatBufferBuilder* builder); void setPropsWithFlatBuffers(cocos2d::Node* node, const flatbuffers::Table* checkBoxOptions); cocos2d::Node* createNodeWithFlatBuffers(const flatbuffers::Table* checkBoxOptions); - virtual int getResourceType(std::string key); + virtual int getResourceType(const std::string& key); }; } diff --git a/cocos/editor-support/cocostudio/WidgetReader/GameMapReader/GameMapReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/GameMapReader/GameMapReader.cpp index 28da60915fe5..7bfe60e98bda 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/GameMapReader/GameMapReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/GameMapReader/GameMapReader.cpp @@ -179,7 +179,7 @@ namespace cocostudio { Size size = layerInfo->_layerSize; auto& tilesets = mapInfo->getTilesets(); - if (tilesets.size()>0) + if (!tilesets.empty()) { TMXTilesetInfo* tileset = nullptr; for (auto iter = tilesets.crbegin(); iter != tilesets.crend(); ++iter) diff --git a/cocos/editor-support/cocostudio/WidgetReader/GameNode3DReader/GameNode3DReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/GameNode3DReader/GameNode3DReader.cpp index 85073038f670..bf8aac2fa7fe 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/GameNode3DReader/GameNode3DReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/GameNode3DReader/GameNode3DReader.cpp @@ -440,7 +440,7 @@ namespace cocostudio return node; } - int GameNode3DReader::getResourceType(std::string key) + int GameNode3DReader::getResourceType(const std::string& key) { if (key == "Normal" || key == "Default") { diff --git a/cocos/editor-support/cocostudio/WidgetReader/GameNode3DReader/GameNode3DReader.h b/cocos/editor-support/cocostudio/WidgetReader/GameNode3DReader/GameNode3DReader.h index 1349b882a180..362482be269d 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/GameNode3DReader/GameNode3DReader.h +++ b/cocos/editor-support/cocostudio/WidgetReader/GameNode3DReader/GameNode3DReader.h @@ -58,7 +58,7 @@ namespace cocostudio cocos2d::Node* createNodeWithFlatBuffers(const flatbuffers::Table* node3DOptions); protected: - int getResourceType(std::string key); + int getResourceType(const std::string& key); }; } diff --git a/cocos/editor-support/cocostudio/WidgetReader/ImageViewReader/ImageViewReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/ImageViewReader/ImageViewReader.cpp index 9139c1a6703f..7df02d8c3dc2 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/ImageViewReader/ImageViewReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/ImageViewReader/ImageViewReader.cpp @@ -422,7 +422,7 @@ namespace cocostudio return imageView; } - int ImageViewReader::getResourceType(std::string key) + int ImageViewReader::getResourceType(const std::string& key) { if(key == "Normal" || key == "Default") { diff --git a/cocos/editor-support/cocostudio/WidgetReader/ImageViewReader/ImageViewReader.h b/cocos/editor-support/cocostudio/WidgetReader/ImageViewReader/ImageViewReader.h index 1af986c85597..4f8479eccd68 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/ImageViewReader/ImageViewReader.h +++ b/cocos/editor-support/cocostudio/WidgetReader/ImageViewReader/ImageViewReader.h @@ -53,7 +53,7 @@ namespace cocostudio void setPropsWithFlatBuffers(cocos2d::Node* node, const flatbuffers::Table* imageViewOptions); cocos2d::Node* createNodeWithFlatBuffers(const flatbuffers::Table* imageViewOptions); - int getResourceType(std::string key); + int getResourceType(const std::string& key); }; } diff --git a/cocos/editor-support/cocostudio/WidgetReader/LayoutReader/LayoutReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/LayoutReader/LayoutReader.cpp index 97616fd0198a..80d8f1caf870 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/LayoutReader/LayoutReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/LayoutReader/LayoutReader.cpp @@ -648,7 +648,7 @@ namespace cocostudio auto imageFileNameDic = options->backGroundImageData(); int imageFileNameType = imageFileNameDic->resourceType(); std::string imageFileName = imageFileNameDic->path()->c_str(); - if (imageFileName != "") + if (!imageFileName.empty()) { switch (imageFileNameType) { @@ -746,7 +746,7 @@ namespace cocostudio return layout; } - int LayoutReader::getResourceType(std::string key) + int LayoutReader::getResourceType(const std::string& key) { if(key == "Normal" || key == "Default") { diff --git a/cocos/editor-support/cocostudio/WidgetReader/LayoutReader/LayoutReader.h b/cocos/editor-support/cocostudio/WidgetReader/LayoutReader/LayoutReader.h index 8c62f46727a0..3912b2be98e0 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/LayoutReader/LayoutReader.h +++ b/cocos/editor-support/cocostudio/WidgetReader/LayoutReader/LayoutReader.h @@ -52,7 +52,7 @@ namespace cocostudio void setPropsWithFlatBuffers(cocos2d::Node* node, const flatbuffers::Table* layoutOptions); cocos2d::Node* createNodeWithFlatBuffers(const flatbuffers::Table* layoutOptions); - int getResourceType(std::string key); + int getResourceType(const std::string& key); }; } diff --git a/cocos/editor-support/cocostudio/WidgetReader/ListViewReader/ListViewReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/ListViewReader/ListViewReader.cpp index 14522532cf08..37a05ae0e382 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/ListViewReader/ListViewReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/ListViewReader/ListViewReader.cpp @@ -462,7 +462,7 @@ namespace cocostudio auto imageFileNameDic = options->backGroundImageData(); int imageFileNameType = imageFileNameDic->resourceType(); std::string imageFileName = imageFileNameDic->path()->c_str(); - if (imageFileName != "") + if (!imageFileName.empty()) { switch (imageFileNameType) { @@ -539,11 +539,11 @@ namespace cocostudio // listView->setGravity(gravity); std::string directionType = options->directionType()->c_str(); - if (directionType == "") + if (directionType.empty()) { listView->setDirection(ListView::Direction::HORIZONTAL); std::string verticalType = options->verticalType()->c_str(); - if (verticalType == "") + if (verticalType.empty()) { listView->setGravity(ListView::Gravity::TOP); } @@ -560,7 +560,7 @@ namespace cocostudio { listView->setDirection(ListView::Direction::VERTICAL); std::string horizontalType = options->horizontalType()->c_str(); - if (horizontalType == "") + if (horizontalType.empty()) { listView->setGravity(ListView::Gravity::LEFT); } @@ -609,7 +609,7 @@ namespace cocostudio return listView; } - int ListViewReader::getResourceType(std::string key) + int ListViewReader::getResourceType(const std::string& key) { if(key == "Normal" || key == "Default") { diff --git a/cocos/editor-support/cocostudio/WidgetReader/ListViewReader/ListViewReader.h b/cocos/editor-support/cocostudio/WidgetReader/ListViewReader/ListViewReader.h index 24b6f769bbb2..6ae3b49788ab 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/ListViewReader/ListViewReader.h +++ b/cocos/editor-support/cocostudio/WidgetReader/ListViewReader/ListViewReader.h @@ -51,7 +51,7 @@ namespace cocostudio void setPropsWithFlatBuffers(cocos2d::Node* node, const flatbuffers::Table* listViewOptions); cocos2d::Node* createNodeWithFlatBuffers(const flatbuffers::Table* listViewOptions); - int getResourceType(std::string key); + int getResourceType(const std::string& key); }; } diff --git a/cocos/editor-support/cocostudio/WidgetReader/LoadingBarReader/LoadingBarReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/LoadingBarReader/LoadingBarReader.cpp index cbf15f8639b6..b0c05c331919 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/LoadingBarReader/LoadingBarReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/LoadingBarReader/LoadingBarReader.cpp @@ -355,7 +355,7 @@ namespace cocostudio return loadingBar; } - int LoadingBarReader::getResourceType(std::string key) + int LoadingBarReader::getResourceType(const std::string& key) { if(key == "Normal" || key == "Default") { diff --git a/cocos/editor-support/cocostudio/WidgetReader/LoadingBarReader/LoadingBarReader.h b/cocos/editor-support/cocostudio/WidgetReader/LoadingBarReader/LoadingBarReader.h index dcb7ec2344a4..2dcc029f5d3f 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/LoadingBarReader/LoadingBarReader.h +++ b/cocos/editor-support/cocostudio/WidgetReader/LoadingBarReader/LoadingBarReader.h @@ -51,7 +51,7 @@ namespace cocostudio void setPropsWithFlatBuffers(cocos2d::Node* node, const flatbuffers::Table* loadingBarOptions); cocos2d::Node* createNodeWithFlatBuffers(const flatbuffers::Table* loadingBarOptions); - int getResourceType(std::string key); + int getResourceType(const std::string& key); }; } diff --git a/cocos/editor-support/cocostudio/WidgetReader/NodeReaderDefine.h b/cocos/editor-support/cocostudio/WidgetReader/NodeReaderDefine.h index 2cf4b38dc9a2..4eb0ed1d4eb6 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/NodeReaderDefine.h +++ b/cocos/editor-support/cocostudio/WidgetReader/NodeReaderDefine.h @@ -36,10 +36,10 @@ #define DECLARE_CLASS_NODE_READER_INFO \ public: \ static cocos2d::ObjectFactory::TInfo __Type; \ -static cocos2d::Ref* createInstance(void); \ +static cocos2d::Ref* createInstance(); \ #define IMPLEMENT_CLASS_NODE_READER_INFO(className) \ -cocos2d::Ref* className::createInstance(void) \ +cocos2d::Ref* className::createInstance() \ { \ return className::getInstance(); \ } \ @@ -48,6 +48,6 @@ cocos2d::ObjectFactory::TInfo className::__Type(#className, &className::createIn #define CREATE_CLASS_NODE_READER_INFO(className) \ cocos2d::ObjectFactory::TInfo(#className, &className::createInstance) \ -#define FLATSTR_TO_BOOL(str) (str.compare("True") == 0) ? true : false +#define FLATSTR_TO_BOOL(str) (str == "True") ? true : false #endif /* defined(__cocos2d_libs__NodeReaderDefine__) */ diff --git a/cocos/editor-support/cocostudio/WidgetReader/PageViewReader/PageViewReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/PageViewReader/PageViewReader.cpp index fe201babd66d..5240f88fdd05 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/PageViewReader/PageViewReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/PageViewReader/PageViewReader.cpp @@ -375,7 +375,7 @@ namespace cocostudio auto imageFileNameDic = options->backGroundImageData(); int imageFileNameType = imageFileNameDic->resourceType(); std::string imageFileName = imageFileNameDic->path()->c_str(); - if (imageFileName != "") + if (!imageFileName.empty()) { switch (imageFileNameType) { @@ -472,7 +472,7 @@ namespace cocostudio return pageView; } - int PageViewReader::getResourceType(std::string key) + int PageViewReader::getResourceType(const std::string& key) { if(key == "Normal" || key == "Default") { diff --git a/cocos/editor-support/cocostudio/WidgetReader/PageViewReader/PageViewReader.h b/cocos/editor-support/cocostudio/WidgetReader/PageViewReader/PageViewReader.h index 069c8f2b3e43..8497a6389f08 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/PageViewReader/PageViewReader.h +++ b/cocos/editor-support/cocostudio/WidgetReader/PageViewReader/PageViewReader.h @@ -51,7 +51,7 @@ namespace cocostudio void setPropsWithFlatBuffers(cocos2d::Node* node, const flatbuffers::Table* pageViewOptions); cocos2d::Node* createNodeWithFlatBuffers(const flatbuffers::Table* pageViewOptions); - int getResourceType(std::string key); + int getResourceType(const std::string& key); }; } diff --git a/cocos/editor-support/cocostudio/WidgetReader/ScrollViewReader/ScrollViewReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/ScrollViewReader/ScrollViewReader.cpp index d5d2530c1fff..f0f3faa059b9 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/ScrollViewReader/ScrollViewReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/ScrollViewReader/ScrollViewReader.cpp @@ -208,15 +208,15 @@ namespace cocostudio { bounceEnabled = FLATSTR_TO_BOOL(value); } - else if (name.compare("BarEnabled") == 0) + else if (name == "BarEnabled") { scrollbarEnabled = FLATSTR_TO_BOOL(value); } - else if (name.compare("BarAutoHide") == 0) + else if (name == "BarAutoHide") { scrollbarAutoHide = FLATSTR_TO_BOOL(value); } - else if (name.compare("BarAutoHideTime") == 0) + else if (name == "BarAutoHideTime") { scrollbarAutoHideTime = atof(value.c_str()); } @@ -476,7 +476,7 @@ namespace cocostudio auto imageFileNameDic = options->backGroundImageData(); int imageFileNameType = imageFileNameDic->resourceType(); std::string imageFileName = imageFileNameDic->path()->c_str(); - if (imageFileName != "") + if (!imageFileName.empty()) { switch (imageFileNameType) { @@ -591,7 +591,7 @@ namespace cocostudio return scrollView; } - int ScrollViewReader::getResourceType(std::string key) + int ScrollViewReader::getResourceType(const std::string& key) { if (key == "Normal" || key == "Default") { diff --git a/cocos/editor-support/cocostudio/WidgetReader/ScrollViewReader/ScrollViewReader.h b/cocos/editor-support/cocostudio/WidgetReader/ScrollViewReader/ScrollViewReader.h index 26cdf4e73abe..9be9c4abcac3 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/ScrollViewReader/ScrollViewReader.h +++ b/cocos/editor-support/cocostudio/WidgetReader/ScrollViewReader/ScrollViewReader.h @@ -51,7 +51,7 @@ namespace cocostudio void setPropsWithFlatBuffers(cocos2d::Node* node, const flatbuffers::Table* scrollViewOptions); cocos2d::Node* createNodeWithFlatBuffers(const flatbuffers::Table* scrollViewOptions); - int getResourceType(std::string key); + int getResourceType(const std::string& key); }; } diff --git a/cocos/editor-support/cocostudio/WidgetReader/SliderReader/SliderReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/SliderReader/SliderReader.cpp index 001f57e98285..47fbfe599ec2 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/SliderReader/SliderReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/SliderReader/SliderReader.cpp @@ -862,7 +862,7 @@ namespace cocostudio return slider; } - int SliderReader::getResourceType(std::string key) + int SliderReader::getResourceType(const std::string& key) { if(key == "Normal" || key == "Default") { diff --git a/cocos/editor-support/cocostudio/WidgetReader/SliderReader/SliderReader.h b/cocos/editor-support/cocostudio/WidgetReader/SliderReader/SliderReader.h index f8bf585a78b8..bae723ce2b9e 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/SliderReader/SliderReader.h +++ b/cocos/editor-support/cocostudio/WidgetReader/SliderReader/SliderReader.h @@ -51,7 +51,7 @@ namespace cocostudio void setPropsWithFlatBuffers(cocos2d::Node* node, const flatbuffers::Table* sliderOptions); cocos2d::Node* createNodeWithFlatBuffers(const flatbuffers::Table* sliderOptions); - int getResourceType(std::string key); + int getResourceType(const std::string& key); }; } diff --git a/cocos/editor-support/cocostudio/WidgetReader/SpriteReader/SpriteReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/SpriteReader/SpriteReader.cpp index b664d6b12cf9..0db38a5dd10e 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/SpriteReader/SpriteReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/SpriteReader/SpriteReader.cpp @@ -273,7 +273,7 @@ namespace cocostudio return sprite; } - int SpriteReader::getResourceType(std::string key) + int SpriteReader::getResourceType(const std::string& key) { if(key == "Normal" || key == "Default") { diff --git a/cocos/editor-support/cocostudio/WidgetReader/SpriteReader/SpriteReader.h b/cocos/editor-support/cocostudio/WidgetReader/SpriteReader/SpriteReader.h index 8d8e9660ef9f..600632b8edba 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/SpriteReader/SpriteReader.h +++ b/cocos/editor-support/cocostudio/WidgetReader/SpriteReader/SpriteReader.h @@ -51,7 +51,7 @@ namespace cocostudio void setPropsWithFlatBuffers(cocos2d::Node* node, const flatbuffers::Table* spriteOptions); cocos2d::Node* createNodeWithFlatBuffers(const flatbuffers::Table* spriteOptions); - int getResourceType(std::string key); + int getResourceType(const std::string& key); }; } diff --git a/cocos/editor-support/cocostudio/WidgetReader/TabControlReader/TabControlReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/TabControlReader/TabControlReader.cpp index 873b4ec2ab58..0352161d855c 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/TabControlReader/TabControlReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/TabControlReader/TabControlReader.cpp @@ -145,7 +145,7 @@ flatbuffers::Offset TabControlReader::createOptionsWithFlatB if (attriname == "ctype") { - if (value.compare("TabItemObjectData") == 0) + if (value == "TabItemObjectData") { auto itemOption = TabItemReader::getInstance()->createTabItemOptionWithFlatBuffers(child, builder); tabItems.push_back(itemOption); @@ -284,11 +284,11 @@ flatbuffers::Offset TabHeaderReader::createOptionsWithFlatBu std::string attriname = attribute->Name(); std::string value = attribute->Value(); - if (attriname.compare("FontSize") == 0) + if (attriname == "FontSize") { fontsize = atoi(value.c_str()); } - else if (attriname.compare("TitleText") == 0) + else if (attriname == "TitleText") { text = value; } @@ -578,7 +578,7 @@ void TabHeaderReader::setPropsWithFlatBuffers(cocos2d::Node* node, const flatbuf bool fileExist = false; std::string errorFilePath = ""; std::string path = resourceData->path()->c_str(); - if (path != "") + if (!path.empty()) { if (FileUtils::getInstance()->isFileExist(path)) { @@ -902,7 +902,7 @@ cocos2d::Node* TabHeaderReader::createNodeWithFlatBuffers(const flatbuffers::Tab return node; } -int TabHeaderReader::getResourceType(std::string key) +int TabHeaderReader::getResourceType(const std::string& key) { if (key == "Normal" || key == "Default") { @@ -958,15 +958,15 @@ flatbuffers::Offset TabItemReader::createTabItemOpti while (child) { std::string attriName = child->Name(); - if (attriName.compare("Children") == 0) + if (attriName == "Children") { containerChildrenData = const_cast(child); } - if (attriName.compare("Header") == 0) + if (attriName == "Header") { header = TabHeaderReader::getInstance()->createOptionsWithFlatBuffers(child, builder); } - else if (attriName.compare("Container") == 0) + else if (attriName == "Container") { containerData = const_cast(child); } diff --git a/cocos/editor-support/cocostudio/WidgetReader/TabControlReader/TabControlReader.h b/cocos/editor-support/cocostudio/WidgetReader/TabControlReader/TabControlReader.h index 862a203498e9..8b4204ed4d38 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/TabControlReader/TabControlReader.h +++ b/cocos/editor-support/cocostudio/WidgetReader/TabControlReader/TabControlReader.h @@ -72,7 +72,7 @@ class TabHeaderReader : public cocos2d::Ref, public cocostudio::NodeReaderProtoc cocos2d::Node* createNodeWithFlatBuffers(const flatbuffers::Table* nodeOptions) override; private: static TabHeaderReader* _tabheaderReaderInstance; - int getResourceType(std::string key); + int getResourceType(const std::string& key); }; class TabItemReader : public cocos2d::Ref, public cocostudio::NodeReaderProtocol diff --git a/cocos/editor-support/cocostudio/WidgetReader/TextFieldReader/TextFieldReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/TextFieldReader/TextFieldReader.cpp index b37a4563af73..b3e7c094a7da 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/TextFieldReader/TextFieldReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/TextFieldReader/TextFieldReader.cpp @@ -324,7 +324,7 @@ namespace cocostudio { ILocalizationManager* lm = LocalizationHelper::getCurrentManager(); std::string localizedTxt = lm->getLocalizationString(text); - std::string::size_type newlineIndex = localizedTxt.find("\n"); + std::string::size_type newlineIndex = localizedTxt.find('\n'); if (newlineIndex != std::string::npos) localizedTxt = localizedTxt.substr(0, newlineIndex); textField->setString(localizedTxt); @@ -361,7 +361,7 @@ namespace cocostudio std::string errorFilePath = ""; auto resourceData = options->fontResource(); std::string path = resourceData->path()->c_str(); - if (path != "") + if (!path.empty()) { if (FileUtils::getInstance()->isFileExist(path)) { diff --git a/cocos/editor-support/cocostudio/WidgetReader/UserCameraReader/UserCameraReader.cpp b/cocos/editor-support/cocostudio/WidgetReader/UserCameraReader/UserCameraReader.cpp index aee7c9da620a..c0fa94fd4ee1 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/UserCameraReader/UserCameraReader.cpp +++ b/cocos/editor-support/cocostudio/WidgetReader/UserCameraReader/UserCameraReader.cpp @@ -483,7 +483,7 @@ namespace cocostudio return camera; } - int UserCameraReader::getResourceType(std::string key) + int UserCameraReader::getResourceType(const std::string& key) { if (key == "Normal" || key == "Default") { diff --git a/cocos/editor-support/cocostudio/WidgetReader/UserCameraReader/UserCameraReader.h b/cocos/editor-support/cocostudio/WidgetReader/UserCameraReader/UserCameraReader.h index 5e82f5c624c3..956463f43660 100644 --- a/cocos/editor-support/cocostudio/WidgetReader/UserCameraReader/UserCameraReader.h +++ b/cocos/editor-support/cocostudio/WidgetReader/UserCameraReader/UserCameraReader.h @@ -57,7 +57,7 @@ namespace cocostudio cocos2d::Node* createNodeWithFlatBuffers(const flatbuffers::Table* userCameraOptions); protected: - int getResourceType(std::string key); + int getResourceType(const std::string& key); cocos2d::Vec2 getVec2Attribute(const tinyxml2::XMLAttribute* attribute) const; }; } diff --git a/cocos/editor-support/spine/Animation.c b/cocos/editor-support/spine/Animation.c index 6c3fea6f2b19..35a2f39ae1ba 100644 --- a/cocos/editor-support/spine/Animation.c +++ b/cocos/editor-support/spine/Animation.c @@ -28,10 +28,10 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include -#include +#include "spine/Animation.h" +#include "spine/IkConstraint.h" #include -#include +#include "spine/extension.h" spAnimation* spAnimation_create (const char* name, int timelinesCount) { spAnimation* self = NEW(spAnimation); diff --git a/cocos/editor-support/spine/Animation.h b/cocos/editor-support/spine/Animation.h index 296f8e26ea90..d9ea6d860ffe 100644 --- a/cocos/editor-support/spine/Animation.h +++ b/cocos/editor-support/spine/Animation.h @@ -31,9 +31,9 @@ #ifndef SPINE_ANIMATION_H_ #define SPINE_ANIMATION_H_ -#include -#include -#include +#include "spine/dll.h" +#include "spine/Event.h" +#include "spine/Attachment.h" #ifdef __cplusplus extern "C" { diff --git a/cocos/editor-support/spine/AnimationState.c b/cocos/editor-support/spine/AnimationState.c index 14ad9dd1510b..3b01a89677cc 100644 --- a/cocos/editor-support/spine/AnimationState.c +++ b/cocos/editor-support/spine/AnimationState.c @@ -28,8 +28,8 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include -#include +#include "spine/AnimationState.h" +#include "spine/extension.h" #include #define SUBSEQUENT 0 diff --git a/cocos/editor-support/spine/AnimationState.h b/cocos/editor-support/spine/AnimationState.h index a8b54e73253f..0963bb81ec92 100644 --- a/cocos/editor-support/spine/AnimationState.h +++ b/cocos/editor-support/spine/AnimationState.h @@ -31,11 +31,11 @@ #ifndef SPINE_ANIMATIONSTATE_H_ #define SPINE_ANIMATIONSTATE_H_ -#include -#include -#include -#include -#include +#include "spine/dll.h" +#include "spine/Animation.h" +#include "spine/AnimationStateData.h" +#include "spine/Event.h" +#include "spine/Array.h" #ifdef __cplusplus extern "C" { diff --git a/cocos/editor-support/spine/AnimationStateData.c b/cocos/editor-support/spine/AnimationStateData.c index 40279a8e194e..ed7d097bb00a 100644 --- a/cocos/editor-support/spine/AnimationStateData.c +++ b/cocos/editor-support/spine/AnimationStateData.c @@ -28,8 +28,8 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include -#include +#include "spine/AnimationStateData.h" +#include "spine/extension.h" typedef struct _ToEntry _ToEntry; struct _ToEntry { diff --git a/cocos/editor-support/spine/AnimationStateData.h b/cocos/editor-support/spine/AnimationStateData.h index 87bdba5c1892..25f691ee6bcd 100644 --- a/cocos/editor-support/spine/AnimationStateData.h +++ b/cocos/editor-support/spine/AnimationStateData.h @@ -31,9 +31,9 @@ #ifndef SPINE_ANIMATIONSTATEDATA_H_ #define SPINE_ANIMATIONSTATEDATA_H_ -#include -#include -#include +#include "spine/dll.h" +#include "spine/Animation.h" +#include "spine/SkeletonData.h" #ifdef __cplusplus extern "C" { diff --git a/cocos/editor-support/spine/Array.c b/cocos/editor-support/spine/Array.c index 03a32bc78b31..346f5a4c0461 100644 --- a/cocos/editor-support/spine/Array.c +++ b/cocos/editor-support/spine/Array.c @@ -28,8 +28,8 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include -#include +#include "spine/Array.h" +#include "spine/extension.h" _SP_ARRAY_IMPLEMENT_TYPE(spFloatArray, float) _SP_ARRAY_IMPLEMENT_TYPE(spIntArray, int) diff --git a/cocos/editor-support/spine/Array.h b/cocos/editor-support/spine/Array.h index 3beb083253fe..1362050da0a5 100644 --- a/cocos/editor-support/spine/Array.h +++ b/cocos/editor-support/spine/Array.h @@ -31,7 +31,7 @@ #ifndef SPINE_ARRAY_H #define SPINE_ARRAY_H -#include +#include "spine/dll.h" #ifdef __cplusplus extern "C" { diff --git a/cocos/editor-support/spine/Atlas.c b/cocos/editor-support/spine/Atlas.c index 00b5364176f3..6977e5e0d6b9 100644 --- a/cocos/editor-support/spine/Atlas.c +++ b/cocos/editor-support/spine/Atlas.c @@ -28,9 +28,9 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include +#include "spine/Atlas.h" #include -#include +#include "spine/extension.h" spAtlasPage* spAtlasPage_create(spAtlas* atlas, const char* name) { spAtlasPage* self = NEW(spAtlasPage); diff --git a/cocos/editor-support/spine/Atlas.h b/cocos/editor-support/spine/Atlas.h index 61637f17909f..15e236827809 100644 --- a/cocos/editor-support/spine/Atlas.h +++ b/cocos/editor-support/spine/Atlas.h @@ -31,7 +31,7 @@ #ifndef SPINE_ATLAS_H_ #define SPINE_ATLAS_H_ -#include +#include "spine/dll.h" #ifdef __cplusplus extern "C" { diff --git a/cocos/editor-support/spine/AtlasAttachmentLoader.c b/cocos/editor-support/spine/AtlasAttachmentLoader.c index ea686ada0480..aa6866fc4e57 100644 --- a/cocos/editor-support/spine/AtlasAttachmentLoader.c +++ b/cocos/editor-support/spine/AtlasAttachmentLoader.c @@ -28,8 +28,8 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include -#include +#include "spine/AtlasAttachmentLoader.h" +#include "spine/extension.h" spAttachment* _spAtlasAttachmentLoader_createAttachment (spAttachmentLoader* loader, spSkin* skin, spAttachmentType type, const char* name, const char* path) { diff --git a/cocos/editor-support/spine/AtlasAttachmentLoader.h b/cocos/editor-support/spine/AtlasAttachmentLoader.h index a62b14e5b6e3..0ad0ef7122b7 100644 --- a/cocos/editor-support/spine/AtlasAttachmentLoader.h +++ b/cocos/editor-support/spine/AtlasAttachmentLoader.h @@ -31,9 +31,9 @@ #ifndef SPINE_ATLASATTACHMENTLOADER_H_ #define SPINE_ATLASATTACHMENTLOADER_H_ -#include -#include -#include +#include "spine/dll.h" +#include "spine/AttachmentLoader.h" +#include "spine/Atlas.h" #ifdef __cplusplus extern "C" { diff --git a/cocos/editor-support/spine/Attachment.c b/cocos/editor-support/spine/Attachment.c index 69d547a57b04..5dbaefd16162 100644 --- a/cocos/editor-support/spine/Attachment.c +++ b/cocos/editor-support/spine/Attachment.c @@ -28,9 +28,9 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include -#include -#include +#include "spine/Attachment.h" +#include "spine/extension.h" +#include "spine/Slot.h" typedef struct _spAttachmentVtable { void (*dispose) (spAttachment* self); diff --git a/cocos/editor-support/spine/Attachment.h b/cocos/editor-support/spine/Attachment.h index 39d2cf3a0872..5181777f9f06 100644 --- a/cocos/editor-support/spine/Attachment.h +++ b/cocos/editor-support/spine/Attachment.h @@ -31,7 +31,7 @@ #ifndef SPINE_ATTACHMENT_H_ #define SPINE_ATTACHMENT_H_ -#include +#include "spine/dll.h" #ifdef __cplusplus extern "C" { diff --git a/cocos/editor-support/spine/AttachmentLoader.c b/cocos/editor-support/spine/AttachmentLoader.c index 6a1e04eaaf69..6287364f4473 100644 --- a/cocos/editor-support/spine/AttachmentLoader.c +++ b/cocos/editor-support/spine/AttachmentLoader.c @@ -28,9 +28,9 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include +#include "spine/AttachmentLoader.h" #include -#include +#include "spine/extension.h" typedef struct _spAttachmentLoaderVtable { spAttachment* (*createAttachment) (spAttachmentLoader* self, spSkin* skin, spAttachmentType type, const char* name, diff --git a/cocos/editor-support/spine/AttachmentLoader.h b/cocos/editor-support/spine/AttachmentLoader.h index 774ff8ecdfce..cb43cf56e666 100644 --- a/cocos/editor-support/spine/AttachmentLoader.h +++ b/cocos/editor-support/spine/AttachmentLoader.h @@ -31,9 +31,9 @@ #ifndef SPINE_ATTACHMENTLOADER_H_ #define SPINE_ATTACHMENTLOADER_H_ -#include -#include -#include +#include "spine/dll.h" +#include "spine/Attachment.h" +#include "spine/Skin.h" #ifdef __cplusplus extern "C" { diff --git a/cocos/editor-support/spine/AttachmentVertices.cpp b/cocos/editor-support/spine/AttachmentVertices.cpp index ce614ec74688..814c11457a7a 100644 --- a/cocos/editor-support/spine/AttachmentVertices.cpp +++ b/cocos/editor-support/spine/AttachmentVertices.cpp @@ -28,7 +28,7 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include +#include "spine/AttachmentVertices.h" USING_NS_CC; diff --git a/cocos/editor-support/spine/Bone.c b/cocos/editor-support/spine/Bone.c index 66571ab13333..6a167cbc0ccf 100644 --- a/cocos/editor-support/spine/Bone.c +++ b/cocos/editor-support/spine/Bone.c @@ -28,8 +28,8 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include -#include +#include "spine/Bone.h" +#include "spine/extension.h" #include static int yDown; @@ -166,7 +166,7 @@ void spBone_updateWorldTransformWith (spBone* self, float x, float y, float rota za *= s; zc *= s; s = SQRT(za * za + zc * zc); - r = PI / 2 + atan2(zc, za); + r = PI / 2 + atan2f(zc, za); zb = COS(r) * s; zd = SIN(r) * s; la = COS_DEG(shearX) * scaleX; diff --git a/cocos/editor-support/spine/Bone.h b/cocos/editor-support/spine/Bone.h index 725152a62748..4f7ca102756e 100644 --- a/cocos/editor-support/spine/Bone.h +++ b/cocos/editor-support/spine/Bone.h @@ -31,8 +31,8 @@ #ifndef SPINE_BONE_H_ #define SPINE_BONE_H_ -#include -#include +#include "spine/dll.h" +#include "spine/BoneData.h" #ifdef __cplusplus extern "C" { diff --git a/cocos/editor-support/spine/BoneData.c b/cocos/editor-support/spine/BoneData.c index 6338e7f14345..01ff134f8f2a 100644 --- a/cocos/editor-support/spine/BoneData.c +++ b/cocos/editor-support/spine/BoneData.c @@ -28,8 +28,8 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include -#include +#include "spine/BoneData.h" +#include "spine/extension.h" spBoneData* spBoneData_create (int index, const char* name, spBoneData* parent) { spBoneData* self = NEW(spBoneData); diff --git a/cocos/editor-support/spine/BoneData.h b/cocos/editor-support/spine/BoneData.h index 1f4730b1b3b7..59dd2e86c01e 100644 --- a/cocos/editor-support/spine/BoneData.h +++ b/cocos/editor-support/spine/BoneData.h @@ -31,7 +31,7 @@ #ifndef SPINE_BONEDATA_H_ #define SPINE_BONEDATA_H_ -#include +#include "spine/dll.h" #ifdef __cplusplus extern "C" { diff --git a/cocos/editor-support/spine/BoundingBoxAttachment.c b/cocos/editor-support/spine/BoundingBoxAttachment.c index 2cbea77d8b05..38d3761c4d67 100644 --- a/cocos/editor-support/spine/BoundingBoxAttachment.c +++ b/cocos/editor-support/spine/BoundingBoxAttachment.c @@ -28,8 +28,8 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include -#include +#include "spine/BoundingBoxAttachment.h" +#include "spine/extension.h" void _spBoundingBoxAttachment_dispose (spAttachment* attachment) { spBoundingBoxAttachment* self = SUB_CAST(spBoundingBoxAttachment, attachment); diff --git a/cocos/editor-support/spine/BoundingBoxAttachment.h b/cocos/editor-support/spine/BoundingBoxAttachment.h index 71d4876d30be..8c2d675c3458 100644 --- a/cocos/editor-support/spine/BoundingBoxAttachment.h +++ b/cocos/editor-support/spine/BoundingBoxAttachment.h @@ -31,11 +31,11 @@ #ifndef SPINE_BOUNDINGBOXATTACHMENT_H_ #define SPINE_BOUNDINGBOXATTACHMENT_H_ -#include -#include -#include -#include -#include +#include "spine/dll.h" +#include "spine/Attachment.h" +#include "spine/VertexAttachment.h" +#include "spine/Atlas.h" +#include "spine/Slot.h" #ifdef __cplusplus extern "C" { diff --git a/cocos/editor-support/spine/ClippingAttachment.c b/cocos/editor-support/spine/ClippingAttachment.c index 0c2d4ab5f7ed..33638f144367 100644 --- a/cocos/editor-support/spine/ClippingAttachment.c +++ b/cocos/editor-support/spine/ClippingAttachment.c @@ -28,8 +28,8 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include -#include +#include "spine/ClippingAttachment.h" +#include "spine/extension.h" void _spClippingAttachment_dispose (spAttachment* attachment) { spClippingAttachment* self = SUB_CAST(spClippingAttachment, attachment); diff --git a/cocos/editor-support/spine/ClippingAttachment.h b/cocos/editor-support/spine/ClippingAttachment.h index 134334d6d727..c66c2fe49cbc 100644 --- a/cocos/editor-support/spine/ClippingAttachment.h +++ b/cocos/editor-support/spine/ClippingAttachment.h @@ -31,11 +31,11 @@ #ifndef SPINE_CLIPPINGATTACHMENT_H_ #define SPINE_CLIPPINGATTACHMENT_H_ -#include -#include -#include -#include -#include +#include "spine/dll.h" +#include "spine/Attachment.h" +#include "spine/VertexAttachment.h" +#include "spine/Atlas.h" +#include "spine/Slot.h" #ifdef __cplusplus extern "C" { diff --git a/cocos/editor-support/spine/Cocos2dAttachmentLoader.cpp b/cocos/editor-support/spine/Cocos2dAttachmentLoader.cpp index bb91555231b0..1fe8a22628ee 100644 --- a/cocos/editor-support/spine/Cocos2dAttachmentLoader.cpp +++ b/cocos/editor-support/spine/Cocos2dAttachmentLoader.cpp @@ -28,9 +28,9 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include -#include -#include +#include "spine/Cocos2dAttachmentLoader.h" +#include "spine/extension.h" +#include "spine/AttachmentVertices.h" USING_NS_CC; using namespace spine; diff --git a/cocos/editor-support/spine/Cocos2dAttachmentLoader.h b/cocos/editor-support/spine/Cocos2dAttachmentLoader.h index 35f95e9104fa..8bb634ceaed2 100644 --- a/cocos/editor-support/spine/Cocos2dAttachmentLoader.h +++ b/cocos/editor-support/spine/Cocos2dAttachmentLoader.h @@ -31,7 +31,7 @@ #ifndef SPINE_COCOS2DATTACHMENTLOADER_H_ #define SPINE_COCOS2DATTACHMENTLOADER_H_ -#include +#include "spine/AtlasAttachmentLoader.h" extern "C" { diff --git a/cocos/editor-support/spine/Color.c b/cocos/editor-support/spine/Color.c index 02168ee3cce0..365fcb6ab3b3 100644 --- a/cocos/editor-support/spine/Color.c +++ b/cocos/editor-support/spine/Color.c @@ -28,8 +28,8 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include -#include +#include "spine/Color.h" +#include "spine/extension.h" spColor* spColor_create() { return MALLOC(spColor, 1); diff --git a/cocos/editor-support/spine/Color.h b/cocos/editor-support/spine/Color.h index 272ba95524b6..941188398ec9 100644 --- a/cocos/editor-support/spine/Color.h +++ b/cocos/editor-support/spine/Color.h @@ -31,7 +31,7 @@ #ifndef SPINE_COLOR_H_ #define SPINE_COLOR_H_ -#include +#include "spine/dll.h" #ifdef __cplusplus extern "C" { diff --git a/cocos/editor-support/spine/Event.c b/cocos/editor-support/spine/Event.c index 04b2f67de39b..caa661b087cd 100644 --- a/cocos/editor-support/spine/Event.c +++ b/cocos/editor-support/spine/Event.c @@ -28,8 +28,8 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include -#include +#include "spine/Event.h" +#include "spine/extension.h" spEvent* spEvent_create (float time, spEventData* data) { spEvent* self = NEW(spEvent); diff --git a/cocos/editor-support/spine/Event.h b/cocos/editor-support/spine/Event.h index 308fd3953000..d08052852eca 100644 --- a/cocos/editor-support/spine/Event.h +++ b/cocos/editor-support/spine/Event.h @@ -31,8 +31,8 @@ #ifndef SPINE_EVENT_H_ #define SPINE_EVENT_H_ -#include -#include +#include "spine/dll.h" +#include "spine/EventData.h" #ifdef __cplusplus extern "C" { diff --git a/cocos/editor-support/spine/EventData.c b/cocos/editor-support/spine/EventData.c index b53fe152f6be..cdbc6461a412 100644 --- a/cocos/editor-support/spine/EventData.c +++ b/cocos/editor-support/spine/EventData.c @@ -28,8 +28,8 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include -#include +#include "spine/EventData.h" +#include "spine/extension.h" spEventData* spEventData_create (const char* name) { spEventData* self = NEW(spEventData); diff --git a/cocos/editor-support/spine/EventData.h b/cocos/editor-support/spine/EventData.h index 459d161c9ee0..628c4486724e 100644 --- a/cocos/editor-support/spine/EventData.h +++ b/cocos/editor-support/spine/EventData.h @@ -31,7 +31,7 @@ #ifndef SPINE_EVENTDATA_H_ #define SPINE_EVENTDATA_H_ -#include +#include "spine/dll.h" #ifdef __cplusplus extern "C" { diff --git a/cocos/editor-support/spine/IkConstraint.c b/cocos/editor-support/spine/IkConstraint.c index 509bc25d5da7..3b59e4a6c5d8 100644 --- a/cocos/editor-support/spine/IkConstraint.c +++ b/cocos/editor-support/spine/IkConstraint.c @@ -28,9 +28,9 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include -#include -#include +#include "spine/IkConstraint.h" +#include "spine/Skeleton.h" +#include "spine/extension.h" #include spIkConstraint *spIkConstraint_create(spIkConstraintData *data, const spSkeleton *skeleton) { diff --git a/cocos/editor-support/spine/IkConstraint.h b/cocos/editor-support/spine/IkConstraint.h index e9f27ba2e7dd..2ba8157f0721 100644 --- a/cocos/editor-support/spine/IkConstraint.h +++ b/cocos/editor-support/spine/IkConstraint.h @@ -31,9 +31,9 @@ #ifndef SPINE_IKCONSTRAINT_H_ #define SPINE_IKCONSTRAINT_H_ -#include -#include -#include +#include "spine/dll.h" +#include "spine/IkConstraintData.h" +#include "spine/Bone.h" #ifdef __cplusplus extern "C" { diff --git a/cocos/editor-support/spine/IkConstraintData.c b/cocos/editor-support/spine/IkConstraintData.c index c4d99faecd90..f74de615a9f7 100644 --- a/cocos/editor-support/spine/IkConstraintData.c +++ b/cocos/editor-support/spine/IkConstraintData.c @@ -28,8 +28,8 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include -#include +#include "spine/IkConstraintData.h" +#include "spine/extension.h" spIkConstraintData* spIkConstraintData_create (const char* name) { spIkConstraintData* self = NEW(spIkConstraintData); diff --git a/cocos/editor-support/spine/IkConstraintData.h b/cocos/editor-support/spine/IkConstraintData.h index de8f899c1d26..dd93405e9b05 100644 --- a/cocos/editor-support/spine/IkConstraintData.h +++ b/cocos/editor-support/spine/IkConstraintData.h @@ -31,8 +31,8 @@ #ifndef SPINE_IKCONSTRAINTDATA_H_ #define SPINE_IKCONSTRAINTDATA_H_ -#include -#include +#include "spine/dll.h" +#include "spine/BoneData.h" #ifdef __cplusplus extern "C" { diff --git a/cocos/editor-support/spine/Json.c b/cocos/editor-support/spine/Json.c index 6225ff00cc82..17cf10b17025 100644 --- a/cocos/editor-support/spine/Json.c +++ b/cocos/editor-support/spine/Json.c @@ -39,7 +39,7 @@ #include #include /* strtod (C89), strtof (C99) */ #include /* strcasecmp (4.4BSD - compatibility), _stricmp (_WIN32) */ -#include +#include "spine/extension.h" #ifndef SPINE_JSON_DEBUG /* Define this to do extra NULL and expected-character checking */ diff --git a/cocos/editor-support/spine/Json.h b/cocos/editor-support/spine/Json.h index 078a5a715827..0b5608817433 100644 --- a/cocos/editor-support/spine/Json.h +++ b/cocos/editor-support/spine/Json.h @@ -74,7 +74,7 @@ float Json_getFloat (Json* json, const char* name, float defaultValue); int Json_getInt (Json* json, const char* name, int defaultValue); /* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when Json_create() returns 0. 0 when Json_create() succeeds. */ -const char* Json_getError (void); +const char* Json_getError (); #ifdef __cplusplus } diff --git a/cocos/editor-support/spine/MeshAttachment.c b/cocos/editor-support/spine/MeshAttachment.c index bd1ab94bd056..6bc8d23c604f 100644 --- a/cocos/editor-support/spine/MeshAttachment.c +++ b/cocos/editor-support/spine/MeshAttachment.c @@ -28,8 +28,8 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include -#include +#include "spine/MeshAttachment.h" +#include "spine/extension.h" void _spMeshAttachment_dispose (spAttachment* attachment) { spMeshAttachment* self = SUB_CAST(spMeshAttachment, attachment); diff --git a/cocos/editor-support/spine/MeshAttachment.h b/cocos/editor-support/spine/MeshAttachment.h index 20a7e75ac44c..03b1491512d3 100644 --- a/cocos/editor-support/spine/MeshAttachment.h +++ b/cocos/editor-support/spine/MeshAttachment.h @@ -31,11 +31,11 @@ #ifndef SPINE_MESHATTACHMENT_H_ #define SPINE_MESHATTACHMENT_H_ -#include -#include -#include -#include -#include +#include "spine/dll.h" +#include "spine/Attachment.h" +#include "spine/VertexAttachment.h" +#include "spine/Atlas.h" +#include "spine/Slot.h" #ifdef __cplusplus extern "C" { diff --git a/cocos/editor-support/spine/PathAttachment.c b/cocos/editor-support/spine/PathAttachment.c index 92305f1b7678..06ef9b508992 100644 --- a/cocos/editor-support/spine/PathAttachment.c +++ b/cocos/editor-support/spine/PathAttachment.c @@ -28,8 +28,8 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include -#include +#include "spine/PathAttachment.h" +#include "spine/extension.h" void _spPathAttachment_dispose (spAttachment* attachment) { spPathAttachment* self = SUB_CAST(spPathAttachment, attachment); diff --git a/cocos/editor-support/spine/PathAttachment.h b/cocos/editor-support/spine/PathAttachment.h index 6584733bd3a1..f6809bbe4e08 100644 --- a/cocos/editor-support/spine/PathAttachment.h +++ b/cocos/editor-support/spine/PathAttachment.h @@ -31,11 +31,11 @@ #ifndef SPINE_PATHATTACHMENT_H_ #define SPINE_PATHATTACHMENT_H_ -#include -#include -#include -#include -#include +#include "spine/dll.h" +#include "spine/Attachment.h" +#include "spine/VertexAttachment.h" +#include "spine/Atlas.h" +#include "spine/Slot.h" #ifdef __cplusplus extern "C" { diff --git a/cocos/editor-support/spine/PathConstraint.c b/cocos/editor-support/spine/PathConstraint.c index 988d0d1154b0..67be24cbbf50 100644 --- a/cocos/editor-support/spine/PathConstraint.c +++ b/cocos/editor-support/spine/PathConstraint.c @@ -28,9 +28,9 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include -#include -#include +#include "spine/PathConstraint.h" +#include "spine/Skeleton.h" +#include "spine/extension.h" #define PATHCONSTRAINT_NONE -1 #define PATHCONSTRAINT_BEFORE -2 diff --git a/cocos/editor-support/spine/PathConstraint.h b/cocos/editor-support/spine/PathConstraint.h index d6c761eb3a05..73b7e9c89122 100644 --- a/cocos/editor-support/spine/PathConstraint.h +++ b/cocos/editor-support/spine/PathConstraint.h @@ -31,10 +31,10 @@ #ifndef SPINE_PATHCONSTRAINT_H_ #define SPINE_PATHCONSTRAINT_H_ -#include -#include -#include -#include +#include "spine/dll.h" +#include "spine/PathConstraintData.h" +#include "spine/Bone.h" +#include "spine/Slot.h" #include "PathAttachment.h" #ifdef __cplusplus diff --git a/cocos/editor-support/spine/PathConstraintData.c b/cocos/editor-support/spine/PathConstraintData.c index a02f8c3576e6..a1cdfcdc9a80 100644 --- a/cocos/editor-support/spine/PathConstraintData.c +++ b/cocos/editor-support/spine/PathConstraintData.c @@ -28,8 +28,8 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include -#include +#include "spine/PathConstraintData.h" +#include "spine/extension.h" spPathConstraintData* spPathConstraintData_create (const char* name) { spPathConstraintData* self = NEW(spPathConstraintData); diff --git a/cocos/editor-support/spine/PathConstraintData.h b/cocos/editor-support/spine/PathConstraintData.h index 0c515dbea202..41103cf228fc 100644 --- a/cocos/editor-support/spine/PathConstraintData.h +++ b/cocos/editor-support/spine/PathConstraintData.h @@ -31,9 +31,9 @@ #ifndef SPINE_PATHCONSTRAINTDATA_H_ #define SPINE_PATHCONSTRAINTDATA_H_ -#include -#include -#include +#include "spine/dll.h" +#include "spine/BoneData.h" +#include "spine/SlotData.h" #ifdef __cplusplus extern "C" { diff --git a/cocos/editor-support/spine/PointAttachment.c b/cocos/editor-support/spine/PointAttachment.c index 9a013966352b..bcbe3ea20353 100644 --- a/cocos/editor-support/spine/PointAttachment.c +++ b/cocos/editor-support/spine/PointAttachment.c @@ -28,8 +28,8 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include -#include +#include "spine/PointAttachment.h" +#include "spine/extension.h" void _spPointAttachment_dispose (spAttachment* attachment) { spPathAttachment* self = SUB_CAST(spPathAttachment, attachment); diff --git a/cocos/editor-support/spine/PointAttachment.h b/cocos/editor-support/spine/PointAttachment.h index da8df6cbbdfd..768fa994a6e1 100644 --- a/cocos/editor-support/spine/PointAttachment.h +++ b/cocos/editor-support/spine/PointAttachment.h @@ -31,11 +31,11 @@ #ifndef SPINE_POINTATTACHMENT_H_ #define SPINE_POINTATTACHMENT_H_ -#include -#include -#include -#include -#include +#include "spine/dll.h" +#include "spine/Attachment.h" +#include "spine/VertexAttachment.h" +#include "spine/Atlas.h" +#include "spine/Slot.h" #ifdef __cplusplus extern "C" { diff --git a/cocos/editor-support/spine/RegionAttachment.c b/cocos/editor-support/spine/RegionAttachment.c index ee905f1d9084..1ba5a5712cc4 100644 --- a/cocos/editor-support/spine/RegionAttachment.c +++ b/cocos/editor-support/spine/RegionAttachment.c @@ -28,8 +28,8 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include -#include +#include "spine/RegionAttachment.h" +#include "spine/extension.h" typedef enum { BLX = 0, BLY, ULX, ULY, URX, URY, BRX, BRY diff --git a/cocos/editor-support/spine/RegionAttachment.h b/cocos/editor-support/spine/RegionAttachment.h index 59249c218aa1..30663f632641 100644 --- a/cocos/editor-support/spine/RegionAttachment.h +++ b/cocos/editor-support/spine/RegionAttachment.h @@ -31,10 +31,10 @@ #ifndef SPINE_REGIONATTACHMENT_H_ #define SPINE_REGIONATTACHMENT_H_ -#include -#include -#include -#include +#include "spine/dll.h" +#include "spine/Attachment.h" +#include "spine/Atlas.h" +#include "spine/Slot.h" #ifdef __cplusplus extern "C" { diff --git a/cocos/editor-support/spine/Skeleton.c b/cocos/editor-support/spine/Skeleton.c index 125e28b15da4..7c9a3d8b5266 100644 --- a/cocos/editor-support/spine/Skeleton.c +++ b/cocos/editor-support/spine/Skeleton.c @@ -28,10 +28,10 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include +#include "spine/Skeleton.h" #include #include -#include +#include "spine/extension.h" typedef enum { SP_UPDATE_BONE, SP_UPDATE_IK_CONSTRAINT, SP_UPDATE_PATH_CONSTRAINT, SP_UPDATE_TRANSFORM_CONSTRAINT diff --git a/cocos/editor-support/spine/Skeleton.h b/cocos/editor-support/spine/Skeleton.h index 74bc528d19db..60494cdeead1 100644 --- a/cocos/editor-support/spine/Skeleton.h +++ b/cocos/editor-support/spine/Skeleton.h @@ -31,13 +31,13 @@ #ifndef SPINE_SKELETON_H_ #define SPINE_SKELETON_H_ -#include -#include -#include -#include -#include -#include -#include +#include "spine/dll.h" +#include "spine/SkeletonData.h" +#include "spine/Slot.h" +#include "spine/Skin.h" +#include "spine/IkConstraint.h" +#include "spine/TransformConstraint.h" +#include "spine/PathConstraint.h" #ifdef __cplusplus extern "C" { diff --git a/cocos/editor-support/spine/SkeletonAnimation.cpp b/cocos/editor-support/spine/SkeletonAnimation.cpp index acf53fea8b57..ef1d0d5364dd 100644 --- a/cocos/editor-support/spine/SkeletonAnimation.cpp +++ b/cocos/editor-support/spine/SkeletonAnimation.cpp @@ -28,9 +28,9 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include -#include -#include +#include "spine/SkeletonAnimation.h" +#include "spine/spine-cocos2dx.h" +#include "spine/extension.h" #include USING_NS_CC; diff --git a/cocos/editor-support/spine/SkeletonAnimation.h b/cocos/editor-support/spine/SkeletonAnimation.h index fc7f163cae23..5108909dd51b 100644 --- a/cocos/editor-support/spine/SkeletonAnimation.h +++ b/cocos/editor-support/spine/SkeletonAnimation.h @@ -31,8 +31,8 @@ #ifndef SPINE_SKELETONANIMATION_H_ #define SPINE_SKELETONANIMATION_H_ -#include -#include +#include "spine/spine.h" +#include "spine/SkeletonRenderer.h" #include "cocos2d.h" namespace spine { diff --git a/cocos/editor-support/spine/SkeletonBatch.cpp b/cocos/editor-support/spine/SkeletonBatch.cpp index 7ac3ce419c10..b9361e74e976 100644 --- a/cocos/editor-support/spine/SkeletonBatch.cpp +++ b/cocos/editor-support/spine/SkeletonBatch.cpp @@ -28,8 +28,8 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include -#include +#include "spine/SkeletonBatch.h" +#include "spine/extension.h" #include USING_NS_CC; diff --git a/cocos/editor-support/spine/SkeletonBatch.h b/cocos/editor-support/spine/SkeletonBatch.h index eea569739f1a..c3cdb7dd5515 100644 --- a/cocos/editor-support/spine/SkeletonBatch.h +++ b/cocos/editor-support/spine/SkeletonBatch.h @@ -31,7 +31,7 @@ #ifndef SPINE_SKELETONBATCH_H_ #define SPINE_SKELETONBATCH_H_ -#include +#include "spine/spine.h" #include "cocos2d.h" #include diff --git a/cocos/editor-support/spine/SkeletonBinary.c b/cocos/editor-support/spine/SkeletonBinary.c index 97168a5bb0e2..6ad508c2baca 100644 --- a/cocos/editor-support/spine/SkeletonBinary.c +++ b/cocos/editor-support/spine/SkeletonBinary.c @@ -28,11 +28,11 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include +#include "spine/SkeletonBinary.h" #include -#include -#include -#include +#include "spine/extension.h" +#include "spine/AtlasAttachmentLoader.h" +#include "spine/Animation.h" #include "kvec.h" typedef struct { diff --git a/cocos/editor-support/spine/SkeletonBinary.h b/cocos/editor-support/spine/SkeletonBinary.h index 41f50d3171f9..9985cfa4bbf6 100644 --- a/cocos/editor-support/spine/SkeletonBinary.h +++ b/cocos/editor-support/spine/SkeletonBinary.h @@ -31,11 +31,11 @@ #ifndef SPINE_SKELETONBINARY_H_ #define SPINE_SKELETONBINARY_H_ -#include -#include -#include -#include -#include +#include "spine/dll.h" +#include "spine/Attachment.h" +#include "spine/AttachmentLoader.h" +#include "spine/SkeletonData.h" +#include "spine/Atlas.h" #ifdef __cplusplus extern "C" { diff --git a/cocos/editor-support/spine/SkeletonBounds.c b/cocos/editor-support/spine/SkeletonBounds.c index 5caa6dc8ee14..10ac96765ac2 100644 --- a/cocos/editor-support/spine/SkeletonBounds.c +++ b/cocos/editor-support/spine/SkeletonBounds.c @@ -28,9 +28,9 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include +#include "spine/SkeletonBounds.h" #include -#include +#include "spine/extension.h" spPolygon* spPolygon_create (int capacity) { spPolygon* self = NEW(spPolygon); diff --git a/cocos/editor-support/spine/SkeletonBounds.h b/cocos/editor-support/spine/SkeletonBounds.h index 077dca5c8971..98ca9c58515b 100644 --- a/cocos/editor-support/spine/SkeletonBounds.h +++ b/cocos/editor-support/spine/SkeletonBounds.h @@ -31,9 +31,9 @@ #ifndef SPINE_SKELETONBOUNDS_H_ #define SPINE_SKELETONBOUNDS_H_ -#include -#include -#include +#include "spine/dll.h" +#include "spine/BoundingBoxAttachment.h" +#include "spine/Skeleton.h" #ifdef __cplusplus extern "C" { diff --git a/cocos/editor-support/spine/SkeletonClipping.c b/cocos/editor-support/spine/SkeletonClipping.c index 8d2c7803c56f..4da622bdb37a 100644 --- a/cocos/editor-support/spine/SkeletonClipping.c +++ b/cocos/editor-support/spine/SkeletonClipping.c @@ -28,8 +28,8 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include -#include +#include "spine/SkeletonClipping.h" +#include "spine/extension.h" spSkeletonClipping* spSkeletonClipping_create() { spSkeletonClipping* clipping = CALLOC(spSkeletonClipping, 1); diff --git a/cocos/editor-support/spine/SkeletonClipping.h b/cocos/editor-support/spine/SkeletonClipping.h index 74f21fccb796..ae7d9f373584 100644 --- a/cocos/editor-support/spine/SkeletonClipping.h +++ b/cocos/editor-support/spine/SkeletonClipping.h @@ -31,11 +31,11 @@ #ifndef SPINE_SKELETONCLIPPING_H #define SPINE_SKELETONCLIPPING_H -#include -#include -#include -#include -#include +#include "spine/dll.h" +#include "spine/Array.h" +#include "spine/ClippingAttachment.h" +#include "spine/Slot.h" +#include "spine/Triangulator.h" #ifdef __cplusplus extern "C" { diff --git a/cocos/editor-support/spine/SkeletonData.c b/cocos/editor-support/spine/SkeletonData.c index 78a724e45234..a6879c1409b0 100644 --- a/cocos/editor-support/spine/SkeletonData.c +++ b/cocos/editor-support/spine/SkeletonData.c @@ -28,9 +28,9 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include +#include "spine/SkeletonData.h" #include -#include +#include "spine/extension.h" spSkeletonData* spSkeletonData_create () { return NEW(spSkeletonData); diff --git a/cocos/editor-support/spine/SkeletonData.h b/cocos/editor-support/spine/SkeletonData.h index 5383d7d144f7..b608c92fb386 100644 --- a/cocos/editor-support/spine/SkeletonData.h +++ b/cocos/editor-support/spine/SkeletonData.h @@ -31,15 +31,15 @@ #ifndef SPINE_SKELETONDATA_H_ #define SPINE_SKELETONDATA_H_ -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "spine/dll.h" +#include "spine/BoneData.h" +#include "spine/SlotData.h" +#include "spine/Skin.h" +#include "spine/EventData.h" +#include "spine/Animation.h" +#include "spine/IkConstraintData.h" +#include "spine/TransformConstraintData.h" +#include "spine/PathConstraintData.h" #ifdef __cplusplus extern "C" { diff --git a/cocos/editor-support/spine/SkeletonJson.c b/cocos/editor-support/spine/SkeletonJson.c index 842258dee1a1..c21e062442bb 100644 --- a/cocos/editor-support/spine/SkeletonJson.c +++ b/cocos/editor-support/spine/SkeletonJson.c @@ -28,13 +28,13 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include +#include "spine/SkeletonJson.h" #include #include #include "Json.h" -#include -#include -#include +#include "spine/extension.h" +#include "spine/AtlasAttachmentLoader.h" +#include "spine/Array.h" #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) #define strdup _strdup diff --git a/cocos/editor-support/spine/SkeletonJson.h b/cocos/editor-support/spine/SkeletonJson.h index 58eacdd8b2b1..88a64ba5fc94 100644 --- a/cocos/editor-support/spine/SkeletonJson.h +++ b/cocos/editor-support/spine/SkeletonJson.h @@ -31,12 +31,12 @@ #ifndef SPINE_SKELETONJSON_H_ #define SPINE_SKELETONJSON_H_ -#include -#include -#include -#include -#include -#include +#include "spine/dll.h" +#include "spine/Attachment.h" +#include "spine/AttachmentLoader.h" +#include "spine/SkeletonData.h" +#include "spine/Atlas.h" +#include "spine/Animation.h" #ifdef __cplusplus extern "C" { diff --git a/cocos/editor-support/spine/SkeletonRenderer.cpp b/cocos/editor-support/spine/SkeletonRenderer.cpp index 860ce3501101..b8668e73355c 100644 --- a/cocos/editor-support/spine/SkeletonRenderer.cpp +++ b/cocos/editor-support/spine/SkeletonRenderer.cpp @@ -28,12 +28,12 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include -#include -#include -#include -#include -#include +#include "spine/SkeletonRenderer.h" +#include "spine/extension.h" +#include "spine/SkeletonBatch.h" +#include "spine/SkeletonTwoColorBatch.h" +#include "spine/AttachmentVertices.h" +#include "spine/Cocos2dAttachmentLoader.h" #include USING_NS_CC; diff --git a/cocos/editor-support/spine/SkeletonRenderer.h b/cocos/editor-support/spine/SkeletonRenderer.h index adf34bd70bfe..7cae9b8a663b 100644 --- a/cocos/editor-support/spine/SkeletonRenderer.h +++ b/cocos/editor-support/spine/SkeletonRenderer.h @@ -31,7 +31,7 @@ #ifndef SPINE_SKELETONRENDERER_H_ #define SPINE_SKELETONRENDERER_H_ -#include +#include "spine/spine.h" #include "cocos2d.h" namespace spine { diff --git a/cocos/editor-support/spine/SkeletonTwoColorBatch.cpp b/cocos/editor-support/spine/SkeletonTwoColorBatch.cpp index fac3fc971af8..2c191b9e901a 100644 --- a/cocos/editor-support/spine/SkeletonTwoColorBatch.cpp +++ b/cocos/editor-support/spine/SkeletonTwoColorBatch.cpp @@ -27,12 +27,10 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include -#include +#include "spine/SkeletonTwoColorBatch.h" +#include "spine/extension.h" #include -#include "base/ccUtils.h" - USING_NS_CC; #define EVENT_AFTER_DRAW_RESET_POSITION "director_after_draw" using std::max; @@ -92,17 +90,14 @@ void TwoColorTrianglesCommand::generateMaterialID() { void TwoColorTrianglesCommand::useMaterial() const { //Set texture - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, _textureID); + GL::bindTexture2D(_textureID); - if (_alphaTextureID > 0) - { + if (_alphaTextureID > 0) { // ANDROID ETC1 ALPHA supports. - glActiveTexture(GL_TEXTURE0 + 1); - glBindTexture(GL_TEXTURE_2D, _alphaTextureID); + GL::bindTexture2DN(1, _alphaTextureID); } //set blend mode - cocos2d::utils::setBlending(_blendType.src, _blendType.dst); + GL::blendFunc(_blendType.src, _blendType.dst); _glProgramState->apply(_mv); } diff --git a/cocos/editor-support/spine/SkeletonTwoColorBatch.h b/cocos/editor-support/spine/SkeletonTwoColorBatch.h index 8035fad47d2c..d69aee5a6870 100644 --- a/cocos/editor-support/spine/SkeletonTwoColorBatch.h +++ b/cocos/editor-support/spine/SkeletonTwoColorBatch.h @@ -31,7 +31,7 @@ #ifndef SPINE_SKELETONTWOCOLORBATCH_H_ #define SPINE_SKELETONTWOCOLORBATCH_H_ -#include +#include "spine/spine.h" #include "cocos2d.h" #include diff --git a/cocos/editor-support/spine/Skin.c b/cocos/editor-support/spine/Skin.c index 66fbd1af0130..6822d456c917 100644 --- a/cocos/editor-support/spine/Skin.c +++ b/cocos/editor-support/spine/Skin.c @@ -28,8 +28,8 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include -#include +#include "spine/Skin.h" +#include "spine/extension.h" _Entry* _Entry_create (int slotIndex, const char* name, spAttachment* attachment) { _Entry* self = NEW(_Entry); diff --git a/cocos/editor-support/spine/Skin.h b/cocos/editor-support/spine/Skin.h index 488ad1450543..a18b37dbc1e7 100644 --- a/cocos/editor-support/spine/Skin.h +++ b/cocos/editor-support/spine/Skin.h @@ -31,8 +31,8 @@ #ifndef SPINE_SKIN_H_ #define SPINE_SKIN_H_ -#include -#include +#include "spine/dll.h" +#include "spine/Attachment.h" #ifdef __cplusplus extern "C" { diff --git a/cocos/editor-support/spine/Slot.c b/cocos/editor-support/spine/Slot.c index 49888bb5cb85..7d46c9c18966 100644 --- a/cocos/editor-support/spine/Slot.c +++ b/cocos/editor-support/spine/Slot.c @@ -28,8 +28,8 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include -#include +#include "spine/Slot.h" +#include "spine/extension.h" typedef struct { spSlot super; diff --git a/cocos/editor-support/spine/Slot.h b/cocos/editor-support/spine/Slot.h index 16db951b6d9e..54354d4e70ec 100644 --- a/cocos/editor-support/spine/Slot.h +++ b/cocos/editor-support/spine/Slot.h @@ -31,10 +31,10 @@ #ifndef SPINE_SLOT_H_ #define SPINE_SLOT_H_ -#include -#include -#include -#include +#include "spine/dll.h" +#include "spine/Bone.h" +#include "spine/Attachment.h" +#include "spine/SlotData.h" #ifdef __cplusplus extern "C" { diff --git a/cocos/editor-support/spine/SlotData.c b/cocos/editor-support/spine/SlotData.c index 7ef171e85500..957b828f18ec 100644 --- a/cocos/editor-support/spine/SlotData.c +++ b/cocos/editor-support/spine/SlotData.c @@ -28,8 +28,8 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include -#include +#include "spine/SlotData.h" +#include "spine/extension.h" spSlotData* spSlotData_create (const int index, const char* name, spBoneData* boneData) { spSlotData* self = NEW(spSlotData); diff --git a/cocos/editor-support/spine/SlotData.h b/cocos/editor-support/spine/SlotData.h index 669d01f50cb1..e802461bd131 100644 --- a/cocos/editor-support/spine/SlotData.h +++ b/cocos/editor-support/spine/SlotData.h @@ -31,9 +31,9 @@ #ifndef SPINE_SLOTDATA_H_ #define SPINE_SLOTDATA_H_ -#include -#include -#include +#include "spine/dll.h" +#include "spine/BoneData.h" +#include "spine/Color.h" #ifdef __cplusplus extern "C" { diff --git a/cocos/editor-support/spine/TransformConstraint.c b/cocos/editor-support/spine/TransformConstraint.c index 233dfa2d6f98..43b5b5c49212 100644 --- a/cocos/editor-support/spine/TransformConstraint.c +++ b/cocos/editor-support/spine/TransformConstraint.c @@ -28,9 +28,9 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include -#include -#include +#include "spine/TransformConstraint.h" +#include "spine/Skeleton.h" +#include "spine/extension.h" spTransformConstraint* spTransformConstraint_create (spTransformConstraintData* data, const spSkeleton* skeleton) { int i; diff --git a/cocos/editor-support/spine/TransformConstraint.h b/cocos/editor-support/spine/TransformConstraint.h index 0af1d8d5d3de..84dcc6a9d1a4 100644 --- a/cocos/editor-support/spine/TransformConstraint.h +++ b/cocos/editor-support/spine/TransformConstraint.h @@ -31,9 +31,9 @@ #ifndef SPINE_TRANSFORMCONSTRAINT_H_ #define SPINE_TRANSFORMCONSTRAINT_H_ -#include -#include -#include +#include "spine/dll.h" +#include "spine/TransformConstraintData.h" +#include "spine/Bone.h" #ifdef __cplusplus extern "C" { diff --git a/cocos/editor-support/spine/TransformConstraintData.c b/cocos/editor-support/spine/TransformConstraintData.c index c9b3d06e3ef2..62ebf1371f50 100644 --- a/cocos/editor-support/spine/TransformConstraintData.c +++ b/cocos/editor-support/spine/TransformConstraintData.c @@ -28,8 +28,8 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include -#include +#include "spine/TransformConstraintData.h" +#include "spine/extension.h" spTransformConstraintData* spTransformConstraintData_create (const char* name) { spTransformConstraintData* self = NEW(spTransformConstraintData); diff --git a/cocos/editor-support/spine/TransformConstraintData.h b/cocos/editor-support/spine/TransformConstraintData.h index 34920b877dbc..63b1fb3f3d24 100644 --- a/cocos/editor-support/spine/TransformConstraintData.h +++ b/cocos/editor-support/spine/TransformConstraintData.h @@ -31,8 +31,8 @@ #ifndef SPINE_TRANSFORMCONSTRAINTDATA_H_ #define SPINE_TRANSFORMCONSTRAINTDATA_H_ -#include -#include +#include "spine/dll.h" +#include "spine/BoneData.h" #ifdef __cplusplus extern "C" { diff --git a/cocos/editor-support/spine/Triangulator.c b/cocos/editor-support/spine/Triangulator.c index bc473825850a..0deba5da247a 100644 --- a/cocos/editor-support/spine/Triangulator.c +++ b/cocos/editor-support/spine/Triangulator.c @@ -28,8 +28,8 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include -#include +#include "spine/Triangulator.h" +#include "spine/extension.h" #include spTriangulator* spTriangulator_create() { diff --git a/cocos/editor-support/spine/Triangulator.h b/cocos/editor-support/spine/Triangulator.h index 69863b2f78c7..5a6ace56d6f2 100644 --- a/cocos/editor-support/spine/Triangulator.h +++ b/cocos/editor-support/spine/Triangulator.h @@ -31,8 +31,8 @@ #ifndef SPINE_TRIANGULATOR_H #define SPINE_TRIANGULATOR_H -#include -#include +#include "spine/dll.h" +#include "spine/Array.h" #ifdef __cplusplus extern "C" { diff --git a/cocos/editor-support/spine/VertexAttachment.c b/cocos/editor-support/spine/VertexAttachment.c index dde19ba5354e..c05525d0169d 100644 --- a/cocos/editor-support/spine/VertexAttachment.c +++ b/cocos/editor-support/spine/VertexAttachment.c @@ -28,8 +28,8 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include -#include +#include "spine/VertexAttachment.h" +#include "spine/extension.h" /* FIXME this is not thread-safe */ static int nextID = 0; diff --git a/cocos/editor-support/spine/VertexAttachment.h b/cocos/editor-support/spine/VertexAttachment.h index 3bb766ade69f..0a0640d8b857 100644 --- a/cocos/editor-support/spine/VertexAttachment.h +++ b/cocos/editor-support/spine/VertexAttachment.h @@ -31,9 +31,9 @@ #ifndef SPINE_VERTEXATTACHMENT_H_ #define SPINE_VERTEXATTACHMENT_H_ -#include -#include -#include +#include "spine/dll.h" +#include "spine/Attachment.h" +#include "spine/Slot.h" #ifdef __cplusplus extern "C" { diff --git a/cocos/editor-support/spine/VertexEffect.c b/cocos/editor-support/spine/VertexEffect.c index 68d4d1f68043..24ae8c11b9a4 100644 --- a/cocos/editor-support/spine/VertexEffect.c +++ b/cocos/editor-support/spine/VertexEffect.c @@ -28,8 +28,8 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include -#include +#include "spine/VertexEffect.h" +#include "spine/extension.h" void _spJitterVertexEffect_begin(spVertexEffect* self, spSkeleton* skeleton) { } diff --git a/cocos/editor-support/spine/VertexEffect.h b/cocos/editor-support/spine/VertexEffect.h index 4f670119b3cd..994ffa01e406 100644 --- a/cocos/editor-support/spine/VertexEffect.h +++ b/cocos/editor-support/spine/VertexEffect.h @@ -31,9 +31,9 @@ #ifndef SPINE_VERTEXEFFECT_H_ #define SPINE_VERTEXEFFECT_H_ -#include -#include -#include +#include "spine/dll.h" +#include "spine/Skeleton.h" +#include "spine/Color.h" #ifdef __cplusplus extern "C" { diff --git a/cocos/editor-support/spine/extension.c b/cocos/editor-support/spine/extension.c index de1074865afd..64e07b4f1c2e 100644 --- a/cocos/editor-support/spine/extension.c +++ b/cocos/editor-support/spine/extension.c @@ -28,7 +28,7 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include +#include "spine/extension.h" #include float _spInternalRandom () { diff --git a/cocos/editor-support/spine/extension.h b/cocos/editor-support/spine/extension.h index 0823b5667cb4..a75040674657 100644 --- a/cocos/editor-support/spine/extension.h +++ b/cocos/editor-support/spine/extension.h @@ -126,21 +126,21 @@ #define UNUSED(x) (void)(x) -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "stdlib.h" +#include "string.h" +#include "math.h" +#include "spine/Skeleton.h" +#include "spine/Animation.h" +#include "spine/Atlas.h" +#include "spine/AttachmentLoader.h" +#include "spine/VertexAttachment.h" +#include "spine/RegionAttachment.h" +#include "spine/MeshAttachment.h" +#include "spine/BoundingBoxAttachment.h" +#include "spine/ClippingAttachment.h" +#include "spine/PathAttachment.h" +#include "spine/PointAttachment.h" +#include "spine/AnimationState.h" #ifdef __cplusplus extern "C" { diff --git a/cocos/editor-support/spine/proj.win32/libSpine.vcxproj b/cocos/editor-support/spine/proj.win32/libSpine.vcxproj index bf508ff83c81..ade6722e9676 100644 --- a/cocos/editor-support/spine/proj.win32/libSpine.vcxproj +++ b/cocos/editor-support/spine/proj.win32/libSpine.vcxproj @@ -112,6 +112,7 @@ {B7C2A162-DEC9-4418-972E-240AB3CBFCAE} libSpine + 10.0.17134.0 diff --git a/cocos/editor-support/spine/spine-cocos2dx.cpp b/cocos/editor-support/spine/spine-cocos2dx.cpp index 6e75b4eed841..c9af6e2544a3 100644 --- a/cocos/editor-support/spine/spine-cocos2dx.cpp +++ b/cocos/editor-support/spine/spine-cocos2dx.cpp @@ -28,8 +28,8 @@ * POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ -#include -#include +#include "spine/spine-cocos2dx.h" +#include "spine/extension.h" USING_NS_CC; diff --git a/cocos/editor-support/spine/spine-cocos2dx.h b/cocos/editor-support/spine/spine-cocos2dx.h index 7f09e359ff16..4fd49752eb04 100644 --- a/cocos/editor-support/spine/spine-cocos2dx.h +++ b/cocos/editor-support/spine/spine-cocos2dx.h @@ -31,11 +31,11 @@ #ifndef SPINE_COCOS2DX_H_ #define SPINE_COCOS2DX_H_ -#include +#include "spine/spine.h" #include "cocos2d.h" -#include -#include -#include -#include +#include "spine/Cocos2dAttachmentLoader.h" +#include "spine/SkeletonRenderer.h" +#include "spine/SkeletonAnimation.h" +#include "spine/SkeletonBatch.h" #endif /* SPINE_COCOS2DX_H_ */ diff --git a/cocos/editor-support/spine/spine.h b/cocos/editor-support/spine/spine.h index 6c85d7cb995d..b90f6d16aa9f 100644 --- a/cocos/editor-support/spine/spine.h +++ b/cocos/editor-support/spine/spine.h @@ -31,33 +31,33 @@ #ifndef SPINE_SPINE_H_ #define SPINE_SPINE_H_ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "spine/dll.h" +#include "spine/Animation.h" +#include "spine/AnimationState.h" +#include "spine/AnimationStateData.h" +#include "spine/Atlas.h" +#include "spine/AtlasAttachmentLoader.h" +#include "spine/Attachment.h" +#include "spine/AttachmentLoader.h" +#include "spine/Bone.h" +#include "spine/BoneData.h" +#include "spine/RegionAttachment.h" +#include "spine/VertexAttachment.h" +#include "spine/MeshAttachment.h" +#include "spine/BoundingBoxAttachment.h" +#include "spine/ClippingAttachment.h" +#include "spine/PointAttachment.h" +#include "spine/Skeleton.h" +#include "spine/SkeletonBounds.h" +#include "spine/SkeletonData.h" +#include "spine/SkeletonBinary.h" +#include "spine/SkeletonJson.h" +#include "spine/Skin.h" +#include "spine/Slot.h" +#include "spine/SlotData.h" +#include "spine/SkeletonClipping.h" +#include "spine/Event.h" +#include "spine/EventData.h" +#include "spine/VertexEffect.h" #endif /* SPINE_SPINE_H_ */ diff --git a/cocos/math/CCGeometry.cpp b/cocos/math/CCGeometry.cpp index ffe00e5163dd..ab4cd81d8b9b 100644 --- a/cocos/math/CCGeometry.cpp +++ b/cocos/math/CCGeometry.cpp @@ -35,7 +35,7 @@ NS_CC_BEGIN // implementation of Size -Size::Size(void) : width(0), height(0) +Size::Size() : Size(0.0f, 0.0f) { } @@ -43,20 +43,10 @@ Size::Size(float w, float h) : width(w), height(h) { } -Size::Size(const Size& other) : width(other.width), height(other.height) -{ -} - Size::Size(const Vec2& point) : width(point.x), height(point.y) { } -Size& Size::operator= (const Size& other) -{ - setSize(other.width, other.height); - return *this; -} - Size& Size::operator= (const Vec2& point) { setSize(point.x, point.y); @@ -100,29 +90,19 @@ const Size Size::ZERO = Size(0, 0); // implementation of Rect -Rect::Rect(void) +Rect::Rect() +: Rect(0.0f, 0.0f, 0.0f, 0.0f) { - setRect(0.0f, 0.0f, 0.0f, 0.0f); } Rect::Rect(float x, float y, float width, float height) +: origin(x, y), size(width, height) { - setRect(x, y, width, height); -} -Rect::Rect(const Vec2& pos, const Size& dimension) -{ - setRect(pos.x, pos.y, dimension.width, dimension.height); } -Rect::Rect(const Rect& other) -{ - setRect(other.origin.x, other.origin.y, other.size.width, other.size.height); -} - -Rect& Rect::operator= (const Rect& other) +Rect::Rect(const Vec2& pos, const Size& dimension) +: origin(pos), size(dimension) { - setRect(other.origin.x, other.origin.y, other.size.width, other.size.height); - return *this; } void Rect::setRect(float x, float y, float width, float height) @@ -175,15 +155,10 @@ float Rect::getMinY() const bool Rect::containsPoint(const Vec2& point) const { - bool bRet = false; - - if (point.x >= getMinX() && point.x <= getMaxX() - && point.y >= getMinY() && point.y <= getMaxY()) - { - bRet = true; - } - - return bRet; + return (point.x >= getMinX() && + point.x <= getMaxX() && + point.y >= getMinY() && + point.y <= getMaxY()); } bool Rect::intersectsRect(const Rect& rect) const diff --git a/cocos/math/CCGeometry.h b/cocos/math/CCGeometry.h index f343a7dc46df..4e2b3ba44a51 100644 --- a/cocos/math/CCGeometry.h +++ b/cocos/math/CCGeometry.h @@ -46,7 +46,7 @@ class CC_DLL Size /**Height of the Size.*/ float height; public: - /**Conversion from Vec2 to Size.*/ + /**Conversion from Size to Vec2.*/ operator Vec2() const { return Vec2(width, height); @@ -63,15 +63,9 @@ class CC_DLL Size */ Size(); Size(float width, float height); - Size(const Size& other); explicit Size(const Vec2& point); /**@}*/ - /** - * @js NA - * @lua NA - */ - Size& operator= (const Size& other); /** * @js NA * @lua NA @@ -119,7 +113,7 @@ class CC_DLL Rect /**Low left point of rect.*/ Vec2 origin; /**Width and height of the rect.*/ - Size size; + Size size; public: /** @@ -138,17 +132,6 @@ class CC_DLL Rect */ Rect(const Vec2& pos, const Size& dimension); /** - Copy constructor. - * @js NA - * @lua NA - */ - Rect(const Rect& other); - /** - * @js NA - * @lua NA - */ - Rect& operator= (const Rect& other); - /** Set the x, y, width and height of Rect. * @js NA * @lua NA @@ -190,7 +173,7 @@ class CC_DLL Rect */ bool equals(const Rect& rect) const; /** - Check if the points is contained in the rect. + Check if the points is contained inclusively in the rect. * @js NA */ bool containsPoint(const Vec2& point) const; diff --git a/cocos/math/MathUtilNeon.inl b/cocos/math/MathUtilNeon.inl index bf41e6c70427..78d2ba7c2991 100644 --- a/cocos/math/MathUtilNeon.inl +++ b/cocos/math/MathUtilNeon.inl @@ -43,7 +43,7 @@ public: inline static void crossVec3(const float* v1, const float* v2, float* dst); }; -inline void MathUtilNeon::addMatrix(const float* m, float scalar, float* dst) +inline void MathUtilNeon::addMatrix(const float* m, float scalar, float* dst) __attribute__((optnone)) { asm volatile( "vld1.32 {q0, q1}, [%1]! \n\t" // M[m0-m7] @@ -66,7 +66,7 @@ inline void MathUtilNeon::addMatrix(const float* m, float scalar, float* dst) ); } -inline void MathUtilNeon::addMatrix(const float* m1, const float* m2, float* dst) +inline void MathUtilNeon::addMatrix(const float* m1, const float* m2, float* dst) __attribute__((optnone)) { asm volatile( "vld1.32 {q0, q1}, [%1]! \n\t" // M1[m0-m7] @@ -87,7 +87,7 @@ inline void MathUtilNeon::addMatrix(const float* m1, const float* m2, float* dst ); } -inline void MathUtilNeon::subtractMatrix(const float* m1, const float* m2, float* dst) +inline void MathUtilNeon::subtractMatrix(const float* m1, const float* m2, float* dst) __attribute__((optnone)) { asm volatile( "vld1.32 {q0, q1}, [%1]! \n\t" // M1[m0-m7] @@ -108,7 +108,7 @@ inline void MathUtilNeon::subtractMatrix(const float* m1, const float* m2, float ); } -inline void MathUtilNeon::multiplyMatrix(const float* m, float scalar, float* dst) +inline void MathUtilNeon::multiplyMatrix(const float* m, float scalar, float* dst) __attribute__((optnone)) { asm volatile( "vld1.32 {d0[0]}, [%2] \n\t" // M[m0-m7] @@ -128,7 +128,7 @@ inline void MathUtilNeon::multiplyMatrix(const float* m, float scalar, float* ds ); } -inline void MathUtilNeon::multiplyMatrix(const float* m1, const float* m2, float* dst) +inline void MathUtilNeon::multiplyMatrix(const float* m1, const float* m2, float* dst) __attribute__((optnone)) { asm volatile( "vld1.32 {d16 - d19}, [%1]! \n\t" // M1[m0-m7] @@ -165,7 +165,7 @@ inline void MathUtilNeon::multiplyMatrix(const float* m1, const float* m2, float ); } -inline void MathUtilNeon::negateMatrix(const float* m, float* dst) +inline void MathUtilNeon::negateMatrix(const float* m, float* dst) __attribute__((optnone)) { asm volatile( "vld1.32 {q0-q1}, [%1]! \n\t" // load m0-m7 @@ -184,7 +184,7 @@ inline void MathUtilNeon::negateMatrix(const float* m, float* dst) ); } -inline void MathUtilNeon::transposeMatrix(const float* m, float* dst) +inline void MathUtilNeon::transposeMatrix(const float* m, float* dst) __attribute__((optnone)) { asm volatile( "vld4.32 {d0[0], d2[0], d4[0], d6[0]}, [%1]! \n\t" // DST->M[m0, m4, m8, m12] = M[m0-m3] @@ -200,7 +200,7 @@ inline void MathUtilNeon::transposeMatrix(const float* m, float* dst) ); } -inline void MathUtilNeon::transformVec4(const float* m, float x, float y, float z, float w, float* dst) +inline void MathUtilNeon::transformVec4(const float* m, float x, float y, float z, float w, float* dst) __attribute__((optnone)) { asm volatile( "vld1.32 {d0[0]}, [%1] \n\t" // V[x] @@ -223,7 +223,7 @@ inline void MathUtilNeon::transformVec4(const float* m, float x, float y, float ); } -inline void MathUtilNeon::transformVec4(const float* m, const float* v, float* dst) +inline void MathUtilNeon::transformVec4(const float* m, const float* v, float* dst) __attribute__((optnone)) { asm volatile ( @@ -243,7 +243,7 @@ inline void MathUtilNeon::transformVec4(const float* m, const float* v, float* d ); } -inline void MathUtilNeon::crossVec3(const float* v1, const float* v2, float* dst) +inline void MathUtilNeon::crossVec3(const float* v1, const float* v2, float* dst) __attribute__((optnone)) { asm volatile( "vld1.32 {d1[1]}, [%1] \n\t" // diff --git a/cocos/math/MathUtilNeon64.inl b/cocos/math/MathUtilNeon64.inl index 9832669907fd..08b0ff7b5c28 100644 --- a/cocos/math/MathUtilNeon64.inl +++ b/cocos/math/MathUtilNeon64.inl @@ -44,7 +44,7 @@ public: inline static void crossVec3(const float* v1, const float* v2, float* dst); }; -inline void MathUtilNeon64::addMatrix(const float* m, float scalar, float* dst) +inline void MathUtilNeon64::addMatrix(const float* m, float scalar, float* dst) __attribute__((optnone)) { asm volatile( "ld4 {v0.4s, v1.4s, v2.4s, v3.4s}, [%1] \n\t" // M[m0-m7] M[m8-m15] @@ -62,7 +62,7 @@ inline void MathUtilNeon64::addMatrix(const float* m, float scalar, float* dst) ); } -inline void MathUtilNeon64::addMatrix(const float* m1, const float* m2, float* dst) +inline void MathUtilNeon64::addMatrix(const float* m1, const float* m2, float* dst) __attribute__((optnone)) { asm volatile( "ld4 {v0.4s, v1.4s, v2.4s, v3.4s}, [%1] \n\t" // M1[m0-m7] M1[m8-m15] @@ -80,7 +80,7 @@ inline void MathUtilNeon64::addMatrix(const float* m1, const float* m2, float* d ); } -inline void MathUtilNeon64::subtractMatrix(const float* m1, const float* m2, float* dst) +inline void MathUtilNeon64::subtractMatrix(const float* m1, const float* m2, float* dst) __attribute__((optnone)) { asm volatile( "ld4 {v0.4s, v1.4s, v2.4s, v3.4s}, [%1] \n\t" // M1[m0-m7] M1[m8-m15] @@ -98,7 +98,7 @@ inline void MathUtilNeon64::subtractMatrix(const float* m1, const float* m2, flo ); } -inline void MathUtilNeon64::multiplyMatrix(const float* m, float scalar, float* dst) +inline void MathUtilNeon64::multiplyMatrix(const float* m, float scalar, float* dst) __attribute__((optnone)) { asm volatile( "ld1 {v0.s}[0], [%2] \n\t" //s @@ -116,7 +116,7 @@ inline void MathUtilNeon64::multiplyMatrix(const float* m, float scalar, float* ); } -inline void MathUtilNeon64::multiplyMatrix(const float* m1, const float* m2, float* dst) +inline void MathUtilNeon64::multiplyMatrix(const float* m1, const float* m2, float* dst) __attribute__((optnone)) { asm volatile( "ld1 {v8.4s, v9.4s, v10.4s, v11.4s}, [%1] \n\t" // M1[m0-m7] M1[m8-m15] M2[m0-m7] M2[m8-m15] @@ -151,7 +151,7 @@ inline void MathUtilNeon64::multiplyMatrix(const float* m1, const float* m2, flo ); } -inline void MathUtilNeon64::negateMatrix(const float* m, float* dst) +inline void MathUtilNeon64::negateMatrix(const float* m, float* dst) __attribute__((optnone)) { asm volatile( "ld4 {v0.4s, v1.4s, v2.4s, v3.4s}, [%1] \n\t" // load m0-m7 load m8-m15 @@ -168,7 +168,7 @@ inline void MathUtilNeon64::negateMatrix(const float* m, float* dst) ); } -inline void MathUtilNeon64::transposeMatrix(const float* m, float* dst) +inline void MathUtilNeon64::transposeMatrix(const float* m, float* dst) __attribute__((optnone)) { asm volatile( "ld4 {v0.4s, v1.4s, v2.4s, v3.4s}, [%1] \n\t" // DST->M[m0, m4, m8, m12] = M[m0-m3] @@ -180,7 +180,7 @@ inline void MathUtilNeon64::transposeMatrix(const float* m, float* dst) ); } -inline void MathUtilNeon64::transformVec4(const float* m, float x, float y, float z, float w, float* dst) +inline void MathUtilNeon64::transformVec4(const float* m, float x, float y, float z, float w, float* dst) __attribute__((optnone)) { asm volatile( "ld1 {v0.s}[0], [%1] \n\t" // V[x] @@ -204,7 +204,7 @@ inline void MathUtilNeon64::transformVec4(const float* m, float x, float y, floa ); } -inline void MathUtilNeon64::transformVec4(const float* m, const float* v, float* dst) +inline void MathUtilNeon64::transformVec4(const float* m, const float* v, float* dst) __attribute__((optnone)) { asm volatile ( @@ -223,7 +223,7 @@ inline void MathUtilNeon64::transformVec4(const float* m, const float* v, float* ); } -inline void MathUtilNeon64::crossVec3(const float* v1, const float* v2, float* dst) +inline void MathUtilNeon64::crossVec3(const float* v1, const float* v2, float* dst) __attribute__((optnone)) { asm volatile( "ld1 {v0.2s}, [%2] \n\t" diff --git a/cocos/math/Quaternion.cpp b/cocos/math/Quaternion.cpp index 4750d6d79718..90cd1667c76e 100644 --- a/cocos/math/Quaternion.cpp +++ b/cocos/math/Quaternion.cpp @@ -53,15 +53,6 @@ Quaternion::Quaternion(const Vec3& axis, float angle) set(axis, angle); } -Quaternion::Quaternion(const Quaternion& copy) -{ - set(copy); -} - -Quaternion::~Quaternion() -{ -} - const Quaternion& Quaternion::identity() { static Quaternion value(0.0f, 0.0f, 0.0f, 1.0f); diff --git a/cocos/math/Quaternion.h b/cocos/math/Quaternion.h index 2e5b1d46e7fd..c74521a4a310 100644 --- a/cocos/math/Quaternion.h +++ b/cocos/math/Quaternion.h @@ -125,18 +125,6 @@ class CC_DLL Quaternion */ Quaternion(const Vec3& axis, float angle); - /** - * Constructs a new quaternion that is a copy of the specified one. - * - * @param copy The quaternion to copy. - */ - Quaternion(const Quaternion& copy); - - /** - * Destructor. - */ - ~Quaternion(); - /** * Returns the identity quaternion. * diff --git a/cocos/math/Vec2.h b/cocos/math/Vec2.h index 18ab06efae64..dc3a76fdce49 100644 --- a/cocos/math/Vec2.h +++ b/cocos/math/Vec2.h @@ -93,18 +93,6 @@ class CC_DLL Vec2 */ Vec2(const Vec2& p1, const Vec2& p2); - /** - * Constructs a new vector that is a copy of the specified vector. - * - * @param copy The vector to copy. - */ - Vec2(const Vec2& copy); - - /** - * Destructor. - */ - ~Vec2(); - /** * Indicates whether this vector contains all zeros. * diff --git a/cocos/math/Vec2.inl b/cocos/math/Vec2.inl index 79c08103b6ef..d39f272272e0 100644 --- a/cocos/math/Vec2.inl +++ b/cocos/math/Vec2.inl @@ -42,15 +42,6 @@ inline Vec2::Vec2(const Vec2& p1, const Vec2& p2) set(p1, p2); } -inline Vec2::Vec2(const Vec2& copy) -{ - set(copy); -} - -inline Vec2::~Vec2() -{ -} - inline bool Vec2::isZero() const { return x == 0.0f && y == 0.0f; diff --git a/cocos/math/Vec3.cpp b/cocos/math/Vec3.cpp index 61321524dcf5..a95d3afd0524 100644 --- a/cocos/math/Vec3.cpp +++ b/cocos/math/Vec3.cpp @@ -45,11 +45,6 @@ Vec3::Vec3(const Vec3& p1, const Vec3& p2) set(p1, p2); } -Vec3::Vec3(const Vec3& copy) -{ - set(copy); -} - Vec3 Vec3::fromColor(unsigned int color) { float components[3]; @@ -65,10 +60,6 @@ Vec3 Vec3::fromColor(unsigned int color) return value; } -Vec3::~Vec3() -{ -} - float Vec3::angle(const Vec3& v1, const Vec3& v2) { float dx = v1.y * v2.z - v1.z * v2.y; diff --git a/cocos/math/Vec3.h b/cocos/math/Vec3.h index 508cfc98a469..705b09a2a788 100644 --- a/cocos/math/Vec3.h +++ b/cocos/math/Vec3.h @@ -93,13 +93,6 @@ class CC_DLL Vec3 */ Vec3(const Vec3& p1, const Vec3& p2); - /** - * Constructs a new vector that is a copy of the specified vector. - * - * @param copy The vector to copy. - */ - Vec3(const Vec3& copy); - /** * Creates a new vector from an integer interpreted as an RGB value. * E.g. 0xff0000 represents red or the vector (1, 0, 0). @@ -110,11 +103,6 @@ class CC_DLL Vec3 */ static Vec3 fromColor(unsigned int color); - /** - * Destructor. - */ - ~Vec3(); - /** * Indicates whether this vector contains all zeros. * diff --git a/cocos/navmesh/CCNavMesh.cpp b/cocos/navmesh/CCNavMesh.cpp index b8ed2eb69403..d7e3eb09c29b 100644 --- a/cocos/navmesh/CCNavMesh.cpp +++ b/cocos/navmesh/CCNavMesh.cpp @@ -516,7 +516,7 @@ void cocos2d::NavMesh::findPath(const Vec3 &start, const Vec3 &end, std::vector< //dtVcopy(&m_smoothPath[m_nsmoothPath * 3], iterPos); //m_nsmoothPath++; - pathPoints.push_back(Vec3(iterPos[0], iterPos[1], iterPos[2])); + pathPoints.emplace_back(iterPos[0], iterPos[1], iterPos[2]); nsmoothPath++; // Move towards target a small advancement at a time until target reached or @@ -571,7 +571,7 @@ void cocos2d::NavMesh::findPath(const Vec3 &start, const Vec3 &end, std::vector< { //dtVcopy(&m_smoothPath[m_nsmoothPath * 3], iterPos); //m_nsmoothPath++; - pathPoints.push_back(Vec3(iterPos[0], iterPos[1], iterPos[2])); + pathPoints.emplace_back(iterPos[0], iterPos[1], iterPos[2]); nsmoothPath++; } break; @@ -602,14 +602,14 @@ void cocos2d::NavMesh::findPath(const Vec3 &start, const Vec3 &end, std::vector< { //dtVcopy(&m_smoothPath[m_nsmoothPath * 3], startPos); //m_nsmoothPath++; - pathPoints.push_back(Vec3(startPos[0], startPos[1], startPos[2])); + pathPoints.emplace_back(startPos[0], startPos[1], startPos[2]); nsmoothPath++; // Hack to make the dotted path not visible during off-mesh connection. if (nsmoothPath & 1) { //dtVcopy(&m_smoothPath[m_nsmoothPath * 3], startPos); //m_nsmoothPath++; - pathPoints.push_back(Vec3(startPos[0], startPos[1], startPos[2])); + pathPoints.emplace_back(startPos[0], startPos[1], startPos[2]); nsmoothPath++; } } @@ -627,7 +627,7 @@ void cocos2d::NavMesh::findPath(const Vec3 &start, const Vec3 &end, std::vector< //dtVcopy(&m_smoothPath[m_nsmoothPath * 3], iterPos); //m_nsmoothPath++; - pathPoints.push_back(Vec3(iterPos[0], iterPos[1], iterPos[2])); + pathPoints.emplace_back(iterPos[0], iterPos[1], iterPos[2]); nsmoothPath++; } } diff --git a/cocos/navmesh/CCNavMeshDebugDraw.cpp b/cocos/navmesh/CCNavMeshDebugDraw.cpp index b353d81c277b..f2f06e1606cf 100644 --- a/cocos/navmesh/CCNavMeshDebugDraw.cpp +++ b/cocos/navmesh/CCNavMeshDebugDraw.cpp @@ -26,6 +26,7 @@ #if CC_USE_NAVMESH #include "renderer/CCGLProgramCache.h" +#include "renderer/ccGLStateCache.h" #include "renderer/CCRenderer.h" #include "renderer/CCRenderState.h" #include "base/CCDirector.h" @@ -140,8 +141,7 @@ void NavMeshDebugDraw::drawImplement(const cocos2d::Mat4& transform, uint32_t /* _program->setUniformsForBuiltins(transform); glBindBuffer(GL_ARRAY_BUFFER, _vbo); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_COLOR); + GL::enableVertexAttribs(GL::VERTEX_ATTRIB_FLAG_POSITION | GL::VERTEX_ATTRIB_FLAG_COLOR); glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 3, GL_FLOAT, GL_FALSE, sizeof(V3F_C4F), (GLvoid *)offsetof(V3F_C4F, position)); glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_COLOR, 4, GL_FLOAT, GL_FALSE, sizeof(V3F_C4F), (GLvoid *)offsetof(V3F_C4F, color)); if (_dirtyBuffer){ diff --git a/cocos/network/CCDownloader-curl.cpp b/cocos/network/CCDownloader-curl.cpp index 258165987b46..aed3d95648dd 100644 --- a/cocos/network/CCDownloader-curl.cpp +++ b/cocos/network/CCDownloader-curl.cpp @@ -256,17 +256,17 @@ namespace cocos2d { namespace network { DLLOG("Destruct DownloaderCURL::Impl %p %d", this, _thread.joinable()); } - void addTask(std::shared_ptr task, DownloadTaskCURL* coTask) + void addTask(const std::shared_ptr& task, DownloadTaskCURL* coTask) { if (DownloadTask::ERROR_NO_ERROR == coTask->_errCode) { lock_guard lock(_requestMutex); - _requestQueue.push_back(make_pair(task, coTask)); + _requestQueue.emplace_back(task, coTask); } else { lock_guard lock(_finishedMutex); - _finishedQueue.push_back(make_pair(task, coTask)); + _finishedQueue.emplace_back(task, coTask); } } @@ -532,7 +532,7 @@ namespace cocos2d { namespace network { } } - if (coTaskMap.size()) + if (!coTaskMap.empty()) { mcode = CURLM_CALL_MULTI_PERFORM; while(CURLM_CALL_MULTI_PERFORM == mcode) @@ -637,7 +637,7 @@ namespace cocos2d { namespace network { TaskWrapper wrapper; { lock_guard lock(_requestMutex); - if (_requestQueue.size()) + if (!_requestQueue.empty()) { wrapper = _requestQueue.front(); _requestQueue.pop_front(); @@ -681,7 +681,7 @@ namespace cocos2d { namespace network { lock_guard lock(_processMutex); _processSet.insert(wrapper); } - } while (coTaskMap.size()); + } while (!coTaskMap.empty()); curl_multi_cleanup(curlmHandle); this->stop(); diff --git a/cocos/network/CCDownloader.cpp b/cocos/network/CCDownloader.cpp index e59278e080eb..d3633f0bc387 100644 --- a/cocos/network/CCDownloader.cpp +++ b/cocos/network/CCDownloader.cpp @@ -57,16 +57,7 @@ namespace cocos2d { namespace network { //////////////////////////////////////////////////////////////////////////////// // Implement Downloader - Downloader::Downloader() - { - DownloaderHints hints = - { - 6, - 45, - ".tmp" - }; - new(this)Downloader(hints); - } + Downloader::Downloader() : Downloader(DownloaderHints{6, 45, ".tmp"}) { } Downloader::Downloader(const DownloaderHints& hints) { diff --git a/cocos/network/HttpClient-android.cpp b/cocos/network/HttpClient-android.cpp index 2f39ee422771..f423de79bc55 100644 --- a/cocos/network/HttpClient-android.cpp +++ b/cocos/network/HttpClient-android.cpp @@ -885,6 +885,8 @@ HttpClient::HttpClient() , _threadCount(0) , _cookie(nullptr) , _requestSentinel(new HttpRequest()) +, _clearRequestPredicate(nullptr) +, _clearResponsePredicate(nullptr) { CCLOG("In the constructor of HttpClient!"); increaseThreadCount(); @@ -991,6 +993,39 @@ void HttpClient::dispatchResponseCallbacks() } } +void HttpClient::clearResponseAndRequestQueue() +{ + _requestQueueMutex.lock(); + if (_requestQueue.size()) + { + for (auto it = _requestQueue.begin(); it != _requestQueue.end();) + { + if(!_clearRequestPredicate || + _clearRequestPredicate((*it))) + { + (*it)->release(); + it =_requestQueue.erase(it); + } + else + { + it++; + } + } + } + _requestQueueMutex.unlock(); + + _responseQueueMutex.lock(); + if (_clearResponsePredicate) + { + _responseQueue.erase(std::remove_if(_responseQueue.begin(), _responseQueue.end(), _clearResponsePredicate), _responseQueue.end()); + } + else + { + _responseQueue.clear(); + } + _responseQueueMutex.unlock(); +} + void HttpClient::increaseThreadCount() { _threadCountMutex.lock(); diff --git a/cocos/network/HttpClient-apple.mm b/cocos/network/HttpClient-apple.mm index 049f386a7b93..6e3e4f418c49 100644 --- a/cocos/network/HttpClient-apple.mm +++ b/cocos/network/HttpClient-apple.mm @@ -371,6 +371,8 @@ static int processTask(HttpClient* client, HttpRequest* request, NSString* reque , _threadCount(0) , _cookie(nullptr) , _requestSentinel(new HttpRequest()) +, _clearRequestPredicate(nullptr) +, _clearResponsePredicate(nullptr) { CCLOG("In the constructor of HttpClient!"); memset(_responseMessage, 0, sizeof(char) * RESPONSE_BUFFER_SIZE); @@ -534,7 +536,39 @@ static int processTask(HttpClient* client, HttpRequest* request, NSString* reque response->setErrorBuffer(responseMessage); } } - + +void HttpClient::clearResponseAndRequestQueue() +{ + _requestQueueMutex.lock(); + if (_requestQueue.size()) + { + for (auto it = _requestQueue.begin(); it != _requestQueue.end();) + { + if(!_clearRequestPredicate || + _clearRequestPredicate((*it))) + { + (*it)->release(); + it =_requestQueue.erase(it); + } + else + { + it++; + } + } + } + _requestQueueMutex.unlock(); + + _responseQueueMutex.lock(); + if (_clearResponsePredicate) + { + _responseQueue.erase(std::remove_if(_responseQueue.begin(), _responseQueue.end(), _clearResponsePredicate), _responseQueue.end()); + } + else + { + _responseQueue.clear(); + } + _responseQueueMutex.unlock(); +} void HttpClient::increaseThreadCount() { diff --git a/cocos/network/HttpClient.cpp b/cocos/network/HttpClient.cpp index a01cd7911337..9a8659e62638 100644 --- a/cocos/network/HttpClient.cpp +++ b/cocos/network/HttpClient.cpp @@ -403,6 +403,8 @@ HttpClient::HttpClient() , _threadCount(0) , _cookie(nullptr) , _requestSentinel(new HttpRequest()) +, _clearRequestPredicate(nullptr) +, _clearResponsePredicate(nullptr) { CCLOG("In the constructor of HttpClient!"); memset(_responseMessage, 0, RESPONSE_BUFFER_SIZE * sizeof(char)); @@ -575,6 +577,39 @@ void HttpClient::processResponse(HttpResponse* response, char* responseMessage) response->setSucceed(true); } } + +void HttpClient::clearResponseAndRequestQueue() +{ + _requestQueueMutex.lock(); + if (!_requestQueue.empty()) + { + for (auto it = _requestQueue.begin(); it != _requestQueue.end();) + { + if(!_clearRequestPredicate || + _clearRequestPredicate((*it))) + { + (*it)->release(); + it =_requestQueue.erase(it); + } + else + { + it++; + } + } + } + _requestQueueMutex.unlock(); + + _responseQueueMutex.lock(); + if (_clearResponsePredicate) + { + _responseQueue.erase(std::remove_if(_responseQueue.begin(), _responseQueue.end(), _clearResponsePredicate), _responseQueue.end()); + } + else + { + _responseQueue.clear(); + } + _responseQueueMutex.unlock(); +} void HttpClient::increaseThreadCount() { diff --git a/cocos/network/HttpClient.h b/cocos/network/HttpClient.h index 2e31b4202dcd..16ed49c55358 100644 --- a/cocos/network/HttpClient.h +++ b/cocos/network/HttpClient.h @@ -150,6 +150,34 @@ class CC_DLL HttpClient std::mutex& getCookieFileMutex() {return _cookieFileMutex;} std::mutex& getSSLCaFileMutex() {return _sslCaFileMutex;} + + typedef std::function ClearRequestPredicate; + typedef std::function ClearResponsePredicate; + + /** + * Clears the pending http responses and http requests + * If defined, the method uses the ClearRequestPredicate and ClearResponsePredicate + * to check for each request/response which to delete + */ + void clearResponseAndRequestQueue(); + + /** + * Sets a predicate function that is going to be called to determine if we proceed + * each of the pending requests + * + * @param predicate function that will be called + */ + void setClearRequestPredicate(ClearRequestPredicate predicate) { _clearRequestPredicate = predicate; } + + /** + Sets a predicate function that is going to be called to determine if we proceed + * each of the pending requests + * + * @param cb predicate function that will be called + */ + void setClearResponsePredicate(ClearResponsePredicate predicate) { _clearResponsePredicate = predicate; } + + private: HttpClient(); virtual ~HttpClient(); @@ -203,6 +231,9 @@ class CC_DLL HttpClient char _responseMessage[RESPONSE_BUFFER_SIZE]; HttpRequest* _requestSentinel; + + ClearRequestPredicate _clearRequestPredicate; + ClearResponsePredicate _clearResponsePredicate; }; } // namespace network diff --git a/cocos/network/SocketIO.cpp b/cocos/network/SocketIO.cpp index fab86d3889f0..dc436bc3a94d 100644 --- a/cocos/network/SocketIO.cpp +++ b/cocos/network/SocketIO.cpp @@ -29,15 +29,18 @@ ****************************************************************************/ #include "network/SocketIO.h" -#include "network/Uri.h" -#include -#include -#include -#include "base/ccUTF8.h" #include "base/CCDirector.h" #include "base/CCScheduler.h" -#include "network/WebSocket.h" +#include "base/ccUTF8.h" #include "network/HttpClient.h" +#include "network/Uri.h" +#include "network/WebSocket.h" + +#include +#include +#include +#include +#include #include "json/rapidjson.h" #include "json/document-wrapper.h" @@ -79,8 +82,8 @@ class SocketIOPacket std::vector getData()const{ return _args; }; virtual std::string stringify()const; - static SocketIOPacket * createPacketWithType(const std::string& type, SocketIOVersion version); - static SocketIOPacket * createPacketWithTypeIndex(int type, SocketIOVersion version); + static std::shared_ptr createPacketWithType(const std::string& type, SocketIOVersion version); + static std::shared_ptr createPacketWithTypeIndex(int type, SocketIOVersion version); protected: std::string _pId;//id message std::string _ack;// @@ -106,15 +109,15 @@ class SocketIOPacketV10x : public SocketIOPacket SocketIOPacket::SocketIOPacket() :_endpointseparator(""), _separator(":") { - _types.push_back("disconnect"); - _types.push_back("connect"); - _types.push_back("heartbeat"); - _types.push_back("message"); - _types.push_back("json"); - _types.push_back("event"); - _types.push_back("ack"); - _types.push_back("error"); - _types.push_back("noop"); + _types.emplace_back("disconnect"); + _types.emplace_back("connect"); + _types.emplace_back("heartbeat"); + _types.emplace_back("message"); + _types.emplace_back("json"); + _types.emplace_back("event"); + _types.emplace_back("ack"); + _types.emplace_back("error"); + _types.emplace_back("noop"); } SocketIOPacket::~SocketIOPacket() @@ -151,7 +154,7 @@ std::string SocketIOPacket::toString()const encoded << this->_separator; // Add the endpoint for the namespace to be used if not the default namespace "" or "/", and as long as it is not an ACK, heartbeat, or disconnect packet - if (_endpoint != "/" && _endpoint != "" && _type != "ack" && _type != "heartbeat" && _type != "disconnect") { + if (_endpoint != "/" && !_endpoint.empty() && _type != "ack" && _type != "heartbeat" && _type != "disconnect") { encoded << _endpoint << _endpointseparator; } encoded << this->_separator; @@ -235,20 +238,20 @@ SocketIOPacketV10x::SocketIOPacketV10x() { _separator = ""; _endpointseparator = ","; - _types.push_back("disconnected"); - _types.push_back("connected"); - _types.push_back("heartbeat"); - _types.push_back("pong"); - _types.push_back("message"); - _types.push_back("upgrade"); - _types.push_back("noop"); - _typesMessage.push_back("connect"); - _typesMessage.push_back("disconnect"); - _typesMessage.push_back("event"); - _typesMessage.push_back("ack"); - _typesMessage.push_back("error"); - _typesMessage.push_back("binarevent"); - _typesMessage.push_back("binaryack"); + _types.emplace_back("disconnected"); + _types.emplace_back("connected"); + _types.emplace_back("heartbeat"); + _types.emplace_back("pong"); + _types.emplace_back("message"); + _types.emplace_back("upgrade"); + _types.emplace_back("noop"); + _typesMessage.emplace_back("connect"); + _typesMessage.emplace_back("disconnect"); + _typesMessage.emplace_back("event"); + _typesMessage.emplace_back("ack"); + _typesMessage.emplace_back("error"); + _typesMessage.emplace_back("binarevent"); + _typesMessage.emplace_back("binaryack"); } int SocketIOPacketV10x::typeAsNumber()const @@ -305,37 +308,38 @@ SocketIOPacketV10x::~SocketIOPacketV10x() _endpoint = ""; } -SocketIOPacket * SocketIOPacket::createPacketWithType(const std::string& type, SocketIOPacket::SocketIOVersion version) +std::shared_ptr SocketIOPacket::createPacketWithType(const std::string& type, SocketIOPacket::SocketIOVersion version) { - SocketIOPacket *ret; - switch (version) + if(version == SocketIOPacket::SocketIOVersion::V09x) { - case SocketIOPacket::SocketIOVersion::V09x: - ret = new (std::nothrow) SocketIOPacket; - break; - case SocketIOPacket::SocketIOVersion::V10x: - ret = new (std::nothrow) SocketIOPacketV10x; - break; + auto ret = std::make_shared(); + ret->initWithType(type); + return ret; } - ret->initWithType(type); - return ret; + else if(version == SocketIOPacket::SocketIOVersion::V10x) + { + auto ret = std::make_shared(); + ret->initWithType(type); + return ret; + } + return nullptr; } - -SocketIOPacket * SocketIOPacket::createPacketWithTypeIndex(int type, SocketIOPacket::SocketIOVersion version) +std::shared_ptr SocketIOPacket::createPacketWithTypeIndex(int type, SocketIOPacket::SocketIOVersion version) { - SocketIOPacket *ret; - switch (version) + if(version == SocketIOPacket::SocketIOVersion::V09x) { - case SocketIOPacket::SocketIOVersion::V09x: - ret = new (std::nothrow) SocketIOPacket; - break; - case SocketIOPacket::SocketIOVersion::V10x: - return new (std::nothrow) SocketIOPacketV10x; - break; + auto ret = std::make_shared(); + ret->initWithTypeIndex(type); + return ret; + } + else if(version == SocketIOPacket::SocketIOVersion::V10x) + { + auto ret = std::make_shared(); + ret->initWithTypeIndex(type); + return ret; } - ret->initWithTypeIndex(type); - return ret; + return nullptr; } /** @@ -343,8 +347,8 @@ SocketIOPacket * SocketIOPacket::createPacketWithTypeIndex(int type, SocketIOPac * Clients/endpoints may share the same impl to accomplish multiplexing on the same websocket */ class SIOClientImpl : - public cocos2d::Ref, - public WebSocket::Delegate + public WebSocket::Delegate, + public std::enable_shared_from_this { private: int _heartbeat, _timeout; @@ -362,7 +366,7 @@ class SIOClientImpl : SIOClientImpl(const Uri& uri, const std::string& caFilePath); virtual ~SIOClientImpl(); - static SIOClientImpl* create(const Uri& uri, const std::string& caFilePath); + static std::shared_ptr create(const Uri& uri, const std::string& caFilePath); virtual void onOpen(WebSocket* ws); virtual void onMessage(WebSocket* ws, const WebSocket::Data& data); @@ -385,7 +389,7 @@ class SIOClientImpl : void send(const std::string& endpoint, const std::string& s); void send(const std::string& endpoint, const std::vector& s); - void send(SocketIOPacket *packet); + void send(std::shared_ptr& packet); void emit(const std::string& endpoint, const std::string& eventname, const std::string& args); void emit(const std::string& endpoint, const std::string& eventname, const std::vector& args); @@ -429,7 +433,14 @@ void SIOClientImpl::handshake() request->setUrl(pre.str()); request->setRequestType(HttpRequest::Type::GET); - request->setResponseCallback(CC_CALLBACK_2(SIOClientImpl::handshakeResponse, this)); + std::weak_ptr self = shared_from_this(); + auto callback = [self](HttpClient* client, HttpResponse *resp) { + auto conn = self.lock(); + if (conn) { + conn->handshakeResponse(client, resp); + } + }; + request->setResponseCallback(callback); request->setTag("handshake"); CCLOGINFO("SIOClientImpl::handshake() waiting"); @@ -441,8 +452,6 @@ void SIOClientImpl::handshake() HttpClient::getInstance()->send(request); request->release(); - - return; } void SIOClientImpl::handshakeResponse(HttpClient* /*sender*/, HttpResponse *response) @@ -489,7 +498,7 @@ void SIOClientImpl::handshakeResponse(HttpClient* /*sender*/, HttpResponse *resp std::string sid = ""; int heartbeat = 0, timeout = 0; - if (res.find("}") != std::string::npos) { + if (res.find('}') != std::string::npos) { CCLOGINFO("SIOClientImpl::handshake() Socket.IO 1.x detected"); _version = SocketIOPacket::SocketIOVersion::V10x; @@ -500,29 +509,29 @@ void SIOClientImpl::handshakeResponse(HttpClient* /*sender*/, HttpResponse *resp std::string temp = res.substr(a, res.size() - a); // find the sid - a = temp.find(":"); - b = temp.find(","); + a = temp.find(':'); + b = temp.find(','); sid = temp.substr(a + 2, b - (a + 3)); temp = temp.erase(0, b + 1); // chomp past the upgrades - b = temp.find(","); + b = temp.find(','); temp = temp.erase(0, b + 1); // get the pingInterval / heartbeat - a = temp.find(":"); - b = temp.find(","); + a = temp.find(':'); + b = temp.find(','); std::string heartbeat_str = temp.substr(a + 1, b - a); heartbeat = atoi(heartbeat_str.c_str()) / 1000; temp = temp.erase(0, b + 1); // get the timeout - a = temp.find(":"); - b = temp.find("}"); + a = temp.find(':'); + b = temp.find('}'); std::string timeout_str = temp.substr(a + 1, b - a); timeout = atoi(timeout_str.c_str()) / 1000; @@ -536,20 +545,20 @@ void SIOClientImpl::handshakeResponse(HttpClient* /*sender*/, HttpResponse *resp // sample: 3GYzE9md2Ig-lm3cf8Rv:60:60:websocket,htmlfile,xhr-polling,jsonp-polling size_t pos = 0; - pos = res.find(":"); + pos = res.find(':'); if (pos != std::string::npos) { sid = res.substr(0, pos); res.erase(0, pos + 1); } - pos = res.find(":"); + pos = res.find(':'); if (pos != std::string::npos) { heartbeat = atoi(res.substr(pos + 1, res.size()).c_str()); } - pos = res.find(":"); + pos = res.find(':'); if (pos != std::string::npos) { timeout = atoi(res.substr(pos + 1, res.size()).c_str()); @@ -562,9 +571,6 @@ void SIOClientImpl::handshakeResponse(HttpClient* /*sender*/, HttpResponse *resp _timeout = timeout; openSocket(); - - return; - } void SIOClientImpl::openSocket() @@ -593,8 +599,6 @@ void SIOClientImpl::openSocket() { CC_SAFE_DELETE(_ws); } - - return; } bool SIOClientImpl::init() @@ -633,13 +637,13 @@ void SIOClientImpl::disconnect() _ws->close(); } -SIOClientImpl* SIOClientImpl::create(const Uri& uri, const std::string& caFilePath) +std::shared_ptr SIOClientImpl::create(const Uri& uri, const std::string& caFilePath) { SIOClientImpl *s = new (std::nothrow) SIOClientImpl(uri, caFilePath); if (s && s->init()) { - return s; + return std::shared_ptr(s); } return nullptr; @@ -657,7 +661,7 @@ void SIOClientImpl::addClient(const std::string& endpoint, SIOClient* client) void SIOClientImpl::connectToEndpoint(const std::string& endpoint) { - SocketIOPacket *packet = SocketIOPacket::createPacketWithType("connect", _version); + auto packet = SocketIOPacket::createPacketWithType("connect", _version); packet->setEndpoint(endpoint); this->send(packet); } @@ -685,7 +689,7 @@ void SIOClientImpl::disconnectFromEndpoint(const std::string& endpoint) void SIOClientImpl::heartbeat(float /*dt*/) { - SocketIOPacket *packet = SocketIOPacket::createPacketWithType("heartbeat", _version); + auto packet = SocketIOPacket::createPacketWithType("heartbeat", _version); this->send(packet); @@ -698,7 +702,7 @@ void SIOClientImpl::send(const std::string& endpoint, const std::vectorsetEndpoint(endpoint); for(auto &i : s) { @@ -721,13 +725,13 @@ void SIOClientImpl::send(const std::string& endpoint, const std::string& s) send(endpoint, t); } -void SIOClientImpl::send(SocketIOPacket *packet) +void SIOClientImpl::send(std::shared_ptr& packet) { std::string req = packet->toString(); if (_connected) { CCLOGINFO("-->SEND:%s", req.data()); - _ws->send(req.data()); + _ws->send(req); } else CCLOGINFO("Cant send the message (%s) because disconnected", req.c_str()); @@ -736,7 +740,7 @@ void SIOClientImpl::send(SocketIOPacket *packet) void SIOClientImpl::emit(const std::string& endpoint, const std::string& eventname, const std::string& args) { CCLOGINFO("Emitting event \"%s\"", eventname.c_str()); - SocketIOPacket *packet = SocketIOPacket::createPacketWithType("event", _version); + auto packet = SocketIOPacket::createPacketWithType("event", _version); packet->setEndpoint(endpoint == "/" ? "" : endpoint); packet->setEvent(eventname); packet->addData(args); @@ -746,7 +750,7 @@ void SIOClientImpl::emit(const std::string& endpoint, const std::string& eventna void SIOClientImpl::emit(const std::string& endpoint, const std::string& eventname, const std::vector& args) { CCLOGINFO("Emitting event \"%s\"", eventname.c_str()); - SocketIOPacket *packet = SocketIOPacket::createPacketWithType("event", _version); + auto packet = SocketIOPacket::createPacketWithType("event", _version); packet->setEndpoint(endpoint == "/" ? "" : endpoint); packet->setEvent(eventname); for (auto &arg : args) { @@ -759,22 +763,30 @@ void SIOClientImpl::onOpen(WebSocket* /*ws*/) { _connected = true; - SocketIO::getInstance()->addSocket(_uri.getAuthority(), this); + auto self = shared_from_this(); + + SocketIO::getInstance()->addSocket(_uri.getAuthority(), self); if (_version == SocketIOPacket::SocketIOVersion::V10x) { std::string s = "5";//That's a ping https://github.com/Automattic/engine.io-parser/blob/1b8e077b2218f4947a69f5ad18be2a512ed54e93/lib/index.js#L21 - _ws->send(s.data()); + _ws->send(s); } - Director::getInstance()->getScheduler()->schedule(CC_SCHEDULE_SELECTOR(SIOClientImpl::heartbeat), this, (_heartbeat * .9f), false); + std::weak_ptr selfWeak = shared_from_this(); + auto f = [selfWeak](float dt) { + auto conn = selfWeak.lock(); + if(conn) + conn->heartbeat(dt); + }; + + Director::getInstance()->getScheduler()->schedule(f, this, (_heartbeat * .9f), false, "heart_beat"); for (auto& client : _clients) { client.second->onOpen(); } - CCLOGINFO("SIOClientImpl::onOpen socket connected!"); } void SIOClientImpl::onMessage(WebSocket* /*ws*/, const WebSocket::Data& data) @@ -795,20 +807,20 @@ void SIOClientImpl::onMessage(WebSocket* /*ws*/, const WebSocket::Data& data) std::string::size_type pos, pos2; - pos = payload.find(":"); + pos = payload.find(':'); if (pos != std::string::npos) { payload.erase(0, pos + 1); } - pos = payload.find(":"); + pos = payload.find(':'); if (pos != std::string::npos) { msgid = atoi(payload.substr(0, pos + 1).c_str()); } payload.erase(0, pos + 1); - pos = payload.find(":"); + pos = payload.find(':'); if (pos != std::string::npos) { endpoint = payload.substr(0, pos); @@ -819,7 +831,7 @@ void SIOClientImpl::onMessage(WebSocket* /*ws*/, const WebSocket::Data& data) endpoint = payload; } - if (endpoint == "") endpoint = "/"; + if (endpoint.empty()) endpoint = "/"; c = getClient(endpoint); @@ -860,8 +872,8 @@ void SIOClientImpl::onMessage(WebSocket* /*ws*/, const WebSocket::Data& data) if (c) { eventname = ""; - pos = s_data.find(":"); - pos2 = s_data.find(","); + pos = s_data.find(':'); + pos2 = s_data.find(','); if (pos2 > pos) { eventname = s_data.substr(pos + 2, pos2 - (pos + 3)); @@ -917,8 +929,8 @@ void SIOClientImpl::onMessage(WebSocket* /*ws*/, const WebSocket::Data& data) std::string endpoint = ""; - std::string::size_type a = payload.find("/"); - std::string::size_type b = payload.find("["); + std::string::size_type a = payload.find('/'); + std::string::size_type b = payload.find('['); if (b != std::string::npos) { @@ -934,14 +946,14 @@ void SIOClientImpl::onMessage(WebSocket* /*ws*/, const WebSocket::Data& data) } // we didn't find and endpoint and we are in the default namespace - if (endpoint == "") endpoint = "/"; + if (endpoint.empty()) endpoint = "/"; c = getClient(endpoint); payload = payload.substr(1); if (endpoint != "/") payload = payload.substr(endpoint.size()); - if (endpoint != "/" && payload != "") payload = payload.substr(1); + if (endpoint != "/" && !payload.empty()) payload = payload.substr(1); switch (control2) { @@ -961,8 +973,8 @@ void SIOClientImpl::onMessage(WebSocket* /*ws*/, const WebSocket::Data& data) { CCLOGINFO("Event Received (%s)", payload.c_str()); - std::string::size_type payloadFirstSlashPos = payload.find("\""); - std::string::size_type payloadSecondSlashPos = payload.substr(payloadFirstSlashPos + 1).find("\""); + std::string::size_type payloadFirstSlashPos = payload.find('\"'); + std::string::size_type payloadSecondSlashPos = payload.substr(payloadFirstSlashPos + 1).find('\"'); std::string eventname = payload.substr(payloadFirstSlashPos + 1, payloadSecondSlashPos - payloadFirstSlashPos + 1); @@ -1004,8 +1016,6 @@ void SIOClientImpl::onMessage(WebSocket* /*ws*/, const WebSocket::Data& data) } break; } - - return; } void SIOClientImpl::onClose(WebSocket* /*ws*/) @@ -1020,11 +1030,9 @@ void SIOClientImpl::onClose(WebSocket* /*ws*/) _connected = false; if (Director::getInstance()) Director::getInstance()->getScheduler()->unscheduleAllForTarget(this); - + SocketIO::getInstance()->removeSocket(_uri.getAuthority()); } - - this->release(); } void SIOClientImpl::onError(WebSocket* /*ws*/, const WebSocket::ErrorCode& error) @@ -1033,13 +1041,12 @@ void SIOClientImpl::onError(WebSocket* /*ws*/, const WebSocket::ErrorCode& error } //begin SIOClient methods -SIOClient::SIOClient(const std::string& path, SIOClientImpl* impl, SocketIO::SIODelegate& delegate) +SIOClient::SIOClient(const std::string& path, std::shared_ptr& impl, SocketIO::SIODelegate& delegate) : _path(path) , _connected(false) , _socket(impl) , _delegate(&delegate) { - } SIOClient::~SIOClient() @@ -1115,7 +1122,6 @@ void SIOClient::disconnect() { setConnected(false); _socket->disconnectFromEndpoint(_path); - this->release(); } @@ -1123,21 +1129,20 @@ void SIOClient::socketClosed() { setConnected(false); _delegate->onClose(this); - this->release(); } bool SIOClient::isConnected() const { - return _socket && _socket->_connected && _connected; + return _connected && _socket && _socket->_connected ; } -void SIOClient::setConnected(bool connected) +void SIOClient::setConnected(bool connected) { _connected = connected; } -void SIOClient::on(const std::string& eventName, SIOEvent e) +void SIOClient::on(const std::string& eventName, const SIOEvent& e) { _eventRegistry[eventName] = e; } @@ -1203,11 +1208,11 @@ SIOClient* SocketIO::connect(const std::string& uri, SocketIO::SIODelegate& dele { Uri uriObj = Uri::parse(uri); - SIOClientImpl *socket = SocketIO::getInstance()->getSocket(uriObj.getAuthority()); - SIOClient *c = nullptr; + std::shared_ptr socket = SocketIO::getInstance()->getSocket(uriObj.getAuthority()); + SIOClient * c = nullptr; std::string path = uriObj.getPath(); - if (path == "") + if (path.empty()) path = "/"; if (socket == nullptr) @@ -1240,7 +1245,7 @@ SIOClient* SocketIO::connect(const std::string& uri, SocketIO::SIODelegate& dele c->disconnect(); CCLOG("SocketIO: recreate a new socket, new client, connect"); - SIOClientImpl* newSocket = SIOClientImpl::create(uriObj, caFilePath); + std::shared_ptr newSocket = SIOClientImpl::create(uriObj, caFilePath); SIOClient *newC = new (std::nothrow) SIOClient(path, newSocket, delegate); newSocket->addClient(path, newC); @@ -1253,14 +1258,16 @@ SIOClient* SocketIO::connect(const std::string& uri, SocketIO::SIODelegate& dele return c; } -SIOClientImpl* SocketIO::getSocket(const std::string& uri) +std::shared_ptr SocketIO::getSocket(const std::string& uri) { - return _sockets.at(uri); + auto p = _sockets.find(uri); + if(p == _sockets.end()) return nullptr; + return p->second.lock(); } -void SocketIO::addSocket(const std::string& uri, SIOClientImpl* socket) +void SocketIO::addSocket(const std::string& uri, std::shared_ptr& socket) { - _sockets.insert(uri, socket); + _sockets.emplace(uri, socket); } void SocketIO::removeSocket(const std::string& uri) diff --git a/cocos/network/SocketIO.h b/cocos/network/SocketIO.h index 9bd191e33df2..55d229303912 100644 --- a/cocos/network/SocketIO.h +++ b/cocos/network/SocketIO.h @@ -181,15 +181,16 @@ class CC_DLL SocketIO static SocketIO *_inst; - cocos2d::Map _sockets; + std::unordered_map> _sockets; - SIOClientImpl* getSocket(const std::string& uri); - void addSocket(const std::string& uri, SIOClientImpl* socket); + std::shared_ptr getSocket(const std::string& uri); + void addSocket(const std::string& uri, std::shared_ptr& socket); void removeSocket(const std::string& uri); friend class SIOClientImpl; private: - CC_DISALLOW_COPY_AND_ASSIGN(SocketIO) + CC_DISALLOW_COPY_AND_ASSIGN(SocketIO); }; //c++11 style callbacks entities will be created using CC_CALLBACK (which uses std::bind) @@ -210,9 +211,9 @@ class CC_DLL SIOClient std::string _path, _tag; bool _connected; - SIOClientImpl* _socket; - - SocketIO::SIODelegate* _delegate; + std::shared_ptr _socket; + + SocketIO::SIODelegate* _delegate = nullptr; EventRegistry _eventRegistry; @@ -236,7 +237,7 @@ class CC_DLL SIOClient * @param impl the SIOClientImpl object. * @param delegate the SIODelegate object. */ - SIOClient(const std::string& path, SIOClientImpl* impl, SocketIO::SIODelegate& delegate); + SIOClient(const std::string& path, std::shared_ptr& impl, SocketIO::SIODelegate& delegate); /** * Destructor of SIOClient class. */ @@ -276,7 +277,7 @@ class CC_DLL SIOClient * @param eventName the name of event. * @param e the callback function. */ - void on(const std::string& eventName, SIOEvent e); + void on(const std::string& eventName, const SIOEvent& e); /** * Set tag of SIOClient. diff --git a/cocos/network/WebSocket.cpp b/cocos/network/WebSocket.cpp index c9c45a7fe212..892da61e36c7 100644 --- a/cocos/network/WebSocket.cpp +++ b/cocos/network/WebSocket.cpp @@ -51,9 +51,10 @@ #define WS_RX_BUFFER_SIZE (65536) #define WS_RESERVE_RECEIVE_BUFFER_SIZE (4096) +//#define WEBSOCKETS_LOGGING #define LOG_TAG "WebSocket.cpp" -#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) +#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) && defined(WEBSOCKETS_LOGGING) // log, CCLOG aren't threadsafe, since we uses sub threads for parsing pcm data, threadsafe log output // is needed. Define the following macros (ALOGV, ALOGD, ALOGI, ALOGW, ALOGE) for threadsafe log output. @@ -122,7 +123,7 @@ static void wsLog(const char * format, ...) // Since CCLOG isn't thread safe, we uses LOGD for multi-thread logging. #ifdef ANDROID - #if COCOS2D_DEBUG > 0 + #ifdef WEBSOCKETS_LOGGING #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG,__VA_ARGS__) #else #define LOGD(...) @@ -130,7 +131,7 @@ static void wsLog(const char * format, ...) #define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG,__VA_ARGS__) #else - #if COCOS2D_DEBUG > 0 + #ifdef WEBSOCKETS_LOGGING #define LOGD(fmt, ...) wsLog("D/" LOG_TAG " (" QUOTEME(__LINE__) "): " fmt "", ##__VA_ARGS__) #else #define LOGD(fmt, ...) @@ -139,9 +140,9 @@ static void wsLog(const char * format, ...) #define LOGE(fmt, ...) wsLog("E/" LOG_TAG " (" QUOTEME(__LINE__) "): " fmt "", ##__VA_ARGS__) #endif +#ifdef WEBSOCKETS_LOGGING static void printWebSocketLog(int level, const char *line) { -#if COCOS2D_DEBUG > 0 static const char * const log_level_names[] = { "ERR", "WARN", @@ -155,20 +156,18 @@ static void printWebSocketLog(int level, const char *line) "LATENCY", }; - char buf[30] = {0}; - int n; + const char* level_name = ""; - for (n = 0; n < LLL_COUNT; n++) { + for (int n = 0; n < LLL_COUNT; n++) { if (level != (1 << n)) continue; - sprintf(buf, "%s: ", log_level_names[n]); + level_name = log_level_names[n]; break; } - LOGD("%s%s\n", buf, line); - -#endif // #if COCOS2D_DEBUG > 0 + LOGD("%s: %s", level_name, line); } +#endif // #ifdef WEBSOCKETS_LOGGING NS_NETWORK_BEGIN @@ -389,8 +388,10 @@ void WsThreadHelper::onSubThreadLoop() void WsThreadHelper::onSubThreadStarted() { +#ifdef WEBSOCKETS_LOGGING int log_level = LLL_ERR | LLL_WARN | LLL_NOTICE | LLL_INFO/* | LLL_DEBUG | LLL_PARSER | LLL_HEADER*/ | LLL_EXT | LLL_CLIENT | LLL_LATENCY; lws_set_log_level(log_level, printWebSocketLog); +#endif memset(__defaultProtocols, 0, 2 * sizeof(struct lws_protocols)); @@ -467,11 +468,11 @@ class WebSocketFrame return false; } - _data.reserve(LWS_PRE + len); - _data.resize(LWS_PRE, 0x00); + _data.resize(LWS_PRE + len); + if (len > 0) { - _data.insert(_data.end(), buf, buf + len); + std::copy(buf, buf + len, _data.begin() + LWS_PRE); } _payload = _data.data() + LWS_PRE; @@ -544,7 +545,7 @@ WebSocket::WebSocket() WebSocket::~WebSocket() { LOGD("In the destructor of WebSocket (%p)\n", this); - + std::lock_guard lk(__instanceMutex); if (__websocketInstances != nullptr) @@ -922,7 +923,7 @@ void WebSocket::onClientOpenConnectionRequest() if (nullptr == _wsInstance) { - onConnectionError(); + onConnectionError(nullptr, 0); return; } } @@ -1197,11 +1198,19 @@ int WebSocket::onConnectionOpened() return 0; } -int WebSocket::onConnectionError() +int WebSocket::onConnectionError(void* in, ssize_t len) { + std::string error; + { std::lock_guard lk(_readyStateMutex); - LOGD("WebSocket (%p) onConnectionError, state: %d ...\n", this, (int)_readyState); + if (len > 0) + { + error.assign((char*)in, (char*)in + len); + } + + LOGD("WebSocket (%p) onConnectionError, state: %d, error: %s\n", this, (int)_readyState, error.c_str()); + if (_readyState == State::CLOSED) { return 0; @@ -1210,13 +1219,14 @@ int WebSocket::onConnectionError() } std::shared_ptr> isDestroyed = _isDestroyed; - __wsHelper->sendMessageToCocosThread([this, isDestroyed](){ + __wsHelper->sendMessageToCocosThread([this, isDestroyed, error](){ if (*isDestroyed) { LOGD("WebSocket instance was destroyed!\n"); } else { + CCLOGERROR("WebSocket connection error: %s", error.c_str()); _delegate->onError(this, ErrorCode::CONNECTION_FAILURE); } }); @@ -1301,7 +1311,7 @@ int WebSocket::onSocketCallback(struct lws *wsi, break; case LWS_CALLBACK_CLIENT_CONNECTION_ERROR: - ret = onConnectionError(); + ret = onConnectionError(in, len); break; case LWS_CALLBACK_WSI_DESTROY: @@ -1318,10 +1328,18 @@ int WebSocket::onSocketCallback(struct lws *wsi, case LWS_CALLBACK_CHANGE_MODE_POLL_FD: case LWS_CALLBACK_LOCK_POLL: case LWS_CALLBACK_UNLOCK_POLL: + case LWS_CALLBACK_ADD_POLL_FD: + case LWS_CALLBACK_DEL_POLL_FD: + case LWS_CALLBACK_CLOSED_CLIENT_HTTP: + case LWS_CALLBACK_CLIENT_FILTER_PRE_ESTABLISH: + case LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER: break; case LWS_CALLBACK_PROTOCOL_INIT: LOGD("protocol init..."); break; + case LWS_CALLBACK_WSI_CREATE: + LOGD("protocol create..."); + break; case LWS_CALLBACK_PROTOCOL_DESTROY: LOGD("protocol destroy..."); break; diff --git a/cocos/network/WebSocket.h b/cocos/network/WebSocket.h index f939944d00dd..265974d2589d 100644 --- a/cocos/network/WebSocket.h +++ b/cocos/network/WebSocket.h @@ -231,7 +231,7 @@ class CC_DLL WebSocket int onClientWritable(); int onClientReceivedData(void* in, ssize_t len); int onConnectionOpened(); - int onConnectionError(); + int onConnectionError(void* in, ssize_t len); int onConnectionClosed(); struct lws_vhost* createVhost(struct lws_protocols* protocols, int& sslConnection); diff --git a/cocos/physics/CCPhysicsJoint.cpp b/cocos/physics/CCPhysicsJoint.cpp index afa1cf98a623..8ab7457ae51d 100644 --- a/cocos/physics/CCPhysicsJoint.cpp +++ b/cocos/physics/CCPhysicsJoint.cpp @@ -180,7 +180,7 @@ bool PhysicsJoint::initJoint() void PhysicsJoint::flushDelayTasks() { - for (auto tsk : _delayTasks) + for (const auto& tsk : _delayTasks) { tsk(); } diff --git a/cocos/physics/CCPhysicsWorld.cpp b/cocos/physics/CCPhysicsWorld.cpp index cd6effd739f2..03b835210a8c 100644 --- a/cocos/physics/CCPhysicsWorld.cpp +++ b/cocos/physics/CCPhysicsWorld.cpp @@ -271,6 +271,7 @@ void PhysicsWorld::debugDraw() { _debugDraw = DrawNode::create(); _debugDraw->setIsolated(true); + _debugDraw->setGlobalZOrder(_debugDrawGlobalZOrder); _debugDraw->retain(); Director::getInstance()->getRunningScene()->addChild(_debugDraw); } @@ -395,7 +396,7 @@ void PhysicsWorld::collisionSeparateCallback(PhysicsContact& contact) _eventDispatcher->dispatchEvent(&contact); } -void PhysicsWorld::rayCast(PhysicsRayCastCallbackFunc func, const Vec2& point1, const Vec2& point2, void* data) +void PhysicsWorld::rayCast(const PhysicsRayCastCallbackFunc& func, const Vec2& point1, const Vec2& point2, void* data) { CCASSERT(func != nullptr, "func shouldn't be nullptr"); @@ -418,7 +419,7 @@ void PhysicsWorld::rayCast(PhysicsRayCastCallbackFunc func, const Vec2& point1, } } -void PhysicsWorld::queryRect(PhysicsQueryRectCallbackFunc func, const Rect& rect, void* data) +void PhysicsWorld::queryRect(const PhysicsQueryRectCallbackFunc& func, const Rect& rect, void* data) { CCASSERT(func != nullptr, "func shouldn't be nullptr"); @@ -439,7 +440,7 @@ void PhysicsWorld::queryRect(PhysicsQueryRectCallbackFunc func, const Rect& rect } } -void PhysicsWorld::queryPoint(PhysicsQueryPointCallbackFunc func, const Vec2& point, void* data) +void PhysicsWorld::queryPoint(const PhysicsQueryPointCallbackFunc& func, const Vec2& point, void* data) { CCASSERT(func != nullptr, "func shouldn't be nullptr"); @@ -990,6 +991,7 @@ PhysicsWorld::PhysicsWorld() , _debugDraw(nullptr) , _debugDrawMask(DEBUGDRAW_NONE) , _eventDispatcher(nullptr) +, _debugDrawGlobalZOrder(0.f) { } diff --git a/cocos/physics/CCPhysicsWorld.h b/cocos/physics/CCPhysicsWorld.h index e6cb026327b5..eaa3e8b3b212 100644 --- a/cocos/physics/CCPhysicsWorld.h +++ b/cocos/physics/CCPhysicsWorld.h @@ -167,7 +167,7 @@ class CC_DLL PhysicsWorld * @param end A Vec2 object contains the end position of the ray. * @param data User defined data, it is passed to func. */ - void rayCast(PhysicsRayCastCallbackFunc func, const Vec2& start, const Vec2& end, void* data); + void rayCast(const PhysicsRayCastCallbackFunc& func, const Vec2& start, const Vec2& end, void* data); /** * Searches for physics shapes that contains in the rect. @@ -177,7 +177,7 @@ class CC_DLL PhysicsWorld * @param rect A Rect object contains a rectangle's x, y, width and height. * @param data User defined data, it is passed to func. */ - void queryRect(PhysicsQueryRectCallbackFunc func, const Rect& rect, void* data); + void queryRect(const PhysicsQueryRectCallbackFunc& func, const Rect& rect, void* data); /** * Searches for physics shapes that contains the point. @@ -187,7 +187,7 @@ class CC_DLL PhysicsWorld * @param point A Vec2 object contains the position of the point. * @param data User defined data, it is passed to func. */ - void queryPoint(PhysicsQueryPointCallbackFunc func, const Vec2& point, void* data); + void queryPoint(const PhysicsQueryPointCallbackFunc& func, const Vec2& point, void* data); /** * Get physics shapes that contains the point. @@ -326,7 +326,12 @@ class CC_DLL PhysicsWorld * @return An integer number. */ int getDebugDrawMask() { return _debugDrawMask; } - + + /** + * Set the debug draw global Z order. + */ + void setDebugDrawGlobalZOrder(float globalZOrder) { _debugDrawGlobalZOrder = globalZOrder; } + /** * To control the step of physics. * @@ -396,7 +401,8 @@ class CC_DLL PhysicsWorld bool _autoStep; DrawNode* _debugDraw; int _debugDrawMask; - + float _debugDrawGlobalZOrder; + EventDispatcher* _eventDispatcher; Vector _delayAddBodies; diff --git a/cocos/physics3d/CCPhysics3D.cpp b/cocos/physics3d/CCPhysics3D.cpp index 6002a8337782..c710062eaa3f 100644 --- a/cocos/physics3d/CCPhysics3D.cpp +++ b/cocos/physics3d/CCPhysics3D.cpp @@ -56,7 +56,7 @@ btVector3 convertVec3TobtVector3( const cocos2d::Vec3 &vec3 ) cocos2d::Mat4 convertbtTransformToMat4( const btTransform &btTrans ) { cocos2d::Mat4 mat; - auto rot = btTrans.getBasis(); + const auto& rot = btTrans.getBasis(); auto row = rot.getRow(0); mat.m[0] = row.getX(); mat.m[4] = row.getY(); diff --git a/cocos/physics3d/CCPhysics3DDebugDrawer.cpp b/cocos/physics3d/CCPhysics3DDebugDrawer.cpp index ac8105ac8d48..4e68e7377694 100644 --- a/cocos/physics3d/CCPhysics3DDebugDrawer.cpp +++ b/cocos/physics3d/CCPhysics3DDebugDrawer.cpp @@ -27,10 +27,10 @@ #include "base/CCConfiguration.h" #include "base/ccMacros.h" #include "base/CCDirector.h" -#include "base/ccUtils.h" #include "renderer/CCGLProgram.h" #include "renderer/CCRenderer.h" #include "renderer/CCRenderState.h" +#include "renderer/ccGLStateCache.h" #include "renderer/CCGLProgramCache.h" #if CC_USE_3D_PHYSICS @@ -134,7 +134,7 @@ void Physics3DDebugDrawer::drawImplementation( const Mat4 &transform, uint32_t / _program->setUniformsForBuiltins(transform); glEnable(GL_DEPTH_TEST); - utils::setBlending(_blendFunc.src, _blendFunc.dst); + GL::blendFunc(_blendFunc.src, _blendFunc.dst); if (_dirty) { @@ -144,12 +144,11 @@ void Physics3DDebugDrawer::drawImplementation( const Mat4 &transform, uint32_t / } if (Configuration::getInstance()->supportsShareableVAO()) { - glBindVertexArray(_vao); + GL::bindVAO(_vao); } else { - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_COLOR); + GL::enableVertexAttribs(GL::VERTEX_ATTRIB_FLAG_POSITION | GL::VERTEX_ATTRIB_FLAG_COLOR); glBindBuffer(GL_ARRAY_BUFFER, _vbo); // vertex @@ -176,7 +175,7 @@ void Physics3DDebugDrawer::init() if (Configuration::getInstance()->supportsShareableVAO()) { glGenVertexArrays(1, &_vao); - glBindVertexArray(_vao); + GL::bindVAO(_vao); } glGenBuffers(1, &_vbo); @@ -193,7 +192,7 @@ void Physics3DDebugDrawer::init() if (Configuration::getInstance()->supportsShareableVAO()) { - glBindVertexArray(0); + GL::bindVAO(0); } } diff --git a/cocos/platform/CCApplication.h b/cocos/platform/CCApplication.h index 00950cc9e694..ad86810b2e65 100644 --- a/cocos/platform/CCApplication.h +++ b/cocos/platform/CCApplication.h @@ -42,8 +42,6 @@ THE SOFTWARE. #include "platform/winrt/CCApplication.h" #elif CC_TARGET_PLATFORM == CC_PLATFORM_LINUX #include "platform/linux/CCApplication-linux.h" -#elif CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN -#include "platform/tizen/CCApplication-tizen.h" #endif /// @endcond diff --git a/cocos/platform/CCApplicationProtocol.h b/cocos/platform/CCApplicationProtocol.h index 09d5f39309ee..8cc7bf0863c0 100644 --- a/cocos/platform/CCApplicationProtocol.h +++ b/cocos/platform/CCApplicationProtocol.h @@ -28,7 +28,6 @@ THE SOFTWARE. #define __CC_APPLICATION_PROTOCOL_H__ #include "platform/CCPlatformMacros.h" -#include "base/CCScriptSupport.h" #include "base/CCAutoreleasePool.h" #include "base/ccTypes.h" @@ -67,9 +66,6 @@ class CC_DLL ApplicationProtocol * @lua NA */ virtual ~ApplicationProtocol(){ -#if CC_ENABLE_SCRIPT_BINDING - ScriptEngineManager::destroyInstance(); -#endif /** clean auto release pool. */ PoolManager::destroyInstance(); } @@ -104,7 +100,6 @@ class CC_DLL ApplicationProtocol * @lua NA */ virtual void setAnimationInterval(float interval) = 0; - virtual void setAnimationInterval(float interval, SetIntervalReason reason) = 0; /** Subclass override the function to set OpenGL context attribution instead of use default value. * And now can only set six attributions:redBits,greenBits,blueBits,alphaBits,depthBits,stencilBits. diff --git a/cocos/platform/CCCommon.h b/cocos/platform/CCCommon.h index ba6f0aecd99c..037eb65fd249 100644 --- a/cocos/platform/CCCommon.h +++ b/cocos/platform/CCCommon.h @@ -45,7 +45,7 @@ void CC_DLL LuaLog(const char * format); /** @brief Pop out a message box */ -void CC_DLL MessageBox(const char * msg, const char * title); +void CC_DLL ccMessageBox(const char * msg, const char * title); /** @brief Enum the language type supported now diff --git a/cocos/platform/CCDataManager.cpp b/cocos/platform/CCDataManager.cpp new file mode 100644 index 000000000000..f359487a33cb --- /dev/null +++ b/cocos/platform/CCDataManager.cpp @@ -0,0 +1,73 @@ +/**************************************************************************** +Copyright (c) 2010-2012 cocos2d-x.org +Copyright (c) 2013-2016 Chukong Technologies Inc. +Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. +Copyright (c) 2019 Xiamen Yaji Software Co., Ltd. + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#include "platform/CCDataManager.h" + +#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID +# include "platform/android/jni/JniHelper.h" +# define DataManagerClassName "org/cocos2dx/lib/Cocos2dxDataManager" +#endif + +NS_CC_BEGIN + +void DataManager::setProcessID(int pid){ +#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID + JniHelper::callStaticVoidMethod(DataManagerClassName, "setProcessID", pid); +#endif +} +void DataManager::setFrameSize(int width, int height){ +#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID + JniHelper::callStaticVoidMethod(DataManagerClassName, "setFrameSize", width, height); +#endif +} +void DataManager::onSceneLoaderBegin(){ +#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID + JniHelper::callStaticVoidMethod(DataManagerClassName, "onSceneLoaderBegin"); +#endif +} +void DataManager::onSceneLoaderEnd(){ +#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID + JniHelper::callStaticVoidMethod(DataManagerClassName, "onSceneLoaderEnd"); +#endif +} +void DataManager::onShaderLoaderBegin(){ +#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID + JniHelper::callStaticVoidMethod(DataManagerClassName, "onShaderLoaderBegin"); +#endif +} +void DataManager::onShaderLoaderEnd(){ +#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID + JniHelper::callStaticVoidMethod(DataManagerClassName, "onShaderLoaderEnd"); +#endif +} +void DataManager::setOptimise(const std::string& thing, const std::string& value){ +#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID + JniHelper::callStaticVoidMethod(DataManagerClassName, "setOptimise", thing.c_str(), value.c_str()); +#endif +} + +NS_CC_END diff --git a/cocos/platform/winrt/InputEventTypes.h b/cocos/platform/CCDataManager.h similarity index 63% rename from cocos/platform/winrt/InputEventTypes.h rename to cocos/platform/CCDataManager.h index d9385b1a09cd..b12389389ca5 100644 --- a/cocos/platform/winrt/InputEventTypes.h +++ b/cocos/platform/CCDataManager.h @@ -1,7 +1,8 @@ /**************************************************************************** -Copyright (c) 2013 cocos2d-x.org -Copyright (c) Microsoft Open Technologies, Inc. +Copyright (c) 2010-2012 cocos2d-x.org +Copyright (c) 2013-2016 Chukong Technologies Inc. Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. +Copyright (c) 2019 Xiamen Yaji Software Co., Ltd. http://www.cocos2d-x.org @@ -24,23 +25,35 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ -#ifndef __INPUT_EVENT_TYPES__ -#define __INPUT_EVENT_TYPES__ +#ifndef __CC_DataManager_H__ +#define __CC_DataManager_H__ +#include +#include "platform/CCPlatformMacros.h" +#include "base/ccTypes.h" NS_CC_BEGIN +/** + * @addtogroup platform + * @{ + */ -enum class Cocos2dKeyEvent : int +class CC_DLL DataManager { - Text, - Escape, - Back, - Enter +public: + static void setProcessID(int pid); + static void setFrameSize(int width, int height); + static void onSceneLoaderBegin(); + static void onSceneLoaderEnd(); + static void onShaderLoaderBegin(); + static void onShaderLoaderEnd(); + static void setOptimise(const std::string& thing, const std::string& value); }; -NS_CC_END - +// end of platform group +/** @} */ -#endif // #ifndef __INPUT_EVENT_TYPES__ +NS_CC_END +#endif // __CC_DataManager_H__ diff --git a/cocos/platform/CCFileUtils.cpp b/cocos/platform/CCFileUtils.cpp index 50e604f626b1..cb07642ff6bb 100644 --- a/cocos/platform/CCFileUtils.cpp +++ b/cocos/platform/CCFileUtils.cpp @@ -547,8 +547,7 @@ void FileUtils::destroyInstance() void FileUtils::setDelegate(FileUtils *delegate) { - if (s_sharedFileUtils) - delete s_sharedFileUtils; + delete s_sharedFileUtils; s_sharedFileUtils = delegate; } @@ -616,7 +615,7 @@ bool FileUtils::init() { DECLARE_GUARD; _searchPathArray.push_back(_defaultResRootPath); - _searchResolutionsOrderArray.push_back(""); + _searchResolutionsOrderArray.emplace_back(""); return true; } @@ -624,6 +623,7 @@ void FileUtils::purgeCachedEntries() { DECLARE_GUARD; _fullPathCache.clear(); + _fullPathCacheDir.clear(); } std::string FileUtils::getStringFromFile(const std::string& filename) const @@ -669,20 +669,21 @@ FileUtils::Status FileUtils::getContents(const std::string& filename, ResizableB if (fullPath.empty()) return Status::NotExists; - FILE *fp = fopen(fs->getSuitableFOpen(fullPath).c_str(), "rb"); - if (!fp) - return Status::OpenFailed; + std::string suitableFullPath = fs->getSuitableFOpen(fullPath); -#if defined(_MSC_VER) - auto descriptor = _fileno(fp); -#else - auto descriptor = fileno(fp); -#endif struct stat statBuf; - if (fstat(descriptor, &statBuf) == -1) { - fclose(fp); + if (stat(suitableFullPath.c_str(), &statBuf) == -1) { return Status::ReadFailed; } + + if (!(statBuf.st_mode & S_IFREG)) { + return Status::NotRegularFileType; + } + + FILE *fp = fopen(suitableFullPath.c_str(), "rb"); + if (!fp) + return Status::OpenFailed; + size_t size = statBuf.st_size; buffer->resize(size); @@ -724,12 +725,9 @@ unsigned char* FileUtils::getFileDataFromZip(const std::string& zipFilePath, con file = unzOpen(FileUtils::getInstance()->getSuitableFOpen(zipFilePath).c_str()); CC_BREAK_IF(!file); - // FIXME: Other platforms should use upstream minizip like mingw-w64 -#ifdef MINIZIP_FROM_SYSTEM - int ret = unzLocateFile(file, filename.c_str(), NULL); -#else - int ret = unzLocateFile(file, filename.c_str(), 1); -#endif + // minizip 1.2.0 is same with other platforms + int ret = unzLocateFile(file, filename.c_str(), nullptr); + CC_BREAK_IF(UNZ_OK != ret); char filePathA[260]; @@ -795,7 +793,7 @@ std::string FileUtils::getPathForFilename(const std::string& filename, const std { std::string file = filename; std::string file_path = ""; - size_t pos = filename.find_last_of("/"); + size_t pos = filename.find_last_of('/'); if (pos != std::string::npos) { file_path = filename.substr(0, pos+1); @@ -807,11 +805,16 @@ std::string FileUtils::getPathForFilename(const std::string& filename, const std path += file_path; path += resolutionDirectory; - path = getFullPathForDirectoryAndFilename(path, file); + path = getFullPathForFilenameWithinDirectory(path, file); return path; } +std::string FileUtils::getPathForDirectory(const std::string &dir, const std::string &resolutionDiretory, const std::string &searchPath) const +{ + return searchPath + resolutionDiretory + dir; +} + std::string FileUtils::fullPathForFilename(const std::string &filename) const { @@ -863,6 +866,60 @@ std::string FileUtils::fullPathForFilename(const std::string &filename) const return ""; } + +std::string FileUtils::fullPathForDirectory(const std::string &dir) const +{ + DECLARE_GUARD; + + if (dir.empty()) + { + return ""; + } + + if (isAbsolutePath(dir)) + { + return dir; + } + + // Already Cached ? + auto cacheIter = _fullPathCacheDir.find(dir); + if(cacheIter != _fullPathCacheDir.end()) + { + return cacheIter->second; + } + std::string longdir = dir; + std::string fullpath; + + if(longdir[longdir.length() - 1] != '/') + { + longdir +="/"; + } + + const std::string newdirname( getNewFilename(longdir) ); + + for (const auto& searchIt : _searchPathArray) + { + for (const auto& resolutionIt : _searchResolutionsOrderArray) + { + fullpath = this->getPathForDirectory(newdirname, resolutionIt, searchIt); + if (!fullpath.empty() && isDirectoryExistInternal(fullpath)) + { + // Using the filename passed in as key. + _fullPathCacheDir.emplace(dir, fullpath); + return fullpath; + } + + } + } + + if(isPopupNotify()){ + CCLOG("cocos2d: fullPathForDirectory: No directory found at %s. Possible missing directory.", dir.c_str()); + } + + // The file wasn't found, return empty string. + return ""; +} + std::string FileUtils::fullPathFromRelativeFile(const std::string &filename, const std::string &relativeFile) const { return relativeFile.substr(0, relativeFile.rfind('/')+1) + getNewFilename(filename); @@ -880,11 +937,12 @@ void FileUtils::setSearchResolutionsOrder(const std::vector& search bool existDefault = false; _fullPathCache.clear(); + _fullPathCacheDir.clear(); _searchResolutionsOrderArray.clear(); for(const auto& iter : searchResolutionsOrder) { std::string resolutionDirectory = iter; - if (!existDefault && resolutionDirectory == "") + if (!existDefault && resolutionDirectory.empty()) { existDefault = true; } @@ -899,7 +957,7 @@ void FileUtils::setSearchResolutionsOrder(const std::vector& search if (!existDefault) { - _searchResolutionsOrderArray.push_back(""); + _searchResolutionsOrderArray.emplace_back(""); } } @@ -955,6 +1013,7 @@ void FileUtils::setDefaultResourceRootPath(const std::string& path) if (_defaultResRootPath != path) { _fullPathCache.clear(); + _fullPathCacheDir.clear(); _defaultResRootPath = path; if (!_defaultResRootPath.empty() && _defaultResRootPath[_defaultResRootPath.length()-1] != '/') { @@ -973,6 +1032,7 @@ void FileUtils::setSearchPaths(const std::vector& searchPaths) _originalSearchPaths = searchPaths; _fullPathCache.clear(); + _fullPathCacheDir.clear(); _searchPathArray.clear(); for (const auto& path : _originalSearchPaths) @@ -1029,6 +1089,7 @@ void FileUtils::setFilenameLookupDictionary(const ValueMap& filenameLookupDict) { DECLARE_GUARD; _fullPathCache.clear(); + _fullPathCacheDir.clear(); _filenameLookupDict = filenameLookupDict; } @@ -1052,17 +1113,16 @@ void FileUtils::loadFilenameLookupDictionaryFromFile(const std::string &filename } } -std::string FileUtils::getFullPathForDirectoryAndFilename(const std::string& directory, const std::string& filename) const +std::string FileUtils::getFullPathForFilenameWithinDirectory(const std::string& directory, const std::string& filename) const { // get directory+filename, safely adding '/' as necessary std::string ret = directory; - if (directory.size() && directory[directory.size()-1] != '/'){ + if (!directory.empty() && directory[directory.size()-1] != '/'){ ret += '/'; } ret += filename; - // if the file doesn't exist, return an empty string - if (!isFileExistInternal(ret) && !isDirectoryExistInternal(ret)) { + if (!isFileExistInternal(ret)) { ret = ""; } return ret; @@ -1106,30 +1166,10 @@ bool FileUtils::isDirectoryExist(const std::string& dirPath) const if (isAbsolutePath(dirPath)) { return isDirectoryExistInternal(dirPath); + } else { + auto fullPath = fullPathForDirectory(dirPath); + return !fullPath.empty(); } - - // Already Cached ? - auto cacheIter = _fullPathCache.find(dirPath); - if( cacheIter != _fullPathCache.end() ) - { - return isDirectoryExistInternal(cacheIter->second); - } - - std::string fullpath; - for (const auto& searchIt : _searchPathArray) - { - for (const auto& resolutionIt : _searchResolutionsOrderArray) - { - // searchPath + file_path + resourceDirectory - fullpath = fullPathForFilename(searchIt + dirPath + resolutionIt); - if (isDirectoryExistInternal(fullpath)) - { - _fullPathCache.emplace(dirPath, fullpath); - return true; - } - } - } - return false; } void FileUtils::isDirectoryExist(const std::string& fullPath, std::function callback) const @@ -1187,7 +1227,7 @@ void FileUtils::getFileSize(const std::string &filepath, std::function)> callback) const { - auto fullPath = fullPathForFilename(dirPath); + auto fullPath = fullPathForDirectory(dirPath); performOperationOffthread([fullPath]() { return FileUtils::getInstance()->listFiles(fullPath); }, std::move(callback)); @@ -1195,7 +1235,7 @@ void FileUtils::listFilesAsync(const std::string& dirPath, std::function)> callback) const { - auto fullPath = fullPathForFilename(dirPath); + auto fullPath = fullPathForDirectory(dirPath); performOperationOffthread([fullPath]() { std::vector retval; FileUtils::getInstance()->listFilesRecursively(fullPath, &retval); @@ -1458,8 +1498,8 @@ long FileUtils::getFileSize(const std::string &filepath) const std::vector FileUtils::listFiles(const std::string& dirPath) const { std::vector files; - std::string fullpath = fullPathForFilename(dirPath); - if (isDirectoryExist(fullpath)) + std::string fullpath = fullPathForDirectory(dirPath); + if (!fullpath.empty() && isDirectoryExist(fullpath)) { tinydir_dir dir; std::string fullpathstr = fullpath; @@ -1496,7 +1536,7 @@ std::vector FileUtils::listFiles(const std::string& dirPath) const void FileUtils::listFilesRecursively(const std::string& dirPath, std::vector *files) const { - std::string fullpath = fullPathForFilename(dirPath); + std::string fullpath = fullPathForDirectory(dirPath); if (isDirectoryExist(fullpath)) { tinydir_dir dir; diff --git a/cocos/platform/CCFileUtils.h b/cocos/platform/CCFileUtils.h index b21e58818f32..2b68927fcbc7 100644 --- a/cocos/platform/CCFileUtils.h +++ b/cocos/platform/CCFileUtils.h @@ -203,7 +203,8 @@ class CC_DLL FileUtils ReadFailed = 3, // Read failed NotInitialized = 4, // FileUtils is not initializes TooLarge = 5, // The file is too large (great than 2^32-1) - ObtainSizeFailed = 6 // Failed to obtain the file size. + ObtainSizeFailed = 6, // Failed to obtain the file size. + NotRegularFileType = 7 // File type is not S_IFREG }; /** @@ -342,6 +343,7 @@ class CC_DLL FileUtils */ virtual std::string fullPathForFilename(const std::string &filename) const; + /** * Loads the filenameLookup dictionary from the contents of a filename. * @@ -894,6 +896,9 @@ class CC_DLL FileUtils */ virtual std::string getPathForFilename(const std::string& filename, const std::string& resolutionDirectory, const std::string& searchPath) const; + virtual std::string getPathForDirectory(const std::string &dir, const std::string &resolutionDiretory, const std::string &searchPath) const; + + /** * Gets full path for the directory and the filename. * @@ -904,8 +909,14 @@ class CC_DLL FileUtils * @param filename The name of the file. * @return The full path of the file, if the file can't be found, it will return an empty string. */ - virtual std::string getFullPathForDirectoryAndFilename(const std::string& directory, const std::string& filename) const; - + virtual std::string getFullPathForFilenameWithinDirectory(const std::string& directory, const std::string& filename) const; + + + /** + * Returns the fullpath for a given dirname. + * @since 3.17.1 + */ + virtual std::string fullPathForDirectory(const std::string &dirname) const; /** * mutex used to protect fields. @@ -949,11 +960,17 @@ class CC_DLL FileUtils std::string _defaultResRootPath; /** - * The full path cache. When a file is found, it will be added into this cache. + * The full path cache for normal files. When a file is found, it will be added into this cache. * This variable is used for improving the performance of file search. */ mutable std::unordered_map _fullPathCache; + /** + * The full path cache for directories. When a diretory is found, it will be added into this cache. + * This variable is used for improving the performance of file search. + */ + mutable std::unordered_map _fullPathCacheDir; + /** * Writable path. */ diff --git a/cocos/platform/CCGLView.cpp b/cocos/platform/CCGLView.cpp index 4e84bda09d35..b13fcf0fa55a 100644 --- a/cocos/platform/CCGLView.cpp +++ b/cocos/platform/CCGLView.cpp @@ -331,7 +331,7 @@ void GLView::handleTouchesBegin(int num, intptr_t ids[], float xs[], float ys[]) } } - if (touchEvent._touches.size() == 0) + if (touchEvent._touches.empty()) { CCLOG("touchesBegan: size = 0"); return; @@ -388,7 +388,7 @@ void GLView::handleTouchesMove(int num, intptr_t ids[], float xs[], float ys[], } } - if (touchEvent._touches.size() == 0) + if (touchEvent._touches.empty()) { CCLOG("touchesMoved: size = 0"); return; @@ -442,7 +442,7 @@ void GLView::handleTouchesOfEndOrCancel(EventTouch::EventCode eventCode, int num } - if (touchEvent._touches.size() == 0) + if (touchEvent._touches.empty()) { CCLOG("touchesEnded or touchesCancel: size = 0"); return; diff --git a/cocos/platform/CCGLView.h b/cocos/platform/CCGLView.h index 5752ad4ba3ff..5fd14cc910df 100644 --- a/cocos/platform/CCGLView.h +++ b/cocos/platform/CCGLView.h @@ -195,6 +195,19 @@ class CC_DLL GLView : public Ref */ virtual float getFrameZoomFactor() const { return 1.0; } + /** + * Sets the cursor for the window with custom image. + * + * @param filename A path to image file, e.g., "cursors/custom.png". + * @param hotspot Cursor hotspot, as a anchor point, default is top left (0, 1) + */ + virtual void setCursor(const std::string& filename, Vec2 hotspot = Vec2::ANCHOR_TOP_LEFT) {} + + /** + * Sets the cursor for the window back to default. + */ + virtual void setDefaultCursor() {} + /** * Hide or Show the mouse cursor if there is one. * @@ -363,22 +376,22 @@ class CC_DLL GLView : public Ref /** Set window icon (implemented for windows and linux). * - * @param filename A path to image file, e.g., "icons/cusom.png". + * @param filename A path to image file, e.g., "icons/custom.png". */ - virtual void setIcon(const std::string& filename) const {}; + virtual void setIcon(const std::string& filename) const {} /** Set window icon (implemented for windows and linux). * Best icon (based on size) will be auto selected. * * @param filelist The array contains icons. */ - virtual void setIcon(const std::vector& filelist) const {}; + virtual void setIcon(const std::vector& filelist) const {} /** Set default window icon (implemented for windows and linux). * On windows it will use icon from .exe file (if included). * On linux it will use default window icon. */ - virtual void setDefaultIcon() const {}; + virtual void setDefaultIcon() const {} /** * Get the opengl view port rectangle. @@ -420,6 +433,7 @@ class CC_DLL GLView : public Ref #if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) virtual id getCocoaWindow() = 0; + virtual id getNSGLContext() = 0; // stevetranby: added #endif /* (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) */ /** diff --git a/cocos/platform/CCImage.cpp b/cocos/platform/CCImage.cpp index 8e5c225a2db5..eb01683400c0 100644 --- a/cocos/platform/CCImage.cpp +++ b/cocos/platform/CCImage.cpp @@ -1145,9 +1145,18 @@ bool Image::initWithPngData(const unsigned char * data, ssize_t dataLen) png_read_end(png_ptr, nullptr); // premultiplied alpha for RGBA8888 - if (PNG_PREMULTIPLIED_ALPHA_ENABLED && color_type == PNG_COLOR_TYPE_RGB_ALPHA) + if (color_type == PNG_COLOR_TYPE_RGB_ALPHA) { - premultipliedAlpha(); + if (PNG_PREMULTIPLIED_ALPHA_ENABLED) + { + premultiplyAlpha(); + } + else + { +#if CC_ENABLE_PREMULTIPLIED_ALPHA != 0 + _hasPremultipliedAlpha = true; +#endif + } } if (row_pointers != nullptr) @@ -2416,7 +2425,7 @@ bool Image::saveImageToJPG(const std::string& filePath) while (cinfo.next_scanline < cinfo.image_height) { row_pointer[0] = & tempData[cinfo.next_scanline * row_stride]; - (void) jpeg_write_scanlines(&cinfo, row_pointer, 1); + (void)jpeg_write_scanlines(&cinfo, row_pointer, 1); } if (tempData != nullptr) @@ -2428,7 +2437,7 @@ bool Image::saveImageToJPG(const std::string& filePath) { while (cinfo.next_scanline < cinfo.image_height) { row_pointer[0] = & _data[cinfo.next_scanline * row_stride]; - (void) jpeg_write_scanlines(&cinfo, row_pointer, 1); + (void)jpeg_write_scanlines(&cinfo, row_pointer, 1); } } @@ -2445,7 +2454,7 @@ bool Image::saveImageToJPG(const std::string& filePath) #endif // CC_USE_JPEG } -void Image::premultipliedAlpha() +void Image::premultiplyAlpha() { #if CC_ENABLE_PREMULTIPLIED_ALPHA == 0 _hasPremultipliedAlpha = false; @@ -2464,6 +2473,29 @@ void Image::premultipliedAlpha() #endif } +static inline unsigned char clamp(int x) { + return (unsigned char)(x >= 0 ? (x < 255 ? x : 255) : 0); +} + +void Image::reversePremultipliedAlpha() +{ + CCASSERT(_renderFormat == Texture2D::PixelFormat::RGBA8888, "The pixel format should be RGBA8888!"); + + unsigned int* fourBytes = (unsigned int*)_data; + for (int i = 0; i < _width * _height; i++) + { + unsigned char* p = _data + i * 4; + if (p[3] > 0) + { + fourBytes[i] = clamp(int(std::ceil((p[0] * 255.0f) / p[3]))) | + clamp(int(std::ceil((p[1] * 255.0f) / p[3]))) << 8 | + clamp(int(std::ceil((p[2] * 255.0f) / p[3]))) << 16 | + p[3] << 24; + } + } + + _hasPremultipliedAlpha = false; +} void Image::setPVRImagesHavePremultipliedAlpha(bool haveAlphaPremultiplied) { diff --git a/cocos/platform/CCImage.h b/cocos/platform/CCImage.h index 6a7cebf20a53..a864944905fb 100644 --- a/cocos/platform/CCImage.h +++ b/cocos/platform/CCImage.h @@ -160,6 +160,8 @@ class CC_DLL Image : public Ref @param isToRGB whether the image is saved as RGB format. */ bool saveToFile(const std::string &filename, bool isToRGB = true); + void premultiplyAlpha(); + void reversePremultipliedAlpha(); protected: #if CC_USE_WIC @@ -182,8 +184,6 @@ class CC_DLL Image : public Ref bool saveImageToPNG(const std::string& filePath, bool isToRGB = true); bool saveImageToJPG(const std::string& filePath); - void premultipliedAlpha(); - protected: /** @brief Determine how many mipmaps can we have. diff --git a/cocos/platform/CCPlatformConfig.h b/cocos/platform/CCPlatformConfig.h index 1b835bd1209a..4a45d686f1e3 100644 --- a/cocos/platform/CCPlatformConfig.h +++ b/cocos/platform/CCPlatformConfig.h @@ -58,7 +58,7 @@ THE SOFTWARE. #define CC_TARGET_PLATFORM CC_PLATFORM_UNKNOWN // Apple: Mac and iOS -#if defined(__APPLE__) && !defined(ANDROID) // exclude android for binding generator. +#if defined(__APPLE__) && !defined(__ANDROID__) // exclude android for binding generator. #include #if TARGET_OS_IPHONE // TARGET_OS_IPHONE includes TARGET_OS_IOS TARGET_OS_TV and TARGET_OS_WATCH. see TargetConditionals.h #undef CC_TARGET_PLATFORM @@ -70,7 +70,7 @@ THE SOFTWARE. #endif // android -#if defined(ANDROID) +#if defined(__ANDROID__) #undef CC_TARGET_PLATFORM #define CC_TARGET_PLATFORM CC_PLATFORM_ANDROID #endif diff --git a/cocos/platform/CCPlatformDefine.h b/cocos/platform/CCPlatformDefine.h index 18f87a133046..d82438eabb35 100644 --- a/cocos/platform/CCPlatformDefine.h +++ b/cocos/platform/CCPlatformDefine.h @@ -38,12 +38,8 @@ THE SOFTWARE. #include "platform/android/CCPlatformDefine-android.h" #elif CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 #include "platform/win32/CCPlatformDefine-win32.h" -#elif CC_TARGET_PLATFORM == CC_PLATFORM_WINRT -#include "platform/winrt/CCPlatformDefine-winrt.h" #elif CC_TARGET_PLATFORM == CC_PLATFORM_LINUX #include "platform/linux/CCPlatformDefine-linux.h" -#elif CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN -#include "platform/tizen/CCPlatformDefine-tizen.h" #endif /// @endcond diff --git a/cocos/platform/CCPlatformMacros.h b/cocos/platform/CCPlatformMacros.h index d28c6035c7d2..0d09ecd031df 100644 --- a/cocos/platform/CCPlatformMacros.h +++ b/cocos/platform/CCPlatformMacros.h @@ -130,10 +130,10 @@ CC_DEPRECATED_ATTRIBUTE static __TYPE__* node() \ * If you need protected or private, please declare. */ #define CC_PROPERTY_READONLY(varType, varName, funName)\ -protected: varType varName; public: virtual varType get##funName(void) const; +protected: varType varName; public: virtual varType get##funName() const #define CC_PROPERTY_READONLY_PASS_BY_REF(varType, varName, funName)\ -protected: varType varName; public: virtual const varType& get##funName(void) const; +protected: varType varName; public: virtual const varType& get##funName() const /** @def CC_PROPERTY * It is used to declare a protected variable. @@ -148,10 +148,10 @@ protected: varType varName; public: virtual const varType& get##funName(void) co * If you need protected or private, please declare. */ #define CC_PROPERTY(varType, varName, funName)\ -protected: varType varName; public: virtual varType get##funName(void) const; virtual void set##funName(varType var); +protected: varType varName; public: virtual varType get##funName() const; virtual void set##funName(varType var) #define CC_PROPERTY_PASS_BY_REF(varType, varName, funName)\ -protected: varType varName; public: virtual const varType& get##funName(void) const; virtual void set##funName(const varType& var); +protected: varType varName; public: virtual const varType& get##funName() const; virtual void set##funName(const varType& var) /** @def CC_SYNTHESIZE_READONLY * It is used to declare a protected variable. We can use getter to read the variable. @@ -164,10 +164,10 @@ protected: varType varName; public: virtual const varType& get##funName(void) co * If you need protected or private, please declare. */ #define CC_SYNTHESIZE_READONLY(varType, varName, funName)\ -protected: varType varName; public: virtual inline varType get##funName(void) const { return varName; } +protected: varType varName; public: virtual inline varType get##funName() const { return varName; } #define CC_SYNTHESIZE_READONLY_PASS_BY_REF(varType, varName, funName)\ -protected: varType varName; public: virtual inline const varType& get##funName(void) const { return varName; } +protected: varType varName; public: virtual inline const varType& get##funName() const { return varName; } /** @def CC_SYNTHESIZE * It is used to declare a protected variable. @@ -182,13 +182,13 @@ protected: varType varName; public: virtual inline const varType& get##funName(v * If you need protected or private, please declare. */ #define CC_SYNTHESIZE(varType, varName, funName)\ -protected: varType varName; public: virtual inline varType get##funName(void) const { return varName; } virtual inline void set##funName(varType var){ varName = var; } +protected: varType varName; public: virtual inline varType get##funName() const { return varName; } virtual inline void set##funName(varType var){ varName = var; } #define CC_SYNTHESIZE_PASS_BY_REF(varType, varName, funName)\ -protected: varType varName; public: virtual inline const varType& get##funName(void) const { return varName; } virtual inline void set##funName(const varType& var){ varName = var; } +protected: varType varName; public: virtual inline const varType& get##funName() const { return varName; } virtual inline void set##funName(const varType& var){ varName = var; } #define CC_SYNTHESIZE_RETAIN(varType, varName, funName) \ -private: varType varName; public: virtual inline varType get##funName(void) const { return varName; } virtual inline void set##funName(varType var) \ +private: varType varName; public: virtual inline varType get##funName() const { return varName; } virtual inline void set##funName(varType var) \ { \ if (varName != var) \ { \ @@ -248,11 +248,11 @@ private: varType varName; public: virtual inline varType get##funName(void) cons || (defined(__clang__) && (__clang_major__ >= 3)) || (_MSC_VER >= 1800) #define CC_DISALLOW_COPY_AND_ASSIGN(TypeName) \ TypeName(const TypeName &) = delete; \ - TypeName &operator =(const TypeName &) = delete; + TypeName &operator =(const TypeName &) = delete #else #define CC_DISALLOW_COPY_AND_ASSIGN(TypeName) \ TypeName(const TypeName &); \ - TypeName &operator =(const TypeName &); + TypeName &operator =(const TypeName &) #endif /** @def CC_DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) diff --git a/cocos/platform/CCSAXParser.cpp b/cocos/platform/CCSAXParser.cpp index eca50aec1e39..907a5eb01b6d 100644 --- a/cocos/platform/CCSAXParser.cpp +++ b/cocos/platform/CCSAXParser.cpp @@ -28,66 +28,10 @@ #include // because its based on windows 8 build :P #include "platform/CCFileUtils.h" -#include "tinyxml2.h" #include "rapidxml/rapidxml_sax3.hpp" NS_CC_BEGIN -class XmlSaxHander : public tinyxml2::XMLVisitor -{ -public: - XmlSaxHander():_ccsaxParserImp(0){}; - - virtual bool VisitEnter( const tinyxml2::XMLElement& element, const tinyxml2::XMLAttribute* firstAttribute ); - virtual bool VisitExit( const tinyxml2::XMLElement& element ); - virtual bool Visit( const tinyxml2::XMLText& text ); - virtual bool Visit( const tinyxml2::XMLUnknown&){ return true; } - - void setSAXParserImp(SAXParser* parser) - { - _ccsaxParserImp = parser; - } - -private: - SAXParser *_ccsaxParserImp; -}; - - -bool XmlSaxHander::VisitEnter( const tinyxml2::XMLElement& element, const tinyxml2::XMLAttribute* firstAttribute ) -{ - //log(" VisitEnter %s",element.Value()); - - std::vector attsVector; - for( const tinyxml2::XMLAttribute* attrib = firstAttribute; attrib; attrib = attrib->Next() ) - { - //log("%s", attrib->Name()); - attsVector.push_back(attrib->Name()); - //log("%s",attrib->Value()); - attsVector.push_back(attrib->Value()); - } - - // nullptr is used in c++11 - //attsVector.push_back(nullptr); - attsVector.push_back(nullptr); - - SAXParser::startElement(_ccsaxParserImp, (const CC_XML_CHAR *)element.Value(), (const CC_XML_CHAR **)(&attsVector[0])); - return true; -} -bool XmlSaxHander::VisitExit( const tinyxml2::XMLElement& element ) -{ - //log("VisitExit %s",element.Value()); - - SAXParser::endElement(_ccsaxParserImp, (const CC_XML_CHAR *)element.Value()); - return true; -} - -bool XmlSaxHander::Visit( const tinyxml2::XMLText& text ) -{ - //log("Visit %s",text.Value()); - SAXParser::textHandler(_ccsaxParserImp, (const CC_XML_CHAR *)text.Value(), strlen(text.Value())); - return true; -} - /// rapidxml SAX handler class RapidXmlSaxHander : public rapidxml::xml_sax2_handler { @@ -124,7 +68,7 @@ SAXParser::SAXParser() _delegator = nullptr; } -SAXParser::~SAXParser(void) +SAXParser::~SAXParser() { } @@ -136,12 +80,11 @@ bool SAXParser::init(const char* /*encoding*/) bool SAXParser::parse(const char* xmlData, size_t dataLength) { - tinyxml2::XMLDocument tinyDoc; - tinyDoc.Parse(xmlData, dataLength); - XmlSaxHander printer; - printer.setSAXParserImp(this); - - return tinyDoc.Accept( &printer ); + if(xmlData != nullptr && dataLength > 0) { + std::string mutableData(xmlData, dataLength); + return this->parseIntrusive(&mutableData.front(), dataLength); + } + return false; } bool SAXParser::parse(const std::string& filename) @@ -150,7 +93,7 @@ bool SAXParser::parse(const std::string& filename) Data data = FileUtils::getInstance()->getDataFromFile(filename); if (!data.isNull()) { - ret = parse((const char*)data.getBytes(), data.getSize()); + ret = parseIntrusive((char*)data.getBytes(), data.getSize()); } return ret; diff --git a/cocos/platform/CCSAXParser.h b/cocos/platform/CCSAXParser.h index 574010a7ba8b..9bb2c2e37119 100644 --- a/cocos/platform/CCSAXParser.h +++ b/cocos/platform/CCSAXParser.h @@ -74,7 +74,7 @@ class CC_DLL SAXParser * @js NA * @lua NA */ - ~SAXParser(void); + ~SAXParser(); /** * @js NA * @lua NA diff --git a/cocos/platform/CCStdC.h b/cocos/platform/CCStdC.h index 52ec32087627..a90f921cb089 100644 --- a/cocos/platform/CCStdC.h +++ b/cocos/platform/CCStdC.h @@ -41,8 +41,6 @@ THE SOFTWARE. #include "platform/winrt/CCStdC.h" #elif CC_TARGET_PLATFORM == CC_PLATFORM_LINUX #include "platform/linux/CCStdC-linux.h" -#elif CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN -#include "platform/tizen/CCStdC-tizen.h" #endif #endif /* __PLATFORM_CCSTDC_H__*/ diff --git a/cocos/platform/CMakeLists.txt b/cocos/platform/CMakeLists.txt index 14a43d3f53ec..ed9f2a475b80 100644 --- a/cocos/platform/CMakeLists.txt +++ b/cocos/platform/CMakeLists.txt @@ -95,6 +95,7 @@ elseif(APPLE) platform/ios/CCEAGLView-ios.h platform/ios/CCGLViewImpl-ios.h platform/ios/CCES2Renderer-ios.h + platform/ios/CCInputView-ios.h ) set(COCOS_PLATFORM_SPECIFIC_SRC ${COCOS_PLATFORM_SPECIFIC_SRC} @@ -106,6 +107,7 @@ elseif(APPLE) platform/ios/CCES2Renderer-ios.m platform/ios/CCGLViewImpl-ios.mm platform/ios/CCImage-ios.mm + platform/ios/CCInputView-ios.mm ) endif() @@ -157,6 +159,7 @@ set(COCOS_PLATFORM_HEADER set(COCOS_PLATFORM_SRC ${COCOS_PLATFORM_SPECIFIC_SRC} + platform/CCDataManager.cpp platform/CCSAXParser.cpp platform/CCThread.cpp platform/CCGLView.cpp diff --git a/cocos/platform/android/Android.mk b/cocos/platform/android/Android.mk index 4adfd98351ca..7a307ba53119 100644 --- a/cocos/platform/android/Android.mk +++ b/cocos/platform/android/Android.mk @@ -18,7 +18,6 @@ jni/Java_org_cocos2dx_lib_Cocos2dxAccelerometer.cpp \ jni/Java_org_cocos2dx_lib_Cocos2dxBitmap.cpp \ jni/Java_org_cocos2dx_lib_Cocos2dxHelper.cpp \ jni/Java_org_cocos2dx_lib_Cocos2dxRenderer.cpp \ -jni/Java_org_cocos2dx_lib_Cocos2dxEngineDataManager.cpp \ jni/JniHelper.cpp \ jni/TouchesJni.cpp diff --git a/cocos/platform/android/CCApplication-android.cpp b/cocos/platform/android/CCApplication-android.cpp index cd1e1f1de93e..da71a1ba542f 100644 --- a/cocos/platform/android/CCApplication-android.cpp +++ b/cocos/platform/android/CCApplication-android.cpp @@ -27,7 +27,6 @@ THE SOFTWARE. #include "platform/CCPlatformConfig.h" #if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID -#include "platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxEngineDataManager.h" #include "platform/android/jni/JniHelper.h" #include "platform/CCApplication.h" #include "base/CCDirector.h" @@ -79,12 +78,7 @@ int Application::run() void Application::setAnimationInterval(float interval) { - setAnimationInterval(interval, SetIntervalReason::BY_ENGINE); -} - -void Application::setAnimationInterval(float interval, SetIntervalReason reason) -{ - EngineDataManager::setAnimationInterval(interval, reason); + JniHelper::callStaticVoidMethod("org/cocos2dx/lib/Cocos2dxRenderer", "setAnimationInterval", interval); } ////////////////////////////////////////////////////////////////////////// diff --git a/cocos/platform/android/CCApplication-android.h b/cocos/platform/android/CCApplication-android.h index 3f7ee8b96dd0..c2278ce95825 100644 --- a/cocos/platform/android/CCApplication-android.h +++ b/cocos/platform/android/CCApplication-android.h @@ -53,7 +53,6 @@ class CC_DLL Application : public ApplicationProtocol @param interval The time, expressed in seconds, between current frame and next. */ virtual void setAnimationInterval(float interval) override; - virtual void setAnimationInterval(float interval, SetIntervalReason reason) override; /** @brief Run the message loop. diff --git a/cocos/platform/android/CCCommon-android.cpp b/cocos/platform/android/CCCommon-android.cpp index 8f48d988abfb..0759a7c66094 100644 --- a/cocos/platform/android/CCCommon-android.cpp +++ b/cocos/platform/android/CCCommon-android.cpp @@ -37,7 +37,7 @@ NS_CC_BEGIN #define MAX_LEN (cocos2d::kMaxLogLen + 1) -void MessageBox(const char * pszMsg, const char * pszTitle) +void ccMessageBox(const char * pszMsg, const char * pszTitle) { JniHelper::callStaticVoidMethod("org.cocos2dx.lib.Cocos2dxHelper", "showDialog", pszTitle, pszMsg); } diff --git a/cocos/platform/android/CCDevice-android.cpp b/cocos/platform/android/CCDevice-android.cpp index 002888effdc6..742351d92ad1 100644 --- a/cocos/platform/android/CCDevice-android.cpp +++ b/cocos/platform/android/CCDevice-android.cpp @@ -77,7 +77,7 @@ class BitmapDC { } - ~BitmapDC(void) + ~BitmapDC() { } @@ -89,7 +89,7 @@ class BitmapDC { JniMethodInfo methodInfo; if (! JniHelper::getStaticMethodInfo(methodInfo, "org.cocos2dx.lib.Cocos2dxBitmap", "createTextBitmapShadowStroke", - "([BLjava/lang/String;IIIIIIIIZFFFFZIIIIFZI)Z")) + "([BLjava/lang/String;IIIIIIIIFZFFFFZIIIIFZI)Z")) { CCLOG("%s %d: error to get methodInfo", __FILE__, __LINE__); return false; @@ -122,7 +122,7 @@ class BitmapDC if(!methodInfo.env->CallStaticBooleanMethod(methodInfo.classID, methodInfo.methodID, strArray, jstrFont, textDefinition._fontSize, textDefinition._fontFillColor.r, textDefinition._fontFillColor.g, textDefinition._fontFillColor.b, textDefinition._fontAlpha, - eAlignMask, nWidth, nHeight, + eAlignMask, nWidth, nHeight, textDefinition._lineSpacing, textDefinition._shadow._shadowEnabled, textDefinition._shadow._shadowOffset.width, -textDefinition._shadow._shadowOffset.height, textDefinition._shadow._shadowBlur, textDefinition._shadow._shadowOpacity, textDefinition._stroke._strokeEnabled, textDefinition._stroke._strokeColor.r, textDefinition._stroke._strokeColor.g, diff --git a/cocos/platform/android/CCFileUtils-android.cpp b/cocos/platform/android/CCFileUtils-android.cpp index cf27566406ae..c895288d4400 100644 --- a/cocos/platform/android/CCFileUtils-android.cpp +++ b/cocos/platform/android/CCFileUtils-android.cpp @@ -31,7 +31,6 @@ THE SOFTWARE. #include "platform/CCCommon.h" #include "platform/android/jni/JniHelper.h" #include "platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.h" -#include "platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxEngineDataManager.h" #include "android/asset_manager.h" #include "android/asset_manager_jni.h" #include "base/ZipUtils.h" @@ -213,12 +212,18 @@ bool FileUtilsAndroid::isDirectoryExistInternal(const std::string& dirPath) cons return false; } - const char* s = dirPath.c_str(); + std::string dirPathCopy = dirPath; + if(dirPathCopy[dirPathCopy.length() - 1] == '/') + { + dirPathCopy.erase(dirPathCopy.length() - 1); + } + + const char* s = dirPathCopy.c_str(); // find absolute path in flash memory if (s[0] == '/') { - CCLOG("find in flash memory dirPath(%s)", s); + //CCLOG("find in flash memory dirPath(%s)", s); struct stat st; if (stat(s, &st) == 0) { @@ -227,13 +232,16 @@ bool FileUtilsAndroid::isDirectoryExistInternal(const std::string& dirPath) cons } else { + + // find it in apk's assets dir // Found "assets/" at the beginning of the path and we don't want it - CCLOG("find in apk dirPath(%s)", s); + //CCLOG("find in apk dirPath(%s)", s); if (dirPath.find(ASSETS_FOLDER_NAME) == 0) { s += ASSETS_FOLDER_NAME_LENGTH; } + if (FileUtilsAndroid::assetmanager) { AAssetDir* aa = AAssetManager_openDir(FileUtilsAndroid::assetmanager, s); @@ -292,10 +300,10 @@ long FileUtilsAndroid::getFileSize(const std::string& filepath) const std::vector FileUtilsAndroid::listFiles(const std::string& dirPath) const { - if(isAbsolutePath(dirPath)) return FileUtils::listFiles(dirPath); + if(!dirPath.empty() && dirPath[0] == '/') return FileUtils::listFiles(dirPath); std::vector fileList; - string fullPath = fullPathForFilename(dirPath); + string fullPath = fullPathForDirectory(dirPath); static const std::string apkprefix("assets/"); string relativePath = ""; @@ -314,6 +322,11 @@ std::vector FileUtilsAndroid::listFiles(const std::string& dirPath) return fileList; } + if(relativePath[relativePath.length() - 1] == '/') + { + relativePath.erase(relativePath.length() - 1); + } + auto *dir = AAssetManager_openDir(assetmanager, relativePath.c_str()); if(nullptr == dir) { LOGD("... FileUtilsAndroid::failed to open dir %s", relativePath.c_str()); @@ -331,10 +344,16 @@ std::vector FileUtilsAndroid::listFiles(const std::string& dirPath) return fileList; } -FileUtils::Status FileUtilsAndroid::getContents(const std::string& filename, ResizableBuffer* buffer) const +bool FileUtilsAndroid::removeDirectory(const std::string& path) const { - EngineDataManager::onBeforeReadFile(); + if (path.empty()) + return false; + + return removeDirectoryJNI(path.c_str()); +} +FileUtils::Status FileUtilsAndroid::getContents(const std::string& filename, ResizableBuffer* buffer) const +{ static const std::string apkprefix("assets/"); if (filename.empty()) return FileUtils::Status::NotExists; diff --git a/cocos/platform/android/CCFileUtils-android.h b/cocos/platform/android/CCFileUtils-android.h index a20107548784..601e799b01f4 100644 --- a/cocos/platform/android/CCFileUtils-android.h +++ b/cocos/platform/android/CCFileUtils-android.h @@ -34,6 +34,8 @@ Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. #include "base/ccTypes.h" #include #include +#include +#include #include "jni.h" #include "android/asset_manager.h" @@ -74,6 +76,8 @@ class CC_DLL FileUtilsAndroid : public FileUtils virtual long getFileSize(const std::string& filepath) const override; virtual std::vector listFiles(const std::string& dirPath) const override; + + virtual bool removeDirectory(const std::string& dirPath) const override; private: virtual bool isFileExistInternal(const std::string& strFilePath) const override; virtual bool isDirectoryExistInternal(const std::string& dirPath) const override; diff --git a/cocos/platform/android/CCGLViewImpl-android.cpp b/cocos/platform/android/CCGLViewImpl-android.cpp index c16927973bb2..519584f383fe 100644 --- a/cocos/platform/android/CCGLViewImpl-android.cpp +++ b/cocos/platform/android/CCGLViewImpl-android.cpp @@ -144,6 +144,8 @@ Rect GLViewImpl::getSafeAreaRect() const { bool isScreenRound = JniHelper::callStaticBooleanMethod("org/cocos2dx/lib/Cocos2dxHelper", "isScreenRound"); bool hasSoftKeys = JniHelper::callStaticBooleanMethod("org/cocos2dx/lib/Cocos2dxHelper", "hasSoftKeys"); + bool isCutoutEnabled = JniHelper::callStaticBooleanMethod("org/cocos2dx/lib/Cocos2dxHelper", "isCutoutEnabled"); + if(isScreenRound) { // edge screen (ex. Samsung Galaxy s7, s9, s9+, Note 9, Nokia 8 Sirocco, Sony Xperia XZ3, Oppo Find X...) if(safeAreaRect.size.width < safeAreaRect.size.height) { @@ -184,6 +186,33 @@ Rect GLViewImpl::getSafeAreaRect() const { } } + if (isCutoutEnabled) { + // screen with enabled cutout area (ex. Google Pixel 3 XL, Huawei P20, Asus ZenFone 5, etc) + static int* safeInsets = JniHelper::callStaticIntArrayMethod("org/cocos2dx/lib/Cocos2dxHelper", "getSafeInsets"); + if (safeInsets != nullptr) { + float safeInsetBottom = safeInsets[0] / _scaleY; + float safeInsetLeft = safeInsets[1] / _scaleX; + float safeInsetRight = safeInsets[2] / _scaleX; + float safeInsetTop = safeInsets[3] / _scaleY; + + // fit safe area rect with safe insets + if (safeInsetBottom > 0) { + safeAreaRect.origin.y += safeInsetBottom; + safeAreaRect.size.height -= safeInsetBottom; + } + if (safeInsetLeft > 0) { + safeAreaRect.origin.x += safeInsetLeft; + safeAreaRect.size.width -= safeInsetLeft; + } + if (safeInsetRight > 0) { + safeAreaRect.size.width -= safeInsetRight; + } + if (safeInsetTop > 0) { + safeAreaRect.size.height -= safeInsetTop; + } + } + } + return safeAreaRect; } diff --git a/cocos/platform/android/CMakeLists.txt b/cocos/platform/android/CMakeLists.txt index 17cbd0d94b1d..609317806d08 100644 --- a/cocos/platform/android/CMakeLists.txt +++ b/cocos/platform/android/CMakeLists.txt @@ -14,7 +14,6 @@ set(${target_name}_src jni/Java_org_cocos2dx_lib_Cocos2dxBitmap.cpp jni/Java_org_cocos2dx_lib_Cocos2dxHelper.cpp jni/Java_org_cocos2dx_lib_Cocos2dxRenderer.cpp - jni/Java_org_cocos2dx_lib_Cocos2dxEngineDataManager.cpp ) add_library(${target_name} STATIC diff --git a/cocos/platform/android/java/libs/EngineDataManager.jar b/cocos/platform/android/java/libs/EngineDataManager.jar deleted file mode 100644 index 74f326d937f2..000000000000 Binary files a/cocos/platform/android/java/libs/EngineDataManager.jar and /dev/null differ diff --git a/cocos/platform/android/java/libs/oppoSDK.jar b/cocos/platform/android/java/libs/oppoSDK.jar new file mode 100755 index 000000000000..19350f273191 Binary files /dev/null and b/cocos/platform/android/java/libs/oppoSDK.jar differ diff --git a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxActivity.java b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxActivity.java index 77c29fcceb18..16a46c8ca40a 100644 --- a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxActivity.java +++ b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxActivity.java @@ -166,8 +166,6 @@ protected void onCreate(final Bundle savedInstanceState) { // Audio configuration this.setVolumeControlStream(AudioManager.STREAM_MUSIC); - - Cocos2dxEngineDataManager.init(this, mGLSurfaceView); } //native method,call GLViewImpl::getGLContextAttrs() to get the OpenGL ES context attributions @@ -190,8 +188,6 @@ protected void onResume() { Cocos2dxAudioFocusManager.registerAudioFocusListener(this); this.hideVirtualButton(); resumeIfHasFocus(); - - Cocos2dxEngineDataManager.resume(); } @Override @@ -224,7 +220,6 @@ protected void onPause() { Cocos2dxAudioFocusManager.unregisterAudioFocusListener(this); Cocos2dxHelper.onPause(); mGLSurfaceView.onPause(); - Cocos2dxEngineDataManager.pause(); } @Override @@ -232,8 +227,6 @@ protected void onDestroy() { if(gainAudioFocus) Cocos2dxAudioFocusManager.unregisterAudioFocusListener(this); super.onDestroy(); - - Cocos2dxEngineDataManager.destroy(); } @Override @@ -287,6 +280,7 @@ public void init() { // Cocos2dxGLSurfaceView this.mGLSurfaceView = this.onCreateView(); + this.mGLSurfaceView.setPreserveEGLContextOnPause(true); // ...add to FrameLayout mFrameLayout.addView(this.mGLSurfaceView); @@ -307,7 +301,8 @@ public void init() { public Cocos2dxGLSurfaceView onCreateView() { Cocos2dxGLSurfaceView glSurfaceView = new Cocos2dxGLSurfaceView(this); //this line is need on some device if we specify an alpha bits - if(this.mGLContextAttrs[3] > 0) glSurfaceView.getHolder().setFormat(PixelFormat.TRANSLUCENT); + // FIXME: is it needed? And it will cause afterimage. + // if(this.mGLContextAttrs[3] > 0) glSurfaceView.getHolder().setFormat(PixelFormat.TRANSLUCENT); // use custom EGLConfigureChooser Cocos2dxEGLConfigChooser chooser = new Cocos2dxEGLConfigChooser(this.mGLContextAttrs); diff --git a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxBitmap.java b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxBitmap.java index 6aec602b92d3..07fd695a3fab 100644 --- a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxBitmap.java +++ b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxBitmap.java @@ -151,7 +151,7 @@ public static Typeface calculateShrinkTypeFace(String text, int width, int heigh public static boolean createTextBitmapShadowStroke(byte[] bytes, final String fontName, int fontSize, int fontTintR, int fontTintG, int fontTintB, int fontTintA, - int alignment, int width, int height, + int alignment, int width, int height, float lineSpacing, boolean shadow, float shadowDX, float shadowDY, float shadowBlur, float shadowOpacity, boolean stroke, int strokeR, int strokeG, int strokeB, int strokeA, float strokeSize, boolean enableWrap, int overflow) { String string; @@ -196,12 +196,12 @@ public static boolean createTextBitmapShadowStroke(byte[] bytes, final String f if (overflow == 1 && !enableWrap){ int widthBoundary = (int)Math.ceil( StaticLayout.getDesiredWidth(string, paint)); - layout = new StaticLayout(string, paint, widthBoundary , hAlignment,1.0f,0.0f,false); + layout = new StaticLayout(string, paint, widthBoundary, hAlignment, 1.0f, lineSpacing, false); }else { if (overflow == 2) { calculateShrinkTypeFace(string, width, height, hAlignment, fontSize, paint, enableWrap); } - layout = new StaticLayout(string, paint, maxWidth , hAlignment,1.0f,0.0f,false); + layout = new StaticLayout(string, paint, maxWidth, hAlignment, 1.0f, lineSpacing, false); } layoutWidth = layout.getWidth(); diff --git a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxDataManager.java b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxDataManager.java new file mode 100644 index 000000000000..b5cdf6df1f75 --- /dev/null +++ b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxDataManager.java @@ -0,0 +1,57 @@ +/**************************************************************************** +Copyright (c) 2010-2012 cocos2d-x.org +Copyright (c) 2013-2016 Chukong Technologies Inc. +Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. +Copyright (c) 2019 Xiamen Yaji Software Co., Ltd. + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + ****************************************************************************/ + +package org.cocos2dx.lib; +import android.util.Log; + +import com.oppo.oiface.engine.OifaceGameEngineManager; + +public class Cocos2dxDataManager { + public static void setOptimise(String thing, String value){ + String jsonStr = "{\"" + thing + "\":" + String.valueOf(value) + "}"; + OifaceGameEngineManager.getInstance().updateGameEngineInfo(jsonStr); + } + + public static void setProcessID(int pid){ + setOptimise("render_pid", String.valueOf(pid)); + } + public static void setFrameSize(int width, int height){ + setOptimise("buffer_size", String.valueOf(width * height)); + } + public static void onSceneLoaderBegin(){ + setOptimise("load_scene", String.valueOf(1)); + } + public static void onSceneLoaderEnd(){ + setOptimise("load_scene", String.valueOf(0)); + } + public static void onShaderLoaderBegin(){ + setOptimise("shader_compile", String.valueOf(1)); + } + public static void onShaderLoaderEnd(){ + setOptimise("shader_compile", String.valueOf(0)); + } +} diff --git a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxEngineDataManager.java b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxEngineDataManager.java deleted file mode 100644 index 8d09a7ca9ba0..000000000000 --- a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxEngineDataManager.java +++ /dev/null @@ -1,263 +0,0 @@ -/**************************************************************************** - * Copyright (c) 2016 Chukong Technologies Inc. - *

- * http://www.cocos2d-x.org - *

- * Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - *

- * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - *

- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - ****************************************************************************/ - -package org.cocos2dx.lib; - -import android.content.Context; -import android.opengl.GLSurfaceView; -import android.os.Handler; -import android.util.Log; - -import org.cocos2dx.enginedata.EngineDataManager; -import org.cocos2dx.enginedata.IEngineDataManager; - -public class Cocos2dxEngineDataManager { - private static final String TAG = "CCEngineDataManager"; - private static EngineDataManager sManager = new EngineDataManager(); - private static boolean sIsEnabled = true; - private static boolean sIsInited = false; - - private Cocos2dxEngineDataManager() { - - } - - // Whether to disable Cocos2dxEngineDataManager, invoke it if you don't wanna - // this optimization. You could invoke `Cocos2dxEngineDataManager.disable` before - // `super.onCreate` in game's Activity. The following code snippet demonstrates how to disable it. - /* - public class AppActivity extends Cocos2dxActivity { - @Override - protected void onCreate(Bundle savedInstanceState) { - Cocos2dxEngineDataManager.disable(); // disable before `super.onCreate` - super.onCreate(savedInstanceState); - ... - ... - } - } - */ - // Currently, it only supports HuaWei mobile phones. - public static void disable() { - sIsEnabled = false; - } - - public static boolean isInited() { - return sIsInited; - } - - // Lifecycle functions - public static boolean init(Context context, final GLSurfaceView glSurfaceView) { - if (context == null) { - Log.e(TAG, "Context is null"); - return false; - } - - if (glSurfaceView == null) { - Log.e(TAG, "glSurfaceView is null"); - return false; - } - - final IEngineDataManager.OnSystemCommandListener listener = new IEngineDataManager.OnSystemCommandListener() { - - @Override - public void onQueryFps(final int[] expectedFps, final int[] realFps) { - //@note Query FPS should not post it to GL thread since `expectedFps` and `realFps` - // need to be filled immediately. -// glSurfaceView.queueEvent(new Runnable() { -// @Override -// public void run() { - nativeOnQueryFps(expectedFps, realFps); -// } -// }); - } - - @Override - public void onChangeContinuousFrameLostConfig(final int cycle, final int maxFrameMissed) { - glSurfaceView.queueEvent(new Runnable() { - @Override - public void run() { - nativeOnChangeContinuousFrameLostConfig(cycle, maxFrameMissed); - } - }); - } - - @Override - public void onChangeLowFpsConfig(final int cycle, final float maxFrameDx) { - glSurfaceView.queueEvent(new Runnable() { - @Override - public void run() { - nativeOnChangeLowFpsConfig(cycle, maxFrameDx); - } - }); - } - - @Override - public void onChangeExpectedFps(final int fps) { - glSurfaceView.queueEvent(new Runnable() { - @Override - public void run() { - nativeOnChangeExpectedFps(fps); - } - }); - } - - @Override - public void onChangeSpecialEffectLevel(final int level) { - glSurfaceView.queueEvent(new Runnable() { - @Override - public void run() { - nativeOnChangeSpecialEffectLevel(level); - } - }); - } - - @Override - public void onChangeMuteEnabled(final boolean enabled) { - glSurfaceView.queueEvent(new Runnable() { - @Override - public void run() { - nativeOnChangeMuteEnabled(enabled); - } - }); - } - }; - - if (sIsEnabled) { - sIsInited = sManager.init(listener); - } - - nativeSetSupportOptimization(sIsInited); - - return sIsInited; - } - - public static void destroy() { - if (sIsEnabled) { - sManager.destroy(); - } - } - - public static void pause() { - if (sIsEnabled) { - sManager.pause(); - } - } - - public static void resume() { - if (sIsEnabled) { - sManager.resume(); - } - } - // - - public static String getVendorInfo() { - if (sIsEnabled) { - return sManager.getVendorInfo(); - } - return ""; - } - - private static IEngineDataManager.GameStatus convertIntegerToGameStatus(int gameStatus) { - IEngineDataManager.GameStatus[] values = IEngineDataManager.GameStatus.values(); - for (IEngineDataManager.GameStatus status : values) { - if (gameStatus == status.ordinal()) { - return status; - } - } - - return IEngineDataManager.GameStatus.INVALID; - } - /* - * @brief Notify game overhead changed - * @param gameStatus Which situation current game is in - * @param cpuLevel Current game wastes how much CPU resources, the range is [0,10] - * @param gpuLevel Current game wastes how much GPU resources, the range is [0,10] - */ - public static void notifyGameStatus(int gameStatus, int cpuLevel, int gpuLevel) { - if (!sIsEnabled) { - nativeSetSupportOptimization(false); - return; - } - - IEngineDataManager.GameStatus status = convertIntegerToGameStatus(gameStatus); - if (status == IEngineDataManager.GameStatus.INVALID) { - Log.e(TAG, "Invalid game status: " + gameStatus); - return; - } - sManager.notifyGameStatus(status, cpuLevel, gpuLevel); - } - - /* - * @brief Notify an event that some frames are lost. - * @param cycle The statistic cycle of 'Continuous Frame Lost Event', value is in millisecond, default value is 5000ms - * @param continuousFrameLostThreshold The threshold of 'Continuous Frame Lost', default value is 3, - * if there're 3 times of frame lost in 100ms, then mark a - * 'continuous frame lost', it's set by system. - * @times How many times of `Continuous Frame Lost` event happens in a `cycle' - */ - public static void notifyContinuousFrameLost(int cycle, int continuousFrameLostThreshold, int times) { - if (!sIsEnabled) { - nativeSetSupportOptimization(false); - return; - } - - sManager.notifyContinuousFrameLost(cycle, continuousFrameLostThreshold, times); - } - - /* - * @brief Notify an event that game FPS is too low - * @param cycle The statistic cycle of 'FPS Too Low Event', value is in millisecond, default value is 1000ms - * @param lowFpsThreshold The threshold of fps rate to indicate low fps, 'fps rate' = 'real fps' / 'excepted fps', - * default value is 0.3. if 'fps rate' is larger than 0.3, mark a 'low fps', it's set by system. - * - * @param lostFrameCount How many frames are lost in a 'cycle' - */ - public static void notifyLowFps(int cycle, float lowFpsThreshold, int lostFrameCount) { - if (!sIsEnabled) { - nativeSetSupportOptimization(false); - return; - } - - sManager.notifyLowFps(cycle, lowFpsThreshold, lostFrameCount); - } - - public static void notifyFpsChanged(float oldFps, float newFps) { - if (!sIsEnabled) { - nativeSetSupportOptimization(false); - return; - } - - sManager.notifyFpsChanged(oldFps, newFps); - } - - // Native methods - private native static void nativeSetSupportOptimization(boolean isSupported); - private native static void nativeOnQueryFps(/*out*/ int[] expectedFps, /*out*/ int[] realFps); - private native static void nativeOnChangeContinuousFrameLostConfig(int cycle, int continuousFrameLostThreshold); - private native static void nativeOnChangeLowFpsConfig(int cycle, float lowFpsThreshold); - private native static void nativeOnChangeExpectedFps(int fps); - private native static void nativeOnChangeSpecialEffectLevel(int level); - private native static void nativeOnChangeMuteEnabled(boolean enabled); -} diff --git a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxGLSurfaceView.java b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxGLSurfaceView.java index 83347c306d87..0f4f6f9ed3ae 100644 --- a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxGLSurfaceView.java +++ b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxGLSurfaceView.java @@ -199,7 +199,7 @@ public void run() { } }); this.setRenderMode(RENDERMODE_WHEN_DIRTY); - //super.onPause(); + // super.onPause(); } @Override diff --git a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxHelper.java b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxHelper.java index d8fc5ba68bf3..012733b706c7 100644 --- a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxHelper.java +++ b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxHelper.java @@ -25,7 +25,9 @@ of this software and associated documentation files (the "Software"), to deal ****************************************************************************/ package org.cocos2dx.lib; +import android.annotation.SuppressLint; import android.content.pm.PackageManager; +import android.graphics.Rect; import android.media.AudioManager; import android.app.Activity; import android.content.ComponentName; @@ -47,9 +49,11 @@ of this software and associated documentation files (the "Software"), to deal import android.util.DisplayMetrics; import android.util.Log; import android.view.Display; +import android.view.DisplayCutout; import android.view.KeyCharacterMap; import android.view.KeyEvent; import android.view.ViewConfiguration; +import android.view.Window; import android.view.WindowManager; import com.android.vending.expansion.zipfile.APKExpansionSupport; @@ -64,6 +68,7 @@ of this software and associated documentation files (the "Software"), to deal import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.LinkedHashSet; +import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Set; @@ -202,6 +207,39 @@ public boolean accept(File dir, String name) { return Cocos2dxHelper.sAssetsPath; } + + //remove directory + public static boolean removeDirectory(final String directory) + { + try{ + File file = new File(directory); + recursionDeleteFile(file); + return true; + }catch(Exception ex){ + ex.printStackTrace(); + return false; + } + } + + + private static void recursionDeleteFile(File file) + { + if (file.isFile()) { + file.delete(); + return; + } + if (file.isDirectory()) { + File[] childrenFile = file.listFiles(); + if (childrenFile == null || childrenFile.length == 0) { + file.delete(); + return; + } + for (File f : childrenFile) { + recursionDeleteFile(f); + } + file.delete(); + } + } public static ZipResourceFile getObbFile() { if (null == sOBBFile) { @@ -481,6 +519,10 @@ public static void onEnterForeground() { } public static void terminateProcess() { + // Remove it from recent apps. + if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + sActivity.finishAndRemoveTask(); + } android.os.Process.killProcess(android.os.Process.myPid()); } @@ -504,6 +546,16 @@ public void run() { } } + private static int displayMetricsToDPI(DisplayMetrics metrics) + { + if(metrics.xdpi != metrics.ydpi) { + Log.w(Cocos2dxHelper.TAG, "xdpi != ydpi, use (xdpi + ydpi)/2 instead."); + return (int) ((metrics.xdpi + metrics.ydpi) / 2.0); + } else { + return (int)metrics.xdpi; + } + } + public static int getDPI() { if (sActivity != null) @@ -515,8 +567,15 @@ public static int getDPI() Display d = wm.getDefaultDisplay(); if (d != null) { + try { + Method getRealMetrics = d.getClass().getMethod("getRealMetrics", metrics.getClass()); + getRealMetrics.invoke(d, metrics); + return displayMetricsToDPI(metrics); + } catch (Exception e) { + e.printStackTrace(); + } d.getMetrics(metrics); - return (int)(metrics.density*160.0f); + return displayMetricsToDPI(metrics); } } } @@ -771,6 +830,48 @@ public static boolean isScreenRound() { return false; } + /** + * Returns whether the window is always allowed to extend into the DisplayCutout areas on the short edges of the screen. + * + * @return true if the window in display cutout mode on the short edges of the screen, false otherwise + */ + @SuppressLint("InlinedApi") + public static boolean isCutoutEnabled() { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { + WindowManager.LayoutParams lp = sActivity.getWindow().getAttributes(); + return lp.layoutInDisplayCutoutMode == WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES; + } + + return false; + } + + /** + * Returns safe insets array. + * + * @return array of int with safe insets values + */ + @SuppressLint("NewApi") + public static int[] getSafeInsets() { + final int[] safeInsets = new int[]{0, 0, 0, 0}; + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { + Window cocosWindow = sActivity.getWindow(); + DisplayCutout displayCutout = cocosWindow.getDecorView().getRootWindowInsets().getDisplayCutout(); + // Judge whether it is cutouts (aka notch) screen phone by judge cutout equle to null + if (displayCutout != null) { + List rects = displayCutout.getBoundingRects(); + // Judge whether it is cutouts (aka notch) screen phone by judge cutout rects is null or zero size + if (rects != null && rects.size() != 0) { + safeInsets[0] = displayCutout.getSafeInsetBottom(); + safeInsets[1] = displayCutout.getSafeInsetLeft(); + safeInsets[2] = displayCutout.getSafeInsetRight(); + safeInsets[3] = displayCutout.getSafeInsetTop(); + } + } + } + + return safeInsets; + } + /** * Queries about whether any physical keys exist on the * any keyboard attached to the device and returns true diff --git a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxMusic.java b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxMusic.java index eb5cec5e5d0e..7898fbbc295b 100644 --- a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxMusic.java +++ b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxMusic.java @@ -280,7 +280,7 @@ private MediaPlayer createMediaPlayer(final String path) { mediaPlayer.setDataSource(fis.getFD()); fis.close(); } else { - if (Cocos2dxHelper.getObbFile() != null) { + if (Cocos2dxHelper.getObbFile() != null && Cocos2dxHelper.getObbFile().getAssetFileDescriptor(path) != null) { final AssetFileDescriptor assetFileDescriptor = Cocos2dxHelper.getObbFile().getAssetFileDescriptor(path); mediaPlayer.setDataSource(assetFileDescriptor.getFileDescriptor(), assetFileDescriptor.getStartOffset(), assetFileDescriptor.getLength()); } else { diff --git a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxVideoHelper.java b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxVideoHelper.java index ed7dee96ebf4..beff0786c62c 100644 --- a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxVideoHelper.java +++ b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxVideoHelper.java @@ -66,6 +66,8 @@ public class Cocos2dxVideoHelper { private final static int VideoTaskRestart = 10; private final static int VideoTaskKeepRatio = 11; private final static int VideoTaskFullScreen = 12; + private final static int VideoTaskSetLooping = 13; + private final static int VideoTaskSetUserInputEnabled = 14; final static int KeyEventBack = 1000; static class VideoHandler extends Handler{ @@ -157,11 +159,24 @@ public void handleMessage(Message msg) { } break; } + case VideoTaskSetLooping: { + Cocos2dxVideoHelper helper = mReference.get(); + helper._setLooping(msg.arg1, msg.arg2 != 0); + break; + } + + case VideoTaskSetUserInputEnabled: { + Cocos2dxVideoHelper helper = mReference.get(); + helper._setUserInputEnabled(msg.arg1, msg.arg2 != 0); + break; + } + case KeyEventBack: { Cocos2dxVideoHelper helper = mReference.get(); helper.onBackKeyEvent(); break; - } + } + default: break; } @@ -257,6 +272,36 @@ private void _setVideoURL(int index, int videoSource, String videoUrl) { } } } + + public static void setLooping(int index, boolean looping) { + Message msg = new Message(); + msg.what = VideoTaskSetLooping; + msg.arg1 = index; + msg.arg2 = looping ? 1 : 0; + mVideoHandler.sendMessage(msg); + } + + private void _setLooping(int index, boolean looping) { + Cocos2dxVideoView videoView = sVideoViews.get(index); + if (videoView != null) { + videoView.setLooping(looping); + } + } + + public static void setUserInputEnabled(int index, boolean enableInput) { + Message msg = new Message(); + msg.what = VideoTaskSetUserInputEnabled; + msg.arg1 = index; + msg.arg2 = enableInput ? 1 : 0; + mVideoHandler.sendMessage(msg); + } + + private void _setUserInputEnabled(int index, boolean enableInput) { + Cocos2dxVideoView videoView = sVideoViews.get(index); + if (videoView != null) { + videoView.setUserInputEnabled(enableInput); + } + } public static void setVideoRect(int index, int left, int top, int maxWidth, int maxHeight) { Message msg = new Message(); diff --git a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxVideoView.java b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxVideoView.java index 5626682516f9..93ea3e3b134b 100644 --- a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxVideoView.java +++ b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxVideoView.java @@ -198,7 +198,7 @@ private void initVideoView() { @Override public boolean onTouchEvent(MotionEvent event) { - if((event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_UP) + if( mUserInputEnabled && ((event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_UP)) { if (isPlaying()) { pause(); @@ -211,6 +211,8 @@ public boolean onTouchEvent(MotionEvent event) { } private boolean mIsAssetRouse = false; + private boolean mLooping = false; + private boolean mUserInputEnabled = true; private String mVideoFilePath = null; private static final String AssetResourceRoot = "assets/"; @@ -246,6 +248,14 @@ private void setVideoURI(Uri uri, Map headers) { requestLayout(); invalidate(); } + + public void setLooping(boolean looping) { + mLooping = looping; + } + + public void setUserInputEnabled(boolean enableInput) { + mUserInputEnabled = enableInput; + } public void stopPlayback() { if (mMediaPlayer != null) { @@ -291,12 +301,16 @@ private void openVideo() { mMediaPlayer.setDisplay(mSurfaceHolder); mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); mMediaPlayer.setScreenOnWhilePlaying(true); + mMediaPlayer.setLooping(mLooping); // CROWDSTAR //} mDuration = -1; mCurrentBufferPercentage = 0; if (mIsAssetRouse) { AssetFileDescriptor afd = mCocos2dxActivity.getAssets().openFd(mVideoFilePath); + if (afd == null && Cocos2dxHelper.getObbFile() != null) { + afd = Cocos2dxHelper.getObbFile() .getAssetFileDescriptor(mVideoFilePath); + } mMediaPlayer.setDataSource(afd.getFileDescriptor(),afd.getStartOffset(),afd.getLength()); } else { mMediaPlayer.setDataSource(mCocos2dxActivity, mVideoUri); @@ -425,8 +439,13 @@ public void onPrepared(MediaPlayer mp) { public void onCompletion(MediaPlayer mp) { mCurrentState = STATE_PLAYBACK_COMPLETED; mTargetState = STATE_PLAYBACK_COMPLETED; - - release(true); + + // Do not release the player if we are looping as we still need the + // the player resources to exist + if (!mLooping) { + release(true); + } + if (mOnVideoEventListener != null) { mOnVideoEventListener.onVideoEvent(mViewTag,EVENT_COMPLETED); } @@ -438,7 +457,8 @@ public void onCompletion(MediaPlayer mp) { private static final int EVENT_PAUSED = 1; private static final int EVENT_STOPPED = 2; private static final int EVENT_COMPLETED = 3; - + private static final int EVENT_ERROR = 4; + public interface OnVideoEventListener { void onVideoEvent(int tag,int event); @@ -451,6 +471,10 @@ public boolean onError(MediaPlayer mp, int framework_err, int impl_err) { mCurrentState = STATE_ERROR; mTargetState = STATE_ERROR; + if (mOnVideoEventListener != null) { + mOnVideoEventListener.onVideoEvent(mViewTag, EVENT_ERROR); + } + /* If an error handler has been supplied, use it and finish. */ if (mOnErrorListener != null) { if (mOnErrorListener.onError(mMediaPlayer, framework_err, impl_err)) { diff --git a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxWebViewHelper.java b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxWebViewHelper.java index 0dffbbcfd062..d6ace93469bc 100755 --- a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxWebViewHelper.java +++ b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxWebViewHelper.java @@ -127,23 +127,15 @@ public void run() { } public static void setBackgroundTransparent(final int index) { - if(android.os.Build.VERSION.SDK_INT >10) { - sCocos2dxActivity.runOnUiThread(new Runnable() { - @Override - public void run() { - Cocos2dxWebView webView = webViews.get(index); - if (webView != null) { - webView.setBackgroundColor(Color.TRANSPARENT); - try { - Method method = webView.getClass().getMethod("setLayerType",int.class,Paint.class); - method.invoke(webView,WebView.LAYER_TYPE_SOFTWARE,null); - } catch (Exception e) { - e.printStackTrace(); - } - } + sCocos2dxActivity.runOnUiThread(new Runnable() { + @Override + public void run() { + Cocos2dxWebView webView = webViews.get(index); + if (webView != null) { + webView.setBackgroundColor(Color.TRANSPARENT); } - }); - } + } + }); } public static void setOpacityWebView(final int index, final float opacity) { diff --git a/cocos/platform/android/javaactivity-android.cpp b/cocos/platform/android/javaactivity-android.cpp index a44b951820be..98fe8263880f 100644 --- a/cocos/platform/android/javaactivity-android.cpp +++ b/cocos/platform/android/javaactivity-android.cpp @@ -34,9 +34,12 @@ THE SOFTWARE. #include "base/CCEventDispatcher.h" #include "renderer/CCGLProgramCache.h" #include "renderer/CCTextureCache.h" +#include "renderer/ccGLStateCache.h" #include "2d/CCDrawingPrimitives.h" #include "platform/android/jni/JniHelper.h" +#include "platform/CCDataManager.h" #include "network/CCDownloader-android.h" +#include #include #include #include @@ -85,6 +88,9 @@ JNIEXPORT jint JNI_OnLoad(JavaVM *vm, void *reserved) JNIEXPORT void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thiz, jint w, jint h) { + DataManager::setProcessID(getpid()); + DataManager::setFrameSize(w, h); + auto director = cocos2d::Director::getInstance(); auto glview = director->getOpenGLView(); if (!glview) @@ -97,7 +103,7 @@ JNIEXPORT void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, j } else { - cocos2d::Director::getInstance()->resetMatrixStack(); + cocos2d::GL::invalidateStateCache(); cocos2d::GLProgramCache::getInstance()->reloadDefaultGLPrograms(); cocos2d::DrawPrimitives::init(); cocos2d::VolatileTextureMgr::reloadAllTextures(); diff --git a/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxEngineDataManager.cpp b/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxEngineDataManager.cpp deleted file mode 100644 index 30018c9398ce..000000000000 --- a/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxEngineDataManager.cpp +++ /dev/null @@ -1,1682 +0,0 @@ -/**************************************************************************** -Copyright (c) 2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - -http://www.cocos2d-x.org - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -****************************************************************************/ - -#include "platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxEngineDataManager.h" -#include "platform/android/jni/JniHelper.h" -#include "platform/CCFileUtils.h" -#include "platform/android/CCApplication-android.h" -#include "base/CCDirector.h" -#include "base/CCEventDispatcher.h" -#include "base/CCEventType.h" -#include "renderer/CCRenderer.h" -#include "2d/CCParticleSystem.h" -#include "2d/CCActionManager.h" -#include "audio/include/AudioEngine.h" -#include -#include -#include - -#define LOG_TAG "EngineDataManager.cpp" -#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__) -#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__) - -#define EDM_DEBUG 0 - -#define JNI_FUNC_PREFIX(func) Java_org_cocos2dx_lib_Cocos2dxEngineDataManager_##func - -using namespace cocos2d; - -#if EDM_DEBUG -#include "platform/android/jni/ProcessCpuTracker.h" - -namespace { - -std::string& trim(std::string& s) -{ - if (s.empty()) - return s; - - s.erase(0, s.find_first_not_of(" \t")); - s.erase(s.find_last_not_of(" \t") + 1); - return s; -} - -void split(const std::string& s, const std::string& delim, std::vector* ret) -{ - size_t last = 0; - size_t index = s.find(delim, last); - while (index != std::string::npos) - { - ret->push_back(s.substr(last, index - last)); - last = index + delim.length(); - index = s.find(delim, last); - } - if (index - last > 0) - { - ret->push_back(s.substr(last, index - last)); - } -} - -std::string& deleteChar(std::string& s, const char* toDeleteChar) -{ - if (s.empty()) - return s; - - size_t pos = s.find_first_of(toDeleteChar); - while (pos != std::string::npos) - { - s.erase(pos, 1); - pos = s.find_first_of(toDeleteChar); - } - - return s; -} - -bool getValueFromMap(const std::map& m, const std::string& key, std::string* outValue) -{ - if (m.empty() || outValue == NULL) - return false; - - std::map::const_iterator iter = m.find(key); - if (iter != m.end()) - { - *outValue = iter->second; - return true; - } - outValue->clear(); - return false; -} - -std::string& toLowercase(std::string& s) -{ - std::transform(s.begin(), s.end(), s.begin(), ::tolower); - return s; -} - -} // namespace { - -#endif - -namespace { - -const char* ENGINE_DATA_MANAGER_VERSION = "5"; -const char* CLASS_NAME_ENGINE_DATA_MANAGER = "org.cocos2dx.lib.Cocos2dxEngineDataManager"; -const char* CLASS_NAME_RENDERER = "org.cocos2dx.lib.Cocos2dxRenderer"; - -bool _isInitialized = false; -bool _isSupported = false; -bool _isFirstSetNextScene = true; -bool _isReplaceScene = false; -bool _isReadFile = false; -bool _isInBackground = false; - -uint32_t _drawCountInterval = 0; -const uint32_t _drawCountThreshold = 30; - -#if EDM_DEBUG -uint32_t _printCpuGpuLevelCounter = 0; -uint32_t _printCpuGpuLevelThreshold = UINT_MAX; // Print cpu/gpu level in every 60 frames even if levels aren't changed. - -uint32_t _printCpuUsageCounter = 0; -uint32_t _printCpuUsageThreshold = UINT_MAX; - -ProcessCpuTracker _cpuTracker; -bool _forceEnableOptimization = false; -#endif - -/* last time frame lost cycle was calculated */ -std::chrono::steady_clock::time_point _lastContinuousFrameLostUpdate; -std::chrono::steady_clock::time_point _lastFrameLost100msUpdate; - -/* last time low fps cycle was calculated */ -std::chrono::steady_clock::time_point _lastLowFpsUpdate; - -int _continuousFrameLostCycle = 5000; -int _continuousFrameLostThreshold = 3; -int _continuousFrameLostCount = 0; -int _frameLostCounter = 0; - -int _lowFpsCycle = 1000; -float _lowFpsThreshold = 0.3f; -int _lowFpsCounter = 0; - -int _oldCpuLevel = -1; -int _oldGpuLevel = -1; - -int _oldCpuLevelMulFactor = -1; -int _oldGpuLevelMulFactor = -1; - -float _levelDecreaseThreshold = 0.2f; - -float _cpuFpsFactor = 1.0f; -float _gpuFpsFactor = 1.0f; -bool _isFpsChanged = false; -float _oldRealFps = 60.0f; - -uint32_t _lowFpsCheckMode = 0; // 0: Continuous mode, 1: Average mode -float _lowRealFpsThreshold = 0.5f; // Unit: percentage (0 ~ 1) -std::chrono::steady_clock::time_point _lastTimeNotifyLevelByLowFps; // Only used in continuous mode -float _notifyLevelByLowFpsThreshold = 0.5f; // Unit: seconds, only used in continuous mode -int _minValueOfNotifyCpuLevelByLowFps = 4; -int _minValueOfNotifyGpuLevelByLowFps = 5; -uint32_t _continuousLowRealFpsCount = 0; // Only used in continuous mode -uint32_t _continuousLowRealFpsThreshold = 1; // Only used in continuous mode -uint32_t _calculateAvgFpsCount = 0; // Only used in average mode -float _calculateAvgFpsSum = 0.0f; // Only used in average mode -std::chrono::steady_clock::time_point _lastTimeCalculateAvgFps; // Only used in average mode - -const float DEFAULT_INTERVAL = (1.0f / 60.0f); -// The final animation interval which is used in 'onDrawFrame' -float _animationInterval = DEFAULT_INTERVAL; - -// The animation interval set by engine. -// It could be updated by 'Director::getInstance()->setAnimationInterval(value);' -// or 'Director::getInstance()->resume();', 'Director::getInstance()->startAnimation();'. -float _animationIntervalByEngineOrGame = DEFAULT_INTERVAL; - -// The animation interval set by system. -// System could set this variable through EngineDataManager to override the default FPS set by developer. -// By using this variable, system will be able to control temperature better -// and waste less power while device is in low battery mode, so game could be played longer when battery is nearly dead. -// setAnimationInterval will reset _animationIntervalBySystem to -1 since last change last takes effect. -// Currently, only HuaWei Android devices may use this variable. -float _animationIntervalBySystem = -1.0f; - -// The animation interval when scene is changing. -// _animationIntervalByEngineOrGame & _animationIntervalBySystem will not take effect -// while _animationIntervalBySceneChange is greater than 0, -// but _animationIntervalByEngineOrGame will be effective while -// Its priority is highest while it's valid ( > 0) , and it will be invalid (set to -1) after changing scene finishes. -// Currently, only HuaWei Android devices may use this variable. -float _animationIntervalBySceneChange = -1.0f; - -// The animation interval when director is paused. -// It could be updated by 'Director::getInstance()->pause();' -// Its priority is higher than _animationIntervalBySystem. -float _animationIntervalByDirectorPaused = -1.0f; - -#define CARRAY_SIZE(arr) ((int)(arr.size())) - -enum LevelChangeReason -{ - LEVEL_CHANGE_REASON_NONE = 0, - LEVEL_CHANGE_REASON_CPU = (1 << 0), - LEVEL_CHANGE_REASON_GPU = (1 << 1), - LEVEL_CHANGE_REASON_CPU_AND_GPU = (LEVEL_CHANGE_REASON_CPU | LEVEL_CHANGE_REASON_GPU) -}; - -// CPU Level - -struct CpuLevelInfo -{ - unsigned int nodeCount; - unsigned int particleCount; - unsigned int actionCount; - unsigned int audioCount; -}; - -std::vector _cpuLevelArr = { - {500 , 500, 500, 6}, - {1250, 1500, 2000, 20}, - {1750, 2000, 3000, 32}, - {2750, 2500, 7000, 50} -}; - -// GPU Level - -struct GpuLevelInfo -{ - unsigned int vertexCount; - unsigned int drawCount; -}; - -std::vector _gpuLevelArr = { - {2000, 400}, - {4000, 800}, - {6000, 1000}, - {8000, 1100}, - {10000, 1200}, - {15000, 1300}, - {22000, 1350}, - {30000, 1400}, - {40000, 1450} -}; - -// Particle Level -const std::vector _particleLevelArr = { - 0.0f, - 0.2f, - 0.4f, - 0.6f, - 0.8f, - 1.0f -}; - - -#if EDM_DEBUG -class FpsCollector -{ -public: - FpsCollector(float intervalInSeconds) - : _collectFpsInterval(intervalInSeconds) - {} - - void setCollectFpsInterval(float intervalInSeconds) - { - _collectFpsInterval = intervalInSeconds; - } - - inline float getCollectFpsInterval() const { return _collectFpsInterval; } - - void update(float fps) - { - auto now = std::chrono::steady_clock::now(); - // collect - _fpsContainer.push_back(fps); - - float duration = std::chrono::duration_cast(now - _lastTimeCollectFps).count() / 1000000.0f; - if (duration > _collectFpsInterval) - { - // output info - _lastTimeCollectFps = now; - print(); - } - } - - void reset(const std::chrono::steady_clock::time_point& time) - { - _lastTimeCollectFps = time; - _fpsContainer.clear(); - } - -private: - void print() - { - if (_fpsContainer.empty()) - return; - - std::stringstream ss; - ss.precision(3); - float sum = 0.0f; - float fps = 0.0f; - std::vector::iterator iter = _fpsContainer.begin(); - for (; iter != _fpsContainer.end(); ++iter) - { - fps = *iter; - ss << fps << ", "; - sum += fps; - } - std::string s = ss.str(); - LOGD("Collected FPS: %savg: %.01f, sum:%d", s.c_str(), sum/_fpsContainer.size(), (int)_fpsContainer.size()); - - _fpsContainer.clear(); - } -private: - float _collectFpsInterval; - std::chrono::steady_clock::time_point _lastTimeCollectFps; - std::vector _fpsContainer; -}; - -#endif - -class FpsUpdatedWatcher -{ -public: - FpsUpdatedWatcher(float threshold) - : _threshold(threshold) - , _updateCount(0) - , _isStarted(false) - { - _data.reserve(12); - } - - ~FpsUpdatedWatcher() - {} - - void start() - { - reset(); - _isStarted = true; - } - inline bool isStarted() { return _isStarted; } - - void update(float fps) - { - if (!_isStarted) - return; - - if (_data.size() >= 12) - _data.erase(_data.begin()); - - _data.push_back(fps); - ++_updateCount; - } - - void reset() - { - _data.clear(); - _updateCount = 0; - _isStarted = false; - } - - bool isStable() - { - if (_updateCount > 24) - return true; - - if (_data.size() < 12) - return false; - - float sum = 0.0f; - float average = 0.0f; - uint32_t stableCount = 0; - - std::vector::iterator iter = _data.begin(); - for (; iter != _data.end(); ++iter) - sum += *iter; - - average = sum / _data.size(); - - iter = _data.begin(); - for (; iter != _data.end(); ++iter) - { - if (fabs(*iter - average) < _threshold) - ++stableCount; - } - - return stableCount > 9; - } -private: - std::vector _data; // Collect 12 frames data - float _threshold; - int _updateCount; - bool _isStarted; -}; - -FpsUpdatedWatcher _fpsUpdatedWatcher(2.0f); - -#if EDM_DEBUG -FpsCollector _fpsCollector(0.2f); -bool _isCollectFpsEnabled = false; -#endif - -int cbCpuLevelNode(int i) { return _cpuLevelArr[i].nodeCount; } -int cbCpuLevelParticle(int i) { return _cpuLevelArr[i].particleCount; } -int cbCpuLevelAction(int i) { return _cpuLevelArr[i].actionCount; } -int cbCpuLevelAudio(int i) { return _cpuLevelArr[i].audioCount; } - -float toCpuLevelPerFactor(int value, int (*cb)(int i)) -{ - int len = CARRAY_SIZE(_cpuLevelArr); - int prevStep = 0; - int curStep = 0; - for (int i = 0; i < len; ++i) - { - curStep = cb(i); - if (value < curStep) - { - // The return value should be a float value. - // Do linear interpolation here - return i + (1.0f / (curStep - prevStep) * (value - prevStep)); - } - prevStep = curStep; - } - return len; -} - -int cbGpuLevelVertex(int i) { return _gpuLevelArr[i].vertexCount; } -int cbGpuLevelDraw(int i) { return _gpuLevelArr[i].drawCount; } - -float toGpuLevelPerFactor(int value, int (*cb)(int i)) -{ - int len = CARRAY_SIZE(_gpuLevelArr); - int prevStep = 0; - int curStep = 0; - - for (int i = 0; i < len; ++i) - { - curStep = cb(i); - if (value < curStep) - { - // The return value should be a float value. - // Do linear interpolation here - return i + (1.0f / (curStep - prevStep) * (value - prevStep)); - } - - prevStep = curStep; - - } - return len; -} - -void resetLastTime() -{ - _lastFrameLost100msUpdate = std::chrono::steady_clock::now(); - _lastContinuousFrameLostUpdate = _lastFrameLost100msUpdate; - _lastLowFpsUpdate = _lastFrameLost100msUpdate; - _lastTimeNotifyLevelByLowFps = _lastFrameLost100msUpdate; - _lastTimeCalculateAvgFps = _lastFrameLost100msUpdate; - -#if EDM_DEBUG - _fpsCollector.reset(_lastFrameLost100msUpdate); -#endif -} - -void parseDebugConfig() -{ -#if EDM_DEBUG - auto fileUtils = FileUtils::getInstance(); - - const char* configPath = "/sdcard/cc-res-level.json"; - - if (!fileUtils->isFileExist(configPath)) - { - return; - } - - LOGD("Using debug level config: %s", configPath); - - std::string buffer; - unsigned long size = 0; - unsigned char* resLevelConfig = fileUtils->getFileData(configPath, "rb", &size); - if (resLevelConfig != NULL && size > 0) - { - buffer.insert(0, (const char*)resLevelConfig, (size_t)size); - } - delete[] resLevelConfig; - - // Get std::map from config file - { - size_t pos = buffer.find_first_of('{'); - if (pos != std::string::npos) - { - buffer.replace(pos, 1, ""); - } - pos = buffer.find_last_of('}'); - - if (pos != std::string::npos) - { - buffer.replace(pos, 1, ""); - } - } - - deleteChar(buffer, "\r"); - deleteChar(buffer, "\n"); - deleteChar(buffer, "\t"); - deleteChar(buffer, " "); - - std::string cpuLevelBuffer; - { - const char* cpuLevelStartKey = "\"cpu_level\":["; - const size_t cpuLevelStartKeyLen = strlen(cpuLevelStartKey); - size_t cpuLevelStartPos = buffer.find(cpuLevelStartKey); - if (cpuLevelStartPos != std::string::npos) - { - cpuLevelStartPos += cpuLevelStartKeyLen; - size_t cpuLevelEndPos = buffer.find("]", cpuLevelStartPos); - cpuLevelBuffer = buffer.substr(cpuLevelStartPos, cpuLevelEndPos - cpuLevelStartPos); - buffer.erase(cpuLevelStartPos-cpuLevelStartKeyLen, cpuLevelBuffer.length() + cpuLevelStartKeyLen + 1); - } - } - - if (!cpuLevelBuffer.empty()) - { - LOGD("cpuLevelBuffer: %s", cpuLevelBuffer.c_str()); - } - - std::string gpuLevelBuffer; - { - const char* gpuLevelStartKey = "\"gpu_level\":["; - const size_t gpuLevelStartKeyLen = strlen(gpuLevelStartKey); - size_t gpuLevelStartPos = buffer.find(gpuLevelStartKey); - if (gpuLevelStartPos != std::string::npos) - { - gpuLevelStartPos += gpuLevelStartKeyLen; - size_t gpuLevelEndPos = buffer.find("]", gpuLevelStartPos); - gpuLevelBuffer = buffer.substr(gpuLevelStartPos, gpuLevelEndPos - gpuLevelStartPos); - buffer.erase(gpuLevelStartPos-gpuLevelStartKeyLen, gpuLevelBuffer.length() + gpuLevelStartKeyLen + 1); - } - } - - if (gpuLevelBuffer.empty()) - { - LOGD("gpuLevelBuffer: %s", gpuLevelBuffer.c_str()); - } - - LOGD("remain: %s", buffer.c_str()); - - std::vector keyValueArr; - split(buffer, ",", &keyValueArr); - - if (keyValueArr.empty()) - { - LOGE("Parse cc-res-level.json failed!"); - return; - } - - LOGD("element count: %d", (int)keyValueArr.size()); - - std::map configMap; - for (size_t i = 0, len = keyValueArr.size(); i < len; ++i) - { - std::string e = keyValueArr[i]; - if (e.empty()) - continue; - - std::vector keyValue; - split(e, ":", &keyValue); - if (keyValue.empty() || keyValue.size() != 2) - { - LOGE("Parse (%s) failed, size: %d", e.c_str(), (int)keyValue.size()); - return; - } - - deleteChar(keyValue[0], "\""); - - configMap.insert(std::make_pair(keyValue[0], keyValue[1])); - } - - std::string tmp; - if (getValueFromMap(configMap, "force_enable_optimization", &tmp)) - { - toLowercase(tmp); - if (tmp == "true") - { - _forceEnableOptimization = true; - } - LOGD("[changed] force_enable_optimization: %d", _forceEnableOptimization); - } - else - { - LOGD("[default] force_enable_optimization: %d", _forceEnableOptimization); - } - - - if (getValueFromMap(configMap, "level_log_freq", &tmp)) - { - _printCpuGpuLevelThreshold = (uint32_t)atoi(tmp.c_str()); - LOGD("[changed] level_log_freq: %u", _printCpuGpuLevelThreshold); - } - else - { - LOGD("[default] level_log_freq: %u", _printCpuGpuLevelThreshold); - } - - - if (getValueFromMap(configMap, "cpu_usage_log_freq", &tmp)) - { - _printCpuUsageThreshold = (uint32_t)atoi(tmp.c_str()); - LOGD("[changed] cpu_usage_log_freq: %u", _printCpuUsageThreshold); - } - else - { - LOGD("[default] cpu_usage_log_freq: %u", _printCpuUsageThreshold); - } - - if (getValueFromMap(configMap, "level_decrease_threshold", &tmp)) - { - _levelDecreaseThreshold = atof(tmp.c_str()); - LOGD("[changed] level_decrease_threshold: %f", _levelDecreaseThreshold); - } - else - { - LOGD("[default] level_decrease_threshold: %f", _levelDecreaseThreshold); - } - - if (getValueFromMap(configMap, "low_fps_check_mode", &tmp)) - { - _lowFpsCheckMode = (uint32_t)atoi(tmp.c_str()); - LOGD("[changed] low_fps_check_mode: %u", _lowFpsCheckMode); - } - else - { - LOGD("[default] low_fps_check_mode: %u", _lowFpsCheckMode); - } - - if (getValueFromMap(configMap, "low_realfps_threshold", &tmp)) - { - _lowRealFpsThreshold = atof(tmp.c_str()); - LOGD("[changed] low_realfps_threshold: %f", _lowRealFpsThreshold); - } - else - { - LOGD("[default] low_realfps_threshold: %f", _lowRealFpsThreshold); - } - - if (getValueFromMap(configMap, "notify_level_by_low_fps_threshold", &tmp)) - { - _notifyLevelByLowFpsThreshold = atof(tmp.c_str()); - LOGD("[changed] notify_level_by_low_fps_threshold: %f", _notifyLevelByLowFpsThreshold); - } - else - { - LOGD("[default] notify_level_by_low_fps_threshold: %f", _notifyLevelByLowFpsThreshold); - } - - if (getValueFromMap(configMap, "min_value_of_notify_cpu_level_by_low_fps", &tmp)) - { - _minValueOfNotifyCpuLevelByLowFps = atoi(tmp.c_str()); - if (_minValueOfNotifyCpuLevelByLowFps > CARRAY_SIZE(_cpuLevelArr)) - { - _minValueOfNotifyCpuLevelByLowFps = CARRAY_SIZE(_cpuLevelArr); - } - LOGD("[changed] min_value_of_notify_cpu_level_by_low_fps: %d", _minValueOfNotifyCpuLevelByLowFps); - } - else - { - LOGD("[default] min_value_of_notify_cpu_level_by_low_fps: %d", _minValueOfNotifyCpuLevelByLowFps); - } - - if (getValueFromMap(configMap, "min_value_of_notify_gpu_level_by_low_fps", &tmp)) - { - _minValueOfNotifyGpuLevelByLowFps = atoi(tmp.c_str()); - if (_minValueOfNotifyGpuLevelByLowFps > CARRAY_SIZE(_gpuLevelArr)) - { - _minValueOfNotifyGpuLevelByLowFps = CARRAY_SIZE(_gpuLevelArr); - } - LOGD("[changed] min_value_of_notify_gpu_level_by_low_fps: %d", _minValueOfNotifyGpuLevelByLowFps); - } - else - { - LOGD("[default] min_value_of_notify_gpu_level_by_low_fps: %d", _minValueOfNotifyGpuLevelByLowFps); - } - - if (getValueFromMap(configMap, "continuous_low_realfps_threshold", &tmp)) - { - _continuousLowRealFpsThreshold = (uint32_t)atoi(tmp.c_str()); - LOGD("[changed] continuous_low_realfps_threshold: %u", _continuousLowRealFpsThreshold); - } - else - { - LOGD("[default] continuous_low_realfps_threshold: %u", _continuousLowRealFpsThreshold); - } - - if (getValueFromMap(configMap, "enable_collect_fps", &tmp)) - { - toLowercase(tmp); - if (tmp == "true") - { - _isCollectFpsEnabled = true; - } - LOGD("[changed] enable_collect_fps: %d", (int)_isCollectFpsEnabled); - } - else - { - LOGD("[default] enable_collect_fps: %d", (int)_isCollectFpsEnabled); - } - - if (getValueFromMap(configMap, "collect_fps_interval", &tmp)) - { - _fpsCollector.setCollectFpsInterval(atof(tmp.c_str())); - LOGD("[changed] collect_fps_interval: %f", _fpsCollector.getCollectFpsInterval()); - } - else - { - LOGD("[default] collect_fps_interval: %f", _fpsCollector.getCollectFpsInterval()); - } - - if (!cpuLevelBuffer.empty()) - { - std::vector cpuObjectArray; - split(cpuLevelBuffer, "},", &cpuObjectArray); - if (!cpuObjectArray.empty()) - { - _cpuLevelArr.clear(); - CpuLevelInfo cpuLevelInfo; - - for (size_t i = 0, len = cpuObjectArray.size(); i < len; ++i) - { - std::string& e = cpuObjectArray[i]; - size_t pos = e.find_first_of('{'); - if (pos != std::string::npos) - { - e.replace(pos, 1, ""); - } - pos = e.find_last_of('}'); - - if (pos != std::string::npos) - { - e.replace(pos, 1, ""); - } - - LOGD("cpu level: %s", e.c_str()); - - std::vector cpuLevelElement; - split(e, ",", &cpuLevelElement); - - for (size_t j = 0; j < cpuLevelElement.size(); ++j) - { - std::map kvMap; - std::vector kvArr; - split(cpuLevelElement[j], ":", &kvArr); - if (kvArr.size() != 2) - { - LOGE("cpu level configuration error: %d", (int)kvArr.size()); - return; - } - deleteChar(kvArr[0], "\""); - - kvMap.insert(std::make_pair(kvArr[0], kvArr[1])); - - if (getValueFromMap(kvMap, "node", &tmp)) - { - cpuLevelInfo.nodeCount = (uint32_t)atoi(tmp.c_str()); - } - - if (getValueFromMap(kvMap, "particle", &tmp)) - { - cpuLevelInfo.particleCount = (uint32_t)atoi(tmp.c_str()); - } - if (getValueFromMap(kvMap, "action", &tmp)) - { - cpuLevelInfo.actionCount = (uint32_t)atoi(tmp.c_str()); - } - if (getValueFromMap(kvMap, "audio", &tmp)) - { - cpuLevelInfo.audioCount = (uint32_t)atoi(tmp.c_str()); - } - } - - _cpuLevelArr.push_back(cpuLevelInfo); - } - } - } - - if (!gpuLevelBuffer.empty()) - { - std::vector gpuObjectArray; - split(gpuLevelBuffer, "},", &gpuObjectArray); - if (!gpuObjectArray.empty()) - { - _gpuLevelArr.clear(); - GpuLevelInfo gpuLevelInfo; - - for (size_t i = 0, len = gpuObjectArray.size(); i < len; ++i) - { - std::string& e = gpuObjectArray[i]; - size_t pos = e.find_first_of('{'); - if (pos != std::string::npos) - { - e.replace(pos, 1, ""); - } - pos = e.find_last_of('}'); - - if (pos != std::string::npos) - { - e.replace(pos, 1, ""); - } - - LOGD("gpu level: %s", e.c_str()); - - std::vector gpuLevelElement; - split(e, ",", &gpuLevelElement); - - for (size_t j = 0; j < gpuLevelElement.size(); ++j) - { - std::map kvMap; - std::vector kvArr; - split(gpuLevelElement[j], ":", &kvArr); - if (kvArr.size() != 2) - { - LOGE("gpu level configuration error: %d", (int)kvArr.size()); - return; - } - deleteChar(kvArr[0], "\""); - - kvMap.insert(std::make_pair(kvArr[0], kvArr[1])); - - if (getValueFromMap(kvMap, "vertex", &tmp)) - { - gpuLevelInfo.vertexCount = (uint32_t)atoi(tmp.c_str()); - } - - if (getValueFromMap(kvMap, "draw", &tmp)) - { - gpuLevelInfo.drawCount = (uint32_t)atoi(tmp.c_str()); - } - } - - _gpuLevelArr.push_back(gpuLevelInfo); - } - } - } - - { - LOGD("-----------------------------------------"); - std::vector::iterator iter = _cpuLevelArr.begin(); - for (; iter != _cpuLevelArr.end(); ++iter) - { - CpuLevelInfo level = *iter; - LOGD("cpu level: %u, %u, %u, %u", level.nodeCount, level.particleCount, level.actionCount, level.audioCount); - } - LOGD("-----------------------------------------"); - } - - { - LOGD("========================================="); - std::vector::iterator iter = _gpuLevelArr.begin(); - for (; iter != _gpuLevelArr.end(); ++iter) - { - GpuLevelInfo level = *iter; - LOGD("gpu level: %u, %u", level.vertexCount, level.drawCount); - } - LOGD("========================================="); - } -#endif // EDM_DEBUG -} - -void setAnimationIntervalBySystem(float interval) -{ - if (!_isSupported) - return; - - LOGD("Set FPS %f by system", std::ceil(1.0f / interval)); - EngineDataManager::setAnimationInterval(interval, SetIntervalReason::BY_SYSTEM); -} - -void setAnimationIntervalBySceneChange(float interval) -{ - if (!_isSupported) - return; - - LOGD("Set FPS %f while changing scene", std::ceil(1.0f / interval)); - EngineDataManager::setAnimationInterval(interval, SetIntervalReason::BY_SCENE_CHANGE); -} - -} // namespace { - -namespace cocos2d { - -int EngineDataManager::getTotalParticleCount() -{ - auto& particleSystems = ParticleSystem::getAllParticleSystems(); - if (particleSystems.empty()) - { - return 0; - } - - int count = 0; - for (auto&& system : particleSystems) - { - count += system->getTotalParticles(); - } - - return count; -} - -// calculates frame lost event -// static -void EngineDataManager::calculateFrameLost() -{ - auto director = Director::getInstance(); - - if (_lowFpsThreshold > 0 && _continuousFrameLostThreshold > 0) - { - float frameRate = director->getFrameRate(); - - float expectedFps = 1.0f / _animationInterval; - float frameLostRate = (expectedFps - frameRate) * _animationInterval; - if (frameLostRate > _lowFpsThreshold) - { - ++_frameLostCounter; - ++_lowFpsCounter; -// LOGD("_frameLostCounter: %d, _lowFpsCounter=%d", _frameLostCounter, _lowFpsCounter); - } - - auto now = std::chrono::steady_clock::now(); - float interval = std::chrono::duration_cast(now - _lastFrameLost100msUpdate).count() / 1000000.0f; - if (interval > 0.1f) - { - _lastFrameLost100msUpdate = now; - // check lost frame count - if (_frameLostCounter >= _continuousFrameLostThreshold) - { - ++_continuousFrameLostCount; - } - // Reset frame lost counter after 100ms interval - // even it's smaller than _continuousFrameLostThreshold - _frameLostCounter = 0; - } - - interval = std::chrono::duration_cast(now - _lastContinuousFrameLostUpdate).count() / 1000000.0f; - if (interval > (_continuousFrameLostCycle / 1000.0f)) - { - _lastContinuousFrameLostUpdate = now; - if (_continuousFrameLostCount > 0) - { - // notify continuous frame lost event to system - notifyContinuousFrameLost(_continuousFrameLostCycle, _continuousFrameLostThreshold, _continuousFrameLostCount); - - // LOGD("continuous frame lost: %d", _continuousFrameLostCount); - _continuousFrameLostCount = 0; - } - } - - interval = std::chrono::duration_cast(now - _lastLowFpsUpdate).count() / 1000000.0f; - if (interval > (_lowFpsCycle / 1000.0f)) - { - _lastLowFpsUpdate = now; - if (_lowFpsCounter > 0) - { - // notify low fps event to system - notifyLowFps(_lowFpsCycle, _lowFpsThreshold, _lowFpsCounter); - // LOGD("low fps frame count: %d", _lowFpsCounter); - _lowFpsCounter = 0; - } - } - } -} - -// static -void EngineDataManager::onBeforeSetNextScene(EventCustom* event) -{ - // Reset the old status since we have changed CPU/GPU level manually. - // If the CPU level isn't 5 and GPU level isn't 0 in the next time of checking CPU/GPU level, - // Make sure that the changed CPU/GPU level will be notified. - _oldCpuLevel = -1; - _oldGpuLevel = -1; - _oldCpuLevelMulFactor = -1; - _oldGpuLevelMulFactor = -1; - - if (_isFirstSetNextScene) - { - _isFirstSetNextScene = false; - notifyGameStatus(GameStatus::LAUNCH_END, -1, -1); - } - else if (_isReplaceScene) - { - notifyGameStatus(GameStatus::SCENE_CHANGE_END, -1, -1); - } - - notifyGameStatus(GameStatus::SCENE_CHANGE_BEGIN, 5, 0); - - // SetAnimationIntervalBySceneChange to 1.0f/60.0f while there isn't in replacing scene. - if (!_isReplaceScene) - { - // Modify fps to 60 - setAnimationIntervalBySceneChange(DEFAULT_INTERVAL); - } - - _isReplaceScene = true; -} - -void EngineDataManager::onBeforeReadFile() -{ - _isReadFile = true; -} - -void EngineDataManager::notifyGameStatusIfCpuOrGpuLevelChanged() -{ - // calculate CPU & GPU levels - int cpuLevel = 0; - int gpuLevel = 0; - - int levelChangeReason = LEVEL_CHANGE_REASON_NONE; - - Director* director = Director::getInstance(); - int totalNodeCount = Node::getAttachedNodeCount(); - int totalParticleCount = getTotalParticleCount(); - int totalActionCount = director->getActionManager()->getNumberOfRunningActions(); - int totalPlayingAudioCount = experimental::AudioEngine::getPlayingAudioCount(); - - { - float cpuLevelNode = toCpuLevelPerFactor(totalNodeCount, cbCpuLevelNode); - float cpuLevelParticle = toCpuLevelPerFactor(totalParticleCount, cbCpuLevelParticle); - float cpuLevelAction = toCpuLevelPerFactor(totalActionCount, cbCpuLevelAction); - float cpuLevelAudio = toCpuLevelPerFactor(totalPlayingAudioCount, cbCpuLevelAudio); - float fCpuLevel = cpuLevelNode + cpuLevelParticle + cpuLevelAction + cpuLevelAudio; - float highestCpuLevel = CARRAY_SIZE(_cpuLevelArr) * 1.0f; - fCpuLevel = fCpuLevel > highestCpuLevel ? highestCpuLevel : fCpuLevel; - cpuLevel = std::floor(fCpuLevel); - -#if EDM_DEBUG - if (_printCpuGpuLevelCounter > _printCpuGpuLevelThreshold) - { - LOGD("DEBUG: cpu level: %d, node: (%f, %d), particle: (%f, %d), action: (%f, %d), audio: (%f, %d)", - cpuLevel, cpuLevelNode, totalNodeCount, cpuLevelParticle, totalParticleCount, cpuLevelAction, totalActionCount, cpuLevelAudio, totalPlayingAudioCount); - } -#endif - if (_oldCpuLevel < 0 - || fCpuLevel < (1.0f * _oldCpuLevel - _levelDecreaseThreshold) - || cpuLevel > _oldCpuLevel - ) - { - LOGD("NOTIFY: cpu level: %d, node: (%f, %d), particle: (%f, %d), action: (%f, %d), audio: (%f, %d)", - cpuLevel, cpuLevelNode, totalNodeCount, cpuLevelParticle, totalParticleCount, cpuLevelAction, totalActionCount, cpuLevelAudio, totalPlayingAudioCount); - levelChangeReason |= LEVEL_CHANGE_REASON_CPU; - _oldCpuLevel = cpuLevel; - } - else - { - // Adjust cpu level to old cpu level, it's necessary because we have a level decrease threshold. - // For instance, if threshold is 0.2, fCpuLevel = 1.9, cpuLevel = 1, _oldCpuLevel = 2, - // fCpuLevel is in the decrease threshold region, we need to still notify '2' to vendor. - // Therefore, reset cpuLevel to 2 here. - cpuLevel = _oldCpuLevel; - } - } - - { - auto renderer = director->getRenderer(); - int vertexCount = renderer->getDrawnVertices(); - int drawCount = renderer->getDrawnBatches(); - - float gpuLevelVertex = toGpuLevelPerFactor(vertexCount, cbGpuLevelVertex); - float gpuLevelDraw = toGpuLevelPerFactor(drawCount, cbGpuLevelDraw); - float fGpuLevel = gpuLevelVertex + gpuLevelDraw; - float highestGpuLevel = CARRAY_SIZE(_gpuLevelArr) * 1.0f; - fGpuLevel = fGpuLevel > highestGpuLevel ? highestGpuLevel : fGpuLevel; - gpuLevel = std::floor(fGpuLevel); - -#if EDM_DEBUG - if (_printCpuGpuLevelCounter > _printCpuGpuLevelThreshold) - { - LOGD("DEBUG: gpu level: %d, vertex: (%f, %d), draw: (%f, %d)", gpuLevel, gpuLevelVertex, vertexCount, gpuLevelDraw, drawCount); - } -#endif - if (_oldGpuLevel < 0 - || fGpuLevel < (1.0f * _oldGpuLevel - _levelDecreaseThreshold) - || gpuLevel > _oldGpuLevel - ) - { - LOGD("NOTIFY: gpu level: %d, vertex: (%f, %d), draw: (%f, %d)", gpuLevel, gpuLevelVertex, vertexCount, gpuLevelDraw, drawCount); - levelChangeReason |= LEVEL_CHANGE_REASON_GPU; - _oldGpuLevel = gpuLevel; - } - else - { - // Adjust gpu level to old gpu level, it's necessary because we have a level decrease threshold. - // For instance, if threshold is 0.2, fGpuLevel = 1.9, gpuLevel = 1, _oldGpuLevel = 2, - // fGpuLevel is in the decrease threshold region, we need to still notify '2' to vendor. - // Therefore, reset gpuLevel to 2 here. - gpuLevel = _oldGpuLevel; - } - } - - float expectedFps = 1.0f / _animationInterval; - float realFps = director->getFrameRate(); - bool isLowRealFps = false; - if (_fpsUpdatedWatcher.isStarted()) - { - _fpsUpdatedWatcher.update(realFps); - if (_fpsUpdatedWatcher.isStable()) - { - LOGD("FPS(%.01f) is stable now!", realFps); - _fpsUpdatedWatcher.reset(); - } - } - else - { -#if EDM_DEBUG - if (_isCollectFpsEnabled) - { - _fpsCollector.update(realFps); - } -#endif - if (0 == _lowFpsCheckMode) - { - // Low Real Fps definition: - // CurrentFrameTimeCost > ExpectedFrameTimeCost + ExpectedFrameTimeCost * LowRealFpsThreshold - isLowRealFps = (1.0f / realFps) > (_animationInterval + _animationInterval * _lowRealFpsThreshold); - if (isLowRealFps) - { - auto now = std::chrono::steady_clock::now(); - float lowFpsIntervalInSeconds = std::chrono::duration_cast(now - _lastTimeNotifyLevelByLowFps).count() / 1000000.0f; - - if (_continuousLowRealFpsCount >= _continuousLowRealFpsThreshold - && lowFpsIntervalInSeconds > _notifyLevelByLowFpsThreshold) - { - _continuousLowRealFpsCount = 0; - LOGD("Detected low fps (mode 0): real: %.01f, expected: %.01f, interval: %.03fs", realFps, expectedFps, lowFpsIntervalInSeconds); - _lastTimeNotifyLevelByLowFps = now; - } - else - { - // Reset this varible to false since it's smaller than notification threshold. - // In this way, we could avoid to notify vendor frequently. - isLowRealFps = false; - - ++_continuousLowRealFpsCount; - } - } - else - { - _continuousLowRealFpsCount = 0; - } - } - else - { - ++_calculateAvgFpsCount; - _calculateAvgFpsSum += realFps; - - auto now = std::chrono::steady_clock::now(); - float interval = std::chrono::duration_cast(now - _lastTimeCalculateAvgFps).count() / 1000000.0f; - - if (interval > _notifyLevelByLowFpsThreshold) - { - float avgFps = _calculateAvgFpsSum / _calculateAvgFpsCount; - // Low Real Fps definition: - // CurrentFrameTimeCost > ExpectedFrameTimeCost + ExpectedFrameTimeCost * LowRealFpsThreshold - isLowRealFps = (1.0f / avgFps) > (_animationInterval + _animationInterval * _lowRealFpsThreshold); - - if (isLowRealFps) - { - LOGD("Detected low fps (mode 1): avg: %.01f, expected: %.01f, interval: %.03fs, framecount: %u", avgFps, expectedFps, interval, _calculateAvgFpsCount); - } - - // Reset counter - _calculateAvgFpsCount = 0; - _calculateAvgFpsSum = 0.0f; - - // Reset last time of calculating average fps - _lastTimeCalculateAvgFps = now; - } - } - } - - if (levelChangeReason != LEVEL_CHANGE_REASON_NONE || _isFpsChanged || isLowRealFps) - { - _isFpsChanged = false; - - // LOGD("expectedFps: %f, realFps: %f", expectedFps, realFps); - if (isLowRealFps) - { - _cpuFpsFactor = _gpuFpsFactor = 1.0f; - } - else - { - _cpuFpsFactor = _gpuFpsFactor = expectedFps / 60.0f; - } - - int newCpuLevelMulFactor = std::ceil(cpuLevel * _cpuFpsFactor); - int newGpuLevelMulFactor = std::ceil(gpuLevel * _gpuFpsFactor); - - if (isLowRealFps - || newCpuLevelMulFactor != _oldCpuLevelMulFactor - || newGpuLevelMulFactor != _oldGpuLevelMulFactor) - { - const char* logPrefix = "[level changed]"; - if (isLowRealFps) - { - logPrefix = "[low fps]"; - if (newCpuLevelMulFactor < _minValueOfNotifyCpuLevelByLowFps) - { - newCpuLevelMulFactor = _minValueOfNotifyCpuLevelByLowFps; - } - - if (newGpuLevelMulFactor < _minValueOfNotifyGpuLevelByLowFps) - { - newGpuLevelMulFactor = _minValueOfNotifyGpuLevelByLowFps; - } - } - - int cpuLevelToNotify = newCpuLevelMulFactor; - int gpuLevelToNotify = newGpuLevelMulFactor; - - // Set CPU or GPU level to -2 only when fps isn't changed and isn't in low fps. - if (!_isFpsChanged && !isLowRealFps) - { - if (_oldGpuLevelMulFactor == newGpuLevelMulFactor) - { - gpuLevelToNotify = -2; // Only CPU level has been changed, pass -2 to GPU level. - } - else if (_oldCpuLevelMulFactor == newCpuLevelMulFactor) - { - cpuLevelToNotify = -2; // Only GPU level has been changed, pass -2 to CPU level. - } - } - - LOGD("%s notifyGameStatus: IN_SCENE(%d, %d), cpuLevel: %d->%d(%d), gpuLevel: %d->%d(%d), factor: %f", - logPrefix, - cpuLevel, gpuLevel, - _oldCpuLevelMulFactor, cpuLevelToNotify, newCpuLevelMulFactor, - _oldGpuLevelMulFactor, gpuLevelToNotify, newGpuLevelMulFactor, - _cpuFpsFactor); - - notifyGameStatus(GameStatus::IN_SCENE, cpuLevelToNotify, gpuLevelToNotify); - - _oldCpuLevelMulFactor = newCpuLevelMulFactor; - _oldGpuLevelMulFactor = newGpuLevelMulFactor; - } - } -} - -// static -void EngineDataManager::onAfterDrawScene(EventCustom* event) -{ - calculateFrameLost(); - -#if EDM_DEBUG - ++_printCpuGpuLevelCounter; - ++_printCpuUsageCounter; -#endif - - if (_isReplaceScene) - { - ++_drawCountInterval; - - if (_drawCountInterval > _drawCountThreshold) - { - _drawCountInterval = 0; - _isReplaceScene = false; - - // setAnimationIntervalBySceneChange to -1.0f to - // make developer's or huawei's FPS setting take effect. - setAnimationIntervalBySceneChange(-1.0f); - - _oldCpuLevel = -1; - _oldGpuLevel = -1; - _oldCpuLevelMulFactor = -1; - _oldGpuLevelMulFactor = -1; - notifyGameStatus(GameStatus::SCENE_CHANGE_END, -1, -1); - } - else if (_isReadFile) - { - _drawCountInterval = 0; - } - _isReadFile = false; - } - else - { - notifyGameStatusIfCpuOrGpuLevelChanged(); - } - -#if EDM_DEBUG - if (_printCpuUsageCounter > _printCpuUsageThreshold) - { - _printCpuUsageCounter = 0; - _cpuTracker.update(); - _cpuTracker.printCurrentState(); - } - - if (_printCpuGpuLevelCounter > _printCpuGpuLevelThreshold) - { - _printCpuGpuLevelCounter = 0; - } -#endif -} - -// static -void EngineDataManager::onEnterForeground(EventCustom* event) -{ - _isInBackground = false; - - static bool isFirstTime = true; - LOGD("onEnterForeground, isFirstTime: %d", isFirstTime); - - if (isFirstTime) - { - isFirstTime = false; - } - else - { - resetLastTime(); - // Reset the old status - _oldCpuLevel = -1; - _oldGpuLevel = -1; - _oldCpuLevelMulFactor = -1; - _oldGpuLevelMulFactor = -1; - // Notify CPU/GPU level to system since old levels have been changed. - notifyGameStatusIfCpuOrGpuLevelChanged(); - } -} - -void EngineDataManager::onEnterBackground(EventCustom* event) -{ - LOGD("EngineDataManager::onEnterBackground ..."); - _isInBackground = true; -} - -// static -void EngineDataManager::init() -{ - parseDebugConfig(); - -#if EDM_DEBUG - if (_forceEnableOptimization) - { - LOGD("init, force enable optimization!"); - _isSupported = true; - } -#endif - - if (!_isSupported) - return; - - if (_isInitialized) - return; - - resetLastTime(); - - LOGD("EngineDataManager version: %s", ENGINE_DATA_MANAGER_VERSION); - - auto dispatcher = Director::getInstance()->getEventDispatcher(); - dispatcher->addCustomEventListener(Director::EVENT_AFTER_DRAW, std::bind(onAfterDrawScene, std::placeholders::_1)); - dispatcher->addCustomEventListener(Director::EVENT_BEFORE_SET_NEXT_SCENE, std::bind(onBeforeSetNextScene, std::placeholders::_1)); - dispatcher->addCustomEventListener(EVENT_COME_TO_FOREGROUND, std::bind(onEnterForeground, std::placeholders::_1)); - dispatcher->addCustomEventListener(EVENT_COME_TO_BACKGROUND, std::bind(onEnterBackground, std::placeholders::_1)); - - notifyGameStatus(GameStatus::LAUNCH_BEGIN, 5, -1); - - -#if EDM_DEBUG - _cpuTracker.update(); -#endif - _isInitialized = true; -} - -// static -void EngineDataManager::destroy() -{ - if (!_isSupported) - return; -} - -// static -void EngineDataManager::notifyGameStatus(GameStatus type, int cpuLevel, int gpuLevel) -{ - if (!_isSupported) - return; - - JniMethodInfo methodInfo; - if (JniHelper::getStaticMethodInfo(methodInfo, CLASS_NAME_ENGINE_DATA_MANAGER, "notifyGameStatus", "(III)V")) - { - methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID, (int)type, cpuLevel, gpuLevel); - methodInfo.env->DeleteLocalRef(methodInfo.classID); - } -} - -static void updateFinalAnimationInterval() -{ - if (_animationIntervalBySceneChange > 0.0f) { - _animationInterval = _animationIntervalBySceneChange; - } else if (_animationIntervalByDirectorPaused > 0.0f) { - _animationInterval = _animationIntervalByDirectorPaused; - } else if (_animationIntervalBySystem > 0.0f) { - _animationInterval = _animationIntervalBySystem; - } else { - _animationInterval = _animationIntervalByEngineOrGame; - } -} - -void EngineDataManager::setAnimationInterval(float interval, SetIntervalReason reason) -{ - float oldFps = 0.0f; - float newFps = 0.0f; - - if (reason == SetIntervalReason::BY_GAME) { - LOGD("setAnimationInterval by game: %.04f", interval); - - if (_isSupported) - { - float oldInterval = _animationIntervalBySystem > 0.0f ? _animationIntervalBySystem : _animationIntervalByEngineOrGame; - oldFps = (float)ceil(1.0f/oldInterval); - newFps = (float)ceil(1.0f/interval); - } - - _animationIntervalByDirectorPaused = -1.0f; - // Reset _animationIntervalBySystem to -1 to make developer's FPS configuration take effect. - _animationIntervalBySystem = -1.0f; - _animationIntervalByEngineOrGame = interval; - } else if (reason == SetIntervalReason::BY_ENGINE) { - LOGD("setAnimationInterval by engine: %.04f", interval); - _animationIntervalByDirectorPaused = -1.0f; - _animationIntervalByEngineOrGame = interval; - } else if (reason == SetIntervalReason::BY_SYSTEM) { - LOGD("setAnimationInterval by system: %.04f", interval); - if (interval > 0.0f) { - _animationIntervalBySystem = interval; - } else { - _animationIntervalBySystem = -1.0f; - } - } else if (reason == SetIntervalReason::BY_SCENE_CHANGE) { - LOGD("setAnimationInterval by scene change: %.04f", interval); - if (interval > 0.0f) { - _animationIntervalBySceneChange = interval; - } else { - _animationIntervalBySceneChange = -1.0f; - } - } else if (reason == SetIntervalReason::BY_DIRECTOR_PAUSE) { - LOGD("setAnimationInterval by director paused: %.04f", interval); - _animationIntervalByDirectorPaused = interval; - } else { - LOGD("setAnimationInterval by UNKNOWN reason: %.04f", interval); - } - updateFinalAnimationInterval(); - - LOGD("JNI setAnimationInterval: %f", _animationInterval); - JniHelper::callStaticVoidMethod(CLASS_NAME_RENDERER, "setAnimationInterval", _animationInterval); - - if (_isSupported) - { - // Notify system that FPS configuration has been changed by game. - // notifyFpsChanged has to be invoked at the end. - if (fabs(oldFps - newFps) > 1.0f) - { - _isFpsChanged = true; - notifyFpsChanged(oldFps, newFps); - _fpsUpdatedWatcher.start(); - } - } -} - -// static -void EngineDataManager::notifyContinuousFrameLost(int continueFrameLostCycle, int continueFrameLostThreshold, int times) -{ - if (!_isSupported) - return; - - JniMethodInfo methodInfo; - if (JniHelper::getStaticMethodInfo(methodInfo, CLASS_NAME_ENGINE_DATA_MANAGER, "notifyContinuousFrameLost", "(III)V")) - { - methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID, continueFrameLostCycle, continueFrameLostThreshold, times); - methodInfo.env->DeleteLocalRef(methodInfo.classID); - } -} - -// static -void EngineDataManager::notifyLowFps(int lowFpsCycle, float lowFpsThreshold, int frames) -{ - if (!_isSupported) - return; - - JniMethodInfo methodInfo; - if (JniHelper::getStaticMethodInfo(methodInfo, CLASS_NAME_ENGINE_DATA_MANAGER, "notifyLowFps", "(IFI)V")) - { - methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID, lowFpsCycle, lowFpsThreshold, frames); - methodInfo.env->DeleteLocalRef(methodInfo.classID); - } -} - -// static -void EngineDataManager::notifyFpsChanged(float oldFps, float newFps) -{ - if (!_isSupported) - return; - - LOGD("notifyFpsChanged: %.0f -> %.0f", oldFps, newFps); - JniMethodInfo methodInfo; - if (JniHelper::getStaticMethodInfo(methodInfo, CLASS_NAME_ENGINE_DATA_MANAGER, "notifyFpsChanged", "(FF)V")) - { - methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID, oldFps, newFps); - methodInfo.env->DeleteLocalRef(methodInfo.classID); - } -} - -void EngineDataManager::nativeOnQueryFps(JNIEnv* env, jobject thiz, jintArray arrExpectedFps, jintArray arrRealFps) -{ - if (!_isSupported) - return; - - jsize arrLenExpectedFps = env->GetArrayLength(arrExpectedFps); - jsize arrLenRealFps = env->GetArrayLength(arrRealFps); - - if (arrLenExpectedFps > 0 && arrLenRealFps > 0) - { - Director* director = Director::getInstance(); - jboolean isCopy = JNI_FALSE; - jint* expectedFps = env->GetIntArrayElements(arrExpectedFps, &isCopy); - float animationInterval = director->getAnimationInterval(); - *expectedFps = (int)std::ceil(1.0f / animationInterval); - - jint* realFps = env->GetIntArrayElements(arrRealFps, &isCopy); - *realFps = (int)std::ceil(director->getFrameRate()); - - // Log before expectedFps & realFps is released. - LOGD("nativeOnQueryFps, realFps: %d, expected: %d", *realFps, *expectedFps); - env->ReleaseIntArrayElements(arrExpectedFps, expectedFps, 0); - env->ReleaseIntArrayElements(arrRealFps, realFps, 0); - } - else - { - LOGE("Invalid array size, expectedFps.size=%d, realFps.size=%d", arrLenExpectedFps, arrLenRealFps); - } -} - -void EngineDataManager::nativeOnChangeContinuousFrameLostConfig(JNIEnv* env, jobject thiz, jint continueFrameLostCycle, jint continueFrameLostThreshold) -{ - if (!_isSupported) - return; - - LOGD("nativeOnChangeContinuousFrameLostConfig, continueFrameLostCycle: %d, continueFrameLostThreshold: %d", continueFrameLostCycle, continueFrameLostThreshold); - - _continuousFrameLostCycle = continueFrameLostCycle; - _continuousFrameLostThreshold = continueFrameLostThreshold; -} - -void EngineDataManager::nativeOnChangeLowFpsConfig(JNIEnv* env, jobject thiz, jint lowFpsCycle, jfloat lowFpsThreshold) -{ - if (!_isSupported) - return; - - LOGD("nativeOnChangeLowFpsConfig, lowFpsCycle: %d, lowFpsThreshold: %f", lowFpsCycle, lowFpsThreshold); - _lowFpsCycle = lowFpsCycle; - _lowFpsThreshold = lowFpsThreshold; -} - -void EngineDataManager::nativeOnChangeExpectedFps(JNIEnv* env, jobject thiz, jint fps) -{ - if (!_isSupported) - return; - - if (fps < -1 || fps > 60) - { - LOGE("Setting fps (%d) isn't supported!", fps); - return; - } - - auto director = cocos2d::Director::getInstance(); - float defaultAnimationInterval = director->getAnimationInterval(); - - int defaultFps = static_cast(std::ceil(1.0f/defaultAnimationInterval)); - - if (fps > defaultFps) - { - LOGD("nativeOnChangeExpectedFps, fps (%d) is greater than default fps (%d), reset it to default!", fps, defaultFps); - fps = -1; - } - - LOGD("nativeOnChangeExpectedFps, set fps: %d, default fps: %d", fps, defaultFps); - - if (fps > 0) - { - setAnimationIntervalBySystem(1.0f/fps); - LOGD("nativeOnChangeExpectedFps, fps (%d) was set successfuly!", fps); - } - else if (fps == -1) // -1 means to reset to default FPS - { - setAnimationIntervalBySystem(-1.0f); - LOGD("nativeOnChangeExpectedFps, fps (%d) was reset successfuly!", defaultFps); - } -} - -void EngineDataManager::nativeOnChangeSpecialEffectLevel(JNIEnv* env, jobject thiz, jint level) -{ - if (!_isSupported) - return; - - LOGD("nativeOnChangeSpecialEffectLevel, set level: %d", level); - - if (level < 0 || level >= CARRAY_SIZE(_particleLevelArr)) - { - LOGE("Pass a wrong level value: %d, only 0 ~ %d is supported!", level, CARRAY_SIZE(_particleLevelArr) - 1); - return; - } - - ParticleSystem::setTotalParticleCountFactor(_particleLevelArr[level]); -} - -void EngineDataManager::nativeOnChangeMuteEnabled(JNIEnv* env, jobject thiz, jboolean isMuteEnabled) -{ - if (!_isSupported) - return; - - LOGD("nativeOnChangeMuteEnabled, isMuteEnabled: %d", isMuteEnabled); - cocos2d::experimental::AudioEngine::setEnabled(!isMuteEnabled); -} - -} // namespace cocos2d { - -///////////////////////////// -extern "C" { - -JNIEXPORT void JNICALL JNI_FUNC_PREFIX(nativeSetSupportOptimization)(JNIEnv* env, jobject thiz, jboolean isSupported) -{ - LOGD("nativeSetSupportOptimization: %d", isSupported); - _isSupported = (isSupported == JNI_TRUE); -} - -JNIEXPORT void JNICALL JNI_FUNC_PREFIX(nativeOnQueryFps)(JNIEnv* env, jobject thiz, jintArray arrExpectedFps, jintArray arrRealFps) -{ - EngineDataManager::nativeOnQueryFps(env, thiz, arrExpectedFps, arrRealFps); -} - -JNIEXPORT void JNICALL JNI_FUNC_PREFIX(nativeOnChangeContinuousFrameLostConfig)(JNIEnv* env, jobject thiz, jint continueFrameLostCycle, jint continueFrameLostThreshold) -{ - EngineDataManager::nativeOnChangeContinuousFrameLostConfig(env, thiz, continueFrameLostCycle, continueFrameLostThreshold); -} - -JNIEXPORT void JNICALL JNI_FUNC_PREFIX(nativeOnChangeLowFpsConfig)(JNIEnv* env, jobject thiz, jint lowFpsCycle, jfloat lowFpsThreshold) -{ - EngineDataManager::nativeOnChangeLowFpsConfig(env, thiz, lowFpsCycle, lowFpsThreshold); -} - -JNIEXPORT void JNICALL JNI_FUNC_PREFIX(nativeOnChangeExpectedFps)(JNIEnv* env, jobject thiz, jint fps) -{ - EngineDataManager::nativeOnChangeExpectedFps(env, thiz, fps); -} - -JNIEXPORT void JNICALL JNI_FUNC_PREFIX(nativeOnChangeSpecialEffectLevel)(JNIEnv* env, jobject thiz, jint level) -{ - EngineDataManager::nativeOnChangeSpecialEffectLevel(env, thiz, level); -} - -JNIEXPORT void JNICALL JNI_FUNC_PREFIX(nativeOnChangeMuteEnabled)(JNIEnv* env, jobject thiz, jboolean enabled) -{ - EngineDataManager::nativeOnChangeMuteEnabled(env, thiz, enabled); -} -///////////////////////////// - -} // extern "C" { diff --git a/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxEngineDataManager.h b/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxEngineDataManager.h deleted file mode 100644 index c07db6f60cf8..000000000000 --- a/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxEngineDataManager.h +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** -Copyright (c) 2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - -http://www.cocos2d-x.org - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -****************************************************************************/ - -#pragma once -#include "base/ccTypes.h" - -#include -#include -#include - -#include - -namespace cocos2d { - -class ParticleSystem; -class EventCustom; - -class EngineDataManager -{ -public: - static void init(); - static void destroy(); - - static std::string getVendorInfo(); - - enum class GameStatus - { - LAUNCH_BEGIN = 0, - LAUNCH_END, - SCENE_CHANGE_BEGIN, - SCENE_CHANGE_END, - IN_SCENE - }; - - static void notifyGameStatus(GameStatus type, int cpuLevel, int gpuLevel); - static void setAnimationInterval(float interval, SetIntervalReason reason); - // Used in FileUtilsAndroid::getContents - static void onBeforeReadFile(); - -private: - static void notifyContinuousFrameLost(int frameLostCycle, int continueFrameLostThreshold, int times); - static void notifyLowFps(int lowFpsCycle, float lowFpsThreshold, int frames); - static void notifyFpsChanged(float oldFps, float newFps); - static void notifyGameStatusIfCpuOrGpuLevelChanged(); - - static void calculateFrameLost(); - - static void onBeforeSetNextScene(EventCustom* event); - static void onAfterDrawScene(EventCustom* event); - static void onEnterForeground(EventCustom* event); - static void onEnterBackground(EventCustom* event); - - static int getTotalParticleCount(); - -// For JNI function use, should be public -public: - static void nativeOnQueryFps(JNIEnv* env, jobject thiz, jintArray arrExpectedFps, jintArray arrRealFps); - static void nativeOnChangeContinuousFrameLostConfig(JNIEnv* env, jobject thiz, jint continueFrameLostCycle, jint continueFrameLostThreshold); - static void nativeOnChangeLowFpsConfig(JNIEnv* env, jobject thiz, jint lowFpsCycle, jfloat lowFpsThreshold); - static void nativeOnChangeExpectedFps(JNIEnv* env, jobject thiz, jint fps); - static void nativeOnChangeSpecialEffectLevel(JNIEnv* env, jobject thiz, jint level); - static void nativeOnChangeMuteEnabled(JNIEnv* env, jobject thiz, jboolean enabled); -}; - -} // namespace cocos2d { \ No newline at end of file diff --git a/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.cpp b/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.cpp index c2cc9ed5257f..7de22dc8d0a4 100644 --- a/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.cpp +++ b/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.cpp @@ -154,3 +154,21 @@ void conversionEncodingJNI(const char* src, int byteSize, const char* fromCharse methodInfo.env->DeleteLocalRef(methodInfo.classID); } } + + +bool removeDirectoryJNI(const char* path) +{ + JniMethodInfo methodInfo; + if (JniHelper::getStaticMethodInfo(methodInfo,className.c_str(),"removeDirectory","(Ljava/lang/String;)Z")) + { + jstring stringArgPath = methodInfo.env->NewStringUTF(path); + jboolean suc = methodInfo.env->CallStaticBooleanMethod(methodInfo.classID,methodInfo.methodID,stringArgPath); + + methodInfo.env->DeleteLocalRef(methodInfo.classID); + methodInfo.env->DeleteLocalRef(stringArgPath); + + return suc; + } + + return false; +} \ No newline at end of file diff --git a/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.h b/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.h index ef146c2f6094..18c4f6b2d556 100644 --- a/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.h +++ b/cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.h @@ -34,6 +34,7 @@ extern const char * getApkPath(); extern std::string getPackageNameJNI(); extern int getObbAssetFileDescriptorJNI(const char* path, long* startOffset, long* size); extern void conversionEncodingJNI(const char* src, int byteSize, const char* fromCharset, char* dst, const char* newCharset); +extern bool removeDirectoryJNI(const char* path); extern int getDeviceSampleRate(); extern int getDeviceAudioBufferSizeInFrames(); diff --git a/cocos/platform/android/jni/JniHelper.h b/cocos/platform/android/jni/JniHelper.h index fbf0135851a6..c4943083d6ff 100644 --- a/cocos/platform/android/jni/JniHelper.h +++ b/cocos/platform/android/jni/JniHelper.h @@ -188,6 +188,37 @@ class CC_DLL JniHelper return nullptr; } + /** + @brief Call of Java static int* method + @return address of JniMethodInfo if there are proper JniMethodInfo; otherwise nullptr. + */ + template + static int* callStaticIntArrayMethod(const std::string& className, + const std::string& methodName, + Ts... xs) { + static int ret[32]; + cocos2d::JniMethodInfo t; + std::string signature = "(" + std::string(getJNISignature(xs...)) + ")[I"; + if (cocos2d::JniHelper::getStaticMethodInfo(t, className.c_str(), methodName.c_str(), signature.c_str())) { + LocalRefMapType localRefs; + jintArray array = (jintArray) t.env->CallStaticObjectMethod(t.classID, t.methodID, convert(localRefs, t, xs)...); + jsize len = t.env->GetArrayLength(array); + if (len <= 32) { + jint* elems = t.env->GetIntArrayElements(array, 0); + if (elems) { + memcpy(ret, elems, sizeof(int) * len); + t.env->ReleaseIntArrayElements(array, elems, 0); + }; + } + t.env->DeleteLocalRef(t.classID); + deleteLocalRefs(t.env, localRefs); + return &ret[0]; + } else { + reportError(className, methodName, signature); + } + return nullptr; + } + /** @brief Call of Java static Vec3 method @return JniMethodInfo of Vec3 type if there are proper JniMethodInfo; otherwise Vec3(0, 0, 0). diff --git a/cocos/platform/android/jni/ProcessCpuTracker.cpp b/cocos/platform/android/jni/ProcessCpuTracker.cpp deleted file mode 100644 index 66acd2e2cf58..000000000000 --- a/cocos/platform/android/jni/ProcessCpuTracker.cpp +++ /dev/null @@ -1,355 +0,0 @@ -/**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - ****************************************************************************/ - -#include "platform/android/jni/ProcessCpuTracker.h" - -#ifdef ANDROID -#include -#include -#include -#endif -#include -#include -#include -#include -#include - -#ifdef ANDROID -#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, "ProcessCpuTracker", __VA_ARGS__) -#else -#define LOGD printf -#endif - -typedef struct _CpuInfo -{ - long userTime; // Unit: jiffies - long niceTime; - long systemTime; - long idleTime; - long ioWaitTime; - long irqTime; - long softIrqTime; -}CpuInfo; - -// Return 0 means the end of buffer -static bool readLine(char* p, const char* end, char** next) -{ - if (p == NULL) - { - *next = NULL; - return false; - } - - while (*p != '\n' && p < end) - ++p; - - if (*p == '\n') - {// line break - *p = '\0'; // Set to \0 to make a sub-sequence string - *next = ++p; - return true; - } - else - {// end of buffer - *next = NULL; - return true; - } -} - -static std::vector readProcStat() -{ - std::vector cpuInfos; - cpuInfos.reserve(13); - char buffer[1024] = {0}; - -#ifdef ANDROID - int fd = open("/proc/stat", O_RDONLY); - - if (fd < 0) - { - return cpuInfos; - } - - const int len = read(fd, buffer, sizeof(buffer)-1); - close(fd); - - if (len < 0) { - LOGD("Unable to open process fd=%d", fd); - return cpuInfos; - } - buffer[len] = 0; -#else - FILE* fp = fopen("fonts/stat-huawei.txt", "rb"); - if (fp == NULL) - return cpuInfos; - fread(buffer, sizeof(buffer)-1, 1, fp); - fclose(fp); - size_t len = strlen(buffer); -#endif - - char* p = buffer; - const char* end = p + len; - char* next = NULL; - int cpuIndex; - const int COLUMN = sizeof(CpuInfo) / sizeof(long); - size_t i = 0; - - while (readLine(p, end, &next)) - { - // break if the line with no cpu prefix - if (p[0] != 'c' || p[1] != 'p' || p[2] != 'u') - break; - -// LOGD("%s\n", p); - // Removes 'cpu%d' prefix - p = p + 3; - - if (*p == ' ') - { // The first line means the average cpu usage - cpuIndex = 0; - } - else - { - cpuIndex = strtol(p, &p, 10) + 1; - } - -// LOGD("cpu index: %d\n", cpuIndex); - - cpuInfos.resize(cpuIndex + 1); - - for (i = 0; i < COLUMN; ++i) - { - long value = strtol(p, &p, 10); -// LOGD("%ld ", value); - - CpuInfo& info = cpuInfos[cpuIndex]; - long* e = (long*)&info + i; - *e = value; - } -// LOGD("%s", "\n"); - - p = next; - } - - return cpuInfos; -} - -void ProcessCpuTracker::update() -{ - static const int JIFFYMILLIS = 10; - std::vector cpuInfos = readProcStat(); - if (!cpuInfos.empty()) - { - if (_cpuTimeInfos.size() < cpuInfos.size()) - { - _cpuTimeInfos.resize(cpuInfos.size()); - } - -// LOGD("cpuInfo size: %d", (int)cpuInfos.size()); - - for (size_t i = 0, len = cpuInfos.size(); i < len; ++i) - { - CpuTimeInfo& cpuTimeInfo = _cpuTimeInfos[i]; - const CpuInfo& cpuInfo = cpuInfos[i]; - // Total user time is user + nice time. - const long usertime = (cpuInfo.userTime + cpuInfo.niceTime) * JIFFYMILLIS; - // Total system time is simply system time. - const long systemtime = cpuInfo.systemTime * JIFFYMILLIS; - // Total idle time is simply idle time. - const long idletime = cpuInfo.idleTime * JIFFYMILLIS; - // Total irq time is iowait + irq + softirq time. - const long iowaittime = cpuInfo.ioWaitTime * JIFFYMILLIS; - const long irqtime = cpuInfo.irqTime * JIFFYMILLIS; - const long softirqtime = cpuInfo.softIrqTime * JIFFYMILLIS; - // This code is trying to avoid issues with idle time going backwards, - // but currently it gets into situations where it triggers most of the time. :( - if (false || (usertime >= cpuTimeInfo.mBaseUserTime && systemtime >= cpuTimeInfo.mBaseSystemTime - && iowaittime >= cpuTimeInfo.mBaseIoWaitTime && irqtime >= cpuTimeInfo.mBaseIrqTime - && softirqtime >= cpuTimeInfo.mBaseSoftIrqTime && idletime >= cpuTimeInfo.mBaseIdleTime)) { - cpuTimeInfo.mRelUserTime = usertime - cpuTimeInfo.mBaseUserTime; - cpuTimeInfo.mRelSystemTime = systemtime - cpuTimeInfo.mBaseSystemTime; - cpuTimeInfo.mRelIoWaitTime = iowaittime - cpuTimeInfo.mBaseIoWaitTime; - cpuTimeInfo.mRelIrqTime = irqtime - cpuTimeInfo.mBaseIrqTime; - cpuTimeInfo.mRelSoftIrqTime = softirqtime - cpuTimeInfo.mBaseSoftIrqTime; - cpuTimeInfo.mRelIdleTime = idletime - cpuTimeInfo.mBaseIdleTime; -// if (true) { -// LOGD("CPU%d, Total U: %ld, N:%ld S:%ld I:%ld W:%ld Q:%ld O:%ld\n", -// (int)i, -// cpuInfo.userTime, -// cpuInfo.niceTime, -// cpuInfo.systemTime, -// cpuInfo.idleTime, -// cpuInfo.ioWaitTime, -// cpuInfo.irqTime, -// cpuInfo.softIrqTime -// ); -// LOGD("CPU%d, Rel U:%ld, S:%ld, I:%ld, Q:%ld\n", -// (int)i, -// cpuTimeInfo.mRelUserTime, -// cpuTimeInfo.mRelSystemTime, -// cpuTimeInfo.mRelIdleTime, -// cpuTimeInfo.mRelIrqTime -// ); -// if (cpuTimeInfo.mRelUserTime < 0 -// || cpuTimeInfo.mRelSystemTime < 0 -// || cpuTimeInfo.mRelIdleTime < 0 -// || cpuTimeInfo.mRelIrqTime < 0) -// { -// LOGD("CPU%d,base U:%ld, S:%ld, I:%ld, Q:%ld\n", -// (int)i, -// cpuTimeInfo.mBaseUserTime, -// cpuTimeInfo.mBaseSystemTime, -// cpuTimeInfo.mBaseIdleTime, -// cpuTimeInfo.mBaseIrqTime -// ); -// } -// } - cpuTimeInfo.mBaseUserTime = usertime; - cpuTimeInfo.mBaseSystemTime = systemtime; - cpuTimeInfo.mBaseIoWaitTime = iowaittime; - cpuTimeInfo.mBaseIrqTime = irqtime; - cpuTimeInfo.mBaseSoftIrqTime = softirqtime; - cpuTimeInfo.mBaseIdleTime = idletime; - } else { - -// if (usertime < cpuTimeInfo.mBaseUserTime) -// { -// LOGD("ERROR: usertime: %ld, base: %ld", usertime, cpuTimeInfo.mBaseUserTime); -// } -// -// if (systemtime < cpuTimeInfo.mBaseSystemTime) -// { -// LOGD("ERROR: systemtime: %ld, base: %ld", systemtime, cpuTimeInfo.mBaseSystemTime); -// } -// -// if (iowaittime < cpuTimeInfo.mBaseIoWaitTime) -// { -// LOGD("ERROR: iowaittime: %ld, base: %ld", iowaittime, cpuTimeInfo.mBaseIoWaitTime); -// } -// -// if (irqtime < cpuTimeInfo.mBaseIrqTime) -// { -// LOGD("ERROR: irqtime: %ld, base: %ld", irqtime, cpuTimeInfo.mBaseIrqTime); -// } -// -// if (softirqtime < cpuTimeInfo.mBaseSoftIrqTime) -// { -// LOGD("ERROR: softirqtime: %ld, base: %ld", softirqtime, cpuTimeInfo.mBaseSoftIrqTime); -// } -// -// if (idletime < cpuTimeInfo.mBaseIdleTime) -// { -// LOGD("ERROR: idletime: %ld, base: %ld", idletime, cpuTimeInfo.mBaseIdleTime); -// } - - if (usertime > 0 || idletime > 0) - { - cpuTimeInfo.mBaseUserTime = usertime; - cpuTimeInfo.mBaseSystemTime = systemtime; - cpuTimeInfo.mBaseIoWaitTime = iowaittime; - cpuTimeInfo.mBaseIrqTime = irqtime; - cpuTimeInfo.mBaseSoftIrqTime = softirqtime; - cpuTimeInfo.mBaseIdleTime = idletime; - } - - cpuTimeInfo.mRelUserTime = 0; - cpuTimeInfo.mRelSystemTime = 0; - cpuTimeInfo.mRelIoWaitTime = 0; - cpuTimeInfo.mRelIrqTime = 0; - cpuTimeInfo.mRelSoftIrqTime = 0; - cpuTimeInfo.mRelIdleTime = 0; - LOGD("CPU: %d, /proc/stats has gone backwards; skipping CPU update\n", (int)i); - } - } - } -} - -static long printRatio(std::stringstream& ss, long numerator, long denominator) { - long hundreds = 0; - if (denominator > 0) - { - long thousands = (numerator*1000)/denominator; - hundreds = thousands/10; - ss << hundreds; - if (hundreds < 10) { - long remainder = thousands - (hundreds*10); - - if (remainder != 0) { - ss << '.'; - ss << remainder; - } - } - } - else - { - ss << '0'; - } - ss << " "; - - return hundreds; -} - -static long printProcessCPU(std::stringstream& ss, long totalTime, long user) -{ - return printRatio(ss, user, totalTime); -} - -void ProcessCpuTracker::printCurrentState() -{ - std::stringstream ss; - long totalCpuUsage = 0; - for (size_t i = 0, len = _cpuTimeInfos.size(); i < len; ++i) - { - CpuTimeInfo& cpuTimeInfo = _cpuTimeInfos[i]; - const long totalTime = cpuTimeInfo.mRelUserTime + cpuTimeInfo.mRelSystemTime + cpuTimeInfo.mRelIoWaitTime - + cpuTimeInfo.mRelIrqTime + cpuTimeInfo.mRelSoftIrqTime + cpuTimeInfo.mRelIdleTime; - -// if (totalTime <= 0) -// { -// LOGD("cjh totalTime, i=%d: %ld mRelUserTime: %ld, mRelSystemTime: %ld, mRelIoWaitTime: %ld, mRelIrqTime: %ld, mRelSoftIrqTime: %ld, mRelIdleTime: %ld", -// (int)i, -// totalTime, -// cpuTimeInfo.mRelUserTime, -// cpuTimeInfo.mRelSystemTime, -// cpuTimeInfo.mRelIoWaitTime, -// cpuTimeInfo.mRelIrqTime, -// cpuTimeInfo.mRelSoftIrqTime, -// cpuTimeInfo.mRelIdleTime -// ); -// } - - const long preCoreUsage = printProcessCPU(ss, totalTime, cpuTimeInfo.mRelUserTime); - if (i > 0) - { - totalCpuUsage += preCoreUsage; - } - } - - ss << "T:"; - ss << totalCpuUsage; - std::string str = ss.str(); - LOGD("CPU: %s", str.c_str()); -} - - diff --git a/cocos/platform/android/jni/ProcessCpuTracker.h b/cocos/platform/android/jni/ProcessCpuTracker.h deleted file mode 100644 index eae84ab8474e..000000000000 --- a/cocos/platform/android/jni/ProcessCpuTracker.h +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - ****************************************************************************/ - -#pragma once - -#include - -class ProcessCpuTracker -{ -public: - void update(); - void printCurrentState(); - -private: - struct CpuTimeInfo - { - CpuTimeInfo() - : mBaseUserTime(0) - , mBaseSystemTime(0) - , mBaseIoWaitTime(0) - , mBaseIrqTime(0) - , mBaseSoftIrqTime(0) - , mBaseIdleTime(0) - , mRelUserTime(0) - , mRelSystemTime(0) - , mRelIoWaitTime(0) - , mRelIrqTime(0) - , mRelSoftIrqTime(0) - , mRelIdleTime(0) - { - } - // All times are in milliseconds. They are converted from jiffies to milliseconds - // when extracted from the kernel. - long mBaseUserTime; - long mBaseSystemTime; - long mBaseIoWaitTime; - long mBaseIrqTime; - long mBaseSoftIrqTime; - long mBaseIdleTime; - - long mRelUserTime; - long mRelSystemTime; - long mRelIoWaitTime; - long mRelIrqTime; - long mRelSoftIrqTime; - long mRelIdleTime; - }; - - std::vector _cpuTimeInfos; -}; - - diff --git a/cocos/platform/android/libcocos2dx-with-controller/AndroidManifest.xml b/cocos/platform/android/libcocos2dx-with-controller/AndroidManifest.xml index cc170d62a604..8daa0c3ea636 100644 --- a/cocos/platform/android/libcocos2dx-with-controller/AndroidManifest.xml +++ b/cocos/platform/android/libcocos2dx-with-controller/AndroidManifest.xml @@ -2,8 +2,4 @@ - - - - diff --git a/cocos/platform/android/libcocos2dx/AndroidManifest.xml b/cocos/platform/android/libcocos2dx/AndroidManifest.xml index cc170d62a604..8daa0c3ea636 100644 --- a/cocos/platform/android/libcocos2dx/AndroidManifest.xml +++ b/cocos/platform/android/libcocos2dx/AndroidManifest.xml @@ -2,8 +2,4 @@ - - - - diff --git a/cocos/platform/android/libcocos2dx/proguard-rules.pro b/cocos/platform/android/libcocos2dx/proguard-rules.pro index 3e3132a1fcca..deb8b2d1f2fa 100644 --- a/cocos/platform/android/libcocos2dx/proguard-rules.pro +++ b/cocos/platform/android/libcocos2dx/proguard-rules.pro @@ -20,3 +20,5 @@ -keep public class org.cocos2dx.lib.** -keepclassmembers public class org.cocos2dx.lib.** { *; } +-keep public class com.oppo.oiface.engine.** { *; } +-dontwarn com.oppo.oiface.engine.** \ No newline at end of file diff --git a/cocos/platform/apple/CCFileUtils-apple.h b/cocos/platform/apple/CCFileUtils-apple.h index 5e700d6cdb14..726e44fcebd6 100644 --- a/cocos/platform/apple/CCFileUtils-apple.h +++ b/cocos/platform/apple/CCFileUtils-apple.h @@ -50,7 +50,7 @@ class CC_DLL FileUtilsApple : public FileUtils virtual ~FileUtilsApple(); /* override functions */ virtual std::string getWritablePath() const override; - virtual std::string getFullPathForDirectoryAndFilename(const std::string& directory, const std::string& filename) const override; + virtual std::string getFullPathForFilenameWithinDirectory(const std::string& directory, const std::string& filename) const override; virtual ValueMap getValueMapFromFile(const std::string& filename) const override; virtual ValueMap getValueMapFromData(const char* filedata, int filesize) const override; @@ -62,6 +62,8 @@ class CC_DLL FileUtilsApple : public FileUtils #endif virtual bool createDirectory(const std::string& path) const override; + virtual std::string getPathForDirectory(const std::string &dir, const std::string &resolutionDiretory, const std::string &searchPath) const override; + private: virtual bool isFileExistInternal(const std::string& filePath) const override; virtual bool removeDirectory(const std::string& dirPath) const override; diff --git a/cocos/platform/apple/CCFileUtils-apple.mm b/cocos/platform/apple/CCFileUtils-apple.mm index 92bbfb45a8b0..1548f6483c8e 100644 --- a/cocos/platform/apple/CCFileUtils-apple.mm +++ b/cocos/platform/apple/CCFileUtils-apple.mm @@ -315,7 +315,35 @@ static int unlink_cb(const char *fpath, const struct stat *sb, int typeflag, str return true; } -std::string FileUtilsApple::getFullPathForDirectoryAndFilename(const std::string& directory, const std::string& filename) const +std::string FileUtilsApple::getPathForDirectory(const std::string &dir, const std::string &resolutionDiretory, const std::string &searchPath) const +{ + auto path = searchPath + resolutionDiretory + dir; + + if(!path.empty() && path[path.length() -1] == '/') { + path.erase(path.end() - 1); + } + + if(path[0] == '/') + { + BOOL isDir = false; + if([s_fileManager fileExistsAtPath:[NSString stringWithUTF8String:dir.c_str()] + isDirectory:&isDir]) { + return isDir ? path : ""; + } + } + else + { + NSString *fullpath = [pimpl_->getBundle() pathForResource:[NSString stringWithUTF8String:path.c_str()] + ofType:nil]; + if(fullpath != nil) { + return [fullpath UTF8String]; + } + } + return ""; +} + + +std::string FileUtilsApple::getFullPathForFilenameWithinDirectory(const std::string& directory, const std::string& filename) const { if (directory[0] != '/') { diff --git a/cocos/platform/apple/CCLock-apple.cpp b/cocos/platform/apple/CCLock-apple.cpp index 6393ff65da05..76d67ca8f131 100644 --- a/cocos/platform/apple/CCLock-apple.cpp +++ b/cocos/platform/apple/CCLock-apple.cpp @@ -28,21 +28,21 @@ THE SOFTWARE. NS_CC_BEGIN -Lock::Lock(void) +Lock::Lock() { } -Lock::~Lock(void) +Lock::~Lock() { } -void Lock::lock(void) +void Lock::lock() { } -void Lock::unlock(void) +void Lock::unlock() { } diff --git a/cocos/platform/apple/CCLock-apple.h b/cocos/platform/apple/CCLock-apple.h index f3f07d11fdbe..6ad5c571c29e 100644 --- a/cocos/platform/apple/CCLock-apple.h +++ b/cocos/platform/apple/CCLock-apple.h @@ -37,15 +37,15 @@ class Lock /** * @js ctor */ - Lock(void); + Lock(); /** * @js NA * @lua NA */ - ~Lock(void); + ~Lock(); - void lock(void); - void unlock(void); + void lock(); + void unlock(); }; NS_CC_END diff --git a/cocos/platform/desktop/CCGLViewImpl-desktop.cpp b/cocos/platform/desktop/CCGLViewImpl-desktop.cpp index b16cf473746b..f3df4366e049 100644 --- a/cocos/platform/desktop/CCGLViewImpl-desktop.cpp +++ b/cocos/platform/desktop/CCGLViewImpl-desktop.cpp @@ -39,9 +39,7 @@ THE SOFTWARE. #include "base/ccUtils.h" #include "base/ccUTF8.h" #include "2d/CCCamera.h" -#if CC_ICON_SET_SUPPORT #include "platform/CCImage.h" -#endif /* CC_ICON_SET_SUPPORT */ NS_CC_BEGIN @@ -207,6 +205,7 @@ GLViewImpl::GLViewImpl(bool initglfw) , _monitor(nullptr) , _mouseX(0.0f) , _mouseY(0.0f) +, _cursor(nullptr) { _viewName = "cocos2dx"; g_keyCodeMap.clear(); @@ -309,7 +308,7 @@ bool GLViewImpl::initWithRect(const std::string& viewName, Rect rect, float fram message.append(_glfwError); } - MessageBox(message.c_str(), "Error launch application"); + ccMessageBox(message.c_str(), "Error launch application"); return false; } @@ -358,7 +357,7 @@ bool GLViewImpl::initWithRect(const std::string& viewName, Rect rect, float fram sprintf(strComplain, "OpenGL 1.5 or higher is required (your version is %s). Please upgrade the driver of your video card.", glVersion); - MessageBox(strComplain, "OpenGL version too old"); + ccMessageBox(strComplain, "OpenGL version too old"); return false; } @@ -492,7 +491,7 @@ void GLViewImpl::setIcon(const std::vector& filelist) const { GLFWwindow* window = this->getWindow(); glfwSetWindowIcon(window, iconsCount, images); - CC_SAFE_DELETE(images); + CC_SAFE_DELETE_ARRAY(images); for (auto& icon: icons) { CC_SAFE_DELETE(icon); } @@ -504,6 +503,37 @@ void GLViewImpl::setDefaultIcon() const { } #endif /* CC_ICON_SET_SUPPORT */ +void GLViewImpl::setCursor(const std::string& filename, Vec2 hotspot) { + + if (_cursor) { + glfwDestroyCursor(_cursor); + _cursor = nullptr; + } + + Image* ccImage = new (std::nothrow) Image(); + if (ccImage && ccImage->initWithImageFile(filename)) { + GLFWimage image; + image.width = ccImage->getWidth(); + image.height = ccImage->getHeight(); + image.pixels = ccImage->getData(); + _cursor = glfwCreateCursor(&image, (int)(hotspot.x * image.width), (int)((1.0f - hotspot.y) * image.height)); + if (_cursor) { + glfwSetCursor(_mainWindow, _cursor); + } + } + CC_SAFE_DELETE(ccImage); +} + +void GLViewImpl::setDefaultCursor() { + + if (_cursor) { + glfwDestroyCursor(_cursor); + _cursor = nullptr; + } + + glfwSetCursor(_mainWindow, NULL); +} + void GLViewImpl::setCursorVisible( bool isVisible ) { if( _mainWindow == NULL ) @@ -996,7 +1026,7 @@ bool GLViewImpl::initGlew() GLenum GlewInitResult = glewInit(); if (GLEW_OK != GlewInitResult) { - MessageBox((char *)glewGetErrorString(GlewInitResult), "OpenGL error"); + ccMessageBox((char *)glewGetErrorString(GlewInitResult), "OpenGL error"); return false; } @@ -1021,7 +1051,7 @@ bool GLViewImpl::initGlew() #if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) if(glew_dynamic_binding() == false) { - MessageBox("No OpenGL framebuffer support. Please upgrade the driver of your video card.", "OpenGL error"); + ccMessageBox("No OpenGL framebuffer support. Please upgrade the driver of your video card.", "OpenGL error"); return false; } #endif diff --git a/cocos/platform/desktop/CCGLViewImpl-desktop.h b/cocos/platform/desktop/CCGLViewImpl-desktop.h index 6b493ff8dc57..1eda42c325d4 100644 --- a/cocos/platform/desktop/CCGLViewImpl-desktop.h +++ b/cocos/platform/desktop/CCGLViewImpl-desktop.h @@ -102,14 +102,26 @@ class CC_DLL GLViewImpl : public GLView virtual void setDefaultIcon() const override; #endif /* CC_ICON_SET_SUPPORT */ - /* - * Set zoom factor for frame. This method is for debugging big resolution (e.g.new ipad) app on desktop. + /** + * Sets the cursor for the window with custom image. */ - void setFrameZoomFactor(float zoomFactor) override; + virtual void setCursor(const std::string& filename, Vec2 hotspot = Vec2::ANCHOR_TOP_LEFT) override; + + /** + * Sets the cursor for the window back to default. + */ + virtual void setDefaultCursor() override; + /** * Hide or Show the mouse cursor if there is one. */ virtual void setCursorVisible(bool isVisible) override; + + /* + * Set zoom factor for frame. This method is for debugging big resolution (e.g.new ipad) app on desktop. + */ + void setFrameZoomFactor(float zoomFactor) override; + /** Retina support is disabled by default * @note This method is only available on Mac. */ @@ -126,6 +138,7 @@ class CC_DLL GLViewImpl : public GLView #if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) id getCocoaWindow() override { return glfwGetCocoaWindow(_mainWindow); } + id getNSGLContext() override { return glfwGetNSGLContext(_mainWindow); } // stevetranby: added #endif // #if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) protected: @@ -169,6 +182,8 @@ class CC_DLL GLViewImpl : public GLView float _mouseX; float _mouseY; + GLFWcursor* _cursor; + friend class GLFWEventHandler; public: diff --git a/cocos/platform/ios/CCApplication-ios.h b/cocos/platform/ios/CCApplication-ios.h index 7120f4ab1b37..c2c51a829870 100644 --- a/cocos/platform/ios/CCApplication-ios.h +++ b/cocos/platform/ios/CCApplication-ios.h @@ -69,7 +69,6 @@ class CC_DLL Application : public ApplicationProtocol @param interval The time, expressed in seconds, between current frame and next. */ virtual void setAnimationInterval(float interval) override; - virtual void setAnimationInterval(float interval, SetIntervalReason reason) override; /** @brief Get current language config diff --git a/cocos/platform/ios/CCApplication-ios.mm b/cocos/platform/ios/CCApplication-ios.mm index f9e666883d71..80adacee5cac 100644 --- a/cocos/platform/ios/CCApplication-ios.mm +++ b/cocos/platform/ios/CCApplication-ios.mm @@ -64,11 +64,6 @@ of this software and associated documentation files (the "Software"), to deal [[CCDirectorCaller sharedDirectorCaller] setAnimationInterval: interval ]; } -void Application::setAnimationInterval(float interval, SetIntervalReason reason) -{ - setAnimationInterval(interval); -} - ///////////////////////////////////////////////////////////////////////////////////////////////// // static member function ////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/cocos/platform/ios/CCCommon-ios.mm b/cocos/platform/ios/CCCommon-ios.mm index d5da2c09449b..ca1115c40723 100644 --- a/cocos/platform/ios/CCCommon-ios.mm +++ b/cocos/platform/ios/CCCommon-ios.mm @@ -39,7 +39,7 @@ of this software and associated documentation files (the "Software"), to deal NS_CC_BEGIN // ios no MessageBox, use log instead -void MessageBox(const char * msg, const char * title) +void ccMessageBox(const char * msg, const char * title) { // only enable it on iOS. // FIXME: Implement it for tvOS diff --git a/cocos/platform/ios/CCDevice-ios.mm b/cocos/platform/ios/CCDevice-ios.mm index 682dbd98eb23..52cabde822dd 100644 --- a/cocos/platform/ios/CCDevice-ios.mm +++ b/cocos/platform/ios/CCDevice-ios.mm @@ -145,7 +145,7 @@ static CGSize _calculateShrinkedSizeForString(NSAttributedString **str, *str = __attributedStringWithFontSize(mutableString, fontSize); CGSize fitSize = [*str boundingRectWithSize:CGSizeMake(constrainSize.width, MAX_MEASURE_HEIGHT) - options:(NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading) + options:(NSStringDrawingUsesLineFragmentOrigin) context:nil].size; if (fitSize.width == 0 || fitSize.height == 0) { @@ -339,6 +339,7 @@ - (void)accelerometer:(CMAccelerometerData *)accelerometerData float tintColorG; float tintColorB; float tintColorA; + float lineSpacing; unsigned char* data; @@ -363,7 +364,7 @@ static CGSize _calculateStringSize(NSAttributedString *str, id font, CGSize *con CGSize dim; dim = [str boundingRectWithSize:CGSizeMake(textRect.width, textRect.height) - options:(NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading) + options:(NSStringDrawingUsesLineFragmentOrigin) context:nil].size; dim.width = ceilf(dim.width); @@ -414,6 +415,7 @@ static bool _initWithString(const char * text, cocos2d::Device::TextAlign align, NSTextAlignment nsAlign = FontUtils::_calculateTextAlignment(align); NSMutableParagraphStyle* paragraphStyle = FontUtils::_calculateParagraphStyle(enableWrap, overflow); paragraphStyle.alignment = nsAlign; + paragraphStyle.lineSpacing = info->lineSpacing; // measure text size with specified font and determine the rectangle to draw text in @@ -579,6 +581,7 @@ static bool _initWithString(const char * text, cocos2d::Device::TextAlign align, info.tintColorG = textDefinition._fontFillColor.g / 255.0f; info.tintColorB = textDefinition._fontFillColor.b / 255.0f; info.tintColorA = textDefinition._fontAlpha / 255.0f; + info.lineSpacing = textDefinition._lineSpacing; if (! _initWithString(text, align, textDefinition._fontName.c_str(), textDefinition._fontSize, &info, textDefinition._enableWrap, textDefinition._overflow)) { diff --git a/cocos/platform/ios/CCDirectorCaller-ios.mm b/cocos/platform/ios/CCDirectorCaller-ios.mm index 14d39d9cc9ac..7e9b5da0fa24 100644 --- a/cocos/platform/ios/CCDirectorCaller-ios.mm +++ b/cocos/platform/ios/CCDirectorCaller-ios.mm @@ -76,6 +76,8 @@ - (instancetype)init NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; [nc addObserver:self selector:@selector(appDidBecomeActive) name:UIApplicationDidBecomeActiveNotification object:nil]; [nc addObserver:self selector:@selector(appDidBecomeInactive) name:UIApplicationWillResignActiveNotification object:nil]; + [nc addObserver:self selector:@selector(appDidBecomeActive) name:UIApplicationWillEnterForegroundNotification object:nil]; + [nc addObserver:self selector:@selector(appDidBecomeInactive) name:UIApplicationDidEnterBackgroundNotification object:nil]; self.interval = 1; } @@ -158,6 +160,12 @@ -(void)initLastDisplayTime lastDisplayTime = (mach_absolute_time() / clockFrequency) - ((1.0 / 60) * self.interval); } +// +-(void)setActive:(BOOL)isActive +{ + isAppActive = isActive; +} + @end #endif // CC_TARGET_PLATFORM == CC_PLATFORM_IOS diff --git a/cocos/platform/ios/CCEAGLView-ios.h b/cocos/platform/ios/CCEAGLView-ios.h index bce94c3eb7fa..65c7a6b80357 100644 --- a/cocos/platform/ios/CCEAGLView-ios.h +++ b/cocos/platform/ios/CCEAGLView-ios.h @@ -60,10 +60,6 @@ APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Copyright (C) 2008 Apple Inc. All Rights Reserved. */ - -#include "platform/CCPlatformConfig.h" -#if CC_TARGET_PLATFORM == CC_PLATFORM_IOS - #import #import #import @@ -80,42 +76,18 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved. * The view content is basically an EAGL surface you render your OpenGL scene into. * Note that setting the view non-opaque will only work if the EAGL surface has an alpha channel. */ -@interface CCEAGLView : UIView +@interface CCEAGLView : UIView { id renderer_; - EAGLContext *context_; // weak ref - NSString *pixelformat_; - GLuint depthFormat_; BOOL preserveBackbuffer_; - - CGSize size_; CGRect safeArea_; BOOL discardFramebufferSupported_; //fsaa addition - BOOL multisampling_; unsigned int requestedSamples_; - BOOL isUseUITextField; -@private - NSString * markedText_; - CGRect caretRect_; - CGRect originalRect_; - NSNotification* keyboardShowNotification_; - BOOL isKeyboardShown_; } -@property(nonatomic, readonly) UITextPosition *beginningOfDocument; -@property(nonatomic, readonly) UITextPosition *endOfDocument; -@property(nonatomic, assign) id inputDelegate; -@property(nonatomic, readonly) UITextRange *markedTextRange; -@property (nonatomic, copy) NSDictionary *markedTextStyle; -@property(readwrite, copy) UITextRange *selectedTextRange; -@property(nonatomic, readonly) id tokenizer; -@property(nonatomic, readonly, getter = isKeyboardShown) BOOL isKeyboardShown; -@property(nonatomic, copy) NSNotification* keyboardShowNotification; -@property(nonatomic) UITextAutocorrectionType autocorrectionType; // default is UITextAutocorrectionTypeDefault - /** creates an initializes an CCEAGLView with a frame and 0-bit depth buffer, and a RGB565 color buffer */ + (id) viewWithFrame:(CGRect)frame; /** creates an initializes an CCEAGLView with a frame, a color buffer format, and 0-bit depth buffer */ @@ -132,7 +104,7 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved. /** Initializes an CCEAGLView with a frame, a color buffer format, a depth buffer format, a sharegroup and multisampling support */ - (id) initWithFrame:(CGRect)frame pixelFormat:(NSString*)format depthFormat:(GLuint)depth preserveBackbuffer:(BOOL)retained sharegroup:(EAGLSharegroup*)sharegroup multiSampling:(BOOL)sampling numberOfSamples:(unsigned int)nSamples; -/** pixel format: it could be RGBA8 (32-bit) or RGB565 (16-bit) */ +//// * pixel format: it could be RGBA8 (32-bit) or RGB565 (16-bit) @property(nonatomic,readonly) NSString* pixelFormat; /** depth format of the render buffer: 0, 16 or 24 bits*/ @property(nonatomic,readonly) GLuint depthFormat; @@ -144,6 +116,7 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved. @property(nonatomic,readonly) EAGLContext *context; @property(nonatomic,readwrite) BOOL multiSampling; +@property(nonatomic, readonly) BOOL isKeyboardShown; /** CCEAGLView uses double-buffer. This method swaps the buffers */ @@ -157,6 +130,7 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved. -(void) doAnimationWhenKeyboardMoveWithDuration:(float) duration distance:(float) dis; -(void) doAnimationWhenAnotherEditBeClicked; -@end -#endif // CC_PLATFORM_IOS +-(void) showKeyboard; +-(void) hideKeyboard; +@end diff --git a/cocos/platform/ios/CCEAGLView-ios.mm b/cocos/platform/ios/CCEAGLView-ios.mm index 1f06a0f27484..7feff61c6cea 100644 --- a/cocos/platform/ios/CCEAGLView-ios.mm +++ b/cocos/platform/ios/CCEAGLView-ios.mm @@ -60,10 +60,6 @@ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE Copyright (C) 2008 Apple Inc. All Rights Reserved. */ - -#include "platform/CCPlatformConfig.h" -#if CC_TARGET_PLATFORM == CC_PLATFORM_IOS - #import "platform/ios/CCEAGLView-ios.h" #import @@ -74,14 +70,17 @@ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE #import "platform/ios/CCGLViewImpl-ios.h" #import "platform/ios/CCES2Renderer-ios.h" #import "platform/ios/OpenGL_Internal-ios.h" +#import "platform/ios/CCInputView-ios.h" //CLASS IMPLEMENTATIONS: #define IOS_MAX_TOUCHES_COUNT 10 -@interface CCEAGLView (Private) -- (BOOL) setupSurfaceWithSharegroup:(EAGLSharegroup*)sharegroup; -- (unsigned int) convertPixelFormat:(NSString*) pixelFormat; +@interface CCEAGLView () +@property (nonatomic) CCInputView* textInputView; +@property(nonatomic, readwrite, assign) BOOL isKeyboardShown; +@property(nonatomic, copy) NSNotification* keyboardShowNotification; +@property(nonatomic, assign) CGRect originalRect; @end @implementation CCEAGLView @@ -90,8 +89,10 @@ @implementation CCEAGLView @synthesize pixelFormat=pixelformat_, depthFormat=depthFormat_; @synthesize context=context_; @synthesize multiSampling=multiSampling_; -@synthesize isKeyboardShown=isKeyboardShown_; @synthesize keyboardShowNotification = keyboardShowNotification_; +@synthesize isKeyboardShown; +@synthesize originalRect = originalRect_; + + (Class) layerClass { return [CAEAGLLayer class]; @@ -131,23 +132,19 @@ - (id) initWithFrame:(CGRect)frame pixelFormat:(NSString*)format depthFormat:(GL { if((self = [super initWithFrame:frame])) { - isUseUITextField = YES; + self.textInputView = [[CCInputView alloc] initWithFrame:frame]; pixelformat_ = format; depthFormat_ = depth; multiSampling_ = sampling; requestedSamples_ = nSamples; preserveBackbuffer_ = retained; - markedText_ = nil; if( ! [self setupSurfaceWithSharegroup:sharegroup] ) { [self release]; return nil; } - originalRect_ = self.frame; self.keyboardShowNotification = nil; - self.autocorrectionType = UITextAutocorrectionTypeNo; - if ([self respondsToSelector:@selector(setContentScaleFactor:)]) { self.contentScaleFactor = [[UIScreen mainScreen] scale]; @@ -160,15 +157,14 @@ - (id) initWithFrame:(CGRect)frame pixelFormat:(NSString*)format depthFormat:(GL -(id) initWithCoder:(NSCoder *)aDecoder { if( (self = [super initWithCoder:aDecoder]) ) { - - CAEAGLLayer* eaglLayer = (CAEAGLLayer*)[self layer]; + self.textInputView = [[CCInputView alloc] initWithCoder:aDecoder]; + CAEAGLLayer* eaglLayer = (CAEAGLLayer*)[self layer]; pixelformat_ = kEAGLColorFormatRGB565; depthFormat_ = 0; // GL_DEPTH_COMPONENT24_OES; multiSampling_= NO; requestedSamples_ = 0; size_ = [eaglLayer bounds].size; - markedText_ = nil; if( ! [self setupSurfaceWithSharegroup:nil] ) { [self release]; @@ -179,25 +175,6 @@ -(id) initWithCoder:(NSCoder *)aDecoder return self; } -- (void)didMoveToWindow -{ -#if !defined(CC_TARGET_OS_TVOS) - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(onUIKeyboardNotification:) - name:UIKeyboardWillShowNotification object:nil]; - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(onUIKeyboardNotification:) - name:UIKeyboardDidShowNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(onUIKeyboardNotification:) - name:UIKeyboardWillHideNotification object:nil]; - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(onUIKeyboardNotification:) - name:UIKeyboardDidHideNotification object:nil]; -#endif -} -(int) getWidth { @@ -249,7 +226,7 @@ - (void) dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; // remove keyboard notification [renderer_ release]; - self.keyboardShowNotification = nullptr; // implicit release + [self.textInputView release]; [super dealloc]; } @@ -380,33 +357,12 @@ - (CGRect) convertRectFromViewToSurface:(CGRect)rect return ret; } - --(void) handleTouchesAfterKeyboardShow -{ - NSArray *subviews = self.subviews; - - for(UIView* view in subviews) - { - if([view isKindOfClass:NSClassFromString(@"UITextView")] || - [view isKindOfClass:NSClassFromString(@"UITextField")]) - { - if ([view isFirstResponder]) - { - [view resignFirstResponder]; - return; - } - } - } -} - // Pass the touches to the superview #pragma mark CCEAGLView - Touch Delegate - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { - if (isKeyboardShown_) - { - [self handleTouchesAfterKeyboardShow]; - } + if (self.isKeyboardShown) + [self closeKeyboardOpenedByEditBox]; UITouch* ids[IOS_MAX_TOUCHES_COUNT] = {0}; float xs[IOS_MAX_TOUCHES_COUNT] = {0.0f}; @@ -507,264 +463,115 @@ - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event glview->handleTouchesCancel(i, (intptr_t*)ids, xs, ys); } -#pragma mark - UIView - Responder - -- (BOOL)canBecomeFirstResponder +- (void) showKeyboard { - if (nil != markedText_) { - [markedText_ release]; - } - markedText_ = nil; - if (isUseUITextField) - { - return NO; - } - return YES; + [self addSubview:self.textInputView]; + [self.textInputView becomeFirstResponder]; } -- (BOOL)becomeFirstResponder +- (void) hideKeyboard { - isUseUITextField = NO; - return [super becomeFirstResponder]; + [self.textInputView resignFirstResponder]; + [self.textInputView removeFromSuperview]; } -- (BOOL)resignFirstResponder +-(void) doAnimationWhenKeyboardMoveWithDuration:(float) duration distance:(float) dis { - isUseUITextField = YES; - return [super resignFirstResponder]; -} - -#pragma mark - UIKeyInput protocol - + [UIView beginAnimations:nil context:nullptr]; + [UIView setAnimationDelegate:self]; + [UIView setAnimationDuration:duration]; + [UIView setAnimationBeginsFromCurrentState:YES]; + + //NSLog(@"[animation] dis = %f, scale = %f \n", dis, cocos2d::GLView::getInstance()->getScaleY()); + + if (dis < 0.0f) dis = 0.0f; -- (BOOL)hasText -{ - return NO; -} + auto glview = cocos2d::Director::getInstance()->getOpenGLView(); + dis *= glview->getScaleY(); + + dis /= self.contentScaleFactor; -- (void)insertText:(NSString *)text -{ - if (nil != markedText_) { - [markedText_ release]; - markedText_ = nil; - } - const char * pszText = [text cStringUsingEncoding:NSUTF8StringEncoding]; - cocos2d::IMEDispatcher::sharedDispatcher()->dispatchInsertText(pszText, strlen(pszText)); + #if defined(CC_TARGET_OS_TVOS) + self.frame = CGRectMake(originalRect_.origin.x, originalRect_.origin.y - dis, originalRect_.size.width, originalRect_.size.height); + #else + switch (getFixedOrientation([[UIApplication sharedApplication] statusBarOrientation])) + { + case UIInterfaceOrientationPortrait: + self.frame = CGRectMake(originalRect_.origin.x, originalRect_.origin.y - dis, originalRect_.size.width, originalRect_.size.height); + break; + + case UIInterfaceOrientationPortraitUpsideDown: + self.frame = CGRectMake(originalRect_.origin.x, originalRect_.origin.y + dis, originalRect_.size.width, originalRect_.size.height); + break; + + case UIInterfaceOrientationLandscapeLeft: + self.frame = CGRectMake(originalRect_.origin.x - dis, originalRect_.origin.y , originalRect_.size.width, originalRect_.size.height); + break; + + case UIInterfaceOrientationLandscapeRight: + self.frame = CGRectMake(originalRect_.origin.x + dis, originalRect_.origin.y , originalRect_.size.width, originalRect_.size.height); + break; + + default: + break; + } + #endif + + [UIView commitAnimations]; } -- (void)deleteBackward +-(void) doAnimationWhenAnotherEditBeClicked { - if (nil != markedText_) { - [markedText_ release]; - markedText_ = nil; + if (self.keyboardShowNotification != nil) + { + [[NSNotificationCenter defaultCenter]postNotification:self.keyboardShowNotification]; } - cocos2d::IMEDispatcher::sharedDispatcher()->dispatchDeleteBackward(); -} - -#pragma mark - UITextInputTrait protocol - --(UITextAutocapitalizationType) autocapitalizationType -{ - return UITextAutocapitalizationTypeNone; -} - -#pragma mark - UITextInput protocol - -#pragma mark UITextInput - properties - -@synthesize beginningOfDocument; -@synthesize endOfDocument; -@synthesize inputDelegate; -@synthesize markedTextRange; -@synthesize markedTextStyle; -// @synthesize selectedTextRange; // must implement -@synthesize tokenizer; -@synthesize autocorrectionType; - -/* Text may have a selection, either zero-length (a caret) or ranged. Editing operations are - * always performed on the text from this selection. nil corresponds to no selection. */ -- (void)setSelectedTextRange:(UITextRange *)aSelectedTextRange -{ - CCLOG("UITextRange:setSelectedTextRange"); -} -- (UITextRange *)selectedTextRange -{ - return [[[UITextRange alloc] init] autorelease]; } -#pragma mark UITextInput - Replacing and Returning Text +#pragma UIKeyboard notification -- (NSString *)textInRange:(UITextRange *)range -{ - CCLOG("textInRange"); - return @""; -} -- (void)replaceRange:(UITextRange *)range withText:(NSString *)theText -{ - CCLOG("replaceRange"); -} - -#pragma mark UITextInput - Working with Marked and Selected Text - - - -/* If text can be selected, it can be marked. Marked text represents provisionally - * inserted text that has yet to be confirmed by the user. It requires unique visual - * treatment in its display. If there is any marked text, the selection, whether a - * caret or an extended range, always resides within. - * - * Setting marked text either replaces the existing marked text or, if none is present, - * inserts it from the current selection. */ - -- (void)setMarkedTextRange:(UITextRange *)markedTextRange -{ - CCLOG("setMarkedTextRange"); -} - -- (UITextRange *)markedTextRange -{ - CCLOG("markedTextRange"); - return nil; // Nil if no marked text. -} -- (void)setMarkedTextStyle:(NSDictionary *)markedTextStyle -{ - CCLOG("setMarkedTextStyle"); - -} -- (NSDictionary *)markedTextStyle -{ - CCLOG("markedTextStyle"); - return nil; -} -- (void)setMarkedText:(NSString *)markedText selectedRange:(NSRange)selectedRange -{ - CCLOG("setMarkedText"); - if (markedText == markedText_) { - return; - } - if (nil != markedText_) { - [markedText_ release]; - } - markedText_ = markedText; - [markedText_ retain]; -} -- (void)unmarkText -{ - CCLOG("unmarkText"); - if (nil == markedText_) +#if !defined(CC_TARGET_OS_TVOS) +namespace { + UIInterfaceOrientation getFixedOrientation(UIInterfaceOrientation statusBarOrientation) { - return; + if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) + { + statusBarOrientation = UIInterfaceOrientationPortrait; + } + return statusBarOrientation; } - const char * pszText = [markedText_ cStringUsingEncoding:NSUTF8StringEncoding]; - cocos2d::IMEDispatcher::sharedDispatcher()->dispatchInsertText(pszText, strlen(pszText)); - [markedText_ release]; - markedText_ = nil; -} - -#pragma mark Methods for creating ranges and positions. - -- (UITextRange *)textRangeFromPosition:(UITextPosition *)fromPosition toPosition:(UITextPosition *)toPosition -{ - CCLOG("textRangeFromPosition"); - return nil; -} -- (UITextPosition *)positionFromPosition:(UITextPosition *)position offset:(NSInteger)offset -{ - CCLOG("positionFromPosition"); - return nil; -} -- (UITextPosition *)positionFromPosition:(UITextPosition *)position inDirection:(UITextLayoutDirection)direction offset:(NSInteger)offset -{ - CCLOG("positionFromPosition"); - return nil; -} - -/* Simple evaluation of positions */ -- (NSComparisonResult)comparePosition:(UITextPosition *)position toPosition:(UITextPosition *)other -{ - CCLOG("comparePosition"); - return (NSComparisonResult)0; -} -- (NSInteger)offsetFromPosition:(UITextPosition *)from toPosition:(UITextPosition *)toPosition -{ - CCLOG("offsetFromPosition"); - return 0; -} - -- (UITextPosition *)positionWithinRange:(UITextRange *)range farthestInDirection:(UITextLayoutDirection)direction -{ - CCLOG("positionWithinRange"); - return nil; -} -- (UITextRange *)characterRangeByExtendingPosition:(UITextPosition *)position inDirection:(UITextLayoutDirection)direction -{ - CCLOG("characterRangeByExtendingPosition"); - return nil; -} - -#pragma mark Writing direction - -- (UITextWritingDirection)baseWritingDirectionForPosition:(UITextPosition *)position inDirection:(UITextStorageDirection)direction -{ - CCLOG("baseWritingDirectionForPosition"); - return UITextWritingDirectionNatural; } -- (void)setBaseWritingDirection:(UITextWritingDirection)writingDirection forRange:(UITextRange *)range -{ - CCLOG("setBaseWritingDirection"); -} - -#pragma mark Geometry +#endif -/* Geometry used to provide, for example, a correction rect. */ -- (CGRect)firstRectForRange:(UITextRange *)range -{ - CCLOG("firstRectForRange"); - return CGRectNull; -} -- (CGRect)caretRectForPosition:(UITextPosition *)position +- (void)didMoveToWindow { - CCLOG("caretRectForPosition"); - return caretRect_; -} - -#pragma mark Hit testing +#if !defined(CC_TARGET_OS_TVOS) + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(onUIKeyboardNotification:) + name:UIKeyboardWillShowNotification object:nil]; -/* JS - Find the closest position to a given point */ -- (UITextPosition *)closestPositionToPoint:(CGPoint)point -{ - CCLOG("closestPositionToPoint"); - return nil; -} -- (UITextPosition *)closestPositionToPoint:(CGPoint)point withinRange:(UITextRange *)range -{ - CCLOG("closestPositionToPoint"); - return nil; -} -- (UITextRange *)characterRangeAtPoint:(CGPoint)point -{ - CCLOG("characterRangeAtPoint"); - return nil; -} + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(onUIKeyboardNotification:) + name:UIKeyboardDidShowNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(onUIKeyboardNotification:) + name:UIKeyboardWillHideNotification object:nil]; -- (NSArray *)selectionRectsForRange:(UITextRange *)range -{ - CCLOG("selectionRectsForRange"); - return nil; + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(onUIKeyboardNotification:) + name:UIKeyboardDidHideNotification object:nil]; +#endif } -#pragma mark - UIKeyboard notification - -#if !defined(CC_TARGET_OS_TVOS) - (void)onUIKeyboardNotification:(NSNotification *)notif { NSString * type = notif.name; NSDictionary* info = [notif userInfo]; - CGRect begin = [self convertRect: + CGRect begin = [self convertRect: [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue] fromView:self]; - CGRect end = [self convertRect: + CGRect end = [self convertRect: [[info objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue] fromView:self]; double aniDuration = [[info objectForKey:UIKeyboardAnimationDurationUserInfoKey] doubleValue]; @@ -847,21 +654,14 @@ - (void)onUIKeyboardNotification:(NSNotification *)notif notiInfo.duration = (float)aniDuration; cocos2d::IMEDispatcher* dispatcher = cocos2d::IMEDispatcher::sharedDispatcher(); - if (UIKeyboardWillShowNotification == type) + if (UIKeyboardWillShowNotification == type) { - self.keyboardShowNotification = notif; // implicit copy dispatcher->dispatchKeyboardWillShow(notiInfo); } else if (UIKeyboardDidShowNotification == type) { - //CGSize screenSize = self.window.screen.bounds.size; + self.isKeyboardShown = YES; dispatcher->dispatchKeyboardDidShow(notiInfo); - caretRect_ = end; - - int fontSize = [UIFont smallSystemFontSize]; - caretRect_.origin.y = viewSize.height - (caretRect_.origin.y + caretRect_.size.height + fontSize); - caretRect_.size.height = 0; - isKeyboardShown_ = YES; } else if (UIKeyboardWillHideNotification == type) { @@ -869,78 +669,28 @@ - (void)onUIKeyboardNotification:(NSNotification *)notif } else if (UIKeyboardDidHideNotification == type) { - caretRect_ = CGRectZero; + self.isKeyboardShown = NO; dispatcher->dispatchKeyboardDidHide(notiInfo); - isKeyboardShown_ = NO; - } -} -#endif - -#if !defined(CC_TARGET_OS_TVOS) -UIInterfaceOrientation getFixedOrientation(UIInterfaceOrientation statusBarOrientation) -{ - if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) - { - statusBarOrientation = UIInterfaceOrientationPortrait; } - return statusBarOrientation; } -#endif --(void) doAnimationWhenKeyboardMoveWithDuration:(float)duration distance:(float)dis +// Close the keyboard opened by EditBox +-(void) closeKeyboardOpenedByEditBox { - [UIView beginAnimations:nil context:nullptr]; - [UIView setAnimationDelegate:self]; - [UIView setAnimationDuration:duration]; - [UIView setAnimationBeginsFromCurrentState:YES]; - - //NSLog(@"[animation] dis = %f, scale = %f \n", dis, cocos2d::GLView::getInstance()->getScaleY()); - - if (dis < 0.0f) dis = 0.0f; - - auto glview = cocos2d::Director::getInstance()->getOpenGLView(); - dis *= glview->getScaleY(); - - dis /= self.contentScaleFactor; - -#if defined(CC_TARGET_OS_TVOS) - self.frame = CGRectMake(originalRect_.origin.x, originalRect_.origin.y - dis, originalRect_.size.width, originalRect_.size.height); -#else - switch (getFixedOrientation([[UIApplication sharedApplication] statusBarOrientation])) - { - case UIInterfaceOrientationPortrait: - self.frame = CGRectMake(originalRect_.origin.x, originalRect_.origin.y - dis, originalRect_.size.width, originalRect_.size.height); - break; - - case UIInterfaceOrientationPortraitUpsideDown: - self.frame = CGRectMake(originalRect_.origin.x, originalRect_.origin.y + dis, originalRect_.size.width, originalRect_.size.height); - break; - - case UIInterfaceOrientationLandscapeLeft: - self.frame = CGRectMake(originalRect_.origin.x - dis, originalRect_.origin.y , originalRect_.size.width, originalRect_.size.height); - break; - - case UIInterfaceOrientationLandscapeRight: - self.frame = CGRectMake(originalRect_.origin.x + dis, originalRect_.origin.y , originalRect_.size.width, originalRect_.size.height); - break; - - default: - break; - } -#endif + NSArray *subviews = self.subviews; - [UIView commitAnimations]; -} - - --(void) doAnimationWhenAnotherEditBeClicked -{ - if (self.keyboardShowNotification != nil) + for(UIView* view in subviews) { - [[NSNotificationCenter defaultCenter]postNotification:self.keyboardShowNotification]; + if([view isKindOfClass:NSClassFromString(@"UITextView")] || + [view isKindOfClass:NSClassFromString(@"UITextField")]) + { + if ([view isFirstResponder]) + { + [view resignFirstResponder]; + return; + } + } } } @end - -#endif // CC_PLATFORM_IOS diff --git a/cocos/platform/ios/CCGLViewImpl-ios.mm b/cocos/platform/ios/CCGLViewImpl-ios.mm index 476d66377a64..5d5b36691457 100644 --- a/cocos/platform/ios/CCGLViewImpl-ios.mm +++ b/cocos/platform/ios/CCGLViewImpl-ios.mm @@ -224,11 +224,11 @@ of this software and associated documentation files (the "Software"), to deal if (open) { - [eaglview becomeFirstResponder]; + [eaglview showKeyboard]; } else { - [eaglview resignFirstResponder]; + [eaglview hideKeyboard]; } } diff --git a/cocos/platform/ios/CCImage-ios.mm b/cocos/platform/ios/CCImage-ios.mm index baad43f45aea..ac6b04ed3f0b 100644 --- a/cocos/platform/ios/CCImage-ios.mm +++ b/cocos/platform/ios/CCImage-ios.mm @@ -91,7 +91,14 @@ of this software and associated documentation files (the "Software"), to deal CGBitmapInfo bitmapInfo = kCGBitmapByteOrderDefault; if (saveToPNG && hasAlpha() && (! isToRGB)) { - bitmapInfo |= kCGImageAlphaPremultipliedLast; + if (_hasPremultipliedAlpha) + { + bitmapInfo |= kCGImageAlphaPremultipliedLast; + } + else + { + bitmapInfo |= kCGImageAlphaLast; + } } CGDataProviderRef provider = CGDataProviderCreateWithData(nullptr, pixels, myDataLength, nullptr); CGColorSpaceRef colorSpaceRef = CGColorSpaceCreateDeviceRGB(); diff --git a/cocos/platform/ios/CCInputView-ios.h b/cocos/platform/ios/CCInputView-ios.h new file mode 100644 index 000000000000..94b69ff60580 --- /dev/null +++ b/cocos/platform/ios/CCInputView-ios.h @@ -0,0 +1,4 @@ +#import + +@interface CCInputView : UIView +@end diff --git a/cocos/platform/ios/CCInputView-ios.mm b/cocos/platform/ios/CCInputView-ios.mm new file mode 100644 index 000000000000..9313f3ee5c16 --- /dev/null +++ b/cocos/platform/ios/CCInputView-ios.mm @@ -0,0 +1,204 @@ +#import "platform/ios/CCInputView-ios.h" +#import "base/CCIMEDispatcher.h" +#import "base/CCDirector.h" + +@interface CCInputView () + +@property(nonatomic) NSString* myMarkedText; + +@end + +@implementation CCInputView + +@synthesize myMarkedText; +@synthesize hasText; +@synthesize beginningOfDocument; +@synthesize endOfDocument; +@synthesize markedTextStyle; +@synthesize tokenizer; +@synthesize autocorrectionType; + +- (instancetype) initWithFrame:(CGRect)frame { + if (self = [super initWithFrame:frame] ) { + self.myMarkedText = nil; + self.autocorrectionType = UITextAutocorrectionTypeNo; + } + + return self; +} + +- (void) dealloc { + [[NSNotificationCenter defaultCenter] removeObserver:self]; // remove keyboard notification + [self.myMarkedText release]; + [self removeFromSuperview]; + [super dealloc]; +} + +- (BOOL) canBecomeFirstResponder { + return YES; +} + +- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event +{ + [self resignFirstResponder]; + [self removeFromSuperview]; +} + +#pragma TextInput protocol + +- (id)inputDelegate { + return nil; +} + +- (void)setInputDelegate:(id)inputDelegate { + +} + +- (void)setSelectedTextRange:(UITextRange *)aSelectedTextRange { + CCLOG("UITextRange:setSelectedTextRange"); +} + +- (UITextRange *)selectedTextRange { + return [[[UITextRange alloc] init] autorelease]; +} + +- (void)deleteBackward { + if (nil != self.myMarkedText) { + [self.myMarkedText release]; + self.myMarkedText = nil; + } + cocos2d::IMEDispatcher::sharedDispatcher()->dispatchDeleteBackward(); +} + +- (void)insertText:(nonnull NSString *)text { + if (nil != self.myMarkedText) { + [self.myMarkedText release]; + self.myMarkedText = nil; + } + const char * pszText = [text cStringUsingEncoding:NSUTF8StringEncoding]; + cocos2d::IMEDispatcher::sharedDispatcher()->dispatchInsertText(pszText, strlen(pszText)); +} + +- (NSWritingDirection)baseWritingDirectionForPosition:(nonnull UITextPosition *)position inDirection:(UITextStorageDirection)direction { + CCLOG("baseWritingDirectionForPosition"); + return NSWritingDirectionLeftToRight; +} + +- (CGRect)caretRectForPosition:(nonnull UITextPosition *)position { + CCLOG("caretRectForPosition"); + return CGRectZero; +} + +- (nullable UITextRange *)characterRangeAtPoint:(CGPoint)point { + CCLOG("characterRangeAtPoint"); + return nil; +} + +- (nullable UITextRange *)characterRangeByExtendingPosition:(nonnull UITextPosition *)position inDirection:(UITextLayoutDirection)direction { + CCLOG("characterRangeByExtendingPosition"); + return nil; +} + +- (nullable UITextPosition *)closestPositionToPoint:(CGPoint)point { + CCLOG("closestPositionToPoint"); + return nil; +} + +- (nullable UITextPosition *)closestPositionToPoint:(CGPoint)point withinRange:(nonnull UITextRange *)range { + CCLOG("closestPositionToPoint"); + return nil; +} + +- (NSComparisonResult)comparePosition:(nonnull UITextPosition *)position toPosition:(nonnull UITextPosition *)other { + CCLOG("comparePosition"); + return (NSComparisonResult)0; +} + +- (CGRect)firstRectForRange:(nonnull UITextRange *)range { + CCLOG("firstRectForRange"); + return CGRectNull; +} + +- (NSInteger)offsetFromPosition:(nonnull UITextPosition *)from toPosition:(nonnull UITextPosition *)toPosition { + CCLOG("offsetFromPosition"); + return 0; +} + +- (nullable UITextPosition *)positionFromPosition:(nonnull UITextPosition *)position inDirection:(UITextLayoutDirection)direction offset:(NSInteger)offset { + CCLOG("positionFromPosition"); + return nil; +} + +- (nullable UITextPosition *)positionFromPosition:(nonnull UITextPosition *)position offset:(NSInteger)offset { + CCLOG("positionFromPosition"); + return nil; +} + +- (nullable UITextPosition *)positionWithinRange:(nonnull UITextRange *)range farthestInDirection:(UITextLayoutDirection)direction { + CCLOG("positionWithinRange"); + return nil; +} + +- (void)replaceRange:(nonnull UITextRange *)range withText:(nonnull NSString *)text { + +} + +- (nonnull NSArray *)selectionRectsForRange:(nonnull UITextRange *)range { + CCLOG("selectionRectsForRange"); + return nil; +} + +- (void)setBaseWritingDirection:(NSWritingDirection)writingDirection forRange:(nonnull UITextRange *)range { + +} + +- (void)setMarkedText:(nullable NSString *)markedText selectedRange:(NSRange)selectedRange { + CCLOG("setMarkedText"); + if (markedText == self.myMarkedText) { + return; + } + if (nil != self.myMarkedText) { + [self.myMarkedText release]; + } + self.myMarkedText = markedText; + [self.myMarkedText retain]; +} + +- (UITextRange *)markedTextRange +{ + CCLOG("markedTextRange"); + if (nil != self.myMarkedText) { + return [[[UITextRange alloc] init] autorelease]; + } + return nil; // Nil if no marked text. +} + +- (nullable NSString *)textInRange:(nonnull UITextRange *)range { + CCLOG("textInRange"); + if (nil != self.myMarkedText) { + return self.myMarkedText; + } + return @""; +} + +- (nullable UITextRange *)textRangeFromPosition:(nonnull UITextPosition *)fromPosition toPosition:(nonnull UITextPosition *)toPosition { + CCLOG("textRangeFromPosition"); + return nil; +} + +- (void)unmarkText { + CCLOG("unmarkText"); + if (nil == self.myMarkedText) + { + return; + } + const char * pszText = [self.myMarkedText cStringUsingEncoding:NSUTF8StringEncoding]; + cocos2d::IMEDispatcher::sharedDispatcher()->dispatchInsertText(pszText, strlen(pszText)); + [self.myMarkedText release]; + self.myMarkedText = nil; +} + +- (void)encodeWithCoder:(nonnull NSCoder *)coder { +} + +@end diff --git a/cocos/platform/linux/CCApplication-linux.cpp b/cocos/platform/linux/CCApplication-linux.cpp index 10b376ff41b3..d1ed03a8c9fa 100644 --- a/cocos/platform/linux/CCApplication-linux.cpp +++ b/cocos/platform/linux/CCApplication-linux.cpp @@ -115,11 +115,6 @@ void Application::setAnimationInterval(float interval) _animationInterval = interval*1000.0f; } -void Application::setAnimationInterval(float interval, SetIntervalReason reason) -{ - setAnimationInterval(interval); -} - void Application::setResourceRootPath(const std::string& rootResDir) { _resourceRootPath = rootResDir; @@ -133,7 +128,7 @@ void Application::setResourceRootPath(const std::string& rootResDir) pFileUtils->setSearchPaths(searchPaths); } -const std::string& Application::getResourceRootPath(void) +const std::string& Application::getResourceRootPath() { return _resourceRootPath; } diff --git a/cocos/platform/linux/CCApplication-linux.h b/cocos/platform/linux/CCApplication-linux.h index 42f9817c7556..875938e4bdf4 100644 --- a/cocos/platform/linux/CCApplication-linux.h +++ b/cocos/platform/linux/CCApplication-linux.h @@ -55,7 +55,6 @@ class Application : public ApplicationProtocol @param interval The time, which expressed in second in second, between current frame and next. */ virtual void setAnimationInterval(float interval) override; - virtual void setAnimationInterval(float interval, SetIntervalReason reason) override; /** @brief Run the message loop. @@ -103,7 +102,7 @@ class Application : public ApplicationProtocol * Gets the Resource root path. * @deprecated Please use FileUtils::getInstance()->getSearchPaths() instead. */ - CC_DEPRECATED_ATTRIBUTE const std::string& getResourceRootPath(void); + CC_DEPRECATED_ATTRIBUTE const std::string& getResourceRootPath(); /** @brief Get target platform diff --git a/cocos/platform/linux/CCCommon-linux.cpp b/cocos/platform/linux/CCCommon-linux.cpp index 270c281b1217..6ebaca744e8e 100644 --- a/cocos/platform/linux/CCCommon-linux.cpp +++ b/cocos/platform/linux/CCCommon-linux.cpp @@ -33,7 +33,7 @@ THE SOFTWARE. NS_CC_BEGIN -void MessageBox(const char * msg, const char * title) +void ccMessageBox(const char * msg, const char * title) { log("%s: %s", title, msg); } diff --git a/cocos/platform/linux/CCDevice-linux.cpp b/cocos/platform/linux/CCDevice-linux.cpp index 92e4137a7364..0b967f488091 100644 --- a/cocos/platform/linux/CCDevice-linux.cpp +++ b/cocos/platform/linux/CCDevice-linux.cpp @@ -34,6 +34,7 @@ THE SOFTWARE. #include #include +#include #include #include #include @@ -98,7 +99,7 @@ int Device::getDPI() */ double xres = ((((double) DisplayWidth(dpy,scr)) * 25.4) / ((double) DisplayWidthMM(dpy,scr))); - dpi = (int) (xres + 0.5); + dpi = std::lround(xres); //printf("dpi = %d\n", dpi); XCloseDisplay (dpy); } @@ -349,7 +350,7 @@ class BitmapDC std::string lowerCasePath = fontPath; std::transform(lowerCasePath.begin(), lowerCasePath.end(), lowerCasePath.begin(), ::tolower); if ( lowerCasePath.find(".ttf") != std::string::npos ) { - fontPath = cocos2d::FileUtils::getInstance()->fullPathForFilename(fontPath.c_str()); + fontPath = cocos2d::FileUtils::getInstance()->fullPathForFilename(fontPath); FILE *f = fopen(fontPath.c_str(), "r"); if ( f ) { diff --git a/cocos/platform/linux/CCFileUtils-linux.cpp b/cocos/platform/linux/CCFileUtils-linux.cpp index 1e45f26ab149..831a77efb865 100644 --- a/cocos/platform/linux/CCFileUtils-linux.cpp +++ b/cocos/platform/linux/CCFileUtils-linux.cpp @@ -78,7 +78,7 @@ bool FileUtilsLinux::init() fullpath[length] = '\0'; std::string appPath = fullpath; - _defaultResRootPath = appPath.substr(0, appPath.find_last_of("/")); + _defaultResRootPath = appPath.substr(0, appPath.find_last_of('/')); _defaultResRootPath += CC_RESOURCE_FOLDER_LINUX; // Set writable path to $XDG_CONFIG_HOME or ~/.config// if $XDG_CONFIG_HOME not exists. @@ -91,7 +91,7 @@ bool FileUtilsLinux::init() xdgConfigPath = xdg_config_path; } _writablePath = xdgConfigPath; - _writablePath += appPath.substr(appPath.find_last_of("/")); + _writablePath += appPath.substr(appPath.find_last_of('/')); _writablePath += "/"; return FileUtils::init(); diff --git a/cocos/platform/mac/CCApplication-mac.h b/cocos/platform/mac/CCApplication-mac.h index 9588e4b8a167..9ca9fa828ac4 100644 --- a/cocos/platform/mac/CCApplication-mac.h +++ b/cocos/platform/mac/CCApplication-mac.h @@ -54,7 +54,6 @@ class CC_DLL Application : public ApplicationProtocol @param interval The time, which expressed in second in second, between current frame and next. */ virtual void setAnimationInterval(float interval) override; - virtual void setAnimationInterval(float interval, SetIntervalReason reason) override; /** @brief Run the message loop. @@ -111,11 +110,11 @@ class CC_DLL Application : public ApplicationProtocol * Gets the Resource root path. * @deprecated Please use FileUtils::getInstance()->getSearchPaths() instead. */ - CC_DEPRECATED_ATTRIBUTE const std::string& getResourceRootPath(void); + CC_DEPRECATED_ATTRIBUTE const std::string& getResourceRootPath(); void setStartupScriptFilename(const std::string& startupScriptFile); - const std::string& getStartupScriptFilename(void); + const std::string& getStartupScriptFilename(); protected: static Application * sm_pSharedApplication; diff --git a/cocos/platform/mac/CCApplication-mac.mm b/cocos/platform/mac/CCApplication-mac.mm index bbbf6dcde421..12bae715f99d 100644 --- a/cocos/platform/mac/CCApplication-mac.mm +++ b/cocos/platform/mac/CCApplication-mac.mm @@ -79,11 +79,21 @@ static long getCurrentMillSecond() // Retain glview to avoid glview being released in the while loop glview->retain(); - + + unsigned int ctx_updated_count = 0; + while (!glview->windowShouldClose()) { lastTime = getCurrentMillSecond(); - + + // hack to fix issue #19080, black screen on macOS 10.14 + // stevetranby: look into doing this outside loop to get rid of condition test per frame + if(ctx_updated_count < 2) { + ctx_updated_count++; + NSOpenGLContext* ctx = (NSOpenGLContext*)glview->getNSGLContext(); + [ctx update]; + } + director->mainLoop(); glview->pollEvents(); @@ -115,11 +125,6 @@ static long getCurrentMillSecond() _animationInterval = interval*1000.0f; } -void Application::setAnimationInterval(float interval, SetIntervalReason reason) -{ - setAnimationInterval(interval); -} - Application::Platform Application::getTargetPlatform() { return Platform::OS_MAC; diff --git a/cocos/platform/mac/CCCommon-mac.mm b/cocos/platform/mac/CCCommon-mac.mm index 1d022a37eb2f..44b06bc47b61 100644 --- a/cocos/platform/mac/CCCommon-mac.mm +++ b/cocos/platform/mac/CCCommon-mac.mm @@ -43,7 +43,7 @@ void LuaLog(const char * format) } // ios no MessageBox, use log instead -void MessageBox(const char * msg, const char * title) +void ccMessageBox(const char * msg, const char * title) { NSString * tmpTitle = (title) ? [NSString stringWithUTF8String : title] : nil; NSString * tmpMsg = (msg) ? [NSString stringWithUTF8String : msg] : nil; diff --git a/cocos/platform/mac/CCDevice-mac.mm b/cocos/platform/mac/CCDevice-mac.mm index 822ac09227f4..9e94f2bef3db 100644 --- a/cocos/platform/mac/CCDevice-mac.mm +++ b/cocos/platform/mac/CCDevice-mac.mm @@ -279,28 +279,22 @@ static bool _initWithString(const char * text, Device::TextAlign align, const ch NSSize realDimensions; - if (overflow == 2) { + if (overflow == 2) realDimensions = _calculateRealSizeForString(&stringWithAttributes, font, dimensions, enableWrap); - } else { + else realDimensions = _calculateStringSize(stringWithAttributes, font, &dimensions, enableWrap, overflow); - } - // Mac crashes if the width or height is 0 CC_BREAK_IF(realDimensions.width <= 0 || realDimensions.height <= 0); - if(dimensions.width <= 0.f) { + if(dimensions.width <= 0.f) dimensions.width = realDimensions.width; - } - if (dimensions.height <= 0.f) { + if (dimensions.height <= 0.f) dimensions.height = realDimensions.height; - } - - + //Alignment CGFloat xPadding = FontUtils::_calculateTextDrawStartWidth(align, realDimensions, dimensions); - CGFloat yPadding = _calculateTextDrawStartHeight(align, realDimensions, dimensions); NSInteger POTWide = dimensions.width; @@ -308,18 +302,26 @@ static bool _initWithString(const char * text, Device::TextAlign align, const ch NSRect textRect = NSMakeRect(xPadding, POTHigh - dimensions.height + yPadding, realDimensions.width, realDimensions.height); - - [[NSGraphicsContext currentContext] setShouldAntialias:NO]; - - NSImage *image = [[NSImage alloc] initWithSize:NSMakeSize(POTWide, POTHigh)]; - [image lockFocus]; - // patch for mac retina display and lableTTF - [[NSAffineTransform transform] set]; + NSBitmapImageRep* offscreenRep = [[[NSBitmapImageRep alloc] + initWithBitmapDataPlanes:NULL + pixelsWide:POTWide + pixelsHigh:POTHigh + bitsPerSample:8 + samplesPerPixel:4 + hasAlpha:YES + isPlanar:NO + colorSpaceName:NSDeviceRGBColorSpace + bitmapFormat: 0 + bytesPerRow:4 * POTWide + bitsPerPixel:32] autorelease]; + + NSGraphicsContext* g = [NSGraphicsContext graphicsContextWithBitmapImageRep:offscreenRep]; + [NSGraphicsContext saveGraphicsState]; + [NSGraphicsContext setCurrentContext:g]; [stringWithAttributes drawInRect:textRect]; - NSBitmapImageRep *bitmap = [[NSBitmapImageRep alloc] initWithFocusedViewRect:NSMakeRect (0.0f, 0.0f, POTWide, POTHigh)]; - [image unlockFocus]; + [NSGraphicsContext restoreGraphicsState]; - auto data = (unsigned char*) [bitmap bitmapData]; //Use the same buffer to improve the performance. + auto data = (unsigned char*) [offscreenRep bitmapData]; //Use the same buffer to improve the performance. NSUInteger textureSize = POTWide * POTHigh * 4; auto dataNew = (unsigned char*)malloc(sizeof(unsigned char) * textureSize); @@ -333,8 +335,6 @@ static bool _initWithString(const char * text, Device::TextAlign align, const ch info->isPremultipliedAlpha = true; ret = true; } - [bitmap release]; - [image release]; } while (0); return ret; } diff --git a/cocos/platform/tizen/CCApplication-tizen.cpp b/cocos/platform/tizen/CCApplication-tizen.cpp deleted file mode 100644 index d312e44a2941..000000000000 --- a/cocos/platform/tizen/CCApplication-tizen.cpp +++ /dev/null @@ -1,624 +0,0 @@ -/**************************************************************************** - Copyright (c) 2014-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - ****************************************************************************/ - -#include "platform/CCPlatformConfig.h" -#if CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN - -#include "platform/tizen/CCApplication-tizen.h" -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "platform/tizen/CCGLViewImpl-tizen.h" -#include "base/CCDirector.h" -#include "base/CCEventKeyboard.h" -#include "base/CCEventDispatcher.h" -#include "base/ccUtils.h" -#include "platform/CCFileUtils.h" - -#ifdef LOG_TAG -#undef LOG_TAG -#endif -#define LOG_TAG "cocos2d-x" - -ELEMENTARY_GLVIEW_GLOBAL_DEFINE(); - -NS_CC_BEGIN - -void stopAccelerometerSensor(); -void pauseAccelerometerSensor(); -void resumeAccelerometerSensor(); - -static void makeCurrent(void) -{ - Application* app = Application::getInstance(); - evas_gl_make_current(app->_evasGL, app->_sfc, app->_ctx); -} - - -static Eina_Bool _key_down_cb(void *data, int type, void *ev) -{ - makeCurrent(); - Ecore_Event_Key *event = (Ecore_Event_Key *)ev; - if (!strcmp("XF86Stop", event->key) || !strcmp("XF86Back", event->key)) - { - cocos2d::EventKeyboard event(cocos2d::EventKeyboard::KeyCode::KEY_ESCAPE, true); - cocos2d::Director::getInstance()->getEventDispatcher()->dispatchEvent(&event); - } - else if (!strcmp("XF86Menu", event->key)) - { - cocos2d::EventKeyboard event(cocos2d::EventKeyboard::KeyCode::KEY_MENU, true); - cocos2d::Director::getInstance()->getEventDispatcher()->dispatchEvent(&event); - } - - return ECORE_CALLBACK_PASS_ON; -} - -static Eina_Bool _key_up_cb(void *data, int type, void *ev) -{ - makeCurrent(); - Ecore_Event_Key *event = (Ecore_Event_Key *)ev; - if (!strcmp("XF86Stop", event->key) || !strcmp("XF86Back", event->key)) - { - cocos2d::EventKeyboard event(cocos2d::EventKeyboard::KeyCode::KEY_ESCAPE, false); - cocos2d::Director::getInstance()->getEventDispatcher()->dispatchEvent(&event); - } - else if (!strcmp("XF86Menu", event->key)) - { - cocos2d::EventKeyboard event(cocos2d::EventKeyboard::KeyCode::KEY_MENU, false); - cocos2d::Director::getInstance()->getEventDispatcher()->dispatchEvent(&event); - } - - return ECORE_CALLBACK_PASS_ON; -} - -static void draw_gl(Evas_Object *obj) -{ - auto director = Director::getInstance(); - auto glview = director->getOpenGLView(); - - director->mainLoop(); - glview->pollEvents(); -} - -static void del_gl(Evas_Object *obj) { - -} - -// sharedApplication pointer -Application* Application::__instance = nullptr; - -Application::Application() -: _win(nullptr) -, _conform(nullptr) -, _animationInterval(1.0f/60.0f*1000.0f) -, _paused(false) -{ - _orientation = APP_DEVICE_ORIENTATION_0; - CC_ASSERT(! __instance); - __instance = this; -} - -Application::~Application() -{ - CC_ASSERT(this == __instance); - __instance = nullptr; -} - -static void del_anim(void *data, Evas *evas, Evas_Object *obj, void *event_info) -{ - Ecore_Animator *ani = (Ecore_Animator *)evas_object_data_get(obj, "ani"); - ecore_animator_del(ani); -} - -static Eina_Bool anim(void *data) { - elm_glview_changed_set((Evas_Object*)data); - return EINA_TRUE; -} - -static void init_gl(Evas_Object *obj) { - Application *ad = Application::getInstance(); - - //save current ctx - ad->_evasGL = elm_glview_evas_gl_get(obj); - ad->_ctx = evas_gl_current_context_get(ad->_evasGL); - ad->_sfc = evas_gl_current_surface_get(ad->_evasGL); - - auto director = Director::getInstance(); - auto glview = director->getOpenGLView(); - if (glview == nullptr) { - glview = GLViewImpl::create("Cocos2dxTizen"); - - int w, h; - elm_glview_size_get(obj, &w, &h); - glview->setFrameSize(w, h); - director->setOpenGLView(glview); - } - - ad->initGLContextAttrs(); - // Initialize instance and cocos2d. - if (! ad->applicationDidFinishLaunching()) - { - return; - } -} - -static void create_indicator(Application *ad) { - elm_win_conformant_set(ad->_win, EINA_TRUE); - - elm_win_indicator_mode_set(ad->_win, ELM_WIN_INDICATOR_SHOW); - elm_win_indicator_opacity_set(ad->_win, ELM_WIN_INDICATOR_TRANSPARENT); - - ad->_conform = elm_conformant_add(ad->_win); - evas_object_size_hint_weight_set(ad->_conform, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); - elm_win_resize_object_add(ad->_win, ad->_conform); - evas_object_show(ad->_conform); -} - -static Evas_Object* add_win(const char *name) { - Evas_Object *win; - - win = elm_win_util_standard_add(name, "tizen"); - - if (!win) - return nullptr; - //fix openURL tests not goes to another program issue - // elm_win_fullscreen_set(win, EINA_TRUE); - evas_object_show(win); - - return win; -} - -//touch call back -static void touches_down_cb(void *data, Evas *e , Evas_Object *obj , void *event_info) -{ - auto ev = (Evas_Event_Multi_Down *)event_info; - int id = ev->device; - float x = ev->canvas.x; - float y = ev->canvas.y; - - makeCurrent(); - cocos2d::Director::getInstance()->getOpenGLView()->handleTouchesBegin(1, &id, &x, &y); -} - -static void touches_move_cb(void *data, Evas *e , Evas_Object *obj , void *event_info) -{ - auto ev = (Evas_Event_Multi_Move *)event_info; - int id = ev->device; - float x = ev->cur.canvas.x; - float y = ev->cur.canvas.y; - - makeCurrent(); - cocos2d::Director::getInstance()->getOpenGLView()->handleTouchesMove(1, &id, &x, &y); -} - -static void touches_up_cb(void *data, Evas *e , Evas_Object *obj , void *event_info) -{ - auto ev = (Evas_Event_Multi_Up *)event_info; - int id = ev->device; - float x = ev->canvas.x; - float y = ev->canvas.y; - - makeCurrent(); - cocos2d::Director::getInstance()->getOpenGLView()->handleTouchesEnd(1, &id, &x, &y); -} - -static void touch_down_cb(void *data, Evas *e , Evas_Object *obj , void *event_info) -{ - auto ev = (Evas_Event_Mouse_Down *)event_info; - int id = ev->button; - float x = ev->canvas.x; - float y = ev->canvas.y; - - makeCurrent(); - cocos2d::Director::getInstance()->getOpenGLView()->handleTouchesBegin(1, &id, &x, &y); -} - -static void touch_move_cb(void *data, Evas *e , Evas_Object *obj , void *event_info) -{ - auto ev = (Evas_Event_Mouse_Move *)event_info; - int id = ev->buttons; - float x = ev->cur.canvas.x; - float y = ev->cur.canvas.y; - - makeCurrent(); - cocos2d::Director::getInstance()->getOpenGLView()->handleTouchesMove(1, &id, &x, &y); -} - -static void touch_up_cb(void *data, Evas *e , Evas_Object *obj , void *event_info) -{ - auto ev = (Evas_Event_Mouse_Up *)event_info; - int id = ev->button; - float x = ev->canvas.x; - float y = ev->canvas.y; - - makeCurrent(); - cocos2d::Director::getInstance()->getOpenGLView()->handleTouchesEnd(1, &id, &x, &y); -} - -static Elm_GLView_Mode get_glview_mode(const GLContextAttrs &attrs) -{ - /* for performance */ - Elm_GLView_Mode mode = ELM_GLVIEW_DIRECT; - - /* alpha */ - if (attrs.alphaBits > 0) - { - //fixme if enable this, cpp-test show white screen only. - //mode = (Elm_GLView_Mode)(mode | ELM_GLVIEW_ALPHA); - } - - /* depth */ - if (attrs.depthBits > 24) - { - mode = (Elm_GLView_Mode)(mode | ELM_GLVIEW_DEPTH_32); - } - else if (attrs.depthBits > 16) - { - mode = (Elm_GLView_Mode)(mode | ELM_GLVIEW_DEPTH_24); - } - else if (attrs.depthBits > 8) - { - mode = (Elm_GLView_Mode)(mode | ELM_GLVIEW_DEPTH_16); - } - else if (attrs.depthBits > 0) - { - mode = (Elm_GLView_Mode)(mode | ELM_GLVIEW_DEPTH_8); - } - - /* stencil */ - if (attrs.stencilBits > 8) - { - mode = (Elm_GLView_Mode)(mode | ELM_GLVIEW_STENCIL_16); - } - else if (attrs.stencilBits > 4) - { - mode = (Elm_GLView_Mode)(mode | ELM_GLVIEW_STENCIL_8); - } - else if (attrs.stencilBits > 2) - { - mode = (Elm_GLView_Mode)(mode | ELM_GLVIEW_STENCIL_4); - } - else if (attrs.stencilBits > 1) - { - mode = (Elm_GLView_Mode)(mode | ELM_GLVIEW_STENCIL_2); - } - else if (attrs.stencilBits > 0) - { - mode = (Elm_GLView_Mode)(mode | ELM_GLVIEW_STENCIL_1); - } - - return mode; -} - -static bool app_create(void *data) { - /* Hook to take necessary actions before main event loop starts - * Initialize UI resources and application's data - * If this function returns true, the main loop of application starts - * If this function returns false, the application is terminated. */ - - Evas_Object *gl; - Application *ad = (Application *)data; - - if (!data) - return false; - - /* Create and initialize GLView */ - elm_config_accel_preference_set("opengl"); - /* Create the window */ - ad->_win = add_win("cocos2d-x"); - - if (!ad->_win) - return false; - - int rots[2]; - rots[0] = ad->_orientation; - rots[1] = rots[0] + 180 % 360; - elm_win_wm_rotation_available_rotations_set(ad->_win, rots, 2); - - ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, _key_down_cb, ad); - ecore_event_handler_add(ECORE_EVENT_KEY_UP, _key_up_cb, ad); - - gl = elm_glview_add(ad->_win); - elm_win_resize_object_add(ad->_win, gl); - ELEMENTARY_GLVIEW_GLOBAL_USE(gl); - evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - - /* Create and initialize GLView */ - ad->initGLContextAttrs(); - auto attrs = GLView::getGLContextAttrs(); - auto mode = get_glview_mode(attrs); - elm_glview_mode_set(gl, mode); - - /* The resize policy tells GLView what to do with the surface when it - * resizes. ELM_GLVIEW_RESIZE_POLICY_RECREATE will tell it to - * destroy the current surface and recreate it to the new size. - */ - //elm_glview_resize_policy_set(gl, ELM_GLVIEW_RESIZE_POLICY_RECREATE); - - /* The render policy sets how GLView should render GL code. - * ELM_GLVIEW_RENDER_POLICY_ON_DEMAND will have the GL callback - * called only when the object is visible. - * ELM_GLVIEW_RENDER_POLICY_ALWAYS would cause the callback to be - * called even if the object were hidden. - */ - elm_glview_render_policy_set(gl, ELM_GLVIEW_RENDER_POLICY_ON_DEMAND); - - /* The initialize callback function gets registered here */ - elm_glview_init_func_set(gl, init_gl); - - /* The delete callback function gets registered here */ - elm_glview_del_func_set(gl, del_gl); - - /* The resize callback function gets registered here */ - // Cocos2d-x doesn't support to change orientation from portrait to landscape. - // So comment next line. -// elm_glview_resize_func_set(gl, resize_gl); - - /* The render callback function gets registered here */ - elm_glview_render_func_set(gl, draw_gl); - - /* Add the GLView to the box and show it */ - evas_object_show(gl); - - elm_object_focus_set(gl, EINA_TRUE); - - /* This adds an animator so that the app will regularly - * trigger updates of the GLView using elm_glview_changed_set(). - * - * NOTE: If you delete GL, this animator will keep running trying to access - * GL so this animator needs to be deleted with ecore_animator_del(). - */ - ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_TIMER); - ad->_ani = ecore_animator_add(anim, gl); - evas_object_data_set(gl, "ani", ad->_ani); - evas_object_event_callback_add(gl, EVAS_CALLBACK_DEL, del_anim, gl); - - /* Add Mouse Event Callbacks */ - evas_object_event_callback_add(gl, EVAS_CALLBACK_MOUSE_DOWN, touch_down_cb, ad); - evas_object_event_callback_add(gl, EVAS_CALLBACK_MOUSE_MOVE, touch_move_cb, ad); - evas_object_event_callback_add(gl, EVAS_CALLBACK_MOUSE_UP, touch_up_cb, ad); - - evas_object_event_callback_add(gl, EVAS_CALLBACK_MULTI_DOWN, touches_down_cb, ad); - evas_object_event_callback_add(gl, EVAS_CALLBACK_MULTI_MOVE, touches_move_cb, ad); - evas_object_event_callback_add(gl, EVAS_CALLBACK_MULTI_UP, touches_up_cb, ad); - - - - create_indicator(ad); - - return true; -} - -static void app_pause(void *data) -{ - /* Take necessary actions when application becomes invisible. */ - if(!data) - { - return; - } - pauseAccelerometerSensor(); - - Application* app = ((Application *)data); - app->applicationDidEnterBackground(); - - ecore_animator_freeze(app->_ani); - app->setPauseFlag(true); -} - -static void app_resume(void *data) -{ - /* Take necessary actions when application becomes visible. */ - if(!data) - { - return; - } - - Application* app = ((Application *)data); - app->applicationWillEnterForeground(); - resumeAccelerometerSensor(); - - ecore_animator_thaw(app->_ani); - app->setPauseFlag(false); -} - -static void app_terminate(void *data) -{ - /* Release all resources. */ - if(!data) - { - return; - } - stopAccelerometerSensor(); - Director::getInstance()->end(); - // Application* app = ((Application *)data); - // delete app; -} - -static void app_control(app_control_h app_control, void *data) -{ - /* Handle the launch request. */ -} - -int Application::run() -{ - ui_app_lifecycle_callback_s event_callback = { nullptr, }; - - event_callback.create = app_create; - event_callback.terminate = app_terminate; - event_callback.pause = app_pause; - event_callback.resume = app_resume; - event_callback.app_control = app_control; - -/* ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, ui_app_low_battery, &ad); - ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, ui_app_low_memory, &ad); - ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, ui_app_orient_changed, &ad); - ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed, &ad); - ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, ui_app_region_changed, &ad); - ui_app_remove_event_handler(handlers[APP_EVENT_LOW_MEMORY]); -*/ - int ret = ui_app_main(_argc, _argv, &event_callback, this); - if (ret != APP_ERROR_NONE) { - dlog_print(DLOG_ERROR, LOG_TAG, "The application failed to start, and returned %d", ret); - } - - return ret; -} - -void Application::setAnimationInterval(float interval) -{ - _animationInterval = interval*1000.0f; - ecore_animator_frametime_set(interval); -} - -void Application::setAnimationInterval(float interval, SetIntervalReason reason) -{ - setAnimationInterval(interval); -} - -void Application::setResourceRootPath(const std::string& rootResDir) -{ - _resourceRootPath = rootResDir; - if (_resourceRootPath[_resourceRootPath.length() - 1] != '/') - { - _resourceRootPath += '/'; - } - FileUtils* pFileUtils = FileUtils::getInstance(); - std::vector searchPaths = pFileUtils->getSearchPaths(); - searchPaths.insert(searchPaths.begin(), _resourceRootPath); - pFileUtils->setSearchPaths(searchPaths); -} - -const std::string& Application::getResourceRootPath(void) -{ - return _resourceRootPath; -} - -Application::Platform Application::getTargetPlatform() -{ - return Platform::OS_TIZEN; -} - -void Application::setDeviceOrientation(int orientation) -{ - _orientation = orientation; -} - -void Application::setMainArgs(int argc, char **argv) -{ - _argc = argc; - _argv = argv; -} -bool Application::openURL(const std::string &url) -{ - bool flag = false; - if(0==url.length()) - { - return flag; - } - app_control_h app_control; - - app_control_create(&app_control); - app_control_set_operation(app_control, APP_CONTROL_OPERATION_VIEW); - app_control_set_uri(app_control, url.c_str()); - - int ctrlError; - if ((ctrlError=app_control_send_launch_request(app_control, NULL, NULL)) == APP_CONTROL_ERROR_NONE) - { - flag = true; - } - else - { - dlog_print(DLOG_ERROR, LOG_TAG, "open url failed, and returned %d", ctrlError); - } - - app_control_destroy(app_control); - return flag; -} - -////////////////////////////////////////////////////////////////////////// -// static member function -////////////////////////////////////////////////////////////////////////// -Application* Application::getInstance() -{ - CC_ASSERT(__instance); - return __instance; -} - -// @deprecated Use getInstance() instead -Application* Application::sharedApplication() -{ - return Application::getInstance(); -} - -const char * Application::getCurrentLanguageCode() -{ - static char code[3]={0}; - char *pLanguageName = getenv("LANG"); - if (!pLanguageName) - return "en"; - strtok(pLanguageName, "_"); - if (!pLanguageName) - return "en"; - strncpy(code,pLanguageName,2); - code[2]='\0'; - return code; -} - -std::string Application::getVersion() -{ - //TODO - return ""; -} - -LanguageType Application::getCurrentLanguage() -{ - char *pLanguageName = getenv("LANG"); - if (!pLanguageName) - { - return LanguageType::ENGLISH; - } - strtok(pLanguageName, "_"); - if (!pLanguageName) - { - return LanguageType::ENGLISH; - } - - return utils::getLanguageTypeByISO2(pLanguageName); -} - -NS_CC_END - -#endif // CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN - diff --git a/cocos/platform/tizen/CCApplication-tizen.h b/cocos/platform/tizen/CCApplication-tizen.h deleted file mode 100644 index 76f4d23b3b91..000000000000 --- a/cocos/platform/tizen/CCApplication-tizen.h +++ /dev/null @@ -1,137 +0,0 @@ -/**************************************************************************** - Copyright (c) 2014-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - ****************************************************************************/ - -#include "platform/CCPlatformConfig.h" -#if CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN - -#ifndef CCAPLICATION_TIZEN_H_ -#define CCAPLICATION_TIZEN_H_ - -#include "platform/CCCommon.h" -#include "platform/CCApplicationProtocol.h" -#include - -#include - -NS_CC_BEGIN -class Rect; - -class Application : public ApplicationProtocol -{ -public: - /** - * @js ctor - */ - Application(); - /** - * @js NA - * @lua NA - */ - virtual ~Application(); - - /** - @brief Callback by Director for limit FPS. - @param interval The time, which expressed in second in second, between current frame and next. - */ - virtual void setAnimationInterval(float interval) override; - virtual void setAnimationInterval(float interval, SetIntervalReason reason) override; - - /** - @brief Run the message loop. - */ - int run(); - - /** - @brief Get current application instance. - @return Current application instance pointer. - */ - static Application* getInstance(); - - /** @deprecated Use getInstance() instead */ - CC_DEPRECATED_ATTRIBUTE static Application* sharedApplication(); - - /* override functions */ - virtual LanguageType getCurrentLanguage() override; - - std::string getVersion() override; - - /** - @brief Get current language iso 639-1 code - @return Current language iso 639-1 code - */ - virtual const char * getCurrentLanguageCode() override; - - /** - @brief Open url in default browser - @param String with url to open. - @return true if the resource located by the URL was successfully opened; otherwise false. - */ - virtual bool openURL(const std::string &url) override; - - /** - * Sets the Resource root path. - * @deprecated Please use FileUtils::getInstance()->setSearchPaths() instead. - */ - CC_DEPRECATED_ATTRIBUTE void setResourceRootPath(const std::string& rootResDir); - - /** - * Gets the Resource root path. - * @deprecated Please use FileUtils::getInstance()->getSearchPaths() instead. - */ - CC_DEPRECATED_ATTRIBUTE const std::string& getResourceRootPath(void); - - /** - @brief Get target platform - */ - virtual Platform getTargetPlatform() override; - - void setDeviceOrientation(int orientation); - void setMainArgs(int argc, char **argv); - void setPauseFlag(bool pause){_paused = pause;} - bool isPaused(){return _paused;} -public: - Evas_Object * _win; - Evas_Object * _conform; - - Evas_GL * _evasGL; - Evas_GL_Context * _ctx; - Evas_GL_Surface * _sfc; - Ecore_Animator * _ani; - - int _orientation; - int _argc; - char **_argv; -protected: - long _animationInterval; //micro second - std::string _resourceRootPath; - bool _paused; - static Application * __instance; -}; - -NS_CC_END - -#endif // CCAPLICATION_TIZEN_H_ - -#endif /* CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN */ diff --git a/cocos/platform/tizen/CCCommon-tizen.cpp b/cocos/platform/tizen/CCCommon-tizen.cpp deleted file mode 100644 index 4b4e60b5f0f0..000000000000 --- a/cocos/platform/tizen/CCCommon-tizen.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** - Copyright (c) 2014-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - ****************************************************************************/ - -#include "platform/CCPlatformConfig.h" -#if CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN - -#include "platform/CCCommon.h" -#include "platform/tizen/CCStdC-tizen.h" -#include "base/CCConsole.h" - -NS_CC_BEGIN - -void MessageBox(const char * msg, const char * title) -{ - log("%s: %s", title, msg); -} - -void LuaLog(const char * format) -{ - puts(format); -} - -NS_CC_END - -#endif // CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN diff --git a/cocos/platform/tizen/CCDevice-tizen.cpp b/cocos/platform/tizen/CCDevice-tizen.cpp deleted file mode 100644 index 9e4381bb0001..000000000000 --- a/cocos/platform/tizen/CCDevice-tizen.cpp +++ /dev/null @@ -1,358 +0,0 @@ -/**************************************************************************** - Copyright (c) 2014-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - ****************************************************************************/ - -#include "platform/CCPlatformConfig.h" -#if CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN - -#include "platform/CCDevice.h" - -#include -#include -#include -#include -#include -#include - -#include "base/CCEventDispatcher.h" -#include "base/CCEventAcceleration.h" -#include "base/CCDirector.h" -#include "platform/CCFileUtils.h" -#include "platform/tizen/CCApplication-tizen.h" - -using namespace std; -NS_CC_BEGIN - -static sensor_h s_sensorHandle = nullptr; -static sensor_listener_h s_sensorListener = nullptr; -static float s_sensorInterval = 30.0f; - -#define GRAVITY_EARTH 9.80665f - -static bool checkAccelerometerValues(sensor_event_s *sensor_data) -{ - for(int i = 0; i < sensor_data->value_count; ++i) - { - float value = sensor_data->values[i]; - - if(isnan(value))//or other limitations - { - return false; - } - } - return true; -} - -static void accelerometer_sensor_cb(sensor_h _sensor, sensor_event_s *sensor_data, void *user_data) -{ - if(!checkAccelerometerValues(sensor_data)) - { - CCLOG("sensor value is invalid!!"); - return; - } - if(3 != sensor_data->value_count) - { - return; - } - Acceleration *_acceleration = new Acceleration(); - _acceleration->x = sensor_data->values[0] / GRAVITY_EARTH; - _acceleration->y = sensor_data->values[1] / GRAVITY_EARTH; - _acceleration->z = sensor_data->values[2] / GRAVITY_EARTH; - _acceleration->timestamp = (double)sensor_data->timestamp / 1e6; - - double tmp = _acceleration->x; - Application *app = Application::getInstance(); - int orientation = elm_win_rotation_get(app->_win); - - switch (orientation) - { - case 0: - _acceleration->x = _acceleration->y; - _acceleration->y = tmp; - break; - - case 90: - _acceleration->x = -_acceleration->y; - _acceleration->y = tmp; - break; - - case 180: - _acceleration->x = -_acceleration->y; - _acceleration->y = -tmp; - break; - - case 270: - _acceleration->x = _acceleration->y; - _acceleration->y = -tmp; - break; - default: - CCLOG("unknown orientation"); - } - - cocos2d::EventAcceleration event(*_acceleration); - auto dispatcher = cocos2d::Director::getInstance()->getEventDispatcher(); - dispatcher->dispatchEvent(&event); -} - -void stopAccelerometerSensor() -{ - if (s_sensorListener) - { - sensor_listener_stop(s_sensorListener); - sensor_destroy_listener(s_sensorListener); - s_sensorListener = nullptr; - s_sensorHandle = nullptr; - } -} - -void startAccelerometerSensor() -{ - if (!s_sensorListener) - { - sensor_get_default_sensor(SENSOR_ACCELEROMETER, &s_sensorHandle); - auto err = sensor_create_listener(s_sensorHandle, &s_sensorListener); - if(SENSOR_ERROR_NONE != err) - { - CCLOG("create sensor failed!"); - } - sensor_listener_set_event_cb(s_sensorListener, s_sensorInterval, accelerometer_sensor_cb, NULL); - sensor_listener_start(s_sensorListener); - } -} - -static bool s_resumeAccelerometerSensor = false; - -void pauseAccelerometerSensor() -{ - if (s_sensorListener) - { - s_resumeAccelerometerSensor = true; - stopAccelerometerSensor(); - } - else - { - s_resumeAccelerometerSensor = false; - } -} - -void resumeAccelerometerSensor() -{ - if (s_resumeAccelerometerSensor) - { - startAccelerometerSensor(); - } -} - -void Device::setAccelerometerEnabled(bool isEnabled) -{ - if(isEnabled) - { - startAccelerometerSensor(); - } - else - { - stopAccelerometerSensor(); - } -} - -void Device::setAccelerometerInterval(float interval) -{ - s_sensorInterval = interval; - if(s_sensorListener) - { - sensor_listener_set_interval(s_sensorListener, s_sensorInterval); - } -} - -int Device::getDPI() -{ - static int dpi = -1; - if (dpi == -1) - { - auto ret = system_info_get_platform_int("tizen.org/feature/screen.dpi",&dpi); - if(ret != SYSTEM_INFO_ERROR_NONE) - { - //error handing - dpi = -1; - } - } - return dpi; -} - -static void getTextBitmapData(const char * text, const FontDefinition& textDefinition, Data& bitmapData, int &bitmapWidth, int &bitmapHeight) -{ - //create canvas object - auto method = evas_render_method_lookup("buffer"); - if (method <= 0) - { - log("ERROR: evas was not compiled with 'buffer' engine!"); - return ; - } - - //evas_init();//not necessary, removed when use Tizen 2.4. - auto canvas = evas_new(); - if(!canvas){ - log("ERROR: could not instantiate new evas canvas."); - return; - } - evas_output_method_set(canvas, method); - - std::string fontFullPath; - if(textDefinition._fontName.empty()) - { - fontFullPath = "Sans"; - } - else - { - fontFullPath= FileUtils::getInstance()->fullPathForFilename(textDefinition._fontName); - } - - const char* fontName = fontFullPath.c_str(); - const char* textAlign = "left"; - const char* textValign = "top"; - char richTextStyle[50]; - richTextStyle[0] = 0; - - if (textDefinition._stroke._strokeEnabled) - { - sprintf(richTextStyle,"style=outline outline_color=#%02X%02X%02X", - textDefinition._stroke._strokeColor.r, textDefinition._stroke._strokeColor.g, textDefinition._stroke._strokeColor.b); - } - - switch (textDefinition._alignment) - { - case TextHAlignment::CENTER: - textAlign = "center"; - break; - case TextHAlignment::RIGHT: - textAlign = "right"; - break; - default: - break; - } - double valignment = 0.0; - switch(textDefinition._vertAlignment) - { - case TextVAlignment::CENTER: - textValign = "center"; - valignment = 0.5; - break; - case TextVAlignment::BOTTOM: - textValign = "bottom"; - valignment = 1.0; - break; - default: - break; - } - - auto richText = (char*)malloc(strlen(text) + 150); - sprintf(richText,"DEFAULT='font=%s font_size=%d align=%s valign=%s %s color=#%02X%02X%02X wrap=word'", - fontName, textDefinition._fontSize, textAlign, textValign, richTextStyle, - textDefinition._fontFillColor.b, textDefinition._fontFillColor.g, textDefinition._fontFillColor.r); - - auto entry = evas_object_textblock_add(canvas); - auto st = evas_textblock_style_new(); - evas_textblock_style_set(st, richText); - evas_object_textblock_style_set(entry, st); - evas_textblock_style_free(st); - evas_object_textblock_valign_set(entry, valignment); - - evas_object_textblock_text_markup_set(entry, evas_textblock_text_utf8_to_markup(entry, text)); - free(richText); - - evas_object_resize(entry, 2048, 0);//allocate one default size first. - - Evas_Coord width = textDefinition._dimensions.width; - Evas_Coord height = textDefinition._dimensions.height; - if(0==width*height) - { - evas_object_textblock_size_formatted_get(entry, &width, &height); - } - - evas_object_resize(entry, width, height); - - //init canvas - evas_output_size_set(canvas, width, height); - evas_output_viewport_set(canvas, 0, 0, width, height); - - auto einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(canvas); - if (!einfo){ - log("ERROR: could not get evas engine info!"); - evas_free(canvas); - return ; - } - - // ARGB32 is sizeof(int), that is 4 bytes, per pixel - bitmapWidth = width; - bitmapHeight = height; - void* pixels = malloc(bitmapWidth * bitmapHeight * 4); - if (!pixels){ - log("ERROR: could not allocate canvas pixels!"); - evas_free(canvas); - return; - } - - einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32; - einfo->info.dest_buffer = pixels; - einfo->info.dest_buffer_row_bytes = bitmapWidth * sizeof(int); - einfo->info.use_color_key = 0; - einfo->info.alpha_threshold = 0; - einfo->info.func.new_update_region = NULL; - einfo->info.func.free_update_region = NULL; - evas_engine_info_set(canvas, (Evas_Engine_Info *)einfo); - - //render - evas_object_show(entry); - auto updates = evas_render_updates(canvas); - evas_render_updates_free(updates); - - bitmapData.fastSet((unsigned char*)pixels,bitmapWidth * bitmapHeight * 4); - - evas_free(canvas); - //evas_shutdown();//not necessary, removed when use Tizen 2.4. -} - -Data Device::getTextureDataForText(const char * text, const FontDefinition& textDefinition, TextAlign align, int &width, int &height, bool& hasPremultipliedAlpha) -{ - Data ret; - do - { - getTextBitmapData(text, textDefinition, ret, width, height); - hasPremultipliedAlpha = true; - } while (0); - - return ret; -} - -void Device::setKeepScreenOn(bool value) -{ -} - -void Device::vibrate(float /*duration*/) -{ -} - -NS_CC_END - -#endif // CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN diff --git a/cocos/platform/tizen/CCFileUtils-tizen.cpp b/cocos/platform/tizen/CCFileUtils-tizen.cpp deleted file mode 100644 index 504f81994d8c..000000000000 --- a/cocos/platform/tizen/CCFileUtils-tizen.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************** - Copyright (c) 2014-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - ****************************************************************************/ - -#include "platform/CCPlatformConfig.h" -#if CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN - -#include "platform/tizen/CCFileUtils-tizen.h" -#include -#include - -using namespace std; -NS_CC_BEGIN - -FileUtils* FileUtils::getInstance() -{ - if (s_sharedFileUtils == nullptr) - { - s_sharedFileUtils = new FileUtilsTizen(); - if(!s_sharedFileUtils->init()) - { - delete s_sharedFileUtils; - s_sharedFileUtils = nullptr; - CCLOG("ERROR: Could not init FileUtilsTizen"); - } - } - - return s_sharedFileUtils; -} - -FileUtilsTizen::FileUtilsTizen() -{ - -} - -bool FileUtilsTizen::init() -{ - _defaultResRootPath = app_get_resource_path(); - _writablePath = app_get_data_path(); - - return FileUtils::init(); -} - -string FileUtilsTizen::getWritablePath() const -{ - return _writablePath; -} - -bool FileUtilsTizen::isFileExistInternal(const std::string& strFilePath) const -{ - if (strFilePath.empty()) - { - return false; - } - - std::string strPath = strFilePath; - if (!isAbsolutePath(strPath)) - { // Not absolute path, add the default root path at the beginning. - strPath.insert(0, _defaultResRootPath); - } - - struct stat sts; - return (stat(strPath.c_str(), &sts) != -1) ? true : false; -} - -NS_CC_END - -#endif // CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN diff --git a/cocos/platform/tizen/CCFileUtils-tizen.h b/cocos/platform/tizen/CCFileUtils-tizen.h deleted file mode 100644 index e72d60eb34c2..000000000000 --- a/cocos/platform/tizen/CCFileUtils-tizen.h +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** - Copyright (c) 2014-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - ****************************************************************************/ - -#include "platform/CCPlatformConfig.h" -#if CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN - -#ifndef __CC_FILEUTILS_TIZEN_H__ -#define __CC_FILEUTILS_TIZEN_H__ - -#include "platform/CCFileUtils.h" -#include "platform/CCPlatformMacros.h" -#include "base/ccTypes.h" -#include - -NS_CC_BEGIN - -/** - * @addtogroup platform - * @{ - */ - -//! @brief Helper class to handle file operations -class CC_DLL FileUtilsTizen : public FileUtils -{ -public: - /* override functions */ - virtual bool init() override; - - virtual std::string getWritablePath() const override; - -private: - FileUtilsTizen(); - - std::string _writablePath; - - virtual bool isFileExistInternal(const std::string& strFilePath) const override; - - friend class FileUtils; -}; - -// end of platform group -/// @} - -NS_CC_END - -#endif // __CC_FILEUTILS_TIZEN_H__ - -#endif // CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN - diff --git a/cocos/platform/tizen/CCGL-tizen.h b/cocos/platform/tizen/CCGL-tizen.h deleted file mode 100644 index 77abe2cba5fc..000000000000 --- a/cocos/platform/tizen/CCGL-tizen.h +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** - Copyright (c) 2014-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - ****************************************************************************/ - -#ifndef __CCGL_H__ -#define __CCGL_H__ - -#include "platform/CCPlatformConfig.h" -#if CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN - -#include - -#ifndef glGenVertexArrays - #define glGenVertexArrays glGenVertexArraysOES -#endif -#ifndef glDeleteVertexArrays - #define glDeleteVertexArrays glDeleteVertexArraysOES -#endif -#ifndef GL_WRITE_ONLY - #define GL_WRITE_ONLY GL_WRITE_ONLY_OES -#endif -#ifndef glMapBuffer - #define glMapBuffer glMapBufferOES -#endif -#ifndef glUnmapBuffer - #define glUnmapBuffer glUnmapBufferOES -#endif -#ifndef GL_BGRA - #define GL_BGRA GL_BGRA_EXT -#endif -#ifndef glBindVertexArray - #define glBindVertexArray glBindVertexArrayOES -#endif -#ifndef glClearDepth - #define glClearDepth glClearDepthf -#endif -#ifndef GL_DEPTH24_STENCIL8 - #define GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_OES -#endif - - -ELEMENTARY_GLVIEW_GLOBAL_DECLARE(); - -#endif // CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN - -#endif // __CCGL_H__ diff --git a/cocos/platform/tizen/CCGLViewImpl-tizen.cpp b/cocos/platform/tizen/CCGLViewImpl-tizen.cpp deleted file mode 100644 index 53f474432c16..000000000000 --- a/cocos/platform/tizen/CCGLViewImpl-tizen.cpp +++ /dev/null @@ -1,218 +0,0 @@ -/**************************************************************************** - Copyright (c) 2014-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - ****************************************************************************/ - -#include "platform/CCPlatformConfig.h" -#if CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN - -#include "platform/tizen/CCGLViewImpl-tizen.h" -#include -#include -#include -#include -#include "platform/CCApplication.h" -#include "base/CCIMEDispatcher.h" -#include "base/CCDirector.h" - -NS_CC_BEGIN - -GLViewImpl* GLViewImpl::createWithRect(const std::string& viewName, Rect rect, float frameZoomFactor) -{ - auto ret = new GLViewImpl; - if(ret && ret->initWithRect(viewName, rect, frameZoomFactor)) { - ret->autorelease(); - return ret; - } - - return nullptr; -} - -GLViewImpl* GLViewImpl::create(const std::string& viewName) -{ - auto ret = new GLViewImpl; - if(ret && ret->initWithFullScreen(viewName)) { - ret->autorelease(); - return ret; - } - - return nullptr; -} - -GLViewImpl* GLViewImpl::createWithFullScreen(const std::string& viewName) -{ - auto ret = new GLViewImpl(); - if(ret && ret->initWithFullScreen(viewName)) { - ret->autorelease(); - return ret; - } - - return nullptr; -} - -GLViewImpl::GLViewImpl() -{ - -} - -GLViewImpl::~GLViewImpl() -{ - -} - -bool GLViewImpl::initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor) -{ - return true; -} - -bool GLViewImpl::initWithFullScreen(const std::string& viewName) -{ - return true; -} - - -bool GLViewImpl::isOpenGLReady() -{ - return (_screenSize.width != 0 && _screenSize.height != 0); -} - -void GLViewImpl::end() -{ - ui_app_exit(); -} - -void GLViewImpl::swapBuffers() -{ -} - -//============================================================================================ -static Evas_Object * s_keypadWin = nullptr; -static Evas_Object * s_keypadEntry = nullptr; -Ecore_IMF_Context *s_imf = nullptr; - -static void imfEventCommitCallback(void *data, Ecore_IMF_Context *ctx, void *event_info) -{ - auto commit_str = (char *)event_info; - if (commit_str) - { - cocos2d::IMEDispatcher::sharedDispatcher()->dispatchInsertText(commit_str, strlen(commit_str)); - } -} - -static void entryKeyCallback(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - auto keyInfo = (Evas_Event_Key_Up*)event_info; - if (keyInfo->key && !strcmp(keyInfo->key,"BackSpace")) - { - cocos2d::IMEDispatcher::sharedDispatcher()->dispatchDeleteBackward(); - } -} - -static void stateChangedCallback(void *data, Ecore_IMF_Context *ctx, int value) -{ - if (value == ECORE_IMF_INPUT_PANEL_STATE_HIDE) - { - evas_object_del(s_keypadWin); - s_keypadWin = nullptr; - s_imf = nullptr; - } -} - -static void closeKeypad() -{ - ecore_imf_context_input_panel_event_callback_add (s_imf, ECORE_IMF_INPUT_PANEL_STATE_EVENT, stateChangedCallback, NULL); - elm_entry_input_panel_hide(s_keypadEntry); -} - -static void entryActivatedCallback(void *data, Evas_Object *obj, void *event_info) -{ - closeKeypad(); -} - -static void keyPadBackCallback(void *data, Evas_Object *obj, void *event_info) -{ - closeKeypad(); -} - -static void blankAreaClickedCallback(void *data, Evas *e, Evas_Object *obj, void *event_info) -{ - closeKeypad(); -} - -void GLViewImpl::setIMEKeyboardState(bool open) -{ - if (open) - { - if (!s_keypadWin) - { - auto frameSize = Director::getInstance()->getOpenGLView()->getFrameSize(); - auto app = Application::getInstance(); - - s_keypadWin = elm_win_add(app->_win, "cocos2d-x textfield", ELM_WIN_BASIC); - elm_win_autodel_set(s_keypadWin, EINA_TRUE); - elm_win_conformant_set(s_keypadWin, EINA_TRUE); - elm_win_alpha_set(s_keypadWin, EINA_TRUE); - eext_object_event_callback_add(s_keypadWin, EEXT_CALLBACK_BACK, keyPadBackCallback, NULL); - evas_object_show(s_keypadWin); - - int rots[2]; - rots[0] = (int)elm_win_rotation_get(app->_win); - rots[1] = rots[0] + 180 % 360; - elm_win_wm_rotation_available_rotations_set(s_keypadWin, rots, 2); - - auto rectangle = elm_bg_add(s_keypadWin); - evas_object_resize(rectangle, frameSize.width, frameSize.height + 50); - evas_object_color_set(rectangle, 0xff, 0xff, 0xff, 0); - evas_object_move(rectangle, 0, -50); - evas_object_show(rectangle); - - evas_object_repeat_events_set(rectangle, EINA_TRUE); - evas_object_event_callback_add(rectangle, EVAS_CALLBACK_MOUSE_UP, blankAreaClickedCallback, NULL); - evas_object_event_callback_add(rectangle, EVAS_CALLBACK_MULTI_UP, blankAreaClickedCallback, NULL); - - s_keypadEntry = elm_entry_add(rectangle); - elm_entry_single_line_set(s_keypadEntry, EINA_TRUE); - evas_object_resize(s_keypadEntry, frameSize.width, 50); - evas_object_move(s_keypadEntry, 0, -50); - elm_entry_input_panel_return_key_type_set(s_keypadEntry, ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE); - elm_entry_prediction_allow_set(s_keypadEntry, EINA_FALSE); - evas_object_event_callback_add(s_keypadEntry, EVAS_CALLBACK_KEY_UP, entryKeyCallback, NULL); - evas_object_show(s_keypadEntry); - - elm_object_focus_set(s_keypadEntry, EINA_TRUE); - evas_object_smart_callback_add(s_keypadEntry, "activated", entryActivatedCallback, NULL); - elm_entry_input_panel_show(s_keypadEntry); - - s_imf = (Ecore_IMF_Context*)elm_entry_imf_context_get(s_keypadEntry); - ecore_imf_context_event_callback_add(s_imf, ECORE_IMF_CALLBACK_COMMIT, imfEventCommitCallback, s_keypadEntry); - } - } - else if (s_keypadWin) - { - closeKeypad(); - } -} - -NS_CC_END - -#endif // CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN diff --git a/cocos/platform/tizen/CCGLViewImpl-tizen.h b/cocos/platform/tizen/CCGLViewImpl-tizen.h deleted file mode 100644 index b6718aceafcf..000000000000 --- a/cocos/platform/tizen/CCGLViewImpl-tizen.h +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** - Copyright (c) 2014-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - ****************************************************************************/ - -#ifndef __CC_EGLVIEWIMPL_TIZEN_H__ -#define __CC_EGLVIEWIMPL_TIZEN_H__ - -#include "platform/CCPlatformConfig.h" -#if CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN - -#include "platform/CCGLView.h" - -NS_CC_BEGIN - -class CC_DLL GLViewImpl : public GLView -{ -public: - - // static function - static GLViewImpl* create(const std::string &viewname); - static GLViewImpl* createWithRect(const std::string& viewName, Rect rect, float frameZoomFactor = 1.0f); - static GLViewImpl* createWithFullScreen(const std::string& viewName); - - bool isOpenGLReady() override; - void end() override; - void swapBuffers() override; - void setIMEKeyboardState(bool bOpen) override; - -protected: - GLViewImpl(); - virtual ~GLViewImpl(); - - bool initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor); - bool initWithFullScreen(const std::string& viewName); -}; - -NS_CC_END - -#endif // CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN - -#endif // end of __CC_EGLVIEWIMPL_TIZEN_H__ diff --git a/cocos/platform/tizen/CCPlatformDefine-tizen.h b/cocos/platform/tizen/CCPlatformDefine-tizen.h deleted file mode 100644 index acf92853af49..000000000000 --- a/cocos/platform/tizen/CCPlatformDefine-tizen.h +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** - Copyright (c) 2014-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - ****************************************************************************/ - -#ifndef __CCPLATFORMDEFINE_H__ -#define __CCPLATFORMDEFINE_H__ - -#include "platform/CCPlatformConfig.h" -#if CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN - -#include - -#define CC_DLL - -#include -#define CC_ASSERT(cond) assert(cond) -#define CC_UNUSED_PARAM(unusedparam) (void)unusedparam - -/* Define NULL pointer value */ -#ifndef NULL -#ifdef __cplusplus -#define NULL 0 -#else -#define NULL ((void *)0) -#endif -#endif - - -#endif // CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN - -#endif /* __CCPLATFORMDEFINE_H__*/ diff --git a/cocos/platform/tizen/CCStdC-tizen.cpp b/cocos/platform/tizen/CCStdC-tizen.cpp deleted file mode 100644 index 330f0d401b24..000000000000 --- a/cocos/platform/tizen/CCStdC-tizen.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** - Copyright (c) 2014-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - ****************************************************************************/ - -#include "platform/CCPlatformConfig.h" -#if CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN - -#include "platform/tizen/CCStdC-tizen.h" - -#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) - -int CC_DLL gettimeofday(struct timeval * val, struct timezone *) -{ - if (val) - { - SYSTEMTIME wtm; - GetLocalTime(&wtm); - - struct tm tTm; - tTm.tm_year = wtm.wYear - 1900; - tTm.tm_mon = wtm.wMonth - 1; - tTm.tm_mday = wtm.wDay; - tTm.tm_hour = wtm.wHour; - tTm.tm_min = wtm.wMinute; - tTm.tm_sec = wtm.wSecond; - tTm.tm_isdst = -1; - - val->tv_sec = (long)mktime(&tTm); // time_t is 64-bit on win32 - val->tv_usec = wtm.wMilliseconds * 1000; - } - return 0; -} -#elif (CC_TARGET_PLATFORM == CC_PLATFORM_BADA) - -using namespace Osp::System; - -int CC_DLL gettimeofday(struct timeval * val, struct timezone *) -{ - if (val) - { - long long curTick = 0; - SystemTime::GetTicks(curTick); - unsigned int ms = curTick; - val->tv_sec = ms / 1000; - val->tv_usec = (ms % 1000) * 1000; - } - return 0; -} - -#endif // CC_PLATFORM_WIN32 - -#endif // CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN diff --git a/cocos/platform/tizen/CCStdC-tizen.h b/cocos/platform/tizen/CCStdC-tizen.h deleted file mode 100644 index e553ece8c9bb..000000000000 --- a/cocos/platform/tizen/CCStdC-tizen.h +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** - Copyright (c) 2014-2016 Chukong Technologies Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - ****************************************************************************/ - -#ifndef __CC_STD_C_H__ -#define __CC_STD_C_H__ - -#include "platform/CCPlatformConfig.h" -#if CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN - -#include "platform/CCPlatformMacros.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef MIN -#define MIN(x,y) (((x) > (y)) ? (y) : (x)) -#endif // MIN - -#ifndef MAX -#define MAX(x,y) (((x) < (y)) ? (y) : (x)) -#endif // MAX - -#endif // CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN - -#endif // __CC_STD_C_H__ diff --git a/cocos/platform/win32/CCApplication-win32.cpp b/cocos/platform/win32/CCApplication-win32.cpp index ab5f918cc4e4..e289fa6854bb 100644 --- a/cocos/platform/win32/CCApplication-win32.cpp +++ b/cocos/platform/win32/CCApplication-win32.cpp @@ -151,11 +151,6 @@ void Application::setAnimationInterval(float interval) _animationInterval.QuadPart = (LONGLONG)(interval * freq.QuadPart); } -void Application::setAnimationInterval(float interval, SetIntervalReason reason) -{ - setAnimationInterval(interval); -} - ////////////////////////////////////////////////////////////////////////// // static member function ////////////////////////////////////////////////////////////////////////// @@ -324,7 +319,7 @@ void Application::setResourceRootPath(const std::string& rootResDir) pFileUtils->setSearchPaths(searchPaths); } -const std::string& Application::getResourceRootPath(void) +const std::string& Application::getResourceRootPath() { return _resourceRootPath; } diff --git a/cocos/platform/win32/CCApplication-win32.h b/cocos/platform/win32/CCApplication-win32.h index 4b890b107dba..b5f2acbc56a4 100644 --- a/cocos/platform/win32/CCApplication-win32.h +++ b/cocos/platform/win32/CCApplication-win32.h @@ -67,7 +67,6 @@ class CC_DLL Application : public ApplicationProtocol /* override functions */ virtual void setAnimationInterval(float interval) override; - virtual void setAnimationInterval(float interval, SetIntervalReason reason) override; virtual LanguageType getCurrentLanguage(); @@ -100,11 +99,11 @@ class CC_DLL Application : public ApplicationProtocol * Gets the Resource root path. * @deprecated Please use FileUtils::getInstance()->getSearchPaths() instead. */ - CC_DEPRECATED_ATTRIBUTE const std::string& getResourceRootPath(void); + CC_DEPRECATED_ATTRIBUTE const std::string& getResourceRootPath(); void setStartupScriptFilename(const std::string& startupScriptFile); - const std::string& getStartupScriptFilename(void) + const std::string& getStartupScriptFilename() { return _startupScriptFilename; } diff --git a/cocos/platform/win32/CCCommon-win32.cpp b/cocos/platform/win32/CCCommon-win32.cpp index c3b97c1bddf0..344676c51f35 100644 --- a/cocos/platform/win32/CCCommon-win32.cpp +++ b/cocos/platform/win32/CCCommon-win32.cpp @@ -35,7 +35,7 @@ NS_CC_BEGIN #define MAX_LEN (cocos2d::kMaxLogLen + 1) -void MessageBox(const char * pszMsg, const char * pszTitle) +void ccMessageBox(const char * pszMsg, const char * pszTitle) { std::wstring wsMsg = cocos2d::StringUtf8ToWideChar(pszMsg); std::wstring wsTitle = cocos2d::StringUtf8ToWideChar(pszTitle); diff --git a/cocos/platform/win32/CCDevice-win32.cpp b/cocos/platform/win32/CCDevice-win32.cpp index c0ab398b0a54..47a3a5a43608 100644 --- a/cocos/platform/win32/CCDevice-win32.cpp +++ b/cocos/platform/win32/CCDevice-win32.cpp @@ -31,6 +31,8 @@ THE SOFTWARE. #include "platform/CCFileUtils.h" #include "platform/CCStdC.h" +#include + NS_CC_BEGIN int Device::getDPI() @@ -171,12 +173,12 @@ class BitmapDC if (fontPath.size() > 0) { _curFontPath = fontPath; - wchar_t * pwszBuffer = utf8ToUtf16(_curFontPath); + wchar_t * pwszBuffer = utf8ToUtf16(fontPath); if (pwszBuffer) { if (AddFontResource(pwszBuffer)) { - SendMessage(_wnd, WM_FONTCHANGE, 0, 0); + PostMessage(_wnd, WM_FONTCHANGE, 0, 0); } delete[] pwszBuffer; pwszBuffer = nullptr; @@ -218,7 +220,7 @@ class BitmapDC CC_BREAK_IF(!pszText || nLen <= 0); RECT rc = { 0, 0, 0, 0 }; - DWORD dwCalcFmt = DT_CALCRECT; + DWORD dwCalcFmt = DT_CALCRECT | DT_NOPREFIX; if (!enableWrap) { dwCalcFmt |= DT_SINGLELINE; @@ -298,12 +300,11 @@ class BitmapDC { int nRet = 0; wchar_t * pwszBuffer = nullptr; - wchar_t* fixedText = nullptr; do { CC_BREAK_IF(!pszText); - DWORD dwFmt = DT_WORDBREAK; + DWORD dwFmt = DT_WORDBREAK | DT_NOPREFIX; if (!enableWrap) { dwFmt |= DT_SINGLELINE; } @@ -332,37 +333,7 @@ class BitmapDC memset(pwszBuffer, 0, sizeof(wchar_t)*nBufLen); nLen = MultiByteToWideChar(CP_UTF8, 0, pszText, nLen, pwszBuffer, nBufLen); - if (strchr(pszText, '&')) - { - fixedText = new wchar_t[nLen * 2 + 1]; - int fixedIndex = 0; - for (int index = 0; index < nLen; ++index) - { - if (pwszBuffer[index] == '&') - { - fixedText[fixedIndex] = '&'; - fixedText[fixedIndex + 1] = '&'; - fixedIndex += 2; - } - else - { - fixedText[fixedIndex] = pwszBuffer[index]; - fixedIndex += 1; - } - } - fixedText[fixedIndex] = '\0'; - nLen = fixedIndex; - } - - SIZE newSize; - if (fixedText) - { - newSize = sizeWithText(fixedText, nLen, dwFmt, fontName, textSize, tSize.cx, tSize.cy, enableWrap, overflow); - } - else - { - newSize = sizeWithText(pwszBuffer, nLen, dwFmt, fontName, textSize, tSize.cx, tSize.cy, enableWrap, overflow); - } + SIZE newSize = sizeWithText(pwszBuffer, nLen, dwFmt, fontName, textSize, tSize.cx, tSize.cy, enableWrap, overflow); RECT rcText = { 0 }; // if content width is 0, use text size as content size @@ -429,20 +400,12 @@ class BitmapDC SetTextColor(_DC, RGB(255, 255, 255)); // white color // draw text - if (fixedText) - { - nRet = DrawTextW(_DC, fixedText, nLen, &rcText, dwFmt); - } - else - { - nRet = DrawTextW(_DC, pwszBuffer, nLen, &rcText, dwFmt); - } + nRet = DrawTextW(_DC, pwszBuffer, nLen, &rcText, dwFmt); SelectObject(_DC, hOldBmp); SelectObject(_DC, hOldFont); } while (0); CC_SAFE_DELETE_ARRAY(pwszBuffer); - delete[] fixedText; return nRet; } @@ -471,7 +434,7 @@ class BitmapDC if (pwszBuffer) { RemoveFontResource(pwszBuffer); - SendMessage(_wnd, WM_FONTCHANGE, 0, 0); + PostMessage(_wnd, WM_FONTCHANGE, 0, 0); delete[] pwszBuffer; pwszBuffer = nullptr; } @@ -558,4 +521,4 @@ void Device::vibrate(float duration) NS_CC_END -#endif // CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 \ No newline at end of file +#endif // CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 diff --git a/cocos/platform/win32/CCFileUtils-win32.cpp b/cocos/platform/win32/CCFileUtils-win32.cpp index 42480c2c50f5..d0cc12ebae8e 100644 --- a/cocos/platform/win32/CCFileUtils-win32.cpp +++ b/cocos/platform/win32/CCFileUtils-win32.cpp @@ -36,6 +36,9 @@ THE SOFTWARE. #include #include +#include +#include + using namespace std; #define DECLARE_GUARD std::lock_guard mutexGuard(_mutex) @@ -104,7 +107,7 @@ bool FileUtilsWin32::init() { DECLARE_GUARD; _checkPath(); - _defaultResRootPath = s_resourcePath; + _defaultResRootPath = s_resourcePath + "Resources/"; return FileUtils::init(); } @@ -217,12 +220,12 @@ std::string FileUtilsWin32::getPathForFilename(const std::string& filename, cons return FileUtils::getPathForFilename(unixFileName, unixResolutionDirectory, unixSearchPath); } -std::string FileUtilsWin32::getFullPathForDirectoryAndFilename(const std::string& strDirectory, const std::string& strFilename) const +std::string FileUtilsWin32::getFullPathForFilenameWithinDirectory(const std::string& strDirectory, const std::string& strFilename) const { std::string unixDirectory = convertPathFormatToUnixStyle(strDirectory); std::string unixFilename = convertPathFormatToUnixStyle(strFilename); - return FileUtils::getFullPathForDirectoryAndFilename(unixDirectory, unixFilename); + return FileUtils::getFullPathForFilenameWithinDirectory(unixDirectory, unixFilename); } void FileUtilsWin32::listFilesRecursively(const std::string& dirPath, std::vector *files) const @@ -271,9 +274,19 @@ void FileUtilsWin32::listFilesRecursively(const std::string& dirPath, std::vecto } } +long FileUtilsWin32::getFileSize(const std::string &filepath) const +{ + struct _stat tmp; + if (_stat(filepath.c_str(), &tmp) == 0) + { + return (long)tmp.st_size; + } + return 0; +} + std::vector FileUtilsWin32::listFiles(const std::string& dirPath) const { - std::string fullpath = fullPathForFilename(dirPath); + std::string fullpath = fullPathForDirectory(dirPath); std::vector files; if (isDirectoryExist(fullpath)) { diff --git a/cocos/platform/win32/CCFileUtils-win32.h b/cocos/platform/win32/CCFileUtils-win32.h index 8c11b14609ec..d1c2fccbef10 100644 --- a/cocos/platform/win32/CCFileUtils-win32.h +++ b/cocos/platform/win32/CCFileUtils-win32.h @@ -112,6 +112,8 @@ class CC_DLL FileUtilsWin32 : public FileUtils virtual FileUtils::Status getContents(const std::string& filename, ResizableBuffer* buffer) const override; + virtual long getFileSize(const std::string &filepath) const override; + /** * Gets full path for filename, resolution directory and search path. * @@ -132,7 +134,7 @@ class CC_DLL FileUtilsWin32 : public FileUtils * @param filename The name of the file. * @return The full path of the file, if the file can't be found, it will return an empty string. */ - virtual std::string getFullPathForDirectoryAndFilename(const std::string& directory, const std::string& filename) const override; + virtual std::string getFullPathForFilenameWithinDirectory(const std::string& directory, const std::string& filename) const override; /** * List all files in a directory. diff --git a/cocos/platform/win32/CCStdC-win32.h b/cocos/platform/win32/CCStdC-win32.h index 98ba8641d0a5..088dae43d474 100644 --- a/cocos/platform/win32/CCStdC-win32.h +++ b/cocos/platform/win32/CCStdC-win32.h @@ -97,12 +97,12 @@ typedef SSIZE_T ssize_t; #ifndef NOMINMAX #define NOMINMAX #endif -// Structure timeval has define in winsock.h, include windows.h for it. -#include #ifndef __MINGW32__ #include +// Structure timeval has define in winsock.h, include windows.h for it. +#include NS_CC_BEGIN @@ -120,6 +120,7 @@ NS_CC_END #undef _WINSOCKAPI_ #include +#include // Conflicted with math.h isnan #include @@ -139,11 +140,6 @@ inline errno_t strcpy_s(char *strDestination, size_t numberOfElements, #endif #endif // __MINGW32__ -// Conflicted with cocos2d::MessageBox, so we need to undef it. -#ifdef MessageBox -#undef MessageBox -#endif - // Conflicted with ParticleSystem::PositionType::RELATIVE, so we need to undef it. #ifdef RELATIVE #undef RELATIVE diff --git a/cocos/platform/win8.1-universal/Cocos2dRenderer.cpp b/cocos/platform/win8.1-universal/Cocos2dRenderer.cpp deleted file mode 100644 index 89b709088f4f..000000000000 --- a/cocos/platform/win8.1-universal/Cocos2dRenderer.cpp +++ /dev/null @@ -1,153 +0,0 @@ -/* -* cocos2d-x http://www.cocos2d-x.org -* -* Copyright (c) 2010-2014 - cocos2d-x community -* Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. -* -* Portions Copyright (c) Microsoft Open Technologies, Inc. -* All Rights Reserved -* -* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and limitations under the License. -*/ - -#include "Cocos2dRenderer.h" -#include "AppDelegate.h" -#include "platform/winrt/CCGLViewImpl-winrt.h" -#include "platform/CCApplication.h" -#include "renderer/CCTextureCache.h" - -// These are used by the shader compilation methods. -#include -#include -#include - -using namespace Platform; -using namespace Windows::UI::Core; -using namespace Windows::UI::Xaml::Controls; -using namespace Windows::Graphics::Display; -using namespace cocos2d; - -Cocos2dRenderer::Cocos2dRenderer(int width, int height, float dpi, DisplayOrientations orientation, CoreDispatcher^ dispatcher, Panel^ panel) - : m_app(nullptr) - , m_width(width) - , m_height(height) - , m_dpi(dpi) - , m_dispatcher(dispatcher) - , m_panel(panel) - , m_orientation(orientation) -{ - m_app = new AppDelegate(); -} - -Cocos2dRenderer::~Cocos2dRenderer() -{ - delete m_app; -} - -void Cocos2dRenderer::Resume() -{ - auto director = cocos2d::Director::getInstance(); - auto glview = director->getOpenGLView(); - - if (!glview) - { - GLViewImpl* glview = GLViewImpl::create("Test Cpp"); - glview->setDispatcher(m_dispatcher.Get()); - glview->setPanel(m_panel.Get()); - glview->Create(static_cast(m_width), static_cast(m_height), m_dpi, m_orientation); - director->setOpenGLView(glview); - CCApplication::getInstance()->run(); - } - else - { - Application::getInstance()->applicationWillEnterForeground(); - cocos2d::EventCustom foregroundEvent(EVENT_COME_TO_FOREGROUND); - cocos2d::Director::getInstance()->getEventDispatcher()->dispatchEvent(&foregroundEvent); - } -} - -void Cocos2dRenderer::Pause() -{ - if (Director::getInstance()->getOpenGLView()) { - Application::getInstance()->applicationDidEnterBackground(); - cocos2d::EventCustom backgroundEvent(EVENT_COME_TO_BACKGROUND); - cocos2d::Director::getInstance()->getEventDispatcher()->dispatchEvent(&backgroundEvent); - } -} - -bool Cocos2dRenderer::AppShouldExit() -{ - return GLViewImpl::sharedOpenGLView()->AppShouldExit(); -} - -void Cocos2dRenderer::DeviceLost() -{ - Pause(); - - auto director = cocos2d::Director::getInstance(); - if (director->getOpenGLView()) { - cocos2d::GL::invalidateStateCache(); - cocos2d::GLProgramCache::getInstance()->reloadDefaultGLPrograms(); - cocos2d::DrawPrimitives::init(); - cocos2d::VolatileTextureMgr::reloadAllTextures(); - - cocos2d::EventCustom recreatedEvent(EVENT_RENDERER_RECREATED); - director->getEventDispatcher()->dispatchEvent(&recreatedEvent); - director->setGLDefaultValues(); - - Application::getInstance()->applicationWillEnterForeground(); - cocos2d::EventCustom foregroundEvent(EVENT_COME_TO_FOREGROUND); - cocos2d::Director::getInstance()->getEventDispatcher()->dispatchEvent(&foregroundEvent); - } -} - - - -void Cocos2dRenderer::Draw(GLsizei width, GLsizei height, float dpi, DisplayOrientations orientation) -{ - auto glView = GLViewImpl::sharedOpenGLView(); - - if (orientation != m_orientation) - { - m_orientation = orientation; - glView->UpdateOrientation(orientation); - } - - if (width != m_width || height != m_height) - { - m_width = width; - m_height = height; - glView->UpdateForWindowSizeChange(static_cast(width), static_cast(height)); - } - - if (dpi != m_dpi) - { - m_dpi = dpi; - glView->SetDPI(m_dpi); - } - - glView->ProcessEvents(); - glView->Render(); -} - -void Cocos2dRenderer::QueuePointerEvent(cocos2d::PointerEventType type, Windows::UI::Core::PointerEventArgs^ args) -{ - GLViewImpl::sharedOpenGLView()->QueuePointerEvent(type, args); -} - -void Cocos2dRenderer::QueueBackButtonEvent() -{ - GLViewImpl::sharedOpenGLView()->QueueBackKeyPress(); -} - -void Cocos2dRenderer::QueueKeyboardEvent(WinRTKeyboardEventType type, Windows::UI::Core::KeyEventArgs^ args) -{ - GLViewImpl::sharedOpenGLView()->QueueWinRTKeyboardEvent(type, args); -} diff --git a/cocos/platform/win8.1-universal/Cocos2dRenderer.h b/cocos/platform/win8.1-universal/Cocos2dRenderer.h deleted file mode 100644 index 871452962453..000000000000 --- a/cocos/platform/win8.1-universal/Cocos2dRenderer.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -* cocos2d-x http://www.cocos2d-x.org -* -* Copyright (c) 2010-2014 - cocos2d-x community -* Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. -* -* Portions Copyright (c) Microsoft Open Technologies, Inc. -* All Rights Reserved -* -* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and limitations under the License. -*/ -#pragma once - -#include - - - - -class AppDelegate; - -class Cocos2dRenderer -{ -public: - Cocos2dRenderer(int width, int height, float dpi, - Windows::Graphics::Display::DisplayOrientations orientation, - Windows::UI::Core::CoreDispatcher^ dispatcher, Windows::UI::Xaml::Controls::Panel^ panel); - ~Cocos2dRenderer(); - void Draw(GLsizei width, GLsizei height, float dpi, Windows::Graphics::Display::DisplayOrientations orientation); - void QueuePointerEvent(cocos2d::PointerEventType type, Windows::UI::Core::PointerEventArgs^ args); - void QueueKeyboardEvent(cocos2d::WinRTKeyboardEventType type, Windows::UI::Core::KeyEventArgs^ args); - void QueueBackButtonEvent(); - void Pause(); - void Resume(); - void DeviceLost(); - bool AppShouldExit(); - -private: - - int m_width; - int m_height; - float m_dpi; - - // The AppDelegate for the Cocos2D app - AppDelegate* m_app; - Platform::Agile m_dispatcher; - Platform::Agile m_panel; - Windows::Graphics::Display::DisplayOrientations m_orientation; -}; diff --git a/cocos/platform/win8.1-universal/OpenGLES.cpp b/cocos/platform/win8.1-universal/OpenGLES.cpp deleted file mode 100644 index e1cda61ebe0d..000000000000 --- a/cocos/platform/win8.1-universal/OpenGLES.cpp +++ /dev/null @@ -1,256 +0,0 @@ -/* -* cocos2d-x http://www.cocos2d-x.org -* -* Copyright (c) 2010-2014 - cocos2d-x community -* Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. -* -* Portions Copyright (c) Microsoft Open Technologies, Inc. -* All Rights Reserved -* -* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and limitations under the License. -*/ - -#include "OpenGLES.h" -using namespace Platform; -using namespace Windows::UI::Xaml::Controls; -using namespace Windows::Foundation; -using namespace Windows::Foundation::Collections; - -OpenGLES::OpenGLES() : - mEglDisplay(EGL_NO_DISPLAY), - mEglContext(EGL_NO_CONTEXT), - mEglConfig(nullptr) -{ - Initialize(); -} - -OpenGLES::~OpenGLES() -{ - Cleanup(); -} - -void OpenGLES::Initialize() -{ - const EGLint configAttributes[] = - { - EGL_RED_SIZE, 8, - EGL_GREEN_SIZE, 8, - EGL_BLUE_SIZE, 8, - EGL_ALPHA_SIZE, 8, - EGL_DEPTH_SIZE, 8, - EGL_STENCIL_SIZE, 8, - EGL_NONE - }; - - const EGLint contextAttributes[] = - { - EGL_CONTEXT_CLIENT_VERSION, 2, - EGL_NONE - }; - - const EGLint defaultDisplayAttributes[] = - { - // These are the default display attributes, used to request ANGLE's D3D11 renderer. - // eglInitialize will only succeed with these attributes if the hardware supports D3D11 Feature Level 10_0+. - EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, - - // EGL_ANGLE_DISPLAY_ALLOW_RENDER_TO_BACK_BUFFER is an optimization that can have large performance benefits on mobile devices. - // Its syntax is subject to change, though. Please update your Visual Studio templates if you experience compilation issues with it. - EGL_ANGLE_DISPLAY_ALLOW_RENDER_TO_BACK_BUFFER, EGL_TRUE, - - // EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE is an option that enables ANGLE to automatically call - // the IDXGIDevice3::Trim method on behalf of the application when it gets suspended. - // Calling IDXGIDevice3::Trim when an application is suspended is a Windows Store application certification requirement. - EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE, EGL_TRUE, - EGL_NONE, - }; - - const EGLint fl9_3DisplayAttributes[] = - { - // These can be used to request ANGLE's D3D11 renderer, with D3D11 Feature Level 9_3. - // These attributes are used if the call to eglInitialize fails with the default display attributes. - EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, - EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE, 9, - EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE, 3, - EGL_ANGLE_DISPLAY_ALLOW_RENDER_TO_BACK_BUFFER, EGL_TRUE, - EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE, EGL_TRUE, - EGL_NONE, - }; - - const EGLint warpDisplayAttributes[] = - { - // These attributes can be used to request D3D11 WARP. - // They are used if eglInitialize fails with both the default display attributes and the 9_3 display attributes. - EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, - EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE, - EGL_ANGLE_DISPLAY_ALLOW_RENDER_TO_BACK_BUFFER, EGL_TRUE, - EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE, EGL_TRUE, - EGL_NONE, - }; - - EGLConfig config = NULL; - - // eglGetPlatformDisplayEXT is an alternative to eglGetDisplay. It allows us to pass in display attributes, used to configure D3D11. - PFNEGLGETPLATFORMDISPLAYEXTPROC eglGetPlatformDisplayEXT = reinterpret_cast(eglGetProcAddress("eglGetPlatformDisplayEXT")); - if (!eglGetPlatformDisplayEXT) - { - throw Exception::CreateException(E_FAIL, L"Failed to get function eglGetPlatformDisplayEXT"); - } - - // - // To initialize the display, we make three sets of calls to eglGetPlatformDisplayEXT and eglInitialize, with varying - // parameters passed to eglGetPlatformDisplayEXT: - // 1) The first calls uses "defaultDisplayAttributes" as a parameter. This corresponds to D3D11 Feature Level 10_0+. - // 2) If eglInitialize fails for step 1 (e.g. because 10_0+ isn't supported by the default GPU), then we try again - // using "fl9_3DisplayAttributes". This corresponds to D3D11 Feature Level 9_3. - // 3) If eglInitialize fails for step 2 (e.g. because 9_3+ isn't supported by the default GPU), then we try again - // using "warpDisplayAttributes". This corresponds to D3D11 Feature Level 11_0 on WARP, a D3D11 software rasterizer. - // - - // This tries to initialize EGL to D3D11 Feature Level 10_0+. See above comment for details. - mEglDisplay = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, defaultDisplayAttributes); - if (mEglDisplay == EGL_NO_DISPLAY) - { - throw Exception::CreateException(E_FAIL, L"Failed to get EGL display"); - } - - if (eglInitialize(mEglDisplay, NULL, NULL) == EGL_FALSE) - { - // This tries to initialize EGL to D3D11 Feature Level 9_3, if 10_0+ is unavailable (e.g. on some mobile devices). - mEglDisplay = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, fl9_3DisplayAttributes); - if (mEglDisplay == EGL_NO_DISPLAY) - { - throw Exception::CreateException(E_FAIL, L"Failed to get EGL display"); - } - - if (eglInitialize(mEglDisplay, NULL, NULL) == EGL_FALSE) - { - // This initializes EGL to D3D11 Feature Level 11_0 on WARP, if 9_3+ is unavailable on the default GPU. - mEglDisplay = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, warpDisplayAttributes); - if (mEglDisplay == EGL_NO_DISPLAY) - { - throw Exception::CreateException(E_FAIL, L"Failed to get EGL display"); - } - - if (eglInitialize(mEglDisplay, NULL, NULL) == EGL_FALSE) - { - // If all of the calls to eglInitialize returned EGL_FALSE then an error has occurred. - throw Exception::CreateException(E_FAIL, L"Failed to initialize EGL"); - } - } - } - - EGLint numConfigs = 0; - if ((eglChooseConfig(mEglDisplay, configAttributes, &mEglConfig, 1, &numConfigs) == EGL_FALSE) || (numConfigs == 0)) - { - throw Exception::CreateException(E_FAIL, L"Failed to choose first EGLConfig"); - } - - mEglContext = eglCreateContext(mEglDisplay, mEglConfig, EGL_NO_CONTEXT, contextAttributes); - if (mEglContext == EGL_NO_CONTEXT) - { - throw Exception::CreateException(E_FAIL, L"Failed to create EGL context"); - } -} - -void OpenGLES::Cleanup() -{ - if (mEglDisplay != EGL_NO_DISPLAY && mEglContext != EGL_NO_CONTEXT) - { - eglDestroyContext(mEglDisplay, mEglContext); - mEglContext = EGL_NO_CONTEXT; - } - - if (mEglDisplay != EGL_NO_DISPLAY) - { - eglTerminate(mEglDisplay); - mEglDisplay = EGL_NO_DISPLAY; - } -} - -void OpenGLES::Reset() -{ - Cleanup(); - Initialize(); -} - -EGLSurface OpenGLES::CreateSurface(SwapChainPanel^ panel, const Size* renderSurfaceSize, const float* resolutionScale) -{ - if (!panel) - { - throw Exception::CreateException(E_INVALIDARG, L"SwapChainPanel parameter is invalid"); - } - - if (renderSurfaceSize != nullptr && resolutionScale != nullptr) - { - throw Exception::CreateException(E_INVALIDARG, L"A size and a scale can't both be specified"); - } - - EGLSurface surface = EGL_NO_SURFACE; - - const EGLint surfaceAttributes[] = - { - // EGL_ANGLE_SURFACE_RENDER_TO_BACK_BUFFER is part of the same optimization as EGL_ANGLE_DISPLAY_ALLOW_RENDER_TO_BACK_BUFFER (see above). - // If you have compilation issues with it then please update your Visual Studio templates. - EGL_ANGLE_SURFACE_RENDER_TO_BACK_BUFFER, EGL_TRUE, - EGL_NONE - }; - - // Create a PropertySet and initialize with the EGLNativeWindowType. - PropertySet^ surfaceCreationProperties = ref new PropertySet(); - surfaceCreationProperties->Insert(ref new String(EGLNativeWindowTypeProperty), panel); - - // If a render surface size is specified, add it to the surface creation properties - if (renderSurfaceSize != nullptr) - { - surfaceCreationProperties->Insert(ref new String(EGLRenderSurfaceSizeProperty), PropertyValue::CreateSize(*renderSurfaceSize)); - } - - // If a resolution scale is specified, add it to the surface creation properties - if (resolutionScale != nullptr) - { - surfaceCreationProperties->Insert(ref new String(EGLRenderResolutionScaleProperty), PropertyValue::CreateSingle(*resolutionScale)); - } - - surface = eglCreateWindowSurface(mEglDisplay, mEglConfig, reinterpret_cast(surfaceCreationProperties), surfaceAttributes); - if (surface == EGL_NO_SURFACE) - { - throw Exception::CreateException(E_FAIL, L"Failed to create EGL surface"); - } - - return surface; -} - -void OpenGLES::GetSurfaceDimensions(const EGLSurface surface, EGLint* width, EGLint* height) -{ - eglQuerySurface(mEglDisplay, surface, EGL_WIDTH, width); - eglQuerySurface(mEglDisplay, surface, EGL_HEIGHT, height); -} - -void OpenGLES::DestroySurface(const EGLSurface surface) -{ - if (mEglDisplay != EGL_NO_DISPLAY && surface != EGL_NO_SURFACE) - { - eglDestroySurface(mEglDisplay, surface); - } -} - -void OpenGLES::MakeCurrent(const EGLSurface surface) -{ - if (eglMakeCurrent(mEglDisplay, surface, surface, mEglContext) == EGL_FALSE) - { - throw Exception::CreateException(E_FAIL, L"Failed to make EGLSurface current"); - } -} - -EGLBoolean OpenGLES::SwapBuffers(const EGLSurface surface) -{ - return (eglSwapBuffers(mEglDisplay, surface)); -} diff --git a/cocos/platform/win8.1-universal/OpenGLES.h b/cocos/platform/win8.1-universal/OpenGLES.h deleted file mode 100644 index c157ffabd06f..000000000000 --- a/cocos/platform/win8.1-universal/OpenGLES.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -* cocos2d-x http://www.cocos2d-x.org -* -* Copyright (c) 2010-2014 - cocos2d-x community -* Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. -* -* Portions Copyright (c) Microsoft Open Technologies, Inc. -* All Rights Reserved -* -* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and limitations under the License. -*/ - -#pragma once - -// OpenGL ES includes -#include - -// EGL includes -#include -#include -#include -#include - -class OpenGLES -{ -public: - OpenGLES(); - ~OpenGLES(); - - EGLSurface CreateSurface(Windows::UI::Xaml::Controls::SwapChainPanel^ panel, const Windows::Foundation::Size* renderSurfaceSize, const float* renderResolutionScale); - void GetSurfaceDimensions(const EGLSurface surface, EGLint *width, EGLint *height); - void DestroySurface(const EGLSurface surface); - void MakeCurrent(const EGLSurface surface); - EGLBoolean SwapBuffers(const EGLSurface surface); - void Reset(); - void Cleanup(); - -private: - void Initialize(); - -private: - EGLDisplay mEglDisplay; - EGLContext mEglContext; - EGLConfig mEglConfig; -}; diff --git a/cocos/platform/win8.1-universal/OpenGLESPage.xaml b/cocos/platform/win8.1-universal/OpenGLESPage.xaml deleted file mode 100644 index b59232a2fa6f..000000000000 --- a/cocos/platform/win8.1-universal/OpenGLESPage.xaml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - diff --git a/cocos/platform/win8.1-universal/OpenGLESPage.xaml.cpp b/cocos/platform/win8.1-universal/OpenGLESPage.xaml.cpp deleted file mode 100644 index e0d4ab2b887a..000000000000 --- a/cocos/platform/win8.1-universal/OpenGLESPage.xaml.cpp +++ /dev/null @@ -1,469 +0,0 @@ -/* -* cocos2d-x http://www.cocos2d-x.org -* -* Copyright (c) 2010-2014 - cocos2d-x community -* Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. -* -* Portions Copyright (c) Microsoft Open Technologies, Inc. -* All Rights Reserved -* -* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and limitations under the License. -*/ - -#include "App.xaml.h" -#include "OpenGLESPage.xaml.h" - -using namespace CocosAppWinRT; -using namespace cocos2d; -using namespace Platform; -using namespace Concurrency; -using namespace Windows::Foundation; -using namespace Windows::Graphics::Display; -using namespace Windows::System::Threading; -using namespace Windows::UI::Core; -using namespace Windows::UI::Input; -using namespace Windows::UI::Xaml; -using namespace Windows::UI::Xaml::Controls; -using namespace Windows::UI::Xaml::Controls::Primitives; -using namespace Windows::UI::Xaml::Data; -using namespace Windows::UI::Xaml::Input; -using namespace Windows::UI::Xaml::Media; -using namespace Windows::UI::Xaml::Navigation; - -#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) || _MSC_VER >= 1900 -using namespace Windows::Phone::UI::Input; -#endif - -OpenGLESPage::OpenGLESPage() : - OpenGLESPage(nullptr) -{ - -} - -OpenGLESPage::OpenGLESPage(OpenGLES* openGLES) : - mOpenGLES(openGLES), - mRenderSurface(EGL_NO_SURFACE), - mCoreInput(nullptr), - mDpi(0.0f), - mDeviceLost(false), - mCursorVisible(true), - mVisible(false), - mOrientation(DisplayOrientations::Landscape) -{ - InitializeComponent(); - - Windows::UI::Core::CoreWindow^ window = Windows::UI::Xaml::Window::Current->CoreWindow; - - window->VisibilityChanged += - ref new Windows::Foundation::TypedEventHandler(this, &OpenGLESPage::OnVisibilityChanged); - - window->KeyDown += ref new TypedEventHandler(this, &OpenGLESPage::OnKeyPressed); - - window->KeyUp += ref new TypedEventHandler(this, &OpenGLESPage::OnKeyReleased); - - window->CharacterReceived += ref new TypedEventHandler(this, &OpenGLESPage::OnCharacterReceived); - - - DisplayInformation^ currentDisplayInformation = DisplayInformation::GetForCurrentView(); - - currentDisplayInformation->OrientationChanged += - ref new TypedEventHandler(this, &OpenGLESPage::OnOrientationChanged); - - mOrientation = currentDisplayInformation->CurrentOrientation; - - this->Loaded += - ref new Windows::UI::Xaml::RoutedEventHandler(this, &OpenGLESPage::OnPageLoaded); - -#if _MSC_VER >= 1900 - if (Windows::Foundation::Metadata::ApiInformation::IsTypePresent("Windows.UI.ViewManagement.StatusBar")) - { - Windows::UI::ViewManagement::StatusBar::GetForCurrentView()->HideAsync(); - } - - if (Windows::Foundation::Metadata::ApiInformation::IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")) - { - HardwareButtons::BackPressed += ref new EventHandler(this, &OpenGLESPage::OnBackButtonPressed); - } -#else -#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) - Windows::UI::ViewManagement::StatusBar::GetForCurrentView()->HideAsync(); - HardwareButtons::BackPressed += ref new EventHandler(this, &OpenGLESPage::OnBackButtonPressed); -#else - // Disable all pointer visual feedback for better performance when touching. - // This is not supported on Windows Phone applications. - auto pointerVisualizationSettings = Windows::UI::Input::PointerVisualizationSettings::GetForCurrentView(); - pointerVisualizationSettings->IsContactFeedbackEnabled = false; - pointerVisualizationSettings->IsBarrelButtonFeedbackEnabled = false; -#endif -#endif - - CreateInput(); -} - -void OpenGLESPage::CreateInput() -{ - // Register our SwapChainPanel to get independent input pointer events - auto workItemHandler = ref new WorkItemHandler([this](IAsyncAction ^) - { - // The CoreIndependentInputSource will raise pointer events for the specified device types on whichever thread it's created on. - mCoreInput = swapChainPanel->CreateCoreIndependentInputSource( - Windows::UI::Core::CoreInputDeviceTypes::Mouse | - Windows::UI::Core::CoreInputDeviceTypes::Touch | - Windows::UI::Core::CoreInputDeviceTypes::Pen - ); - - // Register for pointer events, which will be raised on the background thread. - mCoreInput->PointerPressed += ref new TypedEventHandler(this, &OpenGLESPage::OnPointerPressed); - mCoreInput->PointerMoved += ref new TypedEventHandler(this, &OpenGLESPage::OnPointerMoved); - mCoreInput->PointerReleased += ref new TypedEventHandler(this, &OpenGLESPage::OnPointerReleased); - mCoreInput->PointerWheelChanged += ref new TypedEventHandler(this, &OpenGLESPage::OnPointerWheelChanged); - - if (GLViewImpl::sharedOpenGLView() && !GLViewImpl::sharedOpenGLView()->isCursorVisible()) - { - mCoreInput->PointerCursor = nullptr; - } - - // Begin processing input messages as they're delivered. - mCoreInput->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessUntilQuit); - }); - - // Run task on a dedicated high priority background thread. - mInputLoopWorker = ThreadPool::RunAsync(workItemHandler, WorkItemPriority::High, WorkItemOptions::TimeSliced); -} - -OpenGLESPage::~OpenGLESPage() -{ - StopRenderLoop(); - DestroyRenderSurface(); -} - -void OpenGLESPage::OnPageLoaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e) -{ - // The SwapChainPanel has been created and arranged in the page layout, so EGL can be initialized. - CreateRenderSurface(); - StartRenderLoop(); - mVisible = true; -} - -void OpenGLESPage::CreateRenderSurface() -{ - if (mOpenGLES && mRenderSurface == EGL_NO_SURFACE) - { - // The app can configure the SwapChainPanel which may boost performance. - // By default, this template uses the default configuration. - mRenderSurface = mOpenGLES->CreateSurface(swapChainPanel, nullptr, nullptr); - - // You can configure the SwapChainPanel to render at a lower resolution and be scaled up to - // the swapchain panel size. This scaling is often free on mobile hardware. - // - // One way to configure the SwapChainPanel is to specify precisely which resolution it should render at. - // Size customRenderSurfaceSize = Size(800, 600); - // mRenderSurface = mOpenGLES->CreateSurface(swapChainPanel, &customRenderSurfaceSize, nullptr); - // - // Another way is to tell the SwapChainPanel to render at a certain scale factor compared to its size. - // e.g. if the SwapChainPanel is 1920x1280 then setting a factor of 0.5f will make the app render at 960x640 - // float customResolutionScale = 0.5f; - // mRenderSurface = mOpenGLES->CreateSurface(swapChainPanel, nullptr, &customResolutionScale); - // - } -} - -void OpenGLESPage::DestroyRenderSurface() -{ - if (mOpenGLES) - { - mOpenGLES->DestroySurface(mRenderSurface); - } - mRenderSurface = EGL_NO_SURFACE; -} - -void OpenGLESPage::RecoverFromLostDevice() -{ - critical_section::scoped_lock lock(mRenderSurfaceCriticalSection); - DestroyRenderSurface(); - mOpenGLES->Reset(); - CreateRenderSurface(); - std::unique_lock locker(mSleepMutex); - mDeviceLost = false; - mSleepCondition.notify_one(); -} - -void OpenGLESPage::TerminateApp() -{ - { - critical_section::scoped_lock lock(mRenderSurfaceCriticalSection); - - if (mOpenGLES) - { - mOpenGLES->DestroySurface(mRenderSurface); - mOpenGLES->Cleanup(); - } - } - Windows::UI::Xaml::Application::Current->Exit(); -} - -void OpenGLESPage::StartRenderLoop() -{ - // If the render loop is already running then do not start another thread. - if (mRenderLoopWorker != nullptr && mRenderLoopWorker->Status == Windows::Foundation::AsyncStatus::Started) - { - return; - } - - DisplayInformation^ currentDisplayInformation = DisplayInformation::GetForCurrentView(); - mDpi = currentDisplayInformation->LogicalDpi; - - auto dispatcher = Windows::UI::Xaml::Window::Current->CoreWindow->Dispatcher; - - // Create a task for rendering that will be run on a background thread. - auto workItemHandler = ref new Windows::System::Threading::WorkItemHandler([this, dispatcher](Windows::Foundation::IAsyncAction ^ action) - { - mOpenGLES->MakeCurrent(mRenderSurface); - - GLsizei panelWidth = 0; - GLsizei panelHeight = 0; - mOpenGLES->GetSurfaceDimensions(mRenderSurface, &panelWidth, &panelHeight); - - if (mRenderer.get() == nullptr) - { - mRenderer = std::make_shared(panelWidth, panelHeight, mDpi, mOrientation, dispatcher, swapChainPanel); - } - - mRenderer->Resume(); - - while (action->Status == Windows::Foundation::AsyncStatus::Started) - { - if (!mVisible) - { - mRenderer->Pause(); - } - - // wait until app is visible again or thread is cancelled - while (!mVisible) - { - std::unique_lock lock(mSleepMutex); - mSleepCondition.wait(lock); - - if (action->Status != Windows::Foundation::AsyncStatus::Started) - { - return; // thread was cancelled. Exit thread - } - - if (mVisible) - { - mRenderer->Resume(); - } - else // spurious wake up - { - continue; - } - } - - mOpenGLES->GetSurfaceDimensions(mRenderSurface, &panelWidth, &panelHeight); - mRenderer.get()->Draw(panelWidth, panelHeight, mDpi, mOrientation); - - // Recreate input dispatch - if (GLViewImpl::sharedOpenGLView() && mCursorVisible != GLViewImpl::sharedOpenGLView()->isCursorVisible()) - { - CreateInput(); - mCursorVisible = GLViewImpl::sharedOpenGLView()->isCursorVisible(); - } - - if (mRenderer->AppShouldExit()) - { - // run on main UI thread - swapChainPanel->Dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::High, ref new DispatchedHandler([=]() - { - TerminateApp(); - })); - - return; - } - - EGLBoolean result = GL_FALSE; - { - critical_section::scoped_lock lock(mRenderSurfaceCriticalSection); - result = mOpenGLES->SwapBuffers(mRenderSurface); - } - - if (result != GL_TRUE) - { - // The call to eglSwapBuffers was not be successful (i.e. due to Device Lost) - // If the call fails, then we must reinitialize EGL and the GL resources. - mRenderer->Pause(); - mDeviceLost = true; - - // XAML objects like the SwapChainPanel must only be manipulated on the UI thread. - swapChainPanel->Dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::High, ref new Windows::UI::Core::DispatchedHandler([=]() - { - RecoverFromLostDevice(); - }, CallbackContext::Any)); - - // wait until OpenGL is reset or thread is cancelled - while (mDeviceLost) - { - std::unique_lock lock(mSleepMutex); - mSleepCondition.wait(lock); - - if (action->Status != Windows::Foundation::AsyncStatus::Started) - { - return; // thread was cancelled. Exit thread - } - - if (!mDeviceLost) - { - mOpenGLES->MakeCurrent(mRenderSurface); - // restart cocos2d-x - mRenderer->DeviceLost(); - } - else // spurious wake up - { - continue; - } - } - } - } - }); - - // Run task on a dedicated high priority background thread. - mRenderLoopWorker = Windows::System::Threading::ThreadPool::RunAsync(workItemHandler, Windows::System::Threading::WorkItemPriority::High, Windows::System::Threading::WorkItemOptions::TimeSliced); -} - -void OpenGLESPage::StopRenderLoop() -{ - if (mRenderLoopWorker) - { - mRenderLoopWorker->Cancel(); - std::unique_lock locker(mSleepMutex); - mSleepCondition.notify_one(); - mRenderLoopWorker = nullptr; - } -} - -void OpenGLESPage::OnPointerPressed(Object^ sender, PointerEventArgs^ e) -{ - bool isMouseEvent = e->CurrentPoint->PointerDevice->PointerDeviceType == Windows::Devices::Input::PointerDeviceType::Mouse; - if (mRenderer) - { - mRenderer->QueuePointerEvent(isMouseEvent ? PointerEventType::MousePressed : PointerEventType::PointerPressed, e); - } -} - -void OpenGLESPage::OnPointerMoved(Object^ sender, PointerEventArgs^ e) -{ - bool isMouseEvent = e->CurrentPoint->PointerDevice->PointerDeviceType == Windows::Devices::Input::PointerDeviceType::Mouse; - if (mRenderer) - { - mRenderer->QueuePointerEvent(isMouseEvent ? PointerEventType::MouseMoved : PointerEventType::PointerMoved, e); - } -} - -void OpenGLESPage::OnPointerReleased(Object^ sender, PointerEventArgs^ e) -{ - bool isMouseEvent = e->CurrentPoint->PointerDevice->PointerDeviceType == Windows::Devices::Input::PointerDeviceType::Mouse; - - if (mRenderer) - { - mRenderer->QueuePointerEvent(isMouseEvent ? PointerEventType::MouseReleased : PointerEventType::PointerReleased, e); - } -} - -void OpenGLESPage::OnPointerWheelChanged(Object^ sender, PointerEventArgs^ e) -{ - bool isMouseEvent = e->CurrentPoint->PointerDevice->PointerDeviceType == Windows::Devices::Input::PointerDeviceType::Mouse; - if (mRenderer && isMouseEvent) - { - mRenderer->QueuePointerEvent(PointerEventType::MouseWheelChanged, e); - } -} - -void OpenGLESPage::OnKeyPressed(CoreWindow^ sender, KeyEventArgs^ e) -{ - //log("OpenGLESPage::OnKeyPressed %d", e->VirtualKey); - if (mRenderer) - { - mRenderer->QueueKeyboardEvent(WinRTKeyboardEventType::KeyPressed, e); - } -} - -void OpenGLESPage::OnCharacterReceived(CoreWindow^ sender, CharacterReceivedEventArgs^ e) -{ -#if 0 - if (!e->KeyStatus.WasKeyDown) - { - log("OpenGLESPage::OnCharacterReceived %d", e->KeyCode); - } -#endif -} - -void OpenGLESPage::OnKeyReleased(CoreWindow^ sender, KeyEventArgs^ e) -{ - //log("OpenGLESPage::OnKeyReleased %d", e->VirtualKey); - if (mRenderer) - { - mRenderer->QueueKeyboardEvent(WinRTKeyboardEventType::KeyReleased, e); - } -} - - -void OpenGLESPage::OnOrientationChanged(DisplayInformation^ sender, Object^ args) -{ - mOrientation = sender->CurrentOrientation; -} - -void OpenGLESPage::SetVisibility(bool isVisible) -{ - if (isVisible && mRenderSurface != EGL_NO_SURFACE) - { - if (!mVisible) - { - std::unique_lock locker(mSleepMutex); - mVisible = true; - mSleepCondition.notify_one(); - } - } - else - { - mVisible = false; - } -} - -void OpenGLESPage::OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args) -{ - if (args->Visible && mRenderSurface != EGL_NO_SURFACE) - { - SetVisibility(true); - } - else - { - SetVisibility(false); - } -} - -#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) || _MSC_VER >= 1900 -/* -We set args->Handled = true to prevent the app from quitting when the back button is pressed. -This is because this back button event happens on the XAML UI thread and not the cocos2d-x UI thread. -We need to give the game developer a chance to decide to exit the app depending on where they -are in their game. They can receive the back button event by listening for the -EventKeyboard::KeyCode::KEY_ESCAPE event. - -The default behavior is to exit the app if the EventKeyboard::KeyCode::KEY_ESCAPE event -is not handled by the game. -*/ -void OpenGLESPage::OnBackButtonPressed(Object^ sender, BackPressedEventArgs^ args) -{ - if (mRenderer) - { - mRenderer->QueueBackButtonEvent(); - args->Handled = true; - } -} -#endif \ No newline at end of file diff --git a/cocos/platform/win8.1-universal/OpenGLESPage.xaml.h b/cocos/platform/win8.1-universal/OpenGLESPage.xaml.h deleted file mode 100644 index 9fffbad9ca46..000000000000 --- a/cocos/platform/win8.1-universal/OpenGLESPage.xaml.h +++ /dev/null @@ -1,91 +0,0 @@ -/* -* cocos2d-x http://www.cocos2d-x.org -* -* Copyright (c) 2010-2014 - cocos2d-x community -* Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. -* -* Portions Copyright (c) Microsoft Open Technologies, Inc. -* All Rights Reserved -* -* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and limitations under the License. -*/ - -#pragma once - -#include "OpenGLES.h" -#include "OpenGLESPage.g.h" -#include -#include -#include - -#include "Cocos2dRenderer.h" - -namespace CocosAppWinRT -{ - public ref class OpenGLESPage sealed - { - public: - OpenGLESPage(); - virtual ~OpenGLESPage(); - void SetVisibility(bool isVisible); - - internal: - OpenGLESPage(OpenGLES* openGLES); - - private: - void OnPageLoaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); - void OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args); -#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) || _MSC_VER >= 1900 - void OnBackButtonPressed(Platform::Object^ sender, Windows::Phone::UI::Input::BackPressedEventArgs^ args); -#endif - void CreateRenderSurface(); - void DestroyRenderSurface(); - void RecoverFromLostDevice(); - void TerminateApp(); - void StartRenderLoop(); - void StopRenderLoop(); - - void CreateInput(); - - OpenGLES* mOpenGLES; - std::shared_ptr mRenderer; - - EGLSurface mRenderSurface; // This surface is associated with a swapChainPanel on the page - Concurrency::critical_section mRenderSurfaceCriticalSection; - Windows::Foundation::IAsyncAction^ mRenderLoopWorker; - - // Track user input on a background worker thread. - Windows::Foundation::IAsyncAction^ mInputLoopWorker; - Windows::UI::Core::CoreIndependentInputSource^ mCoreInput; - - // Independent touch and pen handling functions. - void OnPointerPressed(Platform::Object^ sender, Windows::UI::Core::PointerEventArgs^ e); - void OnPointerMoved(Platform::Object^ sender, Windows::UI::Core::PointerEventArgs^ e); - void OnPointerReleased(Platform::Object^ sender, Windows::UI::Core::PointerEventArgs^ e); - void OnPointerWheelChanged(Platform::Object^ sender, Windows::UI::Core::PointerEventArgs^ e); - - // Independent keyboard handling functions. - void OnKeyPressed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args); - void OnKeyReleased(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args); - - void OnCharacterReceived(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CharacterReceivedEventArgs^ args); - - void OnOrientationChanged(Windows::Graphics::Display::DisplayInformation^ sender, Platform::Object^ args); - - float mDpi; - bool mDeviceLost; - bool mVisible; - bool mCursorVisible; - Windows::Graphics::Display::DisplayOrientations mOrientation; - - std::mutex mSleepMutex; - std::condition_variable mSleepCondition; - }; -} diff --git a/cocos/platform/win8.1-universal/cocos2d-js/pch.h b/cocos/platform/win8.1-universal/cocos2d-js/pch.h deleted file mode 100644 index 6e3a12daa1fc..000000000000 --- a/cocos/platform/win8.1-universal/cocos2d-js/pch.h +++ /dev/null @@ -1,36 +0,0 @@ -/**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - ****************************************************************************/ - -// -// pch.h -// Header for standard system include files. -// - -#pragma once - -#include "mozilla\Char16.h" -#include "cocos2d.h" -#include "cocos-ext.h" - - diff --git a/cocos/platform/win8.1-universal/pch.cpp b/cocos/platform/win8.1-universal/pch.cpp deleted file mode 100644 index b13a83b5cc02..000000000000 --- a/cocos/platform/win8.1-universal/pch.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - ****************************************************************************/ - -#include "pch.h" diff --git a/cocos/platform/win8.1-universal/pch.h b/cocos/platform/win8.1-universal/pch.h deleted file mode 100644 index 1c4d7fa940d2..000000000000 --- a/cocos/platform/win8.1-universal/pch.h +++ /dev/null @@ -1,38 +0,0 @@ -/**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - ****************************************************************************/ - -// -// pch.h -// Header for standard system include files. -// - -#pragma once - -#include -#include - -#include "cocos2d.h" -#include "cocos-ext.h" - - diff --git a/cocos/platform/winrt/CCApplication.cpp b/cocos/platform/winrt/CCApplication.cpp deleted file mode 100644 index 18a1dcd36048..000000000000 --- a/cocos/platform/winrt/CCApplication.cpp +++ /dev/null @@ -1,229 +0,0 @@ -/**************************************************************************** -Copyright (c) 2010-2013 cocos2d-x.org -Copyright (c) Microsoft Open Technologies, Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - -http://www.cocos2d-x.org - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -****************************************************************************/ -#include "platform/CCPlatformConfig.h" -#if CC_TARGET_PLATFORM == CC_PLATFORM_WINRT -#include "platform/winrt/CCGLViewImpl-winrt.h" -using namespace Windows::UI::Core; -using namespace Windows::Foundation; - -#else -#include "platform/wp8/CCGLViewImpl-wp8.h" -#endif -#include "base/CCDirector.h" -#include -#include "platform/CCFileUtils.h" -#include "platform/winrt/CCWinRTUtils.h" -#include "platform/CCApplication.h" -#include "tinyxml2/tinyxml2.h" - -/** -@brief This function change the PVRFrame show/hide setting in register. -@param bEnable If true show the PVRFrame window, otherwise hide. -*/ - -NS_CC_BEGIN - -// sharedApplication pointer -Application * Application::sm_pSharedApplication = nullptr; - - - - - -//////////////////////////////////////////////////////////////////////////////// -// implement Application -//////////////////////////////////////////////////////////////////////////////// - -// sharedApplication pointer -Application * s_pSharedApplication = nullptr; - -Application::Application() : -m_openURLDelegate(nullptr) -{ - m_nAnimationInterval.QuadPart = 0; - CC_ASSERT(! sm_pSharedApplication); - sm_pSharedApplication = this; -} - -Application::~Application() -{ - CC_ASSERT(this == sm_pSharedApplication); - sm_pSharedApplication = nullptr; -} - -int Application::run() -{ - // Initialize instance and cocos2d. - if (!applicationDidFinishLaunching()) - { - return 0; - } - - GLViewImpl::sharedOpenGLView()->Run(); - return 0; -} - -void Application::setAnimationInterval(float interval) -{ - LARGE_INTEGER nFreq; - QueryPerformanceFrequency(&nFreq); - m_nAnimationInterval.QuadPart = (LONGLONG)(interval * nFreq.QuadPart); -} - -void Application::setAnimationInterval(float interval, SetIntervalReason reason) -{ - setAnimationInterval(interval); -} - -////////////////////////////////////////////////////////////////////////// -// static member function -////////////////////////////////////////////////////////////////////////// -Application* Application::getInstance() -{ - CC_ASSERT(sm_pSharedApplication); - return sm_pSharedApplication; -} - -const char * Application::getCurrentLanguageCode() -{ - static std::string code = "en"; - -#if CC_TARGET_PLATFORM == CC_PLATFORM_WINRT - auto languages = Windows::System::UserProfile::GlobalizationPreferences::Languages; - code = PlatformStringToString(languages->GetAt(0)); -#else - ULONG numLanguages = 0; - DWORD cchLanguagesBuffer = 0; - BOOL result = GetUserPreferredUILanguages(MUI_LANGUAGE_NAME, &numLanguages, NULL, &cchLanguagesBuffer); - - if (result) { - WCHAR* pwszLanguagesBuffer = new WCHAR[cchLanguagesBuffer]; - result = GetUserPreferredUILanguages(MUI_LANGUAGE_NAME, &numLanguages, pwszLanguagesBuffer, &cchLanguagesBuffer); - if (result) { - - code = StringWideCharToUtf8(pwszLanguagesBuffer); - } - - if (pwszLanguagesBuffer) - { - delete [] pwszLanguagesBuffer; - } - } - - -#endif - return code.c_str(); -} - - -LanguageType Application::getCurrentLanguage() -{ - const char* code = getCurrentLanguageCode(); - - return utils::getLanguageTypeByISO2(code); -} - -Application::Platform Application::getTargetPlatform() -{ - if (isWindowsPhone()) - { - return Platform::OS_WP8; - } - else - { - return Platform::OS_WINRT; - } -} - -std::string Application::getVersion() -{ - std::string r(""); - std::string s = FileUtils::getInstance()->getStringFromFile("WMAppManifest.xml"); - if (!s.empty()) { - tinyxml2::XMLDocument doc; - if (!doc.Parse(s.c_str())) { - tinyxml2::XMLElement *app = doc.RootElement()->FirstChildElement("App"); - if (app) { - const char* version = app->Attribute("Version"); - if (version) { - r = version; - } - } - } - } - return r; -} - -bool Application::openURL(const std::string &url) -{ -#if CC_TARGET_PLATFORM == CC_PLATFORM_WINRT - auto dispatcher = cocos2d::GLViewImpl::sharedOpenGLView()->getDispatcher(); - dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal, ref new DispatchedHandler([url]() { - auto uri = ref new Windows::Foundation::Uri(PlatformStringFromString(url)); - concurrency::task launchUriOperation(Windows::System::Launcher::LaunchUriAsync(uri)); - })); - return true; -#else - if (m_openURLDelegate) - { - m_openURLDelegate(PlatformStringFromString(url)); - return true; - } - else - { - return false; - } -#endif -} - -void Application::setResourceRootPath(const std::string& rootResDir) -{ - m_resourceRootPath = rootResDir; - std::replace(m_resourceRootPath.begin(), m_resourceRootPath.end(), '\\', '/'); - if (m_resourceRootPath[m_resourceRootPath.length() - 1] != '/') - { - m_resourceRootPath += '/'; - } - FileUtils* pFileUtils = FileUtils::getInstance(); - std::vector searchPaths = pFileUtils->getSearchPaths(); - searchPaths.insert(searchPaths.begin(), m_resourceRootPath); - pFileUtils->setSearchPaths(searchPaths); -} - -const std::string& Application::getResourceRootPath(void) -{ - return m_resourceRootPath; -} - -void Application::setStartupScriptFilename(const std::string& startupScriptFile) -{ - m_startupScriptFilename = startupScriptFile; - std::replace(m_startupScriptFilename.begin(), m_startupScriptFilename.end(), '\\', '/'); -} - -NS_CC_END - - diff --git a/cocos/platform/winrt/CCApplication.h b/cocos/platform/winrt/CCApplication.h deleted file mode 100644 index 182246061771..000000000000 --- a/cocos/platform/winrt/CCApplication.h +++ /dev/null @@ -1,124 +0,0 @@ -/**************************************************************************** -Copyright (c) 2010-2013 cocos2d-x.org -Copyright (c) Microsoft Open Technologies, Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - -http://www.cocos2d-x.org - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -****************************************************************************/ -#ifndef __CC_APPLICATION_WINRT_H__ -#define __CC_APPLICATION_WINRT_H__ - -#include "platform/CCPlatformConfig.h" -#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) - -#include "platform/CCStdC.h" -#include "platform/CCCommon.h" -#include "platform/CCApplicationProtocol.h" -#include "platform/winrt/InputEvent.h" -#include - -NS_CC_BEGIN - - -class CC_DLL Application : public ApplicationProtocol -{ -public: - Application(); - virtual ~Application(); - - /** - @brief Run the message loop. - */ - int run(); - - /** - @brief Get current application instance. - @return Current application instance pointer. - */ - static Application* getInstance(); - - /* override functions */ - virtual void setAnimationInterval(float interval) override; - virtual void setAnimationInterval(float interval, SetIntervalReason reason) override; - - virtual LanguageType getCurrentLanguage() override; - virtual const char * getCurrentLanguageCode() override; - - /** - @brief Get target platform - */ - virtual Platform getTargetPlatform() override; - - /** - @brief Get application version - */ - virtual std::string getVersion() override; - - /** - @brief Open url in default browser - @param String with url to open. - @return true if the resource located by the URL was successfully opened; otherwise false. - */ - virtual bool openURL(const std::string &url); - - /** - @brief Set the callback responsible for opening a URL. - @param del The delegate that will handle opening a URL. We can't pass back a Platform::String due to name clash. - */ - void SetXamlOpenURLDelegate(const std::function& del) - { - m_openURLDelegate = del; - } - - /** - * Sets the Resource root path. - * @deprecated Please use CCFileUtils::sharedFileUtils()->setSearchPaths() instead. - */ - CC_DEPRECATED_ATTRIBUTE void setResourceRootPath(const std::string& rootResDir); - - /** - * Gets the Resource root path. - * @deprecated Please use CCFileUtils::sharedFileUtils()->getSearchPaths() instead. - */ - CC_DEPRECATED_ATTRIBUTE const std::string& getResourceRootPath(void); - - void setStartupScriptFilename(const std::string& startupScriptFile); - - const std::string& getStartupScriptFilename(void) - { - return m_startupScriptFilename; - } - -protected: - LARGE_INTEGER m_nAnimationInterval; - std::string m_resourceRootPath; - std::string m_startupScriptFilename; - - std::function m_openURLDelegate; - - static Application * sm_pSharedApplication; -}; - -NS_CC_END - -#endif // CC_TARGET_PLATFORM == CC_PLATFORM_WINRT - -#endif // __CC_APPLICATION_WINRT_H__ diff --git a/cocos/platform/winrt/CCCommon.cpp b/cocos/platform/winrt/CCCommon.cpp deleted file mode 100644 index 890cc8ef73b7..000000000000 --- a/cocos/platform/winrt/CCCommon.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -Copyright (c) 2010 cocos2d-x.org -Copyright (c) Microsoft Open Technologies, Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - -http://www.cocos2d-x.org - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -****************************************************************************/ -#include "platform/CCCommon.h" -#include "platform/CCStdC.h" -#include "platform/winrt/CCGLViewImpl-winrt.h" -#include "platform/winrt/CCWinRTUtils.h" - -#if defined(VLD_DEBUG_MEMORY) -#include -#endif - -NS_CC_BEGIN - - -void MessageBox(const char * pszMsg, const char * pszTitle) -{ - // Create the message dialog and set its content - Platform::String^ message = PlatformStringFromString(pszMsg); - Platform::String^ title = PlatformStringFromString(pszTitle); - GLViewImpl::sharedOpenGLView()->ShowMessageBox(title, message); -} - - -void CCLuaLog(const char *pszMsg) -{ -#if defined(COCOS2D_DEBUG) - int bufflen = MultiByteToWideChar(CP_UTF8, 0, pszMsg, -1, NULL, 0); - WCHAR* widebuff = new WCHAR[bufflen + 1]; - memset(widebuff, 0, sizeof(WCHAR) * (bufflen + 1)); - MultiByteToWideChar(CP_UTF8, 0, pszMsg, -1, widebuff, bufflen); - - - OutputDebugStringW(widebuff); - OutputDebugStringA("\n"); - - bufflen = WideCharToMultiByte(CP_ACP, 0, widebuff, -1, NULL, 0, NULL, NULL); - char* buff = new char[bufflen + 1]; - memset(buff, 0, sizeof(char) * (bufflen + 1)); - WideCharToMultiByte(CP_ACP, 0, widebuff, -1, buff, bufflen, NULL, NULL); - puts(buff); - - delete[] widebuff; - delete[] buff; -#endif -} - -NS_CC_END diff --git a/cocos/platform/winrt/CCDevice.cpp b/cocos/platform/winrt/CCDevice.cpp deleted file mode 100644 index 6ca544b8883d..000000000000 --- a/cocos/platform/winrt/CCDevice.cpp +++ /dev/null @@ -1,227 +0,0 @@ -/**************************************************************************** -Copyright (c) 2010-2012 cocos2d-x.org -Copyright (c) 2013-2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - -http://www.cocos2d-x.org - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -****************************************************************************/ - -#include "platform/CCPlatformConfig.h" -#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) - -#include "platform/CCDevice.h" -#include "platform/CCFileUtils.h" -#include "platform/winrt/CCFreeTypeFont.h" -#include "platform/winrt/CCWinRTUtils.h" -#include "platform/CCStdC.h" -#include "platform/winrt/CCGLViewImpl-winrt.h" - -using namespace Windows::Graphics::Display; -using namespace Windows::Devices::Sensors; -using namespace Windows::Foundation; -#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) -using namespace Windows::Phone::Devices::Notification; -#endif // (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) - -NS_CC_BEGIN - -CCFreeTypeFont sFT; - -int Device::getDPI() -{ - return cocos2d::GLViewImpl::sharedOpenGLView()->GetDPI(); -} - -static Accelerometer^ sAccelerometer = nullptr; - - -void Device::setAccelerometerEnabled(bool isEnabled) -{ - static Windows::Foundation::EventRegistrationToken sToken; - static bool sEnabled = false; - - // we always need to reset the accelerometer - if (sAccelerometer) - { - sAccelerometer->ReadingChanged -= sToken; - sAccelerometer = nullptr; - sEnabled = false; - } - - if (isEnabled) - { - sAccelerometer = Accelerometer::GetDefault(); - - if(sAccelerometer == nullptr) - { - // It's not a friendly experience and may cause crash. - //MessageBox("This device does not have an accelerometer.","Alert"); - log("This device does not have an accelerometer."); - return; - } - - setAccelerometerInterval(0.0f); - sEnabled = true; - - sToken = sAccelerometer->ReadingChanged += ref new TypedEventHandler - - ([](Accelerometer^ a, AccelerometerReadingChangedEventArgs^ e) - { - if (!sEnabled) - { - return; - } - - AccelerometerReading^ reading = e->Reading; - cocos2d::Acceleration acc; - acc.x = reading->AccelerationX; - acc.y = reading->AccelerationY; - acc.z = reading->AccelerationZ; - acc.timestamp = 0; - - auto orientation = GLViewImpl::sharedOpenGLView()->getDeviceOrientation(); - - if (isWindowsPhone()) - { - switch (orientation) - { - case DisplayOrientations::Portrait: - acc.x = reading->AccelerationX; - acc.y = reading->AccelerationY; - break; - - case DisplayOrientations::Landscape: - acc.x = -reading->AccelerationY; - acc.y = reading->AccelerationX; - break; - - case DisplayOrientations::PortraitFlipped: - acc.x = -reading->AccelerationX; - acc.y = reading->AccelerationY; - break; - - case DisplayOrientations::LandscapeFlipped: - acc.x = reading->AccelerationY; - acc.y = -reading->AccelerationX; - break; - - default: - acc.x = reading->AccelerationX; - acc.y = reading->AccelerationY; - break; - } - } - else // Windows Store App - { - // from http://msdn.microsoft.com/en-us/library/windows/apps/dn440593 - switch (orientation) - { - case DisplayOrientations::Portrait: - acc.x = reading->AccelerationY; - acc.y = -reading->AccelerationX; - break; - - case DisplayOrientations::Landscape: - acc.x = reading->AccelerationX; - acc.y = reading->AccelerationY; - break; - - case DisplayOrientations::PortraitFlipped: - acc.x = -reading->AccelerationY; - acc.y = reading->AccelerationX; - break; - - case DisplayOrientations::LandscapeFlipped: - acc.x = -reading->AccelerationX; - acc.y = -reading->AccelerationY; - break; - - default: - acc.x = reading->AccelerationY; - acc.y = -reading->AccelerationX; - break; - } - } - - std::shared_ptr event(new AccelerometerEvent(acc)); - cocos2d::GLViewImpl::sharedOpenGLView()->QueueEvent(event); - }); - } -} - -void Device::setAccelerometerInterval(float interval) -{ - if (sAccelerometer) - { - try { - int minInterval = sAccelerometer->MinimumReportInterval; - int reqInterval = (int) interval; - sAccelerometer->ReportInterval = reqInterval < minInterval ? minInterval : reqInterval; - } - catch (Platform::COMException^) - { - CCLOG("Device::setAccelerometerInterval not supported on this device"); - } - } - else - { - CCLOG("Device::setAccelerometerInterval: accelerometer not enabled."); - } -} - - - -Data Device::getTextureDataForText(const char * text, const FontDefinition& textDefinition, TextAlign align, int &width, int &height, bool& hasPremultipliedAlpha) -{ - Data ret; - ssize_t dataLen; - - unsigned char* data = sFT.initWithString(text, textDefinition, align, width, height, dataLen); - - if (data) - { - ret.fastSet(data, dataLen); - hasPremultipliedAlpha = false; - } - - return ret; -} - -void Device::setKeepScreenOn(bool /*value*/) -{ -} - -void Device::vibrate(float duration) -{ -#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) - Windows::Foundation::TimeSpan timespan; - // A time period expressed in 100-nanosecond units, see https://msdn.microsoft.com/en-us/library/windows/apps/windows.foundation.timespan.aspx - // The duration is limited to a maximum of 5 seconds, see https://msdn.microsoft.com/en-us/library/windows/apps/windows.phone.devices.notification.vibrationdevice.aspx - timespan.Duration = std::min(static_cast(duration * 10000), 50000); - - VibrationDevice^ testVibrationDevice = VibrationDevice::GetDefault(); - testVibrationDevice->Vibrate(timespan); -#endif // (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) -} - -NS_CC_END - -#endif // (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) diff --git a/cocos/platform/winrt/CCFileUtilsWinRT.cpp b/cocos/platform/winrt/CCFileUtilsWinRT.cpp deleted file mode 100644 index afacc7fe4d68..000000000000 --- a/cocos/platform/winrt/CCFileUtilsWinRT.cpp +++ /dev/null @@ -1,472 +0,0 @@ -/**************************************************************************** -Copyright (c) 2010 cocos2d-x.org -Copyright (c) Microsoft Open Technologies, Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - -http://www.cocos2d-x.org - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -****************************************************************************/ -#include "platform/winrt/CCFileUtilsWinRT.h" -#include -#include "platform/winrt/CCWinRTUtils.h" -#include "platform/CCCommon.h" -#include "tinydir/tinydir.h" -using namespace std; - -NS_CC_BEGIN - -static std::string s_pszResourcePath; - -// D:\aaa\bbb\ccc\ddd\abc.txt --> D:/aaa/bbb/ccc/ddd/abc.txt -static inline std::string convertPathFormatToUnixStyle(const std::string& path) -{ - std::string ret = path; - size_t len = ret.length(); - for (size_t i = 0; i < len; ++i) - { - if (ret[i] == '\\') - { - ret[i] = '/'; - } - } - return ret; -} - -static std::string UTF8StringToMultiByte(const std::string& strUtf8) -{ - std::string ret; - if (!strUtf8.empty()) - { - std::wstring strWideChar = StringUtf8ToWideChar(strUtf8); - int nNum = WideCharToMultiByte(CP_ACP, 0, strWideChar.c_str(), -1, nullptr, 0, nullptr, FALSE); - if (nNum) - { - char* ansiString = new char[nNum + 1]; - ansiString[0] = 0; - - nNum = WideCharToMultiByte(CP_ACP, 0, strWideChar.c_str(), -1, ansiString, nNum + 1, nullptr, FALSE); - - ret = ansiString; - delete[] ansiString; - } - else - { - CCLOG("Wrong convert to Ansi code:0x%x", GetLastError()); - } - } - - return ret; -} - -static void _checkPath() -{ - if (s_pszResourcePath.empty()) - { - // TODO: needs to be tested - s_pszResourcePath = convertPathFormatToUnixStyle(CCFileUtilsWinRT::getAppPath() + '\\' + "Assets\\Resources" + '\\'); - } -} - -FileUtils* FileUtils::getInstance() -{ - if (s_sharedFileUtils == nullptr) - { - s_sharedFileUtils = new CCFileUtilsWinRT(); - if(!s_sharedFileUtils->init()) - { - delete s_sharedFileUtils; - s_sharedFileUtils = nullptr; - CCLOG("ERROR: Could not init CCFileUtilsWinRT"); - } - } - return s_sharedFileUtils; -} - -CCFileUtilsWinRT::CCFileUtilsWinRT() -{ -} - -bool CCFileUtilsWinRT::init() -{ - _checkPath(); - _defaultResRootPath = s_pszResourcePath; - return FileUtils::init(); -} - -std::string CCFileUtilsWinRT::getPathForFilename(const std::string& filename, const std::string& resolutionDirectory, const std::string& searchPath) const -{ - std::string unixFileName = convertPathFormatToUnixStyle(filename); - std::string unixResolutionDirectory = convertPathFormatToUnixStyle(resolutionDirectory); - std::string unixSearchPath = convertPathFormatToUnixStyle(searchPath); - - return FileUtils::getPathForFilename(unixFileName, unixResolutionDirectory, unixSearchPath); -} - -std::string CCFileUtilsWinRT::getFullPathForDirectoryAndFilename(const std::string& strDirectory, const std::string& strFilename) const -{ - std::string unixDirectory = convertPathFormatToUnixStyle(strDirectory); - std::string unixFilename = convertPathFormatToUnixStyle(strFilename); - return FileUtils::getFullPathForDirectoryAndFilename(unixDirectory, unixFilename); -} - -std::string CCFileUtilsWinRT::getSuitableFOpen(const std::string& filenameUtf8) const -{ - return UTF8StringToMultiByte(filenameUtf8); -} - -long CCFileUtilsWinRT::getFileSize(const std::string &filepath) -{ - WIN32_FILE_ATTRIBUTE_DATA fad; - if (!GetFileAttributesEx(StringUtf8ToWideChar(filepath).c_str(), GetFileExInfoStandard, &fad)) - { - return 0; // error condition, could call GetLastError to find out more - } - LARGE_INTEGER size; - size.HighPart = fad.nFileSizeHigh; - size.LowPart = fad.nFileSizeLow; - return (long)size.QuadPart; -} - -FileUtils::Status CCFileUtilsWinRT::getContents(const std::string& filename, ResizableBuffer* buffer) -{ - if (filename.empty()) - return FileUtils::Status::NotExists; - - // read the file from hardware - std::string fullPath = FileUtils::getInstance()->fullPathForFilename(filename); - - HANDLE fileHandle = ::CreateFile2(StringUtf8ToWideChar(fullPath).c_str(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, OPEN_EXISTING, nullptr); - if (fileHandle == INVALID_HANDLE_VALUE) - return FileUtils::Status::OpenFailed; - - FILE_STANDARD_INFO info = {0}; - if (::GetFileInformationByHandleEx(fileHandle, FileStandardInfo, &info, sizeof(info)) == 0) - { - ::CloseHandle(fileHandle); - return FileUtils::Status::OpenFailed; - } - - if (info.EndOfFile.HighPart > 0) - { - ::CloseHandle(fileHandle); - return FileUtils::Status::TooLarge; - } - - buffer->resize(info.EndOfFile.LowPart); - DWORD sizeRead = 0; - BOOL successed = ::ReadFile(fileHandle, buffer->buffer(), info.EndOfFile.LowPart, &sizeRead, nullptr); - ::CloseHandle(fileHandle); - - if (!successed) - { - buffer->resize(sizeRead); - CCLOG("Get data from file(%s) failed, error code is %s", filename.data(), std::to_string(::GetLastError()).data()); - return FileUtils::Status::ReadFailed; - } - return FileUtils::Status::OK; -} - -bool CCFileUtilsWinRT::isFileExistInternal(const std::string& strFilePath) const -{ - bool ret = false; - FILE * pf = nullptr; - - std::string strPath = strFilePath; - if (!isAbsolutePath(strPath)) - { // Not absolute path, add the default root path at the beginning. - strPath.insert(0, _defaultResRootPath); - } - - strPath = getSuitableFOpen(strPath); - - if (!strPath.empty() && (pf = fopen(strPath.c_str(), "rb"))) - { - ret = true; - fclose(pf); - } - return ret; -} - -bool CCFileUtilsWinRT::isDirectoryExistInternal(const std::string& dirPath) const -{ - WIN32_FILE_ATTRIBUTE_DATA wfad; - std::wstring wdirPath = StringUtf8ToWideChar(dirPath); - if (GetFileAttributesEx(wdirPath.c_str(), GetFileExInfoStandard, &wfad)) - { - return true; - } - return false; -} - -bool CCFileUtilsWinRT::createDirectory(const std::string& path) -{ - CCASSERT(!path.empty(), "Invalid path"); - - if (isDirectoryExist(path)) - return true; - - // Split the path - size_t start = 0; - size_t found = path.find_first_of("/\\", start); - std::string subpath; - std::vector dirs; - - if (found != std::string::npos) - { - while (true) - { - subpath = path.substr(start, found - start + 1); - if (!subpath.empty()) - dirs.push_back(subpath); - start = found + 1; - found = path.find_first_of("/\\", start); - if (found == std::string::npos) - { - if (start < path.length()) - { - dirs.push_back(path.substr(start)); - } - break; - } - } - } - - WIN32_FILE_ATTRIBUTE_DATA wfad; - - if (!(GetFileAttributesEx(StringUtf8ToWideChar(path).c_str(), GetFileExInfoStandard, &wfad))) - { - subpath = ""; - for (unsigned int i = 0, size = dirs.size(); i < size; ++i) - { - subpath += dirs[i]; - if (i > 0 && !isDirectoryExist(subpath)) - { - BOOL ret = CreateDirectory(StringUtf8ToWideChar(subpath).c_str(), NULL); - if (!ret && ERROR_ALREADY_EXISTS != GetLastError()) - { - return false; - } - } - } - } - return true; -} - -bool CCFileUtilsWinRT::removeDirectory(const std::string& path) -{ - std::wstring wpath = StringUtf8ToWideChar(path); - std::wstring files = wpath + L"*.*"; - WIN32_FIND_DATA wfd; - HANDLE search = FindFirstFileEx(files.c_str(), FindExInfoStandard, &wfd, FindExSearchNameMatch, NULL, 0); - bool ret = true; - if (search != INVALID_HANDLE_VALUE) - { - BOOL find = true; - while (find) - { - //. .. - if (wfd.cFileName[0] != '.') - { - std::wstring temp = wpath + wfd.cFileName; - if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - { - temp += '/'; - ret = ret && this->removeDirectory(StringWideCharToUtf8(temp)); - } - else - { - SetFileAttributes(temp.c_str(), FILE_ATTRIBUTE_NORMAL); - ret = ret && DeleteFile(temp.c_str()); - } - } - find = FindNextFile(search, &wfd); - } - FindClose(search); - } - if (ret && RemoveDirectory(wpath.c_str())) - { - return true; - } - return false; -} - -bool CCFileUtilsWinRT::isAbsolutePath(const std::string& strPath) const -{ - if ( strPath.length() > 2 - && ( (strPath[0] >= 'a' && strPath[0] <= 'z') || (strPath[0] >= 'A' && strPath[0] <= 'Z') ) - && strPath[1] == ':') - { - return true; - } - return false; -} - -bool CCFileUtilsWinRT::removeFile(const std::string &path) -{ - std::wstring wpath = StringUtf8ToWideChar(path); - if (DeleteFile(wpath.c_str())) - { - return true; - } - else - { - CCLOG("Remove file failed with error: %d", GetLastError()); - return false; - } -} - -bool CCFileUtilsWinRT::renameFile(const std::string &oldfullpath, const std::string& newfullpath) -{ - CCASSERT(!oldfullpath.empty(), "Invalid path"); - CCASSERT(!newfullpath.empty(), "Invalid path"); - - std::regex pat("\\/"); - std::string _oldfullpath = std::regex_replace(oldfullpath, pat, "\\"); - std::string _newfullpath = std::regex_replace(newfullpath, pat, "\\"); - - std::wstring _wNewfullpath = StringUtf8ToWideChar(_newfullpath); - - if (FileUtils::getInstance()->isFileExist(_newfullpath)) - { - if (!DeleteFile(_wNewfullpath.c_str())) - { - CCLOGERROR("Fail to delete file %s !Error code is 0x%x", newfullpath.c_str(), GetLastError()); - } - } - - if (MoveFileEx(StringUtf8ToWideChar(_oldfullpath).c_str(), _wNewfullpath.c_str(), - MOVEFILE_REPLACE_EXISTING & MOVEFILE_WRITE_THROUGH)) - { - return true; - } - else - { - CCLOGERROR("Fail to rename file %s to %s !Error code is 0x%x", oldfullpath.c_str(), newfullpath.c_str(), GetLastError()); - return false; - } -} - -bool CCFileUtilsWinRT::renameFile(const std::string &path, const std::string &oldname, const std::string &name) -{ - CCASSERT(!path.empty(), "Invalid path"); - std::string oldPath = path + oldname; - std::string newPath = path + name; - - return renameFile(oldPath, newPath); -} - -string CCFileUtilsWinRT::getWritablePath() const -{ - auto localFolderPath = Windows::Storage::ApplicationData::Current->LocalFolder->Path; - return convertPathFormatToUnixStyle(std::string(PlatformStringToString(localFolderPath)) + '\\'); -} - -void CCFileUtilsWinRT::listFilesRecursively(const std::string& dirPath, std::vector *files) const -{ - std::string fullpath = fullPathForFilename(dirPath); - if (isDirectoryExist(fullpath)) - { - tinydir_dir dir; - std::wstring fullpathstr = StringUtf8ToWideChar(fullpath); - - if (tinydir_open(&dir, &fullpathstr[0]) != -1) - { - while (dir.has_next) - { - tinydir_file file; - if (tinydir_readfile(&dir, &file) == -1) - { - // Error getting file - break; - } - std::string fileName = StringWideCharToUtf8(file.name); - - if (fileName != "." && fileName != "..") - { - std::string filepath = StringWideCharToUtf8(file.path); - if (file.is_dir) - { - filepath.append("/"); - files->push_back(filepath); - listFilesRecursively(filepath, files); - } - else - { - files->push_back(filepath); - } - } - - if (tinydir_next(&dir) == -1) - { - // Error getting next file - break; - } - } - } - tinydir_close(&dir); - } -} - -std::vector CCFileUtilsWinRT::listFiles(const std::string& dirPath) const -{ - std::string fullpath = fullPathForFilename(dirPath); - std::vector files; - if (isDirectoryExist(fullpath)) - { - tinydir_dir dir; - std::wstring fullpathstr = StringUtf8ToWideChar(fullpath); - - if (tinydir_open(&dir, &fullpathstr[0]) != -1) - { - while (dir.has_next) - { - tinydir_file file; - if (tinydir_readfile(&dir, &file) == -1) - { - // Error getting file - break; - } - - std::string filepath = StringWideCharToUtf8(file.path); - if (file.is_dir) - { - filepath.append("/"); - } - files.push_back(filepath); - - if (tinydir_next(&dir) == -1) - { - // Error getting next file - break; - } - } - } - tinydir_close(&dir); - } - return files; -} - -string CCFileUtilsWinRT::getAppPath() -{ - Windows::ApplicationModel::Package^ package = Windows::ApplicationModel::Package::Current; - return convertPathFormatToUnixStyle(std::string(PlatformStringToString(package->InstalledLocation->Path))); -} - -NS_CC_END diff --git a/cocos/platform/winrt/CCFileUtilsWinRT.h b/cocos/platform/winrt/CCFileUtilsWinRT.h deleted file mode 100644 index ff2c35c7f6e8..000000000000 --- a/cocos/platform/winrt/CCFileUtilsWinRT.h +++ /dev/null @@ -1,138 +0,0 @@ -/**************************************************************************** - Copyright (c) 2010 cocos2d-x.org - Copyright (c) Microsoft Open Technologies, Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - ****************************************************************************/ -#ifndef __CC_FILEUTILS_WINRT_H__ -#define __CC_FILEUTILS_WINRT_H__ - -#include -#include - -#include "platform/CCFileUtils.h" -#include "platform/CCPlatformMacros.h" -#include "base/ccTypes.h" - -NS_CC_BEGIN - -/** - * @addtogroup platform - * @{ - */ - -//! @brief Helper class to handle file operations -class CC_DLL CCFileUtilsWinRT : public FileUtils -{ - friend class FileUtils; -protected: - CCFileUtilsWinRT(); -public: - /* override functions */ - bool init(); - virtual std::string getWritablePath() const; - virtual bool isAbsolutePath(const std::string& strPath) const; - virtual std::string getPathForFilename(const std::string& filename, const std::string& resolutionDirectory, const std::string& searchPath) const override; - virtual std::string getFullPathForDirectoryAndFilename(const std::string& strDirectory, const std::string& strFilename) const override; - virtual std::string getSuitableFOpen(const std::string& filenameUtf8) const override; - virtual long getFileSize(const std::string &filepath) override; - virtual FileUtils::Status getContents(const std::string& filename, ResizableBuffer* buffer) override; - static std::string getAppPath(); - - /** - * List all files in a directory. - * - * @param dirPath The path of the directory, it could be a relative or an absolute path. - * @return File paths in a string vector - */ - virtual std::vector listFiles(const std::string& dirPath) const; - - /** - * List all files recursively in a directory. - * - * @param dirPath The path of the directory, it could be a relative or an absolute path. - * @return File paths in a string vector - */ - virtual void listFilesRecursively(const std::string& dirPath, std::vector *files) const; - -private: - virtual bool isFileExistInternal(const std::string& strFilePath) const override; - - /** - * Renames a file under the given directory. - * - * @param path The parent directory path of the file, it must be an absolute path. - * @param oldname The current name of the file. - * @param name The new name of the file. - * @return True if the file have been renamed successfully, false if not. - */ - virtual bool renameFile(const std::string &path, const std::string &oldname, const std::string &name) override; - - - /** - * Renames a file. - * - * @param oldfullpath The current name of the file, including path and name. - * @param newfullpath The new name of the file, including path and name - * @return True if the file have been renamed successfully, false if not. - */ - virtual bool renameFile(const std::string &oldfullpath, const std::string& newfullpath) override; - - /** - * Checks whether a directory exists without considering search paths and resolution orders. - * @param dirPath The directory (with absolute path) to look up for - * @return Returns true if the directory found at the given absolute path, otherwise returns false - */ - virtual bool isDirectoryExistInternal(const std::string& dirPath) const override; - - /** - * Removes a file. - * - * @param filepath The full path of the file, it must be an absolute path. - * @return True if the file have been removed successfully, false if not. - */ - virtual bool removeFile(const std::string &filepath) override; - - /** - * Creates a directory. - * - * @param dirPath The path of the directory, it must be an absolute path. - * @return True if the directory have been created successfully, false if not. - */ - virtual bool createDirectory(const std::string& dirPath) override; - - /** - * Removes a directory. - * - * @param dirPath The full path of the directory, it must be an absolute path. - * @return True if the directory have been removed successfully, false if not. - */ - virtual bool removeDirectory(const std::string& dirPath) override; -}; - -// end of platform group -/// @} - -NS_CC_END - -#endif // __CC_FILEUTILS_WINRT_H__ - diff --git a/cocos/platform/winrt/CCFreeTypeFont.cpp b/cocos/platform/winrt/CCFreeTypeFont.cpp deleted file mode 100644 index 9cfbf6bc2969..000000000000 --- a/cocos/platform/winrt/CCFreeTypeFont.cpp +++ /dev/null @@ -1,754 +0,0 @@ -/**************************************************************************** - Copyright (c) 2013 cocos2d-x.org http://cocos2d-x.org - Copyright (c) Microsoft Open Technologies, Inc. - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - ****************************************************************************/ - -#include "platform/winrt/CCFreeTypeFont.h" -#include "base/CCDirector.h" -#include "platform/CCFileUtils.h" - -#include -#include -#include -#include -#include -#include -#include - -using namespace std; - -NS_CC_BEGIN - -static map s_fontsNames; -static FT_Library s_FreeTypeLibrary = nullptr; - -const std::string CCFreeTypeFont::DEFAULT_FONT = "arial"; - -CCFreeTypeFont::CCFreeTypeFont() - :m_space(" ") - , m_face(nullptr) -{ - -} - -CCFreeTypeFont::~CCFreeTypeFont() -{ - reset(); -} - -void CCFreeTypeFont::reset() -{ - for(auto& line : m_lines) - { - line->glyphs.clear(); - delete line; - } - - m_lines.clear(); - - if(m_face) - { - FT_Done_Face(m_face); - m_face = nullptr; - } -} - -unsigned char* CCFreeTypeFont::initWithString(const char * text, const FontDefinition& textDefinition, Device::TextAlign align, int &width, int &height, ssize_t& dataLength) -{ - FT_Error error = 0; - ssize_t size = 0; - unsigned char* pBuffer = nullptr; - unsigned char* data = nullptr; - - Size winSize = Director::getInstance()->getWinSizeInPixels(); - m_windowWidth = (int)winSize.width; - - m_inWidth = textDefinition._dimensions.width; - m_inHeight = textDefinition._dimensions.height; - - m_fontFillColorR = textDefinition._fontFillColor.r; - m_fontFillColorG = textDefinition._fontFillColor.g; - m_fontFillColorB = textDefinition._fontFillColor.b; - m_fontFillColorA = textDefinition._fontAlpha; - -#if 0 - // check the cache for the font file buffer - auto ittFontNames = s_fontsNames.find(textDefinition._fontName); - if(ittFontNames != s_fontsNames.end()) - { - pBuffer = ittFontNames->second.pBuffer; - size = ittFontNames->second.size; - } -#endif // 0 - - - if(!pBuffer) - { - // attempt to load font from Resources fonts folder - pBuffer = loadFont(textDefinition._fontName.c_str(), &size); - if(!pBuffer) - { - // attempt to load font from System fonts folder - pBuffer = loadSystemFont(textDefinition._fontName.c_str(), &size); - } - if(!pBuffer) - { - // attempt to load default font from Resources fonts folder - pBuffer = loadFont(DEFAULT_FONT.c_str(), &size); - } - if(!pBuffer) - { - // attempt to load default font from System fonts folder - pBuffer = loadSystemFont(DEFAULT_FONT.c_str(), &size); - } - - if(!pBuffer) // font not found! - { - return false; - } - -#if 0 - // cache the font file buffer - FontBufferInfo info; - info.pBuffer = pBuffer; - info.size = size; - s_fontsNames[textDefinition._fontName]=info; -#endif // 0 - - } - - m_fontName = textDefinition._fontName; - m_text = text; - - if(!s_FreeTypeLibrary) - { - error = FT_Init_FreeType(&s_FreeTypeLibrary); - } - - if(!error && !m_face) - { - error = FT_New_Memory_Face(s_FreeTypeLibrary, pBuffer, size, 0, &m_face); - } - - if(!error) - { - error = FT_Select_Charmap(m_face, FT_ENCODING_UNICODE); - } - - - if(!error) - { - error = FT_Set_Char_Size(m_face, textDefinition._fontSize << 6, textDefinition._fontSize << 6, 72, 72); - } - - if(!error) - { - error = initGlyphs(text); - } - - if (!error) - { - data = getBitmap(align, width, height, dataLength); - } - - delete [] pBuffer; - - reset(); - - return data; -} - -unsigned char* CCFreeTypeFont::getBitmap(Device::TextAlign eAlignMask, int &width, int &height, ssize_t& dataLength) -{ - int lineNumber = 0; - int totalLines = static_cast(m_lines.size()); - - m_width = m_inWidth ? m_inWidth : m_textWidth; - m_height = m_inHeight ? m_inHeight : m_textHeight; - - unsigned int size = m_width * m_height * 4; - unsigned char* pBuffer = new unsigned char[size]; - dataLength = size; - if(!pBuffer) - { - dataLength = 0; - return nullptr; - } - memset(pBuffer, 0, size); - - for (auto& line : m_lines) - { - FT_Vector pen = getPenForAlignment(line, eAlignMask, lineNumber, totalLines); - drawText(line, pBuffer, &pen); - lineNumber++; - } - width = m_width; - height = m_height; - - return pBuffer; -} - -FT_Vector CCFreeTypeFont::getPenForAlignment(FTLineInfo* pInfo, Device::TextAlign eAlignMask,int lineNumber, int totalLines) -{ - FT_Error error = 0; - FT_Vector pen; - - int top; - int stringWidth = pInfo->bbox.xMax - pInfo->bbox.xMin; - int maxLineNumber = totalLines - 1; - pen.x = 0; - pen.y = 0; - - switch(eAlignMask) - { - case Device::TextAlign::TOP: // Horizontal center and vertical top. - pen.x = ((m_width - stringWidth) / 2) - pInfo->bbox.xMin; - pen.y = pInfo->bbox.yMax + (lineNumber * m_lineHeight); - break; - - case Device::TextAlign::TOP_LEFT: // Horizontal left and vertical top. - pen.x -=pInfo->bbox.xMin; - pen.y = pInfo->bbox.yMax + (lineNumber * m_lineHeight); - break; - - case Device::TextAlign::TOP_RIGHT: // Horizontal right and vertical top. - pen.x = m_width - stringWidth - pInfo->bbox.xMin; - pen.y = pInfo->bbox.yMax + (lineNumber * m_lineHeight); - break; - - case Device::TextAlign::BOTTOM_RIGHT: // Horizontal right and vertical bottom. - pen.x = m_width - stringWidth - pInfo->bbox.xMin; - pen.y = m_height + pInfo->bbox.yMin - ((maxLineNumber - lineNumber) * m_lineHeight); - break; - - case Device::TextAlign::BOTTOM: // Horizontal center and vertical bottom. - pen.x = ((m_width - stringWidth) / 2) - pInfo->bbox.xMin; - pen.y = m_height + pInfo->bbox.yMin - ((maxLineNumber - lineNumber) * m_lineHeight); - break; - - case Device::TextAlign::BOTTOM_LEFT: // Horizontal left and vertical bottom. - pen.x -=pInfo->bbox.xMin; - top = (m_height - m_textHeight) / 2; - pen.y = m_height + pInfo->bbox.yMin - ((maxLineNumber - lineNumber) * m_lineHeight); - break; - - case Device::TextAlign::CENTER: // Horizontal center and vertical center - pen.x = ((m_width - stringWidth) / 2) - pInfo->bbox.xMin; - top = (m_height - m_textHeight) / 2; - pen.y = top + (lineNumber * m_lineHeight) + pInfo->bbox.yMax; - break; - - case Device::TextAlign::RIGHT: // Horizontal right and vertical center. - pen.x = m_width - stringWidth - pInfo->bbox.xMin; - top = (m_height - m_textHeight) / 2; - pen.y = top + (lineNumber * m_lineHeight) + pInfo->bbox.yMax; - break; - - case Device::TextAlign::LEFT: // Horizontal left and vertical center. - default: - pen.x -=pInfo->bbox.xMin; - top = (m_height - m_textHeight) / 2; - pen.y = top + (lineNumber * m_lineHeight) + pInfo->bbox.yMax; - break; - } - - return pen; -} - -void CCFreeTypeFont::drawText(FTLineInfo* pInfo, unsigned char* pBuffer, FT_Vector *pen) -{ - - auto glyphs = pInfo->glyphs; - for (auto& glyph : glyphs) - { - FT_Glyph image = glyph.image; - FT_Error error = FT_Glyph_To_Bitmap(&image, FT_RENDER_MODE_NORMAL, 0, 1); - if (!error) - { - FT_BitmapGlyph bit = (FT_BitmapGlyph)image; - draw_bitmap(pBuffer, &bit->bitmap, pen->x + glyph.pos.x + bit->left,pen->y - bit->top); - FT_Done_Glyph(image); - } - } -} - - -void CCFreeTypeFont::draw_bitmap(unsigned char* pBuffer, FT_Bitmap* bitmap, FT_Int x, FT_Int y) -{ - FT_Int i, j, p, q; - FT_Int x_max = x + bitmap->width; - FT_Int y_max = y + bitmap->rows; - float fontAlpha = m_fontFillColorA / 255.0f; - - for (i = x, p = 0; i < x_max; i++, p++) - { - for ( j = y, q = 0; j < y_max; j++, q++ ) - { - if (i < 0 || j < 0 || i >= m_width || j >= m_height) - continue; - - unsigned char value = bitmap->buffer[q * bitmap->width + p]; - - if(value > 0) - { - FT_Int index = (j * m_width * 4) + (i * 4); - pBuffer[index++] = m_fontFillColorR; - pBuffer[index++] = m_fontFillColorG; - pBuffer[index++] = m_fontFillColorB; - pBuffer[index++] = value * fontAlpha; - } - } - } -} - -void CCFreeTypeFont::endLine() -{ - if(m_currentLine) - { - m_lines.push_back(m_currentLine); - m_textWidth = std::max((long)m_textWidth,m_currentLine->bbox.xMax - m_currentLine->bbox.xMin); - m_textHeight += m_lineHeight; - } -} - -void CCFreeTypeFont::newLine() -{ - m_currentLine = new FTLineInfo(); - m_currentLine->width = 0; - m_currentLine->pen.x = 0; - m_currentLine->pen.y = 0; -} - - -FT_Error CCFreeTypeFont::addWord(const std::string& word) -{ - std::vector glyphs; // glyphs for the word - FT_BBox bbox; // bounding box containing all of the glyphs in the word - int maxWidth = m_inWidth ? m_inWidth : m_windowWidth; - std::string newWord; - - if(m_currentLine->width > 0) - { - newWord = ' ' + word; - } - else - { - newWord = word; - } - - FT_Error error = initWordGlyphs(glyphs, newWord, m_currentLine->pen); - if(!error) - { - compute_bbox(glyphs, &bbox); - if(m_currentLine->width == 0 || bbox.xMax <= maxWidth) - { - m_currentLine->glyphs.insert(m_currentLine->glyphs.end(),glyphs.begin(),glyphs.end()); - if(m_currentLine->width == 0) - { - m_currentLine->bbox = bbox; - } - else - { - m_currentLine->bbox.xMax = bbox.xMax; - } - m_currentLine->width = m_currentLine->bbox.xMax - m_currentLine->bbox.xMin; - } - else - { - endLine(); - newLine(); - addWord(word); - } - } - return error; -} - -FT_Error CCFreeTypeFont::initGlyphs(const char* text) -{ - FT_Error error = 0; - std::stringstream stringStream(text); - std::string line; - vector lines; - vector words; - - m_textWidth = 0; - m_textHeight = 0; - // the height of a line of text based on the max height of a glyph in the font size - m_lineHeight = ((m_face->size->metrics.ascender) >> 6) - ((m_face->size->metrics.descender) >> 6); - - m_lines.clear(); - - while(std::getline(stringStream, line) && !error) - { - newLine(); - - std::size_t prev = 0, pos; - while ((pos = line.find_first_of(" ", prev)) != std::string::npos) - { - if (pos > prev) - { - addWord(line.substr(prev, pos-prev)); - } - prev = pos + 1; - } - if (prev < line.length()) - { - addWord(line.substr(prev, std::string::npos)); - } - endLine(); - } - - return error; -} - -// if linewidth > m_inWidth -// get words for line - -void CCFreeTypeFont::initWords(const char* text) -{ - std::stringstream stringStream(text); - std::string line; - vector lines; - vector words; - - while(std::getline(stringStream, line)) - { - lines.push_back(line); - } - - for (auto& line : lines) - { - std::size_t prev = 0, pos; - while ((pos = line.find_first_of(" ';", prev)) != std::string::npos) - { - if (pos > prev) - words.push_back(line.substr(prev, pos-prev)); - prev = pos+1; - } - if (prev < line.length()) - words.push_back(line.substr(prev, std::string::npos)); - } - - for (auto& word : words) - { - std::string foo(word); - } -} - -FT_Error CCFreeTypeFont::initWordGlyphs(std::vector& glyphs, const std::string& text, FT_Vector& pen) -{ - FT_GlyphSlot slot = m_face->glyph; - FT_UInt glyph_index; - FT_UInt previous = 0; - FT_Error error = 0; - PGlyph glyph; - unsigned int numGlyphs = 0; - - int num_chars = static_cast(text.size()); - int nBufLen = num_chars + 1; - wchar_t * pwszBuffer = new wchar_t[nBufLen]; - if(!pwszBuffer) - { - return -1; - } - - memset(pwszBuffer,0,nBufLen); - num_chars = MultiByteToWideChar(CP_UTF8, 0, text.c_str(), num_chars, pwszBuffer, nBufLen); - pwszBuffer[num_chars] = '\0'; - - glyphs.clear(); - glyphs.resize(num_chars); - FT_Bool useKerning = FT_HAS_KERNING(m_face); - - for (int n = 0; n < num_chars; n++) - { - glyph = &glyphs[numGlyphs]; - - /* convert character code to glyph index */ - FT_ULong c = pwszBuffer[n]; - glyph_index = FT_Get_Char_Index(m_face, c); - - if (useKerning && previous && glyph_index) - { - FT_Vector delta; - FT_Get_Kerning(m_face, previous, glyph_index, - FT_KERNING_DEFAULT, &delta); - pen.x += delta.x >> 6; - } - - /* store current pen position */ - glyph->pos = pen; - glyph->index = glyph_index; - - /* load glyph image into the slot without rendering */ - error = FT_Load_Glyph(m_face, glyph_index, FT_LOAD_DEFAULT); - if (error) - continue; /* ignore errors, jump to next glyph */ - - /* extract glyph image and store it in our table */ - error = FT_Get_Glyph(m_face->glyph, &glyph->image); - if (error) - continue; /* ignore errors, jump to next glyph */ - - /* translate the glyph image now */ - FT_Glyph_Transform(glyph->image, 0, &glyph->pos); - - /* increment pen position */ - pen.x += slot->advance.x >> 6; - - /* record current glyph index */ - previous = glyph_index; - - numGlyphs++; - } - - CC_SAFE_DELETE_ARRAY(pwszBuffer); - - return error; -} - -void CCFreeTypeFont::compute_bbox(std::vector& glyphs, FT_BBox *abbox) -{ - FT_BBox bbox; - FT_BBox glyph_bbox; - - /* initialize string bbox to "empty" values */ - bbox.xMin = 32000; - bbox.xMax = -32000; - - // use the max and min values for the entire font face - bbox.yMin = (m_face->size->metrics.descender) >> 6; - bbox.yMax = (m_face->size->metrics.ascender) >> 6; - - /* for each glyph image, compute its bounding box, */ - /* translate it, and grow the string bbox */ - for (auto& glyph : glyphs) - { - FT_Glyph_Get_CBox(glyph.image, ft_glyph_bbox_pixels, &glyph_bbox); - - glyph_bbox.xMin += glyph.pos.x; - glyph_bbox.xMax += glyph.pos.x; - glyph_bbox.yMin += glyph.pos.y; - glyph_bbox.yMax += glyph.pos.y; - - if (glyph_bbox.xMin < bbox.xMin) - bbox.xMin = glyph_bbox.xMin; - - if (glyph_bbox.yMin < bbox.yMin) - bbox.yMin = glyph_bbox.yMin; - - if (glyph_bbox.xMax > bbox.xMax) - bbox.xMax = glyph_bbox.xMax; - - if (glyph_bbox.yMax > bbox.yMax) - bbox.yMax = glyph_bbox.yMax; - } - - /* check that we really grew the string bbox */ - if (bbox.xMin > bbox.xMax) - { - bbox.xMin = 0; - bbox.yMin = 0; - bbox.xMax = 0; - bbox.yMax = 0; - } - - /* return string bbox */ - *abbox = bbox; -} - -unsigned char* CCFreeTypeFont::loadFont(const char *pFontName, ssize_t *size) -{ - - - std::string lowerCase(pFontName); - std::string path(pFontName); - - for (unsigned int i = 0, length = lowerCase.length(); i < length; ++i) - { - lowerCase[i] = tolower(lowerCase[i]); - } - - if (lowerCase == "") - { - lowerCase = DEFAULT_FONT; - path = lowerCase; - } - - if (std::string::npos == lowerCase.find("fonts/")) - { - path = "fonts/" + lowerCase; - } - - if (std::string::npos == lowerCase.find(".ttf")) - { - path += ".ttf"; - } - - std::string fullpath = FileUtils::getInstance()->fullPathForFilename(path.c_str()); - - if (fullpath == "") - { - return nullptr; - } - - Data d; - FileUtils::getInstance()->getContents(fullpath, &d); - return d.takeBuffer(size); -} - -unsigned char* CCFreeTypeFont::loadSystemFont(const char *pFontName, ssize_t *size) -{ - std::string aName(pFontName); - unsigned char* pBuffer = nullptr; - HRESULT hr = S_OK; - IDWriteFactory *writeFactory = nullptr; - IDWriteFontCollection *fontCollection = nullptr; - IDWriteFontFamily *fontFamily = nullptr; - IDWriteFont *matchingFont = nullptr; - IDWriteFontFace *fontFace = nullptr; - IDWriteFontFile *fontFile = nullptr; - IDWriteFontFileLoader *fontFileLoader = nullptr; - IDWriteFontFileStream *fontFileStream = nullptr; - UINT32 index; - BOOL exists; - std::wstring fontNameW; - const void *fontFileReferenceKey = nullptr; - UINT32 fontFileReferenceKeySize; - void *fragmentContext = nullptr; - - for (unsigned int i = 0, length = aName.length(); i < length; ++i) - { - aName[i] = tolower(aName[i]); - } - fontNameW.assign(aName.begin(), aName.end()); - - //create the factory - hr = DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory), reinterpret_cast(&writeFactory)); - - if(SUCCEEDED(hr)) - { - //obtain the fonts owned by the machine - hr = writeFactory->GetSystemFontCollection(&fontCollection, TRUE); - } - - //get the font - if(SUCCEEDED(hr)) - { - hr = fontCollection->FindFamilyName(fontNameW.c_str(), &index, &exists); - if(SUCCEEDED(hr) && exists) - { - hr = fontCollection->GetFontFamily(index, &fontFamily); - - if(SUCCEEDED(hr)) - { - hr = fontFamily->GetFirstMatchingFont(DWRITE_FONT_WEIGHT_REGULAR, DWRITE_FONT_STRETCH_NORMAL, DWRITE_FONT_STYLE_NORMAL, &matchingFont); - } - - if(SUCCEEDED(hr)) - { - hr = matchingFont->CreateFontFace(&fontFace); - } - - if(SUCCEEDED(hr)) - { - UINT32 numberOfFiles = 1; - hr = fontFace->GetFiles(&numberOfFiles, &fontFile); - } - - if(SUCCEEDED(hr)) - { - //create the font file stream - hr = fontFile->GetReferenceKey(&fontFileReferenceKey, &fontFileReferenceKeySize); - } - - if(SUCCEEDED(hr)) - { - hr = fontFile->GetLoader(&fontFileLoader); - } - - if(SUCCEEDED(hr)) - { - hr = fontFileLoader->CreateStreamFromKey(fontFileReferenceKey, fontFileReferenceKeySize, &fontFileStream); - } - - if(SUCCEEDED(hr)) - { - //finally get the font file dat - UINT64 fileSize; - const void *fragmentStart = nullptr; - hr = fontFileStream->GetFileSize(&fileSize); - - if(SUCCEEDED(hr)) - { - hr = fontFileStream->ReadFileFragment(&fragmentStart, 0, fileSize, &fragmentContext); - } - - if(SUCCEEDED(hr)) - { - pBuffer = (unsigned char*)malloc((size_t)fileSize); - memcpy(pBuffer, fragmentStart, (size_t)fileSize); - *size = (unsigned long)fileSize; - } - } - } - } - - //clean up all the DWrite stuff - if(fontFileStream) - { - fontFileStream->ReleaseFileFragment(fragmentContext); - fontFileStream->Release(); - } - if(fontFileLoader) - { - fontFileLoader->Release(); - } - if(fontFile) - { - fontFile->Release(); - } - if(fontFace) - { - fontFace->Release(); - } - if(matchingFont) - { - matchingFont->Release(); - } - if(fontFamily) - { - fontFamily->Release(); - } - if(fontCollection) - { - fontCollection->Release(); - } - if(writeFactory) - { - writeFactory->Release(); - } - - return pBuffer; -} - -NS_CC_END diff --git a/cocos/platform/winrt/CCFreeTypeFont.h b/cocos/platform/winrt/CCFreeTypeFont.h deleted file mode 100644 index 3e6ebbb6f388..000000000000 --- a/cocos/platform/winrt/CCFreeTypeFont.h +++ /dev/null @@ -1,141 +0,0 @@ -/**************************************************************************** -Copyright (c) 2010 cocos2d-x.org -Copyright (c) Microsoft Open Technologies, Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - -http://www.cocos2d-x.org - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -****************************************************************************/ - -#ifndef __PLATFORM_WINRT_FREETYPE_H__ -#define __PLATFORM_WINRT_FREETYPE_H__ - -#include "platform/CCCommon.h" -#include "platform/CCDevice.h" -#include -#include -#include - -#define generic GenericFromFreeTypeLibrary -#define internal InternalFromFreeTypeLibrary -#include -#include -#include -#include -#include -#undef generic -#undef internal - -NS_CC_BEGIN - -typedef struct TGlyph_ -{ - FT_UInt index; // glyph index - FT_Vector pos; // glyph origin on the baseline - FT_Glyph image; // glyph image -} TGlyph, *PGlyph; - -typedef struct FontBufferInfo -{ - unsigned char* pBuffer; - unsigned long size; -} FontBufferInfo; - -typedef struct FTWordInfo -{ - std::vector glyphs; // glyphs for the word - FT_BBox bbox; // bounding box containing all of the glyphs in the word -} FTWordInfo; - - -typedef struct FTLineInfo -{ - std::vector glyphs; // glyphs for the line text - FT_BBox bbox; // bounding box containing all of the glyphs in the line - unsigned int width; // width of the line - FT_Vector pen; // current pen position -} FTLineInfo; - - -class CC_DLL CCFreeTypeFont -{ -public: - CCFreeTypeFont(); - ~CCFreeTypeFont(); - - unsigned char* initWithString(const char * text, const FontDefinition& textDefinition, Device::TextAlign align, int &width, int &height, ssize_t& dataLength); - - static const std::string DEFAULT_FONT; - -private: - - unsigned char* getBitmap(Device::TextAlign eAlignMask, int &width, int &height, ssize_t& dataLength); - - - unsigned char* loadFont(const char *pFontName, ssize_t* size); - - unsigned char* CCFreeTypeFont::loadSystemFont(const char *pFontName, ssize_t* size); - - FT_Error CCFreeTypeFont::initGlyphs(const char* text); - FT_Error CCFreeTypeFont::initWordGlyphs(std::vector& glyphs, const std::string& text, FT_Vector& pen); - - void compute_bbox(std::vector& glyphs, FT_BBox *abbox); - - void drawText(FTLineInfo* pInfo, unsigned char* pBuffer, FT_Vector *pen); - - void draw_bitmap(unsigned char* pBuffer, FT_Bitmap* bitmap,FT_Int x,FT_Int y); - - void initWords(const char* text); - - void reset(); - - FT_Vector getPenForAlignment(FTLineInfo* pInfo, Device::TextAlign eAlignMask, int lineNumber, int totalLines); - - FT_Error addWord(const std::string& word); - void newLine(); - void endLine(); - - const std::string m_space; - - std::string m_text; - std::string m_fontName; - FT_Face m_face; - std::vector m_lines; - - int m_inWidth; // requested width of text box - int m_inHeight; // requested height of text box - int m_width; // final bitMap width - int m_height; // final bitMap height - int m_textWidth; // width of text text after word wrapping and line breaks - int m_textHeight; // height of text text after word wrapping and line breaks - int m_lineHeight; // height of a line for the font size - int m_windowWidth; // the width of the window - - FTLineInfo* m_currentLine; // the current line object to add words to. - - int m_fontFillColorR; - int m_fontFillColorG; - int m_fontFillColorB; - int m_fontFillColorA; -}; - -NS_CC_END - -#endif diff --git a/cocos/platform/winrt/CCGL.h b/cocos/platform/winrt/CCGL.h deleted file mode 100644 index becb9eb129b6..000000000000 --- a/cocos/platform/winrt/CCGL.h +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -Copyright (c) 2010 cocos2d-x.org -Copyright (c) Microsoft Open Technologies, Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - -http://www.cocos2d-x.org - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -****************************************************************************/ - -#ifndef __CCGL_H__ -#define __CCGL_H__ - -#define GL_BGRA GL_BGRA_EXT -#define glClearDepth glClearDepthf -#define GL_WRITE_ONLY GL_WRITE_ONLY_OES - -#if CC_TARGET_PLATFORM == CC_PLATFORM_WINRT -#include "EGL/egl.h" -#include "EGL/eglext.h" -#include "EGL/eglplatform.h" -#include "GLES2/gl2.h" -#include "GLES2/gl2ext.h" -#include "GLES3/gl3.h" - -#define glClearDepth glClearDepthf -#define glDeleteVertexArrays glDeleteVertexArraysOES -#define glGenVertexArrays glGenVertexArraysOES -#define glBindVertexArray glBindVertexArrayOES -#define glMapBuffer glMapBufferOES -#define glUnmapBuffer glUnmapBufferOES - -#define GL_WRITE_ONLY GL_WRITE_ONLY_OES - -#endif - - - -#endif // __CCGL_H__ diff --git a/cocos/platform/winrt/CCGLViewImpl-winrt.cpp b/cocos/platform/winrt/CCGLViewImpl-winrt.cpp deleted file mode 100644 index 87d7e9949e78..000000000000 --- a/cocos/platform/winrt/CCGLViewImpl-winrt.cpp +++ /dev/null @@ -1,643 +0,0 @@ -/**************************************************************************** -Copyright (c) 2013 cocos2d-x.org -Copyright (c) Microsoft Open Technologies, Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - -http://www.cocos2d-x.org - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -****************************************************************************/ - -#include "platform/winrt/CCGLViewImpl-winrt.h" -#include "base/ccMacros.h" -#include "base/CCDirector.h" -#include "base/CCTouch.h" -#include "base/CCIMEDispatcher.h" -#include "base/CCEventListenerKeyboard.h" -#include "platform/winrt/CCApplication.h" -#include "platform/winrt/CCWinRTUtils.h" -#include "deprecated/CCNotificationCenter.h" -#include "base/CCEventDispatcher.h" -#include "base/CCEventMouse.h" - -#include - -using namespace Platform; -using namespace Concurrency; -using namespace Windows::System; -using namespace Windows::Foundation; -using namespace Windows::Foundation::Collections; -using namespace Windows::Graphics::Display; -using namespace Windows::UI::Input; -using namespace Windows::UI::Core; -using namespace Windows::UI::Xaml; -using namespace Windows::UI::Xaml::Controls; -using namespace Windows::UI::Xaml::Media; -using namespace Windows::UI::Xaml::Input; -using namespace Windows::System; -using namespace Windows::UI::ViewManagement; -using namespace Windows::ApplicationModel; -using namespace Windows::ApplicationModel::Core; -using namespace Windows::ApplicationModel::Activation; -using namespace Platform; -using namespace Microsoft::WRL; - - -NS_CC_BEGIN - -static GLViewImpl* s_pEglView = nullptr; - -GLViewImpl* GLViewImpl::create(const std::string& viewName) -{ - auto ret = new GLViewImpl; - if(ret && ret->initWithFullScreen(viewName)) - { - ret->autorelease(); - return ret; - } - - return nullptr; -} - -GLViewImpl::GLViewImpl() - : _frameZoomFactor(1.0f) - , _supportTouch(true) - , _isRetina(false) - , _isCursorVisible(true) - , m_lastPointValid(false) - , m_running(false) - , m_initialized(false) - , m_windowClosed(false) - , m_windowVisible(true) - , m_width(0) - , m_height(0) - , m_orientation(DisplayOrientations::Landscape) - , m_appShouldExit(false) - , _lastMouseButtonPressed(EventMouse::MouseButton::BUTTON_UNSET) -{ - s_pEglView = this; - _viewName = "cocos2dx"; - - m_keyboard = ref new KeyBoardWinRT(); - - m_backButtonListener = EventListenerKeyboard::create(); - m_backButtonListener->onKeyReleased = CC_CALLBACK_2(GLViewImpl::BackButtonListener, this); - Director::getInstance()->getEventDispatcher()->addEventListenerWithFixedPriority(m_backButtonListener, INT_MAX); -} - -GLViewImpl::~GLViewImpl() -{ - CC_ASSERT(this == s_pEglView); - s_pEglView = nullptr; - - // TODO: cleanup -} - -bool GLViewImpl::initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor) -{ - setViewName(viewName); - setFrameSize(rect.size.width, rect.size.height); - setFrameZoomFactor(frameZoomFactor); - return true; -} - -bool GLViewImpl::initWithFullScreen(const std::string& viewName) -{ - return initWithRect(viewName, Rect(0, 0, m_width, m_height), 1.0f); -} - -bool GLViewImpl::Create(float width, float height, float dpi, DisplayOrientations orientation) -{ - m_orientation = orientation; - m_dpi = dpi; - UpdateForWindowSizeChange(width, height); - return true; -} - -void cocos2d::GLViewImpl::setCursorVisible(bool isVisible) -{ - _isCursorVisible = isVisible; -} - -void GLViewImpl::setDispatcher(Windows::UI::Core::CoreDispatcher^ dispatcher) -{ - m_dispatcher = dispatcher; -} - -void GLViewImpl::setPanel(Windows::UI::Xaml::Controls::Panel^ panel) -{ - m_panel = panel; -} - -void GLViewImpl::setIMEKeyboardState(bool bOpen) -{ - std::string str; - setIMEKeyboardState(bOpen, str); -} - -bool GLViewImpl::ShowMessageBox(Platform::String^ title, Platform::String^ message) -{ - if (m_dispatcher.Get()) - { - m_dispatcher.Get()->RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal, ref new Windows::UI::Core::DispatchedHandler([title, message]() - { - // Show the message dialog - auto msg = ref new Windows::UI::Popups::MessageDialog(message, title); - // Set the command to be invoked when a user presses 'ESC' - msg->CancelCommandIndex = 1; - msg->ShowAsync(); - })); - - return true; - } - return false; -} - -void GLViewImpl::setIMEKeyboardState(bool bOpen, const std::string& str) -{ - if(bOpen) - { - m_keyboard->ShowKeyboard(PlatformStringFromString(str)); - } - else - { - m_keyboard->HideKeyboard(PlatformStringFromString(str)); - } -} - -void GLViewImpl::swapBuffers() -{ - -} - -bool GLViewImpl::isOpenGLReady() -{ - return true; -} - -void GLViewImpl::end() -{ - m_windowClosed = true; - m_appShouldExit = true; -} - -void GLViewImpl::OnSuspending(Platform::Object^ sender, SuspendingEventArgs^ args) -{ -} - -void GLViewImpl::OnResuming(Platform::Object^ sender, Platform::Object^ args) -{ -} - -// user pressed the Back Key on the phone -void GLViewImpl::OnBackKeyPress() -{ - cocos2d::EventKeyboard::KeyCode cocos2dKey = EventKeyboard::KeyCode::KEY_ESCAPE; - cocos2d::EventKeyboard event(cocos2dKey, false); - cocos2d::Director::getInstance()->getEventDispatcher()->dispatchEvent(&event); -} - -void GLViewImpl::BackButtonListener(EventKeyboard::KeyCode keyCode, Event* event) -{ - if (keyCode == EventKeyboard::KeyCode::KEY_ESCAPE) - { - CCLOG("*********************************************************************"); - CCLOG("GLViewImpl::BackButtonListener: Exiting application!"); - CCLOG(""); - CCLOG("If you want to listen for Windows Phone back button events,"); - CCLOG("add a listener for EventKeyboard::KeyCode::KEY_ESCAPE"); - CCLOG("Make sure you call stopPropagation() on the Event if you don't"); - CCLOG("want your app to exit when the back button is pressed."); - CCLOG(""); - CCLOG("For example, add the following to your scene..."); - CCLOG("auto listener = EventListenerKeyboard::create();"); - CCLOG("listener->onKeyReleased = CC_CALLBACK_2(HelloWorld::onKeyReleased, this);"); - CCLOG("getEventDispatcher()->addEventListenerWithFixedPriority(listener, 1);"); - CCLOG(""); - CCLOG("void HelloWorld::onKeyReleased(EventKeyboard::KeyCode keyCode, Event* event)"); - CCLOG("{"); - CCLOG(" if (keyCode == EventKeyboard::KeyCode::KEY_ESCAPE)"); - CCLOG(" {"); - CCLOG(" if (myAppShouldNotQuit) // or whatever logic you want..."); - CCLOG(" {"); - CCLOG(" event->stopPropagation();"); - CCLOG(" }"); - CCLOG(" }"); - CCLOG("}"); - CCLOG(""); - CCLOG("You MUST call event->stopPropagation() if you don't want your app to quit!"); - CCLOG("*********************************************************************"); - - Director::getInstance()->end(); - } -} - -bool GLViewImpl::AppShouldExit() -{ - return m_appShouldExit; -} - -void GLViewImpl::OnPointerPressed(CoreWindow^ sender, PointerEventArgs^ args) -{ - OnPointerPressed(args); -} - -void GLViewImpl::OnPointerPressed(PointerEventArgs^ args) -{ - intptr_t id = args->CurrentPoint->PointerId; - Vec2 pt = GetPoint(args); - handleTouchesBegin(1, &id, &pt.x, &pt.y); -} - -void GLViewImpl::OnPointerWheelChanged(CoreWindow^ sender, PointerEventArgs^ args) -{ - float direction = (float)args->CurrentPoint->Properties->MouseWheelDelta; - intptr_t id = 0; - Vec2 p(0.0f,0.0f); - handleTouchesBegin(1, &id, &p.x, &p.y); - p.y += direction; - handleTouchesMove(1, &id, &p.x, &p.y); - handleTouchesEnd(1, &id, &p.x, &p.y); -} - -void GLViewImpl::OnVisibilityChanged(CoreWindow^ sender, VisibilityChangedEventArgs^ args) -{ - m_windowVisible = args->Visible; -} - -void GLViewImpl::OnWindowClosed(CoreWindow^ sender, CoreWindowEventArgs^ args) -{ - m_windowClosed = true; -} - -void GLViewImpl::OnPointerMoved(CoreWindow^ sender, PointerEventArgs^ args) -{ - OnPointerMoved(args); -} - -void GLViewImpl::OnPointerMoved( PointerEventArgs^ args) -{ - auto currentPoint = args->CurrentPoint; - if (currentPoint->IsInContact) - { - if (m_lastPointValid) - { - intptr_t id = args->CurrentPoint->PointerId; - Vec2 p = GetPoint(args); - handleTouchesMove(1, &id, &p.x, &p.y); - } - m_lastPoint = currentPoint->Position; - m_lastPointValid = true; - } - else - { - m_lastPointValid = false; - } -} - -void GLViewImpl::OnPointerReleased(CoreWindow^ sender, PointerEventArgs^ args) -{ - OnPointerReleased(args); -} - -void GLViewImpl::OnPointerReleased(PointerEventArgs^ args) -{ - intptr_t id = args->CurrentPoint->PointerId; - Vec2 pt = GetPoint(args); - handleTouchesEnd(1, &id, &pt.x, &pt.y); -} - -void cocos2d::GLViewImpl::OnMousePressed(Windows::UI::Core::PointerEventArgs^ args) -{ - Vec2 mousePosition = GetPointMouse(args); - - // Emulated touch, if left mouse button - if (args->CurrentPoint->Properties->IsLeftButtonPressed) - { - intptr_t id = 0; - Vec2 pt = GetPoint(args); - handleTouchesBegin(1, &id, &pt.x, &pt.y); - } - - if (_lastMouseButtonPressed != EventMouse::MouseButton::BUTTON_UNSET) - { - EventMouse event(EventMouse::MouseEventType::MOUSE_UP); - - event.setMouseButton(_lastMouseButtonPressed); - event.setCursorPosition(mousePosition.x, mousePosition.y); - Director::getInstance()->getEventDispatcher()->dispatchEvent(&event); - } - - EventMouse event(EventMouse::MouseEventType::MOUSE_DOWN); - // Set current button - if (args->CurrentPoint->Properties->IsLeftButtonPressed) - { - _lastMouseButtonPressed = EventMouse::MouseButton::BUTTON_LEFT; - } - else if (args->CurrentPoint->Properties->IsRightButtonPressed) - { - _lastMouseButtonPressed = EventMouse::MouseButton::BUTTON_RIGHT; - } - else if (args->CurrentPoint->Properties->IsMiddleButtonPressed) - { - _lastMouseButtonPressed = EventMouse::MouseButton::BUTTON_MIDDLE; - } - event.setMouseButton(_lastMouseButtonPressed); - event.setCursorPosition(mousePosition.x, mousePosition.y); - Director::getInstance()->getEventDispatcher()->dispatchEvent(&event); -} - -void cocos2d::GLViewImpl::OnMouseMoved(Windows::UI::Core::PointerEventArgs^ args) -{ - Vec2 mousePosition = GetPointMouse(args); - - // Emulated touch, if left mouse button - if (args->CurrentPoint->Properties->IsLeftButtonPressed) - { - intptr_t id = 0; - Vec2 pt = GetPoint(args); - handleTouchesMove(1, &id, &pt.x, &pt.y); - } - - EventMouse event(EventMouse::MouseEventType::MOUSE_MOVE); - // Set current button - if (args->CurrentPoint->Properties->IsLeftButtonPressed) - { - event.setMouseButton(EventMouse::MouseButton::BUTTON_LEFT); - } - else if (args->CurrentPoint->Properties->IsRightButtonPressed) - { - event.setMouseButton(EventMouse::MouseButton::BUTTON_RIGHT); - } - else if (args->CurrentPoint->Properties->IsMiddleButtonPressed) - { - event.setMouseButton(EventMouse::MouseButton::BUTTON_MIDDLE); - } - event.setCursorPosition(mousePosition.x, mousePosition.y); - Director::getInstance()->getEventDispatcher()->dispatchEvent(&event); -} - -void cocos2d::GLViewImpl::OnMouseReleased(Windows::UI::Core::PointerEventArgs^ args) -{ - Vec2 mousePosition = GetPointMouse(args); - - // Emulated touch, if left mouse button - if (_lastMouseButtonPressed == EventMouse::MouseButton::BUTTON_LEFT) - { - intptr_t id = 0; - Vec2 pt = GetPoint(args); - handleTouchesEnd(1, &id, &pt.x, &pt.y); - } - - EventMouse event(EventMouse::MouseEventType::MOUSE_UP); - - event.setMouseButton(_lastMouseButtonPressed); - event.setCursorPosition(mousePosition.x, mousePosition.y); - Director::getInstance()->getEventDispatcher()->dispatchEvent(&event); - - _lastMouseButtonPressed = EventMouse::MouseButton::BUTTON_UNSET; -} - -void cocos2d::GLViewImpl::OnMouseWheelChanged(Windows::UI::Core::PointerEventArgs^ args) -{ - Vec2 mousePosition = GetPointMouse(args); - - EventMouse event(EventMouse::MouseEventType::MOUSE_SCROLL); - - float delta = args->CurrentPoint->Properties->MouseWheelDelta; - - if (args->CurrentPoint->Properties->IsHorizontalMouseWheel) - { - event.setScrollData(delta, 0.0f); - } - else - { - event.setScrollData(0.0f, -delta); - } - - event.setCursorPosition(mousePosition.x, mousePosition.y); - Director::getInstance()->getEventDispatcher()->dispatchEvent(&event); -} - -void GLViewImpl::resize(int width, int height) -{ - -} - -void GLViewImpl::setFrameZoomFactor(float fZoomFactor) -{ - _frameZoomFactor = fZoomFactor; - Director::getInstance()->setProjection(Director::getInstance()->getProjection()); - //resize(m_obScreenSize.width * fZoomFactor, m_obScreenSize.height * fZoomFactor); -} - -float GLViewImpl::getFrameZoomFactor() -{ - return _frameZoomFactor; -} - -void GLViewImpl::centerWindow() -{ - // not implemented in WinRT. Window is always full screen -} - -GLViewImpl* GLViewImpl::sharedOpenGLView() -{ - return s_pEglView; -} - -int GLViewImpl::Run() -{ - // XAML version does not have a run loop - m_running = true; - return 0; -}; - -void GLViewImpl::Render() -{ - OnRendering(); -} - -void GLViewImpl::OnRendering() -{ - if(m_running && m_initialized) - { - Director::getInstance()->mainLoop(); - } -} - -// called by orientation change from WP8 XAML -void GLViewImpl::UpdateOrientation(DisplayOrientations orientation) -{ - if(m_orientation != orientation) - { - m_orientation = orientation; - UpdateWindowSize(); - } -} - -// called by size change from WP8 XAML -void GLViewImpl::UpdateForWindowSizeChange(float width, float height) -{ - if (width != m_width || height != m_height) - { - m_width = width; - m_height = height; - UpdateWindowSize(); - } -} - -#if 0 -win32 version - -void GLViewEventHandler::OnGLFWWindowSizeFunCallback(GLFWwindow *windows, int width, int height) -{ - auto view = Director::getInstance()->getOpenGLView(); - if(view && view->getResolutionPolicy() != ResolutionPolicy::UNKNOWN) - { - Size resSize=view->getDesignResolutionSize(); - ResolutionPolicy resPolicy=view->getResolutionPolicy(); - view->setFrameSize(width, height); - view->setDesignResolutionSize(resSize.width, resSize.height, resPolicy); - Director::getInstance()->setViewport(); - } -} -#endif - -void GLViewImpl::UpdateWindowSize() -{ - float width, height; - - width = m_width; - height = m_height; - - - //CCSize designSize = getDesignResolutionSize(); - if(!m_initialized) - { - m_initialized = true; - GLView::setFrameSize(width, height); - } - - auto view = Director::getInstance()->getOpenGLView(); - if(view && view->getResolutionPolicy() != ResolutionPolicy::UNKNOWN) - { - Size resSize=view->getDesignResolutionSize(); - ResolutionPolicy resPolicy=view->getResolutionPolicy(); - view->setFrameSize(width, height); - view->setDesignResolutionSize(resSize.width, resSize.height, resPolicy); - auto director = Director::getInstance(); - director->setViewport(); - director->setProjection(director->getProjection()); - } -} - -cocos2d::Vec2 GLViewImpl::TransformToOrientation(Windows::Foundation::Point p) -{ - cocos2d::Vec2 returnValue; - - float x = p.X; - float y = p.Y; - returnValue = Vec2(x, y); - -#if 0 - switch (m_orientation) - { - case DisplayOrientations::Portrait: - default: - returnValue = Vec2(x, y); - break; - case DisplayOrientations::Landscape: - returnValue = Vec2(y, m_width - x); - break; - case DisplayOrientations::PortraitFlipped: - returnValue = Vec2(m_width - x, m_height - y); - break; - case DisplayOrientations::LandscapeFlipped: - returnValue = Vec2(m_height - y, x); - break; - } -#endif - - float zoomFactor = GLViewImpl::sharedOpenGLView()->getFrameZoomFactor(); - if(zoomFactor > 0.0f) { - returnValue.x /= zoomFactor; - returnValue.y /= zoomFactor; - } - - // CCLOG("%.2f %.2f : %.2f %.2f", p.X, p.Y,returnValue.x, returnValue.y); - - return returnValue; -} - -Vec2 GLViewImpl::GetPoint(PointerEventArgs^ args) { - - return TransformToOrientation(args->CurrentPoint->Position); -} - -Vec2 GLViewImpl::GetPointMouse(PointerEventArgs^ args) { - - Vec2 position = TransformToOrientation(args->CurrentPoint->Position); - - //Because Windows and cocos2d-x uses different Y axis, we need to convert the coordinate here - position.x = (position.x - _viewPortRect.origin.x) / _scaleX; - position.y = (_viewPortRect.origin.y + _viewPortRect.size.height - position.y) / _scaleY; - - return position; -} - - -void GLViewImpl::QueueBackKeyPress() -{ - std::shared_ptr e(new BackButtonEvent()); - mInputEvents.push(e); -} - -void GLViewImpl::QueuePointerEvent(PointerEventType type, PointerEventArgs^ args) -{ - std::shared_ptr e(new PointerEvent(type, args)); - mInputEvents.push(e); -} - -void GLViewImpl::QueueWinRTKeyboardEvent(WinRTKeyboardEventType type, KeyEventArgs^ args) -{ - std::shared_ptr e(new WinRTKeyboardEvent(type, args)); - mInputEvents.push(e); -} - -void GLViewImpl::OnWinRTKeyboardEvent(WinRTKeyboardEventType type, KeyEventArgs^ args) -{ - m_keyboard->OnWinRTKeyboardEvent(type, args); -} - -void GLViewImpl::QueueEvent(std::shared_ptr& event) -{ - mInputEvents.push(event); -} - -void GLViewImpl::ProcessEvents() -{ - std::shared_ptr e; - while (mInputEvents.try_pop(e)) - { - e->execute(); - } -} - -NS_CC_END diff --git a/cocos/platform/winrt/CCGLViewImpl-winrt.h b/cocos/platform/winrt/CCGLViewImpl-winrt.h deleted file mode 100644 index 53a5ea3bf9e0..000000000000 --- a/cocos/platform/winrt/CCGLViewImpl-winrt.h +++ /dev/null @@ -1,196 +0,0 @@ -/**************************************************************************** -Copyright (c) 2010 cocos2d-x.org -Copyright (c) Microsoft Open Technologies, Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - -http://www.cocos2d-x.org - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -****************************************************************************/ - -#ifndef __CC_EGLVIEWIMPL_WINRT_H__ -#define __CC_EGLVIEWIMPL_WINRT_H__ - -#include "platform/winrt/CCStdC.h" -#include "platform/CCCommon.h" -#include "platform/winrt/Keyboard-winrt.h" -#include "platform/CCGLView.h" -#include "base/CCEventKeyboard.h" - -#include -#include -#include -#include -#include - -NS_CC_BEGIN - -class GLViewImpl; - -class CC_DLL GLViewImpl : public GLView -{ -public: - static GLViewImpl* create(const std::string& viewName); - - /* override functions */ - virtual bool isOpenGLReady(); - virtual void end(); - virtual void swapBuffers(); - - Windows::Graphics::Display::DisplayOrientations getDeviceOrientation() {return m_orientation;}; - Size getRenerTargetSize() const { return Size(m_width, m_height); } - - virtual void setIMEKeyboardState(bool bOpen) override; - virtual void setIMEKeyboardState(bool bOpen, const std::string& str); - - virtual bool Create(float width, float height, float dpi, Windows::Graphics::Display::DisplayOrientations orientation); - - /** - * Hide or Show the mouse cursor if there is one. - * - * @param isVisible Hide or Show the mouse cursor if there is one. - */ - virtual void setCursorVisible(bool isVisible) override; - - bool isCursorVisible() { return _isCursorVisible; } - - void setDispatcher(Windows::UI::Core::CoreDispatcher^ dispatcher); - Windows::UI::Core::CoreDispatcher^ getDispatcher() {return m_dispatcher.Get();} - - void setPanel(Windows::UI::Xaml::Controls::Panel^ panel); - Windows::UI::Xaml::Controls::Panel^ getPanel() {return m_panel.Get();} - - void OnPointerPressed(Windows::UI::Core::PointerEventArgs^ args); - void OnPointerMoved(Windows::UI::Core::PointerEventArgs^ args); - void OnPointerReleased(Windows::UI::Core::PointerEventArgs^ args); - - void OnMousePressed(Windows::UI::Core::PointerEventArgs^ args); - void OnMouseMoved(Windows::UI::Core::PointerEventArgs^ args); - void OnMouseReleased(Windows::UI::Core::PointerEventArgs^ args); - void OnMouseWheelChanged(Windows::UI::Core::PointerEventArgs^ args); - - void OnWinRTKeyboardEvent(WinRTKeyboardEventType type, Windows::UI::Core::KeyEventArgs^ args); - - - void OnPointerPressed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args); - void OnPointerWheelChanged(Windows::UI::Core::CoreWindow^, Windows::UI::Core::PointerEventArgs^ args); - void OnPointerMoved(Windows::UI::Core::CoreWindow^, Windows::UI::Core::PointerEventArgs^ args); - void OnPointerReleased(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args); - void OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args); - void OnWindowClosed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CoreWindowEventArgs^ args); - void OnResuming(Platform::Object^ sender, Platform::Object^ args); - void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ args); - void OnBackKeyPress(); - bool AppShouldExit(); - void BackButtonListener(cocos2d::EventKeyboard::KeyCode keyCode, cocos2d::Event* event); - - void QueueBackKeyPress(); - void QueuePointerEvent(PointerEventType type, Windows::UI::Core::PointerEventArgs^ args); - void QueueWinRTKeyboardEvent(WinRTKeyboardEventType type, Windows::UI::Core::KeyEventArgs^ args); - void QueueEvent(std::shared_ptr& event); - - bool ShowMessageBox(Platform::String^ title, Platform::String^ message); - - int Run(); - void Render(); - - void resize(int width, int height); - - float getFrameZoomFactor(); - void centerWindow(); - - void UpdateOrientation(Windows::Graphics::Display::DisplayOrientations orientation); - void UpdateForWindowSizeChange(float width, float height); - - void SetDPI(float dpi) { m_dpi = dpi; } - float GetDPI() { return m_dpi; } - - // static function - /** - @brief get the shared main open gl window - */ - static GLViewImpl* sharedOpenGLView(); - - void ProcessEvents(); - -protected: - GLViewImpl(); - virtual ~GLViewImpl(); - - bool initWithRect(const std::string& viewName, Rect rect, float frameZoomFactor); - bool initWithFullScreen(const std::string& viewName); - - /* - * Set zoom factor for frame. This method is for debugging big resolution (e.g.new ipad) app on desktop. - */ - void setFrameZoomFactor(float zoomFactor); - - inline bool isRetina() { return _isRetina; }; - - float _frameZoomFactor; - bool _supportTouch; - bool _isRetina; - bool _isCursorVisible; - - -private: - CC_DISALLOW_COPY_AND_ASSIGN(GLViewImpl); - - void OnRendering(); - void UpdateWindowSize(); - - cocos2d::Vec2 TransformToOrientation(Windows::Foundation::Point point); - cocos2d::Vec2 GetPoint(Windows::UI::Core::PointerEventArgs^ args); - cocos2d::Vec2 GetPointMouse(Windows::UI::Core::PointerEventArgs^ args); - - Windows::Foundation::Rect m_windowBounds; - Windows::Foundation::EventRegistrationToken m_eventToken; - Windows::Foundation::Point m_lastPoint; - - float m_width; - float m_height; - float m_dpi; - - Windows::Graphics::Display::DisplayOrientations m_orientation; - Windows::Foundation::Rect m_keyboardRect; - - bool m_lastPointValid; - bool m_windowClosed; - bool m_windowVisible; - // PointerReleased for mouse not send button id, need save in PointerPressed last button - EventMouse::MouseButton _lastMouseButtonPressed; - - bool m_running; - bool m_initialized; - bool m_appShouldExit; - - Concurrency::concurrent_queue> mInputEvents; - - Platform::Agile m_dispatcher; - Platform::Agile m_panel; - - KeyBoardWinRT^ m_keyboard; - - cocos2d::EventListenerKeyboard* m_backButtonListener; - -}; - -NS_CC_END - -#endif // end of __CC_EGLVIEWIMPL_WINRT_H__ diff --git a/cocos/platform/winrt/CCGLViewImpl.cpp b/cocos/platform/winrt/CCGLViewImpl.cpp deleted file mode 100644 index 82984e5eb6df..000000000000 --- a/cocos/platform/winrt/CCGLViewImpl.cpp +++ /dev/null @@ -1,585 +0,0 @@ -/**************************************************************************** -Copyright (c) 2010 cocos2d-x.org -Copyright (c) Microsoft Open Technologies, Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - -http://www.cocos2d-x.org - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -****************************************************************************/ - -#include "platform/CCPlatformConfig.h" -#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) - -#include "platform/winrt/CCGLViewImpl.h" -#include "base/ccMacros.h" -#include "base/CCDirector.h" -#include "base/CCTouch.h" -#include "base/CCIMEDispatcher.h" -#include "platform/winrt/CCApplication.h" -#include "platform/winrt/CCWinRTUtils.h" - -#if (_MSC_VER >= 1800) -#include -#endif - - -using namespace Platform; -using namespace Windows::Foundation; -using namespace Windows::Foundation::Collections; -using namespace Windows::Graphics::Display; -using namespace Windows::UI::Input; -using namespace Windows::UI::Core; -using namespace Windows::UI::Xaml; -using namespace Windows::UI::Xaml::Controls; -using namespace Windows::UI::Xaml::Input; -using namespace Windows::UI::Xaml::Media; -using namespace Windows::System; -using namespace Windows::UI::ViewManagement; - -NS_CC_BEGIN - -static GLViewImpl* s_pEglView = nullptr; - -////////////////////////////////////////////////////////////////////////// -// implement GLView -////////////////////////////////////////////////////////////////////////// - -// Initialize the DirectX resources required to run. -void WinRTWindow::Initialize(CoreWindow^ window, SwapChainBackgroundPanel^ panel) -{ - m_window = window; - //TODO: remove esUtils - //esInitContext ( &m_esContext ); - - ANGLE_D3D_FEATURE_LEVEL featureLevel = ANGLE_D3D_FEATURE_LEVEL::ANGLE_D3D_FEATURE_LEVEL_9_1; - -#if (_MSC_VER >= 1800) - // WinRT on Windows 8.1 can compile shaders at run time so we don't care about the DirectX feature level - featureLevel = ANGLE_D3D_FEATURE_LEVEL::ANGLE_D3D_FEATURE_LEVEL_ANY; -#endif - - - HRESULT result = CreateWinrtEglWindow(WINRT_EGL_IUNKNOWN(panel), featureLevel, m_eglWindow.GetAddressOf()); - - if (!SUCCEEDED(result)) - { - CCLOG("Unable to create Angle EGL Window: %d", result); - return; - } - - m_esContext.hWnd = m_eglWindow; - // width and height are ignored and determined from the CoreWindow the SwapChainBackgroundPanel is in. - - //TODO: remove esUtils - //esCreateWindow ( &m_esContext, TEXT("Cocos2d-x"), 0, 0, ES_WINDOW_RGB | ES_WINDOW_ALPHA | ES_WINDOW_DEPTH | ES_WINDOW_STENCIL ); - - m_window->PointerPressed += - ref new TypedEventHandler(this, &WinRTWindow::OnPointerPressed); - m_window->PointerReleased += - ref new TypedEventHandler(this, &WinRTWindow::OnPointerReleased); - m_window->PointerMoved += - ref new TypedEventHandler(this, &WinRTWindow::OnPointerMoved); - m_window->PointerWheelChanged += - ref new TypedEventHandler(this, &WinRTWindow::OnPointerWheelChanged); - - m_dummy = ref new Button(); - m_dummy->Opacity = 0.0; - m_dummy->Width=1; - m_dummy->Height=1; - m_dummy->IsEnabled = true; - panel->Children->Append(m_dummy); - - m_textBox = ref new TextBox(); - m_textBox->Opacity = 0.0; - m_textBox->Width=1; - m_textBox->Height=1; - m_textBox->MaxLength = 1; - - panel->Children->Append(m_textBox); - m_textBox->AddHandler(UIElement::KeyDownEvent, ref new KeyEventHandler(this, &WinRTWindow::OnTextKeyDown), true); - m_textBox->AddHandler(UIElement::KeyUpEvent, ref new KeyEventHandler(this, &WinRTWindow::OnTextKeyUp), true); - m_textBox->IsEnabled = false; - - auto keyboard = InputPane::GetForCurrentView(); - keyboard->Showing += ref new TypedEventHandler(this, &WinRTWindow::ShowKeyboard); - keyboard->Hiding += ref new TypedEventHandler(this, &WinRTWindow::HideKeyboard); - setIMEKeyboardState(false); -} - -WinRTWindow::WinRTWindow(CoreWindow^ window) : - m_lastPointValid(false), - m_textInputEnabled(false) -{ - window->SizeChanged += - ref new TypedEventHandler(this, &WinRTWindow::OnWindowSizeChanged); - - DisplayProperties::LogicalDpiChanged += - ref new DisplayPropertiesEventHandler(this, &WinRTWindow::OnLogicalDpiChanged); - - DisplayProperties::OrientationChanged += - ref new DisplayPropertiesEventHandler(this, &WinRTWindow::OnOrientationChanged); - - DisplayProperties::DisplayContentsInvalidated += - ref new DisplayPropertiesEventHandler(this, &WinRTWindow::OnDisplayContentsInvalidated); - - m_eventToken = CompositionTarget::Rendering::add(ref new EventHandler(this, &WinRTWindow::OnRendering)); -} - - -void WinRTWindow::swapBuffers() -{ - eglSwapBuffers(m_esContext.eglDisplay, m_esContext.eglSurface); -} - - - -void WinRTWindow::OnSuspending() -{ -#if (_MSC_VER >= 1800) - Microsoft::WRL::ComPtr dxgiDevice; - Microsoft::WRL::ComPtr device = m_eglWindow->GetAngleD3DDevice(); - HRESULT result = device.As(&dxgiDevice); - if (SUCCEEDED(result)) - { - dxgiDevice->Trim(); - } -#endif -} - - -void WinRTWindow::ResizeWindow() -{ - GLViewImpl::sharedOpenGLView()->UpdateForWindowSizeChange(); -} - -cocos2d::Vec2 WinRTWindow::GetCCPoint(PointerEventArgs^ args) { - auto p = args->CurrentPoint; - float x = getScaledDPIValue(p->Position.X); - float y = getScaledDPIValue(p->Position.Y); - Vec2 pt(x, y); - - float zoomFactor = GLViewImpl::sharedOpenGLView()->getFrameZoomFactor(); - - if(zoomFactor > 0.0f) { - pt.x /= zoomFactor; - pt.y /= zoomFactor; - } - return pt; -} - -void WinRTWindow::ShowKeyboard(InputPane^ inputPane, InputPaneVisibilityEventArgs^ args) -{ - GLViewImpl::sharedOpenGLView()->ShowKeyboard(args->OccludedRect); -} - -void WinRTWindow::HideKeyboard(InputPane^ inputPane, InputPaneVisibilityEventArgs^ args) -{ - GLViewImpl::sharedOpenGLView()->HideKeyboard(args->OccludedRect); -} - -void WinRTWindow::setIMEKeyboardState(bool bOpen) -{ - m_textInputEnabled = bOpen; - if(m_textInputEnabled) - { - m_textBox->IsEnabled = true; - m_textBox->Focus(FocusState::Pointer); - } - else - { - m_dummy->Focus(FocusState::Pointer); - m_textBox->IsEnabled = false; - } -} - - - -void WinRTWindow::OnTextKeyDown(Object^ sender, KeyRoutedEventArgs^ args) -{ -#if 0 - if(!m_textInputEnabled) - { - return; - } - - auto key = args->Key; - - switch(key) - { - default: - break; - } -#endif -} - -void WinRTWindow::OnTextKeyUp(Object^ sender, KeyRoutedEventArgs^ args) -{ - if(!m_textInputEnabled) - { - return; - } - - args->Handled = true; - - auto key = args->Key; - - switch(key) - { - case VirtualKey::Escape: - // TODO:: fix me - //Director::getInstance()->getKeypadDispatcher()->dispatchKeypadMSG(kTypeBackClicked); - args->Handled = true; - break; - case VirtualKey::Back: - IMEDispatcher::sharedDispatcher()->dispatchDeleteBackward(); - break; - case VirtualKey::Enter: - setIMEKeyboardState(false); - IMEDispatcher::sharedDispatcher()->dispatchInsertText("\n", 1); - break; - default: - char szUtf8[8] = {0}; - int nLen = WideCharToMultiByte(CP_UTF8, 0, (LPCWSTR)m_textBox->Text->Data(), 1, szUtf8, sizeof(szUtf8), NULL, NULL); - IMEDispatcher::sharedDispatcher()->dispatchInsertText(szUtf8, nLen); - break; - } - m_textBox->Text = ""; -} - - -void WinRTWindow::OnPointerWheelChanged(CoreWindow^ sender, PointerEventArgs^ args) -{ - float direction = (float)args->CurrentPoint->Properties->MouseWheelDelta; - int id = 0; - Vec2 p(0.0f,0.0f); - GLViewImpl::sharedOpenGLView()->handleTouchesBegin(1, &id, &p.x, &p.y); - p.y += direction; - GLViewImpl::sharedOpenGLView()->handleTouchesMove(1, &id, &p.x, &p.y); - GLViewImpl::sharedOpenGLView()->handleTouchesEnd(1, &id, &p.x, &p.y); -} - -// user pressed the Back Key on the phone -void GLViewImpl::OnBackKeyPress() -{ -#if 0 - if (m_delegate) - { - m_delegate->Invoke(Cocos2dEvent::TerminateApp); - } -#endif // 0 - -} - - -void GLViewImpl::OnPointerPressed(PointerEventArgs^ args) -{ -#if 0 - int id = args->CurrentPoint->PointerId; - Vec2 pt = GetPoint(args); - handleTouchesBegin(1, &id, &pt.x, &pt.y); -#endif -} - -void GLViewImpl::OnPointerMoved(PointerEventArgs^ args) -{ -#if 0 - auto currentPoint = args->CurrentPoint; - if (currentPoint->IsInContact) - { - if (m_lastPointValid) - { - int id = args->CurrentPoint->PointerId; - Vec2 p = GetPoint(args); - handleTouchesMove(1, &id, &p.x, &p.y); - } - m_lastPoint = currentPoint->Position; - m_lastPointValid = true; - } - else - { - m_lastPointValid = false; - } -#endif -} - -void GLViewImpl::OnPointerReleased(PointerEventArgs^ args) -{ -#if 0 - int id = args->CurrentPoint->PointerId; - Vec2 pt = GetPoint(args); - handleTouchesEnd(1, &id, &pt.x, &pt.y); -#endif // 0 - -} - - - -void WinRTWindow::OnPointerPressed(CoreWindow^ sender, PointerEventArgs^ args) -{ - int id = args->CurrentPoint->PointerId; - Vec2 pt = GetCCPoint(args); - GLViewImpl::sharedOpenGLView()->handleTouchesBegin(1, &id, &pt.x, &pt.y); -} - -void WinRTWindow::OnPointerMoved(CoreWindow^ sender, PointerEventArgs^ args) -{ - auto currentPoint = args->CurrentPoint; - if (currentPoint->IsInContact) - { - if (m_lastPointValid) - { - int id = args->CurrentPoint->PointerId; - Vec2 p = GetCCPoint(args); - GLViewImpl::sharedOpenGLView()->handleTouchesMove(1, &id, &p.x, &p.y); - } - m_lastPoint = currentPoint->Position; - m_lastPointValid = true; - } - else - { - m_lastPointValid = false; - } -} - -void WinRTWindow::OnPointerReleased(CoreWindow^ sender, PointerEventArgs^ args) -{ - int id = args->CurrentPoint->PointerId; - Vec2 pt = GetCCPoint(args); - GLViewImpl::sharedOpenGLView()->handleTouchesEnd(1, &id, &pt.x, &pt.y); -} - -void WinRTWindow::OnWindowSizeChanged(CoreWindow^ sender, WindowSizeChangedEventArgs^ args) -{ - ResizeWindow(); - GLViewImpl::sharedOpenGLView()->UpdateForWindowSizeChange(); -} - -void WinRTWindow::OnLogicalDpiChanged(Object^ sender) -{ - GLViewImpl::sharedOpenGLView()->UpdateForWindowSizeChange(); -} - -void WinRTWindow::OnOrientationChanged(Object^ sender) -{ - ResizeWindow(); - GLViewImpl::sharedOpenGLView()->UpdateForWindowSizeChange(); -} - -void WinRTWindow::OnDisplayContentsInvalidated(Object^ sender) -{ - GLViewImpl::sharedOpenGLView()->UpdateForWindowSizeChange(); -} - -void WinRTWindow::OnRendering(Object^ sender, Object^ args) -{ - GLViewImpl::sharedOpenGLView()->OnRendering(); -} - - -GLViewImpl::GLViewImpl() - : m_window(nullptr) - , m_fFrameZoomFactor(1.0f) - , m_bSupportTouch(false) - , m_lastPointValid(false) - , m_running(false) - , m_winRTWindow(nullptr) - , m_initialized(false) -{ - s_pEglView = this; - _viewName = "Cocos2dxWinRT"; -} - -GLViewImpl::~GLViewImpl() -{ - CC_ASSERT(this == s_pEglView); - s_pEglView = nullptr; - - // TODO: cleanup -} - -bool GLViewImpl::Create(CoreWindow^ window, SwapChainBackgroundPanel^ panel) -{ - bool bRet = false; - m_window = window; - - m_bSupportTouch = true; - m_winRTWindow = ref new WinRTWindow(window); - m_winRTWindow->Initialize(window, panel); - m_initialized = false; - UpdateForWindowSizeChange(); - return bRet; -} - -bool GLViewImpl::isOpenGLReady() -{ - // TODO: need to revisit this - return (m_window.Get() != nullptr); -} - -void GLViewImpl::end() -{ - // TODO: need to implement - -} - -void GLViewImpl::swapBuffers() -{ - m_winRTWindow->swapBuffers(); -} - - -void GLViewImpl::setIMEKeyboardState(bool bOpen) -{ - if(m_winRTWindow) - { - m_winRTWindow->setIMEKeyboardState(bOpen); - } -} - - -void GLViewImpl::resize(int width, int height) -{ - -} - -void GLViewImpl::setFrameZoomFactor(float fZoomFactor) -{ - m_fFrameZoomFactor = fZoomFactor; - resize((int) (_screenSize.width * fZoomFactor), (int) (_screenSize.height * fZoomFactor)); - centerWindow(); - Director::getInstance()->setProjection(Director::getInstance()->getProjection()); -} - - -float GLViewImpl::getFrameZoomFactor() -{ - return m_fFrameZoomFactor; -} - -void GLViewImpl::setFrameSize(float width, float height) -{ - // not implemented in WinRT. Window is always full screen - // GLViewProtocol::setFrameSize(width, height); -} - -void GLViewImpl::centerWindow() -{ - // not implemented in WinRT. Window is always full screen -} - -void GLViewImpl::OnSuspending() -{ - if (m_winRTWindow) - { - m_winRTWindow->OnSuspending(); - } -} - -GLViewImpl* GLViewImpl::sharedOpenGLView() -{ - return s_pEglView; -} - -int GLViewImpl::Run() -{ - m_running = true; - - return 0; -}; - - -void GLViewImpl::OnRendering() -{ - if(m_running && m_initialized) - { - Director::sharedDirector()->mainLoop(); - } -} - -void GLViewImpl::HideKeyboard(Windows::Foundation::Rect r) -{ - return; // not implemented -#if 0 - float height = m_keyboardRect.Height; - float factor = _scaleY / CC_CONTENT_SCALE_FACTOR(); - height = (float)height / factor; - - Rect rect_end(0, 0, 0, 0); - Rect rect_begin(0, 0, _screenSize.width / factor, height); - - IMEKeyboardNotificationInfo info; - info.begin = rect_begin; - info.end = rect_end; - info.duration = 0; - IMEDispatcher::sharedDispatcher()->dispatchKeyboardWillHide(info); - IMEDispatcher::sharedDispatcher()->dispatchKeyboardDidHide(info); -#endif -} - -void GLViewImpl::ShowKeyboard(Windows::Foundation::Rect r) -{ - return; // not implemented -#if 0 - float height = r.Height; - float factor = _scaleY / CC_CONTENT_SCALE_FACTOR(); - height = (float)height / factor; - - Rect rect_begin(0.0f, 0.0f - height, _screenSize.width / factor, height); - Rect rect_end(0.0f, 0.0f, _screenSize.width / factor, height); - - CCIMEKeyboardNotificationInfo info; - info.begin = rect_begin; - info.end = rect_end; - info.duration = 0; - CCIMEDispatcher::sharedDispatcher()->dispatchKeyboardWillShow(info); - CCIMEDispatcher::sharedDispatcher()->dispatchKeyboardDidShow(info); - m_keyboardRect = r; -#endif -} - - -void GLViewImpl::UpdateForWindowSizeChange() -{ - float width = ConvertDipsToPixels(m_window->Bounds.Width); - float height = ConvertDipsToPixels(m_window->Bounds.Height); - - if(!m_initialized) - { - m_initialized = true; - GLView::setFrameSize(width, height); - } - else - { - setFrameSize(width, height); - Size designSize = getDesignResolutionSize(); - GLViewImpl::sharedOpenGLView()->setDesignResolutionSize(designSize.width, designSize.height, ResolutionPolicy::SHOW_ALL); - Director::sharedDirector()->setProjection(Director::sharedDirector()->getProjection()); - } -} - -void GLViewImpl::QueueEvent(std::shared_ptr& event) -{ - std::lock_guard guard(mMutex); - mInputEvents.push(event); -} - -NS_CC_END - -#endif // (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) diff --git a/cocos/platform/winrt/CCGLViewImpl.h b/cocos/platform/winrt/CCGLViewImpl.h deleted file mode 100644 index 9467a401f75d..000000000000 --- a/cocos/platform/winrt/CCGLViewImpl.h +++ /dev/null @@ -1,172 +0,0 @@ -/**************************************************************************** -Copyright (c) 2010 cocos2d-x.org -Copyright (c) Microsoft Open Technologies, Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - -http://www.cocos2d-x.org - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -****************************************************************************/ - -#ifndef __CC_EGLVIEWIMPL_WINRT_H__ -#define __CC_EGLVIEWIMPL_WINRT_H__ - -#include "platform/CCPlatformConfig.h" -#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) - -#include "platform/winrt/CCStdC.h" -#include "platform/winrt/CCGL.h" -#include "platform/CCCommon.h" -#include "platform/winrt/InputEvent.h" -#include "platform/CCGLView.h" - -#include - -#include -#include -#include -#include - -NS_CC_BEGIN - -class CCEGL; -class GLViewImpl; - -ref class WinRTWindow sealed -{ - -public: - WinRTWindow(Windows::UI::Core::CoreWindow^ window); - void Initialize(Windows::UI::Core::CoreWindow^ window, Windows::UI::Xaml::Controls::SwapChainBackgroundPanel^ panel); - void setIMEKeyboardState(bool bOpen); - void swapBuffers(); - - -private: - cocos2d::Vec2 GetCCPoint(Windows::UI::Core::PointerEventArgs^ args); - - void OnTextKeyDown(Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e); - void OnTextKeyUp(Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e); - - void OnPointerWheelChanged(Windows::UI::Core::CoreWindow^, Windows::UI::Core::PointerEventArgs^ args); - void OnPointerMoved(Windows::UI::Core::CoreWindow^, Windows::UI::Core::PointerEventArgs^ args); - void OnPointerPressed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args); - void OnPointerReleased(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args); - void OnWindowSizeChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::WindowSizeChangedEventArgs^ args); - void OnLogicalDpiChanged(Platform::Object^ sender); - void OnOrientationChanged(Platform::Object^ sender); - void OnDisplayContentsInvalidated(Platform::Object^ sender); - void OnRendering(Platform::Object^ sender, Platform::Object^ args); - void OnSuspending(); - void ResizeWindow(); - - - void ShowKeyboard(Windows::UI::ViewManagement::InputPane^ inputPane, Windows::UI::ViewManagement::InputPaneVisibilityEventArgs^ args); - void HideKeyboard(Windows::UI::ViewManagement::InputPane^ inputPane, Windows::UI::ViewManagement::InputPaneVisibilityEventArgs^ args); - - Platform::Agile m_window; - - Windows::Foundation::Point m_lastPoint; - Windows::Foundation::EventRegistrationToken m_eventToken; - bool m_lastPointValid; - bool m_textInputEnabled; - Microsoft::WRL::ComPtr m_eglWindow; - Windows::UI::Xaml::Controls::TextBox^ m_textBox; - Windows::UI::Xaml::Controls::Button^ m_dummy; - - ESContext m_esContext; - - - friend GLViewImpl; -}; - -class CC_DLL GLViewImpl : public GLView -{ -public: - GLViewImpl(); - virtual ~GLViewImpl(); - - /* override functions */ - virtual bool isOpenGLReady(); - virtual void end(); - virtual void swapBuffers(); - virtual void setFrameSize(float width, float height); - virtual void setIMEKeyboardState(bool bOpen); - void ShowKeyboard(Windows::Foundation::Rect r); - void HideKeyboard(Windows::Foundation::Rect r); - virtual bool Create(Windows::UI::Core::CoreWindow^ window, Windows::UI::Xaml::Controls::SwapChainBackgroundPanel^ panel); - void UpdateForWindowSizeChange(); - void OnRendering(); - void OnSuspending(); - void GLViewImpl::QueueEvent(std::shared_ptr& event); - - void OnPointerPressed(Windows::UI::Core::PointerEventArgs^ args); - void OnPointerMoved(Windows::UI::Core::PointerEventArgs^ args); - void OnPointerReleased(Windows::UI::Core::PointerEventArgs^ args); - void OnPointerPressed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args); - void OnBackKeyPress(); - - -private: - Windows::Foundation::EventRegistrationToken m_eventToken; - Windows::Foundation::Point m_lastPoint; - bool m_lastPointValid; - -public: - - // winrt platform functions - Windows::UI::Core::CoreWindow^ getWindow() { return m_window.Get(); }; - - int Run(); - - void resize(int width, int height); - /* - * Set zoom factor for frame. This method is for debugging big resolution (e.g.new ipad) app on desktop. - */ - void setFrameZoomFactor(float fZoomFactor); - float getFrameZoomFactor(); - void centerWindow(); - - - // static function - /** - @brief get the shared main open gl window - */ - static GLViewImpl* sharedOpenGLView(); - -protected: - -private: - Platform::Agile m_window; - bool m_running; - bool m_initialized; - bool m_bSupportTouch; - float m_fFrameZoomFactor; - WinRTWindow^ m_winRTWindow; - Windows::Foundation::Rect m_keyboardRect; - - std::queue> mInputEvents; - std::mutex mMutex; -}; - -NS_CC_END - -#endif // (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) - -#endif // end of __CC_EGLVIEWIMPL_WINRT_H__ diff --git a/cocos/platform/winrt/CCPThreadWinRT.cpp b/cocos/platform/winrt/CCPThreadWinRT.cpp deleted file mode 100644 index 0eae3a39ea09..000000000000 --- a/cocos/platform/winrt/CCPThreadWinRT.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -Copyright (c) 2010-2013 cocos2d-x.org -Copyright (c) Microsoft Open Technologies, Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - -http://www.cocos2d-x.org - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -****************************************************************************/ - - -#include "platform/CCPlatformConfig.h" -#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) - -#include "platform/winrt/CCPThreadWinRT.h" - -NS_CC_BEGIN - -void pthread_mutex_init(pthread_mutex_t* m, void* attributes) { - *m = CreateMutexEx(NULL,FALSE,0,NULL); -} - -int pthread_mutex_lock(pthread_mutex_t* m) { - return WaitForSingleObjectEx(*m,INFINITE,FALSE); -} - -int pthread_mutex_unlock(pthread_mutex_t* m) { - return ReleaseMutex(*m); -} - -void pthread_mutex_destroy(pthread_mutex_t* m) -{ - if(m) - { - CloseHandle(*m); - } -} - - -NS_CC_END - -#endif // (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) diff --git a/cocos/platform/winrt/CCPThreadWinRT.h b/cocos/platform/winrt/CCPThreadWinRT.h deleted file mode 100644 index 367eb5f99a9a..000000000000 --- a/cocos/platform/winrt/CCPThreadWinRT.h +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -Copyright (c) 2010 cocos2d-x.org -Copyright (c) Microsoft Open Technologies, Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - -http://www.cocos2d-x.org - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -****************************************************************************/ - -#ifndef __CCPTHREADWINRT_H__ -#define __CCPTHREADWINRT_H__ - - -#include "platform/CCPlatformConfig.h" -#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) - -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#include "platform/CCPlatformMacros.h" - - -NS_CC_BEGIN - -typedef HANDLE pthread_t; -typedef HANDLE pthread_mutex_t; -typedef int pthread_cond_t; -#define pthread_cond_wait(x, y) - -void pthread_mutex_init(pthread_mutex_t* m, void* attributes); - -int pthread_mutex_lock(pthread_mutex_t* m); - -int pthread_mutex_unlock(pthread_mutex_t* m); - -void pthread_mutex_destroy(pthread_mutex_t* m); - -#define pthread_cond_destroy(x) -#define pthread_cond_signal(x) -#define pthread_cond_init(x, y) - -NS_CC_END - - -#endif // (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) - -#endif // __CCPTHREADWINRT_H__ diff --git a/cocos/platform/winrt/CCPlatformDefine-winrt.h b/cocos/platform/winrt/CCPlatformDefine-winrt.h deleted file mode 100644 index e40c5e4437c5..000000000000 --- a/cocos/platform/winrt/CCPlatformDefine-winrt.h +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -Copyright (c) 2010-2013 cocos2d-x.org -Copyright (c) Microsoft Open Technologies, Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - -http://www.cocos2d-x.org - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -****************************************************************************/ -#ifndef __CCPLATFORMDEFINE_H__ -#define __CCPLATFORMDEFINE_H__ - -#if defined(CC_STATIC) -#define CC_DLL -#else -#if defined(_USRDLL) -#define CC_DLL __declspec(dllexport) -#else /* use a DLL library */ -#define CC_DLL __declspec(dllimport) -#endif -#endif - - - -#include - -#if CC_DISABLE_ASSERT > 0 -#define CC_ASSERT(cond) -#else -#define CC_ASSERT(cond) assert(cond) -#endif -#define CC_UNUSED_PARAM(unusedparam) (void)unusedparam - - -#endif /* __CCPLATFORMDEFINE_H__*/ diff --git a/cocos/platform/winrt/CCPrecompiledShaders.cpp b/cocos/platform/winrt/CCPrecompiledShaders.cpp deleted file mode 100644 index 4acb74f6f89d..000000000000 --- a/cocos/platform/winrt/CCPrecompiledShaders.cpp +++ /dev/null @@ -1,293 +0,0 @@ -/**************************************************************************** -Copyright (c) 2010-2013 cocos2d-x.org -Copyright (c) Microsoft Open Technologies, Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - -http://www.cocos2d-x.org - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -****************************************************************************/ -#include "platform/winrt/CCPrecompiledShaders.h" -#include "platform/winrt/CCWinRTUtils.h" -#include "renderer/CCGLProgram.h" -#include "platform/winrt/sha1.h" - -using namespace Windows::Graphics::Display; -using namespace Windows::Storage; -using namespace Platform; -using namespace Windows::Storage; -using namespace Windows::Storage::Pickers; -using namespace Windows::Storage::Streams; -using namespace concurrency; - -NS_CC_BEGIN - -// singleton stuff -static CCPrecompiledShaders *s_pPrecompiledShaders = nullptr; - -#define SHADER_NAME_PREFIX "s_" - - -CCPrecompiledShaders* CCPrecompiledShaders::getInstance(void) -{ - if (!s_pPrecompiledShaders) - { - s_pPrecompiledShaders = new CCPrecompiledShaders(); - } - - return s_pPrecompiledShaders; -} - -CCPrecompiledShaders::CCPrecompiledShaders(void) - : m_isDirty(false) -{ - Init(); -} - -void CCPrecompiledShaders::Init(void) -{ - m_programs.clear(); - m_precompiledPrograms.clear(); - - // add existing precompiled programs to dictionary - loadPrecompiledPrograms(); -} - -CCPrecompiledShaders::~CCPrecompiledShaders(void) -{ -} - -static std::string computeHash(const GLchar* vShaderByteArray, const GLchar* fShaderByteArray) -{ - SHA1Context sha; - int err; - err = SHA1Reset(&sha); - std::string result = ""; - uint8_t hash[SHA1HashSize]; - char hashString[SHA1HashSize * 2 + 1]; - - if(!err) - { - err = SHA1Input(&sha,(const unsigned char *) vShaderByteArray,static_cast(strlen(vShaderByteArray))); - } - if(!err) - { - err = SHA1Input(&sha,(const unsigned char *) fShaderByteArray, static_cast(strlen(fShaderByteArray))); - } - if(!err) - { - char* shader_version = (char*) glGetString(GL_SHADING_LANGUAGE_VERSION); - err = SHA1Input(&sha,(const unsigned char *) shader_version, static_cast(strlen(shader_version))); - } - if(!err) - { - err = SHA1Result(&sha, hash); - } - if(!err) - { - SHA1ConvertMessageToString(hash, hashString); - result = hashString; - } - - return result; -} - -std::string CCPrecompiledShaders::addShaders(const GLchar* vShaderByteArray, const GLchar* fShaderByteArray) -{ - return computeHash(vShaderByteArray, fShaderByteArray); -} - - -void CCPrecompiledShaders::loadPrecompiledPrograms() -{ - m_precompiledPrograms.clear(); -#if defined(PRECOMPILED_SHADERS) - for(int i = 0; i < s_numPrograms; i++) - { - PrecompiledProgram* p = new PrecompiledProgram(); - p->key = s_programKeys[i]; - p->program = s_programs[i]; - p->length = s_programLengths[i]; - m_precompiledPrograms[s_programKeys[i]] = p; - } -#endif -} - -void CCPrecompiledShaders::addPrecompiledProgram(const char* key, const unsigned char* program, int programLength) -{ - std::string id = key; - PrecompiledProgram* p = nullptr; - auto it = m_precompiledPrograms.find(id); - if (it != m_precompiledPrograms.end()) - { - p = it->second; - } - else - { - p = new PrecompiledProgram(); - m_precompiledPrograms[id] = p; - } - p->key = key; - p->program = program; - p->length = programLength; -} - -bool CCPrecompiledShaders::loadProgram(GLuint program, const GLchar* vShaderByteArray, const GLchar* fShaderByteArray) -{ - std::string id = computeHash(vShaderByteArray, fShaderByteArray); - - auto it = m_precompiledPrograms.find(id); - if(it == m_precompiledPrograms.end()) - return false; - - glProgramBinaryOES(program, GL_PROGRAM_BINARY_ANGLE, (const GLvoid*) it->second->program, it->second->length); - - return true; -} - -bool CCPrecompiledShaders::addProgram(GLuint program, const std::string& id) -{ - int length; - - auto it = m_programs.find(id); - if(it != m_programs.end()) - return true; - - auto it2 = m_precompiledPrograms.find(id); - if(it2 == m_precompiledPrograms.end()) - m_isDirty = true; - - CompiledProgram* p = new CompiledProgram(); - - glGetProgramiv(program, GL_PROGRAM_BINARY_LENGTH_OES, &length); - p->program.reserve(length); - p->length = length; - p->key = id; - GLenum binaryFormat; - glGetProgramBinaryOES(program, length, NULL, &binaryFormat, p->program.data()); - m_programs[id] = p; - - return true; -} - -#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) - -void CCPrecompiledShaders::savePrecompiledPrograms(Windows::Storage::StorageFolder^ folder) -{ - Platform::String ^fileName = L"precompiledshaders.h"; - - auto saveTask = create_task(folder->CreateFileAsync(fileName, CreationCollisionOption::ReplaceExisting)); - - saveTask.then([this](StorageFile^ file) - { - InMemoryRandomAccessStream^ memoryStream = ref new InMemoryRandomAccessStream(); - DataWriter^ dataWriter = ref new DataWriter(memoryStream); - - Platform::String^ programLengths = "const int s_programLengths[] = {"; - Platform::String^ programs = "const unsigned char* s_programs[] = {"; - Platform::String^ programKeys = "const char* s_programKeys[] = {"; - - int numPrograms = 0; - - dataWriter->WriteString(L"#define PRECOMPILED_SHADERS\n\n"); - - - for (auto& iter : m_programs) - { - CompiledProgram* p = (CompiledProgram*)iter.second; - Platform::String^ keyName = PlatformStringFromString(p->key); - Platform::String^ programName = SHADER_NAME_PREFIX + keyName; - - dataWriter->WriteString("const unsigned char "); - dataWriter->WriteString(programName); - dataWriter->WriteString("[] = {\n"); - - char temp[32]; - unsigned char* buffer = p->program.data(); - - for(int i = 0; i < p->length - 1; i++) - { - if(i % 8 == 0) - dataWriter->WriteString("\n"); - sprintf_s(temp, "%3i, ", buffer[i]); - dataWriter->WriteString(PlatformStringFromString(temp)); - } - if((p->length - 1) % 8 == 0) - dataWriter->WriteString("\n"); - sprintf_s(temp, "%3i, ", buffer[p->length - 1]); - dataWriter->WriteString(PlatformStringFromString(temp)); - dataWriter->WriteString("\n};\n\n"); - - if(numPrograms != 0) - { - programLengths += (","); - programs += (","); - programKeys += (","); - } - programLengths += p->length; - programs += programName; - programKeys += "\"" + keyName + "\""; - numPrograms++; - } - - programLengths += "};\n"; - programs += "};\n"; - programKeys += "};\n"; - - Platform::String^ n = ref new Platform::String(L"const int s_numPrograms = "); - n += numPrograms; - n += ";\n"; - - dataWriter->WriteString(n); - dataWriter->WriteString(programLengths); - dataWriter->WriteString(programs); - dataWriter->WriteString(programKeys); - - return FileIO::WriteBufferAsync(file, dataWriter->DetachBuffer()); - }); - -} - -void CCPrecompiledShaders::savePrecompiledShaders() -{ - if(!m_isDirty) - return; - - - FolderPicker^ folderPicker = ref new FolderPicker(); - folderPicker->SuggestedStartLocation = PickerLocationId::Desktop; - folderPicker->FileTypeFilter->Append(".h"); - - auto saveTask = create_task(folderPicker->PickSingleFolderAsync()); - saveTask.then([this](StorageFolder^ folder) - { - if(folder != nullptr) - { - savePrecompiledPrograms(folder); - m_isDirty = false; - } - }); -} -#endif - - - -NS_CC_END - - diff --git a/cocos/platform/winrt/CCPrecompiledShaders.h b/cocos/platform/winrt/CCPrecompiledShaders.h deleted file mode 100644 index 0a13957d8e38..000000000000 --- a/cocos/platform/winrt/CCPrecompiledShaders.h +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** -Copyright (c) 2010-2013 cocos2d-x.org -Copyright (c) Microsoft Open Technologies, Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - -http://www.cocos2d-x.org - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -****************************************************************************/ -#ifndef __CC_PRECOMPILED_SHADERS_H__ -#define __CC_PRECOMPILED_SHADERS_H__ - -#include "platform/CCCommon.h" -#include "platform/winrt/CCGL.h" - -#include -#include -#include - -NS_CC_BEGIN - -typedef struct _PrecompiledProgram -{ - const char* key; - const unsigned char* program; - int length; -} PrecompiledProgram; - -typedef struct _CompiledProgram -{ - std::string key; - std::vector program; - int length; -} CompiledProgram; - - -class CC_DLL CCPrecompiledShaders -{ -public: - CCPrecompiledShaders(); - virtual ~CCPrecompiledShaders(); - - /** - @brief Get current precompiled shaders instance. - @return Current precompiled shaders instance pointer. - */ - static CCPrecompiledShaders* getInstance(); - - void addPrecompiledProgram(const char* key, const unsigned char* program, int programLength); - std::string addShaders(const GLchar* vShaderByteArray, const GLchar* fShaderByteArray); - bool addProgram(GLuint program, const std::string& id); - - bool loadProgram(GLuint program, const GLchar* vShaderByteArray, const GLchar* fShaderByteArray); - - -#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) - void savePrecompiledShaders(); -#endif - -protected: - void savePrecompiledPrograms(Windows::Storage::StorageFolder^ folder); - void loadPrecompiledPrograms(); - - void Init(); - - std::map m_programs; - std::map m_precompiledPrograms; - - bool m_isDirty; -}; - -NS_CC_END - -#endif // __CC_PRECOMPILED_SHADERS_H__ diff --git a/cocos/platform/winrt/CCStdC.cpp b/cocos/platform/winrt/CCStdC.cpp deleted file mode 100644 index ad3a2d77fc5b..000000000000 --- a/cocos/platform/winrt/CCStdC.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************** -Copyright (c) 2010 cocos2d-x.org -Copyright (c) Microsoft Open Technologies, Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - -http://www.cocos2d-x.org - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -****************************************************************************/ - -#include "platform/CCStdC.h" - -int CC_DLL gettimeofday(struct timeval * val, struct timezone *) -{ - if (val) - { - SYSTEMTIME wtm; - GetLocalTime(&wtm); - - struct tm tTm; - tTm.tm_year = wtm.wYear - 1900; - tTm.tm_mon = wtm.wMonth - 1; - tTm.tm_mday = wtm.wDay; - tTm.tm_hour = wtm.wHour; - tTm.tm_min = wtm.wMinute; - tTm.tm_sec = wtm.wSecond; - tTm.tm_isdst = -1; - - val->tv_sec = (long)mktime(&tTm); // time_t is 64-bit on win32 - val->tv_usec = wtm.wMilliseconds * 1000; - } - return 0; -} diff --git a/cocos/platform/winrt/CCStdC.h b/cocos/platform/winrt/CCStdC.h deleted file mode 100644 index 91a5ab102a6e..000000000000 --- a/cocos/platform/winrt/CCStdC.h +++ /dev/null @@ -1,114 +0,0 @@ -/**************************************************************************** -Copyright (c) 2010 cocos2d-x.org -Copyright (c) Microsoft Open Technologies, Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - -http://www.cocos2d-x.org - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -****************************************************************************/ - -#ifndef __CC_STD_C_H__ -#define __CC_STD_C_H__ - -#include "platform/CCPlatformConfig.h" -#if CC_TARGET_PLATFORM == CC_PLATFORM_WINRT - - -#include "platform/CCPlatformMacros.h" -#include -#include -#include - -#ifndef __SSIZE_T -#define __SSIZE_T -typedef SSIZE_T ssize_t; -#endif // __SSIZE_T - -// for math.h on win32 platform - -#if !defined(_USE_MATH_DEFINES) - #define _USE_MATH_DEFINES // make M_PI can be use -#endif - -#if _MSC_VER < 1900 -#ifndef snprintf -#define snprintf _snprintf -#endif -#endif - -#include -#include -#include -#include -#include -#include - -#ifndef M_PI - #define M_PI 3.14159265358 -#endif -#ifndef M_PI_2 - #define M_PI_2 1.57079632679 -#endif - - -// for MIN MAX and sys/time.h on win32 platform -#ifndef NOMINMAX - #define NOMINMAX -#endif - -#ifndef MIN -#define MIN(x,y) (((x) > (y)) ? (y) : (x)) -#endif // MIN - -#ifndef MAX -#define MAX(x,y) (((x) < (y)) ? (y) : (x)) -#endif // MAX - -#include - -#ifdef WINRT_NO_WINSOCK -#undef timeval -struct timeval -{ - long tv_sec; // seconds - long tv_usec; // microSeconds -}; -#else -// Structure timeval has define in winsock.h, include windows.h for it. -#define _WINSOCKAPI_ -#include -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN 1 -#include -#endif -#endif - -struct timezone -{ - int tz_minuteswest; - int tz_dsttime; -}; - -int CC_DLL gettimeofday(struct timeval *, struct timezone *); - -#endif // CC_TARGET_PLATFORM == CC_PLATFORM_WINRT - -#endif // __CC_STD_C_H__ - diff --git a/cocos/platform/winrt/CCWinRTUtils.cpp b/cocos/platform/winrt/CCWinRTUtils.cpp deleted file mode 100644 index 2b5ea35ba833..000000000000 --- a/cocos/platform/winrt/CCWinRTUtils.cpp +++ /dev/null @@ -1,389 +0,0 @@ -/**************************************************************************** -Copyright (c) 2010-2013 cocos2d-x.org -Copyright (c) Microsoft Open Technologies, Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - -http://www.cocos2d-x.org - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -****************************************************************************/ -#include "platform/winrt/CCWinRTUtils.h" -#include -#include -#include -#include -#include -#include "base/ccMacros.h" -#include "platform/CCPlatformMacros.h" -#include "platform/CCFileUtils.h" -#include "base/CCUserDefault.h" - -using namespace Windows::UI::Xaml; -using namespace Windows::UI::Xaml::Controls; - -NS_CC_BEGIN - -using namespace Windows::Graphics::Display; -using namespace Windows::Storage; -using namespace concurrency; -using namespace Platform; -using namespace Windows::Storage; -using namespace Windows::Storage::Pickers; -using namespace Windows::Storage::Streams; -using namespace Windows::Networking::Connectivity; - -bool isWindowsPhone() -{ -#if _MSC_VER >= 1900 - if (Windows::Foundation::Metadata::ApiInformation::IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")) - return true; - else - return false; -#elif (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) - return true; -#else - return false; -#endif -} - -CC_DEPRECATED_ATTRIBUTE std::wstring CC_DLL CCUtf8ToUnicode(const char * pszUtf8Str, unsigned len /*= -1*/) -{ - if (len == -1) - { - return StringUtf8ToWideChar(pszUtf8Str); - } - else - { - std::wstring ret; - do - { - if (!pszUtf8Str || !len) break; - - // get UTF16 string length - int wLen = MultiByteToWideChar(CP_UTF8, 0, pszUtf8Str, len, 0, 0); - if (0 == wLen || 0xFFFD == wLen) break; - - // convert string - wchar_t * pwszStr = new wchar_t[wLen + 1]; - if (!pwszStr) break; - pwszStr[wLen] = 0; - MultiByteToWideChar(CP_UTF8, 0, pszUtf8Str, len, pwszStr, wLen + 1); - ret = pwszStr; - CC_SAFE_DELETE_ARRAY(pwszStr); - } while (0); - return ret; - } -} - -CC_DEPRECATED_ATTRIBUTE std::string CC_DLL CCUnicodeToUtf8(const wchar_t* pwszStr) -{ - return StringWideCharToUtf8(pwszStr); -} - - -std::wstring StringUtf8ToWideChar(const std::string& strUtf8) -{ - std::wstring ret; - if (!strUtf8.empty()) - { - int nNum = MultiByteToWideChar(CP_UTF8, 0, strUtf8.c_str(), -1, nullptr, 0); - if (nNum) - { - WCHAR* wideCharString = new WCHAR[nNum + 1]; - wideCharString[0] = 0; - - nNum = MultiByteToWideChar(CP_UTF8, 0, strUtf8.c_str(), -1, wideCharString, nNum + 1); - - ret = wideCharString; - delete[] wideCharString; - } - else - { - CCLOG("Wrong convert to WideChar code:0x%x", GetLastError()); - } - } - return ret; -} - -std::string StringWideCharToUtf8(const std::wstring& strWideChar) -{ - std::string ret; - if (!strWideChar.empty()) - { - int nNum = WideCharToMultiByte(CP_UTF8, 0, strWideChar.c_str(), -1, nullptr, 0, nullptr, FALSE); - if (nNum) - { - char* utf8String = new char[nNum + 1]; - utf8String[0] = 0; - - nNum = WideCharToMultiByte(CP_UTF8, 0, strWideChar.c_str(), -1, utf8String, nNum + 1, nullptr, FALSE); - - ret = utf8String; - delete[] utf8String; - } - else - { - CCLOG("Wrong convert to Utf8 code:0x%x", GetLastError()); - } - } - - return ret; -} - -std::string PlatformStringToString(Platform::String^ s) { - return StringWideCharToUtf8(std::wstring(s->Data())); -} - -Platform::String^ PlatformStringFromString(const std::string& s) -{ - std::wstring ws = StringUtf8ToWideChar(s); - return ref new Platform::String(ws.data(), static_cast(ws.length())); -} - -#if 0 -// Method to convert a length in device-independent pixels (DIPs) to a length in physical pixels. -float ConvertDipsToPixels(float dips) -{ - static const float dipsPerInch = 96.0f; - return floor(dips * DisplayProperties::LogicalDpi / dipsPerInch + 0.5f); // Round to nearest integer. -} - -float getScaledDPIValue(float v) { - auto dipFactor = DisplayProperties::LogicalDpi / 96.0f; - return v * dipFactor; -} -#endif - -void CC_DLL CCLogIPAddresses() -{ - auto hostnames = NetworkInformation::GetHostNames(); - int length = hostnames->Size; - - for(int i = 0; i < length; i++) - { - auto hn = hostnames->GetAt(i); - if (hn->IPInformation != nullptr) - { - std::string s = PlatformStringToString(hn->DisplayName); - log("IP Address: %s:", s.c_str()); - } - } -} - -std::string CC_DLL getDeviceIPAddresses() -{ - std::stringstream result; - - auto hostnames = NetworkInformation::GetHostNames(); - int length = hostnames->Size; - - for(int i = 0; i < length; i++) - { - auto hn = hostnames->GetAt(i); - if (hn->IPInformation != nullptr) - { - result << PlatformStringToString(hn->DisplayName) << std::endl; - } - } - - return result.str(); -} - -Platform::Object^ findXamlElement(Platform::Object^ parent, Platform::String^ name) -{ - if (parent == nullptr || name == nullptr || name->Length() == 0) - { - return nullptr; - } - - FrameworkElement^ element = dynamic_cast(parent); - if (element == nullptr) - { - return nullptr; - } - - if (element->Name == name) - { - return element; - } - - Panel^ panel = dynamic_cast(element); - if (panel == nullptr) - { - return nullptr; - } - - int count = panel->Children->Size; - for (int i = 0; i < count; i++) - { - auto result = findXamlElement(panel->Children->GetAt(i), name); - if (result != nullptr) - { - return result; - } - } - - return nullptr; -} - - -bool removeXamlElement(Platform::Object^ parent, Platform::Object^ element) -{ - Panel^ panel = dynamic_cast(parent); - if (panel == nullptr) - { - return false; - } - - UIElement^ uiElement = dynamic_cast(element); - if (uiElement == nullptr) - { - return false; - } - - unsigned int index; - if (!panel->Children->IndexOf(uiElement, &index)) - { - return false; - } - - panel->Children->RemoveAt(index); - - return true; -} - -bool replaceXamlElement(Platform::Object^ parent, Platform::Object^ add, Platform::Object^ remove) -{ - Panel^ panel = dynamic_cast(parent); - if (panel == nullptr) - { - return false; - } - - UIElement^ addElement = dynamic_cast(add); - if (addElement == nullptr) - { - return false; - } - - UIElement^ removeElement = dynamic_cast(remove); - if (removeElement == nullptr) - { - return false; - } - - unsigned int index; - if (!panel->Children->IndexOf(removeElement, &index)) - { - return false; - } - - panel->Children->RemoveAt(index); - panel->Children->InsertAt(index, addElement); - - return true; -} - -// Function that reads from a binary file asynchronously. -Concurrency::task^> ReadDataAsync(Platform::String^ path) -{ - using namespace Windows::Storage; - using namespace Concurrency; - - return create_task(StorageFile::GetFileFromPathAsync(path)).then([&](StorageFile^ f) - { - return FileIO::ReadBufferAsync(f); - - }).then([] (Streams::IBuffer^ fileBuffer) -> Platform::Array^ - { - auto fileData = ref new Platform::Array(fileBuffer->Length); - Streams::DataReader::FromBuffer(fileBuffer)->ReadBytes(fileData); - return fileData; - }); -} - -std::string computeHashForFile(const std::string& filePath) -{ - std::string ret = filePath; - size_t pos = ret.find_last_of('/'); - - if (pos != std::string::npos) { - ret = ret.substr(pos); - } - - pos = ret.find_last_of('.'); - - if (pos != std::string::npos) { - ret = ret.substr(0, pos); - } - - CREATEFILE2_EXTENDED_PARAMETERS extParams = { 0 }; - extParams.dwFileAttributes = FILE_ATTRIBUTE_NORMAL; - extParams.dwFileFlags = FILE_FLAG_RANDOM_ACCESS; - extParams.dwSecurityQosFlags = SECURITY_ANONYMOUS; - extParams.dwSize = sizeof(extParams); - extParams.hTemplateFile = nullptr; - extParams.lpSecurityAttributes = nullptr; - - Microsoft::WRL::Wrappers::FileHandle file(CreateFile2(std::wstring(filePath.begin(), filePath.end()).c_str(), GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, &extParams)); - - if (file.Get() != INVALID_HANDLE_VALUE) { - FILE_BASIC_INFO fInfo = { 0 }; - if (GetFileInformationByHandleEx(file.Get(), FileBasicInfo, &fInfo, sizeof(FILE_BASIC_INFO))) { - std::stringstream ss; - ss << ret << "_"; - ss << fInfo.CreationTime.QuadPart; - ss << fInfo.ChangeTime.QuadPart; - ret = ss.str(); - } - } - - return ret; -} - -bool createMappedCacheFile(const std::string& srcFilePath, std::string& cacheFilePath, const std::string& ext /* = "" */) -{ - bool ret = false; - auto folderPath = FileUtils::getInstance()->getWritablePath(); - cacheFilePath = folderPath + computeHashForFile(srcFilePath) + ext; - std::string prevFile = UserDefault::getInstance()->getStringForKey(srcFilePath.c_str()); - - if (prevFile == cacheFilePath) { - ret = FileUtils::getInstance()->isFileExist(cacheFilePath); - } - else { - FileUtils::getInstance()->removeFile(prevFile); - } - - UserDefault::getInstance()->setStringForKey(srcFilePath.c_str(), cacheFilePath); - return ret; -} - -void destroyMappedCacheFile(const std::string& key) -{ - std::string value = UserDefault::getInstance()->getStringForKey(key.c_str()); - - if (!value.empty()) { - FileUtils::getInstance()->removeFile(value); - } - - UserDefault::getInstance()->setStringForKey(key.c_str(), ""); -} - -NS_CC_END diff --git a/cocos/platform/winrt/CCWinRTUtils.h b/cocos/platform/winrt/CCWinRTUtils.h deleted file mode 100644 index d29e9f673b86..000000000000 --- a/cocos/platform/winrt/CCWinRTUtils.h +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -Copyright (c) 2010 cocos2d-x.org -Copyright (c) Microsoft Open Technologies, Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - -http://www.cocos2d-x.org - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -****************************************************************************/ - -#ifndef __CCWINRT_UTILS_H__ -#define __CCWINRT_UTILS_H__ - -#include "platform/CCPlatformMacros.h" -#include - -#include - -NS_CC_BEGIN - -bool isWindowsPhone(); - -CC_DEPRECATED_ATTRIBUTE std::wstring CC_DLL CCUtf8ToUnicode(const char * pszUtf8Str, unsigned len = -1); -CC_DEPRECATED_ATTRIBUTE std::string CC_DLL CCUnicodeToUtf8(const wchar_t* pwszStr); - -std::wstring CC_DLL StringUtf8ToWideChar(const std::string& strUtf8); -std::string CC_DLL StringWideCharToUtf8(const std::wstring& strWideChar); - -Platform::Object^ findXamlElement(Platform::Object^ parent, Platform::String^ name); -bool removeXamlElement(Platform::Object^ parent, Platform::Object^ element); -bool replaceXamlElement(Platform::Object^ parent, Platform::Object^ add, Platform::Object^ remove); - -std::string PlatformStringToString(Platform::String^ s); -Platform::String^ PlatformStringFromString(const std::string& s); - -Concurrency::task^> ReadDataAsync(Platform::String^ path); - -void CC_DLL CCLogIPAddresses(); - -std::string CC_DLL getDeviceIPAddresses(); - -std::string computeHashForFile(const std::string& filePath); - -// creates a cache file path corresponding to given source file. -// srcFilePath - source file. -// cacheFilePath - cache file path to be used to save cache. -// return true if file already exists -bool createMappedCacheFile(/*In*/ const std::string& srcFilePath, /*Out*/ std::string& cacheFilePath, /*Optional*/ const std::string& ext = ""); -void destroyMappedCacheFile(const std::string& key); - -NS_CC_END - -#endif // __CCWINRT_UTILS_H__ diff --git a/cocos/platform/winrt/InputEvent.cpp b/cocos/platform/winrt/InputEvent.cpp deleted file mode 100644 index 168bc89643c1..000000000000 --- a/cocos/platform/winrt/InputEvent.cpp +++ /dev/null @@ -1,193 +0,0 @@ -/**************************************************************************** -Copyright (c) 2013 cocos2d-x.org -Copyright (c) Microsoft Open Technologies, Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - -http://www.cocos2d-x.org - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -****************************************************************************/ - -#include "platform/winrt/InputEvent.h" -#include "platform/winrt/CCWinRTUtils.h" -#include "platform/winrt/CCGLViewImpl-winrt.h" -#include "base/CCEventAcceleration.h" -#include "base/CCDirector.h" -#include "base/CCEventDispatcher.h" -#include "base/CCIMEDispatcher.h" - -NS_CC_BEGIN - -AccelerometerEvent::AccelerometerEvent(const Acceleration& event) - : m_event(event) -{ - -} - -void AccelerometerEvent::execute() -{ - auto dispatcher = Director::getInstance()->getEventDispatcher(); - cocos2d::EventAcceleration accEvent(m_event); - dispatcher->dispatchEvent(&accEvent); -} - - -PointerEvent::PointerEvent(PointerEventType type, Windows::UI::Core::PointerEventArgs^ args) - : m_type(type), m_args(args) -{ - -} - -void PointerEvent::execute() -{ - switch(m_type) - { - case PointerEventType::PointerPressed: - GLViewImpl::sharedOpenGLView()->OnPointerPressed(m_args.Get()); - break; - case PointerEventType::PointerMoved: - GLViewImpl::sharedOpenGLView()->OnPointerMoved(m_args.Get()); - break; - case PointerEventType::PointerReleased: - GLViewImpl::sharedOpenGLView()->OnPointerReleased(m_args.Get()); - break; - case cocos2d::MousePressed: - GLViewImpl::sharedOpenGLView()->OnMousePressed(m_args.Get()); - break; - case cocos2d::MouseMoved: - GLViewImpl::sharedOpenGLView()->OnMouseMoved(m_args.Get()); - break; - case cocos2d::MouseReleased: - GLViewImpl::sharedOpenGLView()->OnMouseReleased(m_args.Get()); - break; - case cocos2d::MouseWheelChanged: - GLViewImpl::sharedOpenGLView()->OnMouseWheelChanged(m_args.Get()); - break; - } -} - -KeyboardEvent::KeyboardEvent(Cocos2dKeyEvent type) - : m_type(type), m_text(nullptr) -{ - -} - -KeyboardEvent::KeyboardEvent(Cocos2dKeyEvent type, Platform::String^ text) - : m_type(type), m_text(text) -{ - -} - -void KeyboardEvent::execute() -{ - switch(m_type) - { - case Cocos2dKeyEvent::Text: - { - std::string utf8String = PlatformStringToString(m_text.Get()); - IMEDispatcher::sharedDispatcher()->dispatchInsertText(utf8String.c_str(), utf8String.size()); - break; - } - - default: - switch (m_type) - { - case Cocos2dKeyEvent::Escape: - //Director::getInstance()()->getKeypadDispatcher()->dispatchKeypadMSG(kTypeBackClicked); - break; - case Cocos2dKeyEvent::Back: - IMEDispatcher::sharedDispatcher()->dispatchDeleteBackward(); - break; - case Cocos2dKeyEvent::Enter: - IMEDispatcher::sharedDispatcher()->dispatchInsertText("\n", 1); - break; - default: - break; - } - break; - } -} - -WinRTKeyboardEvent::WinRTKeyboardEvent(WinRTKeyboardEventType type, Windows::UI::Core::KeyEventArgs^ args) - : m_type(type), m_key(args) -{ -} - -void WinRTKeyboardEvent::execute() -{ - GLViewImpl::sharedOpenGLView()->OnWinRTKeyboardEvent(m_type, m_key.Get()); -} - -BackButtonEvent::BackButtonEvent() -{ - -} - -void BackButtonEvent::execute() -{ - GLViewImpl::sharedOpenGLView()->OnBackKeyPress(); -} - -CustomInputEvent::CustomInputEvent(const std::function& fun) -: m_fun(fun) -{ -} - -void CustomInputEvent::execute() -{ - m_fun(); -} - -UIEditBoxEvent::UIEditBoxEvent(Platform::Object^ sender, Platform::String^ text, Windows::Foundation::EventHandler^ handle) - : m_sender(sender) - , m_text(text) - , m_handler(handle) -{ - -} - -void UIEditBoxEvent::execute() -{ - if (m_handler.Get()) - { - m_handler.Get()->Invoke(m_sender.Get(), m_text.Get()); - } -} - -UIEditBoxEndEvent::UIEditBoxEndEvent(Platform::Object^ sender, Platform::String^ text, int action, Windows::Foundation::EventHandler^ handle) - : m_sender(sender) - , m_text(text) - , m_action(action) - , m_handler(handle) -{ - -} - -void UIEditBoxEndEvent::execute() -{ - if (m_handler.Get()) - { - auto args = ref new EndEventArgs(m_action, m_text.Get()); - m_handler.Get()->Invoke(m_sender.Get(), args); - } -} - -NS_CC_END - - diff --git a/cocos/platform/winrt/InputEvent.h b/cocos/platform/winrt/InputEvent.h deleted file mode 100644 index fda9cb4fde33..000000000000 --- a/cocos/platform/winrt/InputEvent.h +++ /dev/null @@ -1,172 +0,0 @@ -/**************************************************************************** -Copyright (c) 2013 cocos2d-x.org -Copyright (c) Microsoft Open Technologies, Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - -http://www.cocos2d-x.org - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -****************************************************************************/ - -#ifndef __WINRT_INPUT_EVENT__ -#define __WINRT_INPUT_EVENT__ - -#include "platform/CCPlatformMacros.h" -#include "platform/winrt/InputEventTypes.h" -#include "base/ccTypes.h" -#include - -NS_CC_BEGIN - - -enum PointerEventType -{ - PointerPressed, - PointerMoved, - PointerReleased, - MousePressed, - MouseMoved, - MouseReleased, - MouseWheelChanged, -}; -enum MouseButton -{ - Left = 0, - Right = 1, - Middle = 2, - None -}; - -class CC_DLL InputEvent -{ -public: - InputEvent() {}; - virtual ~InputEvent() {}; - virtual void execute() = 0; -}; - - -class CC_DLL AccelerometerEvent : public InputEvent -{ -public: - AccelerometerEvent(const cocos2d::Acceleration& event); - virtual void execute(); - -private: - cocos2d::Acceleration m_event; -}; - -class CC_DLL PointerEvent : public InputEvent -{ -public: - PointerEvent(PointerEventType type, Windows::UI::Core::PointerEventArgs^ args); - virtual void execute(); - - -private: - PointerEventType m_type; - Platform::Agile m_args; -}; - -class CC_DLL KeyboardEvent : public InputEvent - -{ -public: - KeyboardEvent(Cocos2dKeyEvent type); - KeyboardEvent(Cocos2dKeyEvent type, Platform::String^ text); - virtual void execute(); - -private: - Cocos2dKeyEvent m_type; - Platform::Agile m_text; -}; - -enum WinRTKeyboardEventType -{ - KeyPressed, - KeyReleased, -}; - -class CC_DLL WinRTKeyboardEvent : public InputEvent -{ -public: - WinRTKeyboardEvent(WinRTKeyboardEventType type, Windows::UI::Core::KeyEventArgs^ args); - virtual void execute(); - -private: - WinRTKeyboardEventType m_type; - Platform::Agile m_key; -}; - - -class CC_DLL BackButtonEvent : public InputEvent -{ -public: - BackButtonEvent(); - virtual void execute(); -}; - -class CC_DLL CustomInputEvent : public InputEvent -{ -public: - CustomInputEvent(const std::function&); - virtual void execute(); -private: - std::function m_fun; -}; - -class UIEditBoxEvent : public cocos2d::InputEvent -{ -public: - UIEditBoxEvent(Platform::Object^ sender, Platform::String^ text, Windows::Foundation::EventHandler^ handle); - - virtual void execute(); - -protected: - Platform::Agile m_sender; - Platform::Agile m_text; - Platform::Agile^> m_handler; -}; - -ref class EndEventArgs sealed { -public: - EndEventArgs(int action, Platform::String^ text) : m_text(text), m_action(action) {} - int GetAction() { return m_action; } - Platform::String^ GetText() { return m_text; } -private: - int m_action; - Platform::String^ m_text; -}; - -class UIEditBoxEndEvent : public cocos2d::InputEvent -{ -public: - UIEditBoxEndEvent(Platform::Object^ sender, Platform::String^ text, int action, Windows::Foundation::EventHandler^ handle); - virtual void execute(); -protected: - int m_action; - Platform::Agile m_sender; - Platform::Agile m_text; - Platform::Agile^> m_handler; -}; - -NS_CC_END - -#endif // #ifndef __WINRT_INPUT_EVENT__ - diff --git a/cocos/platform/winrt/Keyboard-winrt.cpp b/cocos/platform/winrt/Keyboard-winrt.cpp deleted file mode 100644 index e2a37843e255..000000000000 --- a/cocos/platform/winrt/Keyboard-winrt.cpp +++ /dev/null @@ -1,361 +0,0 @@ -/**************************************************************************** -Copyright (c) 2010-2012 cocos2d-x.org -Copyright (c) 2013-2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - -* Portions Copyright (c) Microsoft Open Technologies, Inc. -* All Rights Reserved -http://www.cocos2d-x.org - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -****************************************************************************/ - -#include "platform/winrt/Keyboard-winrt.h" -#include "base/CCEventKeyboard.h" -#include "platform/winrt/CCGLViewImpl-winrt.h" -#include "base/CCIMEDispatcher.h" -#include "base/CCDirector.h" -#include "base/CCEventDispatcher.h" - -using namespace cocos2d; -using namespace Platform; -using namespace Windows::System; -using namespace Windows::System::Threading; -using namespace Windows::UI::Core; -using namespace Windows::UI::Input; -using namespace Windows::UI::Xaml; -using namespace Windows::UI::Xaml::Controls; -using namespace Windows::UI::Xaml::Input; - -NS_CC_BEGIN - -struct keyCodeItem -{ - int key; - EventKeyboard::KeyCode keyCode; -}; - -static std::map g_keyCodeMap; - -// http://www.kbdedit.com/manual/low_level_vk_list.html -// https://msdn.microsoft.com/library/windows/apps/windows.system.virtualkey.aspx - -static keyCodeItem g_keyCodeStructArray [] = { - /* The unknown key */ - { (int) VirtualKey::None, EventKeyboard::KeyCode::KEY_NONE }, - /* Printable keys */ - { (int) VirtualKey::Space, EventKeyboard::KeyCode::KEY_SPACE }, - { (int) VK_OEM_7, EventKeyboard::KeyCode::KEY_APOSTROPHE }, - { (int) VK_OEM_COMMA, EventKeyboard::KeyCode::KEY_COMMA }, - { (int) VK_OEM_MINUS, EventKeyboard::KeyCode::KEY_MINUS }, - { (int) VK_OEM_PERIOD, EventKeyboard::KeyCode::KEY_PERIOD }, - { (int) VK_OEM_2, EventKeyboard::KeyCode::KEY_SLASH }, - { (int) VK_OEM_3, EventKeyboard::KeyCode::KEY_TILDE }, - - { (int) VirtualKey::Number0, EventKeyboard::KeyCode::KEY_0 }, - { (int) VirtualKey::Number1, EventKeyboard::KeyCode::KEY_1 }, - { (int) VirtualKey::Number2, EventKeyboard::KeyCode::KEY_2 }, - { (int) VirtualKey::Number3, EventKeyboard::KeyCode::KEY_3 }, - { (int) VirtualKey::Number4, EventKeyboard::KeyCode::KEY_4 }, - { (int) VirtualKey::Number5, EventKeyboard::KeyCode::KEY_5 }, - { (int) VirtualKey::Number6, EventKeyboard::KeyCode::KEY_6 }, - { (int) VirtualKey::Number7, EventKeyboard::KeyCode::KEY_7 }, - { (int) VirtualKey::Number8, EventKeyboard::KeyCode::KEY_8 }, - { (int) VirtualKey::Number9, EventKeyboard::KeyCode::KEY_9 }, - { (int) VK_OEM_1, EventKeyboard::KeyCode::KEY_SEMICOLON }, - { (int) VK_OEM_PLUS, EventKeyboard::KeyCode::KEY_EQUAL }, - { (int) VirtualKey::A, EventKeyboard::KeyCode::KEY_A }, - { (int) VirtualKey::B, EventKeyboard::KeyCode::KEY_B }, - { (int) VirtualKey::C, EventKeyboard::KeyCode::KEY_C }, - { (int) VirtualKey::D, EventKeyboard::KeyCode::KEY_D }, - { (int) VirtualKey::E, EventKeyboard::KeyCode::KEY_E }, - { (int) VirtualKey::F, EventKeyboard::KeyCode::KEY_F }, - { (int) VirtualKey::G, EventKeyboard::KeyCode::KEY_G }, - { (int) VirtualKey::H, EventKeyboard::KeyCode::KEY_H }, - { (int) VirtualKey::I, EventKeyboard::KeyCode::KEY_I }, - { (int) VirtualKey::J, EventKeyboard::KeyCode::KEY_J }, - { (int) VirtualKey::K, EventKeyboard::KeyCode::KEY_K }, - { (int) VirtualKey::L, EventKeyboard::KeyCode::KEY_L }, - { (int) VirtualKey::M, EventKeyboard::KeyCode::KEY_M }, - { (int) VirtualKey::N, EventKeyboard::KeyCode::KEY_N }, - { (int) VirtualKey::O, EventKeyboard::KeyCode::KEY_O }, - { (int) VirtualKey::P, EventKeyboard::KeyCode::KEY_P }, - { (int) VirtualKey::Q, EventKeyboard::KeyCode::KEY_Q }, - { (int) VirtualKey::R, EventKeyboard::KeyCode::KEY_R }, - { (int) VirtualKey::S, EventKeyboard::KeyCode::KEY_S }, - { (int) VirtualKey::T, EventKeyboard::KeyCode::KEY_T }, - { (int) VirtualKey::U, EventKeyboard::KeyCode::KEY_U }, - { (int) VirtualKey::V, EventKeyboard::KeyCode::KEY_V }, - { (int) VirtualKey::W, EventKeyboard::KeyCode::KEY_W }, - { (int) VirtualKey::X, EventKeyboard::KeyCode::KEY_X }, - { (int) VirtualKey::Y, EventKeyboard::KeyCode::KEY_Y }, - { (int) VirtualKey::Z, EventKeyboard::KeyCode::KEY_Z }, - { VK_OEM_4, EventKeyboard::KeyCode::KEY_LEFT_BRACKET }, - { VK_OEM_5, EventKeyboard::KeyCode::KEY_BACK_SLASH }, - { VK_OEM_6, EventKeyboard::KeyCode::KEY_RIGHT_BRACKET }, - // { GLFW_KEY_GRAVE_ACCENT , EventKeyboard::KeyCode::KEY_GRAVE }, - - /* Function keys */ - { (int) VirtualKey::Escape, EventKeyboard::KeyCode::KEY_ESCAPE }, - { (int) VirtualKey::Enter, EventKeyboard::KeyCode::KEY_ENTER }, - { (int) VirtualKey::Tab, EventKeyboard::KeyCode::KEY_TAB }, - { (int) VirtualKey::Back, EventKeyboard::KeyCode::KEY_BACKSPACE }, - { (int) VirtualKey::Insert, EventKeyboard::KeyCode::KEY_INSERT }, - { (int) VirtualKey::Delete, EventKeyboard::KeyCode::KEY_DELETE }, - { (int) VirtualKey::Right, EventKeyboard::KeyCode::KEY_RIGHT_ARROW }, - { (int) VirtualKey::Left, EventKeyboard::KeyCode::KEY_LEFT_ARROW }, - { (int) VirtualKey::Down, EventKeyboard::KeyCode::KEY_DOWN_ARROW }, - { (int) VirtualKey::Up, EventKeyboard::KeyCode::KEY_UP_ARROW }, - { VK_PRIOR, EventKeyboard::KeyCode::KEY_PG_UP }, - { VK_NEXT, EventKeyboard::KeyCode::KEY_PG_DOWN }, - { VK_HOME, EventKeyboard::KeyCode::KEY_HOME }, - { VK_END, EventKeyboard::KeyCode::KEY_END }, - { VK_CAPITAL, EventKeyboard::KeyCode::KEY_CAPS_LOCK }, - { VK_SCROLL, EventKeyboard::KeyCode::KEY_SCROLL_LOCK }, - { VK_NUMLOCK, EventKeyboard::KeyCode::KEY_NUM_LOCK }, - { VK_SNAPSHOT, EventKeyboard::KeyCode::KEY_PRINT }, - { VK_PAUSE, EventKeyboard::KeyCode::KEY_PAUSE }, - { (int) VirtualKey::F1, EventKeyboard::KeyCode::KEY_F1 }, - { (int) VirtualKey::F2, EventKeyboard::KeyCode::KEY_F2 }, - { (int) VirtualKey::F3, EventKeyboard::KeyCode::KEY_F3 }, - { (int) VirtualKey::F4, EventKeyboard::KeyCode::KEY_F4 }, - { (int) VirtualKey::F5, EventKeyboard::KeyCode::KEY_F5 }, - { (int) VirtualKey::F6, EventKeyboard::KeyCode::KEY_F6 }, - { (int) VirtualKey::F7, EventKeyboard::KeyCode::KEY_F7 }, - { (int) VirtualKey::F8, EventKeyboard::KeyCode::KEY_F8 }, - { (int) VirtualKey::F9, EventKeyboard::KeyCode::KEY_F9 }, - { (int) VirtualKey::F10, EventKeyboard::KeyCode::KEY_F10 }, - { (int) VirtualKey::F11, EventKeyboard::KeyCode::KEY_F11 }, - { (int) VirtualKey::F12, EventKeyboard::KeyCode::KEY_F12 }, - { (int) VirtualKey::F13, EventKeyboard::KeyCode::KEY_NONE }, - { (int) VirtualKey::F14, EventKeyboard::KeyCode::KEY_NONE }, - { (int) VirtualKey::F15, EventKeyboard::KeyCode::KEY_NONE }, - { (int) VirtualKey::F16, EventKeyboard::KeyCode::KEY_NONE }, - { (int) VirtualKey::F17, EventKeyboard::KeyCode::KEY_NONE }, - { (int) VirtualKey::F18, EventKeyboard::KeyCode::KEY_NONE }, - { (int) VirtualKey::F19, EventKeyboard::KeyCode::KEY_NONE }, - { (int) VirtualKey::F20, EventKeyboard::KeyCode::KEY_NONE }, - { (int) VirtualKey::F21, EventKeyboard::KeyCode::KEY_NONE }, - { (int) VirtualKey::F22, EventKeyboard::KeyCode::KEY_NONE }, - { (int) VirtualKey::F23, EventKeyboard::KeyCode::KEY_NONE }, - { (int) VirtualKey::F24, EventKeyboard::KeyCode::KEY_NONE }, - - { (int) VirtualKey::NumberPad0, EventKeyboard::KeyCode::KEY_0 }, - { (int) VirtualKey::NumberPad1, EventKeyboard::KeyCode::KEY_1 }, - { (int) VirtualKey::NumberPad2, EventKeyboard::KeyCode::KEY_2 }, - { (int) VirtualKey::NumberPad3, EventKeyboard::KeyCode::KEY_3 }, - { (int) VirtualKey::NumberPad4, EventKeyboard::KeyCode::KEY_4 }, - { (int) VirtualKey::NumberPad5, EventKeyboard::KeyCode::KEY_5 }, - { (int) VirtualKey::NumberPad6, EventKeyboard::KeyCode::KEY_6 }, - { (int) VirtualKey::NumberPad7, EventKeyboard::KeyCode::KEY_7 }, - { (int) VirtualKey::NumberPad8, EventKeyboard::KeyCode::KEY_8 }, - { (int) VirtualKey::NumberPad9, EventKeyboard::KeyCode::KEY_9 }, -#if 0 - { GLFW_KEY_KP_1, EventKeyboard::KeyCode::KEY_1 }, - { GLFW_KEY_KP_2, EventKeyboard::KeyCode::KEY_2 }, - { GLFW_KEY_KP_3, EventKeyboard::KeyCode::KEY_3 }, - { GLFW_KEY_KP_4, EventKeyboard::KeyCode::KEY_4 }, - { GLFW_KEY_KP_5, EventKeyboard::KeyCode::KEY_5 }, - { GLFW_KEY_KP_6, EventKeyboard::KeyCode::KEY_6 }, - { GLFW_KEY_KP_7, EventKeyboard::KeyCode::KEY_7 }, - { GLFW_KEY_KP_8, EventKeyboard::KeyCode::KEY_8 }, - { GLFW_KEY_KP_9, EventKeyboard::KeyCode::KEY_9 }, -#endif - { (int) VirtualKey::Decimal, EventKeyboard::KeyCode::KEY_PERIOD }, - { (int) VirtualKey::Divide, EventKeyboard::KeyCode::KEY_KP_DIVIDE }, - { (int) VirtualKey::Multiply, EventKeyboard::KeyCode::KEY_KP_MULTIPLY }, - { (int) VirtualKey::Subtract, EventKeyboard::KeyCode::KEY_KP_MINUS }, - { (int) VirtualKey::Add, EventKeyboard::KeyCode::KEY_KP_PLUS }, - //{ GLFW_KEY_KP_ENTER , EventKeyboard::KeyCode::KEY_KP_ENTER }, - //{ GLFW_KEY_KP_EQUAL , EventKeyboard::KeyCode::KEY_EQUAL }, - { (int) VirtualKey::Shift, EventKeyboard::KeyCode::KEY_LEFT_SHIFT }, - { (int) VirtualKey::Control, EventKeyboard::KeyCode::KEY_LEFT_CTRL }, - { VK_LMENU, EventKeyboard::KeyCode::KEY_LEFT_ALT }, - { (int) VirtualKey::LeftWindows, EventKeyboard::KeyCode::KEY_HYPER }, - { (int) VirtualKey::RightShift, EventKeyboard::KeyCode::KEY_RIGHT_SHIFT }, - { (int) VirtualKey::RightControl, EventKeyboard::KeyCode::KEY_RIGHT_CTRL }, - { VK_RMENU, EventKeyboard::KeyCode::KEY_RIGHT_ALT }, - { (int) VirtualKey::RightWindows, EventKeyboard::KeyCode::KEY_HYPER }, - { (int) VirtualKey::Menu, EventKeyboard::KeyCode::KEY_MENU }, - { (int) VirtualKey::LeftMenu, EventKeyboard::KeyCode::KEY_MENU }, - { (int) VirtualKey::RightMenu, EventKeyboard::KeyCode::KEY_MENU } -}; - -KeyBoardWinRT::KeyBoardWinRT() -{ - g_keyCodeMap.clear(); - for (auto& item : g_keyCodeStructArray) - { - g_keyCodeMap[item.key] = item.keyCode; - } -} - -KeyBoardWinRT::~KeyBoardWinRT() -{ - -} - - -void KeyBoardWinRT::ShowKeyboard(Platform::String^ text) -{ - auto panel = cocos2d::GLViewImpl::sharedOpenGLView()->getPanel(); - auto dispatcher = cocos2d::GLViewImpl::sharedOpenGLView()->getDispatcher(); - - if (dispatcher && panel) - { - // run on main UI thread - dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal, ref new DispatchedHandler([this, text, panel]() - { - if (m_textBox == nullptr) - { - m_useInputMethod = false; - m_textBox = ref new TextBox(); - m_textBox->Opacity = 0.0; - m_textBox->Width = 1; - m_textBox->Height = 1; - m_textBox->TextChanged += ref new TextChangedEventHandler(this, &KeyBoardWinRT::OnTextChanged); - m_textBox->TextCompositionStarted += ref new Windows::Foundation::TypedEventHandler(this, &KeyBoardWinRT::OnTextCompositionStarted); - - m_textBox->TextCompositionEnded += ref new Windows::Foundation::TypedEventHandler(this, &KeyBoardWinRT::OnTextCompositionEnded); -#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) - // Need to use InputScopeNameValue::Search to prevent auto-capitalize - m_textBox->InputScope = ref new InputScope(); - auto n = m_textBox->InputScope->Names; - n->Append(ref new InputScopeName(InputScopeNameValue::Search)); -#endif - panel->Children->Append(m_textBox); - } - m_textBox->SelectionLength = 0; - m_textBox->SelectionStart = 32768; - m_textBox->Focus(FocusState::Programmatic); - })); - } -} - -void KeyBoardWinRT::HideKeyboard(Platform::String^ text) -{ - auto panel = cocos2d::GLViewImpl::sharedOpenGLView()->getPanel(); - auto dispatcher = cocos2d::GLViewImpl::sharedOpenGLView()->getDispatcher(); - - if (dispatcher && panel) - { - // run on main UI thread - dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal, ref new DispatchedHandler([this, text, panel]() - { - if (m_textBox != nullptr) - { - unsigned int index; - if (panel->Children->IndexOf(m_textBox, &index)) - { - panel->Children->RemoveAt(index); - } - } - m_textBox = nullptr; - })); - } -} - -void KeyBoardWinRT::OnWinRTKeyboardEvent(WinRTKeyboardEventType type, KeyEventArgs^ args) -{ - bool pressed = (type == WinRTKeyboardEventType::KeyPressed); - - // Is key repeats - bool repeat = pressed && args->KeyStatus.WasKeyDown; - - int key = static_cast(args->VirtualKey); - auto it = g_keyCodeMap.find(key); - if (it != g_keyCodeMap.end()) - { - - EventKeyboard::KeyCode keyCode = it->second; - - EventKeyboard event(keyCode, pressed); - if (!repeat) - { - auto dispatcher = Director::getInstance()->getEventDispatcher(); - dispatcher->dispatchEvent(&event); - if (keyCode == EventKeyboard::KeyCode::KEY_ENTER) - { - IMEDispatcher::sharedDispatcher()->dispatchInsertText("\n", 1); - } - } - - if (pressed && !event.isStopped()) - { - switch (keyCode) - { - case EventKeyboard::KeyCode::KEY_BACKSPACE: - IMEDispatcher::sharedDispatcher()->dispatchDeleteBackward(); - break; - case EventKeyboard::KeyCode::KEY_HOME: - case EventKeyboard::KeyCode::KEY_KP_HOME: - case EventKeyboard::KeyCode::KEY_DELETE: - case EventKeyboard::KeyCode::KEY_KP_DELETE: - case EventKeyboard::KeyCode::KEY_END: - case EventKeyboard::KeyCode::KEY_LEFT_ARROW: - case EventKeyboard::KeyCode::KEY_RIGHT_ARROW: - case EventKeyboard::KeyCode::KEY_ESCAPE: - IMEDispatcher::sharedDispatcher()->dispatchControlKey(keyCode); - break; - default: - break; - } - } - } - else - { - log("GLViewImpl::OnWinRTKeyboardEvent Virtual Key Code %d not supported", key); - } -} - -void KeyBoardWinRT::OnTextChanged(Platform::Object^ sender, TextChangedEventArgs^ args) -{ - if (m_useInputMethod) { - return; - } - auto text = m_textBox->Text; - if (text) - { - std::shared_ptr e(new cocos2d::KeyboardEvent(Cocos2dKeyEvent::Text, text)); - cocos2d::GLViewImpl::sharedOpenGLView()->QueueEvent(e); - m_textBox->Text = L""; - } -} - -void KeyBoardWinRT::OnTextCompositionStarted(Windows::UI::Xaml::Controls::TextBox^, Windows::UI::Xaml::Controls::TextCompositionStartedEventArgs^ args) -{ - m_useInputMethod = true; -} - -void KeyBoardWinRT::OnTextCompositionEnded(Windows::UI::Xaml::Controls::TextBox^, Windows::UI::Xaml::Controls::TextCompositionEndedEventArgs^ args) -{ - m_useInputMethod = false; - auto text = m_textBox->Text; - if (text) - { - std::shared_ptr e(new cocos2d::KeyboardEvent(Cocos2dKeyEvent::Text, text)); - cocos2d::GLViewImpl::sharedOpenGLView()->QueueEvent(e); - m_textBox->Text = L""; - } -} - -NS_CC_END - diff --git a/cocos/platform/winrt/Keyboard-winrt.h b/cocos/platform/winrt/Keyboard-winrt.h deleted file mode 100644 index d8cbf6ae775c..000000000000 --- a/cocos/platform/winrt/Keyboard-winrt.h +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -Copyright (c) 2010-2012 cocos2d-x.org -Copyright (c) 2013-2016 Chukong Technologies Inc. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - -* Portions Copyright (c) Microsoft Open Technologies, Inc. -* All Rights Reserved -http://www.cocos2d-x.org - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -****************************************************************************/ - -#pragma once - -#include -#include "platform/winrt/InputEvent.h" - -NS_CC_BEGIN - -ref class KeyBoardWinRT sealed -{ -public: - KeyBoardWinRT(); - virtual ~KeyBoardWinRT(); - - void ShowKeyboard(Platform::String^ text); - void HideKeyboard(Platform::String^ text); - -internal: - void OnWinRTKeyboardEvent(WinRTKeyboardEventType type, Windows::UI::Core::KeyEventArgs^ args); - -private: - void OnTextChanged(Platform::Object^ sender, Windows::UI::Xaml::Controls::TextChangedEventArgs^ args); - void OnTextCompositionStarted(Windows::UI::Xaml::Controls::TextBox^, Windows::UI::Xaml::Controls::TextCompositionStartedEventArgs^ args); - void OnTextCompositionEnded(Windows::UI::Xaml::Controls::TextBox^, Windows::UI::Xaml::Controls::TextCompositionEndedEventArgs^ args); - - Windows::UI::Xaml::Controls::TextBox^ m_textBox; - - bool m_useInputMethod; -}; - -NS_CC_END diff --git a/cocos/platform/winrt/WICImageLoader-winrt.cpp b/cocos/platform/winrt/WICImageLoader-winrt.cpp deleted file mode 100644 index 7c83cfaacf0b..000000000000 --- a/cocos/platform/winrt/WICImageLoader-winrt.cpp +++ /dev/null @@ -1,407 +0,0 @@ -/**************************************************************************** -Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. -Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - -The MIT License (MIT) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -Based upon code from the DirectX Tool Kit by Microsoft Corporation, -obtained from https://directxtk.codeplex.com -****************************************************************************/ -#include "platform/winrt/WICImageLoader-winrt.h" -#include "platform/winrt/CCWinRTUtils.h" - -NS_CC_BEGIN - -#if CC_USE_WIC - - IWICImagingFactory* WICImageLoader::_wicFactory = NULL; - -static WICConvert g_WICConvert[] = -{ - // Note target GUID in this conversion table must be one of those directly supported by cocos2d-x - - { GUID_WICPixelFormatBlackWhite, GUID_WICPixelFormat8bppGray }, // DXGI_FORMAT_R8_UNORM - - { GUID_WICPixelFormat1bppIndexed, GUID_WICPixelFormat32bppRGBA }, // DXGI_FORMAT_R8G8B8A8_UNORM - { GUID_WICPixelFormat2bppIndexed, GUID_WICPixelFormat32bppRGBA }, // DXGI_FORMAT_R8G8B8A8_UNORM - { GUID_WICPixelFormat4bppIndexed, GUID_WICPixelFormat32bppRGBA }, // DXGI_FORMAT_R8G8B8A8_UNORM - { GUID_WICPixelFormat8bppIndexed, GUID_WICPixelFormat32bppRGBA }, // DXGI_FORMAT_R8G8B8A8_UNORM - - { GUID_WICPixelFormat2bppGray, GUID_WICPixelFormat8bppGray }, // DXGI_FORMAT_R8_UNORM - { GUID_WICPixelFormat4bppGray, GUID_WICPixelFormat8bppGray }, // DXGI_FORMAT_R8_UNORM - - { GUID_WICPixelFormat16bppGrayFixedPoint, GUID_WICPixelFormat16bppGrayHalf }, // DXGI_FORMAT_R16_FLOAT - { GUID_WICPixelFormat32bppGrayFixedPoint, GUID_WICPixelFormat32bppGrayFloat }, // DXGI_FORMAT_R32_FLOAT - - { GUID_WICPixelFormat16bppBGR555, GUID_WICPixelFormat16bppBGRA5551 }, // DXGI_FORMAT_B5G5R5A1_UNORM - - { GUID_WICPixelFormat32bppBGR101010, GUID_WICPixelFormat32bppRGBA1010102 }, // DXGI_FORMAT_R10G10B10A2_UNORM - - { GUID_WICPixelFormat24bppBGR, GUID_WICPixelFormat24bppRGB }, // DXGI_FORMAT_R8G8B8A8_UNORM - { GUID_WICPixelFormat24bppRGB, GUID_WICPixelFormat24bppRGB }, // DXGI_FORMAT_R8G8B8A8_UNORM - { GUID_WICPixelFormat32bppPBGRA, GUID_WICPixelFormat32bppRGBA }, // DXGI_FORMAT_R8G8B8A8_UNORM - { GUID_WICPixelFormat32bppPRGBA, GUID_WICPixelFormat32bppRGBA }, // DXGI_FORMAT_R8G8B8A8_UNORM - - { GUID_WICPixelFormat48bppRGB, GUID_WICPixelFormat24bppRGB }, // DXGI_FORMAT_R16G16B16A16_UNORM - { GUID_WICPixelFormat48bppBGR, GUID_WICPixelFormat24bppRGB }, // DXGI_FORMAT_R16G16B16A16_UNORM - - { GUID_WICPixelFormat48bppRGBFixedPoint, GUID_WICPixelFormat24bppRGB }, // DXGI_FORMAT_R16G16B16A16_FLOAT - { GUID_WICPixelFormat48bppBGRFixedPoint, GUID_WICPixelFormat24bppRGB }, // DXGI_FORMAT_R16G16B16A16_FLOAT - - //#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) || defined(_WIN7_PLATFORM_UPDATE) - // { GUID_WICPixelFormat32bppRGB, GUID_WICPixelFormat32bppRGBA }, // DXGI_FORMAT_R8G8B8A8_UNORM - // { GUID_WICPixelFormat64bppRGB, GUID_WICPixelFormat64bppRGBA }, // DXGI_FORMAT_R16G16B16A16_UNORM - // { GUID_WICPixelFormat64bppPRGBAHalf, GUID_WICPixelFormat64bppRGBAHalf }, // DXGI_FORMAT_R16G16B16A16_FLOAT - //#endif - - // We don't support n-channel formats -}; - -WICImageLoader::WICImageLoader() : - _width(0), - _height(0), - _dataLen(0), - _bpp(0), - _data(0) -{ - memset((void*)&_format, 0, sizeof(_format)); -} - -WICImageLoader::~WICImageLoader() -{ - if(_data != NULL && _dataLen > 0) { - delete[] _data; - _data = NULL; - } -} - -bool WICImageLoader::decodeImageData(ImageBlob blob, size_t size) -{ - bool bRet = false; - HRESULT hr = E_FAIL; - - IWICStream* pWicStream = NULL; - IWICImagingFactory* pWicFactory = getWICFactory(); - - if(NULL != pWicFactory) - { - hr = pWicFactory->CreateStream(&pWicStream); - } - - if(SUCCEEDED(hr)) - { - hr = pWicStream->InitializeFromMemory((BYTE*)blob, static_cast(size)); - } - - IWICBitmapDecoder* pDecoder = NULL; - - if(SUCCEEDED(hr)) - { - hr = pWicFactory->CreateDecoderFromStream(pWicStream, NULL, WICDecodeMetadataCacheOnLoad, &pDecoder); - } - - bRet = processImage(pDecoder); - - SafeRelease(&pWicStream); - SafeRelease(&pDecoder); - - return bRet; -} - -bool WICImageLoader::processImage(IWICBitmapDecoder* pDecoder) -{ - HRESULT hr = E_FAIL; - IWICBitmapFrameDecode* pFrame = NULL; - - if(NULL != pDecoder) - { - hr = pDecoder->GetFrame(0, &pFrame); - } - - if(SUCCEEDED(hr)) - { - hr = pFrame->GetPixelFormat(&_format); - } - - IWICFormatConverter* pConv = NULL; - - if(SUCCEEDED(hr)) - { - hr = convertFormatIfRequired(pFrame, &pConv); - } - - if(SUCCEEDED(hr)) - { - _bpp = getBitsPerPixel(_format); - - if(NULL != pConv) - { - hr = pConv->GetSize((UINT*)&_width, (UINT*)&_height); - } - else - { - hr = pFrame->GetSize((UINT*)&_width, (UINT*)&_height); - } - } - - assert(_bpp > 0); - assert(_width > 0 && _height > 0); - - if(SUCCEEDED(hr)) - { - size_t rowPitch = (_width * _bpp + 7) / 8; - _dataLen = rowPitch * _height; - _data = new (std::nothrow) BYTE[_dataLen]; - - if(NULL != pConv) - { - hr = pConv->CopyPixels(NULL, static_cast(rowPitch), static_cast(_dataLen), _data); - } - else - { - hr = pFrame->CopyPixels(NULL, static_cast(rowPitch), static_cast(_dataLen), _data); - } - } - - SafeRelease(&pFrame); - SafeRelease(&pConv); - return SUCCEEDED(hr); -} - -HRESULT WICImageLoader::convertFormatIfRequired(IWICBitmapFrameDecode* pFrame, IWICFormatConverter** ppConv) -{ - *ppConv = NULL; - - if( (memcmp(&_format, &GUID_WICPixelFormat8bppGray, sizeof(WICPixelFormatGUID)) == 0) || - (memcmp(&_format, &GUID_WICPixelFormat8bppAlpha, sizeof(WICPixelFormatGUID)) == 0) || - (memcmp(&_format, &GUID_WICPixelFormat24bppRGB, sizeof(WICPixelFormatGUID)) == 0) || - (memcmp(&_format, &GUID_WICPixelFormat32bppRGBA, sizeof(WICPixelFormatGUID)) == 0)) - { - return S_OK; - } - - HRESULT hr = E_FAIL; - IWICImagingFactory* pFactory = getWICFactory(); - IWICFormatConverter* pConv = NULL; - - if(NULL != pFactory) - { - hr = pFactory->CreateFormatConverter(&pConv); - } - - WICPixelFormatGUID destFormat = GUID_WICPixelFormat32bppRGBA; // Fallback to RGBA 32-bit format which is supported by all devices - - for( size_t i=0; i < _countof(g_WICConvert); ++i ) - { - if ( memcmp( &g_WICConvert[i].source, &_format, sizeof(WICPixelFormatGUID) ) == 0 ) - { - memcpy( &destFormat, &g_WICConvert[i].target, sizeof(WICPixelFormatGUID) ); - break; - } - } - - BOOL bCanConv = FALSE; - - if(SUCCEEDED(hr)) - { - hr = pConv->CanConvert(_format, destFormat, &bCanConv); - } - - if(SUCCEEDED(hr) && bCanConv == TRUE) - { - hr = pConv->Initialize(pFrame, destFormat, WICBitmapDitherTypeErrorDiffusion, 0, 0, WICBitmapPaletteTypeCustom); - } - - if(SUCCEEDED(hr)) - { - memcpy(&_format, &destFormat, sizeof(WICPixelFormatGUID)); - *ppConv = pConv; - } - - return SUCCEEDED(hr); -} - -size_t WICImageLoader::getBitsPerPixel(WICPixelFormatGUID format) -{ - HRESULT hr = E_FAIL; - - IWICImagingFactory* pfactory = getWICFactory(); - - IWICComponentInfo* pCInfo = NULL; - - if(pfactory != NULL) - { - hr = pfactory->CreateComponentInfo(format, &pCInfo); - } - - WICComponentType cType; - - if(SUCCEEDED(hr)) - { - hr = pCInfo->GetComponentType(&cType); - } - - IWICPixelFormatInfo* pPInfo = NULL; - - if(SUCCEEDED(hr) && cType == WICPixelFormat) - { - hr = pCInfo->QueryInterface(IID_IWICPixelFormatInfo, (void**)&pPInfo); - } - - UINT bpp = 0; - - if(SUCCEEDED(hr)) - { - hr = pPInfo->GetBitsPerPixel(&bpp); - } - - SafeRelease(&pCInfo); - SafeRelease(&pPInfo); - return bpp; -} - -int WICImageLoader::getHeight() -{ - return _height; -} - -int WICImageLoader::getWidth() -{ - return _width; -} - -size_t WICImageLoader::getImageData(ImageBlob rawData, size_t dataLen) -{ - if(dataLen < _dataLen) - return 0; - - memcpy((void*)rawData, _data, _dataLen); - - return _dataLen; -} - -size_t WICImageLoader::getImageDataSize() -{ - return _dataLen; -} - -WICPixelFormatGUID WICImageLoader::getPixelFormat() -{ - return _format; -} - -bool WICImageLoader::encodeImageData(std::string path, const unsigned char* data, size_t dataLen, WICPixelFormatGUID pixelFormat, int width, int height, GUID containerFormat) -{ - assert(data != NULL); - assert(dataLen > 0 && width > 0 && height > 0); - - IWICImagingFactory* pFact = getWICFactory(); - - HRESULT hr = E_FAIL; - IWICStream* pStream = NULL; - - if (NULL != pFact) { - hr = pFact->CreateStream(&pStream); - } - - if (SUCCEEDED(hr)) { - hr = pStream->InitializeFromFilename(StringUtf8ToWideChar(path).c_str(), GENERIC_WRITE); - } - - IWICBitmapEncoder* pEnc = NULL; - - if (SUCCEEDED(hr)) { - hr = pFact->CreateEncoder(containerFormat, NULL, &pEnc); - } - - if (SUCCEEDED(hr)) { - hr = pEnc->Initialize(pStream, WICBitmapEncoderNoCache); - } - - IWICBitmapFrameEncode* pFrame = NULL; - IPropertyBag2* pProp = NULL; - - if (SUCCEEDED(hr)) { - hr = pEnc->CreateNewFrame(&pFrame, &pProp); - } - - if (SUCCEEDED(hr)) { - hr = pFrame->Initialize(pProp); - } - - if (SUCCEEDED(hr)) { - hr = pFrame->SetSize(width, height); - } - - if (SUCCEEDED(hr)) { - WICPixelFormatGUID targetFormat = pixelFormat; - hr = pFrame->SetPixelFormat(&targetFormat); - - if (targetFormat != pixelFormat) { - hr = E_INVALIDARG; - } - } - - if (SUCCEEDED(hr)) { - size_t bpp = getBitsPerPixel(pixelFormat); - size_t stride = (width * bpp + 7) / 8; - - hr = pFrame->WritePixels(height, static_cast(stride), static_cast(dataLen), (BYTE*)data); - } - - if (SUCCEEDED(hr)) { - hr = pFrame->Commit(); - } - - if (SUCCEEDED(hr)) { - hr = pEnc->Commit(); - } - - SafeRelease(&pStream); - SafeRelease(&pEnc); - SafeRelease(&pFrame); - SafeRelease(&pProp); - return SUCCEEDED(hr); -} - -IWICImagingFactory* WICImageLoader::getWICFactory() -{ - if(NULL == _wicFactory) - { - HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED); - - if(SUCCEEDED(hr)) - { - hr = CoCreateInstance(CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER, IID_IWICImagingFactory, (LPVOID*)&_wicFactory); - } - - if(FAILED(hr)) - { - SafeRelease(&_wicFactory); - } - } - - return _wicFactory; -} - -#endif - -NS_CC_END diff --git a/cocos/platform/winrt/WICImageLoader-winrt.h b/cocos/platform/winrt/WICImageLoader-winrt.h deleted file mode 100644 index b3c9934861ee..000000000000 --- a/cocos/platform/winrt/WICImageLoader-winrt.h +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************** -Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. - -The MIT License (MIT) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -Based upon code from the DirectX Tool Kit by Microsoft Corporation, -obtained from https://directxtk.codeplex.com -****************************************************************************/ - -#ifndef __WIC_IMAGE_LOADER_H__ -#define __WIC_IMAGE_LOADER_H__ - -#include "base/ccConfig.h" - - -#if CC_USE_WIC - -#include -#include -#include -#include "platform/CCPlatformMacros.h" - -NS_CC_BEGIN - - - typedef const unsigned char* ImageBlob; - -struct WICConvert -{ - WICPixelFormatGUID source; - WICPixelFormatGUID target; -}; - -class CC_DLL WICImageLoader -{ -public: - - WICImageLoader(); - ~WICImageLoader(); - - int getWidth(); - int getHeight(); - size_t getImageDataSize(); - WICPixelFormatGUID getPixelFormat(); - size_t getImageData(ImageBlob rawData, size_t dataLen); - bool decodeImageData(ImageBlob data, size_t dataLen); - bool encodeImageData(std::string path, const unsigned char* data, size_t dataLen, WICPixelFormatGUID pixelFormat, int width, int height, GUID containerFormat); - -protected: - bool processImage(IWICBitmapDecoder* decoder); - size_t getBitsPerPixel(WICPixelFormatGUID format); - HRESULT convertFormatIfRequired(IWICBitmapFrameDecode* pFrame, IWICFormatConverter** ppConv); - - static IWICImagingFactory* getWICFactory(); - -private: - int _height; - int _width; - size_t _dataLen; - size_t _bpp; - WICPixelFormatGUID _format; - BYTE* _data; - - - static IWICImagingFactory* _wicFactory; -}; - -template -void SafeRelease(T **ppObj) -{ - if(*ppObj != NULL) - { - (*ppObj)->Release(); - *ppObj = NULL; - } -} - - -NS_CC_END - -#endif -#endif // #ifndef __WIC_IMAGE_LOADER_H__ - diff --git a/cocos/platform/winrt/inet_ntop_winrt.cpp b/cocos/platform/winrt/inet_ntop_winrt.cpp deleted file mode 100644 index 88c5a2d0de70..000000000000 --- a/cocos/platform/winrt/inet_ntop_winrt.cpp +++ /dev/null @@ -1,220 +0,0 @@ -/* - * Copyright (C) 1996-2001 Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -/* - * Original code by Paul Vixie. "curlified" by Gisle Vanem. - */ - -/* Portions Copyright (c) Microsoft Open Technologies, Inc. */ - -/*modifications by Microsoft Open Technologies, Inc. to implement missing inet_ntop() from Windows Phone 8 SDK */ - - -#include -#include - -#if defined(_DEBUG) -#define DEBUGASSERT(x) assert(x) -#else -#define DEBUGASSERT(x) -#endif - -#define ERRNO ((int)GetLastError()) -#define SET_ERRNO(x) (SetLastError((DWORD)(x))) - - -#define ENABLE_IPV6 - -#ifndef HAVE_INET_NTOP - -#ifdef HAVE_SYS_PARAM_H -#include -#endif -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_ARPA_INET_H -#include -#endif - -#if 0 -#define _MPRINTF_REPLACE /* use our functions only */ -#include -#endif // 0 - - -//#include "inet_ntop.h" - -#define IN6ADDRSZ 16 -#define INADDRSZ 4 -#define INT16SZ 2 - -/* - * Format an IPv4 address, more or less like inet_ntoa(). - * - * Returns `dst' (as a const) - * Note: - * - uses no statics - * - takes a unsigned char* not an in_addr as input - */ -static char *inet_ntop4 (const unsigned char *src, char *dst, size_t size) -{ - char tmp[sizeof "255.255.255.255"]; - size_t len; - - DEBUGASSERT(size >= 16); - - tmp[0] = '\0'; - (void)snprintf(tmp, sizeof(tmp), "%d.%d.%d.%d", - ((int)((unsigned char)src[0])) & 0xff, - ((int)((unsigned char)src[1])) & 0xff, - ((int)((unsigned char)src[2])) & 0xff, - ((int)((unsigned char)src[3])) & 0xff); - - len = strlen(tmp); - if(len == 0 || len >= size) { - SET_ERRNO(ENOSPC); - return (NULL); - } - strcpy(dst, tmp); - return dst; -} - -#ifdef ENABLE_IPV6 -/* - * Convert IPv6 binary address into presentation (printable) format. - */ -static char *inet_ntop6 (const unsigned char *src, char *dst, size_t size) -{ - /* - * Note that int32_t and int16_t need only be "at least" large enough - * to contain a value of the specified size. On some systems, like - * Crays, there is no such thing as an integer variable with 16 bits. - * Keep this in mind if you think this function should have been coded - * to use pointer overlays. All the world's not a VAX. - */ - char tmp[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")]; - char *tp; - struct { - long base; - long len; - } best, cur; - unsigned long words[IN6ADDRSZ / INT16SZ]; - int i; - - /* Preprocess: - * Copy the input (bytewise) array into a wordwise array. - * Find the longest run of 0x00's in src[] for :: shorthanding. - */ - memset(words, '\0', sizeof(words)); - for(i = 0; i < IN6ADDRSZ; i++) - words[i/2] |= (src[i] << ((1 - (i % 2)) << 3)); - - best.base = -1; - cur.base = -1; - best.len = 0; - cur.len = 0; - - for(i = 0; i < (IN6ADDRSZ / INT16SZ); i++) { - if(words[i] == 0) { - if(cur.base == -1) - cur.base = i, cur.len = 1; - else - cur.len++; - } - else if(cur.base != -1) { - if(best.base == -1 || cur.len > best.len) - best = cur; - cur.base = -1; - } - } - if((cur.base != -1) && (best.base == -1 || cur.len > best.len)) - best = cur; - if(best.base != -1 && best.len < 2) - best.base = -1; - /* Format the result. */ - tp = tmp; - for(i = 0; i < (IN6ADDRSZ / INT16SZ); i++) { - /* Are we inside the best run of 0x00's? */ - if(best.base != -1 && i >= best.base && i < (best.base + best.len)) { - if(i == best.base) - *tp++ = ':'; - continue; - } - - /* Are we following an initial run of 0x00s or any real hex? - */ - if(i != 0) - *tp++ = ':'; - - /* Is this address an encapsulated IPv4? - */ - if(i == 6 && best.base == 0 && - (best.len == 6 || (best.len == 5 && words[5] == 0xffff))) { - if(!inet_ntop4(src+12, tp, sizeof(tmp) - (tp - tmp))) { - SET_ERRNO(ENOSPC); - return (NULL); - } - tp += strlen(tp); - break; - } - tp += snprintf(tp, 5, "%lx", words[i]); - } - - /* Was it a trailing run of 0x00's? - */ - if(best.base != -1 && (best.base + best.len) == (IN6ADDRSZ / INT16SZ)) - *tp++ = ':'; - *tp++ = '\0'; - - /* Check for overflow, copy, and we're done. - */ - if((size_t)(tp - tmp) > size) { - SET_ERRNO(ENOSPC); - return (NULL); - } - strcpy(dst, tmp); - return dst; -} -#endif /* ENABLE_IPV6 */ - -/* - * Convert a network format address to presentation format. - * - * Returns pointer to presentation format address (`buf'). - * Returns NULL on error and errno set with the specific - * error, EAFNOSUPPORT or ENOSPC. - * - * On Windows we store the error in the thread errno, not - * in the winsock error code. This is to avoid losing the - * actual last winsock error. So use macro ERRNO to fetch the - * errno this function sets when returning NULL, not SOCKERRNO. - */ -char *inet_ntop(int af, const void *src, char *buf, size_t size) -{ - switch (af) { - case AF_INET: - return inet_ntop4((const unsigned char*)src, buf, size); -#ifdef ENABLE_IPV6 - case AF_INET6: - return inet_ntop6((const unsigned char*)src, buf, size); -#endif - default: - SET_ERRNO(EAFNOSUPPORT); - return NULL; - } -} -#endif /* HAVE_INET_NTOP */ diff --git a/cocos/platform/winrt/inet_ntop_winrt.h b/cocos/platform/winrt/inet_ntop_winrt.h deleted file mode 100644 index 12954aa5c0b5..000000000000 --- a/cocos/platform/winrt/inet_ntop_winrt.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef HEADER_CURL_INET_NTOP_WINRT_H -#define HEADER_CURL_INET_NTOP_WINRT_H -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - * - * Portions Copyright (c) Microsoft Open Technologies, Inc. - - - ***************************************************************************/ - -#if _MSC_VER < 1900 -char *inet_ntop(int af, const void *addr, char *buf, size_t size); -#endif - -#endif /* HEADER_CURL_INET_NTOP_H */ - diff --git a/cocos/platform/winrt/inet_pton_winrt.cpp b/cocos/platform/winrt/inet_pton_winrt.cpp deleted file mode 100644 index f9bc0d20e6f0..000000000000 --- a/cocos/platform/winrt/inet_pton_winrt.cpp +++ /dev/null @@ -1,234 +0,0 @@ -/* This is from the BIND 4.9.4 release, modified to compile by itself */ - -/* Copyright (c) 1996 by Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS - * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE - * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -/* Portions Copyright (c) Microsoft Open Technologies, Inc. */ - -/*modifications by Microsoft Open Technologies, Inc. to implement missing inet_pton() from Windows 8 SDK */ - -#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) - -#include -#include - -#define ERRNO ((int)GetLastError()) -#define SET_ERRNO(x) (SetLastError((DWORD)(x))) - -#include "platform/winrt/inet_pton_winrt.h" - -#define ENABLE_IPV6 - -#define IN6ADDRSZ 16 -#define INADDRSZ 4 -#define INT16SZ 2 - -/* - * WARNING: Don't even consider trying to compile this on a system where - * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX. - */ - -static int inet_pton4(const char *src, unsigned char *dst); -#ifdef ENABLE_IPV6 -static int inet_pton6(const char *src, unsigned char *dst); -#endif - -/* int - * inet_pton(af, src, dst) - * convert from presentation format (which usually means ASCII printable) - * to network format (which is usually some kind of binary format). - * return: - * 1 if the address was valid for the specified address family - * 0 if the address wasn't valid (`dst' is untouched in this case) - * -1 if some other error occurred (`dst' is untouched in this case, too) - * notice: - * On Windows we store the error in the thread errno, not - * in the winsock error code. This is to avoid losing the - * actual last winsock error. So use macro ERRNO to fetch the - * errno this function sets when returning (-1), not SOCKERRNO. - * author: - * Paul Vixie, 1996. - */ - -int inet_pton(int af, const char *src, void *dst) -{ - switch (af) { - case AF_INET: - return (inet_pton4(src, (unsigned char *)dst)); -#ifdef ENABLE_IPV6 - case AF_INET6: - return (inet_pton6(src, (unsigned char *)dst)); -#endif - default: - SET_ERRNO(EAFNOSUPPORT); - return (-1); - } - /* NOTREACHED */ -} - -/* int - * inet_pton4(src, dst) - * like inet_aton() but without all the hexadecimal and shorthand. - * return: - * 1 if `src' is a valid dotted quad, else 0. - * notice: - * does not touch `dst' unless it's returning 1. - * author: - * Paul Vixie, 1996. - */ -static int -inet_pton4(const char *src, unsigned char *dst) -{ - static const char digits[] = "0123456789"; - int saw_digit, octets, ch; - unsigned char tmp[INADDRSZ], *tp; - - saw_digit = 0; - octets = 0; - tp = tmp; - *tp = 0; - while((ch = *src++) != '\0') { - const char *pch; - - if((pch = strchr(digits, ch)) != NULL) { - unsigned int val = *tp * 10 + (unsigned int)(pch - digits); - - if(saw_digit && *tp == 0) - return (0); - if(val > 255) - return (0); - *tp = (unsigned char)val; - if(! saw_digit) { - if(++octets > 4) - return (0); - saw_digit = 1; - } - } - else if(ch == '.' && saw_digit) { - if(octets == 4) - return (0); - *++tp = 0; - saw_digit = 0; - } - else - return (0); - } - if(octets < 4) - return (0); - memcpy(dst, tmp, INADDRSZ); - return (1); -} - -#ifdef ENABLE_IPV6 -/* int - * inet_pton6(src, dst) - * convert presentation level address to network order binary form. - * return: - * 1 if `src' is a valid [RFC1884 2.2] address, else 0. - * notice: - * (1) does not touch `dst' unless it's returning 1. - * (2) :: in a full address is silently ignored. - * credit: - * inspired by Mark Andrews. - * author: - * Paul Vixie, 1996. - */ -static int -inet_pton6(const char *src, unsigned char *dst) -{ - static const char xdigits_l[] = "0123456789abcdef", - xdigits_u[] = "0123456789ABCDEF"; - unsigned char tmp[IN6ADDRSZ], *tp, *endp, *colonp; - const char *xdigits, *curtok; - int ch, saw_xdigit; - size_t val; - - memset((tp = tmp), 0, IN6ADDRSZ); - endp = tp + IN6ADDRSZ; - colonp = NULL; - /* Leading :: requires some special handling. */ - if(*src == ':') - if(*++src != ':') - return (0); - curtok = src; - saw_xdigit = 0; - val = 0; - while((ch = *src++) != '\0') { - const char *pch; - - if((pch = strchr((xdigits = xdigits_l), ch)) == NULL) - pch = strchr((xdigits = xdigits_u), ch); - if(pch != NULL) { - val <<= 4; - val |= (pch - xdigits); - if(++saw_xdigit > 4) - return (0); - continue; - } - if(ch == ':') { - curtok = src; - if(!saw_xdigit) { - if(colonp) - return (0); - colonp = tp; - continue; - } - if(tp + INT16SZ > endp) - return (0); - *tp++ = (unsigned char) (val >> 8) & 0xff; - *tp++ = (unsigned char) val & 0xff; - saw_xdigit = 0; - val = 0; - continue; - } - if(ch == '.' && ((tp + INADDRSZ) <= endp) && - inet_pton4(curtok, tp) > 0) { - tp += INADDRSZ; - saw_xdigit = 0; - break; /* '\0' was seen by inet_pton4(). */ - } - return (0); - } - if(saw_xdigit) { - if(tp + INT16SZ > endp) - return (0); - *tp++ = (unsigned char) (val >> 8) & 0xff; - *tp++ = (unsigned char) val & 0xff; - } - if(colonp != NULL) { - /* - * Since some memmove()'s erroneously fail to handle - * overlapping regions, we'll do the shift by hand. - */ - const ssize_t n = tp - colonp; - ssize_t i; - - if(tp == endp) - return (0); - for(i = 1; i <= n; i++) { - *(endp - i) = *(colonp + n - i); - *(colonp + n - i) = 0; - } - tp = endp; - } - if(tp != endp) - return (0); - memcpy(dst, tmp, IN6ADDRSZ); - return (1); -} -#endif /* ENABLE_IPV6 */ - -#endif /* HAVE_INET_PTON */ diff --git a/cocos/platform/winrt/inet_pton_winrt.h b/cocos/platform/winrt/inet_pton_winrt.h deleted file mode 100644 index 15a0110b99ce..000000000000 --- a/cocos/platform/winrt/inet_pton_winrt.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef HEADER_CURL_INET_PTON_WINIRT_H -#define HEADER_CURL_INET_PTON_WINIRT_H -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2005, Daniel Stenberg, , et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - * Portions Copyright (c) Microsoft Open Technologies, Inc. - * - ***************************************************************************/ - -#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) -int inet_pton(int af, const char *src, void *dst); -#endif - -#endif /* HEADER_CURL_INET_PTON_WINIRT_H */ - diff --git a/cocos/platform/winrt/pch.cpp b/cocos/platform/winrt/pch.cpp deleted file mode 100644 index b13a83b5cc02..000000000000 --- a/cocos/platform/winrt/pch.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - ****************************************************************************/ - -#include "pch.h" diff --git a/cocos/platform/winrt/pch.h b/cocos/platform/winrt/pch.h deleted file mode 100644 index 5a5a0f1001c5..000000000000 --- a/cocos/platform/winrt/pch.h +++ /dev/null @@ -1,35 +0,0 @@ -/**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - ****************************************************************************/ - -#pragma once - -#include "platform/winrt/targetver.h" - -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif - -#include -#include "cocos2d.h" -#include "cocos-ext.h" \ No newline at end of file diff --git a/cocos/platform/winrt/sha1.cpp b/cocos/platform/winrt/sha1.cpp deleted file mode 100644 index 9d181fe65ec2..000000000000 --- a/cocos/platform/winrt/sha1.cpp +++ /dev/null @@ -1,422 +0,0 @@ -/* - * sha1.cpp - * - * Copyright (C) The Internet Society (2001). All Rights Reserved. - * This document and translations of it may be copied and furnished to others, - * and derivative works that comment on or otherwise explain it or assist in its - * implementation may be prepared, copied, published and distributed, in whole or in part, - * without restriction of any kind, provided that the above copyright notice and this paragraph - * are included on all such copies and derivative works. However, this document itself may not - * be modified in any way, such as by removing the copyright notice or references to the Internet Society - * or other Internet organizations, except as needed for the purpose of developing Internet standards in - * which case the procedures for copyrights defined in the Internet Standards process must be followed, - * or as required to translate it into languages other than English. - * - * The limited permissions granted above are perpetual and will not be revoked by the Internet Society or its successors or assigns. - * - * This document and the information contained herein is provided on an "AS IS" basis and - * THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, - * INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS - * OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * Source: - * http://www.faqs.org/rfcs/rfc3174.html - * - * Description: - * This file implements the Secure Hashing Algorithm 1 as - * defined in FIPS PUB 180-1 published April 17, 1995. - * - * The SHA-1, produces a 160-bit message digest for a given - * data stream. It should take about 2**n steps to find a - * message with the same digest as a given message and - * 2**(n/2) to find any two messages with the same digest, - * when n is the digest size in bits. Therefore, this - * algorithm can serve as a means of providing a - * "fingerprint" for a message. - * - * Portability Issues: - * SHA-1 is defined in terms of 32-bit "words". This code - * uses (included via "sha1.h" to define 32 and 8 - * bit unsigned integer types. If your C compiler does not - * support 32 bit unsigned integers, this code is not - * appropriate. - * - * Caveats: - * SHA-1 is designed to work with messages less than 2^64 bits - * long. Although SHA-1 allows a message digest to be generated - * for messages of any number of bits less than 2^64, this - * implementation only works with messages with a length that is - * a multiple of the size of an 8-bit character. - * - */ - -#include "platform/winrt/sha1.h" - -/* - * Define the SHA1 circular left shift macro - */ -#define SHA1CircularShift(bits,word) \ - (((word) << (bits)) | ((word) >> (32-(bits)))) - -/* Local Function Prototyptes */ -void SHA1PadMessage(SHA1Context *); -void SHA1ProcessMessageBlock(SHA1Context *); - -/* - * SHA1Reset - * - * Description: - * This function will initialize the SHA1Context in preparation - * for computing a new SHA1 message digest. - * - * Parameters: - * context: [in/out] - * The context to reset. - * - * Returns: - * sha Error Code. - * - */ -int SHA1Reset(SHA1Context *context) -{ - if (!context) - { - return shaNull; - } - - context->Length_Low = 0; - context->Length_High = 0; - context->Message_Block_Index = 0; - - context->Intermediate_Hash[0] = 0x67452301; - context->Intermediate_Hash[1] = 0xEFCDAB89; - context->Intermediate_Hash[2] = 0x98BADCFE; - context->Intermediate_Hash[3] = 0x10325476; - context->Intermediate_Hash[4] = 0xC3D2E1F0; - - context->Computed = 0; - context->Corrupted = 0; - - return shaSuccess; -} - -/* - * SHA1Result - * - * Description: - * This function will return the 160-bit message digest into the - * Message_Digest array provided by the caller. - * NOTE: The first octet of hash is stored in the 0th element, - * the last octet of hash in the 19th element. - * - * Parameters: - * context: [in/out] - * The context to use to calculate the SHA-1 hash. - * Message_Digest: [out] - * Where the digest is returned. - * - * Returns: - * sha Error Code. - * - */ -int SHA1Result( SHA1Context *context, - uint8_t Message_Digest[SHA1HashSize]) -{ - int i; - - if (!context || !Message_Digest) - { - return shaNull; - } - - if (context->Corrupted) - { - return context->Corrupted; - } - - if (!context->Computed) - { - SHA1PadMessage(context); - for(i=0; i<64; ++i) - { - /* message may be sensitive, clear it out */ - context->Message_Block[i] = 0; - } - context->Length_Low = 0; /* and clear length */ - context->Length_High = 0; - context->Computed = 1; - - } - - for(i = 0; i < SHA1HashSize; ++i) - { - Message_Digest[i] = context->Intermediate_Hash[i>>2] - >> 8 * ( 3 - ( i & 0x03 ) ); - } - - return shaSuccess; -} - -/* - * SHA1Input - * - * Description: - * This function accepts an array of octets as the next portion - * of the message. - * - * Parameters: - * context: [in/out] - * The SHA context to update - * message_array: [in] - * An array of characters representing the next portion of - * the message. - * length: [in] - * The length of the message in message_array - * - * Returns: - * sha Error Code. - * - */ -int SHA1Input( SHA1Context *context, - const uint8_t *message_array, - unsigned length) -{ - if (!length) - { - return shaSuccess; - } - - if (!context || !message_array) - { - return shaNull; - } - - if (context->Computed) - { - context->Corrupted = shaStateError; - - return shaStateError; - } - - if (context->Corrupted) - { - return context->Corrupted; - } - while(length-- && !context->Corrupted) - { - context->Message_Block[context->Message_Block_Index++] = - (*message_array & 0xFF); - - context->Length_Low += 8; - if (context->Length_Low == 0) - { - context->Length_High++; - if (context->Length_High == 0) - { - /* Message is too long */ - context->Corrupted = 1; - } - } - - if (context->Message_Block_Index == 64) - { - SHA1ProcessMessageBlock(context); - } - - message_array++; - } - - return shaSuccess; -} - -/* - * SHA1ProcessMessageBlock - * - * Description: - * This function will process the next 512 bits of the message - * stored in the Message_Block array. - * - * Parameters: - * None. - * - * Returns: - * Nothing. - * - * Comments: - - * Many of the variable names in this code, especially the - * single character names, were used because those were the - * names used in the publication. - * - * - */ -void SHA1ProcessMessageBlock(SHA1Context *context) -{ - const uint32_t K[] = { /* Constants defined in SHA-1 */ - 0x5A827999, - 0x6ED9EBA1, - 0x8F1BBCDC, - 0xCA62C1D6 - }; - int t; /* Loop counter */ - uint32_t temp; /* Temporary word value */ - uint32_t W[80]; /* Word sequence */ - uint32_t A, B, C, D, E; /* Word buffers */ - - /* - * Initialize the first 16 words in the array W - */ - for(t = 0; t < 16; t++) - { - W[t] = context->Message_Block[t * 4] << 24; - W[t] |= context->Message_Block[t * 4 + 1] << 16; - W[t] |= context->Message_Block[t * 4 + 2] << 8; - W[t] |= context->Message_Block[t * 4 + 3]; - } - - for(t = 16; t < 80; t++) - { - W[t] = SHA1CircularShift(1,W[t-3] ^ W[t-8] ^ W[t-14] ^ W[t-16]); - } - - A = context->Intermediate_Hash[0]; - B = context->Intermediate_Hash[1]; - C = context->Intermediate_Hash[2]; - D = context->Intermediate_Hash[3]; - E = context->Intermediate_Hash[4]; - - for(t = 0; t < 20; t++) - { - temp = SHA1CircularShift(5,A) + - ((B & C) | ((~B) & D)) + E + W[t] + K[0]; - E = D; - D = C; - C = SHA1CircularShift(30,B); - - B = A; - A = temp; - } - - for(t = 20; t < 40; t++) - { - temp = SHA1CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[1]; - E = D; - D = C; - C = SHA1CircularShift(30,B); - B = A; - A = temp; - } - - for(t = 40; t < 60; t++) - { - temp = SHA1CircularShift(5,A) + - ((B & C) | (B & D) | (C & D)) + E + W[t] + K[2]; - E = D; - D = C; - C = SHA1CircularShift(30,B); - B = A; - A = temp; - } - - for(t = 60; t < 80; t++) - { - temp = SHA1CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[3]; - E = D; - D = C; - C = SHA1CircularShift(30,B); - B = A; - A = temp; - } - - context->Intermediate_Hash[0] += A; - context->Intermediate_Hash[1] += B; - context->Intermediate_Hash[2] += C; - context->Intermediate_Hash[3] += D; - context->Intermediate_Hash[4] += E; - - context->Message_Block_Index = 0; -} - -/* - * SHA1PadMessage - * - - * Description: - * According to the standard, the message must be padded to an even - * 512 bits. The first padding bit must be a '1'. The last 64 - * bits represent the length of the original message. All bits in - * between should be 0. This function will pad the message - * according to those rules by filling the Message_Block array - * accordingly. It will also call the ProcessMessageBlock function - * provided appropriately. When it returns, it can be assumed that - * the message digest has been computed. - * - * Parameters: - * context: [in/out] - * The context to pad - * ProcessMessageBlock: [in] - * The appropriate SHA*ProcessMessageBlock function - * Returns: - * Nothing. - * - */ - -void SHA1PadMessage(SHA1Context *context) -{ - /* - * Check to see if the current message block is too small to hold - * the initial padding bits and length. If so, we will pad the - * block, process it, and then continue padding into a second - * block. - */ - if (context->Message_Block_Index > 55) - { - context->Message_Block[context->Message_Block_Index++] = 0x80; - while(context->Message_Block_Index < 64) - { - context->Message_Block[context->Message_Block_Index++] = 0; - } - - SHA1ProcessMessageBlock(context); - - while(context->Message_Block_Index < 56) - { - context->Message_Block[context->Message_Block_Index++] = 0; - } - } - else - { - context->Message_Block[context->Message_Block_Index++] = 0x80; - while(context->Message_Block_Index < 56) - { - - context->Message_Block[context->Message_Block_Index++] = 0; - } - } - - /* - * Store the message length as the last 8 octets - */ - context->Message_Block[56] = context->Length_High >> 24; - context->Message_Block[57] = context->Length_High >> 16; - context->Message_Block[58] = context->Length_High >> 8; - context->Message_Block[59] = context->Length_High; - context->Message_Block[60] = context->Length_Low >> 24; - context->Message_Block[61] = context->Length_Low >> 16; - context->Message_Block[62] = context->Length_Low >> 8; - context->Message_Block[63] = context->Length_Low; - - SHA1ProcessMessageBlock(context); -} - -static const char alphabet[] = "0123456789ABCDEF"; - -void SHA1ConvertMessageToString(uint8_t *hash_binary, char* hash_string) -{ - for (int i = 0; i != SHA1HashSize; ++i) - { - hash_string[2*i] = alphabet[hash_binary[i] / 16]; - hash_string[2*i + 1] = alphabet[hash_binary[i] % 16]; - } - hash_string[SHA1HashSize * 2] = '\0'; -} diff --git a/cocos/platform/winrt/sha1.h b/cocos/platform/winrt/sha1.h deleted file mode 100644 index e00a028461cb..000000000000 --- a/cocos/platform/winrt/sha1.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * sha1.h - * Copyright (C) The Internet Society (2001). All Rights Reserved. - * This document and translations of it may be copied and furnished to others, - * and derivative works that comment on or otherwise explain it or assist in its - * implementation may be prepared, copied, published and distributed, in whole or in part, - * without restriction of any kind, provided that the above copyright notice and this paragraph - * are included on all such copies and derivative works. However, this document itself may not - * be modified in any way, such as by removing the copyright notice or references to the Internet Society - * or other Internet organizations, except as needed for the purpose of developing Internet standards in - * which case the procedures for copyrights defined in the Internet Standards process must be followed, - * or as required to translate it into languages other than English. - * - * The limited permissions granted above are perpetual and will not be revoked by the Internet Society or its successors or assigns. - * - * This document and the information contained herein is provided on an "AS IS" basis and - * THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, - * INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS - * OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * - * Description: - * This is the header file for code which implements the Secure - * Hashing Algorithm 1 as defined in FIPS PUB 180-1 published - * April 17, 1995. - * - * Many of the variable names in this code, especially the - * single character names, were used because those were the names - * used in the publication. - * - * Please read the file sha1.c for more information. - * - */ - -#ifndef _SHA1_H_ -#define _SHA1_H_ - -#include -/* - * If you do not have the ISO standard stdint.h header file, then you - * must typdef the following: - * name meaning - * uint32_t unsigned 32 bit integer - * uint8_t unsigned 8 bit integer (i.e., unsigned char) - * int_least16_t integer of >= 16 bits - * - */ - -#ifndef _SHA_enum_ -#define _SHA_enum_ -enum -{ - shaSuccess = 0, - shaNull, /* Null pointer parameter */ - shaInputTooLong, /* input data too long */ - shaStateError /* called Input after Result */ -}; -#endif -#define SHA1HashSize 20 - -/* - * This structure will hold context information for the SHA-1 - * hashing operation - */ -typedef struct SHA1Context -{ - uint32_t Intermediate_Hash[SHA1HashSize/4]; /* Message Digest */ - - uint32_t Length_Low; /* Message length in bits */ - uint32_t Length_High; /* Message length in bits */ - - /* Index into message block array */ - int_least16_t Message_Block_Index; - uint8_t Message_Block[64]; /* 512-bit message blocks */ - - int Computed; /* Is the digest computed? */ - int Corrupted; /* Is the message digest corrupted? */ -} SHA1Context; - -/* - * Function Prototypes - */ - -int SHA1Reset( SHA1Context *); -int SHA1Input( SHA1Context *, - const uint8_t *, - unsigned int); -int SHA1Result( SHA1Context *, - uint8_t Message_Digest[SHA1HashSize]); -void SHA1ConvertMessageToString(uint8_t *hash_binary, char* hash_string); - - -#endif diff --git a/cocos/platform/winrt/shaders/precompiledshaders.h b/cocos/platform/winrt/shaders/precompiledshaders.h deleted file mode 100644 index 6d39511d398c..000000000000 --- a/cocos/platform/winrt/shaders/precompiledshaders.h +++ /dev/null @@ -1,5456 +0,0 @@ -/**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - ****************************************************************************/ - -#define PRECOMPILED_SHADERS - -const unsigned char s_2140AC5CB6D3788EBF81062827FA30CB4E9DB1BA[] = { - -166, 147, 0, 0, 142, 9, 2, 1, - 0, 128, 0, 0, 82, 139, 0, 0, - 10, 0, 0, 0, 97, 95, 112, 111, -115, 105, 116, 105, 111, 110, 1, 0, - 0, 0, 82, 139, 0, 0, 7, 0, - 0, 0, 97, 95, 99, 111, 108, 111, -114, 0, 0, 0, 0, 80, 139, 0, - 0, 10, 0, 0, 0, 97, 95, 116, -101, 120, 67, 111, 111, 114, 100, 2, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 1, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 0, 0, 0, 0, - 2, 0, 0, 0, 92, 139, 0, 0, -242, 141, 0, 0, 10, 0, 0, 0, - 67, 67, 95, 80, 77, 97, 116, 114, -105, 120, 0, 0, 0, 0, 255, 255, -255, 255, 0, 0, 0, 0, 4, 0, - 0, 0, 94, 139, 0, 0, 0, 0, - 0, 0, 11, 0, 0, 0, 67, 67, - 95, 84, 101, 120, 116, 117, 114, 101, - 48, 0, 0, 0, 0, 0, 0, 0, - 0, 255, 255, 255, 255, 1, 0, 0, - 0, 2, 0, 0, 0, 10, 0, 0, - 0, 67, 67, 95, 80, 77, 97, 116, -114, 105, 120, 0, 0, 0, 0, 0, - 0, 0, 0, 11, 0, 0, 0, 67, - 67, 95, 84, 101, 120, 116, 117, 114, -101, 48, 0, 0, 0, 0, 1, 0, - 0, 0, 248, 3, 0, 0, 0, 5, - 0, 0, 0, 0, 0, 0, 185, 153, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 68, 88, - 66, 67, 11, 95, 74, 206, 145, 124, - 32, 219, 67, 19, 26, 23, 189, 75, - 35, 86, 1, 0, 0, 0, 248, 3, - 0, 0, 6, 0, 0, 0, 56, 0, - 0, 0, 228, 0, 0, 0, 244, 1, - 0, 0, 112, 2, 0, 0, 48, 3, - 0, 0, 124, 3, 0, 0, 65, 111, -110, 57, 164, 0, 0, 0, 164, 0, - 0, 0, 0, 2, 255, 255, 124, 0, - 0, 0, 40, 0, 0, 0, 0, 0, - 40, 0, 0, 0, 40, 0, 0, 0, - 40, 0, 1, 0, 36, 0, 0, 0, - 40, 0, 0, 0, 0, 0, 1, 2, -255, 255, 31, 0, 0, 2, 0, 0, - 0, 128, 0, 0, 15, 176, 31, 0, - 0, 2, 0, 0, 0, 128, 1, 0, - 3, 176, 31, 0, 0, 2, 0, 0, - 0, 144, 0, 8, 15, 160, 66, 0, - 0, 3, 0, 0, 15, 128, 1, 0, -228, 176, 0, 8, 228, 160, 5, 0, - 0, 3, 0, 0, 15, 128, 0, 0, -228, 128, 0, 0, 228, 176, 1, 0, - 0, 2, 0, 8, 15, 128, 0, 0, -228, 128, 1, 0, 0, 2, 1, 8, - 15, 128, 0, 0, 228, 128, 1, 0, - 0, 2, 2, 8, 15, 128, 0, 0, -228, 128, 1, 0, 0, 2, 3, 8, - 15, 128, 0, 0, 228, 128, 255, 255, - 0, 0, 83, 72, 68, 82, 8, 1, - 0, 0, 64, 0, 0, 0, 66, 0, - 0, 0, 90, 0, 0, 3, 0, 96, - 16, 0, 0, 0, 0, 0, 88, 24, - 0, 4, 0, 112, 16, 0, 0, 0, - 0, 0, 85, 85, 0, 0, 98, 16, - 0, 3, 242, 16, 16, 0, 0, 0, - 0, 0, 98, 16, 0, 3, 50, 16, - 16, 0, 1, 0, 0, 0, 101, 0, - 0, 3, 242, 32, 16, 0, 0, 0, - 0, 0, 101, 0, 0, 3, 242, 32, - 16, 0, 1, 0, 0, 0, 101, 0, - 0, 3, 242, 32, 16, 0, 2, 0, - 0, 0, 101, 0, 0, 3, 242, 32, - 16, 0, 3, 0, 0, 0, 104, 0, - 0, 2, 1, 0, 0, 0, 69, 0, - 0, 9, 242, 0, 16, 0, 0, 0, - 0, 0, 70, 16, 16, 0, 1, 0, - 0, 0, 70, 126, 16, 0, 0, 0, - 0, 0, 0, 96, 16, 0, 0, 0, - 0, 0, 56, 0, 0, 7, 242, 0, - 16, 0, 0, 0, 0, 0, 70, 14, - 16, 0, 0, 0, 0, 0, 70, 30, - 16, 0, 0, 0, 0, 0, 54, 0, - 0, 5, 242, 32, 16, 0, 0, 0, - 0, 0, 70, 14, 16, 0, 0, 0, - 0, 0, 54, 0, 0, 5, 242, 32, - 16, 0, 1, 0, 0, 0, 70, 14, - 16, 0, 0, 0, 0, 0, 54, 0, - 0, 5, 242, 32, 16, 0, 2, 0, - 0, 0, 70, 14, 16, 0, 0, 0, - 0, 0, 54, 0, 0, 5, 242, 32, - 16, 0, 3, 0, 0, 0, 70, 14, - 16, 0, 0, 0, 0, 0, 62, 0, - 0, 1, 83, 84, 65, 84, 116, 0, - 0, 0, 7, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 6, 0, - 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 4, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 82, 68, - 69, 70, 184, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 2, 0, - 0, 0, 28, 0, 0, 0, 0, 4, -255, 255, 0, 65, 0, 0, 134, 0, - 0, 0, 92, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, 1, 0, - 0, 0, 113, 0, 0, 0, 2, 0, - 0, 0, 5, 0, 0, 0, 4, 0, - 0, 0, 255, 255, 255, 255, 0, 0, - 0, 0, 1, 0, 0, 0, 13, 0, - 0, 0, 115, 97, 109, 112, 108, 101, -114, 95, 95, 67, 67, 95, 84, 101, -120, 116, 117, 114, 101, 48, 0, 116, -101, 120, 116, 117, 114, 101, 95, 95, - 67, 67, 95, 84, 101, 120, 116, 117, -114, 101, 48, 0, 77, 105, 99, 114, -111, 115, 111, 102, 116, 32, 40, 82, - 41, 32, 72, 76, 83, 76, 32, 83, -104, 97, 100, 101, 114, 32, 67, 111, -109, 112, 105, 108, 101, 114, 32, 54, - 46, 51, 46, 57, 54, 48, 48, 46, - 49, 54, 51, 56, 52, 0, 73, 83, - 71, 78, 68, 0, 0, 0, 2, 0, - 0, 0, 8, 0, 0, 0, 56, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, 0, 0, - 0, 0, 15, 15, 0, 0, 56, 0, - 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, 1, 0, - 0, 0, 3, 3, 0, 0, 84, 69, - 88, 67, 79, 79, 82, 68, 0, 171, -171, 171, 79, 83, 71, 78, 116, 0, - 0, 0, 4, 0, 0, 0, 8, 0, - 0, 0, 104, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, 15, 0, - 0, 0, 104, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 1, 0, 0, 0, 15, 0, - 0, 0, 104, 0, 0, 0, 2, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 2, 0, 0, 0, 15, 0, - 0, 0, 104, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 3, 0, 0, 0, 15, 0, - 0, 0, 83, 86, 95, 84, 97, 114, -103, 101, 116, 0, 171, 171, 68, 88, - 66, 67, 53, 89, 218, 251, 179, 193, -226, 187, 197, 89, 218, 37, 36, 176, -206, 80, 1, 0, 0, 0, 0, 5, - 0, 0, 6, 0, 0, 0, 56, 0, - 0, 0, 92, 1, 0, 0, 224, 2, - 0, 0, 92, 3, 0, 0, 44, 4, - 0, 0, 144, 4, 0, 0, 65, 111, -110, 57, 28, 1, 0, 0, 28, 1, - 0, 0, 0, 2, 254, 255, 232, 0, - 0, 0, 52, 0, 0, 0, 1, 0, - 36, 0, 0, 0, 48, 0, 0, 0, - 48, 0, 0, 0, 36, 0, 1, 0, - 48, 0, 0, 0, 0, 0, 4, 0, - 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 2, 254, 255, 81, 0, - 0, 5, 5, 0, 15, 160, 0, 0, - 0, 63, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 31, 0, - 0, 2, 5, 0, 0, 128, 0, 0, - 15, 144, 31, 0, 0, 2, 5, 0, - 1, 128, 1, 0, 15, 144, 31, 0, - 0, 2, 5, 0, 2, 128, 2, 0, - 15, 144, 9, 0, 0, 3, 0, 0, - 1, 128, 3, 0, 228, 160, 1, 0, -228, 144, 9, 0, 0, 3, 0, 0, - 2, 128, 4, 0, 228, 160, 1, 0, -228, 144, 2, 0, 0, 3, 0, 0, - 1, 128, 0, 0, 85, 128, 0, 0, - 0, 128, 5, 0, 0, 3, 0, 0, - 4, 192, 0, 0, 0, 128, 5, 0, - 0, 160, 9, 0, 0, 3, 0, 0, - 1, 128, 2, 0, 228, 160, 1, 0, -228, 144, 1, 0, 0, 2, 1, 0, - 2, 128, 0, 0, 0, 129, 9, 0, - 0, 3, 1, 0, 1, 128, 1, 0, -228, 160, 1, 0, 228, 144, 4, 0, - 0, 4, 0, 0, 3, 192, 0, 0, - 85, 128, 0, 0, 228, 160, 1, 0, -228, 128, 1, 0, 0, 2, 0, 0, - 8, 192, 0, 0, 85, 128, 1, 0, - 0, 2, 0, 0, 15, 224, 0, 0, -228, 144, 1, 0, 0, 2, 1, 0, - 3, 224, 2, 0, 228, 144, 255, 255, - 0, 0, 83, 72, 68, 82, 124, 1, - 0, 0, 64, 0, 1, 0, 95, 0, - 0, 0, 89, 0, 0, 4, 70, 142, - 32, 0, 0, 0, 0, 0, 4, 0, - 0, 0, 95, 0, 0, 3, 242, 16, - 16, 0, 0, 0, 0, 0, 95, 0, - 0, 3, 242, 16, 16, 0, 1, 0, - 0, 0, 95, 0, 0, 3, 50, 16, - 16, 0, 2, 0, 0, 0, 101, 0, - 0, 3, 242, 32, 16, 0, 0, 0, - 0, 0, 101, 0, 0, 3, 50, 32, - 16, 0, 1, 0, 0, 0, 103, 0, - 0, 4, 242, 32, 16, 0, 2, 0, - 0, 0, 1, 0, 0, 0, 104, 0, - 0, 2, 1, 0, 0, 0, 54, 0, - 0, 5, 242, 32, 16, 0, 0, 0, - 0, 0, 70, 30, 16, 0, 0, 0, - 0, 0, 54, 0, 0, 5, 50, 32, - 16, 0, 1, 0, 0, 0, 70, 16, - 16, 0, 2, 0, 0, 0, 17, 0, - 0, 8, 18, 0, 16, 0, 0, 0, - 0, 0, 70, 142, 32, 0, 0, 0, - 0, 0, 1, 0, 0, 0, 70, 30, - 16, 0, 1, 0, 0, 0, 54, 0, - 0, 6, 34, 32, 16, 0, 2, 0, - 0, 0, 10, 0, 16, 128, 65, 0, - 0, 0, 0, 0, 0, 0, 17, 0, - 0, 8, 18, 0, 16, 0, 0, 0, - 0, 0, 70, 142, 32, 0, 0, 0, - 0, 0, 2, 0, 0, 0, 70, 30, - 16, 0, 1, 0, 0, 0, 17, 0, - 0, 8, 34, 0, 16, 0, 0, 0, - 0, 0, 70, 142, 32, 0, 0, 0, - 0, 0, 3, 0, 0, 0, 70, 30, - 16, 0, 1, 0, 0, 0, 0, 0, - 0, 7, 18, 0, 16, 0, 0, 0, - 0, 0, 26, 0, 16, 0, 0, 0, - 0, 0, 10, 0, 16, 0, 0, 0, - 0, 0, 54, 0, 0, 5, 130, 32, - 16, 0, 2, 0, 0, 0, 26, 0, - 16, 0, 0, 0, 0, 0, 56, 0, - 0, 7, 66, 32, 16, 0, 2, 0, - 0, 0, 10, 0, 16, 0, 0, 0, - 0, 0, 1, 64, 0, 0, 0, 0, - 0, 63, 17, 0, 0, 8, 18, 32, - 16, 0, 2, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 70, 30, 16, 0, 1, 0, - 0, 0, 62, 0, 0, 1, 83, 84, - 65, 84, 116, 0, 0, 0, 11, 0, - 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 6, 0, 0, 0, 7, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 82, 68, 69, 70, 200, 0, - 0, 0, 1, 0, 0, 0, 72, 0, - 0, 0, 1, 0, 0, 0, 28, 0, - 0, 0, 0, 4, 254, 255, 0, 65, - 0, 0, 148, 0, 0, 0, 60, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 36, 71, -108, 111, 98, 97, 108, 115, 0, 171, -171, 171, 60, 0, 0, 0, 1, 0, - 0, 0, 96, 0, 0, 0, 64, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 120, 0, 0, 0, 0, 0, - 0, 0, 64, 0, 0, 0, 2, 0, - 0, 0, 132, 0, 0, 0, 0, 0, - 0, 0, 95, 67, 67, 95, 80, 77, - 97, 116, 114, 105, 120, 0, 3, 0, - 3, 0, 4, 0, 4, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 77, 105, - 99, 114, 111, 115, 111, 102, 116, 32, - 40, 82, 41, 32, 72, 76, 83, 76, - 32, 83, 104, 97, 100, 101, 114, 32, - 67, 111, 109, 112, 105, 108, 101, 114, - 32, 54, 46, 51, 46, 57, 54, 48, - 48, 46, 49, 54, 51, 56, 52, 0, -171, 171, 73, 83, 71, 78, 92, 0, - 0, 0, 3, 0, 0, 0, 8, 0, - 0, 0, 80, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, 15, 15, - 0, 0, 80, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 1, 0, 0, 0, 15, 15, - 0, 0, 80, 0, 0, 0, 2, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 2, 0, 0, 0, 3, 3, - 0, 0, 84, 69, 88, 67, 79, 79, - 82, 68, 0, 171, 171, 171, 79, 83, - 71, 78, 104, 0, 0, 0, 3, 0, - 0, 0, 8, 0, 0, 0, 80, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, 0, 0, - 0, 0, 15, 0, 0, 0, 80, 0, - 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, 1, 0, - 0, 0, 3, 12, 0, 0, 89, 0, - 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 3, 0, 0, 0, 2, 0, - 0, 0, 15, 0, 0, 0, 84, 69, - 88, 67, 79, 79, 82, 68, 0, 83, - 86, 95, 80, 111, 115, 105, 116, 105, -111, 110, 0, 171, 171, 171, -}; - -const unsigned char s_42003E3EDB1E484A842EB95165D48A439ED6AAE8[] = { - -166, 147, 0, 0, 142, 9, 2, 1, - 0, 128, 0, 0, 82, 139, 0, 0, - 10, 0, 0, 0, 97, 95, 112, 111, -115, 105, 116, 105, 111, 110, 1, 0, - 0, 0, 82, 139, 0, 0, 7, 0, - 0, 0, 97, 95, 99, 111, 108, 111, -114, 0, 0, 0, 0, 80, 139, 0, - 0, 10, 0, 0, 0, 97, 95, 116, -101, 120, 67, 111, 111, 114, 100, 2, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 1, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 0, 0, 0, 0, - 3, 0, 0, 0, 92, 139, 0, 0, -242, 141, 0, 0, 12, 0, 0, 0, - 67, 67, 95, 77, 86, 80, 77, 97, -116, 114, 105, 120, 0, 0, 0, 0, -255, 255, 255, 255, 0, 0, 0, 0, - 4, 0, 0, 0, 94, 139, 0, 0, - 0, 0, 0, 0, 11, 0, 0, 0, - 67, 67, 95, 84, 101, 120, 116, 117, -114, 101, 48, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 1, - 0, 0, 0, 81, 139, 0, 0, 240, -141, 0, 0, 13, 0, 0, 0, 118, - 95, 101, 102, 102, 101, 99, 116, 67, -111, 108, 111, 114, 0, 0, 0, 0, - 0, 0, 0, 0, 255, 255, 255, 255, - 1, 0, 0, 0, 3, 0, 0, 0, - 12, 0, 0, 0, 67, 67, 95, 77, - 86, 80, 77, 97, 116, 114, 105, 120, - 0, 0, 0, 0, 0, 0, 0, 0, - 11, 0, 0, 0, 67, 67, 95, 84, -101, 120, 116, 117, 114, 101, 48, 0, - 0, 0, 0, 1, 0, 0, 0, 13, - 0, 0, 0, 118, 95, 101, 102, 102, -101, 99, 116, 67, 111, 108, 111, 114, - 0, 0, 0, 0, 2, 0, 0, 0, - 44, 7, 0, 0, 4, 5, 0, 0, - 0, 0, 0, 0, 185, 153, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 68, 88, 66, 67, -106, 137, 150, 242, 70, 59, 121, 115, - 1, 56, 143, 240, 248, 24, 67, 104, - 1, 0, 0, 0, 44, 7, 0, 0, - 6, 0, 0, 0, 56, 0, 0, 0, -244, 1, 0, 0, 172, 4, 0, 0, - 40, 5, 0, 0, 100, 6, 0, 0, -176, 6, 0, 0, 65, 111, 110, 57, -180, 1, 0, 0, 180, 1, 0, 0, - 0, 2, 255, 255, 128, 1, 0, 0, - 52, 0, 0, 0, 1, 0, 40, 0, - 0, 0, 52, 0, 0, 0, 52, 0, - 1, 0, 36, 0, 0, 0, 52, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, - 1, 2, 255, 255, 81, 0, 0, 5, - 1, 0, 15, 160, 31, 133, 235, 190, -254, 255, 71, 65, 0, 0, 0, 192, - 0, 0, 64, 64, 81, 0, 0, 5, - 2, 0, 15, 160, 0, 0, 0, 191, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 31, 0, 0, 2, - 0, 0, 0, 128, 0, 0, 15, 176, - 31, 0, 0, 2, 0, 0, 0, 128, - 1, 0, 3, 176, 31, 0, 0, 2, - 0, 0, 0, 144, 0, 8, 15, 160, - 66, 0, 0, 3, 0, 0, 15, 128, - 1, 0, 228, 176, 0, 8, 228, 160, - 7, 0, 0, 2, 0, 0, 1, 128, - 0, 0, 255, 128, 2, 0, 0, 3, - 0, 0, 2, 128, 0, 0, 255, 128, - 1, 0, 0, 160, 5, 0, 0, 3, - 0, 0, 18, 128, 0, 0, 85, 128, - 1, 0, 85, 160, 6, 0, 0, 2, - 0, 0, 1, 128, 0, 0, 0, 128, - 2, 0, 0, 3, 0, 0, 1, 128, - 0, 0, 0, 128, 2, 0, 0, 160, - 2, 0, 0, 3, 0, 0, 17, 128, - 0, 0, 0, 128, 0, 0, 0, 128, - 4, 0, 0, 4, 0, 0, 4, 128, - 0, 0, 0, 128, 1, 0, 170, 160, - 1, 0, 255, 160, 5, 0, 0, 3, - 0, 0, 1, 128, 0, 0, 0, 128, - 0, 0, 0, 128, 5, 0, 0, 3, - 0, 0, 1, 128, 0, 0, 0, 128, - 0, 0, 170, 128, 4, 0, 0, 4, - 0, 0, 4, 128, 0, 0, 85, 128, - 1, 0, 170, 160, 1, 0, 255, 160, - 5, 0, 0, 3, 0, 0, 2, 128, - 0, 0, 85, 128, 0, 0, 85, 128, - 5, 0, 0, 3, 0, 0, 2, 128, - 0, 0, 85, 128, 0, 0, 170, 128, - 11, 0, 0, 3, 1, 0, 8, 128, - 0, 0, 85, 128, 0, 0, 0, 128, - 18, 0, 0, 4, 1, 0, 7, 128, - 0, 0, 85, 128, 0, 0, 228, 176, - 0, 0, 228, 160, 1, 0, 0, 2, - 0, 8, 15, 128, 1, 0, 228, 128, - 1, 0, 0, 2, 1, 8, 15, 128, - 1, 0, 228, 128, 1, 0, 0, 2, - 2, 8, 15, 128, 1, 0, 228, 128, - 1, 0, 0, 2, 3, 8, 15, 128, - 1, 0, 228, 128, 255, 255, 0, 0, - 83, 72, 68, 82, 176, 2, 0, 0, - 64, 0, 0, 0, 172, 0, 0, 0, - 89, 0, 0, 4, 70, 142, 32, 0, - 0, 0, 0, 0, 1, 0, 0, 0, - 90, 0, 0, 3, 0, 96, 16, 0, - 0, 0, 0, 0, 88, 24, 0, 4, - 0, 112, 16, 0, 0, 0, 0, 0, - 85, 85, 0, 0, 98, 16, 0, 3, -114, 16, 16, 0, 0, 0, 0, 0, - 98, 16, 0, 3, 50, 16, 16, 0, - 1, 0, 0, 0, 101, 0, 0, 3, -242, 32, 16, 0, 0, 0, 0, 0, -101, 0, 0, 3, 242, 32, 16, 0, - 1, 0, 0, 0, 101, 0, 0, 3, -242, 32, 16, 0, 2, 0, 0, 0, -101, 0, 0, 3, 242, 32, 16, 0, - 3, 0, 0, 0, 104, 0, 0, 2, - 2, 0, 0, 0, 69, 0, 0, 9, -242, 0, 16, 0, 0, 0, 0, 0, - 70, 16, 16, 0, 1, 0, 0, 0, - 70, 126, 16, 0, 0, 0, 0, 0, - 0, 96, 16, 0, 0, 0, 0, 0, - 75, 0, 0, 5, 18, 0, 16, 0, - 0, 0, 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 0, 0, 0, 10, - 50, 0, 16, 0, 0, 0, 0, 0, -198, 0, 16, 0, 0, 0, 0, 0, - 2, 64, 0, 0, 0, 0, 0, 191, - 31, 133, 235, 190, 0, 0, 0, 0, - 0, 0, 0, 0, 56, 32, 0, 7, - 34, 0, 16, 0, 0, 0, 0, 0, - 26, 0, 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 254, 255, 71, 65, - 0, 32, 0, 7, 18, 0, 16, 0, - 0, 0, 0, 0, 10, 0, 16, 0, - 0, 0, 0, 0, 10, 0, 16, 0, - 0, 0, 0, 0, 50, 0, 0, 9, - 66, 0, 16, 0, 0, 0, 0, 0, - 10, 0, 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 0, 0, 0, 192, - 1, 64, 0, 0, 0, 0, 64, 64, - 56, 0, 0, 7, 18, 0, 16, 0, - 0, 0, 0, 0, 10, 0, 16, 0, - 0, 0, 0, 0, 10, 0, 16, 0, - 0, 0, 0, 0, 56, 0, 0, 7, - 18, 0, 16, 0, 0, 0, 0, 0, - 10, 0, 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 0, 0, 0, 0, - 50, 0, 0, 9, 66, 0, 16, 0, - 0, 0, 0, 0, 26, 0, 16, 0, - 0, 0, 0, 0, 1, 64, 0, 0, - 0, 0, 0, 192, 1, 64, 0, 0, - 0, 0, 64, 64, 56, 0, 0, 7, - 34, 0, 16, 0, 0, 0, 0, 0, - 26, 0, 16, 0, 0, 0, 0, 0, - 26, 0, 16, 0, 0, 0, 0, 0, - 56, 0, 0, 7, 130, 0, 16, 0, - 0, 0, 0, 0, 26, 0, 16, 0, - 0, 0, 0, 0, 42, 0, 16, 0, - 0, 0, 0, 0, 50, 0, 0, 10, - 34, 0, 16, 0, 0, 0, 0, 0, - 42, 0, 16, 128, 65, 0, 0, 0, - 0, 0, 0, 0, 26, 0, 16, 0, - 0, 0, 0, 0, 1, 64, 0, 0, - 0, 0, 128, 63, 52, 0, 0, 7, -130, 0, 16, 0, 1, 0, 0, 0, - 10, 0, 16, 0, 0, 0, 0, 0, - 58, 0, 16, 0, 0, 0, 0, 0, - 56, 0, 0, 7, 210, 0, 16, 0, - 0, 0, 0, 0, 246, 15, 16, 0, - 0, 0, 0, 0, 6, 25, 16, 0, - 0, 0, 0, 0, 50, 0, 0, 10, -114, 0, 16, 0, 1, 0, 0, 0, - 70, 130, 32, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 86, 5, 16, 0, - 0, 0, 0, 0, 134, 3, 16, 0, - 0, 0, 0, 0, 54, 0, 0, 5, -242, 32, 16, 0, 0, 0, 0, 0, - 70, 14, 16, 0, 1, 0, 0, 0, - 54, 0, 0, 5, 242, 32, 16, 0, - 1, 0, 0, 0, 70, 14, 16, 0, - 1, 0, 0, 0, 54, 0, 0, 5, -242, 32, 16, 0, 2, 0, 0, 0, - 70, 14, 16, 0, 1, 0, 0, 0, - 54, 0, 0, 5, 242, 32, 16, 0, - 3, 0, 0, 0, 70, 14, 16, 0, - 1, 0, 0, 0, 62, 0, 0, 1, - 83, 84, 65, 84, 116, 0, 0, 0, - 20, 0, 0, 0, 2, 0, 0, 0, - 0, 0, 0, 0, 6, 0, 0, 0, - 14, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 4, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 82, 68, 69, 70, - 52, 1, 0, 0, 1, 0, 0, 0, -176, 0, 0, 0, 3, 0, 0, 0, - 28, 0, 0, 0, 0, 4, 255, 255, - 0, 65, 0, 0, 0, 1, 0, 0, -124, 0, 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 1, 0, 0, 0, -145, 0, 0, 0, 2, 0, 0, 0, - 5, 0, 0, 0, 4, 0, 0, 0, -255, 255, 255, 255, 0, 0, 0, 0, - 1, 0, 0, 0, 13, 0, 0, 0, -166, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, -115, 97, 109, 112, 108, 101, 114, 95, - 95, 67, 67, 95, 84, 101, 120, 116, -117, 114, 101, 48, 0, 116, 101, 120, -116, 117, 114, 101, 95, 95, 67, 67, - 95, 84, 101, 120, 116, 117, 114, 101, - 48, 0, 36, 71, 108, 111, 98, 97, -108, 115, 0, 171, 166, 0, 0, 0, - 1, 0, 0, 0, 200, 0, 0, 0, - 16, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 224, 0, 0, 0, - 0, 0, 0, 0, 12, 0, 0, 0, - 2, 0, 0, 0, 240, 0, 0, 0, - 0, 0, 0, 0, 95, 118, 95, 101, -102, 102, 101, 99, 116, 67, 111, 108, -111, 114, 0, 171, 1, 0, 3, 0, - 1, 0, 3, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 77, 105, 99, 114, -111, 115, 111, 102, 116, 32, 40, 82, - 41, 32, 72, 76, 83, 76, 32, 83, -104, 97, 100, 101, 114, 32, 67, 111, -109, 112, 105, 108, 101, 114, 32, 54, - 46, 51, 46, 57, 54, 48, 48, 46, - 49, 54, 51, 56, 52, 0, 171, 171, - 73, 83, 71, 78, 68, 0, 0, 0, - 2, 0, 0, 0, 8, 0, 0, 0, - 56, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 15, 7, 0, 0, - 56, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 3, 0, 0, 0, - 1, 0, 0, 0, 3, 3, 0, 0, - 84, 69, 88, 67, 79, 79, 82, 68, - 0, 171, 171, 171, 79, 83, 71, 78, -116, 0, 0, 0, 4, 0, 0, 0, - 8, 0, 0, 0, 104, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 0, 0, 0, 0, - 15, 0, 0, 0, 104, 0, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 1, 0, 0, 0, - 15, 0, 0, 0, 104, 0, 0, 0, - 2, 0, 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 2, 0, 0, 0, - 15, 0, 0, 0, 104, 0, 0, 0, - 3, 0, 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 3, 0, 0, 0, - 15, 0, 0, 0, 83, 86, 95, 84, - 97, 114, 103, 101, 116, 0, 171, 171, - 68, 88, 66, 67, 235, 56, 180, 223, -125, 231, 231, 218, 70, 75, 12, 63, -200, 233, 69, 121, 1, 0, 0, 0, - 4, 5, 0, 0, 6, 0, 0, 0, - 56, 0, 0, 0, 92, 1, 0, 0, -224, 2, 0, 0, 92, 3, 0, 0, - 48, 4, 0, 0, 148, 4, 0, 0, - 65, 111, 110, 57, 28, 1, 0, 0, - 28, 1, 0, 0, 0, 2, 254, 255, -232, 0, 0, 0, 52, 0, 0, 0, - 1, 0, 36, 0, 0, 0, 48, 0, - 0, 0, 48, 0, 0, 0, 36, 0, - 1, 0, 48, 0, 0, 0, 0, 0, - 4, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 2, 254, 255, - 81, 0, 0, 5, 5, 0, 15, 160, - 0, 0, 0, 63, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 31, 0, 0, 2, 5, 0, 0, 128, - 0, 0, 15, 144, 31, 0, 0, 2, - 5, 0, 1, 128, 1, 0, 15, 144, - 31, 0, 0, 2, 5, 0, 2, 128, - 2, 0, 15, 144, 9, 0, 0, 3, - 0, 0, 1, 128, 3, 0, 228, 160, - 1, 0, 228, 144, 9, 0, 0, 3, - 0, 0, 2, 128, 4, 0, 228, 160, - 1, 0, 228, 144, 2, 0, 0, 3, - 0, 0, 1, 128, 0, 0, 85, 128, - 0, 0, 0, 128, 5, 0, 0, 3, - 0, 0, 4, 192, 0, 0, 0, 128, - 5, 0, 0, 160, 9, 0, 0, 3, - 0, 0, 1, 128, 2, 0, 228, 160, - 1, 0, 228, 144, 1, 0, 0, 2, - 1, 0, 2, 128, 0, 0, 0, 129, - 9, 0, 0, 3, 1, 0, 1, 128, - 1, 0, 228, 160, 1, 0, 228, 144, - 4, 0, 0, 4, 0, 0, 3, 192, - 0, 0, 85, 128, 0, 0, 228, 160, - 1, 0, 228, 128, 1, 0, 0, 2, - 0, 0, 8, 192, 0, 0, 85, 128, - 1, 0, 0, 2, 0, 0, 15, 224, - 0, 0, 228, 144, 1, 0, 0, 2, - 1, 0, 3, 224, 2, 0, 228, 144, -255, 255, 0, 0, 83, 72, 68, 82, -124, 1, 0, 0, 64, 0, 1, 0, - 95, 0, 0, 0, 89, 0, 0, 4, - 70, 142, 32, 0, 0, 0, 0, 0, - 4, 0, 0, 0, 95, 0, 0, 3, -242, 16, 16, 0, 0, 0, 0, 0, - 95, 0, 0, 3, 242, 16, 16, 0, - 1, 0, 0, 0, 95, 0, 0, 3, - 50, 16, 16, 0, 2, 0, 0, 0, -101, 0, 0, 3, 242, 32, 16, 0, - 0, 0, 0, 0, 101, 0, 0, 3, - 50, 32, 16, 0, 1, 0, 0, 0, -103, 0, 0, 4, 242, 32, 16, 0, - 2, 0, 0, 0, 1, 0, 0, 0, -104, 0, 0, 2, 1, 0, 0, 0, - 54, 0, 0, 5, 242, 32, 16, 0, - 0, 0, 0, 0, 70, 30, 16, 0, - 0, 0, 0, 0, 54, 0, 0, 5, - 50, 32, 16, 0, 1, 0, 0, 0, - 70, 16, 16, 0, 2, 0, 0, 0, - 17, 0, 0, 8, 18, 0, 16, 0, - 0, 0, 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 1, 0, 0, 0, - 70, 30, 16, 0, 1, 0, 0, 0, - 54, 0, 0, 6, 34, 32, 16, 0, - 2, 0, 0, 0, 10, 0, 16, 128, - 65, 0, 0, 0, 0, 0, 0, 0, - 17, 0, 0, 8, 18, 0, 16, 0, - 0, 0, 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 2, 0, 0, 0, - 70, 30, 16, 0, 1, 0, 0, 0, - 17, 0, 0, 8, 34, 0, 16, 0, - 0, 0, 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 3, 0, 0, 0, - 70, 30, 16, 0, 1, 0, 0, 0, - 0, 0, 0, 7, 18, 0, 16, 0, - 0, 0, 0, 0, 26, 0, 16, 0, - 0, 0, 0, 0, 10, 0, 16, 0, - 0, 0, 0, 0, 54, 0, 0, 5, -130, 32, 16, 0, 2, 0, 0, 0, - 26, 0, 16, 0, 0, 0, 0, 0, - 56, 0, 0, 7, 66, 32, 16, 0, - 2, 0, 0, 0, 10, 0, 16, 0, - 0, 0, 0, 0, 1, 64, 0, 0, - 0, 0, 0, 63, 17, 0, 0, 8, - 18, 32, 16, 0, 2, 0, 0, 0, - 70, 142, 32, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 70, 30, 16, 0, - 1, 0, 0, 0, 62, 0, 0, 1, - 83, 84, 65, 84, 116, 0, 0, 0, - 11, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 6, 0, 0, 0, - 7, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 82, 68, 69, 70, -204, 0, 0, 0, 1, 0, 0, 0, - 72, 0, 0, 0, 1, 0, 0, 0, - 28, 0, 0, 0, 0, 4, 254, 255, - 0, 65, 0, 0, 152, 0, 0, 0, - 60, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, - 36, 71, 108, 111, 98, 97, 108, 115, - 0, 171, 171, 171, 60, 0, 0, 0, - 1, 0, 0, 0, 96, 0, 0, 0, - 64, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 120, 0, 0, 0, - 0, 0, 0, 0, 64, 0, 0, 0, - 2, 0, 0, 0, 136, 0, 0, 0, - 0, 0, 0, 0, 95, 67, 67, 95, - 77, 86, 80, 77, 97, 116, 114, 105, -120, 0, 171, 171, 3, 0, 3, 0, - 4, 0, 4, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 77, 105, 99, 114, -111, 115, 111, 102, 116, 32, 40, 82, - 41, 32, 72, 76, 83, 76, 32, 83, -104, 97, 100, 101, 114, 32, 67, 111, -109, 112, 105, 108, 101, 114, 32, 54, - 46, 51, 46, 57, 54, 48, 48, 46, - 49, 54, 51, 56, 52, 0, 171, 171, - 73, 83, 71, 78, 92, 0, 0, 0, - 3, 0, 0, 0, 8, 0, 0, 0, - 80, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 15, 15, 0, 0, - 80, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 3, 0, 0, 0, - 1, 0, 0, 0, 15, 15, 0, 0, - 80, 0, 0, 0, 2, 0, 0, 0, - 0, 0, 0, 0, 3, 0, 0, 0, - 2, 0, 0, 0, 3, 3, 0, 0, - 84, 69, 88, 67, 79, 79, 82, 68, - 0, 171, 171, 171, 79, 83, 71, 78, -104, 0, 0, 0, 3, 0, 0, 0, - 8, 0, 0, 0, 80, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 0, 0, 0, 0, - 15, 0, 0, 0, 80, 0, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 1, 0, 0, 0, - 3, 12, 0, 0, 89, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 0, - 3, 0, 0, 0, 2, 0, 0, 0, - 15, 0, 0, 0, 84, 69, 88, 67, - 79, 79, 82, 68, 0, 83, 86, 95, - 80, 111, 115, 105, 116, 105, 111, 110, - 0, 171, 171, 171, -}; - -const unsigned char s_5132957B676AE174BDF34524AE4A80338F866279[] = { - -166, 147, 0, 0, 142, 9, 2, 1, - 0, 128, 0, 0, 82, 139, 0, 0, - 10, 0, 0, 0, 97, 95, 112, 111, -115, 105, 116, 105, 111, 110, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 255, 255, 255, 255, 80, 139, - 0, 0, 10, 0, 0, 0, 97, 95, -116, 101, 120, 67, 111, 111, 114, 100, - 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 255, 255, 255, 255, - 0, 0, 0, 0, 0, 0, 0, 0, -255, 255, 255, 255, 0, 0, 0, 0, - 0, 0, 0, 0, 255, 255, 255, 255, - 0, 0, 0, 0, 0, 0, 0, 0, -255, 255, 255, 255, 0, 0, 0, 0, - 0, 0, 0, 0, 255, 255, 255, 255, - 0, 0, 0, 0, 0, 0, 0, 0, -255, 255, 255, 255, 0, 0, 0, 0, - 0, 0, 0, 0, 255, 255, 255, 255, - 0, 0, 0, 0, 0, 0, 0, 0, -255, 255, 255, 255, 0, 0, 0, 0, - 0, 0, 0, 0, 255, 255, 255, 255, - 0, 0, 0, 0, 0, 0, 0, 0, -255, 255, 255, 255, 0, 0, 0, 0, - 0, 0, 0, 0, 255, 255, 255, 255, - 0, 0, 0, 0, 0, 0, 0, 0, -255, 255, 255, 255, 0, 0, 0, 0, - 0, 0, 0, 0, 255, 255, 255, 255, - 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 0, - 0, 2, 0, 0, 0, 92, 139, 0, - 0, 242, 141, 0, 0, 12, 0, 0, - 0, 67, 67, 95, 77, 86, 80, 77, - 97, 116, 114, 105, 120, 0, 0, 0, - 0, 255, 255, 255, 255, 0, 0, 0, - 0, 4, 0, 0, 0, 94, 139, 0, - 0, 0, 0, 0, 0, 11, 0, 0, - 0, 67, 67, 95, 84, 101, 120, 116, -117, 114, 101, 48, 0, 0, 0, 0, - 0, 0, 0, 0, 255, 255, 255, 255, - 1, 0, 0, 0, 2, 0, 0, 0, - 12, 0, 0, 0, 67, 67, 95, 77, - 86, 80, 77, 97, 116, 114, 105, 120, - 0, 0, 0, 0, 0, 0, 0, 0, - 11, 0, 0, 0, 67, 67, 95, 84, -101, 120, 116, 117, 114, 101, 48, 0, - 0, 0, 0, 1, 0, 0, 0, 156, - 3, 0, 0, 144, 4, 0, 0, 0, - 0, 0, 0, 185, 153, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 68, 88, 66, 67, 203, -117, 183, 110, 154, 52, 220, 70, 125, -228, 9, 112, 112, 45, 175, 213, 1, - 0, 0, 0, 156, 3, 0, 0, 6, - 0, 0, 0, 56, 0, 0, 0, 200, - 0, 0, 0, 176, 1, 0, 0, 44, - 2, 0, 0, 236, 2, 0, 0, 32, - 3, 0, 0, 65, 111, 110, 57, 136, - 0, 0, 0, 136, 0, 0, 0, 0, - 2, 255, 255, 96, 0, 0, 0, 40, - 0, 0, 0, 0, 0, 40, 0, 0, - 0, 40, 0, 0, 0, 40, 0, 1, - 0, 36, 0, 0, 0, 40, 0, 0, - 0, 0, 0, 1, 2, 255, 255, 31, - 0, 0, 2, 0, 0, 0, 128, 0, - 0, 3, 176, 31, 0, 0, 2, 0, - 0, 0, 144, 0, 8, 15, 160, 66, - 0, 0, 3, 0, 0, 15, 128, 0, - 0, 228, 176, 0, 8, 228, 160, 1, - 0, 0, 2, 0, 8, 15, 128, 0, - 0, 228, 128, 1, 0, 0, 2, 1, - 8, 15, 128, 0, 0, 228, 128, 1, - 0, 0, 2, 2, 8, 15, 128, 0, - 0, 228, 128, 1, 0, 0, 2, 3, - 8, 15, 128, 0, 0, 228, 128, 255, -255, 0, 0, 83, 72, 68, 82, 224, - 0, 0, 0, 64, 0, 0, 0, 56, - 0, 0, 0, 90, 0, 0, 3, 0, - 96, 16, 0, 0, 0, 0, 0, 88, - 24, 0, 4, 0, 112, 16, 0, 0, - 0, 0, 0, 85, 85, 0, 0, 98, - 16, 0, 3, 50, 16, 16, 0, 0, - 0, 0, 0, 101, 0, 0, 3, 242, - 32, 16, 0, 0, 0, 0, 0, 101, - 0, 0, 3, 242, 32, 16, 0, 1, - 0, 0, 0, 101, 0, 0, 3, 242, - 32, 16, 0, 2, 0, 0, 0, 101, - 0, 0, 3, 242, 32, 16, 0, 3, - 0, 0, 0, 104, 0, 0, 2, 1, - 0, 0, 0, 69, 0, 0, 9, 242, - 0, 16, 0, 0, 0, 0, 0, 70, - 16, 16, 0, 0, 0, 0, 0, 70, -126, 16, 0, 0, 0, 0, 0, 0, - 96, 16, 0, 0, 0, 0, 0, 54, - 0, 0, 5, 242, 32, 16, 0, 0, - 0, 0, 0, 70, 14, 16, 0, 0, - 0, 0, 0, 54, 0, 0, 5, 242, - 32, 16, 0, 1, 0, 0, 0, 70, - 14, 16, 0, 0, 0, 0, 0, 54, - 0, 0, 5, 242, 32, 16, 0, 2, - 0, 0, 0, 70, 14, 16, 0, 0, - 0, 0, 0, 54, 0, 0, 5, 242, - 32, 16, 0, 3, 0, 0, 0, 70, - 14, 16, 0, 0, 0, 0, 0, 62, - 0, 0, 1, 83, 84, 65, 84, 116, - 0, 0, 0, 6, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 5, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 4, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 82, - 68, 69, 70, 184, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 2, - 0, 0, 0, 28, 0, 0, 0, 0, - 4, 255, 255, 0, 65, 0, 0, 134, - 0, 0, 0, 92, 0, 0, 0, 3, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 0, 0, 0, 1, - 0, 0, 0, 113, 0, 0, 0, 2, - 0, 0, 0, 5, 0, 0, 0, 4, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 1, 0, 0, 0, 13, - 0, 0, 0, 115, 97, 109, 112, 108, -101, 114, 95, 95, 67, 67, 95, 84, -101, 120, 116, 117, 114, 101, 48, 0, -116, 101, 120, 116, 117, 114, 101, 95, - 95, 67, 67, 95, 84, 101, 120, 116, -117, 114, 101, 48, 0, 77, 105, 99, -114, 111, 115, 111, 102, 116, 32, 40, - 82, 41, 32, 72, 76, 83, 76, 32, - 83, 104, 97, 100, 101, 114, 32, 67, -111, 109, 112, 105, 108, 101, 114, 32, - 54, 46, 51, 46, 57, 54, 48, 48, - 46, 49, 54, 51, 56, 52, 0, 73, - 83, 71, 78, 44, 0, 0, 0, 1, - 0, 0, 0, 8, 0, 0, 0, 32, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 3, 0, 0, 0, 0, - 0, 0, 0, 3, 3, 0, 0, 84, - 69, 88, 67, 79, 79, 82, 68, 0, -171, 171, 171, 79, 83, 71, 78, 116, - 0, 0, 0, 4, 0, 0, 0, 8, - 0, 0, 0, 104, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 3, - 0, 0, 0, 0, 0, 0, 0, 15, - 0, 0, 0, 104, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 3, - 0, 0, 0, 1, 0, 0, 0, 15, - 0, 0, 0, 104, 0, 0, 0, 2, - 0, 0, 0, 0, 0, 0, 0, 3, - 0, 0, 0, 2, 0, 0, 0, 15, - 0, 0, 0, 104, 0, 0, 0, 3, - 0, 0, 0, 0, 0, 0, 0, 3, - 0, 0, 0, 3, 0, 0, 0, 15, - 0, 0, 0, 83, 86, 95, 84, 97, -114, 103, 101, 116, 0, 171, 171, 68, - 88, 66, 67, 110, 14, 140, 120, 239, -110, 56, 78, 103, 37, 245, 162, 140, -151, 93, 223, 1, 0, 0, 0, 144, - 4, 0, 0, 6, 0, 0, 0, 56, - 0, 0, 0, 68, 1, 0, 0, 156, - 2, 0, 0, 24, 3, 0, 0, 236, - 3, 0, 0, 56, 4, 0, 0, 65, -111, 110, 57, 4, 1, 0, 0, 4, - 1, 0, 0, 0, 2, 254, 255, 208, - 0, 0, 0, 52, 0, 0, 0, 1, - 0, 36, 0, 0, 0, 48, 0, 0, - 0, 48, 0, 0, 0, 36, 0, 1, - 0, 48, 0, 0, 0, 0, 0, 4, - 0, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 2, 254, 255, 81, - 0, 0, 5, 5, 0, 15, 160, 0, - 0, 0, 63, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 31, - 0, 0, 2, 5, 0, 0, 128, 0, - 0, 15, 144, 31, 0, 0, 2, 5, - 0, 1, 128, 1, 0, 15, 144, 9, - 0, 0, 3, 0, 0, 1, 128, 3, - 0, 228, 160, 0, 0, 228, 144, 9, - 0, 0, 3, 0, 0, 2, 128, 4, - 0, 228, 160, 0, 0, 228, 144, 2, - 0, 0, 3, 0, 0, 1, 128, 0, - 0, 85, 128, 0, 0, 0, 128, 5, - 0, 0, 3, 0, 0, 4, 192, 0, - 0, 0, 128, 5, 0, 0, 160, 9, - 0, 0, 3, 0, 0, 1, 128, 2, - 0, 228, 160, 0, 0, 228, 144, 1, - 0, 0, 2, 1, 0, 2, 128, 0, - 0, 0, 129, 9, 0, 0, 3, 1, - 0, 1, 128, 1, 0, 228, 160, 0, - 0, 228, 144, 4, 0, 0, 4, 0, - 0, 3, 192, 0, 0, 85, 128, 0, - 0, 228, 160, 1, 0, 228, 128, 1, - 0, 0, 2, 0, 0, 8, 192, 0, - 0, 85, 128, 1, 0, 0, 2, 0, - 0, 3, 224, 1, 0, 228, 144, 255, -255, 0, 0, 83, 72, 68, 82, 80, - 1, 0, 0, 64, 0, 1, 0, 84, - 0, 0, 0, 89, 0, 0, 4, 70, -142, 32, 0, 0, 0, 0, 0, 4, - 0, 0, 0, 95, 0, 0, 3, 242, - 16, 16, 0, 0, 0, 0, 0, 95, - 0, 0, 3, 50, 16, 16, 0, 1, - 0, 0, 0, 101, 0, 0, 3, 50, - 32, 16, 0, 0, 0, 0, 0, 103, - 0, 0, 4, 242, 32, 16, 0, 1, - 0, 0, 0, 1, 0, 0, 0, 104, - 0, 0, 2, 1, 0, 0, 0, 54, - 0, 0, 5, 50, 32, 16, 0, 0, - 0, 0, 0, 70, 16, 16, 0, 1, - 0, 0, 0, 17, 0, 0, 8, 18, - 0, 16, 0, 0, 0, 0, 0, 70, -142, 32, 0, 0, 0, 0, 0, 1, - 0, 0, 0, 70, 30, 16, 0, 0, - 0, 0, 0, 54, 0, 0, 6, 34, - 32, 16, 0, 1, 0, 0, 0, 10, - 0, 16, 128, 65, 0, 0, 0, 0, - 0, 0, 0, 17, 0, 0, 8, 18, - 0, 16, 0, 0, 0, 0, 0, 70, -142, 32, 0, 0, 0, 0, 0, 2, - 0, 0, 0, 70, 30, 16, 0, 0, - 0, 0, 0, 17, 0, 0, 8, 34, - 0, 16, 0, 0, 0, 0, 0, 70, -142, 32, 0, 0, 0, 0, 0, 3, - 0, 0, 0, 70, 30, 16, 0, 0, - 0, 0, 0, 0, 0, 0, 7, 18, - 0, 16, 0, 0, 0, 0, 0, 26, - 0, 16, 0, 0, 0, 0, 0, 10, - 0, 16, 0, 0, 0, 0, 0, 54, - 0, 0, 5, 130, 32, 16, 0, 1, - 0, 0, 0, 26, 0, 16, 0, 0, - 0, 0, 0, 56, 0, 0, 7, 66, - 32, 16, 0, 1, 0, 0, 0, 10, - 0, 16, 0, 0, 0, 0, 0, 1, - 64, 0, 0, 0, 0, 0, 63, 17, - 0, 0, 8, 18, 32, 16, 0, 1, - 0, 0, 0, 70, 142, 32, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 70, - 30, 16, 0, 0, 0, 0, 0, 62, - 0, 0, 1, 83, 84, 65, 84, 116, - 0, 0, 0, 10, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 4, - 0, 0, 0, 7, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 2, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 82, - 68, 69, 70, 204, 0, 0, 0, 1, - 0, 0, 0, 72, 0, 0, 0, 1, - 0, 0, 0, 28, 0, 0, 0, 0, - 4, 254, 255, 0, 65, 0, 0, 152, - 0, 0, 0, 60, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 0, 0, 0, 0, - 0, 0, 0, 36, 71, 108, 111, 98, - 97, 108, 115, 0, 171, 171, 171, 60, - 0, 0, 0, 1, 0, 0, 0, 96, - 0, 0, 0, 64, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 120, - 0, 0, 0, 0, 0, 0, 0, 64, - 0, 0, 0, 2, 0, 0, 0, 136, - 0, 0, 0, 0, 0, 0, 0, 95, - 67, 67, 95, 77, 86, 80, 77, 97, -116, 114, 105, 120, 0, 171, 171, 3, - 0, 3, 0, 4, 0, 4, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 77, -105, 99, 114, 111, 115, 111, 102, 116, - 32, 40, 82, 41, 32, 72, 76, 83, - 76, 32, 83, 104, 97, 100, 101, 114, - 32, 67, 111, 109, 112, 105, 108, 101, -114, 32, 54, 46, 51, 46, 57, 54, - 48, 48, 46, 49, 54, 51, 56, 52, - 0, 171, 171, 73, 83, 71, 78, 68, - 0, 0, 0, 2, 0, 0, 0, 8, - 0, 0, 0, 56, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 3, - 0, 0, 0, 0, 0, 0, 0, 15, - 15, 0, 0, 56, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 3, - 0, 0, 0, 1, 0, 0, 0, 3, - 3, 0, 0, 84, 69, 88, 67, 79, - 79, 82, 68, 0, 171, 171, 171, 79, - 83, 71, 78, 80, 0, 0, 0, 2, - 0, 0, 0, 8, 0, 0, 0, 56, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 3, 0, 0, 0, 0, - 0, 0, 0, 3, 12, 0, 0, 65, - 0, 0, 0, 0, 0, 0, 0, 1, - 0, 0, 0, 3, 0, 0, 0, 1, - 0, 0, 0, 15, 0, 0, 0, 84, - 69, 88, 67, 79, 79, 82, 68, 0, - 83, 86, 95, 80, 111, 115, 105, 116, -105, 111, 110, 0, 171, 171, 171, -}; - -const unsigned char s_61ACD51E94A6AA8035DE722FB113F24350C0D113[] = { - -166, 147, 0, 0, 142, 9, 2, 1, - 0, 128, 0, 0, 82, 139, 0, 0, - 10, 0, 0, 0, 97, 95, 112, 111, -115, 105, 116, 105, 111, 110, 1, 0, - 0, 0, 82, 139, 0, 0, 7, 0, - 0, 0, 97, 95, 99, 111, 108, 111, -114, 0, 0, 0, 0, 80, 139, 0, - 0, 10, 0, 0, 0, 97, 95, 116, -101, 120, 67, 111, 111, 114, 100, 2, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 1, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 0, 0, 0, 0, - 3, 0, 0, 0, 92, 139, 0, 0, -242, 141, 0, 0, 12, 0, 0, 0, - 67, 67, 95, 77, 86, 80, 77, 97, -116, 114, 105, 120, 0, 0, 0, 0, -255, 255, 255, 255, 0, 0, 0, 0, - 4, 0, 0, 0, 94, 139, 0, 0, - 0, 0, 0, 0, 11, 0, 0, 0, - 67, 67, 95, 84, 101, 120, 116, 117, -114, 101, 48, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 1, - 0, 0, 0, 6, 20, 0, 0, 240, -141, 0, 0, 14, 0, 0, 0, 67, - 67, 95, 97, 108, 112, 104, 97, 95, -118, 97, 108, 117, 101, 0, 0, 0, - 0, 0, 0, 0, 0, 255, 255, 255, -255, 1, 0, 0, 0, 3, 0, 0, - 0, 12, 0, 0, 0, 67, 67, 95, - 77, 86, 80, 77, 97, 116, 114, 105, -120, 0, 0, 0, 0, 0, 0, 0, - 0, 11, 0, 0, 0, 67, 67, 95, - 84, 101, 120, 116, 117, 114, 101, 48, - 0, 0, 0, 0, 1, 0, 0, 0, - 14, 0, 0, 0, 67, 67, 95, 97, -108, 112, 104, 97, 95, 118, 97, 108, -117, 101, 0, 0, 0, 0, 2, 0, - 0, 0, 36, 5, 0, 0, 4, 5, - 0, 0, 0, 0, 0, 0, 185, 153, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 68, 88, - 66, 67, 100, 113, 175, 29, 164, 71, -177, 78, 120, 99, 172, 209, 227, 249, -113, 132, 1, 0, 0, 0, 36, 5, - 0, 0, 6, 0, 0, 0, 56, 0, - 0, 0, 88, 1, 0, 0, 164, 2, - 0, 0, 32, 3, 0, 0, 92, 4, - 0, 0, 168, 4, 0, 0, 65, 111, -110, 57, 24, 1, 0, 0, 24, 1, - 0, 0, 0, 2, 255, 255, 228, 0, - 0, 0, 52, 0, 0, 0, 1, 0, - 40, 0, 0, 0, 52, 0, 0, 0, - 52, 0, 1, 0, 36, 0, 0, 0, - 52, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 1, 2, 255, 255, 81, 0, - 0, 5, 1, 0, 15, 160, 0, 0, -128, 191, 0, 0, 0, 128, 0, 0, - 0, 0, 0, 0, 0, 0, 31, 0, - 0, 2, 0, 0, 0, 128, 0, 0, - 15, 176, 31, 0, 0, 2, 0, 0, - 0, 128, 1, 0, 3, 176, 31, 0, - 0, 2, 0, 0, 0, 144, 0, 8, - 15, 160, 66, 0, 0, 3, 0, 0, - 15, 128, 1, 0, 228, 176, 0, 8, -228, 160, 2, 0, 0, 3, 1, 0, - 8, 128, 0, 0, 255, 129, 0, 0, - 0, 160, 88, 0, 0, 4, 1, 0, - 15, 128, 1, 0, 255, 128, 1, 0, - 0, 160, 1, 0, 85, 160, 65, 0, - 0, 1, 1, 0, 15, 128, 5, 0, - 0, 3, 0, 0, 15, 128, 0, 0, -228, 128, 0, 0, 228, 176, 1, 0, - 0, 2, 1, 0, 15, 128, 0, 0, -228, 128, 1, 0, 0, 2, 2, 0, - 15, 128, 0, 0, 228, 128, 1, 0, - 0, 2, 3, 0, 15, 128, 0, 0, -228, 128, 1, 0, 0, 2, 0, 8, - 15, 128, 1, 0, 228, 128, 1, 0, - 0, 2, 1, 8, 15, 128, 2, 0, -228, 128, 1, 0, 0, 2, 2, 8, - 15, 128, 3, 0, 228, 128, 1, 0, - 0, 2, 3, 8, 15, 128, 0, 0, -228, 128, 255, 255, 0, 0, 83, 72, - 68, 82, 68, 1, 0, 0, 64, 0, - 0, 0, 81, 0, 0, 0, 89, 0, - 0, 4, 70, 142, 32, 0, 0, 0, - 0, 0, 1, 0, 0, 0, 90, 0, - 0, 3, 0, 96, 16, 0, 0, 0, - 0, 0, 88, 24, 0, 4, 0, 112, - 16, 0, 0, 0, 0, 0, 85, 85, - 0, 0, 98, 16, 0, 3, 242, 16, - 16, 0, 0, 0, 0, 0, 98, 16, - 0, 3, 50, 16, 16, 0, 1, 0, - 0, 0, 101, 0, 0, 3, 242, 32, - 16, 0, 0, 0, 0, 0, 101, 0, - 0, 3, 242, 32, 16, 0, 1, 0, - 0, 0, 101, 0, 0, 3, 242, 32, - 16, 0, 2, 0, 0, 0, 101, 0, - 0, 3, 242, 32, 16, 0, 3, 0, - 0, 0, 104, 0, 0, 2, 2, 0, - 0, 0, 69, 0, 0, 9, 242, 0, - 16, 0, 0, 0, 0, 0, 70, 16, - 16, 0, 1, 0, 0, 0, 70, 126, - 16, 0, 0, 0, 0, 0, 0, 96, - 16, 0, 0, 0, 0, 0, 29, 0, - 0, 8, 18, 0, 16, 0, 1, 0, - 0, 0, 10, 128, 32, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, 13, 0, - 4, 3, 10, 0, 16, 0, 1, 0, - 0, 0, 56, 0, 0, 7, 242, 0, - 16, 0, 0, 0, 0, 0, 70, 14, - 16, 0, 0, 0, 0, 0, 70, 30, - 16, 0, 0, 0, 0, 0, 54, 0, - 0, 5, 242, 32, 16, 0, 0, 0, - 0, 0, 70, 14, 16, 0, 0, 0, - 0, 0, 54, 0, 0, 5, 242, 32, - 16, 0, 1, 0, 0, 0, 70, 14, - 16, 0, 0, 0, 0, 0, 54, 0, - 0, 5, 242, 32, 16, 0, 2, 0, - 0, 0, 70, 14, 16, 0, 0, 0, - 0, 0, 54, 0, 0, 5, 242, 32, - 16, 0, 3, 0, 0, 0, 70, 14, - 16, 0, 0, 0, 0, 0, 62, 0, - 0, 1, 83, 84, 65, 84, 116, 0, - 0, 0, 9, 0, 0, 0, 2, 0, - 0, 0, 0, 0, 0, 0, 6, 0, - 0, 0, 2, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 4, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 82, 68, - 69, 70, 52, 1, 0, 0, 1, 0, - 0, 0, 176, 0, 0, 0, 3, 0, - 0, 0, 28, 0, 0, 0, 0, 4, -255, 255, 0, 65, 0, 0, 0, 1, - 0, 0, 124, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, 1, 0, - 0, 0, 145, 0, 0, 0, 2, 0, - 0, 0, 5, 0, 0, 0, 4, 0, - 0, 0, 255, 255, 255, 255, 0, 0, - 0, 0, 1, 0, 0, 0, 13, 0, - 0, 0, 166, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 115, 97, 109, 112, 108, 101, -114, 95, 95, 67, 67, 95, 84, 101, -120, 116, 117, 114, 101, 48, 0, 116, -101, 120, 116, 117, 114, 101, 95, 95, - 67, 67, 95, 84, 101, 120, 116, 117, -114, 101, 48, 0, 36, 71, 108, 111, - 98, 97, 108, 115, 0, 171, 166, 0, - 0, 0, 1, 0, 0, 0, 200, 0, - 0, 0, 16, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 224, 0, - 0, 0, 0, 0, 0, 0, 4, 0, - 0, 0, 2, 0, 0, 0, 240, 0, - 0, 0, 0, 0, 0, 0, 95, 67, - 67, 95, 97, 108, 112, 104, 97, 95, -118, 97, 108, 117, 101, 0, 0, 0, - 3, 0, 1, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 77, 105, - 99, 114, 111, 115, 111, 102, 116, 32, - 40, 82, 41, 32, 72, 76, 83, 76, - 32, 83, 104, 97, 100, 101, 114, 32, - 67, 111, 109, 112, 105, 108, 101, 114, - 32, 54, 46, 51, 46, 57, 54, 48, - 48, 46, 49, 54, 51, 56, 52, 0, -171, 171, 73, 83, 71, 78, 68, 0, - 0, 0, 2, 0, 0, 0, 8, 0, - 0, 0, 56, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, 15, 15, - 0, 0, 56, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 1, 0, 0, 0, 3, 3, - 0, 0, 84, 69, 88, 67, 79, 79, - 82, 68, 0, 171, 171, 171, 79, 83, - 71, 78, 116, 0, 0, 0, 4, 0, - 0, 0, 8, 0, 0, 0, 104, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, 0, 0, - 0, 0, 15, 0, 0, 0, 104, 0, - 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, 1, 0, - 0, 0, 15, 0, 0, 0, 104, 0, - 0, 0, 2, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, 2, 0, - 0, 0, 15, 0, 0, 0, 104, 0, - 0, 0, 3, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, 3, 0, - 0, 0, 15, 0, 0, 0, 83, 86, - 95, 84, 97, 114, 103, 101, 116, 0, -171, 171, 68, 88, 66, 67, 235, 56, -180, 223, 125, 231, 231, 218, 70, 75, - 12, 63, 200, 233, 69, 121, 1, 0, - 0, 0, 4, 5, 0, 0, 6, 0, - 0, 0, 56, 0, 0, 0, 92, 1, - 0, 0, 224, 2, 0, 0, 92, 3, - 0, 0, 48, 4, 0, 0, 148, 4, - 0, 0, 65, 111, 110, 57, 28, 1, - 0, 0, 28, 1, 0, 0, 0, 2, -254, 255, 232, 0, 0, 0, 52, 0, - 0, 0, 1, 0, 36, 0, 0, 0, - 48, 0, 0, 0, 48, 0, 0, 0, - 36, 0, 1, 0, 48, 0, 0, 0, - 0, 0, 4, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 2, -254, 255, 81, 0, 0, 5, 5, 0, - 15, 160, 0, 0, 0, 63, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 31, 0, 0, 2, 5, 0, - 0, 128, 0, 0, 15, 144, 31, 0, - 0, 2, 5, 0, 1, 128, 1, 0, - 15, 144, 31, 0, 0, 2, 5, 0, - 2, 128, 2, 0, 15, 144, 9, 0, - 0, 3, 0, 0, 1, 128, 3, 0, -228, 160, 1, 0, 228, 144, 9, 0, - 0, 3, 0, 0, 2, 128, 4, 0, -228, 160, 1, 0, 228, 144, 2, 0, - 0, 3, 0, 0, 1, 128, 0, 0, - 85, 128, 0, 0, 0, 128, 5, 0, - 0, 3, 0, 0, 4, 192, 0, 0, - 0, 128, 5, 0, 0, 160, 9, 0, - 0, 3, 0, 0, 1, 128, 2, 0, -228, 160, 1, 0, 228, 144, 1, 0, - 0, 2, 1, 0, 2, 128, 0, 0, - 0, 129, 9, 0, 0, 3, 1, 0, - 1, 128, 1, 0, 228, 160, 1, 0, -228, 144, 4, 0, 0, 4, 0, 0, - 3, 192, 0, 0, 85, 128, 0, 0, -228, 160, 1, 0, 228, 128, 1, 0, - 0, 2, 0, 0, 8, 192, 0, 0, - 85, 128, 1, 0, 0, 2, 0, 0, - 15, 224, 0, 0, 228, 144, 1, 0, - 0, 2, 1, 0, 3, 224, 2, 0, -228, 144, 255, 255, 0, 0, 83, 72, - 68, 82, 124, 1, 0, 0, 64, 0, - 1, 0, 95, 0, 0, 0, 89, 0, - 0, 4, 70, 142, 32, 0, 0, 0, - 0, 0, 4, 0, 0, 0, 95, 0, - 0, 3, 242, 16, 16, 0, 0, 0, - 0, 0, 95, 0, 0, 3, 242, 16, - 16, 0, 1, 0, 0, 0, 95, 0, - 0, 3, 50, 16, 16, 0, 2, 0, - 0, 0, 101, 0, 0, 3, 242, 32, - 16, 0, 0, 0, 0, 0, 101, 0, - 0, 3, 50, 32, 16, 0, 1, 0, - 0, 0, 103, 0, 0, 4, 242, 32, - 16, 0, 2, 0, 0, 0, 1, 0, - 0, 0, 104, 0, 0, 2, 1, 0, - 0, 0, 54, 0, 0, 5, 242, 32, - 16, 0, 0, 0, 0, 0, 70, 30, - 16, 0, 0, 0, 0, 0, 54, 0, - 0, 5, 50, 32, 16, 0, 1, 0, - 0, 0, 70, 16, 16, 0, 2, 0, - 0, 0, 17, 0, 0, 8, 18, 0, - 16, 0, 0, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 70, 30, 16, 0, 1, 0, - 0, 0, 54, 0, 0, 6, 34, 32, - 16, 0, 2, 0, 0, 0, 10, 0, - 16, 128, 65, 0, 0, 0, 0, 0, - 0, 0, 17, 0, 0, 8, 18, 0, - 16, 0, 0, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, 2, 0, - 0, 0, 70, 30, 16, 0, 1, 0, - 0, 0, 17, 0, 0, 8, 34, 0, - 16, 0, 0, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 70, 30, 16, 0, 1, 0, - 0, 0, 0, 0, 0, 7, 18, 0, - 16, 0, 0, 0, 0, 0, 26, 0, - 16, 0, 0, 0, 0, 0, 10, 0, - 16, 0, 0, 0, 0, 0, 54, 0, - 0, 5, 130, 32, 16, 0, 2, 0, - 0, 0, 26, 0, 16, 0, 0, 0, - 0, 0, 56, 0, 0, 7, 66, 32, - 16, 0, 2, 0, 0, 0, 10, 0, - 16, 0, 0, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 0, 63, 17, 0, - 0, 8, 18, 32, 16, 0, 2, 0, - 0, 0, 70, 142, 32, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 70, 30, - 16, 0, 1, 0, 0, 0, 62, 0, - 0, 1, 83, 84, 65, 84, 116, 0, - 0, 0, 11, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 6, 0, - 0, 0, 7, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 82, 68, - 69, 70, 204, 0, 0, 0, 1, 0, - 0, 0, 72, 0, 0, 0, 1, 0, - 0, 0, 28, 0, 0, 0, 0, 4, -254, 255, 0, 65, 0, 0, 152, 0, - 0, 0, 60, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 36, 71, 108, 111, 98, 97, -108, 115, 0, 171, 171, 171, 60, 0, - 0, 0, 1, 0, 0, 0, 96, 0, - 0, 0, 64, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 120, 0, - 0, 0, 0, 0, 0, 0, 64, 0, - 0, 0, 2, 0, 0, 0, 136, 0, - 0, 0, 0, 0, 0, 0, 95, 67, - 67, 95, 77, 86, 80, 77, 97, 116, -114, 105, 120, 0, 171, 171, 3, 0, - 3, 0, 4, 0, 4, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 77, 105, - 99, 114, 111, 115, 111, 102, 116, 32, - 40, 82, 41, 32, 72, 76, 83, 76, - 32, 83, 104, 97, 100, 101, 114, 32, - 67, 111, 109, 112, 105, 108, 101, 114, - 32, 54, 46, 51, 46, 57, 54, 48, - 48, 46, 49, 54, 51, 56, 52, 0, -171, 171, 73, 83, 71, 78, 92, 0, - 0, 0, 3, 0, 0, 0, 8, 0, - 0, 0, 80, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, 15, 15, - 0, 0, 80, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 1, 0, 0, 0, 15, 15, - 0, 0, 80, 0, 0, 0, 2, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 2, 0, 0, 0, 3, 3, - 0, 0, 84, 69, 88, 67, 79, 79, - 82, 68, 0, 171, 171, 171, 79, 83, - 71, 78, 104, 0, 0, 0, 3, 0, - 0, 0, 8, 0, 0, 0, 80, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, 0, 0, - 0, 0, 15, 0, 0, 0, 80, 0, - 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, 1, 0, - 0, 0, 3, 12, 0, 0, 89, 0, - 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 3, 0, 0, 0, 2, 0, - 0, 0, 15, 0, 0, 0, 84, 69, - 88, 67, 79, 79, 82, 68, 0, 83, - 86, 95, 80, 111, 115, 105, 116, 105, -111, 110, 0, 171, 171, 171, -}; - -const unsigned char s_6A3FEBEAD7E44B2380CD39CBDCFD1D3B046D8057[] = { - -166, 147, 0, 0, 142, 9, 2, 1, - 0, 128, 0, 0, 82, 139, 0, 0, - 10, 0, 0, 0, 97, 95, 112, 111, -115, 105, 116, 105, 111, 110, 1, 0, - 0, 0, 82, 139, 0, 0, 7, 0, - 0, 0, 97, 95, 99, 111, 108, 111, -114, 0, 0, 0, 0, 80, 139, 0, - 0, 10, 0, 0, 0, 97, 95, 116, -101, 120, 99, 111, 111, 114, 100, 2, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 92, 139, 0, 0, -242, 141, 0, 0, 12, 0, 0, 0, - 67, 67, 95, 77, 86, 80, 77, 97, -116, 114, 105, 120, 0, 0, 0, 0, -255, 255, 255, 255, 0, 0, 0, 0, - 4, 0, 0, 0, 1, 0, 0, 0, - 12, 0, 0, 0, 67, 67, 95, 77, - 86, 80, 77, 97, 116, 114, 105, 120, - 0, 0, 0, 0, 0, 0, 0, 0, - 16, 4, 0, 0, 48, 5, 0, 0, - 0, 0, 0, 0, 185, 153, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 68, 88, 66, 67, - 79, 226, 72, 124, 94, 252, 37, 157, -186, 66, 253, 29, 176, 252, 8, 124, - 1, 0, 0, 0, 16, 4, 0, 0, - 6, 0, 0, 0, 56, 0, 0, 0, - 28, 1, 0, 0, 116, 2, 0, 0, -240, 2, 0, 0, 72, 3, 0, 0, -148, 3, 0, 0, 65, 111, 110, 57, -220, 0, 0, 0, 220, 0, 0, 0, - 0, 2, 255, 255, 184, 0, 0, 0, - 36, 0, 0, 0, 0, 0, 36, 0, - 0, 0, 36, 0, 0, 0, 36, 0, - 0, 0, 36, 0, 0, 0, 36, 0, - 1, 2, 255, 255, 81, 0, 0, 5, - 0, 0, 15, 160, 0, 0, 0, 0, - 0, 0, 128, 63, 0, 0, 0, 0, - 0, 0, 0, 0, 31, 0, 0, 2, - 0, 0, 0, 128, 0, 0, 15, 176, - 31, 0, 0, 2, 0, 0, 0, 128, - 1, 0, 3, 176, 90, 0, 0, 4, - 0, 0, 8, 128, 1, 0, 228, 176, - 1, 0, 228, 176, 0, 0, 0, 160, - 7, 0, 0, 2, 0, 0, 1, 128, - 0, 0, 255, 128, 6, 0, 0, 2, - 0, 0, 1, 128, 0, 0, 0, 128, - 2, 0, 0, 3, 0, 0, 1, 128, - 0, 0, 0, 129, 0, 0, 85, 160, - 88, 0, 0, 4, 0, 0, 15, 128, - 0, 0, 0, 128, 0, 0, 228, 176, - 0, 0, 0, 160, 1, 0, 0, 2, - 0, 8, 15, 128, 0, 0, 228, 128, - 1, 0, 0, 2, 1, 8, 15, 128, - 0, 0, 228, 128, 1, 0, 0, 2, - 2, 8, 15, 128, 0, 0, 228, 128, - 1, 0, 0, 2, 3, 8, 15, 128, - 0, 0, 228, 128, 255, 255, 0, 0, - 83, 72, 68, 82, 80, 1, 0, 0, - 64, 0, 0, 0, 84, 0, 0, 0, - 98, 16, 0, 3, 242, 16, 16, 0, - 0, 0, 0, 0, 98, 16, 0, 3, - 50, 16, 16, 0, 1, 0, 0, 0, -101, 0, 0, 3, 242, 32, 16, 0, - 0, 0, 0, 0, 101, 0, 0, 3, -242, 32, 16, 0, 1, 0, 0, 0, -101, 0, 0, 3, 242, 32, 16, 0, - 2, 0, 0, 0, 101, 0, 0, 3, -242, 32, 16, 0, 3, 0, 0, 0, -104, 0, 0, 2, 1, 0, 0, 0, - 15, 0, 0, 7, 18, 0, 16, 0, - 0, 0, 0, 0, 70, 16, 16, 0, - 1, 0, 0, 0, 70, 16, 16, 0, - 1, 0, 0, 0, 75, 0, 0, 5, - 18, 0, 16, 0, 0, 0, 0, 0, - 10, 0, 16, 0, 0, 0, 0, 0, - 0, 0, 0, 8, 18, 0, 16, 0, - 0, 0, 0, 0, 10, 0, 16, 128, - 65, 0, 0, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 0, 0, 128, 63, - 29, 0, 0, 7, 18, 0, 16, 0, - 0, 0, 0, 0, 10, 0, 16, 0, - 0, 0, 0, 0, 1, 64, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 7, - 18, 0, 16, 0, 0, 0, 0, 0, - 10, 0, 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 0, 0, 128, 63, - 56, 0, 0, 7, 242, 0, 16, 0, - 0, 0, 0, 0, 6, 0, 16, 0, - 0, 0, 0, 0, 70, 30, 16, 0, - 0, 0, 0, 0, 54, 0, 0, 5, -242, 32, 16, 0, 0, 0, 0, 0, - 70, 14, 16, 0, 0, 0, 0, 0, - 54, 0, 0, 5, 242, 32, 16, 0, - 1, 0, 0, 0, 70, 14, 16, 0, - 0, 0, 0, 0, 54, 0, 0, 5, -242, 32, 16, 0, 2, 0, 0, 0, - 70, 14, 16, 0, 0, 0, 0, 0, - 54, 0, 0, 5, 242, 32, 16, 0, - 3, 0, 0, 0, 70, 14, 16, 0, - 0, 0, 0, 0, 62, 0, 0, 1, - 83, 84, 65, 84, 116, 0, 0, 0, - 11, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 6, 0, 0, 0, - 5, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 4, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 82, 68, 69, 70, - 80, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 28, 0, 0, 0, 0, 4, 255, 255, - 0, 65, 0, 0, 28, 0, 0, 0, - 77, 105, 99, 114, 111, 115, 111, 102, -116, 32, 40, 82, 41, 32, 72, 76, - 83, 76, 32, 83, 104, 97, 100, 101, -114, 32, 67, 111, 109, 112, 105, 108, -101, 114, 32, 54, 46, 51, 46, 57, - 54, 48, 48, 46, 49, 54, 51, 56, - 52, 0, 171, 171, 73, 83, 71, 78, - 68, 0, 0, 0, 2, 0, 0, 0, - 8, 0, 0, 0, 56, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 0, 0, 0, 0, - 15, 15, 0, 0, 56, 0, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 1, 0, 0, 0, - 3, 3, 0, 0, 84, 69, 88, 67, - 79, 79, 82, 68, 0, 171, 171, 171, - 79, 83, 71, 78, 116, 0, 0, 0, - 4, 0, 0, 0, 8, 0, 0, 0, -104, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 15, 0, 0, 0, -104, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 3, 0, 0, 0, - 1, 0, 0, 0, 15, 0, 0, 0, -104, 0, 0, 0, 2, 0, 0, 0, - 0, 0, 0, 0, 3, 0, 0, 0, - 2, 0, 0, 0, 15, 0, 0, 0, -104, 0, 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 3, 0, 0, 0, - 3, 0, 0, 0, 15, 0, 0, 0, - 83, 86, 95, 84, 97, 114, 103, 101, -116, 0, 171, 171, 68, 88, 66, 67, -171, 76, 90, 152, 95, 120, 80, 155, -185, 88, 30, 71, 14, 112, 82, 161, - 1, 0, 0, 0, 48, 5, 0, 0, - 6, 0, 0, 0, 56, 0, 0, 0, -108, 1, 0, 0, 12, 3, 0, 0, -136, 3, 0, 0, 92, 4, 0, 0, -192, 4, 0, 0, 65, 111, 110, 57, - 44, 1, 0, 0, 44, 1, 0, 0, - 0, 2, 254, 255, 248, 0, 0, 0, - 52, 0, 0, 0, 1, 0, 36, 0, - 0, 0, 48, 0, 0, 0, 48, 0, - 0, 0, 36, 0, 1, 0, 48, 0, - 0, 0, 0, 0, 4, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 1, 2, 254, 255, 81, 0, 0, 5, - 5, 0, 15, 160, 0, 0, 0, 63, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 31, 0, 0, 2, - 5, 0, 0, 128, 0, 0, 15, 144, - 31, 0, 0, 2, 5, 0, 1, 128, - 1, 0, 15, 144, 31, 0, 0, 2, - 5, 0, 2, 128, 2, 0, 15, 144, - 5, 0, 0, 3, 0, 0, 7, 224, - 0, 0, 255, 144, 0, 0, 228, 144, - 9, 0, 0, 3, 0, 0, 1, 128, - 3, 0, 228, 160, 1, 0, 228, 144, - 9, 0, 0, 3, 0, 0, 2, 128, - 4, 0, 228, 160, 1, 0, 228, 144, - 2, 0, 0, 3, 0, 0, 1, 128, - 0, 0, 85, 128, 0, 0, 0, 128, - 5, 0, 0, 3, 0, 0, 4, 192, - 0, 0, 0, 128, 5, 0, 0, 160, - 9, 0, 0, 3, 0, 0, 1, 128, - 2, 0, 228, 160, 1, 0, 228, 144, - 1, 0, 0, 2, 1, 0, 2, 128, - 0, 0, 0, 129, 9, 0, 0, 3, - 1, 0, 1, 128, 1, 0, 228, 160, - 1, 0, 228, 144, 4, 0, 0, 4, - 0, 0, 3, 192, 0, 0, 85, 128, - 0, 0, 228, 160, 1, 0, 228, 128, - 1, 0, 0, 2, 0, 0, 8, 192, - 0, 0, 85, 128, 1, 0, 0, 2, - 0, 0, 8, 224, 0, 0, 255, 144, - 1, 0, 0, 2, 1, 0, 3, 224, - 2, 0, 228, 144, 255, 255, 0, 0, - 83, 72, 68, 82, 152, 1, 0, 0, - 64, 0, 1, 0, 102, 0, 0, 0, - 89, 0, 0, 4, 70, 142, 32, 0, - 0, 0, 0, 0, 4, 0, 0, 0, - 95, 0, 0, 3, 242, 16, 16, 0, - 0, 0, 0, 0, 95, 0, 0, 3, -242, 16, 16, 0, 1, 0, 0, 0, - 95, 0, 0, 3, 50, 16, 16, 0, - 2, 0, 0, 0, 101, 0, 0, 3, -242, 32, 16, 0, 0, 0, 0, 0, -101, 0, 0, 3, 50, 32, 16, 0, - 1, 0, 0, 0, 103, 0, 0, 4, -242, 32, 16, 0, 2, 0, 0, 0, - 1, 0, 0, 0, 104, 0, 0, 2, - 1, 0, 0, 0, 56, 0, 0, 7, -114, 32, 16, 0, 0, 0, 0, 0, -246, 31, 16, 0, 0, 0, 0, 0, - 70, 18, 16, 0, 0, 0, 0, 0, - 54, 0, 0, 5, 130, 32, 16, 0, - 0, 0, 0, 0, 58, 16, 16, 0, - 0, 0, 0, 0, 54, 0, 0, 5, - 50, 32, 16, 0, 1, 0, 0, 0, - 70, 16, 16, 0, 2, 0, 0, 0, - 17, 0, 0, 8, 18, 0, 16, 0, - 0, 0, 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 1, 0, 0, 0, - 70, 30, 16, 0, 1, 0, 0, 0, - 54, 0, 0, 6, 34, 32, 16, 0, - 2, 0, 0, 0, 10, 0, 16, 128, - 65, 0, 0, 0, 0, 0, 0, 0, - 17, 0, 0, 8, 18, 0, 16, 0, - 0, 0, 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 2, 0, 0, 0, - 70, 30, 16, 0, 1, 0, 0, 0, - 17, 0, 0, 8, 34, 0, 16, 0, - 0, 0, 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 3, 0, 0, 0, - 70, 30, 16, 0, 1, 0, 0, 0, - 0, 0, 0, 7, 18, 0, 16, 0, - 0, 0, 0, 0, 26, 0, 16, 0, - 0, 0, 0, 0, 10, 0, 16, 0, - 0, 0, 0, 0, 54, 0, 0, 5, -130, 32, 16, 0, 2, 0, 0, 0, - 26, 0, 16, 0, 0, 0, 0, 0, - 56, 0, 0, 7, 66, 32, 16, 0, - 2, 0, 0, 0, 10, 0, 16, 0, - 0, 0, 0, 0, 1, 64, 0, 0, - 0, 0, 0, 63, 17, 0, 0, 8, - 18, 32, 16, 0, 2, 0, 0, 0, - 70, 142, 32, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 70, 30, 16, 0, - 1, 0, 0, 0, 62, 0, 0, 1, - 83, 84, 65, 84, 116, 0, 0, 0, - 12, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 6, 0, 0, 0, - 8, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 82, 68, 69, 70, -204, 0, 0, 0, 1, 0, 0, 0, - 72, 0, 0, 0, 1, 0, 0, 0, - 28, 0, 0, 0, 0, 4, 254, 255, - 0, 65, 0, 0, 152, 0, 0, 0, - 60, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, - 36, 71, 108, 111, 98, 97, 108, 115, - 0, 171, 171, 171, 60, 0, 0, 0, - 1, 0, 0, 0, 96, 0, 0, 0, - 64, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 120, 0, 0, 0, - 0, 0, 0, 0, 64, 0, 0, 0, - 2, 0, 0, 0, 136, 0, 0, 0, - 0, 0, 0, 0, 95, 67, 67, 95, - 77, 86, 80, 77, 97, 116, 114, 105, -120, 0, 171, 171, 3, 0, 3, 0, - 4, 0, 4, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 77, 105, 99, 114, -111, 115, 111, 102, 116, 32, 40, 82, - 41, 32, 72, 76, 83, 76, 32, 83, -104, 97, 100, 101, 114, 32, 67, 111, -109, 112, 105, 108, 101, 114, 32, 54, - 46, 51, 46, 57, 54, 48, 48, 46, - 49, 54, 51, 56, 52, 0, 171, 171, - 73, 83, 71, 78, 92, 0, 0, 0, - 3, 0, 0, 0, 8, 0, 0, 0, - 80, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 15, 15, 0, 0, - 80, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 3, 0, 0, 0, - 1, 0, 0, 0, 15, 15, 0, 0, - 80, 0, 0, 0, 2, 0, 0, 0, - 0, 0, 0, 0, 3, 0, 0, 0, - 2, 0, 0, 0, 3, 3, 0, 0, - 84, 69, 88, 67, 79, 79, 82, 68, - 0, 171, 171, 171, 79, 83, 71, 78, -104, 0, 0, 0, 3, 0, 0, 0, - 8, 0, 0, 0, 80, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 0, 0, 0, 0, - 15, 0, 0, 0, 80, 0, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 1, 0, 0, 0, - 3, 12, 0, 0, 89, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 0, - 3, 0, 0, 0, 2, 0, 0, 0, - 15, 0, 0, 0, 84, 69, 88, 67, - 79, 79, 82, 68, 0, 83, 86, 95, - 80, 111, 115, 105, 116, 105, 111, 110, - 0, 171, 171, 171, -}; - -const unsigned char s_6C80A53170768A04FB4457D7203425EA3467E2E4[] = { - -166, 147, 0, 0, 142, 9, 2, 1, - 0, 128, 0, 0, 82, 139, 0, 0, - 10, 0, 0, 0, 97, 95, 112, 111, -115, 105, 116, 105, 111, 110, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 255, 255, 255, 255, 0, 0, - 0, 0, 0, 0, 0, 0, 255, 255, -255, 255, 0, 0, 0, 0, 0, 0, - 0, 0, 255, 255, 255, 255, 0, 0, - 0, 0, 0, 0, 0, 0, 255, 255, -255, 255, 0, 0, 0, 0, 0, 0, - 0, 0, 255, 255, 255, 255, 0, 0, - 0, 0, 0, 0, 0, 0, 255, 255, -255, 255, 0, 0, 0, 0, 0, 0, - 0, 0, 255, 255, 255, 255, 0, 0, - 0, 0, 0, 0, 0, 0, 255, 255, -255, 255, 0, 0, 0, 0, 0, 0, - 0, 0, 255, 255, 255, 255, 0, 0, - 0, 0, 0, 0, 0, 0, 255, 255, -255, 255, 0, 0, 0, 0, 0, 0, - 0, 0, 255, 255, 255, 255, 0, 0, - 0, 0, 0, 0, 0, 0, 255, 255, -255, 255, 0, 0, 0, 0, 0, 0, - 0, 0, 255, 255, 255, 255, 0, 0, - 0, 0, 0, 0, 0, 0, 255, 255, -255, 255, 0, 0, 0, 0, 0, 0, - 0, 0, 255, 255, 255, 255, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 3, - 0, 0, 0, 92, 139, 0, 0, 242, -141, 0, 0, 12, 0, 0, 0, 67, - 67, 95, 77, 86, 80, 77, 97, 116, -114, 105, 120, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 4, - 0, 0, 0, 82, 139, 0, 0, 242, -141, 0, 0, 7, 0, 0, 0, 117, - 95, 99, 111, 108, 111, 114, 0, 0, - 0, 0, 255, 255, 255, 255, 4, 0, - 0, 0, 1, 0, 0, 0, 6, 20, - 0, 0, 242, 141, 0, 0, 11, 0, - 0, 0, 117, 95, 112, 111, 105, 110, -116, 83, 105, 122, 101, 0, 0, 0, - 0, 255, 255, 255, 255, 5, 0, 0, - 0, 1, 0, 0, 0, 3, 0, 0, - 0, 12, 0, 0, 0, 67, 67, 95, - 77, 86, 80, 77, 97, 116, 114, 105, -120, 0, 0, 0, 0, 0, 0, 0, - 0, 7, 0, 0, 0, 117, 95, 99, -111, 108, 111, 114, 0, 0, 0, 0, - 1, 0, 0, 0, 11, 0, 0, 0, -117, 95, 112, 111, 105, 110, 116, 83, -105, 122, 101, 0, 0, 0, 0, 2, - 0, 0, 0, 204, 2, 0, 0, 208, - 4, 0, 0, 0, 0, 0, 0, 185, -153, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 68, - 88, 66, 67, 127, 145, 81, 72, 216, -190, 16, 61, 245, 231, 235, 249, 125, -223, 218, 82, 1, 0, 0, 0, 204, - 2, 0, 0, 6, 0, 0, 0, 56, - 0, 0, 0, 168, 0, 0, 0, 72, - 1, 0, 0, 196, 1, 0, 0, 28, - 2, 0, 0, 80, 2, 0, 0, 65, -111, 110, 57, 104, 0, 0, 0, 104, - 0, 0, 0, 0, 2, 255, 255, 68, - 0, 0, 0, 36, 0, 0, 0, 0, - 0, 36, 0, 0, 0, 36, 0, 0, - 0, 36, 0, 0, 0, 36, 0, 0, - 0, 36, 0, 1, 2, 255, 255, 31, - 0, 0, 2, 0, 0, 0, 128, 0, - 0, 15, 176, 1, 0, 0, 2, 0, - 8, 15, 128, 0, 0, 228, 176, 1, - 0, 0, 2, 1, 8, 15, 128, 0, - 0, 228, 176, 1, 0, 0, 2, 2, - 8, 15, 128, 0, 0, 228, 176, 1, - 0, 0, 2, 3, 8, 15, 128, 0, - 0, 228, 176, 255, 255, 0, 0, 83, - 72, 68, 82, 152, 0, 0, 0, 64, - 0, 0, 0, 38, 0, 0, 0, 98, - 16, 0, 3, 242, 16, 16, 0, 0, - 0, 0, 0, 101, 0, 0, 3, 242, - 32, 16, 0, 0, 0, 0, 0, 101, - 0, 0, 3, 242, 32, 16, 0, 1, - 0, 0, 0, 101, 0, 0, 3, 242, - 32, 16, 0, 2, 0, 0, 0, 101, - 0, 0, 3, 242, 32, 16, 0, 3, - 0, 0, 0, 54, 0, 0, 5, 242, - 32, 16, 0, 0, 0, 0, 0, 70, - 30, 16, 0, 0, 0, 0, 0, 54, - 0, 0, 5, 242, 32, 16, 0, 1, - 0, 0, 0, 70, 30, 16, 0, 0, - 0, 0, 0, 54, 0, 0, 5, 242, - 32, 16, 0, 2, 0, 0, 0, 70, - 30, 16, 0, 0, 0, 0, 0, 54, - 0, 0, 5, 242, 32, 16, 0, 3, - 0, 0, 0, 70, 30, 16, 0, 0, - 0, 0, 0, 62, 0, 0, 1, 83, - 84, 65, 84, 116, 0, 0, 0, 5, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 5, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 4, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 82, 68, 69, 70, 80, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 28, - 0, 0, 0, 0, 4, 255, 255, 0, - 65, 0, 0, 28, 0, 0, 0, 77, -105, 99, 114, 111, 115, 111, 102, 116, - 32, 40, 82, 41, 32, 72, 76, 83, - 76, 32, 83, 104, 97, 100, 101, 114, - 32, 67, 111, 109, 112, 105, 108, 101, -114, 32, 54, 46, 51, 46, 57, 54, - 48, 48, 46, 49, 54, 51, 56, 52, - 0, 171, 171, 73, 83, 71, 78, 44, - 0, 0, 0, 1, 0, 0, 0, 8, - 0, 0, 0, 32, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 3, - 0, 0, 0, 0, 0, 0, 0, 15, - 15, 0, 0, 84, 69, 88, 67, 79, - 79, 82, 68, 0, 171, 171, 171, 79, - 83, 71, 78, 116, 0, 0, 0, 4, - 0, 0, 0, 8, 0, 0, 0, 104, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 3, 0, 0, 0, 0, - 0, 0, 0, 15, 0, 0, 0, 104, - 0, 0, 0, 1, 0, 0, 0, 0, - 0, 0, 0, 3, 0, 0, 0, 1, - 0, 0, 0, 15, 0, 0, 0, 104, - 0, 0, 0, 2, 0, 0, 0, 0, - 0, 0, 0, 3, 0, 0, 0, 2, - 0, 0, 0, 15, 0, 0, 0, 104, - 0, 0, 0, 3, 0, 0, 0, 0, - 0, 0, 0, 3, 0, 0, 0, 3, - 0, 0, 0, 15, 0, 0, 0, 83, - 86, 95, 84, 97, 114, 103, 101, 116, - 0, 171, 171, 68, 88, 66, 67, 73, -129, 132, 250, 182, 151, 72, 83, 149, - 86, 107, 61, 98, 5, 216, 237, 1, - 0, 0, 0, 208, 4, 0, 0, 6, - 0, 0, 0, 56, 0, 0, 0, 56, - 1, 0, 0, 136, 2, 0, 0, 4, - 3, 0, 0, 68, 4, 0, 0, 120, - 4, 0, 0, 65, 111, 110, 57, 248, - 0, 0, 0, 248, 0, 0, 0, 0, - 2, 254, 255, 196, 0, 0, 0, 52, - 0, 0, 0, 1, 0, 36, 0, 0, - 0, 48, 0, 0, 0, 48, 0, 0, - 0, 36, 0, 1, 0, 48, 0, 0, - 0, 0, 0, 5, 0, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1, - 2, 254, 255, 81, 0, 0, 5, 6, - 0, 15, 160, 0, 0, 0, 63, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 31, 0, 0, 2, 5, - 0, 0, 128, 0, 0, 15, 144, 9, - 0, 0, 3, 0, 0, 1, 128, 3, - 0, 228, 160, 0, 0, 228, 144, 9, - 0, 0, 3, 0, 0, 2, 128, 4, - 0, 228, 160, 0, 0, 228, 144, 2, - 0, 0, 3, 0, 0, 1, 128, 0, - 0, 85, 128, 0, 0, 0, 128, 5, - 0, 0, 3, 0, 0, 4, 192, 0, - 0, 0, 128, 6, 0, 0, 160, 9, - 0, 0, 3, 0, 0, 1, 128, 2, - 0, 228, 160, 0, 0, 228, 144, 1, - 0, 0, 2, 1, 0, 2, 128, 0, - 0, 0, 129, 9, 0, 0, 3, 1, - 0, 1, 128, 1, 0, 228, 160, 0, - 0, 228, 144, 4, 0, 0, 4, 0, - 0, 3, 192, 0, 0, 85, 128, 0, - 0, 228, 160, 1, 0, 228, 128, 1, - 0, 0, 2, 0, 0, 8, 192, 0, - 0, 85, 128, 1, 0, 0, 2, 0, - 0, 15, 224, 5, 0, 228, 160, 255, -255, 0, 0, 83, 72, 68, 82, 72, - 1, 0, 0, 64, 0, 1, 0, 82, - 0, 0, 0, 89, 0, 0, 4, 70, -142, 32, 0, 0, 0, 0, 0, 5, - 0, 0, 0, 95, 0, 0, 3, 242, - 16, 16, 0, 0, 0, 0, 0, 101, - 0, 0, 3, 242, 32, 16, 0, 0, - 0, 0, 0, 103, 0, 0, 4, 242, - 32, 16, 0, 1, 0, 0, 0, 1, - 0, 0, 0, 104, 0, 0, 2, 1, - 0, 0, 0, 54, 0, 0, 6, 242, - 32, 16, 0, 0, 0, 0, 0, 70, -142, 32, 0, 0, 0, 0, 0, 4, - 0, 0, 0, 17, 0, 0, 8, 18, - 0, 16, 0, 0, 0, 0, 0, 70, -142, 32, 0, 0, 0, 0, 0, 1, - 0, 0, 0, 70, 30, 16, 0, 0, - 0, 0, 0, 54, 0, 0, 6, 34, - 32, 16, 0, 1, 0, 0, 0, 10, - 0, 16, 128, 65, 0, 0, 0, 0, - 0, 0, 0, 17, 0, 0, 8, 18, - 0, 16, 0, 0, 0, 0, 0, 70, -142, 32, 0, 0, 0, 0, 0, 2, - 0, 0, 0, 70, 30, 16, 0, 0, - 0, 0, 0, 17, 0, 0, 8, 34, - 0, 16, 0, 0, 0, 0, 0, 70, -142, 32, 0, 0, 0, 0, 0, 3, - 0, 0, 0, 70, 30, 16, 0, 0, - 0, 0, 0, 0, 0, 0, 7, 18, - 0, 16, 0, 0, 0, 0, 0, 26, - 0, 16, 0, 0, 0, 0, 0, 10, - 0, 16, 0, 0, 0, 0, 0, 54, - 0, 0, 5, 130, 32, 16, 0, 1, - 0, 0, 0, 26, 0, 16, 0, 0, - 0, 0, 0, 56, 0, 0, 7, 66, - 32, 16, 0, 1, 0, 0, 0, 10, - 0, 16, 0, 0, 0, 0, 0, 1, - 64, 0, 0, 0, 0, 0, 63, 17, - 0, 0, 8, 18, 32, 16, 0, 1, - 0, 0, 0, 70, 142, 32, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 70, - 30, 16, 0, 0, 0, 0, 0, 62, - 0, 0, 1, 83, 84, 65, 84, 116, - 0, 0, 0, 10, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 3, - 0, 0, 0, 7, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 2, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 82, - 68, 69, 70, 56, 1, 0, 0, 1, - 0, 0, 0, 72, 0, 0, 0, 1, - 0, 0, 0, 28, 0, 0, 0, 0, - 4, 254, 255, 0, 65, 0, 0, 4, - 1, 0, 0, 60, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 0, 0, 0, 0, - 0, 0, 0, 36, 71, 108, 111, 98, - 97, 108, 115, 0, 171, 171, 171, 60, - 0, 0, 0, 3, 0, 0, 0, 96, - 0, 0, 0, 96, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 168, - 0, 0, 0, 0, 0, 0, 0, 64, - 0, 0, 0, 2, 0, 0, 0, 184, - 0, 0, 0, 0, 0, 0, 0, 200, - 0, 0, 0, 64, 0, 0, 0, 16, - 0, 0, 0, 2, 0, 0, 0, 212, - 0, 0, 0, 0, 0, 0, 0, 228, - 0, 0, 0, 80, 0, 0, 0, 4, - 0, 0, 0, 0, 0, 0, 0, 244, - 0, 0, 0, 0, 0, 0, 0, 95, - 67, 67, 95, 77, 86, 80, 77, 97, -116, 114, 105, 120, 0, 171, 171, 3, - 0, 3, 0, 4, 0, 4, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 95, -117, 95, 99, 111, 108, 111, 114, 0, -171, 171, 171, 1, 0, 3, 0, 1, - 0, 4, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 95, 117, 95, 112, 111, -105, 110, 116, 83, 105, 122, 101, 0, -171, 171, 171, 0, 0, 3, 0, 1, - 0, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 77, 105, 99, 114, 111, -115, 111, 102, 116, 32, 40, 82, 41, - 32, 72, 76, 83, 76, 32, 83, 104, - 97, 100, 101, 114, 32, 67, 111, 109, -112, 105, 108, 101, 114, 32, 54, 46, - 51, 46, 57, 54, 48, 48, 46, 49, - 54, 51, 56, 52, 0, 171, 171, 73, - 83, 71, 78, 44, 0, 0, 0, 1, - 0, 0, 0, 8, 0, 0, 0, 32, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 3, 0, 0, 0, 0, - 0, 0, 0, 15, 15, 0, 0, 84, - 69, 88, 67, 79, 79, 82, 68, 0, -171, 171, 171, 79, 83, 71, 78, 80, - 0, 0, 0, 2, 0, 0, 0, 8, - 0, 0, 0, 56, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 3, - 0, 0, 0, 0, 0, 0, 0, 15, - 0, 0, 0, 65, 0, 0, 0, 0, - 0, 0, 0, 1, 0, 0, 0, 3, - 0, 0, 0, 1, 0, 0, 0, 15, - 0, 0, 0, 84, 69, 88, 67, 79, - 79, 82, 68, 0, 83, 86, 95, 80, -111, 115, 105, 116, 105, 111, 110, 0, -171, 171, 171, -}; - -const unsigned char s_7845A827CC74A6ED188C81E590C16A4B394AF6EA[] = { - -166, 147, 0, 0, 142, 9, 2, 1, - 0, 128, 0, 0, 82, 139, 0, 0, - 10, 0, 0, 0, 97, 95, 112, 111, -115, 105, 116, 105, 111, 110, 1, 0, - 0, 0, 82, 139, 0, 0, 7, 0, - 0, 0, 97, 95, 99, 111, 108, 111, -114, 0, 0, 0, 0, 80, 139, 0, - 0, 10, 0, 0, 0, 97, 95, 116, -101, 120, 67, 111, 111, 114, 100, 2, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 92, 139, 0, 0, -242, 141, 0, 0, 10, 0, 0, 0, - 67, 67, 95, 80, 77, 97, 116, 114, -105, 120, 0, 0, 0, 0, 255, 255, -255, 255, 0, 0, 0, 0, 4, 0, - 0, 0, 1, 0, 0, 0, 10, 0, - 0, 0, 67, 67, 95, 80, 77, 97, -116, 114, 105, 120, 0, 0, 0, 0, - 0, 0, 0, 0, 204, 2, 0, 0, -164, 4, 0, 0, 0, 0, 0, 0, -185, 153, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 68, 88, 66, 67, 127, 145, 81, 72, -216, 190, 16, 61, 245, 231, 235, 249, -125, 223, 218, 82, 1, 0, 0, 0, -204, 2, 0, 0, 6, 0, 0, 0, - 56, 0, 0, 0, 168, 0, 0, 0, - 72, 1, 0, 0, 196, 1, 0, 0, - 28, 2, 0, 0, 80, 2, 0, 0, - 65, 111, 110, 57, 104, 0, 0, 0, -104, 0, 0, 0, 0, 2, 255, 255, - 68, 0, 0, 0, 36, 0, 0, 0, - 0, 0, 36, 0, 0, 0, 36, 0, - 0, 0, 36, 0, 0, 0, 36, 0, - 0, 0, 36, 0, 1, 2, 255, 255, - 31, 0, 0, 2, 0, 0, 0, 128, - 0, 0, 15, 176, 1, 0, 0, 2, - 0, 8, 15, 128, 0, 0, 228, 176, - 1, 0, 0, 2, 1, 8, 15, 128, - 0, 0, 228, 176, 1, 0, 0, 2, - 2, 8, 15, 128, 0, 0, 228, 176, - 1, 0, 0, 2, 3, 8, 15, 128, - 0, 0, 228, 176, 255, 255, 0, 0, - 83, 72, 68, 82, 152, 0, 0, 0, - 64, 0, 0, 0, 38, 0, 0, 0, - 98, 16, 0, 3, 242, 16, 16, 0, - 0, 0, 0, 0, 101, 0, 0, 3, -242, 32, 16, 0, 0, 0, 0, 0, -101, 0, 0, 3, 242, 32, 16, 0, - 1, 0, 0, 0, 101, 0, 0, 3, -242, 32, 16, 0, 2, 0, 0, 0, -101, 0, 0, 3, 242, 32, 16, 0, - 3, 0, 0, 0, 54, 0, 0, 5, -242, 32, 16, 0, 0, 0, 0, 0, - 70, 30, 16, 0, 0, 0, 0, 0, - 54, 0, 0, 5, 242, 32, 16, 0, - 1, 0, 0, 0, 70, 30, 16, 0, - 0, 0, 0, 0, 54, 0, 0, 5, -242, 32, 16, 0, 2, 0, 0, 0, - 70, 30, 16, 0, 0, 0, 0, 0, - 54, 0, 0, 5, 242, 32, 16, 0, - 3, 0, 0, 0, 70, 30, 16, 0, - 0, 0, 0, 0, 62, 0, 0, 1, - 83, 84, 65, 84, 116, 0, 0, 0, - 5, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 5, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 4, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 82, 68, 69, 70, - 80, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 28, 0, 0, 0, 0, 4, 255, 255, - 0, 65, 0, 0, 28, 0, 0, 0, - 77, 105, 99, 114, 111, 115, 111, 102, -116, 32, 40, 82, 41, 32, 72, 76, - 83, 76, 32, 83, 104, 97, 100, 101, -114, 32, 67, 111, 109, 112, 105, 108, -101, 114, 32, 54, 46, 51, 46, 57, - 54, 48, 48, 46, 49, 54, 51, 56, - 52, 0, 171, 171, 73, 83, 71, 78, - 44, 0, 0, 0, 1, 0, 0, 0, - 8, 0, 0, 0, 32, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 0, 0, 0, 0, - 15, 15, 0, 0, 84, 69, 88, 67, - 79, 79, 82, 68, 0, 171, 171, 171, - 79, 83, 71, 78, 116, 0, 0, 0, - 4, 0, 0, 0, 8, 0, 0, 0, -104, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 15, 0, 0, 0, -104, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 3, 0, 0, 0, - 1, 0, 0, 0, 15, 0, 0, 0, -104, 0, 0, 0, 2, 0, 0, 0, - 0, 0, 0, 0, 3, 0, 0, 0, - 2, 0, 0, 0, 15, 0, 0, 0, -104, 0, 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 3, 0, 0, 0, - 3, 0, 0, 0, 15, 0, 0, 0, - 83, 86, 95, 84, 97, 114, 103, 101, -116, 0, 171, 171, 68, 88, 66, 67, - 29, 56, 85, 83, 131, 253, 216, 133, -161, 187, 70, 220, 103, 188, 220, 164, - 1, 0, 0, 0, 164, 4, 0, 0, - 6, 0, 0, 0, 56, 0, 0, 0, - 68, 1, 0, 0, 156, 2, 0, 0, - 24, 3, 0, 0, 232, 3, 0, 0, - 76, 4, 0, 0, 65, 111, 110, 57, - 4, 1, 0, 0, 4, 1, 0, 0, - 0, 2, 254, 255, 208, 0, 0, 0, - 52, 0, 0, 0, 1, 0, 36, 0, - 0, 0, 48, 0, 0, 0, 48, 0, - 0, 0, 36, 0, 1, 0, 48, 0, - 0, 0, 0, 0, 4, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 1, 2, 254, 255, 81, 0, 0, 5, - 5, 0, 15, 160, 0, 0, 0, 63, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 31, 0, 0, 2, - 5, 0, 0, 128, 0, 0, 15, 144, - 31, 0, 0, 2, 5, 0, 1, 128, - 1, 0, 15, 144, 9, 0, 0, 3, - 0, 0, 1, 128, 3, 0, 228, 160, - 1, 0, 228, 144, 9, 0, 0, 3, - 0, 0, 2, 128, 4, 0, 228, 160, - 1, 0, 228, 144, 2, 0, 0, 3, - 0, 0, 1, 128, 0, 0, 85, 128, - 0, 0, 0, 128, 5, 0, 0, 3, - 0, 0, 4, 192, 0, 0, 0, 128, - 5, 0, 0, 160, 9, 0, 0, 3, - 0, 0, 1, 128, 2, 0, 228, 160, - 1, 0, 228, 144, 1, 0, 0, 2, - 1, 0, 2, 128, 0, 0, 0, 129, - 9, 0, 0, 3, 1, 0, 1, 128, - 1, 0, 228, 160, 1, 0, 228, 144, - 4, 0, 0, 4, 0, 0, 3, 192, - 0, 0, 85, 128, 0, 0, 228, 160, - 1, 0, 228, 128, 1, 0, 0, 2, - 0, 0, 8, 192, 0, 0, 85, 128, - 1, 0, 0, 2, 0, 0, 15, 224, - 0, 0, 228, 144, 255, 255, 0, 0, - 83, 72, 68, 82, 80, 1, 0, 0, - 64, 0, 1, 0, 84, 0, 0, 0, - 89, 0, 0, 4, 70, 142, 32, 0, - 0, 0, 0, 0, 4, 0, 0, 0, - 95, 0, 0, 3, 242, 16, 16, 0, - 0, 0, 0, 0, 95, 0, 0, 3, -242, 16, 16, 0, 1, 0, 0, 0, -101, 0, 0, 3, 242, 32, 16, 0, - 0, 0, 0, 0, 103, 0, 0, 4, -242, 32, 16, 0, 1, 0, 0, 0, - 1, 0, 0, 0, 104, 0, 0, 2, - 1, 0, 0, 0, 54, 0, 0, 5, -242, 32, 16, 0, 0, 0, 0, 0, - 70, 30, 16, 0, 0, 0, 0, 0, - 17, 0, 0, 8, 18, 0, 16, 0, - 0, 0, 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 1, 0, 0, 0, - 70, 30, 16, 0, 1, 0, 0, 0, - 54, 0, 0, 6, 34, 32, 16, 0, - 1, 0, 0, 0, 10, 0, 16, 128, - 65, 0, 0, 0, 0, 0, 0, 0, - 17, 0, 0, 8, 18, 0, 16, 0, - 0, 0, 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 2, 0, 0, 0, - 70, 30, 16, 0, 1, 0, 0, 0, - 17, 0, 0, 8, 34, 0, 16, 0, - 0, 0, 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 3, 0, 0, 0, - 70, 30, 16, 0, 1, 0, 0, 0, - 0, 0, 0, 7, 18, 0, 16, 0, - 0, 0, 0, 0, 26, 0, 16, 0, - 0, 0, 0, 0, 10, 0, 16, 0, - 0, 0, 0, 0, 54, 0, 0, 5, -130, 32, 16, 0, 1, 0, 0, 0, - 26, 0, 16, 0, 0, 0, 0, 0, - 56, 0, 0, 7, 66, 32, 16, 0, - 1, 0, 0, 0, 10, 0, 16, 0, - 0, 0, 0, 0, 1, 64, 0, 0, - 0, 0, 0, 63, 17, 0, 0, 8, - 18, 32, 16, 0, 1, 0, 0, 0, - 70, 142, 32, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 70, 30, 16, 0, - 1, 0, 0, 0, 62, 0, 0, 1, - 83, 84, 65, 84, 116, 0, 0, 0, - 10, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 4, 0, 0, 0, - 7, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 2, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 82, 68, 69, 70, -200, 0, 0, 0, 1, 0, 0, 0, - 72, 0, 0, 0, 1, 0, 0, 0, - 28, 0, 0, 0, 0, 4, 254, 255, - 0, 65, 0, 0, 148, 0, 0, 0, - 60, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, - 36, 71, 108, 111, 98, 97, 108, 115, - 0, 171, 171, 171, 60, 0, 0, 0, - 1, 0, 0, 0, 96, 0, 0, 0, - 64, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 120, 0, 0, 0, - 0, 0, 0, 0, 64, 0, 0, 0, - 2, 0, 0, 0, 132, 0, 0, 0, - 0, 0, 0, 0, 95, 67, 67, 95, - 80, 77, 97, 116, 114, 105, 120, 0, - 3, 0, 3, 0, 4, 0, 4, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 77, 105, 99, 114, 111, 115, 111, 102, -116, 32, 40, 82, 41, 32, 72, 76, - 83, 76, 32, 83, 104, 97, 100, 101, -114, 32, 67, 111, 109, 112, 105, 108, -101, 114, 32, 54, 46, 51, 46, 57, - 54, 48, 48, 46, 49, 54, 51, 56, - 52, 0, 171, 171, 73, 83, 71, 78, - 92, 0, 0, 0, 3, 0, 0, 0, - 8, 0, 0, 0, 80, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 0, 0, 0, 0, - 15, 15, 0, 0, 80, 0, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 1, 0, 0, 0, - 15, 15, 0, 0, 80, 0, 0, 0, - 2, 0, 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 2, 0, 0, 0, - 3, 0, 0, 0, 84, 69, 88, 67, - 79, 79, 82, 68, 0, 171, 171, 171, - 79, 83, 71, 78, 80, 0, 0, 0, - 2, 0, 0, 0, 8, 0, 0, 0, - 56, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 15, 0, 0, 0, - 65, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 3, 0, 0, 0, - 1, 0, 0, 0, 15, 0, 0, 0, - 84, 69, 88, 67, 79, 79, 82, 68, - 0, 83, 86, 95, 80, 111, 115, 105, -116, 105, 111, 110, 0, 171, 171, 171, -}; - -const unsigned char s_993D07D70C4AE9F39EAA9EBBDFD109681386920A[] = { - -166, 147, 0, 0, 142, 9, 2, 1, - 0, 128, 0, 0, 82, 139, 0, 0, - 10, 0, 0, 0, 97, 95, 112, 111, -115, 105, 116, 105, 111, 110, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 255, 255, 255, 255, 80, 139, - 0, 0, 10, 0, 0, 0, 97, 95, -116, 101, 120, 67, 111, 111, 114, 100, - 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 255, 255, 255, 255, - 0, 0, 0, 0, 0, 0, 0, 0, -255, 255, 255, 255, 0, 0, 0, 0, - 0, 0, 0, 0, 255, 255, 255, 255, - 0, 0, 0, 0, 0, 0, 0, 0, -255, 255, 255, 255, 0, 0, 0, 0, - 0, 0, 0, 0, 255, 255, 255, 255, - 0, 0, 0, 0, 0, 0, 0, 0, -255, 255, 255, 255, 0, 0, 0, 0, - 0, 0, 0, 0, 255, 255, 255, 255, - 0, 0, 0, 0, 0, 0, 0, 0, -255, 255, 255, 255, 0, 0, 0, 0, - 0, 0, 0, 0, 255, 255, 255, 255, - 0, 0, 0, 0, 0, 0, 0, 0, -255, 255, 255, 255, 0, 0, 0, 0, - 0, 0, 0, 0, 255, 255, 255, 255, - 0, 0, 0, 0, 0, 0, 0, 0, -255, 255, 255, 255, 0, 0, 0, 0, - 0, 0, 0, 0, 255, 255, 255, 255, - 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 0, - 0, 3, 0, 0, 0, 92, 139, 0, - 0, 242, 141, 0, 0, 12, 0, 0, - 0, 67, 67, 95, 77, 86, 80, 77, - 97, 116, 114, 105, 120, 0, 0, 0, - 0, 255, 255, 255, 255, 0, 0, 0, - 0, 4, 0, 0, 0, 94, 139, 0, - 0, 0, 0, 0, 0, 11, 0, 0, - 0, 67, 67, 95, 84, 101, 120, 116, -117, 114, 101, 48, 0, 0, 0, 0, - 0, 0, 0, 0, 255, 255, 255, 255, - 1, 0, 0, 0, 82, 139, 0, 0, -240, 141, 0, 0, 7, 0, 0, 0, -117, 95, 99, 111, 108, 111, 114, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 1, 0, 0, 0, 3, - 0, 0, 0, 12, 0, 0, 0, 67, - 67, 95, 77, 86, 80, 77, 97, 116, -114, 105, 120, 0, 0, 0, 0, 0, - 0, 0, 0, 11, 0, 0, 0, 67, - 67, 95, 84, 101, 120, 116, 117, 114, -101, 48, 0, 0, 0, 0, 1, 0, - 0, 0, 7, 0, 0, 0, 117, 95, - 99, 111, 108, 111, 114, 0, 0, 0, - 0, 2, 0, 0, 0, 96, 4, 0, - 0, 144, 4, 0, 0, 0, 0, 0, - 0, 185, 153, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 68, 88, 66, 67, 157, 116, 105, - 89, 118, 135, 249, 239, 42, 226, 184, - 78, 220, 105, 236, 28, 1, 0, 0, - 0, 96, 4, 0, 0, 6, 0, 0, - 0, 56, 0, 0, 0, 228, 0, 0, - 0, 252, 1, 0, 0, 120, 2, 0, - 0, 176, 3, 0, 0, 228, 3, 0, - 0, 65, 111, 110, 57, 164, 0, 0, - 0, 164, 0, 0, 0, 0, 2, 255, -255, 112, 0, 0, 0, 52, 0, 0, - 0, 1, 0, 40, 0, 0, 0, 52, - 0, 0, 0, 52, 0, 1, 0, 36, - 0, 0, 0, 52, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, - 0, 0, 0, 0, 0, 1, 2, 255, -255, 31, 0, 0, 2, 0, 0, 0, -128, 0, 0, 3, 176, 31, 0, 0, - 2, 0, 0, 0, 144, 0, 8, 15, -160, 66, 0, 0, 3, 0, 0, 15, -128, 0, 0, 228, 176, 0, 8, 228, -160, 5, 0, 0, 3, 0, 0, 15, -128, 0, 0, 228, 128, 0, 0, 228, -160, 1, 0, 0, 2, 0, 8, 15, -128, 0, 0, 228, 128, 1, 0, 0, - 2, 1, 8, 15, 128, 0, 0, 228, -128, 1, 0, 0, 2, 2, 8, 15, -128, 0, 0, 228, 128, 1, 0, 0, - 2, 3, 8, 15, 128, 0, 0, 228, -128, 255, 255, 0, 0, 83, 72, 68, - 82, 16, 1, 0, 0, 64, 0, 0, - 0, 68, 0, 0, 0, 89, 0, 0, - 4, 70, 142, 32, 0, 0, 0, 0, - 0, 1, 0, 0, 0, 90, 0, 0, - 3, 0, 96, 16, 0, 0, 0, 0, - 0, 88, 24, 0, 4, 0, 112, 16, - 0, 0, 0, 0, 0, 85, 85, 0, - 0, 98, 16, 0, 3, 50, 16, 16, - 0, 0, 0, 0, 0, 101, 0, 0, - 3, 242, 32, 16, 0, 0, 0, 0, - 0, 101, 0, 0, 3, 242, 32, 16, - 0, 1, 0, 0, 0, 101, 0, 0, - 3, 242, 32, 16, 0, 2, 0, 0, - 0, 101, 0, 0, 3, 242, 32, 16, - 0, 3, 0, 0, 0, 104, 0, 0, - 2, 1, 0, 0, 0, 69, 0, 0, - 9, 242, 0, 16, 0, 0, 0, 0, - 0, 70, 16, 16, 0, 0, 0, 0, - 0, 70, 126, 16, 0, 0, 0, 0, - 0, 0, 96, 16, 0, 0, 0, 0, - 0, 56, 0, 0, 8, 242, 0, 16, - 0, 0, 0, 0, 0, 70, 14, 16, - 0, 0, 0, 0, 0, 70, 142, 32, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 54, 0, 0, 5, 242, 32, 16, - 0, 0, 0, 0, 0, 70, 14, 16, - 0, 0, 0, 0, 0, 54, 0, 0, - 5, 242, 32, 16, 0, 1, 0, 0, - 0, 70, 14, 16, 0, 0, 0, 0, - 0, 54, 0, 0, 5, 242, 32, 16, - 0, 2, 0, 0, 0, 70, 14, 16, - 0, 0, 0, 0, 0, 54, 0, 0, - 5, 242, 32, 16, 0, 3, 0, 0, - 0, 70, 14, 16, 0, 0, 0, 0, - 0, 62, 0, 0, 1, 83, 84, 65, - 84, 116, 0, 0, 0, 7, 0, 0, - 0, 1, 0, 0, 0, 0, 0, 0, - 0, 5, 0, 0, 0, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 4, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 82, 68, 69, 70, 48, 1, 0, - 0, 1, 0, 0, 0, 176, 0, 0, - 0, 3, 0, 0, 0, 28, 0, 0, - 0, 0, 4, 255, 255, 0, 65, 0, - 0, 252, 0, 0, 0, 124, 0, 0, - 0, 3, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, - 0, 1, 0, 0, 0, 145, 0, 0, - 0, 2, 0, 0, 0, 5, 0, 0, - 0, 4, 0, 0, 0, 255, 255, 255, -255, 0, 0, 0, 0, 1, 0, 0, - 0, 13, 0, 0, 0, 166, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, - 0, 0, 0, 0, 0, 115, 97, 109, -112, 108, 101, 114, 95, 95, 67, 67, - 95, 84, 101, 120, 116, 117, 114, 101, - 48, 0, 116, 101, 120, 116, 117, 114, -101, 95, 95, 67, 67, 95, 84, 101, -120, 116, 117, 114, 101, 48, 0, 36, - 71, 108, 111, 98, 97, 108, 115, 0, -171, 166, 0, 0, 0, 1, 0, 0, - 0, 200, 0, 0, 0, 16, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 224, 0, 0, 0, 0, 0, 0, - 0, 16, 0, 0, 0, 2, 0, 0, - 0, 236, 0, 0, 0, 0, 0, 0, - 0, 95, 117, 95, 99, 111, 108, 111, -114, 0, 171, 171, 171, 1, 0, 3, - 0, 1, 0, 4, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 77, 105, 99, -114, 111, 115, 111, 102, 116, 32, 40, - 82, 41, 32, 72, 76, 83, 76, 32, - 83, 104, 97, 100, 101, 114, 32, 67, -111, 109, 112, 105, 108, 101, 114, 32, - 54, 46, 51, 46, 57, 54, 48, 48, - 46, 49, 54, 51, 56, 52, 0, 171, -171, 73, 83, 71, 78, 44, 0, 0, - 0, 1, 0, 0, 0, 8, 0, 0, - 0, 32, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 3, 0, 0, - 0, 0, 0, 0, 0, 3, 3, 0, - 0, 84, 69, 88, 67, 79, 79, 82, - 68, 0, 171, 171, 171, 79, 83, 71, - 78, 116, 0, 0, 0, 4, 0, 0, - 0, 8, 0, 0, 0, 104, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 3, 0, 0, 0, 0, 0, 0, - 0, 15, 0, 0, 0, 104, 0, 0, - 0, 1, 0, 0, 0, 0, 0, 0, - 0, 3, 0, 0, 0, 1, 0, 0, - 0, 15, 0, 0, 0, 104, 0, 0, - 0, 2, 0, 0, 0, 0, 0, 0, - 0, 3, 0, 0, 0, 2, 0, 0, - 0, 15, 0, 0, 0, 104, 0, 0, - 0, 3, 0, 0, 0, 0, 0, 0, - 0, 3, 0, 0, 0, 3, 0, 0, - 0, 15, 0, 0, 0, 83, 86, 95, - 84, 97, 114, 103, 101, 116, 0, 171, -171, 68, 88, 66, 67, 110, 14, 140, -120, 239, 110, 56, 78, 103, 37, 245, -162, 140, 151, 93, 223, 1, 0, 0, - 0, 144, 4, 0, 0, 6, 0, 0, - 0, 56, 0, 0, 0, 68, 1, 0, - 0, 156, 2, 0, 0, 24, 3, 0, - 0, 236, 3, 0, 0, 56, 4, 0, - 0, 65, 111, 110, 57, 4, 1, 0, - 0, 4, 1, 0, 0, 0, 2, 254, -255, 208, 0, 0, 0, 52, 0, 0, - 0, 1, 0, 36, 0, 0, 0, 48, - 0, 0, 0, 48, 0, 0, 0, 36, - 0, 1, 0, 48, 0, 0, 0, 0, - 0, 4, 0, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 2, 254, -255, 81, 0, 0, 5, 5, 0, 15, -160, 0, 0, 0, 63, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 31, 0, 0, 2, 5, 0, 0, -128, 0, 0, 15, 144, 31, 0, 0, - 2, 5, 0, 1, 128, 1, 0, 15, -144, 9, 0, 0, 3, 0, 0, 1, -128, 3, 0, 228, 160, 0, 0, 228, -144, 9, 0, 0, 3, 0, 0, 2, -128, 4, 0, 228, 160, 0, 0, 228, -144, 2, 0, 0, 3, 0, 0, 1, -128, 0, 0, 85, 128, 0, 0, 0, -128, 5, 0, 0, 3, 0, 0, 4, -192, 0, 0, 0, 128, 5, 0, 0, -160, 9, 0, 0, 3, 0, 0, 1, -128, 2, 0, 228, 160, 0, 0, 228, -144, 1, 0, 0, 2, 1, 0, 2, -128, 0, 0, 0, 129, 9, 0, 0, - 3, 1, 0, 1, 128, 1, 0, 228, -160, 0, 0, 228, 144, 4, 0, 0, - 4, 0, 0, 3, 192, 0, 0, 85, -128, 0, 0, 228, 160, 1, 0, 228, -128, 1, 0, 0, 2, 0, 0, 8, -192, 0, 0, 85, 128, 1, 0, 0, - 2, 0, 0, 3, 224, 1, 0, 228, -144, 255, 255, 0, 0, 83, 72, 68, - 82, 80, 1, 0, 0, 64, 0, 1, - 0, 84, 0, 0, 0, 89, 0, 0, - 4, 70, 142, 32, 0, 0, 0, 0, - 0, 4, 0, 0, 0, 95, 0, 0, - 3, 242, 16, 16, 0, 0, 0, 0, - 0, 95, 0, 0, 3, 50, 16, 16, - 0, 1, 0, 0, 0, 101, 0, 0, - 3, 50, 32, 16, 0, 0, 0, 0, - 0, 103, 0, 0, 4, 242, 32, 16, - 0, 1, 0, 0, 0, 1, 0, 0, - 0, 104, 0, 0, 2, 1, 0, 0, - 0, 54, 0, 0, 5, 50, 32, 16, - 0, 0, 0, 0, 0, 70, 16, 16, - 0, 1, 0, 0, 0, 17, 0, 0, - 8, 18, 0, 16, 0, 0, 0, 0, - 0, 70, 142, 32, 0, 0, 0, 0, - 0, 1, 0, 0, 0, 70, 30, 16, - 0, 0, 0, 0, 0, 54, 0, 0, - 6, 34, 32, 16, 0, 1, 0, 0, - 0, 10, 0, 16, 128, 65, 0, 0, - 0, 0, 0, 0, 0, 17, 0, 0, - 8, 18, 0, 16, 0, 0, 0, 0, - 0, 70, 142, 32, 0, 0, 0, 0, - 0, 2, 0, 0, 0, 70, 30, 16, - 0, 0, 0, 0, 0, 17, 0, 0, - 8, 34, 0, 16, 0, 0, 0, 0, - 0, 70, 142, 32, 0, 0, 0, 0, - 0, 3, 0, 0, 0, 70, 30, 16, - 0, 0, 0, 0, 0, 0, 0, 0, - 7, 18, 0, 16, 0, 0, 0, 0, - 0, 26, 0, 16, 0, 0, 0, 0, - 0, 10, 0, 16, 0, 0, 0, 0, - 0, 54, 0, 0, 5, 130, 32, 16, - 0, 1, 0, 0, 0, 26, 0, 16, - 0, 0, 0, 0, 0, 56, 0, 0, - 7, 66, 32, 16, 0, 1, 0, 0, - 0, 10, 0, 16, 0, 0, 0, 0, - 0, 1, 64, 0, 0, 0, 0, 0, - 63, 17, 0, 0, 8, 18, 32, 16, - 0, 1, 0, 0, 0, 70, 142, 32, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 70, 30, 16, 0, 0, 0, 0, - 0, 62, 0, 0, 1, 83, 84, 65, - 84, 116, 0, 0, 0, 10, 0, 0, - 0, 1, 0, 0, 0, 0, 0, 0, - 0, 4, 0, 0, 0, 7, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 2, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 82, 68, 69, 70, 204, 0, 0, - 0, 1, 0, 0, 0, 72, 0, 0, - 0, 1, 0, 0, 0, 28, 0, 0, - 0, 0, 4, 254, 255, 0, 65, 0, - 0, 152, 0, 0, 0, 60, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, - 0, 0, 0, 0, 0, 36, 71, 108, -111, 98, 97, 108, 115, 0, 171, 171, -171, 60, 0, 0, 0, 1, 0, 0, - 0, 96, 0, 0, 0, 64, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 120, 0, 0, 0, 0, 0, 0, - 0, 64, 0, 0, 0, 2, 0, 0, - 0, 136, 0, 0, 0, 0, 0, 0, - 0, 95, 67, 67, 95, 77, 86, 80, - 77, 97, 116, 114, 105, 120, 0, 171, -171, 3, 0, 3, 0, 4, 0, 4, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 77, 105, 99, 114, 111, 115, 111, -102, 116, 32, 40, 82, 41, 32, 72, - 76, 83, 76, 32, 83, 104, 97, 100, -101, 114, 32, 67, 111, 109, 112, 105, -108, 101, 114, 32, 54, 46, 51, 46, - 57, 54, 48, 48, 46, 49, 54, 51, - 56, 52, 0, 171, 171, 73, 83, 71, - 78, 68, 0, 0, 0, 2, 0, 0, - 0, 8, 0, 0, 0, 56, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 3, 0, 0, 0, 0, 0, 0, - 0, 15, 15, 0, 0, 56, 0, 0, - 0, 1, 0, 0, 0, 0, 0, 0, - 0, 3, 0, 0, 0, 1, 0, 0, - 0, 3, 3, 0, 0, 84, 69, 88, - 67, 79, 79, 82, 68, 0, 171, 171, -171, 79, 83, 71, 78, 80, 0, 0, - 0, 2, 0, 0, 0, 8, 0, 0, - 0, 56, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 3, 0, 0, - 0, 0, 0, 0, 0, 3, 12, 0, - 0, 65, 0, 0, 0, 0, 0, 0, - 0, 1, 0, 0, 0, 3, 0, 0, - 0, 1, 0, 0, 0, 15, 0, 0, - 0, 84, 69, 88, 67, 79, 79, 82, - 68, 0, 83, 86, 95, 80, 111, 115, -105, 116, 105, 111, 110, 0, 171, 171, -171, -}; - -const unsigned char s_BF0A97A7CDA97B6CD0F5D1455A170F32E2538AD6[] = { - -166, 147, 0, 0, 142, 9, 2, 1, - 0, 128, 0, 0, 82, 139, 0, 0, - 10, 0, 0, 0, 97, 95, 112, 111, -115, 105, 116, 105, 111, 110, 1, 0, - 0, 0, 82, 139, 0, 0, 7, 0, - 0, 0, 97, 95, 99, 111, 108, 111, -114, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 255, 255, 255, -255, 0, 0, 0, 0, 0, 0, 0, - 0, 255, 255, 255, 255, 0, 0, 0, - 0, 0, 0, 0, 0, 255, 255, 255, -255, 0, 0, 0, 0, 0, 0, 0, - 0, 255, 255, 255, 255, 0, 0, 0, - 0, 0, 0, 0, 0, 255, 255, 255, -255, 0, 0, 0, 0, 0, 0, 0, - 0, 255, 255, 255, 255, 0, 0, 0, - 0, 0, 0, 0, 0, 255, 255, 255, -255, 0, 0, 0, 0, 0, 0, 0, - 0, 255, 255, 255, 255, 0, 0, 0, - 0, 0, 0, 0, 0, 255, 255, 255, -255, 0, 0, 0, 0, 0, 0, 0, - 0, 255, 255, 255, 255, 0, 0, 0, - 0, 0, 0, 0, 0, 255, 255, 255, -255, 0, 0, 0, 0, 0, 0, 0, - 0, 255, 255, 255, 255, 0, 0, 0, - 0, 0, 0, 0, 0, 255, 255, 255, -255, 0, 0, 0, 0, 0, 0, 0, - 0, 255, 255, 255, 255, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 92, 139, 0, 0, 242, 141, - 0, 0, 12, 0, 0, 0, 67, 67, - 95, 77, 86, 80, 77, 97, 116, 114, -105, 120, 0, 0, 0, 0, 255, 255, -255, 255, 0, 0, 0, 0, 4, 0, - 0, 0, 1, 0, 0, 0, 12, 0, - 0, 0, 67, 67, 95, 77, 86, 80, - 77, 97, 116, 114, 105, 120, 0, 0, - 0, 0, 0, 0, 0, 0, 204, 2, - 0, 0, 144, 4, 0, 0, 0, 0, - 0, 0, 185, 153, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 68, 88, 66, 67, 127, 145, - 81, 72, 216, 190, 16, 61, 245, 231, -235, 249, 125, 223, 218, 82, 1, 0, - 0, 0, 204, 2, 0, 0, 6, 0, - 0, 0, 56, 0, 0, 0, 168, 0, - 0, 0, 72, 1, 0, 0, 196, 1, - 0, 0, 28, 2, 0, 0, 80, 2, - 0, 0, 65, 111, 110, 57, 104, 0, - 0, 0, 104, 0, 0, 0, 0, 2, -255, 255, 68, 0, 0, 0, 36, 0, - 0, 0, 0, 0, 36, 0, 0, 0, - 36, 0, 0, 0, 36, 0, 0, 0, - 36, 0, 0, 0, 36, 0, 1, 2, -255, 255, 31, 0, 0, 2, 0, 0, - 0, 128, 0, 0, 15, 176, 1, 0, - 0, 2, 0, 8, 15, 128, 0, 0, -228, 176, 1, 0, 0, 2, 1, 8, - 15, 128, 0, 0, 228, 176, 1, 0, - 0, 2, 2, 8, 15, 128, 0, 0, -228, 176, 1, 0, 0, 2, 3, 8, - 15, 128, 0, 0, 228, 176, 255, 255, - 0, 0, 83, 72, 68, 82, 152, 0, - 0, 0, 64, 0, 0, 0, 38, 0, - 0, 0, 98, 16, 0, 3, 242, 16, - 16, 0, 0, 0, 0, 0, 101, 0, - 0, 3, 242, 32, 16, 0, 0, 0, - 0, 0, 101, 0, 0, 3, 242, 32, - 16, 0, 1, 0, 0, 0, 101, 0, - 0, 3, 242, 32, 16, 0, 2, 0, - 0, 0, 101, 0, 0, 3, 242, 32, - 16, 0, 3, 0, 0, 0, 54, 0, - 0, 5, 242, 32, 16, 0, 0, 0, - 0, 0, 70, 30, 16, 0, 0, 0, - 0, 0, 54, 0, 0, 5, 242, 32, - 16, 0, 1, 0, 0, 0, 70, 30, - 16, 0, 0, 0, 0, 0, 54, 0, - 0, 5, 242, 32, 16, 0, 2, 0, - 0, 0, 70, 30, 16, 0, 0, 0, - 0, 0, 54, 0, 0, 5, 242, 32, - 16, 0, 3, 0, 0, 0, 70, 30, - 16, 0, 0, 0, 0, 0, 62, 0, - 0, 1, 83, 84, 65, 84, 116, 0, - 0, 0, 5, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 5, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 4, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 82, 68, - 69, 70, 80, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 28, 0, 0, 0, 0, 4, -255, 255, 0, 65, 0, 0, 28, 0, - 0, 0, 77, 105, 99, 114, 111, 115, -111, 102, 116, 32, 40, 82, 41, 32, - 72, 76, 83, 76, 32, 83, 104, 97, -100, 101, 114, 32, 67, 111, 109, 112, -105, 108, 101, 114, 32, 54, 46, 51, - 46, 57, 54, 48, 48, 46, 49, 54, - 51, 56, 52, 0, 171, 171, 73, 83, - 71, 78, 44, 0, 0, 0, 1, 0, - 0, 0, 8, 0, 0, 0, 32, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, 0, 0, - 0, 0, 15, 15, 0, 0, 84, 69, - 88, 67, 79, 79, 82, 68, 0, 171, -171, 171, 79, 83, 71, 78, 116, 0, - 0, 0, 4, 0, 0, 0, 8, 0, - 0, 0, 104, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, 15, 0, - 0, 0, 104, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 1, 0, 0, 0, 15, 0, - 0, 0, 104, 0, 0, 0, 2, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 2, 0, 0, 0, 15, 0, - 0, 0, 104, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 3, 0, 0, 0, 15, 0, - 0, 0, 83, 86, 95, 84, 97, 114, -103, 101, 116, 0, 171, 171, 68, 88, - 66, 67, 117, 106, 232, 95, 24, 158, -125, 44, 227, 235, 60, 21, 223, 24, -110, 211, 1, 0, 0, 0, 144, 4, - 0, 0, 6, 0, 0, 0, 56, 0, - 0, 0, 68, 1, 0, 0, 156, 2, - 0, 0, 24, 3, 0, 0, 236, 3, - 0, 0, 56, 4, 0, 0, 65, 111, -110, 57, 4, 1, 0, 0, 4, 1, - 0, 0, 0, 2, 254, 255, 208, 0, - 0, 0, 52, 0, 0, 0, 1, 0, - 36, 0, 0, 0, 48, 0, 0, 0, - 48, 0, 0, 0, 36, 0, 1, 0, - 48, 0, 0, 0, 0, 0, 4, 0, - 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 2, 254, 255, 81, 0, - 0, 5, 5, 0, 15, 160, 0, 0, - 0, 63, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 31, 0, - 0, 2, 5, 0, 0, 128, 0, 0, - 15, 144, 31, 0, 0, 2, 5, 0, - 1, 128, 1, 0, 15, 144, 9, 0, - 0, 3, 0, 0, 1, 128, 3, 0, -228, 160, 1, 0, 228, 144, 9, 0, - 0, 3, 0, 0, 2, 128, 4, 0, -228, 160, 1, 0, 228, 144, 2, 0, - 0, 3, 0, 0, 1, 128, 0, 0, - 85, 128, 0, 0, 0, 128, 5, 0, - 0, 3, 0, 0, 4, 192, 0, 0, - 0, 128, 5, 0, 0, 160, 9, 0, - 0, 3, 0, 0, 1, 128, 2, 0, -228, 160, 1, 0, 228, 144, 1, 0, - 0, 2, 1, 0, 2, 128, 0, 0, - 0, 129, 9, 0, 0, 3, 1, 0, - 1, 128, 1, 0, 228, 160, 1, 0, -228, 144, 4, 0, 0, 4, 0, 0, - 3, 192, 0, 0, 85, 128, 0, 0, -228, 160, 1, 0, 228, 128, 1, 0, - 0, 2, 0, 0, 8, 192, 0, 0, - 85, 128, 1, 0, 0, 2, 0, 0, - 15, 224, 0, 0, 228, 144, 255, 255, - 0, 0, 83, 72, 68, 82, 80, 1, - 0, 0, 64, 0, 1, 0, 84, 0, - 0, 0, 89, 0, 0, 4, 70, 142, - 32, 0, 0, 0, 0, 0, 4, 0, - 0, 0, 95, 0, 0, 3, 242, 16, - 16, 0, 0, 0, 0, 0, 95, 0, - 0, 3, 242, 16, 16, 0, 1, 0, - 0, 0, 101, 0, 0, 3, 242, 32, - 16, 0, 0, 0, 0, 0, 103, 0, - 0, 4, 242, 32, 16, 0, 1, 0, - 0, 0, 1, 0, 0, 0, 104, 0, - 0, 2, 1, 0, 0, 0, 54, 0, - 0, 5, 242, 32, 16, 0, 0, 0, - 0, 0, 70, 30, 16, 0, 0, 0, - 0, 0, 17, 0, 0, 8, 18, 0, - 16, 0, 0, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 70, 30, 16, 0, 1, 0, - 0, 0, 54, 0, 0, 6, 34, 32, - 16, 0, 1, 0, 0, 0, 10, 0, - 16, 128, 65, 0, 0, 0, 0, 0, - 0, 0, 17, 0, 0, 8, 18, 0, - 16, 0, 0, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, 2, 0, - 0, 0, 70, 30, 16, 0, 1, 0, - 0, 0, 17, 0, 0, 8, 34, 0, - 16, 0, 0, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 70, 30, 16, 0, 1, 0, - 0, 0, 0, 0, 0, 7, 18, 0, - 16, 0, 0, 0, 0, 0, 26, 0, - 16, 0, 0, 0, 0, 0, 10, 0, - 16, 0, 0, 0, 0, 0, 54, 0, - 0, 5, 130, 32, 16, 0, 1, 0, - 0, 0, 26, 0, 16, 0, 0, 0, - 0, 0, 56, 0, 0, 7, 66, 32, - 16, 0, 1, 0, 0, 0, 10, 0, - 16, 0, 0, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 0, 63, 17, 0, - 0, 8, 18, 32, 16, 0, 1, 0, - 0, 0, 70, 142, 32, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 70, 30, - 16, 0, 1, 0, 0, 0, 62, 0, - 0, 1, 83, 84, 65, 84, 116, 0, - 0, 0, 10, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 4, 0, - 0, 0, 7, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 2, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 82, 68, - 69, 70, 204, 0, 0, 0, 1, 0, - 0, 0, 72, 0, 0, 0, 1, 0, - 0, 0, 28, 0, 0, 0, 0, 4, -254, 255, 0, 65, 0, 0, 152, 0, - 0, 0, 60, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 36, 71, 108, 111, 98, 97, -108, 115, 0, 171, 171, 171, 60, 0, - 0, 0, 1, 0, 0, 0, 96, 0, - 0, 0, 64, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 120, 0, - 0, 0, 0, 0, 0, 0, 64, 0, - 0, 0, 2, 0, 0, 0, 136, 0, - 0, 0, 0, 0, 0, 0, 95, 67, - 67, 95, 77, 86, 80, 77, 97, 116, -114, 105, 120, 0, 171, 171, 3, 0, - 3, 0, 4, 0, 4, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 77, 105, - 99, 114, 111, 115, 111, 102, 116, 32, - 40, 82, 41, 32, 72, 76, 83, 76, - 32, 83, 104, 97, 100, 101, 114, 32, - 67, 111, 109, 112, 105, 108, 101, 114, - 32, 54, 46, 51, 46, 57, 54, 48, - 48, 46, 49, 54, 51, 56, 52, 0, -171, 171, 73, 83, 71, 78, 68, 0, - 0, 0, 2, 0, 0, 0, 8, 0, - 0, 0, 56, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, 15, 15, - 0, 0, 56, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 1, 0, 0, 0, 15, 15, - 0, 0, 84, 69, 88, 67, 79, 79, - 82, 68, 0, 171, 171, 171, 79, 83, - 71, 78, 80, 0, 0, 0, 2, 0, - 0, 0, 8, 0, 0, 0, 56, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, 0, 0, - 0, 0, 15, 0, 0, 0, 65, 0, - 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 3, 0, 0, 0, 1, 0, - 0, 0, 15, 0, 0, 0, 84, 69, - 88, 67, 79, 79, 82, 68, 0, 83, - 86, 95, 80, 111, 115, 105, 116, 105, -111, 110, 0, 171, 171, 171, -}; - -const unsigned char s_CE141D74B59548C43E99D183312791C6F429C37D[] = { - -166, 147, 0, 0, 142, 9, 2, 1, - 0, 128, 0, 0, 82, 139, 0, 0, - 10, 0, 0, 0, 97, 95, 112, 111, -115, 105, 116, 105, 111, 110, 1, 0, - 0, 0, 82, 139, 0, 0, 7, 0, - 0, 0, 97, 95, 99, 111, 108, 111, -114, 0, 0, 0, 0, 80, 139, 0, - 0, 10, 0, 0, 0, 97, 95, 116, -101, 120, 67, 111, 111, 114, 100, 2, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 1, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 0, 0, 0, 0, - 2, 0, 0, 0, 92, 139, 0, 0, -242, 141, 0, 0, 12, 0, 0, 0, - 67, 67, 95, 77, 86, 80, 77, 97, -116, 114, 105, 120, 0, 0, 0, 0, -255, 255, 255, 255, 0, 0, 0, 0, - 4, 0, 0, 0, 94, 139, 0, 0, - 0, 0, 0, 0, 11, 0, 0, 0, - 67, 67, 95, 84, 101, 120, 116, 117, -114, 101, 48, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 1, - 0, 0, 0, 2, 0, 0, 0, 12, - 0, 0, 0, 67, 67, 95, 77, 86, - 80, 77, 97, 116, 114, 105, 120, 0, - 0, 0, 0, 0, 0, 0, 0, 11, - 0, 0, 0, 67, 67, 95, 84, 101, -120, 116, 117, 114, 101, 48, 0, 0, - 0, 0, 1, 0, 0, 0, 248, 3, - 0, 0, 4, 5, 0, 0, 0, 0, - 0, 0, 185, 153, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 68, 88, 66, 67, 11, 95, - 74, 206, 145, 124, 32, 219, 67, 19, - 26, 23, 189, 75, 35, 86, 1, 0, - 0, 0, 248, 3, 0, 0, 6, 0, - 0, 0, 56, 0, 0, 0, 228, 0, - 0, 0, 244, 1, 0, 0, 112, 2, - 0, 0, 48, 3, 0, 0, 124, 3, - 0, 0, 65, 111, 110, 57, 164, 0, - 0, 0, 164, 0, 0, 0, 0, 2, -255, 255, 124, 0, 0, 0, 40, 0, - 0, 0, 0, 0, 40, 0, 0, 0, - 40, 0, 0, 0, 40, 0, 1, 0, - 36, 0, 0, 0, 40, 0, 0, 0, - 0, 0, 1, 2, 255, 255, 31, 0, - 0, 2, 0, 0, 0, 128, 0, 0, - 15, 176, 31, 0, 0, 2, 0, 0, - 0, 128, 1, 0, 3, 176, 31, 0, - 0, 2, 0, 0, 0, 144, 0, 8, - 15, 160, 66, 0, 0, 3, 0, 0, - 15, 128, 1, 0, 228, 176, 0, 8, -228, 160, 5, 0, 0, 3, 0, 0, - 15, 128, 0, 0, 228, 128, 0, 0, -228, 176, 1, 0, 0, 2, 0, 8, - 15, 128, 0, 0, 228, 128, 1, 0, - 0, 2, 1, 8, 15, 128, 0, 0, -228, 128, 1, 0, 0, 2, 2, 8, - 15, 128, 0, 0, 228, 128, 1, 0, - 0, 2, 3, 8, 15, 128, 0, 0, -228, 128, 255, 255, 0, 0, 83, 72, - 68, 82, 8, 1, 0, 0, 64, 0, - 0, 0, 66, 0, 0, 0, 90, 0, - 0, 3, 0, 96, 16, 0, 0, 0, - 0, 0, 88, 24, 0, 4, 0, 112, - 16, 0, 0, 0, 0, 0, 85, 85, - 0, 0, 98, 16, 0, 3, 242, 16, - 16, 0, 0, 0, 0, 0, 98, 16, - 0, 3, 50, 16, 16, 0, 1, 0, - 0, 0, 101, 0, 0, 3, 242, 32, - 16, 0, 0, 0, 0, 0, 101, 0, - 0, 3, 242, 32, 16, 0, 1, 0, - 0, 0, 101, 0, 0, 3, 242, 32, - 16, 0, 2, 0, 0, 0, 101, 0, - 0, 3, 242, 32, 16, 0, 3, 0, - 0, 0, 104, 0, 0, 2, 1, 0, - 0, 0, 69, 0, 0, 9, 242, 0, - 16, 0, 0, 0, 0, 0, 70, 16, - 16, 0, 1, 0, 0, 0, 70, 126, - 16, 0, 0, 0, 0, 0, 0, 96, - 16, 0, 0, 0, 0, 0, 56, 0, - 0, 7, 242, 0, 16, 0, 0, 0, - 0, 0, 70, 14, 16, 0, 0, 0, - 0, 0, 70, 30, 16, 0, 0, 0, - 0, 0, 54, 0, 0, 5, 242, 32, - 16, 0, 0, 0, 0, 0, 70, 14, - 16, 0, 0, 0, 0, 0, 54, 0, - 0, 5, 242, 32, 16, 0, 1, 0, - 0, 0, 70, 14, 16, 0, 0, 0, - 0, 0, 54, 0, 0, 5, 242, 32, - 16, 0, 2, 0, 0, 0, 70, 14, - 16, 0, 0, 0, 0, 0, 54, 0, - 0, 5, 242, 32, 16, 0, 3, 0, - 0, 0, 70, 14, 16, 0, 0, 0, - 0, 0, 62, 0, 0, 1, 83, 84, - 65, 84, 116, 0, 0, 0, 7, 0, - 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 6, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 4, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 82, 68, 69, 70, 184, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 2, 0, 0, 0, 28, 0, - 0, 0, 0, 4, 255, 255, 0, 65, - 0, 0, 134, 0, 0, 0, 92, 0, - 0, 0, 3, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 1, 0, 0, 0, 113, 0, - 0, 0, 2, 0, 0, 0, 5, 0, - 0, 0, 4, 0, 0, 0, 255, 255, -255, 255, 0, 0, 0, 0, 1, 0, - 0, 0, 13, 0, 0, 0, 115, 97, -109, 112, 108, 101, 114, 95, 95, 67, - 67, 95, 84, 101, 120, 116, 117, 114, -101, 48, 0, 116, 101, 120, 116, 117, -114, 101, 95, 95, 67, 67, 95, 84, -101, 120, 116, 117, 114, 101, 48, 0, - 77, 105, 99, 114, 111, 115, 111, 102, -116, 32, 40, 82, 41, 32, 72, 76, - 83, 76, 32, 83, 104, 97, 100, 101, -114, 32, 67, 111, 109, 112, 105, 108, -101, 114, 32, 54, 46, 51, 46, 57, - 54, 48, 48, 46, 49, 54, 51, 56, - 52, 0, 73, 83, 71, 78, 68, 0, - 0, 0, 2, 0, 0, 0, 8, 0, - 0, 0, 56, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, 15, 15, - 0, 0, 56, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 1, 0, 0, 0, 3, 3, - 0, 0, 84, 69, 88, 67, 79, 79, - 82, 68, 0, 171, 171, 171, 79, 83, - 71, 78, 116, 0, 0, 0, 4, 0, - 0, 0, 8, 0, 0, 0, 104, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, 0, 0, - 0, 0, 15, 0, 0, 0, 104, 0, - 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, 1, 0, - 0, 0, 15, 0, 0, 0, 104, 0, - 0, 0, 2, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, 2, 0, - 0, 0, 15, 0, 0, 0, 104, 0, - 0, 0, 3, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, 3, 0, - 0, 0, 15, 0, 0, 0, 83, 86, - 95, 84, 97, 114, 103, 101, 116, 0, -171, 171, 68, 88, 66, 67, 235, 56, -180, 223, 125, 231, 231, 218, 70, 75, - 12, 63, 200, 233, 69, 121, 1, 0, - 0, 0, 4, 5, 0, 0, 6, 0, - 0, 0, 56, 0, 0, 0, 92, 1, - 0, 0, 224, 2, 0, 0, 92, 3, - 0, 0, 48, 4, 0, 0, 148, 4, - 0, 0, 65, 111, 110, 57, 28, 1, - 0, 0, 28, 1, 0, 0, 0, 2, -254, 255, 232, 0, 0, 0, 52, 0, - 0, 0, 1, 0, 36, 0, 0, 0, - 48, 0, 0, 0, 48, 0, 0, 0, - 36, 0, 1, 0, 48, 0, 0, 0, - 0, 0, 4, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 2, -254, 255, 81, 0, 0, 5, 5, 0, - 15, 160, 0, 0, 0, 63, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 31, 0, 0, 2, 5, 0, - 0, 128, 0, 0, 15, 144, 31, 0, - 0, 2, 5, 0, 1, 128, 1, 0, - 15, 144, 31, 0, 0, 2, 5, 0, - 2, 128, 2, 0, 15, 144, 9, 0, - 0, 3, 0, 0, 1, 128, 3, 0, -228, 160, 1, 0, 228, 144, 9, 0, - 0, 3, 0, 0, 2, 128, 4, 0, -228, 160, 1, 0, 228, 144, 2, 0, - 0, 3, 0, 0, 1, 128, 0, 0, - 85, 128, 0, 0, 0, 128, 5, 0, - 0, 3, 0, 0, 4, 192, 0, 0, - 0, 128, 5, 0, 0, 160, 9, 0, - 0, 3, 0, 0, 1, 128, 2, 0, -228, 160, 1, 0, 228, 144, 1, 0, - 0, 2, 1, 0, 2, 128, 0, 0, - 0, 129, 9, 0, 0, 3, 1, 0, - 1, 128, 1, 0, 228, 160, 1, 0, -228, 144, 4, 0, 0, 4, 0, 0, - 3, 192, 0, 0, 85, 128, 0, 0, -228, 160, 1, 0, 228, 128, 1, 0, - 0, 2, 0, 0, 8, 192, 0, 0, - 85, 128, 1, 0, 0, 2, 0, 0, - 15, 224, 0, 0, 228, 144, 1, 0, - 0, 2, 1, 0, 3, 224, 2, 0, -228, 144, 255, 255, 0, 0, 83, 72, - 68, 82, 124, 1, 0, 0, 64, 0, - 1, 0, 95, 0, 0, 0, 89, 0, - 0, 4, 70, 142, 32, 0, 0, 0, - 0, 0, 4, 0, 0, 0, 95, 0, - 0, 3, 242, 16, 16, 0, 0, 0, - 0, 0, 95, 0, 0, 3, 242, 16, - 16, 0, 1, 0, 0, 0, 95, 0, - 0, 3, 50, 16, 16, 0, 2, 0, - 0, 0, 101, 0, 0, 3, 242, 32, - 16, 0, 0, 0, 0, 0, 101, 0, - 0, 3, 50, 32, 16, 0, 1, 0, - 0, 0, 103, 0, 0, 4, 242, 32, - 16, 0, 2, 0, 0, 0, 1, 0, - 0, 0, 104, 0, 0, 2, 1, 0, - 0, 0, 54, 0, 0, 5, 242, 32, - 16, 0, 0, 0, 0, 0, 70, 30, - 16, 0, 0, 0, 0, 0, 54, 0, - 0, 5, 50, 32, 16, 0, 1, 0, - 0, 0, 70, 16, 16, 0, 2, 0, - 0, 0, 17, 0, 0, 8, 18, 0, - 16, 0, 0, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 70, 30, 16, 0, 1, 0, - 0, 0, 54, 0, 0, 6, 34, 32, - 16, 0, 2, 0, 0, 0, 10, 0, - 16, 128, 65, 0, 0, 0, 0, 0, - 0, 0, 17, 0, 0, 8, 18, 0, - 16, 0, 0, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, 2, 0, - 0, 0, 70, 30, 16, 0, 1, 0, - 0, 0, 17, 0, 0, 8, 34, 0, - 16, 0, 0, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 70, 30, 16, 0, 1, 0, - 0, 0, 0, 0, 0, 7, 18, 0, - 16, 0, 0, 0, 0, 0, 26, 0, - 16, 0, 0, 0, 0, 0, 10, 0, - 16, 0, 0, 0, 0, 0, 54, 0, - 0, 5, 130, 32, 16, 0, 2, 0, - 0, 0, 26, 0, 16, 0, 0, 0, - 0, 0, 56, 0, 0, 7, 66, 32, - 16, 0, 2, 0, 0, 0, 10, 0, - 16, 0, 0, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 0, 63, 17, 0, - 0, 8, 18, 32, 16, 0, 2, 0, - 0, 0, 70, 142, 32, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 70, 30, - 16, 0, 1, 0, 0, 0, 62, 0, - 0, 1, 83, 84, 65, 84, 116, 0, - 0, 0, 11, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 6, 0, - 0, 0, 7, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 82, 68, - 69, 70, 204, 0, 0, 0, 1, 0, - 0, 0, 72, 0, 0, 0, 1, 0, - 0, 0, 28, 0, 0, 0, 0, 4, -254, 255, 0, 65, 0, 0, 152, 0, - 0, 0, 60, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 36, 71, 108, 111, 98, 97, -108, 115, 0, 171, 171, 171, 60, 0, - 0, 0, 1, 0, 0, 0, 96, 0, - 0, 0, 64, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 120, 0, - 0, 0, 0, 0, 0, 0, 64, 0, - 0, 0, 2, 0, 0, 0, 136, 0, - 0, 0, 0, 0, 0, 0, 95, 67, - 67, 95, 77, 86, 80, 77, 97, 116, -114, 105, 120, 0, 171, 171, 3, 0, - 3, 0, 4, 0, 4, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 77, 105, - 99, 114, 111, 115, 111, 102, 116, 32, - 40, 82, 41, 32, 72, 76, 83, 76, - 32, 83, 104, 97, 100, 101, 114, 32, - 67, 111, 109, 112, 105, 108, 101, 114, - 32, 54, 46, 51, 46, 57, 54, 48, - 48, 46, 49, 54, 51, 56, 52, 0, -171, 171, 73, 83, 71, 78, 92, 0, - 0, 0, 3, 0, 0, 0, 8, 0, - 0, 0, 80, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, 15, 15, - 0, 0, 80, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 1, 0, 0, 0, 15, 15, - 0, 0, 80, 0, 0, 0, 2, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 2, 0, 0, 0, 3, 3, - 0, 0, 84, 69, 88, 67, 79, 79, - 82, 68, 0, 171, 171, 171, 79, 83, - 71, 78, 104, 0, 0, 0, 3, 0, - 0, 0, 8, 0, 0, 0, 80, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, 0, 0, - 0, 0, 15, 0, 0, 0, 80, 0, - 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, 1, 0, - 0, 0, 3, 12, 0, 0, 89, 0, - 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 3, 0, 0, 0, 2, 0, - 0, 0, 15, 0, 0, 0, 84, 69, - 88, 67, 79, 79, 82, 68, 0, 83, - 86, 95, 80, 111, 115, 105, 116, 105, -111, 110, 0, 171, 171, 171, -}; - -const unsigned char s_DB22823528A225B43DABEF012B299639D233D54C[] = { - -166, 147, 0, 0, 142, 9, 2, 1, - 0, 128, 0, 0, 82, 139, 0, 0, - 10, 0, 0, 0, 97, 95, 112, 111, -115, 105, 116, 105, 111, 110, 1, 0, - 0, 0, 82, 139, 0, 0, 7, 0, - 0, 0, 97, 95, 99, 111, 108, 111, -114, 0, 0, 0, 0, 80, 139, 0, - 0, 10, 0, 0, 0, 97, 95, 116, -101, 120, 67, 111, 111, 114, 100, 2, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 1, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 0, 0, 0, 0, - 3, 0, 0, 0, 92, 139, 0, 0, -242, 141, 0, 0, 10, 0, 0, 0, - 67, 67, 95, 80, 77, 97, 116, 114, -105, 120, 0, 0, 0, 0, 255, 255, -255, 255, 0, 0, 0, 0, 4, 0, - 0, 0, 94, 139, 0, 0, 0, 0, - 0, 0, 11, 0, 0, 0, 67, 67, - 95, 84, 101, 120, 116, 117, 114, 101, - 48, 0, 0, 0, 0, 0, 0, 0, - 0, 255, 255, 255, 255, 1, 0, 0, - 0, 6, 20, 0, 0, 240, 141, 0, - 0, 14, 0, 0, 0, 67, 67, 95, - 97, 108, 112, 104, 97, 95, 118, 97, -108, 117, 101, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 1, - 0, 0, 0, 3, 0, 0, 0, 10, - 0, 0, 0, 67, 67, 95, 80, 77, - 97, 116, 114, 105, 120, 0, 0, 0, - 0, 0, 0, 0, 0, 11, 0, 0, - 0, 67, 67, 95, 84, 101, 120, 116, -117, 114, 101, 48, 0, 0, 0, 0, - 1, 0, 0, 0, 14, 0, 0, 0, - 67, 67, 95, 97, 108, 112, 104, 97, - 95, 118, 97, 108, 117, 101, 0, 0, - 0, 0, 2, 0, 0, 0, 36, 5, - 0, 0, 0, 5, 0, 0, 0, 0, - 0, 0, 185, 153, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 68, 88, 66, 67, 100, 113, -175, 29, 164, 71, 177, 78, 120, 99, -172, 209, 227, 249, 113, 132, 1, 0, - 0, 0, 36, 5, 0, 0, 6, 0, - 0, 0, 56, 0, 0, 0, 88, 1, - 0, 0, 164, 2, 0, 0, 32, 3, - 0, 0, 92, 4, 0, 0, 168, 4, - 0, 0, 65, 111, 110, 57, 24, 1, - 0, 0, 24, 1, 0, 0, 0, 2, -255, 255, 228, 0, 0, 0, 52, 0, - 0, 0, 1, 0, 40, 0, 0, 0, - 52, 0, 0, 0, 52, 0, 1, 0, - 36, 0, 0, 0, 52, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 1, 2, -255, 255, 81, 0, 0, 5, 1, 0, - 15, 160, 0, 0, 128, 191, 0, 0, - 0, 128, 0, 0, 0, 0, 0, 0, - 0, 0, 31, 0, 0, 2, 0, 0, - 0, 128, 0, 0, 15, 176, 31, 0, - 0, 2, 0, 0, 0, 128, 1, 0, - 3, 176, 31, 0, 0, 2, 0, 0, - 0, 144, 0, 8, 15, 160, 66, 0, - 0, 3, 0, 0, 15, 128, 1, 0, -228, 176, 0, 8, 228, 160, 2, 0, - 0, 3, 1, 0, 8, 128, 0, 0, -255, 129, 0, 0, 0, 160, 88, 0, - 0, 4, 1, 0, 15, 128, 1, 0, -255, 128, 1, 0, 0, 160, 1, 0, - 85, 160, 65, 0, 0, 1, 1, 0, - 15, 128, 5, 0, 0, 3, 0, 0, - 15, 128, 0, 0, 228, 128, 0, 0, -228, 176, 1, 0, 0, 2, 1, 0, - 15, 128, 0, 0, 228, 128, 1, 0, - 0, 2, 2, 0, 15, 128, 0, 0, -228, 128, 1, 0, 0, 2, 3, 0, - 15, 128, 0, 0, 228, 128, 1, 0, - 0, 2, 0, 8, 15, 128, 1, 0, -228, 128, 1, 0, 0, 2, 1, 8, - 15, 128, 2, 0, 228, 128, 1, 0, - 0, 2, 2, 8, 15, 128, 3, 0, -228, 128, 1, 0, 0, 2, 3, 8, - 15, 128, 0, 0, 228, 128, 255, 255, - 0, 0, 83, 72, 68, 82, 68, 1, - 0, 0, 64, 0, 0, 0, 81, 0, - 0, 0, 89, 0, 0, 4, 70, 142, - 32, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 90, 0, 0, 3, 0, 96, - 16, 0, 0, 0, 0, 0, 88, 24, - 0, 4, 0, 112, 16, 0, 0, 0, - 0, 0, 85, 85, 0, 0, 98, 16, - 0, 3, 242, 16, 16, 0, 0, 0, - 0, 0, 98, 16, 0, 3, 50, 16, - 16, 0, 1, 0, 0, 0, 101, 0, - 0, 3, 242, 32, 16, 0, 0, 0, - 0, 0, 101, 0, 0, 3, 242, 32, - 16, 0, 1, 0, 0, 0, 101, 0, - 0, 3, 242, 32, 16, 0, 2, 0, - 0, 0, 101, 0, 0, 3, 242, 32, - 16, 0, 3, 0, 0, 0, 104, 0, - 0, 2, 2, 0, 0, 0, 69, 0, - 0, 9, 242, 0, 16, 0, 0, 0, - 0, 0, 70, 16, 16, 0, 1, 0, - 0, 0, 70, 126, 16, 0, 0, 0, - 0, 0, 0, 96, 16, 0, 0, 0, - 0, 0, 29, 0, 0, 8, 18, 0, - 16, 0, 1, 0, 0, 0, 10, 128, - 32, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 58, 0, 16, 0, 0, 0, - 0, 0, 13, 0, 4, 3, 10, 0, - 16, 0, 1, 0, 0, 0, 56, 0, - 0, 7, 242, 0, 16, 0, 0, 0, - 0, 0, 70, 14, 16, 0, 0, 0, - 0, 0, 70, 30, 16, 0, 0, 0, - 0, 0, 54, 0, 0, 5, 242, 32, - 16, 0, 0, 0, 0, 0, 70, 14, - 16, 0, 0, 0, 0, 0, 54, 0, - 0, 5, 242, 32, 16, 0, 1, 0, - 0, 0, 70, 14, 16, 0, 0, 0, - 0, 0, 54, 0, 0, 5, 242, 32, - 16, 0, 2, 0, 0, 0, 70, 14, - 16, 0, 0, 0, 0, 0, 54, 0, - 0, 5, 242, 32, 16, 0, 3, 0, - 0, 0, 70, 14, 16, 0, 0, 0, - 0, 0, 62, 0, 0, 1, 83, 84, - 65, 84, 116, 0, 0, 0, 9, 0, - 0, 0, 2, 0, 0, 0, 0, 0, - 0, 0, 6, 0, 0, 0, 2, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 4, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 82, 68, 69, 70, 52, 1, - 0, 0, 1, 0, 0, 0, 176, 0, - 0, 0, 3, 0, 0, 0, 28, 0, - 0, 0, 0, 4, 255, 255, 0, 65, - 0, 0, 0, 1, 0, 0, 124, 0, - 0, 0, 3, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 1, 0, 0, 0, 145, 0, - 0, 0, 2, 0, 0, 0, 5, 0, - 0, 0, 4, 0, 0, 0, 255, 255, -255, 255, 0, 0, 0, 0, 1, 0, - 0, 0, 13, 0, 0, 0, 166, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 115, 97, -109, 112, 108, 101, 114, 95, 95, 67, - 67, 95, 84, 101, 120, 116, 117, 114, -101, 48, 0, 116, 101, 120, 116, 117, -114, 101, 95, 95, 67, 67, 95, 84, -101, 120, 116, 117, 114, 101, 48, 0, - 36, 71, 108, 111, 98, 97, 108, 115, - 0, 171, 166, 0, 0, 0, 1, 0, - 0, 0, 200, 0, 0, 0, 16, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 224, 0, 0, 0, 0, 0, - 0, 0, 4, 0, 0, 0, 2, 0, - 0, 0, 240, 0, 0, 0, 0, 0, - 0, 0, 95, 67, 67, 95, 97, 108, -112, 104, 97, 95, 118, 97, 108, 117, -101, 0, 0, 0, 3, 0, 1, 0, - 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 77, 105, 99, 114, 111, 115, -111, 102, 116, 32, 40, 82, 41, 32, - 72, 76, 83, 76, 32, 83, 104, 97, -100, 101, 114, 32, 67, 111, 109, 112, -105, 108, 101, 114, 32, 54, 46, 51, - 46, 57, 54, 48, 48, 46, 49, 54, - 51, 56, 52, 0, 171, 171, 73, 83, - 71, 78, 68, 0, 0, 0, 2, 0, - 0, 0, 8, 0, 0, 0, 56, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, 0, 0, - 0, 0, 15, 15, 0, 0, 56, 0, - 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, 1, 0, - 0, 0, 3, 3, 0, 0, 84, 69, - 88, 67, 79, 79, 82, 68, 0, 171, -171, 171, 79, 83, 71, 78, 116, 0, - 0, 0, 4, 0, 0, 0, 8, 0, - 0, 0, 104, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, 15, 0, - 0, 0, 104, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 1, 0, 0, 0, 15, 0, - 0, 0, 104, 0, 0, 0, 2, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 2, 0, 0, 0, 15, 0, - 0, 0, 104, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 3, 0, 0, 0, 15, 0, - 0, 0, 83, 86, 95, 84, 97, 114, -103, 101, 116, 0, 171, 171, 68, 88, - 66, 67, 53, 89, 218, 251, 179, 193, -226, 187, 197, 89, 218, 37, 36, 176, -206, 80, 1, 0, 0, 0, 0, 5, - 0, 0, 6, 0, 0, 0, 56, 0, - 0, 0, 92, 1, 0, 0, 224, 2, - 0, 0, 92, 3, 0, 0, 44, 4, - 0, 0, 144, 4, 0, 0, 65, 111, -110, 57, 28, 1, 0, 0, 28, 1, - 0, 0, 0, 2, 254, 255, 232, 0, - 0, 0, 52, 0, 0, 0, 1, 0, - 36, 0, 0, 0, 48, 0, 0, 0, - 48, 0, 0, 0, 36, 0, 1, 0, - 48, 0, 0, 0, 0, 0, 4, 0, - 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 2, 254, 255, 81, 0, - 0, 5, 5, 0, 15, 160, 0, 0, - 0, 63, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 31, 0, - 0, 2, 5, 0, 0, 128, 0, 0, - 15, 144, 31, 0, 0, 2, 5, 0, - 1, 128, 1, 0, 15, 144, 31, 0, - 0, 2, 5, 0, 2, 128, 2, 0, - 15, 144, 9, 0, 0, 3, 0, 0, - 1, 128, 3, 0, 228, 160, 1, 0, -228, 144, 9, 0, 0, 3, 0, 0, - 2, 128, 4, 0, 228, 160, 1, 0, -228, 144, 2, 0, 0, 3, 0, 0, - 1, 128, 0, 0, 85, 128, 0, 0, - 0, 128, 5, 0, 0, 3, 0, 0, - 4, 192, 0, 0, 0, 128, 5, 0, - 0, 160, 9, 0, 0, 3, 0, 0, - 1, 128, 2, 0, 228, 160, 1, 0, -228, 144, 1, 0, 0, 2, 1, 0, - 2, 128, 0, 0, 0, 129, 9, 0, - 0, 3, 1, 0, 1, 128, 1, 0, -228, 160, 1, 0, 228, 144, 4, 0, - 0, 4, 0, 0, 3, 192, 0, 0, - 85, 128, 0, 0, 228, 160, 1, 0, -228, 128, 1, 0, 0, 2, 0, 0, - 8, 192, 0, 0, 85, 128, 1, 0, - 0, 2, 0, 0, 15, 224, 0, 0, -228, 144, 1, 0, 0, 2, 1, 0, - 3, 224, 2, 0, 228, 144, 255, 255, - 0, 0, 83, 72, 68, 82, 124, 1, - 0, 0, 64, 0, 1, 0, 95, 0, - 0, 0, 89, 0, 0, 4, 70, 142, - 32, 0, 0, 0, 0, 0, 4, 0, - 0, 0, 95, 0, 0, 3, 242, 16, - 16, 0, 0, 0, 0, 0, 95, 0, - 0, 3, 242, 16, 16, 0, 1, 0, - 0, 0, 95, 0, 0, 3, 50, 16, - 16, 0, 2, 0, 0, 0, 101, 0, - 0, 3, 242, 32, 16, 0, 0, 0, - 0, 0, 101, 0, 0, 3, 50, 32, - 16, 0, 1, 0, 0, 0, 103, 0, - 0, 4, 242, 32, 16, 0, 2, 0, - 0, 0, 1, 0, 0, 0, 104, 0, - 0, 2, 1, 0, 0, 0, 54, 0, - 0, 5, 242, 32, 16, 0, 0, 0, - 0, 0, 70, 30, 16, 0, 0, 0, - 0, 0, 54, 0, 0, 5, 50, 32, - 16, 0, 1, 0, 0, 0, 70, 16, - 16, 0, 2, 0, 0, 0, 17, 0, - 0, 8, 18, 0, 16, 0, 0, 0, - 0, 0, 70, 142, 32, 0, 0, 0, - 0, 0, 1, 0, 0, 0, 70, 30, - 16, 0, 1, 0, 0, 0, 54, 0, - 0, 6, 34, 32, 16, 0, 2, 0, - 0, 0, 10, 0, 16, 128, 65, 0, - 0, 0, 0, 0, 0, 0, 17, 0, - 0, 8, 18, 0, 16, 0, 0, 0, - 0, 0, 70, 142, 32, 0, 0, 0, - 0, 0, 2, 0, 0, 0, 70, 30, - 16, 0, 1, 0, 0, 0, 17, 0, - 0, 8, 34, 0, 16, 0, 0, 0, - 0, 0, 70, 142, 32, 0, 0, 0, - 0, 0, 3, 0, 0, 0, 70, 30, - 16, 0, 1, 0, 0, 0, 0, 0, - 0, 7, 18, 0, 16, 0, 0, 0, - 0, 0, 26, 0, 16, 0, 0, 0, - 0, 0, 10, 0, 16, 0, 0, 0, - 0, 0, 54, 0, 0, 5, 130, 32, - 16, 0, 2, 0, 0, 0, 26, 0, - 16, 0, 0, 0, 0, 0, 56, 0, - 0, 7, 66, 32, 16, 0, 2, 0, - 0, 0, 10, 0, 16, 0, 0, 0, - 0, 0, 1, 64, 0, 0, 0, 0, - 0, 63, 17, 0, 0, 8, 18, 32, - 16, 0, 2, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 70, 30, 16, 0, 1, 0, - 0, 0, 62, 0, 0, 1, 83, 84, - 65, 84, 116, 0, 0, 0, 11, 0, - 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 6, 0, 0, 0, 7, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 82, 68, 69, 70, 200, 0, - 0, 0, 1, 0, 0, 0, 72, 0, - 0, 0, 1, 0, 0, 0, 28, 0, - 0, 0, 0, 4, 254, 255, 0, 65, - 0, 0, 148, 0, 0, 0, 60, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 36, 71, -108, 111, 98, 97, 108, 115, 0, 171, -171, 171, 60, 0, 0, 0, 1, 0, - 0, 0, 96, 0, 0, 0, 64, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 120, 0, 0, 0, 0, 0, - 0, 0, 64, 0, 0, 0, 2, 0, - 0, 0, 132, 0, 0, 0, 0, 0, - 0, 0, 95, 67, 67, 95, 80, 77, - 97, 116, 114, 105, 120, 0, 3, 0, - 3, 0, 4, 0, 4, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 77, 105, - 99, 114, 111, 115, 111, 102, 116, 32, - 40, 82, 41, 32, 72, 76, 83, 76, - 32, 83, 104, 97, 100, 101, 114, 32, - 67, 111, 109, 112, 105, 108, 101, 114, - 32, 54, 46, 51, 46, 57, 54, 48, - 48, 46, 49, 54, 51, 56, 52, 0, -171, 171, 73, 83, 71, 78, 92, 0, - 0, 0, 3, 0, 0, 0, 8, 0, - 0, 0, 80, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, 15, 15, - 0, 0, 80, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 1, 0, 0, 0, 15, 15, - 0, 0, 80, 0, 0, 0, 2, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 2, 0, 0, 0, 3, 3, - 0, 0, 84, 69, 88, 67, 79, 79, - 82, 68, 0, 171, 171, 171, 79, 83, - 71, 78, 104, 0, 0, 0, 3, 0, - 0, 0, 8, 0, 0, 0, 80, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, 0, 0, - 0, 0, 15, 0, 0, 0, 80, 0, - 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, 1, 0, - 0, 0, 3, 12, 0, 0, 89, 0, - 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 3, 0, 0, 0, 2, 0, - 0, 0, 15, 0, 0, 0, 84, 69, - 88, 67, 79, 79, 82, 68, 0, 83, - 86, 95, 80, 111, 115, 105, 116, 105, -111, 110, 0, 171, 171, 171, -}; - -const unsigned char s_E878895044FDA49FE4D8202CE20AF49CC01A8FA9[] = { - -166, 147, 0, 0, 142, 9, 2, 1, - 0, 128, 0, 0, 82, 139, 0, 0, - 10, 0, 0, 0, 97, 95, 112, 111, -115, 105, 116, 105, 111, 110, 1, 0, - 0, 0, 82, 139, 0, 0, 7, 0, - 0, 0, 97, 95, 99, 111, 108, 111, -114, 0, 0, 0, 0, 80, 139, 0, - 0, 10, 0, 0, 0, 97, 95, 116, -101, 120, 67, 111, 111, 114, 100, 2, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 1, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 0, 0, 0, 0, - 2, 0, 0, 0, 92, 139, 0, 0, -242, 141, 0, 0, 12, 0, 0, 0, - 67, 67, 95, 77, 86, 80, 77, 97, -116, 114, 105, 120, 0, 0, 0, 0, -255, 255, 255, 255, 0, 0, 0, 0, - 4, 0, 0, 0, 94, 139, 0, 0, - 0, 0, 0, 0, 11, 0, 0, 0, - 67, 67, 95, 84, 101, 120, 116, 117, -114, 101, 48, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 1, - 0, 0, 0, 2, 0, 0, 0, 12, - 0, 0, 0, 67, 67, 95, 77, 86, - 80, 77, 97, 116, 114, 105, 120, 0, - 0, 0, 0, 0, 0, 0, 0, 11, - 0, 0, 0, 67, 67, 95, 84, 101, -120, 116, 117, 114, 101, 48, 0, 0, - 0, 0, 1, 0, 0, 0, 24, 4, - 0, 0, 4, 5, 0, 0, 0, 0, - 0, 0, 185, 153, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 68, 88, 66, 67, 200, 5, -103, 205, 248, 30, 69, 65, 32, 117, - 98, 148, 123, 240, 193, 101, 1, 0, - 0, 0, 24, 4, 0, 0, 6, 0, - 0, 0, 56, 0, 0, 0, 240, 0, - 0, 0, 20, 2, 0, 0, 144, 2, - 0, 0, 80, 3, 0, 0, 156, 3, - 0, 0, 65, 111, 110, 57, 176, 0, - 0, 0, 176, 0, 0, 0, 0, 2, -255, 255, 136, 0, 0, 0, 40, 0, - 0, 0, 0, 0, 40, 0, 0, 0, - 40, 0, 0, 0, 40, 0, 1, 0, - 36, 0, 0, 0, 40, 0, 0, 0, - 0, 0, 1, 2, 255, 255, 31, 0, - 0, 2, 0, 0, 0, 128, 0, 0, - 15, 176, 31, 0, 0, 2, 0, 0, - 0, 128, 1, 0, 3, 176, 31, 0, - 0, 2, 0, 0, 0, 144, 0, 8, - 15, 160, 66, 0, 0, 3, 0, 0, - 15, 128, 1, 0, 228, 176, 0, 8, -228, 160, 5, 0, 0, 3, 0, 0, - 8, 128, 0, 0, 255, 128, 0, 0, -255, 176, 1, 0, 0, 2, 0, 0, - 7, 128, 0, 0, 228, 176, 1, 0, - 0, 2, 0, 8, 15, 128, 0, 0, -228, 128, 1, 0, 0, 2, 1, 8, - 15, 128, 0, 0, 228, 128, 1, 0, - 0, 2, 2, 8, 15, 128, 0, 0, -228, 128, 1, 0, 0, 2, 3, 8, - 15, 128, 0, 0, 228, 128, 255, 255, - 0, 0, 83, 72, 68, 82, 28, 1, - 0, 0, 64, 0, 0, 0, 71, 0, - 0, 0, 90, 0, 0, 3, 0, 96, - 16, 0, 0, 0, 0, 0, 88, 24, - 0, 4, 0, 112, 16, 0, 0, 0, - 0, 0, 85, 85, 0, 0, 98, 16, - 0, 3, 242, 16, 16, 0, 0, 0, - 0, 0, 98, 16, 0, 3, 50, 16, - 16, 0, 1, 0, 0, 0, 101, 0, - 0, 3, 242, 32, 16, 0, 0, 0, - 0, 0, 101, 0, 0, 3, 242, 32, - 16, 0, 1, 0, 0, 0, 101, 0, - 0, 3, 242, 32, 16, 0, 2, 0, - 0, 0, 101, 0, 0, 3, 242, 32, - 16, 0, 3, 0, 0, 0, 104, 0, - 0, 2, 1, 0, 0, 0, 69, 0, - 0, 9, 242, 0, 16, 0, 0, 0, - 0, 0, 70, 16, 16, 0, 1, 0, - 0, 0, 70, 126, 16, 0, 0, 0, - 0, 0, 0, 96, 16, 0, 0, 0, - 0, 0, 56, 0, 0, 7, 130, 0, - 16, 0, 0, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, 58, 16, - 16, 0, 0, 0, 0, 0, 54, 0, - 0, 5, 114, 0, 16, 0, 0, 0, - 0, 0, 70, 18, 16, 0, 0, 0, - 0, 0, 54, 0, 0, 5, 242, 32, - 16, 0, 0, 0, 0, 0, 70, 14, - 16, 0, 0, 0, 0, 0, 54, 0, - 0, 5, 242, 32, 16, 0, 1, 0, - 0, 0, 70, 14, 16, 0, 0, 0, - 0, 0, 54, 0, 0, 5, 242, 32, - 16, 0, 2, 0, 0, 0, 70, 14, - 16, 0, 0, 0, 0, 0, 54, 0, - 0, 5, 242, 32, 16, 0, 3, 0, - 0, 0, 70, 14, 16, 0, 0, 0, - 0, 0, 62, 0, 0, 1, 83, 84, - 65, 84, 116, 0, 0, 0, 8, 0, - 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 6, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 5, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 82, 68, 69, 70, 184, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 2, 0, 0, 0, 28, 0, - 0, 0, 0, 4, 255, 255, 0, 65, - 0, 0, 134, 0, 0, 0, 92, 0, - 0, 0, 3, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 1, 0, 0, 0, 113, 0, - 0, 0, 2, 0, 0, 0, 5, 0, - 0, 0, 4, 0, 0, 0, 255, 255, -255, 255, 0, 0, 0, 0, 1, 0, - 0, 0, 13, 0, 0, 0, 115, 97, -109, 112, 108, 101, 114, 95, 95, 67, - 67, 95, 84, 101, 120, 116, 117, 114, -101, 48, 0, 116, 101, 120, 116, 117, -114, 101, 95, 95, 67, 67, 95, 84, -101, 120, 116, 117, 114, 101, 48, 0, - 77, 105, 99, 114, 111, 115, 111, 102, -116, 32, 40, 82, 41, 32, 72, 76, - 83, 76, 32, 83, 104, 97, 100, 101, -114, 32, 67, 111, 109, 112, 105, 108, -101, 114, 32, 54, 46, 51, 46, 57, - 54, 48, 48, 46, 49, 54, 51, 56, - 52, 0, 73, 83, 71, 78, 68, 0, - 0, 0, 2, 0, 0, 0, 8, 0, - 0, 0, 56, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, 15, 15, - 0, 0, 56, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 1, 0, 0, 0, 3, 3, - 0, 0, 84, 69, 88, 67, 79, 79, - 82, 68, 0, 171, 171, 171, 79, 83, - 71, 78, 116, 0, 0, 0, 4, 0, - 0, 0, 8, 0, 0, 0, 104, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, 0, 0, - 0, 0, 15, 0, 0, 0, 104, 0, - 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, 1, 0, - 0, 0, 15, 0, 0, 0, 104, 0, - 0, 0, 2, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, 2, 0, - 0, 0, 15, 0, 0, 0, 104, 0, - 0, 0, 3, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, 3, 0, - 0, 0, 15, 0, 0, 0, 83, 86, - 95, 84, 97, 114, 103, 101, 116, 0, -171, 171, 68, 88, 66, 67, 235, 56, -180, 223, 125, 231, 231, 218, 70, 75, - 12, 63, 200, 233, 69, 121, 1, 0, - 0, 0, 4, 5, 0, 0, 6, 0, - 0, 0, 56, 0, 0, 0, 92, 1, - 0, 0, 224, 2, 0, 0, 92, 3, - 0, 0, 48, 4, 0, 0, 148, 4, - 0, 0, 65, 111, 110, 57, 28, 1, - 0, 0, 28, 1, 0, 0, 0, 2, -254, 255, 232, 0, 0, 0, 52, 0, - 0, 0, 1, 0, 36, 0, 0, 0, - 48, 0, 0, 0, 48, 0, 0, 0, - 36, 0, 1, 0, 48, 0, 0, 0, - 0, 0, 4, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 2, -254, 255, 81, 0, 0, 5, 5, 0, - 15, 160, 0, 0, 0, 63, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 31, 0, 0, 2, 5, 0, - 0, 128, 0, 0, 15, 144, 31, 0, - 0, 2, 5, 0, 1, 128, 1, 0, - 15, 144, 31, 0, 0, 2, 5, 0, - 2, 128, 2, 0, 15, 144, 9, 0, - 0, 3, 0, 0, 1, 128, 3, 0, -228, 160, 1, 0, 228, 144, 9, 0, - 0, 3, 0, 0, 2, 128, 4, 0, -228, 160, 1, 0, 228, 144, 2, 0, - 0, 3, 0, 0, 1, 128, 0, 0, - 85, 128, 0, 0, 0, 128, 5, 0, - 0, 3, 0, 0, 4, 192, 0, 0, - 0, 128, 5, 0, 0, 160, 9, 0, - 0, 3, 0, 0, 1, 128, 2, 0, -228, 160, 1, 0, 228, 144, 1, 0, - 0, 2, 1, 0, 2, 128, 0, 0, - 0, 129, 9, 0, 0, 3, 1, 0, - 1, 128, 1, 0, 228, 160, 1, 0, -228, 144, 4, 0, 0, 4, 0, 0, - 3, 192, 0, 0, 85, 128, 0, 0, -228, 160, 1, 0, 228, 128, 1, 0, - 0, 2, 0, 0, 8, 192, 0, 0, - 85, 128, 1, 0, 0, 2, 0, 0, - 15, 224, 0, 0, 228, 144, 1, 0, - 0, 2, 1, 0, 3, 224, 2, 0, -228, 144, 255, 255, 0, 0, 83, 72, - 68, 82, 124, 1, 0, 0, 64, 0, - 1, 0, 95, 0, 0, 0, 89, 0, - 0, 4, 70, 142, 32, 0, 0, 0, - 0, 0, 4, 0, 0, 0, 95, 0, - 0, 3, 242, 16, 16, 0, 0, 0, - 0, 0, 95, 0, 0, 3, 242, 16, - 16, 0, 1, 0, 0, 0, 95, 0, - 0, 3, 50, 16, 16, 0, 2, 0, - 0, 0, 101, 0, 0, 3, 242, 32, - 16, 0, 0, 0, 0, 0, 101, 0, - 0, 3, 50, 32, 16, 0, 1, 0, - 0, 0, 103, 0, 0, 4, 242, 32, - 16, 0, 2, 0, 0, 0, 1, 0, - 0, 0, 104, 0, 0, 2, 1, 0, - 0, 0, 54, 0, 0, 5, 242, 32, - 16, 0, 0, 0, 0, 0, 70, 30, - 16, 0, 0, 0, 0, 0, 54, 0, - 0, 5, 50, 32, 16, 0, 1, 0, - 0, 0, 70, 16, 16, 0, 2, 0, - 0, 0, 17, 0, 0, 8, 18, 0, - 16, 0, 0, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 70, 30, 16, 0, 1, 0, - 0, 0, 54, 0, 0, 6, 34, 32, - 16, 0, 2, 0, 0, 0, 10, 0, - 16, 128, 65, 0, 0, 0, 0, 0, - 0, 0, 17, 0, 0, 8, 18, 0, - 16, 0, 0, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, 2, 0, - 0, 0, 70, 30, 16, 0, 1, 0, - 0, 0, 17, 0, 0, 8, 34, 0, - 16, 0, 0, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 70, 30, 16, 0, 1, 0, - 0, 0, 0, 0, 0, 7, 18, 0, - 16, 0, 0, 0, 0, 0, 26, 0, - 16, 0, 0, 0, 0, 0, 10, 0, - 16, 0, 0, 0, 0, 0, 54, 0, - 0, 5, 130, 32, 16, 0, 2, 0, - 0, 0, 26, 0, 16, 0, 0, 0, - 0, 0, 56, 0, 0, 7, 66, 32, - 16, 0, 2, 0, 0, 0, 10, 0, - 16, 0, 0, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 0, 63, 17, 0, - 0, 8, 18, 32, 16, 0, 2, 0, - 0, 0, 70, 142, 32, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 70, 30, - 16, 0, 1, 0, 0, 0, 62, 0, - 0, 1, 83, 84, 65, 84, 116, 0, - 0, 0, 11, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 6, 0, - 0, 0, 7, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 82, 68, - 69, 70, 204, 0, 0, 0, 1, 0, - 0, 0, 72, 0, 0, 0, 1, 0, - 0, 0, 28, 0, 0, 0, 0, 4, -254, 255, 0, 65, 0, 0, 152, 0, - 0, 0, 60, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 36, 71, 108, 111, 98, 97, -108, 115, 0, 171, 171, 171, 60, 0, - 0, 0, 1, 0, 0, 0, 96, 0, - 0, 0, 64, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 120, 0, - 0, 0, 0, 0, 0, 0, 64, 0, - 0, 0, 2, 0, 0, 0, 136, 0, - 0, 0, 0, 0, 0, 0, 95, 67, - 67, 95, 77, 86, 80, 77, 97, 116, -114, 105, 120, 0, 171, 171, 3, 0, - 3, 0, 4, 0, 4, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 77, 105, - 99, 114, 111, 115, 111, 102, 116, 32, - 40, 82, 41, 32, 72, 76, 83, 76, - 32, 83, 104, 97, 100, 101, 114, 32, - 67, 111, 109, 112, 105, 108, 101, 114, - 32, 54, 46, 51, 46, 57, 54, 48, - 48, 46, 49, 54, 51, 56, 52, 0, -171, 171, 73, 83, 71, 78, 92, 0, - 0, 0, 3, 0, 0, 0, 8, 0, - 0, 0, 80, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, 15, 15, - 0, 0, 80, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 1, 0, 0, 0, 15, 15, - 0, 0, 80, 0, 0, 0, 2, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 2, 0, 0, 0, 3, 3, - 0, 0, 84, 69, 88, 67, 79, 79, - 82, 68, 0, 171, 171, 171, 79, 83, - 71, 78, 104, 0, 0, 0, 3, 0, - 0, 0, 8, 0, 0, 0, 80, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, 0, 0, - 0, 0, 15, 0, 0, 0, 80, 0, - 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, 1, 0, - 0, 0, 3, 12, 0, 0, 89, 0, - 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 3, 0, 0, 0, 2, 0, - 0, 0, 15, 0, 0, 0, 84, 69, - 88, 67, 79, 79, 82, 68, 0, 83, - 86, 95, 80, 111, 115, 105, 116, 105, -111, 110, 0, 171, 171, 171, -}; - -const unsigned char s_EE3D1B2155C6B54D29BFC9FACB7A83A83EC3847B[] = { - -166, 147, 0, 0, 142, 9, 2, 1, - 0, 128, 0, 0, 82, 139, 0, 0, - 10, 0, 0, 0, 97, 95, 112, 111, -115, 105, 116, 105, 111, 110, 1, 0, - 0, 0, 82, 139, 0, 0, 7, 0, - 0, 0, 97, 95, 99, 111, 108, 111, -114, 0, 0, 0, 0, 80, 139, 0, - 0, 10, 0, 0, 0, 97, 95, 116, -101, 120, 67, 111, 111, 114, 100, 2, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 1, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 0, 0, 0, 0, - 2, 0, 0, 0, 92, 139, 0, 0, -242, 141, 0, 0, 12, 0, 0, 0, - 67, 67, 95, 77, 86, 80, 77, 97, -116, 114, 105, 120, 0, 0, 0, 0, -255, 255, 255, 255, 0, 0, 0, 0, - 4, 0, 0, 0, 94, 139, 0, 0, - 0, 0, 0, 0, 11, 0, 0, 0, - 67, 67, 95, 84, 101, 120, 116, 117, -114, 101, 48, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 1, - 0, 0, 0, 2, 0, 0, 0, 12, - 0, 0, 0, 67, 67, 95, 77, 86, - 80, 77, 97, 116, 114, 105, 120, 0, - 0, 0, 0, 0, 0, 0, 0, 11, - 0, 0, 0, 67, 67, 95, 84, 101, -120, 116, 117, 114, 101, 48, 0, 0, - 0, 0, 1, 0, 0, 0, 24, 5, - 0, 0, 4, 5, 0, 0, 0, 0, - 0, 0, 185, 153, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 68, 88, 66, 67, 226, 171, -253, 248, 210, 31, 210, 164, 38, 67, -101, 24, 147, 152, 164, 65, 1, 0, - 0, 0, 24, 5, 0, 0, 6, 0, - 0, 0, 56, 0, 0, 0, 92, 1, - 0, 0, 20, 3, 0, 0, 144, 3, - 0, 0, 80, 4, 0, 0, 156, 4, - 0, 0, 65, 111, 110, 57, 28, 1, - 0, 0, 28, 1, 0, 0, 0, 2, -255, 255, 244, 0, 0, 0, 40, 0, - 0, 0, 0, 0, 40, 0, 0, 0, - 40, 0, 0, 0, 40, 0, 1, 0, - 36, 0, 0, 0, 40, 0, 0, 0, - 0, 0, 1, 2, 255, 255, 81, 0, - 0, 5, 0, 0, 15, 160, 31, 133, -235, 190, 254, 255, 71, 65, 0, 0, - 0, 192, 0, 0, 64, 64, 31, 0, - 0, 2, 0, 0, 0, 128, 0, 0, - 15, 176, 31, 0, 0, 2, 0, 0, - 0, 128, 1, 0, 3, 176, 31, 0, - 0, 2, 0, 0, 0, 144, 0, 8, - 15, 160, 66, 0, 0, 3, 0, 0, - 15, 128, 1, 0, 228, 176, 0, 8, -228, 160, 2, 0, 0, 3, 0, 0, - 1, 128, 0, 0, 255, 128, 0, 0, - 0, 160, 5, 0, 0, 3, 0, 0, - 17, 128, 0, 0, 0, 128, 0, 0, - 85, 160, 4, 0, 0, 4, 0, 0, - 2, 128, 0, 0, 0, 128, 0, 0, -170, 160, 0, 0, 255, 160, 5, 0, - 0, 3, 0, 0, 1, 128, 0, 0, - 0, 128, 0, 0, 0, 128, 5, 0, - 0, 3, 0, 0, 1, 128, 0, 0, - 0, 128, 0, 0, 85, 128, 5, 0, - 0, 3, 0, 0, 8, 128, 0, 0, - 0, 128, 0, 0, 255, 176, 1, 0, - 0, 2, 0, 0, 7, 128, 0, 0, -228, 176, 1, 0, 0, 2, 0, 8, - 15, 128, 0, 0, 228, 128, 1, 0, - 0, 2, 1, 8, 15, 128, 0, 0, -228, 128, 1, 0, 0, 2, 2, 8, - 15, 128, 0, 0, 228, 128, 1, 0, - 0, 2, 3, 8, 15, 128, 0, 0, -228, 128, 255, 255, 0, 0, 83, 72, - 68, 82, 176, 1, 0, 0, 64, 0, - 0, 0, 108, 0, 0, 0, 90, 0, - 0, 3, 0, 96, 16, 0, 0, 0, - 0, 0, 88, 24, 0, 4, 0, 112, - 16, 0, 0, 0, 0, 0, 85, 85, - 0, 0, 98, 16, 0, 3, 242, 16, - 16, 0, 0, 0, 0, 0, 98, 16, - 0, 3, 50, 16, 16, 0, 1, 0, - 0, 0, 101, 0, 0, 3, 242, 32, - 16, 0, 0, 0, 0, 0, 101, 0, - 0, 3, 242, 32, 16, 0, 1, 0, - 0, 0, 101, 0, 0, 3, 242, 32, - 16, 0, 2, 0, 0, 0, 101, 0, - 0, 3, 242, 32, 16, 0, 3, 0, - 0, 0, 104, 0, 0, 2, 1, 0, - 0, 0, 69, 0, 0, 9, 242, 0, - 16, 0, 0, 0, 0, 0, 70, 16, - 16, 0, 1, 0, 0, 0, 70, 126, - 16, 0, 0, 0, 0, 0, 0, 96, - 16, 0, 0, 0, 0, 0, 0, 0, - 0, 7, 18, 0, 16, 0, 0, 0, - 0, 0, 58, 0, 16, 0, 0, 0, - 0, 0, 1, 64, 0, 0, 31, 133, -235, 190, 56, 32, 0, 7, 18, 0, - 16, 0, 0, 0, 0, 0, 10, 0, - 16, 0, 0, 0, 0, 0, 1, 64, - 0, 0, 254, 255, 71, 65, 50, 0, - 0, 9, 34, 0, 16, 0, 0, 0, - 0, 0, 10, 0, 16, 0, 0, 0, - 0, 0, 1, 64, 0, 0, 0, 0, - 0, 192, 1, 64, 0, 0, 0, 0, - 64, 64, 56, 0, 0, 7, 18, 0, - 16, 0, 0, 0, 0, 0, 10, 0, - 16, 0, 0, 0, 0, 0, 10, 0, - 16, 0, 0, 0, 0, 0, 56, 0, - 0, 7, 18, 0, 16, 0, 0, 0, - 0, 0, 10, 0, 16, 0, 0, 0, - 0, 0, 26, 0, 16, 0, 0, 0, - 0, 0, 56, 0, 0, 7, 130, 0, - 16, 0, 0, 0, 0, 0, 10, 0, - 16, 0, 0, 0, 0, 0, 58, 16, - 16, 0, 0, 0, 0, 0, 54, 0, - 0, 5, 114, 0, 16, 0, 0, 0, - 0, 0, 70, 18, 16, 0, 0, 0, - 0, 0, 54, 0, 0, 5, 242, 32, - 16, 0, 0, 0, 0, 0, 70, 14, - 16, 0, 0, 0, 0, 0, 54, 0, - 0, 5, 242, 32, 16, 0, 1, 0, - 0, 0, 70, 14, 16, 0, 0, 0, - 0, 0, 54, 0, 0, 5, 242, 32, - 16, 0, 2, 0, 0, 0, 70, 14, - 16, 0, 0, 0, 0, 0, 54, 0, - 0, 5, 242, 32, 16, 0, 3, 0, - 0, 0, 70, 14, 16, 0, 0, 0, - 0, 0, 62, 0, 0, 1, 83, 84, - 65, 84, 116, 0, 0, 0, 13, 0, - 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 6, 0, 0, 0, 6, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 5, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 82, 68, 69, 70, 184, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 2, 0, 0, 0, 28, 0, - 0, 0, 0, 4, 255, 255, 0, 65, - 0, 0, 134, 0, 0, 0, 92, 0, - 0, 0, 3, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 1, 0, 0, 0, 113, 0, - 0, 0, 2, 0, 0, 0, 5, 0, - 0, 0, 4, 0, 0, 0, 255, 255, -255, 255, 0, 0, 0, 0, 1, 0, - 0, 0, 13, 0, 0, 0, 115, 97, -109, 112, 108, 101, 114, 95, 95, 67, - 67, 95, 84, 101, 120, 116, 117, 114, -101, 48, 0, 116, 101, 120, 116, 117, -114, 101, 95, 95, 67, 67, 95, 84, -101, 120, 116, 117, 114, 101, 48, 0, - 77, 105, 99, 114, 111, 115, 111, 102, -116, 32, 40, 82, 41, 32, 72, 76, - 83, 76, 32, 83, 104, 97, 100, 101, -114, 32, 67, 111, 109, 112, 105, 108, -101, 114, 32, 54, 46, 51, 46, 57, - 54, 48, 48, 46, 49, 54, 51, 56, - 52, 0, 73, 83, 71, 78, 68, 0, - 0, 0, 2, 0, 0, 0, 8, 0, - 0, 0, 56, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, 15, 15, - 0, 0, 56, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 1, 0, 0, 0, 3, 3, - 0, 0, 84, 69, 88, 67, 79, 79, - 82, 68, 0, 171, 171, 171, 79, 83, - 71, 78, 116, 0, 0, 0, 4, 0, - 0, 0, 8, 0, 0, 0, 104, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, 0, 0, - 0, 0, 15, 0, 0, 0, 104, 0, - 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, 1, 0, - 0, 0, 15, 0, 0, 0, 104, 0, - 0, 0, 2, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, 2, 0, - 0, 0, 15, 0, 0, 0, 104, 0, - 0, 0, 3, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, 3, 0, - 0, 0, 15, 0, 0, 0, 83, 86, - 95, 84, 97, 114, 103, 101, 116, 0, -171, 171, 68, 88, 66, 67, 235, 56, -180, 223, 125, 231, 231, 218, 70, 75, - 12, 63, 200, 233, 69, 121, 1, 0, - 0, 0, 4, 5, 0, 0, 6, 0, - 0, 0, 56, 0, 0, 0, 92, 1, - 0, 0, 224, 2, 0, 0, 92, 3, - 0, 0, 48, 4, 0, 0, 148, 4, - 0, 0, 65, 111, 110, 57, 28, 1, - 0, 0, 28, 1, 0, 0, 0, 2, -254, 255, 232, 0, 0, 0, 52, 0, - 0, 0, 1, 0, 36, 0, 0, 0, - 48, 0, 0, 0, 48, 0, 0, 0, - 36, 0, 1, 0, 48, 0, 0, 0, - 0, 0, 4, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 2, -254, 255, 81, 0, 0, 5, 5, 0, - 15, 160, 0, 0, 0, 63, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 31, 0, 0, 2, 5, 0, - 0, 128, 0, 0, 15, 144, 31, 0, - 0, 2, 5, 0, 1, 128, 1, 0, - 15, 144, 31, 0, 0, 2, 5, 0, - 2, 128, 2, 0, 15, 144, 9, 0, - 0, 3, 0, 0, 1, 128, 3, 0, -228, 160, 1, 0, 228, 144, 9, 0, - 0, 3, 0, 0, 2, 128, 4, 0, -228, 160, 1, 0, 228, 144, 2, 0, - 0, 3, 0, 0, 1, 128, 0, 0, - 85, 128, 0, 0, 0, 128, 5, 0, - 0, 3, 0, 0, 4, 192, 0, 0, - 0, 128, 5, 0, 0, 160, 9, 0, - 0, 3, 0, 0, 1, 128, 2, 0, -228, 160, 1, 0, 228, 144, 1, 0, - 0, 2, 1, 0, 2, 128, 0, 0, - 0, 129, 9, 0, 0, 3, 1, 0, - 1, 128, 1, 0, 228, 160, 1, 0, -228, 144, 4, 0, 0, 4, 0, 0, - 3, 192, 0, 0, 85, 128, 0, 0, -228, 160, 1, 0, 228, 128, 1, 0, - 0, 2, 0, 0, 8, 192, 0, 0, - 85, 128, 1, 0, 0, 2, 0, 0, - 15, 224, 0, 0, 228, 144, 1, 0, - 0, 2, 1, 0, 3, 224, 2, 0, -228, 144, 255, 255, 0, 0, 83, 72, - 68, 82, 124, 1, 0, 0, 64, 0, - 1, 0, 95, 0, 0, 0, 89, 0, - 0, 4, 70, 142, 32, 0, 0, 0, - 0, 0, 4, 0, 0, 0, 95, 0, - 0, 3, 242, 16, 16, 0, 0, 0, - 0, 0, 95, 0, 0, 3, 242, 16, - 16, 0, 1, 0, 0, 0, 95, 0, - 0, 3, 50, 16, 16, 0, 2, 0, - 0, 0, 101, 0, 0, 3, 242, 32, - 16, 0, 0, 0, 0, 0, 101, 0, - 0, 3, 50, 32, 16, 0, 1, 0, - 0, 0, 103, 0, 0, 4, 242, 32, - 16, 0, 2, 0, 0, 0, 1, 0, - 0, 0, 104, 0, 0, 2, 1, 0, - 0, 0, 54, 0, 0, 5, 242, 32, - 16, 0, 0, 0, 0, 0, 70, 30, - 16, 0, 0, 0, 0, 0, 54, 0, - 0, 5, 50, 32, 16, 0, 1, 0, - 0, 0, 70, 16, 16, 0, 2, 0, - 0, 0, 17, 0, 0, 8, 18, 0, - 16, 0, 0, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 70, 30, 16, 0, 1, 0, - 0, 0, 54, 0, 0, 6, 34, 32, - 16, 0, 2, 0, 0, 0, 10, 0, - 16, 128, 65, 0, 0, 0, 0, 0, - 0, 0, 17, 0, 0, 8, 18, 0, - 16, 0, 0, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, 2, 0, - 0, 0, 70, 30, 16, 0, 1, 0, - 0, 0, 17, 0, 0, 8, 34, 0, - 16, 0, 0, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 70, 30, 16, 0, 1, 0, - 0, 0, 0, 0, 0, 7, 18, 0, - 16, 0, 0, 0, 0, 0, 26, 0, - 16, 0, 0, 0, 0, 0, 10, 0, - 16, 0, 0, 0, 0, 0, 54, 0, - 0, 5, 130, 32, 16, 0, 2, 0, - 0, 0, 26, 0, 16, 0, 0, 0, - 0, 0, 56, 0, 0, 7, 66, 32, - 16, 0, 2, 0, 0, 0, 10, 0, - 16, 0, 0, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 0, 63, 17, 0, - 0, 8, 18, 32, 16, 0, 2, 0, - 0, 0, 70, 142, 32, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 70, 30, - 16, 0, 1, 0, 0, 0, 62, 0, - 0, 1, 83, 84, 65, 84, 116, 0, - 0, 0, 11, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 6, 0, - 0, 0, 7, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 82, 68, - 69, 70, 204, 0, 0, 0, 1, 0, - 0, 0, 72, 0, 0, 0, 1, 0, - 0, 0, 28, 0, 0, 0, 0, 4, -254, 255, 0, 65, 0, 0, 152, 0, - 0, 0, 60, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 36, 71, 108, 111, 98, 97, -108, 115, 0, 171, 171, 171, 60, 0, - 0, 0, 1, 0, 0, 0, 96, 0, - 0, 0, 64, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 120, 0, - 0, 0, 0, 0, 0, 0, 64, 0, - 0, 0, 2, 0, 0, 0, 136, 0, - 0, 0, 0, 0, 0, 0, 95, 67, - 67, 95, 77, 86, 80, 77, 97, 116, -114, 105, 120, 0, 171, 171, 3, 0, - 3, 0, 4, 0, 4, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 77, 105, - 99, 114, 111, 115, 111, 102, 116, 32, - 40, 82, 41, 32, 72, 76, 83, 76, - 32, 83, 104, 97, 100, 101, 114, 32, - 67, 111, 109, 112, 105, 108, 101, 114, - 32, 54, 46, 51, 46, 57, 54, 48, - 48, 46, 49, 54, 51, 56, 52, 0, -171, 171, 73, 83, 71, 78, 92, 0, - 0, 0, 3, 0, 0, 0, 8, 0, - 0, 0, 80, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, 15, 15, - 0, 0, 80, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 1, 0, 0, 0, 15, 15, - 0, 0, 80, 0, 0, 0, 2, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 2, 0, 0, 0, 3, 3, - 0, 0, 84, 69, 88, 67, 79, 79, - 82, 68, 0, 171, 171, 171, 79, 83, - 71, 78, 104, 0, 0, 0, 3, 0, - 0, 0, 8, 0, 0, 0, 80, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, 0, 0, - 0, 0, 15, 0, 0, 0, 80, 0, - 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, 1, 0, - 0, 0, 3, 12, 0, 0, 89, 0, - 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 3, 0, 0, 0, 2, 0, - 0, 0, 15, 0, 0, 0, 84, 69, - 88, 67, 79, 79, 82, 68, 0, 83, - 86, 95, 80, 111, 115, 105, 116, 105, -111, 110, 0, 171, 171, 171, -}; - -const unsigned char s_F24D6A4F46E684E38E16A586E913369B6E02E595[] = { - -166, 147, 0, 0, 142, 9, 2, 1, - 0, 128, 0, 0, 82, 139, 0, 0, - 10, 0, 0, 0, 97, 95, 112, 111, -115, 105, 116, 105, 111, 110, 1, 0, - 0, 0, 82, 139, 0, 0, 7, 0, - 0, 0, 97, 95, 99, 111, 108, 111, -114, 0, 0, 0, 0, 80, 139, 0, - 0, 10, 0, 0, 0, 97, 95, 116, -101, 120, 67, 111, 111, 114, 100, 2, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 0, - 0, 0, 0, 0, 0, 0, 0, 255, -255, 255, 255, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 1, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 0, 0, 0, 0, - 3, 0, 0, 0, 92, 139, 0, 0, -242, 141, 0, 0, 12, 0, 0, 0, - 67, 67, 95, 77, 86, 80, 77, 97, -116, 114, 105, 120, 0, 0, 0, 0, -255, 255, 255, 255, 0, 0, 0, 0, - 4, 0, 0, 0, 94, 139, 0, 0, - 0, 0, 0, 0, 11, 0, 0, 0, - 67, 67, 95, 84, 101, 120, 116, 117, -114, 101, 48, 0, 0, 0, 0, 0, - 0, 0, 0, 255, 255, 255, 255, 1, - 0, 0, 0, 82, 139, 0, 0, 240, -141, 0, 0, 13, 0, 0, 0, 118, - 95, 101, 102, 102, 101, 99, 116, 67, -111, 108, 111, 114, 0, 0, 0, 0, - 0, 0, 0, 0, 255, 255, 255, 255, - 1, 0, 0, 0, 3, 0, 0, 0, - 12, 0, 0, 0, 67, 67, 95, 77, - 86, 80, 77, 97, 116, 114, 105, 120, - 0, 0, 0, 0, 0, 0, 0, 0, - 11, 0, 0, 0, 67, 67, 95, 84, -101, 120, 116, 117, 114, 101, 48, 0, - 0, 0, 0, 1, 0, 0, 0, 13, - 0, 0, 0, 118, 95, 101, 102, 102, -101, 99, 116, 67, 111, 108, 111, 114, - 0, 0, 0, 0, 2, 0, 0, 0, -248, 5, 0, 0, 4, 5, 0, 0, - 0, 0, 0, 0, 185, 153, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 68, 88, 66, 67, - 96, 44, 85, 169, 144, 78, 197, 165, -246, 37, 113, 96, 91, 225, 82, 101, - 1, 0, 0, 0, 248, 5, 0, 0, - 6, 0, 0, 0, 56, 0, 0, 0, -128, 1, 0, 0, 120, 3, 0, 0, -244, 3, 0, 0, 48, 5, 0, 0, -124, 5, 0, 0, 65, 111, 110, 57, - 64, 1, 0, 0, 64, 1, 0, 0, - 0, 2, 255, 255, 12, 1, 0, 0, - 52, 0, 0, 0, 1, 0, 40, 0, - 0, 0, 52, 0, 0, 0, 52, 0, - 1, 0, 36, 0, 0, 0, 52, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, - 1, 2, 255, 255, 81, 0, 0, 5, - 1, 0, 15, 160, 0, 0, 128, 191, - 0, 0, 0, 128, 0, 0, 0, 0, - 0, 0, 0, 0, 31, 0, 0, 2, - 0, 0, 0, 128, 0, 0, 15, 176, - 31, 0, 0, 2, 0, 0, 0, 128, - 1, 0, 3, 176, 31, 0, 0, 2, - 0, 0, 0, 144, 0, 8, 15, 160, - 66, 0, 0, 3, 0, 0, 15, 128, - 1, 0, 228, 176, 0, 8, 228, 160, - 88, 0, 0, 4, 1, 0, 15, 128, - 0, 0, 0, 129, 1, 0, 0, 160, - 1, 0, 85, 160, 65, 0, 0, 1, - 1, 0, 15, 128, 18, 0, 0, 4, - 1, 0, 7, 128, 0, 0, 255, 128, - 0, 0, 228, 176, 0, 0, 228, 160, - 11, 0, 0, 3, 2, 0, 8, 128, - 0, 0, 255, 128, 0, 0, 0, 128, - 5, 0, 0, 3, 1, 0, 8, 128, - 2, 0, 255, 128, 0, 0, 255, 176, - 88, 0, 0, 4, 0, 0, 15, 128, - 0, 0, 0, 129, 1, 0, 170, 160, - 1, 0, 228, 128, 1, 0, 0, 2, - 1, 0, 15, 128, 0, 0, 228, 128, - 1, 0, 0, 2, 2, 0, 15, 128, - 0, 0, 228, 128, 1, 0, 0, 2, - 3, 0, 15, 128, 0, 0, 228, 128, - 1, 0, 0, 2, 0, 8, 15, 128, - 1, 0, 228, 128, 1, 0, 0, 2, - 1, 8, 15, 128, 2, 0, 228, 128, - 1, 0, 0, 2, 2, 8, 15, 128, - 3, 0, 228, 128, 1, 0, 0, 2, - 3, 8, 15, 128, 0, 0, 228, 128, -255, 255, 0, 0, 83, 72, 68, 82, -240, 1, 0, 0, 64, 0, 0, 0, -124, 0, 0, 0, 89, 0, 0, 4, - 70, 142, 32, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 90, 0, 0, 3, - 0, 96, 16, 0, 0, 0, 0, 0, - 88, 24, 0, 4, 0, 112, 16, 0, - 0, 0, 0, 0, 85, 85, 0, 0, - 98, 16, 0, 3, 242, 16, 16, 0, - 0, 0, 0, 0, 98, 16, 0, 3, - 50, 16, 16, 0, 1, 0, 0, 0, -101, 0, 0, 3, 242, 32, 16, 0, - 0, 0, 0, 0, 101, 0, 0, 3, -242, 32, 16, 0, 1, 0, 0, 0, -101, 0, 0, 3, 242, 32, 16, 0, - 2, 0, 0, 0, 101, 0, 0, 3, -242, 32, 16, 0, 3, 0, 0, 0, -104, 0, 0, 2, 2, 0, 0, 0, - 69, 0, 0, 9, 242, 0, 16, 0, - 0, 0, 0, 0, 70, 16, 16, 0, - 1, 0, 0, 0, 70, 126, 16, 0, - 0, 0, 0, 0, 0, 96, 16, 0, - 0, 0, 0, 0, 49, 0, 0, 7, - 34, 0, 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 0, 0, 0, 0, - 10, 0, 16, 0, 0, 0, 0, 0, - 59, 0, 0, 5, 66, 0, 16, 0, - 0, 0, 0, 0, 26, 0, 16, 0, - 0, 0, 0, 0, 13, 0, 4, 3, - 42, 0, 16, 0, 0, 0, 0, 0, - 0, 0, 0, 8, 66, 0, 16, 0, - 0, 0, 0, 0, 58, 0, 16, 128, - 65, 0, 0, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 0, 0, 128, 63, - 56, 0, 0, 8, 114, 0, 16, 0, - 1, 0, 0, 0, 166, 10, 16, 0, - 0, 0, 0, 0, 70, 130, 32, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 50, 0, 0, 9, 114, 0, 16, 0, - 1, 0, 0, 0, 70, 18, 16, 0, - 0, 0, 0, 0, 246, 15, 16, 0, - 0, 0, 0, 0, 70, 2, 16, 0, - 1, 0, 0, 0, 52, 0, 0, 7, - 18, 0, 16, 0, 0, 0, 0, 0, - 10, 0, 16, 0, 0, 0, 0, 0, - 58, 0, 16, 0, 0, 0, 0, 0, - 56, 0, 0, 7, 130, 0, 16, 0, - 1, 0, 0, 0, 10, 0, 16, 0, - 0, 0, 0, 0, 58, 16, 16, 0, - 0, 0, 0, 0, 1, 0, 0, 7, -242, 0, 16, 0, 0, 0, 0, 0, - 86, 5, 16, 0, 0, 0, 0, 0, - 70, 14, 16, 0, 1, 0, 0, 0, - 54, 0, 0, 5, 242, 32, 16, 0, - 0, 0, 0, 0, 70, 14, 16, 0, - 0, 0, 0, 0, 54, 0, 0, 5, -242, 32, 16, 0, 1, 0, 0, 0, - 70, 14, 16, 0, 0, 0, 0, 0, - 54, 0, 0, 5, 242, 32, 16, 0, - 2, 0, 0, 0, 70, 14, 16, 0, - 0, 0, 0, 0, 54, 0, 0, 5, -242, 32, 16, 0, 3, 0, 0, 0, - 70, 14, 16, 0, 0, 0, 0, 0, - 62, 0, 0, 1, 83, 84, 65, 84, -116, 0, 0, 0, 15, 0, 0, 0, - 2, 0, 0, 0, 0, 0, 0, 0, - 6, 0, 0, 0, 6, 0, 0, 0, - 0, 0, 0, 0, 2, 0, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 4, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 82, 68, 69, 70, 52, 1, 0, 0, - 1, 0, 0, 0, 176, 0, 0, 0, - 3, 0, 0, 0, 28, 0, 0, 0, - 0, 4, 255, 255, 0, 65, 0, 0, - 0, 1, 0, 0, 124, 0, 0, 0, - 3, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 0, - 1, 0, 0, 0, 145, 0, 0, 0, - 2, 0, 0, 0, 5, 0, 0, 0, - 4, 0, 0, 0, 255, 255, 255, 255, - 0, 0, 0, 0, 1, 0, 0, 0, - 13, 0, 0, 0, 166, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 115, 97, 109, 112, -108, 101, 114, 95, 95, 67, 67, 95, - 84, 101, 120, 116, 117, 114, 101, 48, - 0, 116, 101, 120, 116, 117, 114, 101, - 95, 95, 67, 67, 95, 84, 101, 120, -116, 117, 114, 101, 48, 0, 36, 71, -108, 111, 98, 97, 108, 115, 0, 171, -166, 0, 0, 0, 1, 0, 0, 0, -200, 0, 0, 0, 16, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, -224, 0, 0, 0, 0, 0, 0, 0, - 16, 0, 0, 0, 2, 0, 0, 0, -240, 0, 0, 0, 0, 0, 0, 0, - 95, 118, 95, 101, 102, 102, 101, 99, -116, 67, 111, 108, 111, 114, 0, 171, - 1, 0, 3, 0, 1, 0, 4, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 77, 105, 99, 114, 111, 115, 111, 102, -116, 32, 40, 82, 41, 32, 72, 76, - 83, 76, 32, 83, 104, 97, 100, 101, -114, 32, 67, 111, 109, 112, 105, 108, -101, 114, 32, 54, 46, 51, 46, 57, - 54, 48, 48, 46, 49, 54, 51, 56, - 52, 0, 171, 171, 73, 83, 71, 78, - 68, 0, 0, 0, 2, 0, 0, 0, - 8, 0, 0, 0, 56, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 0, 0, 0, 0, - 15, 15, 0, 0, 56, 0, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 1, 0, 0, 0, - 3, 3, 0, 0, 84, 69, 88, 67, - 79, 79, 82, 68, 0, 171, 171, 171, - 79, 83, 71, 78, 116, 0, 0, 0, - 4, 0, 0, 0, 8, 0, 0, 0, -104, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 15, 0, 0, 0, -104, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 3, 0, 0, 0, - 1, 0, 0, 0, 15, 0, 0, 0, -104, 0, 0, 0, 2, 0, 0, 0, - 0, 0, 0, 0, 3, 0, 0, 0, - 2, 0, 0, 0, 15, 0, 0, 0, -104, 0, 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 3, 0, 0, 0, - 3, 0, 0, 0, 15, 0, 0, 0, - 83, 86, 95, 84, 97, 114, 103, 101, -116, 0, 171, 171, 68, 88, 66, 67, -235, 56, 180, 223, 125, 231, 231, 218, - 70, 75, 12, 63, 200, 233, 69, 121, - 1, 0, 0, 0, 4, 5, 0, 0, - 6, 0, 0, 0, 56, 0, 0, 0, - 92, 1, 0, 0, 224, 2, 0, 0, - 92, 3, 0, 0, 48, 4, 0, 0, -148, 4, 0, 0, 65, 111, 110, 57, - 28, 1, 0, 0, 28, 1, 0, 0, - 0, 2, 254, 255, 232, 0, 0, 0, - 52, 0, 0, 0, 1, 0, 36, 0, - 0, 0, 48, 0, 0, 0, 48, 0, - 0, 0, 36, 0, 1, 0, 48, 0, - 0, 0, 0, 0, 4, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 1, 2, 254, 255, 81, 0, 0, 5, - 5, 0, 15, 160, 0, 0, 0, 63, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 31, 0, 0, 2, - 5, 0, 0, 128, 0, 0, 15, 144, - 31, 0, 0, 2, 5, 0, 1, 128, - 1, 0, 15, 144, 31, 0, 0, 2, - 5, 0, 2, 128, 2, 0, 15, 144, - 9, 0, 0, 3, 0, 0, 1, 128, - 3, 0, 228, 160, 1, 0, 228, 144, - 9, 0, 0, 3, 0, 0, 2, 128, - 4, 0, 228, 160, 1, 0, 228, 144, - 2, 0, 0, 3, 0, 0, 1, 128, - 0, 0, 85, 128, 0, 0, 0, 128, - 5, 0, 0, 3, 0, 0, 4, 192, - 0, 0, 0, 128, 5, 0, 0, 160, - 9, 0, 0, 3, 0, 0, 1, 128, - 2, 0, 228, 160, 1, 0, 228, 144, - 1, 0, 0, 2, 1, 0, 2, 128, - 0, 0, 0, 129, 9, 0, 0, 3, - 1, 0, 1, 128, 1, 0, 228, 160, - 1, 0, 228, 144, 4, 0, 0, 4, - 0, 0, 3, 192, 0, 0, 85, 128, - 0, 0, 228, 160, 1, 0, 228, 128, - 1, 0, 0, 2, 0, 0, 8, 192, - 0, 0, 85, 128, 1, 0, 0, 2, - 0, 0, 15, 224, 0, 0, 228, 144, - 1, 0, 0, 2, 1, 0, 3, 224, - 2, 0, 228, 144, 255, 255, 0, 0, - 83, 72, 68, 82, 124, 1, 0, 0, - 64, 0, 1, 0, 95, 0, 0, 0, - 89, 0, 0, 4, 70, 142, 32, 0, - 0, 0, 0, 0, 4, 0, 0, 0, - 95, 0, 0, 3, 242, 16, 16, 0, - 0, 0, 0, 0, 95, 0, 0, 3, -242, 16, 16, 0, 1, 0, 0, 0, - 95, 0, 0, 3, 50, 16, 16, 0, - 2, 0, 0, 0, 101, 0, 0, 3, -242, 32, 16, 0, 0, 0, 0, 0, -101, 0, 0, 3, 50, 32, 16, 0, - 1, 0, 0, 0, 103, 0, 0, 4, -242, 32, 16, 0, 2, 0, 0, 0, - 1, 0, 0, 0, 104, 0, 0, 2, - 1, 0, 0, 0, 54, 0, 0, 5, -242, 32, 16, 0, 0, 0, 0, 0, - 70, 30, 16, 0, 0, 0, 0, 0, - 54, 0, 0, 5, 50, 32, 16, 0, - 1, 0, 0, 0, 70, 16, 16, 0, - 2, 0, 0, 0, 17, 0, 0, 8, - 18, 0, 16, 0, 0, 0, 0, 0, - 70, 142, 32, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 70, 30, 16, 0, - 1, 0, 0, 0, 54, 0, 0, 6, - 34, 32, 16, 0, 2, 0, 0, 0, - 10, 0, 16, 128, 65, 0, 0, 0, - 0, 0, 0, 0, 17, 0, 0, 8, - 18, 0, 16, 0, 0, 0, 0, 0, - 70, 142, 32, 0, 0, 0, 0, 0, - 2, 0, 0, 0, 70, 30, 16, 0, - 1, 0, 0, 0, 17, 0, 0, 8, - 34, 0, 16, 0, 0, 0, 0, 0, - 70, 142, 32, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 70, 30, 16, 0, - 1, 0, 0, 0, 0, 0, 0, 7, - 18, 0, 16, 0, 0, 0, 0, 0, - 26, 0, 16, 0, 0, 0, 0, 0, - 10, 0, 16, 0, 0, 0, 0, 0, - 54, 0, 0, 5, 130, 32, 16, 0, - 2, 0, 0, 0, 26, 0, 16, 0, - 0, 0, 0, 0, 56, 0, 0, 7, - 66, 32, 16, 0, 2, 0, 0, 0, - 10, 0, 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 0, 0, 0, 63, - 17, 0, 0, 8, 18, 32, 16, 0, - 2, 0, 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 70, 30, 16, 0, 1, 0, 0, 0, - 62, 0, 0, 1, 83, 84, 65, 84, -116, 0, 0, 0, 11, 0, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, - 6, 0, 0, 0, 7, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 82, 68, 69, 70, 204, 0, 0, 0, - 1, 0, 0, 0, 72, 0, 0, 0, - 1, 0, 0, 0, 28, 0, 0, 0, - 0, 4, 254, 255, 0, 65, 0, 0, -152, 0, 0, 0, 60, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 36, 71, 108, 111, - 98, 97, 108, 115, 0, 171, 171, 171, - 60, 0, 0, 0, 1, 0, 0, 0, - 96, 0, 0, 0, 64, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, -120, 0, 0, 0, 0, 0, 0, 0, - 64, 0, 0, 0, 2, 0, 0, 0, -136, 0, 0, 0, 0, 0, 0, 0, - 95, 67, 67, 95, 77, 86, 80, 77, - 97, 116, 114, 105, 120, 0, 171, 171, - 3, 0, 3, 0, 4, 0, 4, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 77, 105, 99, 114, 111, 115, 111, 102, -116, 32, 40, 82, 41, 32, 72, 76, - 83, 76, 32, 83, 104, 97, 100, 101, -114, 32, 67, 111, 109, 112, 105, 108, -101, 114, 32, 54, 46, 51, 46, 57, - 54, 48, 48, 46, 49, 54, 51, 56, - 52, 0, 171, 171, 73, 83, 71, 78, - 92, 0, 0, 0, 3, 0, 0, 0, - 8, 0, 0, 0, 80, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 0, 0, 0, 0, - 15, 15, 0, 0, 80, 0, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 1, 0, 0, 0, - 15, 15, 0, 0, 80, 0, 0, 0, - 2, 0, 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 2, 0, 0, 0, - 3, 3, 0, 0, 84, 69, 88, 67, - 79, 79, 82, 68, 0, 171, 171, 171, - 79, 83, 71, 78, 104, 0, 0, 0, - 3, 0, 0, 0, 8, 0, 0, 0, - 80, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 15, 0, 0, 0, - 80, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 3, 0, 0, 0, - 1, 0, 0, 0, 3, 12, 0, 0, - 89, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 3, 0, 0, 0, - 2, 0, 0, 0, 15, 0, 0, 0, - 84, 69, 88, 67, 79, 79, 82, 68, - 0, 83, 86, 95, 80, 111, 115, 105, -116, 105, 111, 110, 0, 171, 171, 171, -}; - -const int s_numPrograms = 14; -const int s_programLengths[] = {2982,3876,2775,3358,2996,2675,2528,3025,2502,2990,3350,3022,3278,3568}; -const unsigned char* s_programs[] = {s_2140AC5CB6D3788EBF81062827FA30CB4E9DB1BA,s_42003E3EDB1E484A842EB95165D48A439ED6AAE8,s_5132957B676AE174BDF34524AE4A80338F866279,s_61ACD51E94A6AA8035DE722FB113F24350C0D113,s_6A3FEBEAD7E44B2380CD39CBDCFD1D3B046D8057,s_6C80A53170768A04FB4457D7203425EA3467E2E4,s_7845A827CC74A6ED188C81E590C16A4B394AF6EA,s_993D07D70C4AE9F39EAA9EBBDFD109681386920A,s_BF0A97A7CDA97B6CD0F5D1455A170F32E2538AD6,s_CE141D74B59548C43E99D183312791C6F429C37D,s_DB22823528A225B43DABEF012B299639D233D54C,s_E878895044FDA49FE4D8202CE20AF49CC01A8FA9,s_EE3D1B2155C6B54D29BFC9FACB7A83A83EC3847B,s_F24D6A4F46E684E38E16A586E913369B6E02E595}; -const char* s_programKeys[] = {"2140AC5CB6D3788EBF81062827FA30CB4E9DB1BA","42003E3EDB1E484A842EB95165D48A439ED6AAE8","5132957B676AE174BDF34524AE4A80338F866279","61ACD51E94A6AA8035DE722FB113F24350C0D113","6A3FEBEAD7E44B2380CD39CBDCFD1D3B046D8057","6C80A53170768A04FB4457D7203425EA3467E2E4","7845A827CC74A6ED188C81E590C16A4B394AF6EA","993D07D70C4AE9F39EAA9EBBDFD109681386920A","BF0A97A7CDA97B6CD0F5D1455A170F32E2538AD6","CE141D74B59548C43E99D183312791C6F429C37D","DB22823528A225B43DABEF012B299639D233D54C","E878895044FDA49FE4D8202CE20AF49CC01A8FA9","EE3D1B2155C6B54D29BFC9FACB7A83A83EC3847B","F24D6A4F46E684E38E16A586E913369B6E02E595"}; diff --git a/cocos/platform/winrt/targetver.h b/cocos/platform/winrt/targetver.h deleted file mode 100644 index 9b10cecdf039..000000000000 --- a/cocos/platform/winrt/targetver.h +++ /dev/null @@ -1,32 +0,0 @@ -/**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - ****************************************************************************/ - -#pragma once - -// Including SDKDDKVer.h defines the highest available Windows platform. - -// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and -// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. - -#include diff --git a/cocos/renderer/CCBatchCommand.cpp b/cocos/renderer/CCBatchCommand.cpp index 852e626abe41..840819d51430 100644 --- a/cocos/renderer/CCBatchCommand.cpp +++ b/cocos/renderer/CCBatchCommand.cpp @@ -25,10 +25,10 @@ #include "renderer/CCBatchCommand.h" +#include "renderer/ccGLStateCache.h" #include "renderer/CCTextureAtlas.h" #include "renderer/CCTexture2D.h" #include "renderer/CCGLProgram.h" -#include "base/ccUtils.h" NS_CC_BEGIN @@ -70,9 +70,8 @@ void BatchCommand::execute() // Set material _shader->use(); _shader->setUniformsForBuiltins(_mv); - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, _textureID); - utils::setBlending(_blendType.src, _blendType.dst); + GL::bindTexture2D(_textureID); + GL::blendFunc(_blendType.src, _blendType.dst); // Draw _textureAtlas->drawQuads(); diff --git a/cocos/renderer/CCGLProgram.cpp b/cocos/renderer/CCGLProgram.cpp index e0a27900f6d9..b8146d054cd3 100644 --- a/cocos/renderer/CCGLProgram.cpp +++ b/cocos/renderer/CCGLProgram.cpp @@ -35,6 +35,7 @@ THE SOFTWARE. #include "base/CCDirector.h" #include "base/ccUTF8.h" +#include "renderer/ccGLStateCache.h" #include "platform/CCFileUtils.h" // helper functions @@ -232,7 +233,7 @@ GLProgram::~GLProgram() if (_program) { - glDeleteProgram(_program); + GL::deleteProgram(_program); } @@ -486,8 +487,11 @@ bool GLProgram::compileShader(GLuint * shader, GLenum type, const GLchar* source #if CC_TARGET_PLATFORM == CC_PLATFORM_WINRT headersDef = (type == GL_VERTEX_SHADER ? "precision mediump float;\n precision mediump int;\n" : "precision mediump float;\n precision mediump int;\n"); // Bugfix to make shader variables types constant to be understood by the current Android Virtual Devices or Emulators. This will also eliminate the 0x501 and 0x502 OpenGL Errors during emulation. +// Changed shader data types mediump to highp to remove possible sprite joggling on some Android phones. #elif CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID - headersDef = "#version 100\n precision mediump float;\n precision mediump int;\n"; + headersDef = (type == GL_VERTEX_SHADER ? + "#version 100\n precision highp float;\n precision highp int;\n" : + "#version 100\n precision highp float;\n precision highp int;\n"); #elif (CC_TARGET_PLATFORM != CC_PLATFORM_WIN32 && CC_TARGET_PLATFORM != CC_PLATFORM_LINUX && CC_TARGET_PLATFORM != CC_PLATFORM_MAC) headersDef = (type == GL_VERTEX_SHADER ? "precision highp float;\n precision highp int;\n" : "precision mediump float;\n precision mediump int;\n"); #endif @@ -617,7 +621,7 @@ bool GLProgram::link() if (status == GL_FALSE) { CCLOG("cocos2d: ERROR: Failed to link program: %i", _program); - glDeleteProgram(_program); + GL::deleteProgram(_program); _program = 0; } else @@ -633,7 +637,7 @@ bool GLProgram::link() void GLProgram::use() { - glUseProgram(_program); + GL::useProgram(_program); } static std::string logForOpenGLShader(GLuint shader) diff --git a/cocos/renderer/CCGLProgramCache.cpp b/cocos/renderer/CCGLProgramCache.cpp index 928ddf5197e2..0072baa18c2e 100644 --- a/cocos/renderer/CCGLProgramCache.cpp +++ b/cocos/renderer/CCGLProgramCache.cpp @@ -35,6 +35,7 @@ THE SOFTWARE. #include "base/CCEventListenerCustom.h" #include "base/CCDirector.h" #include "base/CCEventDispatcher.h" +#include "platform/CCDataManager.h" NS_CC_BEGIN @@ -127,12 +128,17 @@ GLProgramCache::~GLProgramCache() bool GLProgramCache::init() { +#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID + DataManager::onShaderLoaderBegin(); +#endif loadDefaultGLPrograms(); auto listener = EventListenerCustom::create(Configuration::CONFIG_FILE_LOADED, [this](EventCustom* /*event*/){ reloadDefaultGLProgramsRelativeToLights(); }); - +#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID + DataManager::onShaderLoaderEnd(); +#endif Director::getInstance()->getEventDispatcher()->addEventListenerWithFixedPriority(listener, -1); return true; diff --git a/cocos/renderer/CCGLProgramState.cpp b/cocos/renderer/CCGLProgramState.cpp index 0de3707608b1..ef64487ed96c 100644 --- a/cocos/renderer/CCGLProgramState.cpp +++ b/cocos/renderer/CCGLProgramState.cpp @@ -32,6 +32,7 @@ THE SOFTWARE. #include "renderer/CCGLProgram.h" #include "renderer/CCGLProgramStateCache.h" #include "renderer/CCGLProgramCache.h" +#include "renderer/ccGLStateCache.h" #include "renderer/CCTexture2D.h" #include "base/CCEventCustom.h" #include "base/CCEventListenerCustom.h" @@ -116,14 +117,12 @@ void UniformValue::apply() switch (_uniform->type) { case GL_SAMPLER_2D: _glprogram->setUniformLocationWith1i(_uniform->location, _value.tex.textureUnit); - glActiveTexture(GL_TEXTURE0 + _value.tex.textureUnit); - glBindTexture(GL_TEXTURE_2D, _value.tex.textureId); + GL::bindTexture2DN(_value.tex.textureUnit, _value.tex.textureId); break; case GL_SAMPLER_CUBE: _glprogram->setUniformLocationWith1i(_uniform->location, _value.tex.textureUnit); - glActiveTexture(GL_TEXTURE0 + _value.tex.textureUnit); - glBindTexture(GL_TEXTURE_CUBE_MAP, _value.tex.textureId); + GL::bindTextureN(_value.tex.textureUnit, _value.tex.textureId, GL_TEXTURE_CUBE_MAP); break; case GL_INT: @@ -501,7 +500,7 @@ bool GLProgramState::init(GLProgram* glprogram) for(auto &uniform : _glprogram->_userUniforms) { UniformValue value(&uniform.second, _glprogram); - _uniforms[uniform.second.location] = std::move(value); + _uniforms[uniform.second.location] = value; _uniformsByName[uniform.first] = uniform.second.location; } @@ -572,17 +571,7 @@ void GLProgramState::applyAttributes(bool applyAttribFlags) if(_vertexAttribsFlags) { // enable/disable vertex attribs if (applyAttribFlags) - { - auto flags = _vertexAttribsFlags; - for (int i = 0; flags > 0; i++) - { - int flag = 1 << i; - if (flag & flags) - glEnableVertexAttribArray(i); - - flags &= ~flag; - } - } + GL::enableVertexAttribs(_vertexAttribsFlags); // set attributes for(auto &attribute : _attributes) { diff --git a/cocos/renderer/CCMaterial.cpp b/cocos/renderer/CCMaterial.cpp index 1b761612ca42..d60df48445be 100644 --- a/cocos/renderer/CCMaterial.cpp +++ b/cocos/renderer/CCMaterial.cpp @@ -53,7 +53,7 @@ static bool isValidUniform(const char* name); Material* Material::createWithFilename(const std::string& filepath) { auto validfilename = FileUtils::getInstance()->fullPathForFilename(filepath); - if (validfilename.size() > 0) { + if (!validfilename.empty()) { auto mat = new (std::nothrow) Material(); if (mat && mat->initWithFile(validfilename)) { @@ -172,7 +172,7 @@ bool Material::parseTechnique(Properties* techniqueProperties) } else if (strcmp(name, "renderState") == 0) { - parseRenderState(this, space); + parseRenderState(technique, space); } space = techniqueProperties->getNextNamespace(); @@ -465,7 +465,7 @@ const Vector& Material::getTechniques() const Technique* Material::getTechniqueByName(const std::string& name) { for(const auto& technique : _techniques) { - if (technique->getName().compare(name)==0) + if (technique->getName() == name) return technique; } return nullptr; diff --git a/cocos/renderer/CCMeshCommand.cpp b/cocos/renderer/CCMeshCommand.cpp index b2b873851ea5..9d0261e2ccd3 100644 --- a/cocos/renderer/CCMeshCommand.cpp +++ b/cocos/renderer/CCMeshCommand.cpp @@ -32,6 +32,7 @@ #include "base/CCEventDispatcher.h" #include "base/CCEventType.h" #include "2d/CCLight.h" +#include "renderer/ccGLStateCache.h" #include "renderer/CCGLProgramState.h" #include "renderer/CCRenderer.h" #include "renderer/CCTextureAtlas.h" @@ -166,8 +167,7 @@ void MeshCommand::applyRenderState() CCASSERT(_stateBlock, "StateBlock must be non null"); // blend and texture - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, _textureID); + GL::bindTexture2D(_textureID); _stateBlock->bind(); } @@ -198,7 +198,7 @@ void MeshCommand::preBatchDraw() buildVAO(); if (_vao) { - glBindVertexArray(_vao); + GL::bindVAO(_vao); } else { @@ -247,7 +247,7 @@ void MeshCommand::postBatchDraw() { if (_vao) { - glBindVertexArray(0); + GL::bindVAO(0); } else { @@ -305,7 +305,7 @@ void MeshCommand::buildVAO() releaseVAO(); glGenVertexArrays(1, &_vao); - glBindVertexArray(_vao); + GL::bindVAO(_vao); glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer); auto flags = programState->getVertexAttribsFlags(); for (int i = 0; flags > 0; i++) { @@ -318,7 +318,7 @@ void MeshCommand::buildVAO() glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _indexBuffer); - glBindVertexArray(0); + GL::bindVAO(0); glBindBuffer(GL_ARRAY_BUFFER, 0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); } @@ -328,7 +328,7 @@ void MeshCommand::releaseVAO() { glDeleteVertexArrays(1, &_vao); _vao = 0; - glBindVertexArray(0); + GL::bindVAO(0); } } diff --git a/cocos/renderer/CCPass.cpp b/cocos/renderer/CCPass.cpp index 6b8165917ee4..d25224001278 100644 --- a/cocos/renderer/CCPass.cpp +++ b/cocos/renderer/CCPass.cpp @@ -32,6 +32,7 @@ #include "renderer/CCGLProgramState.h" #include "renderer/CCGLProgram.h" #include "renderer/CCTexture2D.h" +#include "renderer/ccGLStateCache.h" #include "renderer/CCTechnique.h" #include "renderer/CCMaterial.h" #include "renderer/CCVertexAttribBinding.h" diff --git a/cocos/renderer/CCPrimitiveCommand.cpp b/cocos/renderer/CCPrimitiveCommand.cpp index 7fda32a31608..25606e4a68b7 100644 --- a/cocos/renderer/CCPrimitiveCommand.cpp +++ b/cocos/renderer/CCPrimitiveCommand.cpp @@ -25,10 +25,10 @@ #include "renderer/CCPrimitiveCommand.h" +#include "renderer/ccGLStateCache.h" #include "renderer/CCGLProgram.h" #include "renderer/CCGLProgramState.h" #include "renderer/CCRenderer.h" -#include "base/ccUtils.h" #include "base/CCDirector.h" @@ -77,11 +77,10 @@ void PrimitiveCommand::init(float globalOrder, GLuint textureID, GLProgramState* void PrimitiveCommand::execute() const { //Set texture - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, _textureID); + GL::bindTexture2D(_textureID); //set blend mode - utils::setBlending(_blendType.src, _blendType.dst); + GL::blendFunc(_blendType.src, _blendType.dst); _glProgramState->apply(_mv); diff --git a/cocos/renderer/CCQuadCommand.cpp b/cocos/renderer/CCQuadCommand.cpp index 21d15420a972..678c96bb5d82 100644 --- a/cocos/renderer/CCQuadCommand.cpp +++ b/cocos/renderer/CCQuadCommand.cpp @@ -26,6 +26,7 @@ #include "renderer/CCQuadCommand.h" +#include "renderer/ccGLStateCache.h" #include "renderer/CCGLProgram.h" #include "renderer/CCMaterial.h" #include "renderer/CCTechnique.h" @@ -115,4 +116,4 @@ void QuadCommand::init(float globalOrder, Texture2D* texture, GLProgramState* gl _alphaTextureID = texture->getAlphaTextureName(); } -NS_CC_END +NS_CC_END \ No newline at end of file diff --git a/cocos/renderer/CCRenderState.cpp b/cocos/renderer/CCRenderState.cpp index e1a8b148d426..03216d4ede68 100644 --- a/cocos/renderer/CCRenderState.cpp +++ b/cocos/renderer/CCRenderState.cpp @@ -27,11 +27,13 @@ #include "renderer/CCRenderState.h" +#include #include #include "renderer/CCTexture2D.h" #include "renderer/CCPass.h" -#include "base/ccUtils.h" +#include "renderer/ccGLStateCache.h" + NS_CC_BEGIN @@ -104,11 +106,7 @@ void RenderState::bind(Pass* pass) CC_ASSERT(pass); if (_texture) - { - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, _texture->getName()); - } - + GL::bindTexture2D(_texture->getName()); // Get the combined modified state bits for our RenderState hierarchy. long stateOverrideBits = _state ? _state->_bits : 0; @@ -249,7 +247,7 @@ void RenderState::StateBlock::bindNoRestore() } if ((_bits & RS_BLEND_FUNC) && (_blendSrc != _defaultState->_blendSrc || _blendDst != _defaultState->_blendDst)) { - utils::setBlending((GLenum)_blendSrc, (GLenum)_blendDst); + GL::blendFunc((GLenum)_blendSrc, (GLenum)_blendDst); _defaultState->_blendSrc = _blendSrc; _defaultState->_blendDst = _blendDst; } @@ -344,7 +342,7 @@ void RenderState::StateBlock::restore(long stateOverrideBits) } if (!(stateOverrideBits & RS_BLEND_FUNC) && (_defaultState->_bits & RS_BLEND_FUNC)) { - utils::setBlending(GL_ONE, GL_ZERO); + GL::blendFunc(GL_ONE, GL_ZERO); _defaultState->_bits &= ~RS_BLEND_FUNC; _defaultState->_blendSrc = RenderState::BLEND_ONE; _defaultState->_blendDst = RenderState::BLEND_ZERO; @@ -456,7 +454,7 @@ void RenderState::StateBlock::cloneInto(StateBlock* state) const static bool parseBoolean(const std::string& value) { - return (value.compare("true")==0); + return value == "true"; } //static int parseInt(const std::string& value) @@ -484,7 +482,8 @@ static RenderState::Blend parseBlend(const std::string& value) { // Convert the string to uppercase for comparison. std::string upper(value); - std::transform(upper.begin(), upper.end(), upper.begin(), (int(*)(int))toupper); + std::transform(upper.begin(), upper.end(), upper.begin(), [](unsigned char c) { + return std::toupper(c);}); if (upper == "ZERO") return RenderState::BLEND_ZERO; else if (upper == "ONE") @@ -638,39 +637,39 @@ static RenderState::FrontFace parseFrontFace(const std::string& value) void RenderState::StateBlock::setState(const std::string& name, const std::string& value) { - if (name.compare("blend") == 0) + if (name == "blend") { setBlend(parseBoolean(value)); } - else if (name.compare("blendSrc") == 0) + else if (name == "blendSrc") { setBlendSrc(parseBlend(value)); } - else if (name.compare("blendDst") == 0) + else if (name == "blendDst") { setBlendDst(parseBlend(value)); } - else if (name.compare("cullFace") == 0) + else if (name == "cullFace") { setCullFace(parseBoolean(value)); } - else if (name.compare("cullFaceSide") == 0) + else if (name == "cullFaceSide") { setCullFaceSide(parseCullFaceSide(value)); } - else if (name.compare("frontFace") == 0) + else if (name == "frontFace") { setFrontFace(parseFrontFace(value)); } - else if (name.compare("depthTest") == 0) + else if (name == "depthTest") { setDepthTest(parseBoolean(value)); } - else if (name.compare("depthWrite") == 0) + else if (name == "depthWrite") { setDepthWrite(parseBoolean(value)); } - else if (name.compare("depthFunc") == 0) + else if (name == "depthFunc") { setDepthFunction(parseDepthFunc(value)); } diff --git a/cocos/renderer/CCRenderer.cpp b/cocos/renderer/CCRenderer.cpp index f08fef3af4cf..64f06596ef7c 100644 --- a/cocos/renderer/CCRenderer.cpp +++ b/cocos/renderer/CCRenderer.cpp @@ -38,6 +38,7 @@ #include "renderer/CCTechnique.h" #include "renderer/CCPass.h" #include "renderer/CCRenderState.h" +#include "renderer/ccGLStateCache.h" #include "base/CCConfiguration.h" #include "base/CCDirector.h" @@ -237,7 +238,7 @@ Renderer::~Renderer() if (Configuration::getInstance()->supportsShareableVAO()) { glDeleteVertexArrays(1, &_buffersVAO); - glBindVertexArray(0); + GL::bindVAO(0); } #if CC_ENABLE_CACHE_TEXTURE_DATA Director::getInstance()->getEventDispatcher()->removeEventListener(_cacheTextureListener); @@ -276,7 +277,7 @@ void Renderer::setupVBOAndVAO() { //generate vbo and vao for trianglesCommand glGenVertexArrays(1, &_buffersVAO); - glBindVertexArray(_buffersVAO); + GL::bindVAO(_buffersVAO); glGenBuffers(2, &_buffersVBO[0]); @@ -306,7 +307,7 @@ void Renderer::setupVBOAndVAO() glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(_indices[0]) * INDEX_VBO_SIZE, _indices, GL_STATIC_DRAW); // Must unbind the VAO before changing the element buffer. - glBindVertexArray(0); + GL::bindVAO(0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); glBindBuffer(GL_ARRAY_BUFFER, 0); @@ -329,7 +330,7 @@ void Renderer::setupVBO() void Renderer::mapBuffers() { // Avoid changing the element buffer for whatever VAO might be bound. - glBindVertexArray(0); + GL::bindVAO(0); glBindBuffer(GL_ARRAY_BUFFER, _buffersVBO[0]); glBufferData(GL_ARRAY_BUFFER, sizeof(_verts[0]) * VBO_SIZE, _verts, GL_DYNAMIC_DRAW); @@ -476,7 +477,7 @@ void Renderer::visitRenderQueue(RenderQueue& queue) //Process Global-Z < 0 Objects // const auto& zNegQueue = queue.getSubQueue(RenderQueue::QUEUE_GROUP::GLOBALZ_NEG); - if (zNegQueue.size() > 0) + if (!zNegQueue.empty()) { if(_isDepthTestFor2D) { @@ -510,7 +511,7 @@ void Renderer::visitRenderQueue(RenderQueue& queue) //Process Opaque Object // const auto& opaqueQueue = queue.getSubQueue(RenderQueue::QUEUE_GROUP::OPAQUE_3D); - if (opaqueQueue.size() > 0) + if (!opaqueQueue.empty()) { //Clear depth to achieve layered rendering glEnable(GL_DEPTH_TEST); @@ -533,7 +534,7 @@ void Renderer::visitRenderQueue(RenderQueue& queue) //Process 3D Transparent object // const auto& transQueue = queue.getSubQueue(RenderQueue::QUEUE_GROUP::TRANSPARENT_3D); - if (transQueue.size() > 0) + if (!transQueue.empty()) { glEnable(GL_DEPTH_TEST); glDepthMask(false); @@ -557,7 +558,7 @@ void Renderer::visitRenderQueue(RenderQueue& queue) //Process Global-Z = 0 Queue // const auto& zZeroQueue = queue.getSubQueue(RenderQueue::QUEUE_GROUP::GLOBALZ_ZERO); - if (zZeroQueue.size() > 0) + if (!zZeroQueue.empty()) { if(_isDepthTestFor2D) { @@ -593,7 +594,7 @@ void Renderer::visitRenderQueue(RenderQueue& queue) //Process Global-Z > 0 Queue // const auto& zPosQueue = queue.getSubQueue(RenderQueue::QUEUE_GROUP::GLOBALZ_POS); - if (zPosQueue.size() > 0) + if (!zPosQueue.empty()) { if(_isDepthTestFor2D) { @@ -793,7 +794,7 @@ void Renderer::drawBatchedTriangles() if (conf->supportsShareableVAO() && conf->supportsMapBuffer()) { //Bind VAO - glBindVertexArray(_buffersVAO); + GL::bindVAO(_buffersVAO); //Set VBO data glBindBuffer(GL_ARRAY_BUFFER, _buffersVBO[0]); @@ -825,9 +826,7 @@ void Renderer::drawBatchedTriangles() glBufferData(GL_ARRAY_BUFFER, sizeof(_verts[0]) * _filledVertex , _verts, GL_DYNAMIC_DRAW); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_COLOR); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_TEX_COORD); + GL::enableVertexAttribs(GL::VERTEX_ATTRIB_FLAG_POS_COLOR_TEX); // vertices glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 3, GL_FLOAT, GL_FALSE, kQuadSize, (GLvoid*) offsetof(V3F_C4B_T2F, vertices)); @@ -856,7 +855,7 @@ void Renderer::drawBatchedTriangles() if (conf->supportsShareableVAO() && conf->supportsMapBuffer()) { //Unbind VAO - glBindVertexArray(0); + GL::bindVAO(0); } else { diff --git a/cocos/renderer/CCRenderer.h b/cocos/renderer/CCRenderer.h index 89c6095896d3..54d39bc902d7 100644 --- a/cocos/renderer/CCRenderer.h +++ b/cocos/renderer/CCRenderer.h @@ -183,6 +183,8 @@ class CC_DLL Renderer /** set color for clear screen */ void setClearColor(const Color4F& clearColor); + /** get color for clear screen */ + const Color4F& getClearColor() const { return _clearColor; }; /* returns the number of drawn batches in the last frame */ ssize_t getDrawnBatches() const { return _drawnBatches; } /* RenderCommands (except) TrianglesCommand should update this value */ diff --git a/cocos/renderer/CCTexture2D.cpp b/cocos/renderer/CCTexture2D.cpp index 7934e620ebf4..22fb891c4c0a 100644 --- a/cocos/renderer/CCTexture2D.cpp +++ b/cocos/renderer/CCTexture2D.cpp @@ -45,6 +45,7 @@ THE SOFTWARE. #include "platform/CCPlatformMacros.h" #include "base/CCDirector.h" #include "renderer/CCGLProgram.h" +#include "renderer/ccGLStateCache.h" #include "renderer/CCGLProgramCache.h" #include "base/CCNinePatchImageParser.h" @@ -463,7 +464,7 @@ Texture2D::~Texture2D() if(_name) { - glDeleteTextures(1, &_name); + GL::deleteTexture(_name); } } @@ -471,7 +472,7 @@ void Texture2D::releaseGLTexture() { if(_name) { - glDeleteTextures(1, &_name); + GL::deleteTexture(_name); } _name = 0; } @@ -553,7 +554,7 @@ bool Texture2D::hasPremultipliedAlpha() const return _hasPremultipliedAlpha; } -bool Texture2D::initWithData(const void *data, ssize_t dataLen, Texture2D::PixelFormat pixelFormat, int pixelsWide, int pixelsHigh, const Size& /*contentSize*/) +bool Texture2D::initWithData(const void *data, ssize_t dataLen, Texture2D::PixelFormat pixelFormat, int pixelsWide, int pixelsHigh, const Size& /*contentSize*/, bool preMultipliedAlpha) { CCASSERT(dataLen>0 && pixelsWide>0 && pixelsHigh>0, "Invalid size"); @@ -561,13 +562,11 @@ bool Texture2D::initWithData(const void *data, ssize_t dataLen, Texture2D::Pixel MipmapInfo mipmap; mipmap.address = (unsigned char*)data; mipmap.len = static_cast(dataLen); - return initWithMipmaps(&mipmap, 1, pixelFormat, pixelsWide, pixelsHigh); + return initWithMipmaps(&mipmap, 1, pixelFormat, pixelsWide, pixelsHigh, preMultipliedAlpha); } -bool Texture2D::initWithMipmaps(MipmapInfo* mipmaps, int mipmapsNum, PixelFormat pixelFormat, int pixelsWide, int pixelsHigh) +bool Texture2D::initWithMipmaps(MipmapInfo* mipmaps, int mipmapsNum, PixelFormat pixelFormat, int pixelsWide, int pixelsHigh, bool preMultipliedAlpha) { - - //the pixelFormat must be a certain value CCASSERT(pixelFormat != PixelFormat::NONE && pixelFormat != PixelFormat::AUTO, "the \"pixelFormat\" param must be a certain value!"); CCASSERT(pixelsWide>0 && pixelsHigh>0, "Invalid size"); @@ -578,7 +577,6 @@ bool Texture2D::initWithMipmaps(MipmapInfo* mipmaps, int mipmapsNum, PixelFormat return false; } - auto formatItr = _pixelFormatInfoTables.find(pixelFormat); if(formatItr == _pixelFormatInfoTables.end()) { @@ -625,13 +623,12 @@ bool Texture2D::initWithMipmaps(MipmapInfo* mipmaps, int mipmapsNum, PixelFormat if(_name != 0) { - glDeleteTextures(1, &_name); + GL::deleteTexture(_name); _name = 0; } glGenTextures(1, &_name); - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, _name); + GL::bindTexture2D(_name); if (mipmapsNum == 1) { @@ -706,7 +703,7 @@ bool Texture2D::initWithMipmaps(MipmapInfo* mipmaps, int mipmapsNum, PixelFormat _maxS = 1; _maxT = 1; - _hasPremultipliedAlpha = false; + _hasPremultipliedAlpha = preMultipliedAlpha; _hasMipmaps = mipmapsNum > 1; // shader @@ -718,8 +715,7 @@ bool Texture2D::updateWithData(const void *data,int offsetX,int offsetY,int widt { if (_name) { - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, _name); + GL::bindTexture2D(_name); const PixelFormatInfo& info = _pixelFormatInfoTables.at(_pixelFormat); glTexSubImage2D(GL_TEXTURE_2D,0,offsetX,offsetY,width,height,info.format, info.type,data); @@ -765,7 +761,6 @@ bool Texture2D::initWithImage(Image *image, PixelFormat format) PixelFormat renderFormat = image->getRenderFormat(); size_t tempDataLen = image->getDataLen(); - if (image->getNumberOfMipmaps() > 1) { if (pixelFormat != image->getRenderFormat()) @@ -773,10 +768,7 @@ bool Texture2D::initWithImage(Image *image, PixelFormat format) CCLOG("cocos2d: WARNING: This image has more than 1 mipmaps and we will not convert the data format"); } - initWithMipmaps(image->getMipmaps(), image->getNumberOfMipmaps(), image->getRenderFormat(), imageWidth, imageHeight); - - // set the premultiplied tag - _hasPremultipliedAlpha = image->hasPremultipliedAlpha(); + initWithMipmaps(image->getMipmaps(), image->getNumberOfMipmaps(), image->getRenderFormat(), imageWidth, imageHeight, image->hasPremultipliedAlpha()); return true; } @@ -787,10 +779,7 @@ bool Texture2D::initWithImage(Image *image, PixelFormat format) CCLOG("cocos2d: WARNING: This image is compressed and we can't convert it for now"); } - initWithData(tempData, tempDataLen, image->getRenderFormat(), imageWidth, imageHeight, imageSize); - - // set the premultiplied tag - _hasPremultipliedAlpha = image->hasPremultipliedAlpha(); + initWithData(tempData, tempDataLen, image->getRenderFormat(), imageWidth, imageHeight, imageSize, image->hasPremultipliedAlpha()); return true; } @@ -801,18 +790,13 @@ bool Texture2D::initWithImage(Image *image, PixelFormat format) pixelFormat = convertDataToFormat(tempData, tempDataLen, renderFormat, pixelFormat, &outTempData, &outTempDataLen); - initWithData(outTempData, outTempDataLen, pixelFormat, imageWidth, imageHeight, imageSize); - + initWithData(outTempData, outTempDataLen, pixelFormat, imageWidth, imageHeight, imageSize, image->hasPremultipliedAlpha()); if (outTempData != nullptr && outTempData != tempData) { - free(outTempData); } - // set the premultiplied tag - _hasPremultipliedAlpha = image->hasPremultipliedAlpha(); - return true; } } @@ -1144,6 +1128,7 @@ bool Texture2D::initWithString(const char *text, const FontDefinition& textDefin auto textDef = textDefinition; auto contentScaleFactor = CC_CONTENT_SCALE_FACTOR(); textDef._fontSize *= contentScaleFactor; + textDef._lineSpacing *= contentScaleFactor; textDef._dimensions.width *= contentScaleFactor; textDef._dimensions.height *= contentScaleFactor; textDef._stroke._strokeSize *= contentScaleFactor; @@ -1190,13 +1175,12 @@ void Texture2D::drawAtPoint(const Vec2& point) point.x, height + point.y, width + point.x, height + point.y }; - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_TEX_COORD); + GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION | GL::VERTEX_ATTRIB_FLAG_TEX_COORD ); _shaderProgram->use(); _shaderProgram->setUniformsForBuiltins(); - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, _name); + GL::bindTexture2D( _name ); + glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices); glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_TEX_COORD, 2, GL_FLOAT, GL_FALSE, 0, coordinates); @@ -1217,13 +1201,11 @@ void Texture2D::drawInRect(const Rect& rect) rect.origin.x, rect.origin.y + rect.size.height, /*0.0f,*/ rect.origin.x + rect.size.width, rect.origin.y + rect.size.height, /*0.0f*/ }; - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_TEX_COORD); + GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION | GL::VERTEX_ATTRIB_FLAG_TEX_COORD ); _shaderProgram->use(); _shaderProgram->setUniformsForBuiltins(); - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, _name); + GL::bindTexture2D( _name ); glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices); glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_TEX_COORD, 2, GL_FLOAT, GL_FALSE, 0, coordinates); @@ -1244,8 +1226,7 @@ void Texture2D::PVRImagesHavePremultipliedAlpha(bool haveAlphaPremultiplied) void Texture2D::generateMipmap() { CCASSERT(_pixelsWide == ccNextPOT(_pixelsWide) && _pixelsHigh == ccNextPOT(_pixelsHigh), "Mipmap texture only works in POT textures"); - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, _name); + GL::bindTexture2D( _name ); glGenerateMipmap(GL_TEXTURE_2D); _hasMipmaps = true; #if CC_ENABLE_CACHE_TEXTURE_DATA @@ -1264,8 +1245,7 @@ void Texture2D::setTexParameters(const TexParams &texParams) (_pixelsHigh == ccNextPOT(_pixelsHigh) || texParams.wrapT == GL_CLAMP_TO_EDGE), "GL_CLAMP_TO_EDGE should be used in NPOT dimensions"); - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, _name); + GL::bindTexture2D( _name ); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, texParams.minFilter ); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, texParams.magFilter ); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, texParams.wrapS ); @@ -1290,8 +1270,7 @@ void Texture2D::setAliasTexParameters() return; } - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, _name); + GL::bindTexture2D( _name ); if( ! _hasMipmaps ) { @@ -1323,8 +1302,7 @@ void Texture2D::setAntiAliasTexParameters() return; } - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, _name); + GL::bindTexture2D( _name ); if( ! _hasMipmaps ) { @@ -1506,10 +1484,12 @@ void Texture2D::removeSpriteFrameCapInset(SpriteFrame* spriteFrame) /// halx99 spec, ANDROID ETC1 ALPHA supports. void Texture2D::setAlphaTexture(Texture2D* alphaTexture) { - if (alphaTexture != nullptr) { - this->_alphaTexture = alphaTexture; - this->_alphaTexture->retain(); - this->_hasPremultipliedAlpha = true; // PremultipliedAlpha should be true. + if (alphaTexture != nullptr) + { + alphaTexture->retain(); + CC_SAFE_RELEASE(_alphaTexture); + _alphaTexture = alphaTexture; + _hasPremultipliedAlpha = true; // PremultipliedAlpha should be true. } } diff --git a/cocos/renderer/CCTexture2D.h b/cocos/renderer/CCTexture2D.h index d237ec1b6ebc..112d9f5dcf73 100644 --- a/cocos/renderer/CCTexture2D.h +++ b/cocos/renderer/CCTexture2D.h @@ -226,10 +226,11 @@ class CC_DLL Texture2D : public Ref @param pixelsWide The image width. @param pixelsHigh The image height. @param contentSize The image content size. + @param preMultipliedAlpha The texture has premultiplied alpha * @js NA * @lua NA */ - bool initWithData(const void *data, ssize_t dataLen, Texture2D::PixelFormat pixelFormat, int pixelsWide, int pixelsHigh, const Size& contentSize); + bool initWithData(const void *data, ssize_t dataLen, Texture2D::PixelFormat pixelFormat, int pixelsWide, int pixelsHigh, const Size& contentSize, bool preMultipliedAlpha = false); /** Initializes with mipmaps. @@ -238,8 +239,9 @@ class CC_DLL Texture2D : public Ref @param pixelFormat The image pixelFormat. @param pixelsWide The image width. @param pixelsHigh The image height. + @param preMultipliedAlpha The texture has premultiplied alpha */ - bool initWithMipmaps(MipmapInfo* mipmaps, int mipmapsNum, Texture2D::PixelFormat pixelFormat, int pixelsWide, int pixelsHigh); + bool initWithMipmaps(MipmapInfo* mipmaps, int mipmapsNum, Texture2D::PixelFormat pixelFormat, int pixelsWide, int pixelsHigh, bool preMultipliedAlpha = false); /** Update with texture data. diff --git a/cocos/renderer/CCTextureAtlas.cpp b/cocos/renderer/CCTextureAtlas.cpp index 2bf88e598d68..750d1fa48c4b 100644 --- a/cocos/renderer/CCTextureAtlas.cpp +++ b/cocos/renderer/CCTextureAtlas.cpp @@ -39,6 +39,7 @@ THE SOFTWARE. #include "base/CCEventListenerCustom.h" #include "renderer/CCTextureCache.h" #include "renderer/CCGLProgram.h" +#include "renderer/ccGLStateCache.h" #include "renderer/CCRenderer.h" #include "renderer/CCTexture2D.h" #include "platform/CCGL.h" @@ -71,7 +72,7 @@ TextureAtlas::~TextureAtlas() if (Configuration::getInstance()->supportsShareableVAO()) { glDeleteVertexArrays(1, &_VAOname); - glBindVertexArray(0); + GL::bindVAO(0); } CC_SAFE_RELEASE(_texture); @@ -255,7 +256,7 @@ void TextureAtlas::setupIndices() void TextureAtlas::setupVBOandVAO() { glGenVertexArrays(1, &_VAOname); - glBindVertexArray(_VAOname); + GL::bindVAO(_VAOname); #define kQuadSize sizeof(_quads[0].bl) @@ -280,7 +281,7 @@ void TextureAtlas::setupVBOandVAO() glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(_indices[0]) * _capacity * 6, _indices, GL_STATIC_DRAW); // Must unbind the VAO before changing the element buffer. - glBindVertexArray(0); + GL::bindVAO(0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); glBindBuffer(GL_ARRAY_BUFFER, 0); @@ -297,7 +298,7 @@ void TextureAtlas::setupVBO() void TextureAtlas::mapBuffers() { // Avoid changing the element buffer for whatever VAO might be bound. - glBindVertexArray(0); + GL::bindVAO(0); glBindBuffer(GL_ARRAY_BUFFER, _buffersVBO[0]); glBufferData(GL_ARRAY_BUFFER, sizeof(_quads[0]) * _capacity, _quads, GL_DYNAMIC_DRAW); @@ -612,8 +613,7 @@ void TextureAtlas::drawNumberOfQuads(ssize_t numberOfQuads, ssize_t start) if(!numberOfQuads) return; - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, _texture->getName()); + GL::bindTexture2D(_texture); auto conf = Configuration::getInstance(); if (conf->supportsShareableVAO() && conf->supportsMapBuffer()) @@ -643,7 +643,7 @@ void TextureAtlas::drawNumberOfQuads(ssize_t numberOfQuads, ssize_t start) _dirty = false; } - glBindVertexArray(_VAOname); + GL::bindVAO(_VAOname); #if CC_REBIND_INDICES_BUFFER glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _buffersVBO[1]); @@ -651,7 +651,7 @@ void TextureAtlas::drawNumberOfQuads(ssize_t numberOfQuads, ssize_t start) glDrawElements(GL_TRIANGLES, (GLsizei) numberOfQuads*6, GL_UNSIGNED_SHORT, (GLvoid*) (start*6*sizeof(_indices[0])) ); - glBindVertexArray(0); + GL::bindVAO(0); #if CC_REBIND_INDICES_BUFFER glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); @@ -675,9 +675,7 @@ void TextureAtlas::drawNumberOfQuads(ssize_t numberOfQuads, ssize_t start) _dirty = false; } - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_COLOR); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_TEX_COORD); + GL::enableVertexAttribs(GL::VERTEX_ATTRIB_FLAG_POS_COLOR_TEX); // vertices glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 3, GL_FLOAT, GL_FALSE, kQuadSize, (GLvoid*) offsetof(V3F_C4B_T2F, vertices)); diff --git a/cocos/renderer/CCTextureAtlas.h b/cocos/renderer/CCTextureAtlas.h index ab564f4e3fa4..68d9ac35da79 100644 --- a/cocos/renderer/CCTextureAtlas.h +++ b/cocos/renderer/CCTextureAtlas.h @@ -67,7 +67,7 @@ class CC_DLL TextureAtlas : public Ref /** Creates a TextureAtlas with an filename and with an initial capacity for Quads. * The TextureAtlas capacity can be increased in runtime. - @param file A null terminated string contains the file path. + @param file The file path. @param capacity Capacity for Quads. */ static TextureAtlas* create(const std::string& file , ssize_t capacity); @@ -94,7 +94,7 @@ class CC_DLL TextureAtlas : public Ref * The TextureAtlas capacity can be increased in runtime. * @attention Do not reinitialize the TextureAtlas because it will leak memory (issue #706). - @param file A null terminated string contains the file path. + @param file The file path. @param capacity Capacity for Quads. */ bool initWithFile(const std::string& file, ssize_t capacity); diff --git a/cocos/renderer/CCTextureCache.cpp b/cocos/renderer/CCTextureCache.cpp index 83a85560fcb2..a4656430c4d5 100644 --- a/cocos/renderer/CCTextureCache.cpp +++ b/cocos/renderer/CCTextureCache.cpp @@ -404,7 +404,7 @@ Texture2D * TextureCache::addImage(const std::string &path) // Needed since addImageAsync calls this method from a different thread std::string fullpath = FileUtils::getInstance()->fullPathForFilename(path); - if (fullpath.size() == 0) + if (fullpath.empty()) { return nullptr; } @@ -527,7 +527,7 @@ bool TextureCache::reloadTexture(const std::string& fileName) Image * image = nullptr; std::string fullpath = FileUtils::getInstance()->fullPathForFilename(fileName); - if (fullpath.size() == 0) + if (fullpath.empty()) { return false; } diff --git a/cocos/renderer/CCTextureCache.h b/cocos/renderer/CCTextureCache.h index d96c2a45cac7..bebeebc5ccba 100644 --- a/cocos/renderer/CCTextureCache.h +++ b/cocos/renderer/CCTextureCache.h @@ -110,7 +110,7 @@ class CC_DLL TextureCache : public Ref * Object and it will return it. It will use the filename as a key. * Otherwise it will return a reference of a previously loaded image. * Supported image extensions: .png, .bmp, .tiff, .jpeg, .pvr. - @param filepath A null terminated string. + @param filepath The file path. */ Texture2D* addImage(const std::string &filepath); @@ -119,7 +119,7 @@ class CC_DLL TextureCache : public Ref * Otherwise it will load a texture in a new thread, and when the image is loaded, the callback will be called with the Texture2D as a parameter. * The callback will be called from the main thread, so it is safe to create any cocos2d object from the callback. * Supported image extensions: .png, .jpg - @param filepath A null terminated string. + @param filepath The file path. @param callback A callback function would be invoked after the image is loaded. @since v0.8 */ diff --git a/cocos/renderer/CCTextureCube.cpp b/cocos/renderer/CCTextureCube.cpp index d4dc61131bda..447fd7d5ddea 100644 --- a/cocos/renderer/CCTextureCube.cpp +++ b/cocos/renderer/CCTextureCube.cpp @@ -27,6 +27,8 @@ #include "platform/CCImage.h" #include "platform/CCFileUtils.h" +#include "renderer/ccGLStateCache.h" + NS_CC_BEGIN unsigned char* getImageData(Image* img, Texture2D::PixelFormat& ePixFmt) @@ -125,7 +127,7 @@ Image* createImage(const std::string& path) // Needed since addImageAsync calls this method from a different thread std::string fullpath = FileUtils::getInstance()->fullPathForFilename(path); - if (fullpath.size() == 0) + if (fullpath.empty()) { return nullptr; } @@ -191,8 +193,7 @@ bool TextureCube::init(const std::string& positive_x, const std::string& negativ GLuint handle; glGenTextures(1, &handle); - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_CUBE_MAP, handle); + GL::bindTextureN(0, handle, GL_TEXTURE_CUBE_MAP); for (int i = 0; i < 6; i++) { @@ -236,8 +237,7 @@ bool TextureCube::init(const std::string& positive_x, const std::string& negativ _name = handle; - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_CUBE_MAP, 0); + GL::bindTextureN(0, 0, GL_TEXTURE_CUBE_MAP); for (auto img: images) { @@ -251,16 +251,14 @@ void TextureCube::setTexParameters(const TexParams& texParams) { CCASSERT(_name != 0, __FUNCTION__); - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_CUBE_MAP, _name); + GL::bindTextureN(0, _name, GL_TEXTURE_CUBE_MAP); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, texParams.minFilter); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, texParams.magFilter); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, texParams.wrapS); glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, texParams.wrapT); - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_CUBE_MAP, 0); + GL::bindTextureN(0, 0, GL_TEXTURE_CUBE_MAP); } bool TextureCube::reloadTexture() diff --git a/cocos/renderer/CCTrianglesCommand.cpp b/cocos/renderer/CCTrianglesCommand.cpp index 8638716f37b6..bff6b7f92b2b 100644 --- a/cocos/renderer/CCTrianglesCommand.cpp +++ b/cocos/renderer/CCTrianglesCommand.cpp @@ -24,12 +24,12 @@ ****************************************************************************/ #include "renderer/CCTrianglesCommand.h" +#include "renderer/ccGLStateCache.h" #include "renderer/CCGLProgram.h" #include "renderer/CCGLProgramState.h" #include "xxhash.h" #include "renderer/CCRenderer.h" #include "renderer/CCTexture2D.h" -#include "base//ccUtils.h" NS_CC_BEGIN @@ -116,16 +116,14 @@ void TrianglesCommand::generateMaterialID() void TrianglesCommand::useMaterial() const { //Set texture - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, _textureID); + GL::bindTexture2D(_textureID); if (_alphaTextureID > 0) { // ANDROID ETC1 ALPHA supports. - glActiveTexture(GL_TEXTURE0 + 1); - glBindTexture(GL_TEXTURE_2D, _alphaTextureID); + GL::bindTexture2DN(1, _alphaTextureID); } //set blend mode - utils::setBlending(_blendType.src, _blendType.dst); + GL::blendFunc(_blendType.src, _blendType.dst); _glProgramState->apply(_mv); } diff --git a/cocos/renderer/CCVertexAttribBinding.cpp b/cocos/renderer/CCVertexAttribBinding.cpp index f3f296e16689..48f4a5dd5f34 100644 --- a/cocos/renderer/CCVertexAttribBinding.cpp +++ b/cocos/renderer/CCVertexAttribBinding.cpp @@ -22,6 +22,7 @@ #include "renderer/CCVertexAttribBinding.h" #include "renderer/CCGLProgramState.h" +#include "renderer/ccGLStateCache.h" #include "platform/CCGL.h" #include "base/CCConfiguration.h" #include "3d/CCMeshVertexIndexData.h" @@ -144,10 +145,16 @@ bool VertexAttribBinding::init(MeshIndexData* meshIndexData, GLProgramState* glP if (Configuration::getInstance()->supportsShareableVAO()) { glGenVertexArrays(1, &_handle); - glBindVertexArray(_handle); + GL::bindVAO(_handle); glBindBuffer(GL_ARRAY_BUFFER, meshVertexData->getVertexBuffer()->getVBO()); - enableVertexAttributes(_vertexAttribsFlags); + auto flags = _vertexAttribsFlags; + for (int i = 0; flags > 0; i++) { + int flag = 1 << i; + if (flag & flags) + glEnableVertexAttribArray(i); + flags &= ~flag; + } glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, meshIndexData->getIndexBuffer()->getVBO()); @@ -156,7 +163,7 @@ bool VertexAttribBinding::init(MeshIndexData* meshIndexData, GLProgramState* glP attribute.second.apply(); } - glBindVertexArray(0); + GL::bindVAO(0); glBindBuffer(GL_ARRAY_BUFFER, 0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); } @@ -170,7 +177,7 @@ void VertexAttribBinding::bind() if (_handle) { // hardware - glBindVertexArray(_handle); + GL::bindVAO(_handle); } else { @@ -180,7 +187,7 @@ void VertexAttribBinding::bind() glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _meshIndexData->getIndexBuffer()->getVBO()); // Software mode - enableVertexAttributes(_vertexAttribsFlags); + GL::enableVertexAttribs(_vertexAttribsFlags); // set attributes for(auto &attribute : _attributes) { @@ -195,7 +202,7 @@ void VertexAttribBinding::unbind() if (_handle) { // Hardware - glBindVertexArray(0); + GL::bindVAO(0); } else { @@ -226,19 +233,6 @@ void VertexAttribBinding::parseAttributes() } } -void VertexAttribBinding::enableVertexAttributes(uint32_t flags) const -{ - auto tmpFlags = flags; - for (int i = 0; tmpFlags > 0; i++) - { - int flag = 1 << i; - if (flag & tmpFlags) - glEnableVertexAttribArray(i); - - tmpFlags &= ~flag; - } -} - VertexAttribValue* VertexAttribBinding::getVertexAttribValue(const std::string& name) { const auto itr = _attributes.find(name); diff --git a/cocos/renderer/CCVertexAttribBinding.h b/cocos/renderer/CCVertexAttribBinding.h index 5a6b60508950..4325089192c4 100644 --- a/cocos/renderer/CCVertexAttribBinding.h +++ b/cocos/renderer/CCVertexAttribBinding.h @@ -89,6 +89,9 @@ class CC_DLL VertexAttribBinding : public Ref private: + + bool init(MeshIndexData* meshIndexData, GLProgramState* glProgramState); + /** * Constructor. */ @@ -103,12 +106,10 @@ class CC_DLL VertexAttribBinding : public Ref * Hidden copy assignment operator. */ VertexAttribBinding& operator=(const VertexAttribBinding&); - - bool init(MeshIndexData* meshIndexData, GLProgramState* glProgramState); + void setVertexAttribPointer(const std::string& name, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLvoid* pointer); VertexAttribValue* getVertexAttribValue(const std::string &name); void parseAttributes(); - void enableVertexAttributes(uint32_t flags) const; GLuint _handle; diff --git a/cocos/renderer/CCVertexIndexBuffer.cpp b/cocos/renderer/CCVertexIndexBuffer.cpp index 37342e219591..7b0f08989fd3 100644 --- a/cocos/renderer/CCVertexIndexBuffer.cpp +++ b/cocos/renderer/CCVertexIndexBuffer.cpp @@ -291,15 +291,15 @@ void IndexBuffer::recreateVBO() const { CCLOG("come to foreground of IndexBuffer"); glGenBuffers(1, &_vbo); - glBindBuffer(GL_ARRAY_BUFFER, _vbo); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _vbo); const void* buffer = nullptr; if(isShadowCopyEnabled()) { buffer = &_shadowCopy[0]; } CCLOG("recreate IndexBuffer with size %d %d ", getSizePerIndex(), _indexNumber); - glBufferData(GL_ARRAY_BUFFER, getSize(), buffer, _usage); - glBindBuffer(GL_ARRAY_BUFFER, 0); + glBufferData(GL_ELEMENT_ARRAY_BUFFER, getSize(), buffer, _usage); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); if(!glIsBuffer(_vbo)) { CCLOGERROR("recreate IndexBuffer Error"); diff --git a/cocos/renderer/CCVertexIndexData.cpp b/cocos/renderer/CCVertexIndexData.cpp index e8e3b79f1bc0..4a69bdd699f2 100644 --- a/cocos/renderer/CCVertexIndexData.cpp +++ b/cocos/renderer/CCVertexIndexData.cpp @@ -24,6 +24,7 @@ ****************************************************************************/ #include "renderer/CCVertexIndexData.h" +#include "renderer/ccGLStateCache.h" #include "renderer/CCVertexIndexBuffer.h" NS_CC_BEGIN @@ -115,12 +116,13 @@ VertexData::~VertexData() void VertexData::use() { - + uint32_t flags(0); for(auto& element : _vertexStreams) { - glEnableVertexAttribArray(element.second._stream._semantic); + flags = flags | (1 << element.second._stream._semantic); } + GL::enableVertexAttribs(flags); int lastVBO = -1; for(auto& element : _vertexStreams) diff --git a/cocos/renderer/CMakeLists.txt b/cocos/renderer/CMakeLists.txt index 269ae867dc98..a6ce84ec4423 100644 --- a/cocos/renderer/CMakeLists.txt +++ b/cocos/renderer/CMakeLists.txt @@ -2,6 +2,7 @@ set(COCOS_RENDERER_HEADER renderer/CCTextureCache.h renderer/CCRenderer.h renderer/CCMaterial.h + renderer/ccGLStateCache.h renderer/CCRenderCommandPool.h renderer/ccShaders.h renderer/CCMeshCommand.h @@ -55,6 +56,7 @@ set(COCOS_RENDERER_SRC renderer/CCVertexAttribBinding.cpp renderer/CCVertexIndexBuffer.cpp renderer/CCVertexIndexData.cpp + renderer/ccGLStateCache.cpp renderer/ccShaders.cpp renderer/CCFrameBuffer.cpp ) diff --git a/cocos/renderer/ccGLStateCache.cpp b/cocos/renderer/ccGLStateCache.cpp new file mode 100644 index 000000000000..d6aaedaff954 --- /dev/null +++ b/cocos/renderer/ccGLStateCache.cpp @@ -0,0 +1,280 @@ +/**************************************************************************** +Copyright (c) 2011 Ricardo Quesada +Copyright (c) 2010-2012 cocos2d-x.org +Copyright (c) 2011 Zynga Inc. +Copyright (c) 2013-2016 Chukong Technologies Inc. +Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#include "renderer/ccGLStateCache.h" + +#include "renderer/CCGLProgram.h" +#include "renderer/CCRenderState.h" +#include "base/CCDirector.h" +#include "base/ccConfig.h" +#include "base/CCConfiguration.h" + +NS_CC_BEGIN + +static const int MAX_ATTRIBUTES = 16; +static const int MAX_ACTIVE_TEXTURE = 16; + +namespace +{ + static GLuint s_currentProjectionMatrix = -1; + static uint32_t s_attributeFlags = 0; // 32 attributes max + +#if CC_ENABLE_GL_STATE_CACHE + + static GLuint s_currentShaderProgram = -1; + static GLuint s_currentBoundTexture[MAX_ACTIVE_TEXTURE] = {(GLuint)-1,(GLuint)-1,(GLuint)-1,(GLuint)-1, (GLuint)-1,(GLuint)-1,(GLuint)-1,(GLuint)-1, (GLuint)-1,(GLuint)-1,(GLuint)-1,(GLuint)-1, (GLuint)-1,(GLuint)-1,(GLuint)-1,(GLuint)-1, }; + static GLenum s_blendingSource = -1; + static GLenum s_blendingDest = -1; + static int s_GLServerState = 0; + static GLuint s_VAO = 0; + static GLenum s_activeTexture = -1; + +#endif // CC_ENABLE_GL_STATE_CACHE +} + +// GL State Cache functions + +namespace GL { + +void invalidateStateCache() +{ + Director::getInstance()->resetMatrixStack(); + s_currentProjectionMatrix = -1; + s_attributeFlags = 0; + +#if CC_ENABLE_GL_STATE_CACHE + s_currentShaderProgram = -1; + for( int i=0; i < MAX_ACTIVE_TEXTURE; i++ ) + { + s_currentBoundTexture[i] = -1; + } + + s_blendingSource = -1; + s_blendingDest = -1; + s_GLServerState = 0; + s_VAO = 0; + +#endif // CC_ENABLE_GL_STATE_CACHE +} + +void deleteProgram( GLuint program ) +{ +#if CC_ENABLE_GL_STATE_CACHE + if(program == s_currentShaderProgram) + { + s_currentShaderProgram = -1; + } +#endif // CC_ENABLE_GL_STATE_CACHE + + glDeleteProgram( program ); +} + +void useProgram( GLuint program ) +{ +#if CC_ENABLE_GL_STATE_CACHE + if( program != s_currentShaderProgram ) { + s_currentShaderProgram = program; + glUseProgram(program); + } +#else + glUseProgram(program); +#endif // CC_ENABLE_GL_STATE_CACHE +} + +static void SetBlending(GLenum sfactor, GLenum dfactor) +{ + if (sfactor == GL_ONE && dfactor == GL_ZERO) + { + glDisable(GL_BLEND); + RenderState::StateBlock::_defaultState->setBlend(false); + } + else + { + glEnable(GL_BLEND); + glBlendFunc(sfactor, dfactor); + + RenderState::StateBlock::_defaultState->setBlend(true); + RenderState::StateBlock::_defaultState->setBlendSrc((RenderState::Blend)sfactor); + RenderState::StateBlock::_defaultState->setBlendDst((RenderState::Blend)dfactor); + } +} + +void blendFunc(GLenum sfactor, GLenum dfactor) +{ +#if CC_ENABLE_GL_STATE_CACHE + if (sfactor != s_blendingSource || dfactor != s_blendingDest) + { + s_blendingSource = sfactor; + s_blendingDest = dfactor; + SetBlending(sfactor, dfactor); + } +#else + SetBlending( sfactor, dfactor ); +#endif // CC_ENABLE_GL_STATE_CACHE +} + +void blendResetToCache() +{ + glBlendEquation(GL_FUNC_ADD); +#if CC_ENABLE_GL_STATE_CACHE + SetBlending(s_blendingSource, s_blendingDest); +#else + SetBlending(CC_BLEND_SRC, CC_BLEND_DST); +#endif // CC_ENABLE_GL_STATE_CACHE +} + +void bindTexture2D(GLuint textureId) +{ + GL::bindTexture2DN(0, textureId); +} + +void bindTexture2D(Texture2D* texture) +{ + GL::bindTexture2DN(0, texture->getName()); + auto alphaTexID = texture->getAlphaTextureName(); + if (alphaTexID > 0) { + GL::bindTexture2DN(1, alphaTexID); + } +} + +void bindTexture2DN(GLuint textureUnit, GLuint textureId) +{ +#if CC_ENABLE_GL_STATE_CACHE + CCASSERT(textureUnit < MAX_ACTIVE_TEXTURE, "textureUnit is too big"); + if (s_currentBoundTexture[textureUnit] != textureId) + { + s_currentBoundTexture[textureUnit] = textureId; + activeTexture(GL_TEXTURE0 + textureUnit); + glBindTexture(GL_TEXTURE_2D, textureId); + } +#else + glActiveTexture(GL_TEXTURE0 + textureUnit); + glBindTexture(GL_TEXTURE_2D, textureId); +#endif +} + +void bindTextureN(GLuint textureUnit, GLuint textureId, GLuint textureType/* = GL_TEXTURE_2D*/) +{ +#if CC_ENABLE_GL_STATE_CACHE + CCASSERT(textureUnit < MAX_ACTIVE_TEXTURE, "textureUnit is too big"); + if (s_currentBoundTexture[textureUnit] != textureId) + { + s_currentBoundTexture[textureUnit] = textureId; + activeTexture(GL_TEXTURE0 + textureUnit); + glBindTexture(textureType, textureId); + } +#else + glActiveTexture(GL_TEXTURE0 + textureUnit); + glBindTexture(textureType, textureId); +#endif +} + + +void deleteTexture(GLuint textureId) +{ +#if CC_ENABLE_GL_STATE_CACHE + for (size_t i = 0; i < MAX_ACTIVE_TEXTURE; ++i) + { + if (s_currentBoundTexture[i] == textureId) + { + s_currentBoundTexture[i] = -1; + } + } +#endif // CC_ENABLE_GL_STATE_CACHE + + glDeleteTextures(1, &textureId); +} + +void deleteTextureN(GLuint /*textureUnit*/, GLuint textureId) +{ + deleteTexture(textureId); +} + +void activeTexture(GLenum texture) +{ +#if CC_ENABLE_GL_STATE_CACHE + if(s_activeTexture != texture) { + s_activeTexture = texture; + glActiveTexture(s_activeTexture); + } +#else + glActiveTexture(texture); +#endif +} + +void bindVAO(GLuint vaoId) +{ + if (Configuration::getInstance()->supportsShareableVAO()) + { + +#if CC_ENABLE_GL_STATE_CACHE + if (s_VAO != vaoId) + { + s_VAO = vaoId; + glBindVertexArray(vaoId); + } +#else + glBindVertexArray(vaoId); +#endif // CC_ENABLE_GL_STATE_CACHE + + } +} + +// GL Vertex Attrib functions + +void enableVertexAttribs(uint32_t flags) +{ + bindVAO(0); + + // hardcoded! + for(int i=0; i < MAX_ATTRIBUTES; i++) { + unsigned int bit = 1 << i; + //FIXME:Cache is disabled, try to enable cache as before + bool enabled = (flags & bit) != 0; + bool enabledBefore = (s_attributeFlags & bit) != 0; + if(enabled != enabledBefore) + { + if( enabled ) + glEnableVertexAttribArray(i); + else + glDisableVertexAttribArray(i); + } + } + s_attributeFlags = flags; +} + +// GL Uniforms functions + +void setProjectionMatrixDirty() +{ + s_currentProjectionMatrix = -1; +} + +} // Namespace GL + +NS_CC_END diff --git a/cocos/renderer/ccGLStateCache.h b/cocos/renderer/ccGLStateCache.h new file mode 100644 index 000000000000..bbe3ab947deb --- /dev/null +++ b/cocos/renderer/ccGLStateCache.h @@ -0,0 +1,193 @@ +/**************************************************************************** + Copyright (c) 2011 Ricardo Quesada + Copyright (c) 2010-2012 cocos2d-x.org + Copyright (c) 2011 Zynga Inc. + Copyright (c) 2013-2016 Chukong Technologies Inc. + Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#ifndef __CCGLSTATE_H__ +#define __CCGLSTATE_H__ + +#include + +#include "platform/CCGL.h" +#include "platform/CCPlatformMacros.h" + +NS_CC_BEGIN + +/** + * @addtogroup renderer + * @{ + */ + +class GLProgram; +class Texture2D; +namespace GL { + +/** Vertex attrib flags. */ +enum { + VERTEX_ATTRIB_FLAG_NONE = 0, + + VERTEX_ATTRIB_FLAG_POSITION = 1 << 0, + VERTEX_ATTRIB_FLAG_COLOR = 1 << 1, + VERTEX_ATTRIB_FLAG_TEX_COORD = 1 << 2, + VERTEX_ATTRIB_FLAG_NORMAL = 1 << 3, + VERTEX_ATTRIB_FLAG_BLEND_WEIGHT = 1 << 4, + VERTEX_ATTRIB_FLAG_BLEND_INDEX = 1 << 5, + + VERTEX_ATTRIB_FLAG_POS_COLOR_TEX = (VERTEX_ATTRIB_FLAG_POSITION | VERTEX_ATTRIB_FLAG_COLOR | VERTEX_ATTRIB_FLAG_TEX_COORD), +}; + +/** + * Invalidates the GL state cache. + * + * If CC_ENABLE_GL_STATE_CACHE it will reset the GL state cache. + * @since v2.0.0 + */ +void CC_DLL invalidateStateCache(); + +/** + * Uses the GL program in case program is different than the current one. + + * If CC_ENABLE_GL_STATE_CACHE is disabled, it will the glUseProgram() directly. + * @since v2.0.0 + */ +void CC_DLL useProgram(GLuint program); + +/** + * Deletes the GL program. If it is the one that is being used, it invalidates it. + * + * If CC_ENABLE_GL_STATE_CACHE is disabled, it will the glDeleteProgram() directly. + * @since v2.0.0 + */ +void CC_DLL deleteProgram(GLuint program); + +/** + * Uses a blending function in case it not already used. + * + * If CC_ENABLE_GL_STATE_CACHE is disabled, it will the glBlendFunc() directly. + * @since v2.0.0 + */ +void CC_DLL blendFunc(GLenum sfactor, GLenum dfactor); + +/** + * Resets the blending mode back to the cached state in case you used glBlendFuncSeparate() or glBlendEquation(). + * + * If CC_ENABLE_GL_STATE_CACHE is disabled, it will just set the default blending mode using GL_FUNC_ADD. + * @since v2.0.0 + */ +void CC_DLL blendResetToCache(); + +/** + * Sets the projection matrix as dirty. + * @since v2.0.0 + */ +void CC_DLL setProjectionMatrixDirty(); + +/** + * Will enable the vertex attribs that are passed as flags. + * Possible flags: + * + * * VERTEX_ATTRIB_FLAG_POSITION + * * VERTEX_ATTRIB_FLAG_COLOR + * * VERTEX_ATTRIB_FLAG_TEX_COORDS + * + * These flags can be ORed. The flags that are not present, will be disabled. + * + * @since v2.0.0 + */ +void CC_DLL enableVertexAttribs(uint32_t flags); + +/** + * If the texture is not already bound to texture unit 0, it binds it. + * + * If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glBindTexture() directly. + * @since v2.0.0 + */ +void CC_DLL bindTexture2D(GLuint textureId); + +/** +* If the texture is not already bound to texture unit 0, it binds it. +* +* If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glBindTexture() directly. +* +* @remark: It will bind alpha texture to support ETC1 alpha channel. +* @since v3.13 +*/ +void CC_DLL bindTexture2D(Texture2D* texture); + +/** + * If the texture is not already bound to a given unit, it binds it. + * + * If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glBindTexture() directly. + * @since v2.1.0 + */ +void CC_DLL bindTexture2DN(GLuint textureUnit, GLuint textureId); + +/** If the texture is not already bound to a given unit, it binds it. + * If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glBindTexture() directly. + * @since v3.6 + */ +void CC_DLL bindTextureN(GLuint textureUnit, GLuint textureId, GLuint textureType = GL_TEXTURE_2D); + +/** + * It will delete a given texture. If the texture was bound, it will invalidate the cached. + * + * If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glDeleteTextures() directly. + * @since v2.0.0 + */ +void CC_DLL deleteTexture(GLuint textureId); + +/** + * It will delete a given texture. If the texture was bound, it will invalidate the cached for the given texture unit. + * + * If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glDeleteTextures() directly. + * @since v2.1.0 + */ +CC_DEPRECATED_ATTRIBUTE void CC_DLL deleteTextureN(GLuint textureUnit, GLuint textureId); + +/** + * Select active texture unit. + * + * If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glActiveTexture() directly. + * @since v3.0 + */ +void CC_DLL activeTexture(GLenum texture); + +/** + * If the vertex array is not already bound, it binds it. + * + * If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glBindVertexArray() directly. + * @since v2.0.0 + */ +void CC_DLL bindVAO(GLuint vaoId); + +// end of support group +/// @} + +} // Namespace GL +NS_CC_END + + +#endif /* __CCGLSTATE_H__ */ diff --git a/cocos/renderer/ccShader_PositionTextureColor_noMVP.frag b/cocos/renderer/ccShader_PositionTextureColor_noMVP.frag index b3f48f7e232b..dc917a804234 100644 --- a/cocos/renderer/ccShader_PositionTextureColor_noMVP.frag +++ b/cocos/renderer/ccShader_PositionTextureColor_noMVP.frag @@ -24,9 +24,6 @@ */ const char* ccPositionTextureColor_noMVP_frag = R"( -#ifdef GL_ES -precision lowp float; -#endif varying vec4 v_fragmentColor; varying vec2 v_texCoord; diff --git a/cocos/scripting/js-bindings/CMakeLists.txt b/cocos/scripting/js-bindings/CMakeLists.txt index 0345172f539f..20e76ba4976e 100644 --- a/cocos/scripting/js-bindings/CMakeLists.txt +++ b/cocos/scripting/js-bindings/CMakeLists.txt @@ -165,14 +165,8 @@ target_include_directories(jscocos2d INTERFACE ${cocos_root}/cocos/scripting/js-bindings/manual ) -# ignore part warnings on binding codes. tocheck: not take effect? - if(WINDOWS) target_compile_definitions(jscocos2d PRIVATE _USRJSSTATIC) -else() - target_compile_options(jscocos2d PRIVATE - -Wno-deprecated - ) endif() set_target_properties(jscocos2d @@ -184,4 +178,10 @@ set_target_properties(jscocos2d if(XCODE OR VS) cocos_mark_code_files("jscocos2d") -endif() \ No newline at end of file +endif() + +if(${CMAKE_VERSION} VERSION_GREATER "3.16.0") + message("CMake 3.16 target_precompile_headers") + target_precompile_headers(jscocos2d PRIVATE + "$<$:precheader.h>") +endif() diff --git a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_auto_api.js b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_auto_api.js index 72882a7ad456..8c2e831da9b7 100644 --- a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_auto_api.js +++ b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_auto_api.js @@ -2400,6 +2400,16 @@ float return false; }, +/** + * @method getVR + * @return {cc.VRIRenderer} + */ +getVR : function ( +) +{ + return cc.VRIRenderer; +}, + /** * @method getContentScaleFactor * @return {float} @@ -2431,13 +2441,19 @@ getSafeAreaRect : function ( }, /** - * @method getVR - * @return {cc.VRIRenderer} + * @method setViewPortInPoints + * @param {float} arg0 + * @param {float} arg1 + * @param {float} arg2 + * @param {float} arg3 */ -getVR : function ( +setViewPortInPoints : function ( +float, +float, +float, +float ) { - return cc.VRIRenderer; }, /** @@ -2514,16 +2530,6 @@ getVisibleOrigin : function ( return cc.Vec2; }, -/** - * @method getFrameSize - * @return {size_object} - */ -getFrameSize : function ( -) -{ - return cc.Size; -}, - /** * @method setFrameZoomFactor * @param {float} arg0 @@ -2564,6 +2570,14 @@ str { }, +/** + * @method setDefaultCursor + */ +setDefaultCursor : function ( +) +{ +}, + /** * @method windowShouldClose * @return {bool} @@ -2631,19 +2645,13 @@ vrirenderer }, /** - * @method setViewPortInPoints - * @param {float} arg0 - * @param {float} arg1 - * @param {float} arg2 - * @param {float} arg3 + * @method getFrameSize + * @return {size_object} */ -setViewPortInPoints : function ( -float, -float, -float, -float +getFrameSize : function ( ) { + return cc.Size; }, /** @@ -2656,6 +2664,18 @@ getScissorRect : function ( return cc.Rect; }, +/** + * @method setCursor + * @param {String} arg0 + * @param {vec2_object} arg1 + */ +setCursor : function ( +str, +vec2 +) +{ +}, + /** * @method getRetinaFactor * @return {int} @@ -3377,6 +3397,16 @@ getAnimationInterval : function ( return 0; }, +/** + * @method getClearColor + * @return {color4f_object} + */ +getClearColor : function ( +) +{ + return cc.Color4F; +}, + /** * @method isPaused * @return {bool} @@ -6713,6 +6743,16 @@ supportsMapBuffer : function ( return false; }, +/** + * @method getInfoAsMap + * @return {map_object} + */ +getInfoAsMap : function ( +) +{ + return map_object; +}, + /** * @method destroyInstance */ diff --git a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_experimental_video_auto_api.js b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_experimental_video_auto_api.js index 1751546076b1..dfa20a6088c0 100644 --- a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_experimental_video_auto_api.js +++ b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_experimental_video_auto_api.js @@ -36,6 +36,16 @@ play : function ( { }, +/** + * @method isUserInputEnabled + * @return {bool} + */ +isUserInputEnabled : function ( +) +{ + return false; +}, + /** * @method setKeepAspectRatioEnabled * @param {bool} arg0 @@ -84,6 +94,26 @@ str { }, +/** + * @method setStyle + * @param {cc.experimental::ui::VideoPlayer::StyleType} arg0 + */ +setStyle : function ( +styletype +) +{ +}, + +/** + * @method seekTo + * @param {float} arg0 + */ +seekTo : function ( +float +) +{ +}, + /** * @method isKeepAspectRatioEnabled * @return {bool} @@ -114,6 +144,16 @@ isFullScreenEnabled : function ( return false; }, +/** + * @method isLooping + * @return {bool} + */ +isLooping : function ( +) +{ + return false; +}, + /** * @method isPlaying * @return {bool} @@ -125,11 +165,21 @@ isPlaying : function ( }, /** - * @method seekTo - * @param {float} arg0 + * @method setLooping + * @param {bool} arg0 */ -seekTo : function ( -float +setLooping : function ( +bool +) +{ +}, + +/** + * @method setUserInputEnabled + * @param {bool} arg0 + */ +setUserInputEnabled : function ( +bool ) { }, diff --git a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_ui_auto_api.js b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_ui_auto_api.js index fd44e2737df7..10dc94b06f7b 100644 --- a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_ui_auto_api.js +++ b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_ui_auto_api.js @@ -4293,6 +4293,14 @@ getCapInsetsBarRenderer : function ( return cc.Rect; }, +/** + * @method updateVisualSlider + */ +updateVisualSlider : function ( +) +{ +}, + /** * @method getCapInsetsProgressBarRenderer * @return {rect_object} diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp index 957ad77f5ba6..422693fec57a 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp @@ -280,6 +280,27 @@ bool js_cocos2dx_Texture2D_initWithMipmaps(JSContext *cx, uint32_t argc, jsval * args.rval().set(jsret); return true; } + if (argc == 6) { + cocos2d::_MipmapInfo* arg0 = nullptr; + int arg1 = 0; + cocos2d::Texture2D::PixelFormat arg2; + int arg3 = 0; + int arg4 = 0; + bool arg5; + #pragma warning NO CONVERSION TO NATIVE FOR _MipmapInfo* + ok = false; + ok &= jsval_to_int32(cx, args.get(1), (int32_t *)&arg1); + ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); + ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3); + ok &= jsval_to_int32(cx, args.get(4), (int32_t *)&arg4); + arg5 = JS::ToBoolean(args.get(5)); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Texture2D_initWithMipmaps : Error processing arguments"); + bool ret = cobj->initWithMipmaps(arg0, arg1, arg2, arg3, arg4, arg5); + JS::RootedValue jsret(cx); + jsret = BOOLEAN_TO_JSVAL(ret); + args.rval().set(jsret); + return true; + } JS_ReportError(cx, "js_cocos2dx_Texture2D_initWithMipmaps : wrong number of arguments: %d, was expecting %d", argc, 5); return false; @@ -6065,6 +6086,28 @@ bool js_cocos2dx_GLView_setContentScaleFactor(JSContext *cx, uint32_t argc, jsva JS_ReportError(cx, "js_cocos2dx_GLView_setContentScaleFactor : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } +bool js_cocos2dx_GLView_getVR(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_getVR : Invalid Native Object"); + if (argc == 0) { + cocos2d::VRIRenderer* ret = cobj->getVR(); + JS::RootedValue jsret(cx); + if (ret) { + jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject(cx, (cocos2d::VRIRenderer*)ret)); + } else { + jsret = JSVAL_NULL; + }; + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_GLView_getVR : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_GLView_getContentScaleFactor(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -6121,26 +6164,30 @@ bool js_cocos2dx_GLView_getSafeAreaRect(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_GLView_getSafeAreaRect : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } -bool js_cocos2dx_GLView_getVR(JSContext *cx, uint32_t argc, jsval *vp) +bool js_cocos2dx_GLView_setViewPortInPoints(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); js_proxy_t *proxy = jsb_get_js_proxy(obj); cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_getVR : Invalid Native Object"); - if (argc == 0) { - cocos2d::VRIRenderer* ret = cobj->getVR(); - JS::RootedValue jsret(cx); - if (ret) { - jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject(cx, (cocos2d::VRIRenderer*)ret)); - } else { - jsret = JSVAL_NULL; - }; - args.rval().set(jsret); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_setViewPortInPoints : Invalid Native Object"); + if (argc == 4) { + double arg0 = 0; + double arg1 = 0; + double arg2 = 0; + double arg3 = 0; + ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0); + ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1); + ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2); + ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLView_setViewPortInPoints : Error processing arguments"); + cobj->setViewPortInPoints(arg0, arg1, arg2, arg3); + args.rval().setUndefined(); return true; } - JS_ReportError(cx, "js_cocos2dx_GLView_getVR : wrong number of arguments: %d, was expecting %d", argc, 0); + JS_ReportError(cx, "js_cocos2dx_GLView_setViewPortInPoints : wrong number of arguments: %d, was expecting %d", argc, 4); return false; } bool js_cocos2dx_GLView_setScissorInPoints(JSContext *cx, uint32_t argc, jsval *vp) @@ -6277,24 +6324,6 @@ bool js_cocos2dx_GLView_getVisibleOrigin(JSContext *cx, uint32_t argc, jsval *vp JS_ReportError(cx, "js_cocos2dx_GLView_getVisibleOrigin : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } -bool js_cocos2dx_GLView_getFrameSize(JSContext *cx, uint32_t argc, jsval *vp) -{ - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); - js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_getFrameSize : Invalid Native Object"); - if (argc == 0) { - cocos2d::Size ret = cobj->getFrameSize(); - JS::RootedValue jsret(cx); - jsret = ccsize_to_jsval(cx, ret); - args.rval().set(jsret); - return true; - } - - JS_ReportError(cx, "js_cocos2dx_GLView_getFrameSize : wrong number of arguments: %d, was expecting %d", argc, 0); - return false; -} bool js_cocos2dx_GLView_setFrameZoomFactor(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -6387,6 +6416,22 @@ bool js_cocos2dx_GLView_setIcon(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_GLView_setIcon : wrong number of arguments"); return false; } +bool js_cocos2dx_GLView_setDefaultCursor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_setDefaultCursor : Invalid Native Object"); + if (argc == 0) { + cobj->setDefaultCursor(); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_GLView_setDefaultCursor : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_GLView_windowShouldClose(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -6531,30 +6576,22 @@ bool js_cocos2dx_GLView_setVR(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_GLView_setVR : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } -bool js_cocos2dx_GLView_setViewPortInPoints(JSContext *cx, uint32_t argc, jsval *vp) +bool js_cocos2dx_GLView_getFrameSize(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - bool ok = true; JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); js_proxy_t *proxy = jsb_get_js_proxy(obj); cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_setViewPortInPoints : Invalid Native Object"); - if (argc == 4) { - double arg0 = 0; - double arg1 = 0; - double arg2 = 0; - double arg3 = 0; - ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0); - ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1); - ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2); - ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLView_setViewPortInPoints : Error processing arguments"); - cobj->setViewPortInPoints(arg0, arg1, arg2, arg3); - args.rval().setUndefined(); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_getFrameSize : Invalid Native Object"); + if (argc == 0) { + cocos2d::Size ret = cobj->getFrameSize(); + JS::RootedValue jsret(cx); + jsret = ccsize_to_jsval(cx, ret); + args.rval().set(jsret); return true; } - JS_ReportError(cx, "js_cocos2dx_GLView_setViewPortInPoints : wrong number of arguments: %d, was expecting %d", argc, 4); + JS_ReportError(cx, "js_cocos2dx_GLView_getFrameSize : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } bool js_cocos2dx_GLView_getScissorRect(JSContext *cx, uint32_t argc, jsval *vp) @@ -6575,6 +6612,36 @@ bool js_cocos2dx_GLView_getScissorRect(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_GLView_getScissorRect : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } +bool js_cocos2dx_GLView_setCursor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::GLView* cobj = (cocos2d::GLView *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_GLView_setCursor : Invalid Native Object"); + if (argc == 1) { + std::string arg0; + ok &= jsval_to_std_string(cx, args.get(0), &arg0); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLView_setCursor : Error processing arguments"); + cobj->setCursor(arg0); + args.rval().setUndefined(); + return true; + } + if (argc == 2) { + std::string arg0; + cocos2d::Vec2 arg1; + ok &= jsval_to_std_string(cx, args.get(0), &arg0); + ok &= jsval_to_vector2(cx, args.get(1), &arg1); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_GLView_setCursor : Error processing arguments"); + cobj->setCursor(arg0, arg1); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_GLView_setCursor : wrong number of arguments: %d, was expecting %d", argc, 1); + return false; +} bool js_cocos2dx_GLView_getRetinaFactor(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -6737,10 +6804,11 @@ void js_register_cocos2dx_GLView(JSContext *cx, JS::HandleObject global) { JS_FN("getViewPortRect", js_cocos2dx_GLView_getViewPortRect, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getScaleY", js_cocos2dx_GLView_getScaleY, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setContentScaleFactor", js_cocos2dx_GLView_setContentScaleFactor, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getVR", js_cocos2dx_GLView_getVR, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getContentScaleFactor", js_cocos2dx_GLView_getContentScaleFactor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setIMEKeyboardState", js_cocos2dx_GLView_setIMEKeyboardState, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getSafeAreaRect", js_cocos2dx_GLView_getSafeAreaRect, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("getVR", js_cocos2dx_GLView_getVR, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("setViewPortInPoints", js_cocos2dx_GLView_setViewPortInPoints, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setScissorInPoints", js_cocos2dx_GLView_setScissorInPoints, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getViewName", js_cocos2dx_GLView_getViewName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("isOpenGLReady", js_cocos2dx_GLView_isOpenGLReady, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -6748,19 +6816,20 @@ void js_register_cocos2dx_GLView(JSContext *cx, JS::HandleObject global) { JS_FN("setDefaultIcon", js_cocos2dx_GLView_setDefaultIcon, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getScaleX", js_cocos2dx_GLView_getScaleX, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getVisibleOrigin", js_cocos2dx_GLView_getVisibleOrigin, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("getFrameSize", js_cocos2dx_GLView_getFrameSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setFrameZoomFactor", js_cocos2dx_GLView_setFrameZoomFactor, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getFrameZoomFactor", js_cocos2dx_GLView_getFrameZoomFactor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getDesignResolutionSize", js_cocos2dx_GLView_getDesignResolutionSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setIcon", js_cocos2dx_GLView_setIcon, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("setDefaultCursor", js_cocos2dx_GLView_setDefaultCursor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("windowShouldClose", js_cocos2dx_GLView_windowShouldClose, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setDesignResolutionSize", js_cocos2dx_GLView_setDesignResolutionSize, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getResolutionPolicy", js_cocos2dx_GLView_getResolutionPolicy, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("isRetinaDisplay", js_cocos2dx_GLView_isRetinaDisplay, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("renderScene", js_cocos2dx_GLView_renderScene, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setVR", js_cocos2dx_GLView_setVR, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("setViewPortInPoints", js_cocos2dx_GLView_setViewPortInPoints, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getFrameSize", js_cocos2dx_GLView_getFrameSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getScissorRect", js_cocos2dx_GLView_getScissorRect, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("setCursor", js_cocos2dx_GLView_setCursor, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getRetinaFactor", js_cocos2dx_GLView_getRetinaFactor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setViewName", js_cocos2dx_GLView_setViewName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getVisibleRect", js_cocos2dx_GLView_getVisibleRect, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -8101,6 +8170,24 @@ bool js_cocos2dx_Director_getAnimationInterval(JSContext *cx, uint32_t argc, jsv JS_ReportError(cx, "js_cocos2dx_Director_getAnimationInterval : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } +bool js_cocos2dx_Director_getClearColor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::Director* cobj = (cocos2d::Director *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Director_getClearColor : Invalid Native Object"); + if (argc == 0) { + const cocos2d::Color4F& ret = cobj->getClearColor(); + JS::RootedValue jsret(cx); + jsret = cccolor4f_to_jsval(cx, ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_Director_getClearColor : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_Director_isPaused(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -8329,6 +8416,7 @@ void js_register_cocos2dx_Director(JSContext *cx, JS::HandleObject global) { JS_FN("getScheduler", js_cocos2dx_Director_getScheduler, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("pushScene", js_cocos2dx_Director_pushScene, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getAnimationInterval", js_cocos2dx_Director_getAnimationInterval, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getClearColor", js_cocos2dx_Director_getClearColor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("isPaused", js_cocos2dx_Director_isPaused, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setDisplayStats", js_cocos2dx_Director_setDisplayStats, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getEventDispatcher", js_cocos2dx_Director_getEventDispatcher, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -9752,6 +9840,22 @@ bool js_cocos2dx_Image_hasPremultipliedAlpha(JSContext *cx, uint32_t argc, jsval JS_ReportError(cx, "js_cocos2dx_Image_hasPremultipliedAlpha : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } +bool js_cocos2dx_Image_reversePremultipliedAlpha(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::Image* cobj = (cocos2d::Image *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Image_reversePremultipliedAlpha : Invalid Native Object"); + if (argc == 0) { + cobj->reversePremultipliedAlpha(); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_Image_reversePremultipliedAlpha : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_Image_getDataLen(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -9858,6 +9962,22 @@ bool js_cocos2dx_Image_getHeight(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_Image_getHeight : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } +bool js_cocos2dx_Image_premultiplyAlpha(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::Image* cobj = (cocos2d::Image *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Image_premultiplyAlpha : Invalid Native Object"); + if (argc == 0) { + cobj->premultiplyAlpha(); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_Image_premultiplyAlpha : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_Image_initWithImageFile(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -10143,11 +10263,13 @@ void js_register_cocos2dx_Image(JSContext *cx, JS::HandleObject global) { static JSFunctionSpec funcs[] = { JS_FN("hasPremultipliedAlpha", js_cocos2dx_Image_hasPremultipliedAlpha, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("reversePremultipliedAlpha", js_cocos2dx_Image_reversePremultipliedAlpha, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getDataLen", js_cocos2dx_Image_getDataLen, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("saveToFile", js_cocos2dx_Image_saveToFile, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("hasAlpha", js_cocos2dx_Image_hasAlpha, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("isCompressed", js_cocos2dx_Image_isCompressed, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getHeight", js_cocos2dx_Image_getHeight, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("premultiplyAlpha", js_cocos2dx_Image_premultiplyAlpha, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("initWithImageFile", js_cocos2dx_Image_initWithImageFile, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getWidth", js_cocos2dx_Image_getWidth, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getBitPerPixel", js_cocos2dx_Image_getBitPerPixel, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -17849,6 +17971,24 @@ bool js_cocos2dx_Configuration_supportsMapBuffer(JSContext *cx, uint32_t argc, j JS_ReportError(cx, "js_cocos2dx_Configuration_supportsMapBuffer : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } +bool js_cocos2dx_Configuration_getInfoAsMap(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::Configuration* cobj = (cocos2d::Configuration *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Configuration_getInfoAsMap : Invalid Native Object"); + if (argc == 0) { + const cocos2d::ValueMap& ret = cobj->getInfoAsMap(); + JS::RootedValue jsret(cx); + jsret = ccvaluemap_to_jsval(cx, ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_Configuration_getInfoAsMap : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_Configuration_destroyInstance(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -17919,6 +18059,7 @@ void js_register_cocos2dx_Configuration(JSContext *cx, JS::HandleObject global) JS_FN("getValue", js_cocos2dx_Configuration_getValue, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("gatherGPUInfo", js_cocos2dx_Configuration_gatherGPUInfo, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("supportsMapBuffer", js_cocos2dx_Configuration_supportsMapBuffer, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getInfoAsMap", js_cocos2dx_Configuration_getInfoAsMap, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -35340,50 +35481,119 @@ bool js_cocos2dx_Label_getOutlineSize(JSContext *cx, uint32_t argc, jsval *vp) } bool js_cocos2dx_Label_setBMFontFilePath(JSContext *cx, uint32_t argc, jsval *vp) { - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::Label* cobj = nullptr; + + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx); + obj.set(args.thisv().toObjectOrNull()); js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::Label* cobj = (cocos2d::Label *)(proxy ? proxy->ptr : NULL); + cobj = (cocos2d::Label *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_Label_setBMFontFilePath : Invalid Native Object"); - if (argc == 1) { - std::string arg0; - ok &= jsval_to_std_string(cx, args.get(0), &arg0); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_setBMFontFilePath : Error processing arguments"); - bool ret = cobj->setBMFontFilePath(arg0); - JS::RootedValue jsret(cx); - jsret = BOOLEAN_TO_JSVAL(ret); - args.rval().set(jsret); - return true; - } - if (argc == 2) { - std::string arg0; - cocos2d::Vec2 arg1; - ok &= jsval_to_std_string(cx, args.get(0), &arg0); - ok &= jsval_to_vector2(cx, args.get(1), &arg1); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_setBMFontFilePath : Error processing arguments"); - bool ret = cobj->setBMFontFilePath(arg0, arg1); - JS::RootedValue jsret(cx); - jsret = BOOLEAN_TO_JSVAL(ret); - args.rval().set(jsret); - return true; - } - if (argc == 3) { - std::string arg0; - cocos2d::Vec2 arg1; - double arg2 = 0; - ok &= jsval_to_std_string(cx, args.get(0), &arg0); - ok &= jsval_to_vector2(cx, args.get(1), &arg1); - ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_setBMFontFilePath : Error processing arguments"); - bool ret = cobj->setBMFontFilePath(arg0, arg1, arg2); - JS::RootedValue jsret(cx); - jsret = BOOLEAN_TO_JSVAL(ret); - args.rval().set(jsret); - return true; - } + do { + if (argc == 3) { + std::string arg0; + ok &= jsval_to_std_string(cx, args.get(0), &arg0); + if (!ok) { ok = true; break; } + cocos2d::Rect arg1; + ok &= jsval_to_ccrect(cx, args.get(1), &arg1); + if (!ok) { ok = true; break; } + bool arg2; + arg2 = JS::ToBoolean(args.get(2)); + bool ret = cobj->setBMFontFilePath(arg0, arg1, arg2); + jsval jsret = JSVAL_NULL; + jsret = BOOLEAN_TO_JSVAL(ret); + args.rval().set(jsret); + return true; + } + } while(0); + + do { + if (argc == 4) { + std::string arg0; + ok &= jsval_to_std_string(cx, args.get(0), &arg0); + if (!ok) { ok = true; break; } + cocos2d::Rect arg1; + ok &= jsval_to_ccrect(cx, args.get(1), &arg1); + if (!ok) { ok = true; break; } + bool arg2; + arg2 = JS::ToBoolean(args.get(2)); + double arg3 = 0; + ok &= JS::ToNumber( cx, args.get(3), &arg3) && !std::isnan(arg3); + if (!ok) { ok = true; break; } + bool ret = cobj->setBMFontFilePath(arg0, arg1, arg2, arg3); + jsval jsret = JSVAL_NULL; + jsret = BOOLEAN_TO_JSVAL(ret); + args.rval().set(jsret); + return true; + } + } while(0); + + do { + if (argc == 1) { + std::string arg0; + ok &= jsval_to_std_string(cx, args.get(0), &arg0); + if (!ok) { ok = true; break; } + bool ret = cobj->setBMFontFilePath(arg0); + jsval jsret = JSVAL_NULL; + jsret = BOOLEAN_TO_JSVAL(ret); + args.rval().set(jsret); + return true; + } + } while(0); - JS_ReportError(cx, "js_cocos2dx_Label_setBMFontFilePath : wrong number of arguments: %d, was expecting %d", argc, 1); + do { + if (argc == 2) { + std::string arg0; + ok &= jsval_to_std_string(cx, args.get(0), &arg0); + if (!ok) { ok = true; break; } + double arg1 = 0; + ok &= JS::ToNumber( cx, args.get(1), &arg1) && !std::isnan(arg1); + if (!ok) { ok = true; break; } + bool ret = cobj->setBMFontFilePath(arg0, arg1); + jsval jsret = JSVAL_NULL; + jsret = BOOLEAN_TO_JSVAL(ret); + args.rval().set(jsret); + return true; + } + } while(0); + + do { + if (argc == 2) { + std::string arg0; + ok &= jsval_to_std_string(cx, args.get(0), &arg0); + if (!ok) { ok = true; break; } + std::string arg1; + ok &= jsval_to_std_string(cx, args.get(1), &arg1); + if (!ok) { ok = true; break; } + bool ret = cobj->setBMFontFilePath(arg0, arg1); + jsval jsret = JSVAL_NULL; + jsret = BOOLEAN_TO_JSVAL(ret); + args.rval().set(jsret); + return true; + } + } while(0); + + do { + if (argc == 3) { + std::string arg0; + ok &= jsval_to_std_string(cx, args.get(0), &arg0); + if (!ok) { ok = true; break; } + std::string arg1; + ok &= jsval_to_std_string(cx, args.get(1), &arg1); + if (!ok) { ok = true; break; } + double arg2 = 0; + ok &= JS::ToNumber( cx, args.get(2), &arg2) && !std::isnan(arg2); + if (!ok) { ok = true; break; } + bool ret = cobj->setBMFontFilePath(arg0, arg1, arg2); + jsval jsret = JSVAL_NULL; + jsret = BOOLEAN_TO_JSVAL(ret); + args.rval().set(jsret); + return true; + } + } while(0); + + JS_ReportError(cx, "js_cocos2dx_Label_setBMFontFilePath : wrong number of arguments"); return false; } bool js_cocos2dx_Label_initWithTTF(JSContext *cx, uint32_t argc, jsval *vp) @@ -36434,74 +36644,137 @@ bool js_cocos2dx_Label_createWithBMFont(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - if (argc == 2) { - std::string arg0; - std::string arg1; - ok &= jsval_to_std_string(cx, args.get(0), &arg0); - ok &= jsval_to_std_string(cx, args.get(1), &arg1); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_createWithBMFont : Error processing arguments"); - - auto ret = cocos2d::Label::createWithBMFont(arg0, arg1); - js_type_class_t *typeClass = js_get_type_from_native(ret); - JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Label")); - args.rval().set(OBJECT_TO_JSVAL(jsret)); - return true; - } - if (argc == 3) { - std::string arg0; - std::string arg1; - cocos2d::TextHAlignment arg2; - ok &= jsval_to_std_string(cx, args.get(0), &arg0); - ok &= jsval_to_std_string(cx, args.get(1), &arg1); - ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_createWithBMFont : Error processing arguments"); - - auto ret = cocos2d::Label::createWithBMFont(arg0, arg1, arg2); - js_type_class_t *typeClass = js_get_type_from_native(ret); - JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Label")); - args.rval().set(OBJECT_TO_JSVAL(jsret)); - return true; - } - if (argc == 4) { - std::string arg0; - std::string arg1; - cocos2d::TextHAlignment arg2; - int arg3 = 0; - ok &= jsval_to_std_string(cx, args.get(0), &arg0); - ok &= jsval_to_std_string(cx, args.get(1), &arg1); - ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); - ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_createWithBMFont : Error processing arguments"); - - auto ret = cocos2d::Label::createWithBMFont(arg0, arg1, arg2, arg3); - js_type_class_t *typeClass = js_get_type_from_native(ret); - JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Label")); - args.rval().set(OBJECT_TO_JSVAL(jsret)); - return true; - } - if (argc == 5) { - std::string arg0; - std::string arg1; - cocos2d::TextHAlignment arg2; - int arg3 = 0; - cocos2d::Vec2 arg4; - ok &= jsval_to_std_string(cx, args.get(0), &arg0); - ok &= jsval_to_std_string(cx, args.get(1), &arg1); - ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); - ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3); - ok &= jsval_to_vector2(cx, args.get(4), &arg4); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_Label_createWithBMFont : Error processing arguments"); - - auto ret = cocos2d::Label::createWithBMFont(arg0, arg1, arg2, arg3, arg4); - js_type_class_t *typeClass = js_get_type_from_native(ret); - JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::Label")); - args.rval().set(OBJECT_TO_JSVAL(jsret)); - return true; - } + + do { + if (argc == 6) { + std::string arg0; + ok &= jsval_to_std_string(cx, args.get(0), &arg0); + if (!ok) { ok = true; break; } + std::string arg1; + ok &= jsval_to_std_string(cx, args.get(1), &arg1); + if (!ok) { ok = true; break; } + cocos2d::TextHAlignment arg2; + ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); + if (!ok) { ok = true; break; } + int arg3 = 0; + ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3); + if (!ok) { ok = true; break; } + cocos2d::Rect arg4; + ok &= jsval_to_ccrect(cx, args.get(4), &arg4); + if (!ok) { ok = true; break; } + bool arg5; + arg5 = JS::ToBoolean(args.get(5)); + if (!ok) { ok = true; break; } + cocos2d::Label* ret = cocos2d::Label::createWithBMFont(arg0, arg1, arg2, arg3, arg4, arg5); + jsval jsret = JSVAL_NULL; + if (ret) { + jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject(cx, (cocos2d::Label*)ret)); + } else { + jsret = JSVAL_NULL; + }; + args.rval().set(jsret); + return true; + } + } while (0); + + do { + if (argc == 2) { + std::string arg0; + ok &= jsval_to_std_string(cx, args.get(0), &arg0); + if (!ok) { ok = true; break; } + std::string arg1; + ok &= jsval_to_std_string(cx, args.get(1), &arg1); + if (!ok) { ok = true; break; } + cocos2d::Label* ret = cocos2d::Label::createWithBMFont(arg0, arg1); + jsval jsret = JSVAL_NULL; + if (ret) { + jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject(cx, (cocos2d::Label*)ret)); + } else { + jsret = JSVAL_NULL; + }; + args.rval().set(jsret); + return true; + } + } while (0); + do { + if (argc == 3) { + std::string arg0; + ok &= jsval_to_std_string(cx, args.get(0), &arg0); + if (!ok) { ok = true; break; } + std::string arg1; + ok &= jsval_to_std_string(cx, args.get(1), &arg1); + if (!ok) { ok = true; break; } + cocos2d::TextHAlignment arg2; + ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); + if (!ok) { ok = true; break; } + cocos2d::Label* ret = cocos2d::Label::createWithBMFont(arg0, arg1, arg2); + jsval jsret = JSVAL_NULL; + if (ret) { + jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject(cx, (cocos2d::Label*)ret)); + } else { + jsret = JSVAL_NULL; + }; + args.rval().set(jsret); + return true; + } + } while (0); + do { + if (argc == 4) { + std::string arg0; + ok &= jsval_to_std_string(cx, args.get(0), &arg0); + if (!ok) { ok = true; break; } + std::string arg1; + ok &= jsval_to_std_string(cx, args.get(1), &arg1); + if (!ok) { ok = true; break; } + cocos2d::TextHAlignment arg2; + ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); + if (!ok) { ok = true; break; } + int arg3 = 0; + ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3); + if (!ok) { ok = true; break; } + cocos2d::Label* ret = cocos2d::Label::createWithBMFont(arg0, arg1, arg2, arg3); + jsval jsret = JSVAL_NULL; + if (ret) { + jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject(cx, (cocos2d::Label*)ret)); + } else { + jsret = JSVAL_NULL; + }; + args.rval().set(jsret); + return true; + } + } while (0); + + do { + if (argc == 5) { + std::string arg0; + ok &= jsval_to_std_string(cx, args.get(0), &arg0); + if (!ok) { ok = true; break; } + std::string arg1; + ok &= jsval_to_std_string(cx, args.get(1), &arg1); + if (!ok) { ok = true; break; } + cocos2d::TextHAlignment arg2; + ok &= jsval_to_int32(cx, args.get(2), (int32_t *)&arg2); + if (!ok) { ok = true; break; } + int arg3 = 0; + ok &= jsval_to_int32(cx, args.get(3), (int32_t *)&arg3); + if (!ok) { ok = true; break; } + std::string arg4; + ok &= jsval_to_std_string(cx, args.get(4), &arg4); + if (!ok) { ok = true; break; } + cocos2d::Label* ret = cocos2d::Label::createWithBMFont(arg0, arg1, arg2, arg3, arg4); + jsval jsret = JSVAL_NULL; + if (ret) { + jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject(cx, (cocos2d::Label*)ret)); + } else { + jsret = JSVAL_NULL; + }; + args.rval().set(jsret); + return true; + } + } while (0); JS_ReportError(cx, "js_cocos2dx_Label_createWithBMFont : wrong number of arguments"); return false; } - bool js_cocos2dx_Label_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -37330,32 +37603,57 @@ bool js_cocos2dx_LabelBMFont_getFntFile(JSContext *cx, uint32_t argc, jsval *vp) } bool js_cocos2dx_LabelBMFont_setFntFile(JSContext *cx, uint32_t argc, jsval *vp) { - JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; - JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + cocos2d::LabelBMFont* cobj = nullptr; + + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx); + obj.set(args.thisv().toObjectOrNull()); js_proxy_t *proxy = jsb_get_js_proxy(obj); - cocos2d::LabelBMFont* cobj = (cocos2d::LabelBMFont *)(proxy ? proxy->ptr : NULL); + cobj = (cocos2d::LabelBMFont *)(proxy ? proxy->ptr : nullptr); JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_LabelBMFont_setFntFile : Invalid Native Object"); - if (argc == 1) { - std::string arg0; - ok &= jsval_to_std_string(cx, args.get(0), &arg0); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LabelBMFont_setFntFile : Error processing arguments"); - cobj->setFntFile(arg0); - args.rval().setUndefined(); - return true; - } - if (argc == 2) { - std::string arg0; - cocos2d::Vec2 arg1; - ok &= jsval_to_std_string(cx, args.get(0), &arg0); - ok &= jsval_to_vector2(cx, args.get(1), &arg1); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_LabelBMFont_setFntFile : Error processing arguments"); - cobj->setFntFile(arg0, arg1); - args.rval().setUndefined(); - return true; - } + do { + if (argc == 3) { + std::string arg0; + ok &= jsval_to_std_string(cx, args.get(0), &arg0); + if (!ok) { ok = true; break; } + cocos2d::Rect arg1; + ok &= jsval_to_ccrect(cx, args.get(1), &arg1); + if (!ok) { ok = true; break; } + bool arg2; + arg2 = JS::ToBoolean(args.get(2)); + cobj->setFntFile(arg0, arg1, arg2); + args.rval().setUndefined(); + return true; + } + } while(0); - JS_ReportError(cx, "js_cocos2dx_LabelBMFont_setFntFile : wrong number of arguments: %d, was expecting %d", argc, 1); + do { + if (argc == 1) { + std::string arg0; + ok &= jsval_to_std_string(cx, args.get(0), &arg0); + if (!ok) { ok = true; break; } + cobj->setFntFile(arg0); + args.rval().setUndefined(); + return true; + } + } while(0); + + do { + if (argc == 2) { + std::string arg0; + ok &= jsval_to_std_string(cx, args.get(0), &arg0); + if (!ok) { ok = true; break; } + cocos2d::Vec2 arg1; + ok &= jsval_to_vector2(cx, args.get(1), &arg1); + if (!ok) { ok = true; break; } + cobj->setFntFile(arg0, arg1); + args.rval().setUndefined(); + return true; + } + } while(0); + + JS_ReportError(cx, "js_cocos2dx_LabelBMFont_setFntFile : wrong number of arguments"); return false; } bool js_cocos2dx_LabelBMFont_setAlignment(JSContext *cx, uint32_t argc, jsval *vp) @@ -65336,6 +65634,28 @@ bool js_cocos2dx_TMXLayer_getTileGIDAt(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_TMXLayer_getTileGIDAt : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } +bool js_cocos2dx_TMXLayer_getAnimTileCoord(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::TMXLayer* cobj = (cocos2d::TMXLayer *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXLayer_getAnimTileCoord : Invalid Native Object"); + if (argc == 0) { + const std::map>* ret = cobj->getAnimTileCoord(); + JS::RootedValue jsret(cx); + if (ret) { + jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject>>(cx, (std::map>*)ret)); + } else { + jsret = JSVAL_NULL; + }; + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_TMXLayer_getAnimTileCoord : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_TMXLayer_getPositionAt(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -65394,6 +65714,24 @@ bool js_cocos2dx_TMXLayer_releaseMap(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_TMXLayer_releaseMap : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } +bool js_cocos2dx_TMXLayer_hasTileAnimation(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::TMXLayer* cobj = (cocos2d::TMXLayer *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXLayer_hasTileAnimation : Invalid Native Object"); + if (argc == 0) { + bool ret = cobj->hasTileAnimation(); + JS::RootedValue jsret(cx); + jsret = BOOLEAN_TO_JSVAL(ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_TMXLayer_hasTileAnimation : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_TMXLayer_setTiles(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -65830,6 +66168,28 @@ bool js_cocos2dx_TMXLayer_getTileAt(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_TMXLayer_getTileAt : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } +bool js_cocos2dx_TMXLayer_getTileAnimManager(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::TMXLayer* cobj = (cocos2d::TMXLayer *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXLayer_getTileAnimManager : Invalid Native Object"); + if (argc == 0) { + cocos2d::TMXTileAnimManager* ret = cobj->getTileAnimManager(); + JS::RootedValue jsret(cx); + if (ret) { + jsret = OBJECT_TO_JSVAL(js_get_or_create_jsobject(cx, (cocos2d::TMXTileAnimManager*)ret)); + } else { + jsret = JSVAL_NULL; + }; + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_TMXLayer_getTileAnimManager : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_TMXLayer_create(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -65928,9 +66288,11 @@ void js_register_cocos2dx_TMXLayer(JSContext *cx, JS::HandleObject global) { static JSFunctionSpec funcs[] = { JS_FN("getTileGIDAt", js_cocos2dx_TMXLayer_getTileGIDAt, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getAnimTileCoord", js_cocos2dx_TMXLayer_getAnimTileCoord, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getPositionAt", js_cocos2dx_TMXLayer_getPositionAt, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setLayerOrientation", js_cocos2dx_TMXLayer_setLayerOrientation, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("releaseMap", js_cocos2dx_TMXLayer_releaseMap, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("hasTileAnimation", js_cocos2dx_TMXLayer_hasTileAnimation, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setTiles", js_cocos2dx_TMXLayer_setTiles, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getLayerSize", js_cocos2dx_TMXLayer_getLayerSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setMapTileSize", js_cocos2dx_TMXLayer_setMapTileSize, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -65949,6 +66311,7 @@ void js_register_cocos2dx_TMXLayer(JSContext *cx, JS::HandleObject global) { JS_FN("getTileSet", js_cocos2dx_TMXLayer_getTileSet, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getProperties", js_cocos2dx_TMXLayer_getProperties, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getTileAt", js_cocos2dx_TMXLayer_getTileAt, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("getTileAnimManager", js_cocos2dx_TMXLayer_getTileAnimManager, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("ctor", js_cocos2dx_TMXLayer_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; @@ -65979,6 +66342,326 @@ void js_register_cocos2dx_TMXLayer(JSContext *cx, JS::HandleObject global) { anonEvaluate(cx, global, "(function () { cc.TMXLayer.extend = cc.Class.extend; })()"); } +JSClass *jsb_cocos2d_TMXTileAnimTask_class; +JSObject *jsb_cocos2d_TMXTileAnimTask_prototype; + +bool js_cocos2dx_TMXTileAnimTask_start(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::TMXTileAnimTask* cobj = (cocos2d::TMXTileAnimTask *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXTileAnimTask_start : Invalid Native Object"); + if (argc == 0) { + cobj->start(); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_TMXTileAnimTask_start : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} +bool js_cocos2dx_TMXTileAnimTask_stop(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::TMXTileAnimTask* cobj = (cocos2d::TMXTileAnimTask *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXTileAnimTask_stop : Invalid Native Object"); + if (argc == 0) { + cobj->stop(); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_TMXTileAnimTask_stop : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} +bool js_cocos2dx_TMXTileAnimTask_isRunning(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::TMXTileAnimTask* cobj = (cocos2d::TMXTileAnimTask *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXTileAnimTask_isRunning : Invalid Native Object"); + if (argc == 0) { + bool ret = cobj->isRunning(); + JS::RootedValue jsret(cx); + jsret = BOOLEAN_TO_JSVAL(ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_TMXTileAnimTask_isRunning : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} +bool js_cocos2dx_TMXTileAnimTask_create(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + if (argc == 3) { + cocos2d::TMXLayer* arg0 = nullptr; + cocos2d::TMXTileAnimInfo* arg1 = nullptr; + cocos2d::Vec2 arg2; + do { + if (args.get(0).isNull()) { arg0 = nullptr; break; } + if (!args.get(0).isObject()) { ok = false; break; } + js_proxy_t *jsProxy; + JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull()); + jsProxy = jsb_get_js_proxy(tmpObj); + arg0 = (cocos2d::TMXLayer*)(jsProxy ? jsProxy->ptr : NULL); + JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); + } while (0); + #pragma warning NO CONVERSION TO NATIVE FOR TMXTileAnimInfo* + ok = false; + ok &= jsval_to_vector2(cx, args.get(2), &arg2); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXTileAnimTask_create : Error processing arguments"); + + auto ret = cocos2d::TMXTileAnimTask::create(arg0, arg1, arg2); + js_type_class_t *typeClass = js_get_type_from_native(ret); + JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::TMXTileAnimTask")); + args.rval().set(OBJECT_TO_JSVAL(jsret)); + return true; + } + JS_ReportError(cx, "js_cocos2dx_TMXTileAnimTask_create : wrong number of arguments"); + return false; +} + +bool js_cocos2dx_TMXTileAnimTask_constructor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + cocos2d::TMXLayer* arg0 = nullptr; + cocos2d::TMXTileAnimInfo* arg1 = nullptr; + cocos2d::Vec2 arg2; + do { + if (args.get(0).isNull()) { arg0 = nullptr; break; } + if (!args.get(0).isObject()) { ok = false; break; } + js_proxy_t *jsProxy; + JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull()); + jsProxy = jsb_get_js_proxy(tmpObj); + arg0 = (cocos2d::TMXLayer*)(jsProxy ? jsProxy->ptr : NULL); + JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); + } while (0); + #pragma warning NO CONVERSION TO NATIVE FOR TMXTileAnimInfo* + ok = false; + ok &= jsval_to_vector2(cx, args.get(2), &arg2); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXTileAnimTask_constructor : Error processing arguments"); + cocos2d::TMXTileAnimTask* cobj = new (std::nothrow) cocos2d::TMXTileAnimTask(arg0, arg1, arg2); + + js_type_class_t *typeClass = js_get_type_from_native(cobj); + + // link the native object with the javascript object + JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TMXTileAnimTask")); + args.rval().set(OBJECT_TO_JSVAL(jsobj)); + if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args); + return true; +} + + +void js_register_cocos2dx_TMXTileAnimTask(JSContext *cx, JS::HandleObject global) { + jsb_cocos2d_TMXTileAnimTask_class = (JSClass *)calloc(1, sizeof(JSClass)); + jsb_cocos2d_TMXTileAnimTask_class->name = "TMXTileAnimTask"; + jsb_cocos2d_TMXTileAnimTask_class->addProperty = JS_PropertyStub; + jsb_cocos2d_TMXTileAnimTask_class->delProperty = JS_DeletePropertyStub; + jsb_cocos2d_TMXTileAnimTask_class->getProperty = JS_PropertyStub; + jsb_cocos2d_TMXTileAnimTask_class->setProperty = JS_StrictPropertyStub; + jsb_cocos2d_TMXTileAnimTask_class->enumerate = JS_EnumerateStub; + jsb_cocos2d_TMXTileAnimTask_class->resolve = JS_ResolveStub; + jsb_cocos2d_TMXTileAnimTask_class->convert = JS_ConvertStub; + jsb_cocos2d_TMXTileAnimTask_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2); + + static JSPropertySpec properties[] = { + JS_PS_END + }; + + static JSFunctionSpec funcs[] = { + JS_FN("start", js_cocos2dx_TMXTileAnimTask_start, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("stop", js_cocos2dx_TMXTileAnimTask_stop, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("isRunning", js_cocos2dx_TMXTileAnimTask_isRunning, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FS_END + }; + + static JSFunctionSpec st_funcs[] = { + JS_FN("create", js_cocos2dx_TMXTileAnimTask_create, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FS_END + }; + + jsb_cocos2d_TMXTileAnimTask_prototype = JS_InitClass( + cx, global, + JS::NullPtr(), + jsb_cocos2d_TMXTileAnimTask_class, + js_cocos2dx_TMXTileAnimTask_constructor, 0, // constructor + properties, + funcs, + NULL, // no static properties + st_funcs); + + JS::RootedObject proto(cx, jsb_cocos2d_TMXTileAnimTask_prototype); + JS::RootedValue className(cx, std_string_to_jsval(cx, "TMXTileAnimTask")); + JS_SetProperty(cx, proto, "_className", className); + JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue); + JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue); + // add the proto and JSClass to the type->js info hash table + jsb_register_class(cx, jsb_cocos2d_TMXTileAnimTask_class, proto, JS::NullPtr()); +} + +JSClass *jsb_cocos2d_TMXTileAnimManager_class; +JSObject *jsb_cocos2d_TMXTileAnimManager_prototype; + +bool js_cocos2dx_TMXTileAnimManager_getTasks(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::TMXTileAnimManager* cobj = (cocos2d::TMXTileAnimManager *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXTileAnimManager_getTasks : Invalid Native Object"); + if (argc == 0) { + const cocos2d::Vector& ret = cobj->getTasks(); + JS::RootedValue jsret(cx); + jsret = ccvector_to_jsval(cx, ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_TMXTileAnimManager_getTasks : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} +bool js_cocos2dx_TMXTileAnimManager_startAll(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::TMXTileAnimManager* cobj = (cocos2d::TMXTileAnimManager *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXTileAnimManager_startAll : Invalid Native Object"); + if (argc == 0) { + cobj->startAll(); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_TMXTileAnimManager_startAll : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} +bool js_cocos2dx_TMXTileAnimManager_stopAll(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::TMXTileAnimManager* cobj = (cocos2d::TMXTileAnimManager *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXTileAnimManager_stopAll : Invalid Native Object"); + if (argc == 0) { + cobj->stopAll(); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_TMXTileAnimManager_stopAll : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} +bool js_cocos2dx_TMXTileAnimManager_create(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + if (argc == 1) { + cocos2d::TMXLayer* arg0 = nullptr; + do { + if (args.get(0).isNull()) { arg0 = nullptr; break; } + if (!args.get(0).isObject()) { ok = false; break; } + js_proxy_t *jsProxy; + JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull()); + jsProxy = jsb_get_js_proxy(tmpObj); + arg0 = (cocos2d::TMXLayer*)(jsProxy ? jsProxy->ptr : NULL); + JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); + } while (0); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXTileAnimManager_create : Error processing arguments"); + + auto ret = cocos2d::TMXTileAnimManager::create(arg0); + js_type_class_t *typeClass = js_get_type_from_native(ret); + JS::RootedObject jsret(cx, jsb_ref_autoreleased_create_jsobject(cx, ret, typeClass, "cocos2d::TMXTileAnimManager")); + args.rval().set(OBJECT_TO_JSVAL(jsret)); + return true; + } + JS_ReportError(cx, "js_cocos2dx_TMXTileAnimManager_create : wrong number of arguments"); + return false; +} + +bool js_cocos2dx_TMXTileAnimManager_constructor(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + cocos2d::TMXLayer* arg0 = nullptr; + do { + if (args.get(0).isNull()) { arg0 = nullptr; break; } + if (!args.get(0).isObject()) { ok = false; break; } + js_proxy_t *jsProxy; + JS::RootedObject tmpObj(cx, args.get(0).toObjectOrNull()); + jsProxy = jsb_get_js_proxy(tmpObj); + arg0 = (cocos2d::TMXLayer*)(jsProxy ? jsProxy->ptr : NULL); + JSB_PRECONDITION2( arg0, cx, false, "Invalid Native Object"); + } while (0); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXTileAnimManager_constructor : Error processing arguments"); + cocos2d::TMXTileAnimManager* cobj = new (std::nothrow) cocos2d::TMXTileAnimManager(arg0); + + js_type_class_t *typeClass = js_get_type_from_native(cobj); + + // link the native object with the javascript object + JS::RootedObject jsobj(cx, jsb_ref_create_jsobject(cx, cobj, typeClass, "cocos2d::TMXTileAnimManager")); + args.rval().set(OBJECT_TO_JSVAL(jsobj)); + if (JS_HasProperty(cx, jsobj, "_ctor", &ok) && ok) + ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(jsobj), "_ctor", args); + return true; +} + + +void js_register_cocos2dx_TMXTileAnimManager(JSContext *cx, JS::HandleObject global) { + jsb_cocos2d_TMXTileAnimManager_class = (JSClass *)calloc(1, sizeof(JSClass)); + jsb_cocos2d_TMXTileAnimManager_class->name = "TMXTileAnimManager"; + jsb_cocos2d_TMXTileAnimManager_class->addProperty = JS_PropertyStub; + jsb_cocos2d_TMXTileAnimManager_class->delProperty = JS_DeletePropertyStub; + jsb_cocos2d_TMXTileAnimManager_class->getProperty = JS_PropertyStub; + jsb_cocos2d_TMXTileAnimManager_class->setProperty = JS_StrictPropertyStub; + jsb_cocos2d_TMXTileAnimManager_class->enumerate = JS_EnumerateStub; + jsb_cocos2d_TMXTileAnimManager_class->resolve = JS_ResolveStub; + jsb_cocos2d_TMXTileAnimManager_class->convert = JS_ConvertStub; + jsb_cocos2d_TMXTileAnimManager_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2); + + static JSPropertySpec properties[] = { + JS_PS_END + }; + + static JSFunctionSpec funcs[] = { + JS_FN("getTasks", js_cocos2dx_TMXTileAnimManager_getTasks, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("startAll", js_cocos2dx_TMXTileAnimManager_startAll, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("stopAll", js_cocos2dx_TMXTileAnimManager_stopAll, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FS_END + }; + + static JSFunctionSpec st_funcs[] = { + JS_FN("create", js_cocos2dx_TMXTileAnimManager_create, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FS_END + }; + + jsb_cocos2d_TMXTileAnimManager_prototype = JS_InitClass( + cx, global, + JS::NullPtr(), + jsb_cocos2d_TMXTileAnimManager_class, + js_cocos2dx_TMXTileAnimManager_constructor, 0, // constructor + properties, + funcs, + NULL, // no static properties + st_funcs); + + JS::RootedObject proto(cx, jsb_cocos2d_TMXTileAnimManager_prototype); + JS::RootedValue className(cx, std_string_to_jsval(cx, "TMXTileAnimManager")); + JS_SetProperty(cx, proto, "_className", className); + JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue); + JS_SetProperty(cx, proto, "__is_ref", JS::TrueHandleValue); + // add the proto and JSClass to the type->js info hash table + jsb_register_class(cx, jsb_cocos2d_TMXTileAnimManager_class, proto, JS::NullPtr()); +} + JSClass *jsb_cocos2d_TMXTiledMap_class; JSObject *jsb_cocos2d_TMXTiledMap_prototype; @@ -66198,6 +66881,26 @@ bool js_cocos2dx_TMXTiledMap_getMapSize(JSContext *cx, uint32_t argc, jsval *vp) JS_ReportError(cx, "js_cocos2dx_TMXTiledMap_getMapSize : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } +bool js_cocos2dx_TMXTiledMap_setTileAnimEnabled(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::TMXTiledMap* cobj = (cocos2d::TMXTiledMap *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_TMXTiledMap_setTileAnimEnabled : Invalid Native Object"); + if (argc == 1) { + bool arg0; + arg0 = JS::ToBoolean(args.get(0)); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_TMXTiledMap_setTileAnimEnabled : Error processing arguments"); + cobj->setTileAnimEnabled(arg0); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_TMXTiledMap_setTileAnimEnabled : wrong number of arguments: %d, was expecting %d", argc, 1); + return false; +} bool js_cocos2dx_TMXTiledMap_initWithXML(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -66495,6 +67198,7 @@ void js_register_cocos2dx_TMXTiledMap(JSContext *cx, JS::HandleObject global) { JS_FN("initWithTMXFile", js_cocos2dx_TMXTiledMap_initWithTMXFile, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getTileSize", js_cocos2dx_TMXTiledMap_getTileSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getMapSize", js_cocos2dx_TMXTiledMap_getMapSize, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("setTileAnimEnabled", js_cocos2dx_TMXTiledMap_setTileAnimEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("initWithXML", js_cocos2dx_TMXTiledMap_initWithXML, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getProperties", js_cocos2dx_TMXTiledMap_getProperties, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getPropertiesForGID", js_cocos2dx_TMXTiledMap_getPropertiesForGID, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -67509,6 +68213,7 @@ void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj) { js_register_cocos2dx_TextureCache(cx, ns); js_register_cocos2dx_SpriteBatchNode(cx, ns); js_register_cocos2dx_TMXLayer(cx, ns); + js_register_cocos2dx_TMXTileAnimManager(cx, ns); js_register_cocos2dx_Configuration(cx, ns); js_register_cocos2dx_ActionTween(cx, ns); js_register_cocos2dx_TransitionFadeDown(cx, ns); @@ -67627,6 +68332,7 @@ void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj) { js_register_cocos2dx_OrbitCamera(cx, ns); js_register_cocos2dx_ParallaxNode(cx, ns); js_register_cocos2dx_TransitionFade(cx, ns); + js_register_cocos2dx_TMXTileAnimTask(cx, ns); js_register_cocos2dx_EaseCubicActionOut(cx, ns); js_register_cocos2dx_EventListenerTouchOneByOne(cx, ns); js_register_cocos2dx_TextFieldTTF(cx, ns); diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp index a2eb31b3753e..0dd6bad479c5 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp @@ -308,10 +308,11 @@ bool js_cocos2dx_GLView_setFrameSize(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_GLView_getViewPortRect(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_GLView_getScaleY(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_GLView_setContentScaleFactor(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_GLView_getVR(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_GLView_getContentScaleFactor(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_GLView_setIMEKeyboardState(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_GLView_getSafeAreaRect(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_GLView_getVR(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_GLView_setViewPortInPoints(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_GLView_setScissorInPoints(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_GLView_getViewName(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_GLView_isOpenGLReady(JSContext *cx, uint32_t argc, jsval *vp); @@ -319,19 +320,20 @@ bool js_cocos2dx_GLView_setCursorVisible(JSContext *cx, uint32_t argc, jsval *vp bool js_cocos2dx_GLView_setDefaultIcon(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_GLView_getScaleX(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_GLView_getVisibleOrigin(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_GLView_getFrameSize(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_GLView_setFrameZoomFactor(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_GLView_getFrameZoomFactor(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_GLView_getDesignResolutionSize(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_GLView_setIcon(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_GLView_setDefaultCursor(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_GLView_windowShouldClose(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_GLView_setDesignResolutionSize(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_GLView_getResolutionPolicy(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_GLView_isRetinaDisplay(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_GLView_renderScene(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_GLView_setVR(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_GLView_setViewPortInPoints(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_GLView_getFrameSize(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_GLView_getScissorRect(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_GLView_setCursor(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_GLView_getRetinaFactor(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_GLView_setViewName(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_GLView_getVisibleRect(JSContext *cx, uint32_t argc, jsval *vp); @@ -413,6 +415,7 @@ bool js_cocos2dx_Director_initProjectionMatrixStack(JSContext *cx, uint32_t argc bool js_cocos2dx_Director_getScheduler(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Director_pushScene(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Director_getAnimationInterval(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_Director_getClearColor(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Director_isPaused(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Director_setDisplayStats(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Director_getEventDispatcher(JSContext *cx, uint32_t argc, jsval *vp); @@ -520,11 +523,13 @@ void js_cocos2dx_Image_finalize(JSContext *cx, JSObject *obj); void js_register_cocos2dx_Image(JSContext *cx, JS::HandleObject global); void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj); bool js_cocos2dx_Image_hasPremultipliedAlpha(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_Image_reversePremultipliedAlpha(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Image_getDataLen(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Image_saveToFile(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Image_hasAlpha(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Image_isCompressed(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Image_getHeight(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_Image_premultiplyAlpha(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Image_initWithImageFile(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Image_getWidth(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Image_getBitPerPixel(JSContext *cx, uint32_t argc, jsval *vp); @@ -1002,6 +1007,7 @@ bool js_cocos2dx_Configuration_getMaxTextureUnits(JSContext *cx, uint32_t argc, bool js_cocos2dx_Configuration_getValue(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Configuration_gatherGPUInfo(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Configuration_supportsMapBuffer(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_Configuration_getInfoAsMap(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Configuration_destroyInstance(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_Configuration_getInstance(JSContext *cx, uint32_t argc, jsval *vp); @@ -4130,9 +4136,11 @@ void js_cocos2dx_TMXLayer_finalize(JSContext *cx, JSObject *obj); void js_register_cocos2dx_TMXLayer(JSContext *cx, JS::HandleObject global); void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj); bool js_cocos2dx_TMXLayer_getTileGIDAt(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_TMXLayer_getAnimTileCoord(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_TMXLayer_getPositionAt(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_TMXLayer_setLayerOrientation(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_TMXLayer_releaseMap(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_TMXLayer_hasTileAnimation(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_TMXLayer_setTiles(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_TMXLayer_getLayerSize(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_TMXLayer_setMapTileSize(JSContext *cx, uint32_t argc, jsval *vp); @@ -4151,9 +4159,36 @@ bool js_cocos2dx_TMXLayer_setTileSet(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_TMXLayer_getTileSet(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_TMXLayer_getProperties(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_TMXLayer_getTileAt(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_TMXLayer_getTileAnimManager(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_TMXLayer_create(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_TMXLayer_TMXLayer(JSContext *cx, uint32_t argc, jsval *vp); +extern JSClass *jsb_cocos2d_TMXTileAnimTask_class; +extern JSObject *jsb_cocos2d_TMXTileAnimTask_prototype; + +bool js_cocos2dx_TMXTileAnimTask_constructor(JSContext *cx, uint32_t argc, jsval *vp); +void js_cocos2dx_TMXTileAnimTask_finalize(JSContext *cx, JSObject *obj); +void js_register_cocos2dx_TMXTileAnimTask(JSContext *cx, JS::HandleObject global); +void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj); +bool js_cocos2dx_TMXTileAnimTask_start(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_TMXTileAnimTask_stop(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_TMXTileAnimTask_isRunning(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_TMXTileAnimTask_create(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_TMXTileAnimTask_TMXTileAnimTask(JSContext *cx, uint32_t argc, jsval *vp); + +extern JSClass *jsb_cocos2d_TMXTileAnimManager_class; +extern JSObject *jsb_cocos2d_TMXTileAnimManager_prototype; + +bool js_cocos2dx_TMXTileAnimManager_constructor(JSContext *cx, uint32_t argc, jsval *vp); +void js_cocos2dx_TMXTileAnimManager_finalize(JSContext *cx, JSObject *obj); +void js_register_cocos2dx_TMXTileAnimManager(JSContext *cx, JS::HandleObject global); +void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj); +bool js_cocos2dx_TMXTileAnimManager_getTasks(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_TMXTileAnimManager_startAll(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_TMXTileAnimManager_stopAll(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_TMXTileAnimManager_create(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_TMXTileAnimManager_TMXTileAnimManager(JSContext *cx, uint32_t argc, jsval *vp); + extern JSClass *jsb_cocos2d_TMXTiledMap_class; extern JSObject *jsb_cocos2d_TMXTiledMap_prototype; @@ -4171,6 +4206,7 @@ bool js_cocos2dx_TMXTiledMap_getResourceFile(JSContext *cx, uint32_t argc, jsval bool js_cocos2dx_TMXTiledMap_initWithTMXFile(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_TMXTiledMap_getTileSize(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_TMXTiledMap_getMapSize(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_TMXTiledMap_setTileAnimEnabled(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_TMXTiledMap_initWithXML(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_TMXTiledMap_getProperties(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_TMXTiledMap_getPropertiesForGID(JSContext *cx, uint32_t argc, jsval *vp); diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_experimental_video_auto.cpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_experimental_video_auto.cpp index a5e43599af82..731dfe314f09 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_experimental_video_auto.cpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_experimental_video_auto.cpp @@ -75,6 +75,24 @@ bool js_cocos2dx_experimental_video_VideoPlayer_play(JSContext *cx, uint32_t arg JS_ReportError(cx, "js_cocos2dx_experimental_video_VideoPlayer_play : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } +bool js_cocos2dx_experimental_video_VideoPlayer_isUserInputEnabled(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::experimental::ui::VideoPlayer* cobj = (cocos2d::experimental::ui::VideoPlayer *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_experimental_video_VideoPlayer_isUserInputEnabled : Invalid Native Object"); + if (argc == 0) { + bool ret = cobj->isUserInputEnabled(); + JS::RootedValue jsret(cx); + jsret = BOOLEAN_TO_JSVAL(ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_experimental_video_VideoPlayer_isUserInputEnabled : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_experimental_video_VideoPlayer_setKeepAspectRatioEnabled(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -171,6 +189,46 @@ bool js_cocos2dx_experimental_video_VideoPlayer_setURL(JSContext *cx, uint32_t a JS_ReportError(cx, "js_cocos2dx_experimental_video_VideoPlayer_setURL : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } +bool js_cocos2dx_experimental_video_VideoPlayer_setStyle(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::experimental::ui::VideoPlayer* cobj = (cocos2d::experimental::ui::VideoPlayer *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_experimental_video_VideoPlayer_setStyle : Invalid Native Object"); + if (argc == 1) { + cocos2d::experimental::ui::VideoPlayer::StyleType arg0; + ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_experimental_video_VideoPlayer_setStyle : Error processing arguments"); + cobj->setStyle(arg0); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_experimental_video_VideoPlayer_setStyle : wrong number of arguments: %d, was expecting %d", argc, 1); + return false; +} +bool js_cocos2dx_experimental_video_VideoPlayer_seekTo(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::experimental::ui::VideoPlayer* cobj = (cocos2d::experimental::ui::VideoPlayer *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_experimental_video_VideoPlayer_seekTo : Invalid Native Object"); + if (argc == 1) { + double arg0 = 0; + ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_experimental_video_VideoPlayer_seekTo : Error processing arguments"); + cobj->seekTo(arg0); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_experimental_video_VideoPlayer_seekTo : wrong number of arguments: %d, was expecting %d", argc, 1); + return false; +} bool js_cocos2dx_experimental_video_VideoPlayer_isKeepAspectRatioEnabled(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -227,6 +285,24 @@ bool js_cocos2dx_experimental_video_VideoPlayer_isFullScreenEnabled(JSContext *c JS_ReportError(cx, "js_cocos2dx_experimental_video_VideoPlayer_isFullScreenEnabled : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } +bool js_cocos2dx_experimental_video_VideoPlayer_isLooping(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::experimental::ui::VideoPlayer* cobj = (cocos2d::experimental::ui::VideoPlayer *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_experimental_video_VideoPlayer_isLooping : Invalid Native Object"); + if (argc == 0) { + bool ret = cobj->isLooping(); + JS::RootedValue jsret(cx); + jsret = BOOLEAN_TO_JSVAL(ret); + args.rval().set(jsret); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_experimental_video_VideoPlayer_isLooping : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_experimental_video_VideoPlayer_isPlaying(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -245,24 +321,44 @@ bool js_cocos2dx_experimental_video_VideoPlayer_isPlaying(JSContext *cx, uint32_ JS_ReportError(cx, "js_cocos2dx_experimental_video_VideoPlayer_isPlaying : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } -bool js_cocos2dx_experimental_video_VideoPlayer_seekTo(JSContext *cx, uint32_t argc, jsval *vp) +bool js_cocos2dx_experimental_video_VideoPlayer_setLooping(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); bool ok = true; JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); js_proxy_t *proxy = jsb_get_js_proxy(obj); cocos2d::experimental::ui::VideoPlayer* cobj = (cocos2d::experimental::ui::VideoPlayer *)(proxy ? proxy->ptr : NULL); - JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_experimental_video_VideoPlayer_seekTo : Invalid Native Object"); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_experimental_video_VideoPlayer_setLooping : Invalid Native Object"); if (argc == 1) { - double arg0 = 0; - ok &= JS::ToNumber( cx, args.get(0), &arg0) && !std::isnan(arg0); - JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_experimental_video_VideoPlayer_seekTo : Error processing arguments"); - cobj->seekTo(arg0); + bool arg0; + arg0 = JS::ToBoolean(args.get(0)); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_experimental_video_VideoPlayer_setLooping : Error processing arguments"); + cobj->setLooping(arg0); args.rval().setUndefined(); return true; } - JS_ReportError(cx, "js_cocos2dx_experimental_video_VideoPlayer_seekTo : wrong number of arguments: %d, was expecting %d", argc, 1); + JS_ReportError(cx, "js_cocos2dx_experimental_video_VideoPlayer_setLooping : wrong number of arguments: %d, was expecting %d", argc, 1); + return false; +} +bool js_cocos2dx_experimental_video_VideoPlayer_setUserInputEnabled(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::experimental::ui::VideoPlayer* cobj = (cocos2d::experimental::ui::VideoPlayer *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_experimental_video_VideoPlayer_setUserInputEnabled : Invalid Native Object"); + if (argc == 1) { + bool arg0; + arg0 = JS::ToBoolean(args.get(0)); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_experimental_video_VideoPlayer_setUserInputEnabled : Error processing arguments"); + cobj->setUserInputEnabled(arg0); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_experimental_video_VideoPlayer_setUserInputEnabled : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } bool js_cocos2dx_experimental_video_VideoPlayer_create(JSContext *cx, uint32_t argc, jsval *vp) @@ -319,16 +415,21 @@ void js_register_cocos2dx_experimental_video_VideoPlayer(JSContext *cx, JS::Hand JS_FN("getFileName", js_cocos2dx_experimental_video_VideoPlayer_getFileName, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getURL", js_cocos2dx_experimental_video_VideoPlayer_getURL, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("play", js_cocos2dx_experimental_video_VideoPlayer_play, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("isUserInputEnabled", js_cocos2dx_experimental_video_VideoPlayer_isUserInputEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setKeepAspectRatioEnabled", js_cocos2dx_experimental_video_VideoPlayer_setKeepAspectRatioEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("stop", js_cocos2dx_experimental_video_VideoPlayer_stop, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setFullScreenEnabled", js_cocos2dx_experimental_video_VideoPlayer_setFullScreenEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setFileName", js_cocos2dx_experimental_video_VideoPlayer_setFileName, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setURL", js_cocos2dx_experimental_video_VideoPlayer_setURL, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("setStyle", js_cocos2dx_experimental_video_VideoPlayer_setStyle, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("seekTo", js_cocos2dx_experimental_video_VideoPlayer_seekTo, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("isKeepAspectRatioEnabled", js_cocos2dx_experimental_video_VideoPlayer_isKeepAspectRatioEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("onPlayEvent", js_cocos2dx_experimental_video_VideoPlayer_onPlayEvent, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("isFullScreenEnabled", js_cocos2dx_experimental_video_VideoPlayer_isFullScreenEnabled, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("isLooping", js_cocos2dx_experimental_video_VideoPlayer_isLooping, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("isPlaying", js_cocos2dx_experimental_video_VideoPlayer_isPlaying, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), - JS_FN("seekTo", js_cocos2dx_experimental_video_VideoPlayer_seekTo, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("setLooping", js_cocos2dx_experimental_video_VideoPlayer_setLooping, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("setUserInputEnabled", js_cocos2dx_experimental_video_VideoPlayer_setUserInputEnabled, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FS_END }; diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_experimental_video_auto.hpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_experimental_video_auto.hpp index 495809b7598c..13fa506ef0a3 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_experimental_video_auto.hpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_experimental_video_auto.hpp @@ -16,16 +16,21 @@ void register_all_cocos2dx_experimental_video(JSContext* cx, JS::HandleObject ob bool js_cocos2dx_experimental_video_VideoPlayer_getFileName(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_experimental_video_VideoPlayer_getURL(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_experimental_video_VideoPlayer_play(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_experimental_video_VideoPlayer_isUserInputEnabled(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_experimental_video_VideoPlayer_setKeepAspectRatioEnabled(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_experimental_video_VideoPlayer_stop(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_experimental_video_VideoPlayer_setFullScreenEnabled(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_experimental_video_VideoPlayer_setFileName(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_experimental_video_VideoPlayer_setURL(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_experimental_video_VideoPlayer_setStyle(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_experimental_video_VideoPlayer_seekTo(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_experimental_video_VideoPlayer_isKeepAspectRatioEnabled(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_experimental_video_VideoPlayer_onPlayEvent(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_experimental_video_VideoPlayer_isFullScreenEnabled(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_experimental_video_VideoPlayer_isLooping(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_experimental_video_VideoPlayer_isPlaying(JSContext *cx, uint32_t argc, jsval *vp); -bool js_cocos2dx_experimental_video_VideoPlayer_seekTo(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_experimental_video_VideoPlayer_setLooping(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_experimental_video_VideoPlayer_setUserInputEnabled(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_experimental_video_VideoPlayer_create(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_experimental_video_VideoPlayer_VideoPlayer(JSContext *cx, uint32_t argc, jsval *vp); diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.cpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.cpp index 19c8d6c384e1..c557720c8634 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.cpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.cpp @@ -10416,6 +10416,22 @@ bool js_cocos2dx_ui_Slider_getCapInsetsBarRenderer(JSContext *cx, uint32_t argc, JS_ReportError(cx, "js_cocos2dx_ui_Slider_getCapInsetsBarRenderer : wrong number of arguments: %d, was expecting %d", argc, 0); return false; } +bool js_cocos2dx_ui_Slider_updateVisualSlider(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::Slider* cobj = (cocos2d::ui::Slider *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_Slider_updateVisualSlider : Invalid Native Object"); + if (argc == 0) { + cobj->updateVisualSlider(); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_Slider_updateVisualSlider : wrong number of arguments: %d, was expecting %d", argc, 0); + return false; +} bool js_cocos2dx_ui_Slider_getCapInsetsProgressBarRenderer(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -10800,6 +10816,7 @@ void js_register_cocos2dx_ui_Slider(JSContext *cx, JS::HandleObject global) { JS_FN("loadBarTexture", js_cocos2dx_ui_Slider_loadBarTexture, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getProgressBarFile", js_cocos2dx_ui_Slider_getProgressBarFile, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getCapInsetsBarRenderer", js_cocos2dx_ui_Slider_getCapInsetsBarRenderer, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("updateVisualSlider", js_cocos2dx_ui_Slider_updateVisualSlider, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getCapInsetsProgressBarRenderer", js_cocos2dx_ui_Slider_getCapInsetsProgressBarRenderer, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getSlidBallPressedRenderer", js_cocos2dx_ui_Slider_getSlidBallPressedRenderer, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("loadSlidBallTexturePressed", js_cocos2dx_ui_Slider_loadSlidBallTexturePressed, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.hpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.hpp index 3552a9a4507e..d24fd1775fe1 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.hpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.hpp @@ -540,6 +540,7 @@ bool js_cocos2dx_ui_Slider_setMaxPercent(JSContext *cx, uint32_t argc, jsval *vp bool js_cocos2dx_ui_Slider_loadBarTexture(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Slider_getProgressBarFile(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Slider_getCapInsetsBarRenderer(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_Slider_updateVisualSlider(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Slider_getCapInsetsProgressBarRenderer(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Slider_getSlidBallPressedRenderer(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_Slider_loadSlidBallTexturePressed(JSContext *cx, uint32_t argc, jsval *vp); diff --git a/cocos/scripting/js-bindings/manual/3d/jsb_cocos2dx_3d_manual.cpp b/cocos/scripting/js-bindings/manual/3d/jsb_cocos2dx_3d_manual.cpp index 5631dd662af5..c3bdd6bab85b 100644 --- a/cocos/scripting/js-bindings/manual/3d/jsb_cocos2dx_3d_manual.cpp +++ b/cocos/scripting/js-bindings/manual/3d/jsb_cocos2dx_3d_manual.cpp @@ -239,7 +239,7 @@ bool jsval_to_TerrainData(JSContext* cx, JS::HandleValue v, Terrain::TerrainData JS::ToNumber(cx, js_mapHeight, &mapHeight); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - ret->_heightMapSrc = heightMap.c_str(); + ret->_heightMapSrc = heightMap; char* tmp = (char*)malloc(sizeof(char) * (alphaMap.size() + 1)); strcpy(tmp, alphaMap.c_str()); tmp[alphaMap.size()] = '\0'; diff --git a/cocos/scripting/js-bindings/manual/ScriptingCore.cpp b/cocos/scripting/js-bindings/manual/ScriptingCore.cpp index f3fbd9a82fc6..3f273d367926 100644 --- a/cocos/scripting/js-bindings/manual/ScriptingCore.cpp +++ b/cocos/scripting/js-bindings/manual/ScriptingCore.cpp @@ -306,7 +306,7 @@ bool JSBCore_platform(JSContext *cx, uint32_t argc, jsval *vp) args.rval().set(INT_TO_JSVAL((int)platform)); return true; -}; +} bool JSBCore_version(JSContext *cx, uint32_t argc, jsval *vp) { @@ -324,7 +324,7 @@ bool JSBCore_version(JSContext *cx, uint32_t argc, jsval *vp) args.rval().set(STRING_TO_JSVAL(js_version)); return true; -}; +} bool JSBCore_os(JSContext *cx, uint32_t argc, jsval *vp) { @@ -364,7 +364,7 @@ bool JSBCore_os(JSContext *cx, uint32_t argc, jsval *vp) args.rval().set(STRING_TO_JSVAL(os)); return true; -}; +} bool JSB_cleanScript(JSContext *cx, uint32_t argc, jsval *vp) { @@ -383,7 +383,7 @@ bool JSB_cleanScript(JSContext *cx, uint32_t argc, jsval *vp) args.rval().setUndefined(); return true; -}; +} bool JSB_core_restartVM(JSContext *cx, uint32_t argc, jsval *vp) { @@ -392,23 +392,13 @@ bool JSB_core_restartVM(JSContext *cx, uint32_t argc, jsval *vp) ScriptingCore::getInstance()->reset(); args.rval().setUndefined(); return true; -}; +} bool JSB_closeWindow(JSContext *cx, uint32_t argc, jsval *vp) { - EventListenerCustom* _event = Director::getInstance()->getEventDispatcher()->addCustomEventListener(Director::EVENT_AFTER_DRAW, [&](EventCustom *event) { - Director::getInstance()->getEventDispatcher()->removeEventListener(_event); - CC_SAFE_RELEASE(_event); - - ScriptingCore::getInstance()->cleanup(); - }); - _event->retain(); Director::getInstance()->end(); -#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) - exit(0); -#endif return true; -}; +} void registerDefaultClasses(JSContext* cx, JS::HandleObject global) { // first, try to get the ns @@ -950,7 +940,29 @@ void ScriptingCore::reportError(JSContext *cx, const char *message, JSErrorRepor report->filename ? report->filename : "", (unsigned int) report->lineno, message); -}; + + if (cx) + { + JS::RootedValue errorContext(cx); + if (JS_GetPendingException(cx, &errorContext)) + { + JS_ClearPendingException(cx); + } + + if (errorContext.isObject()) + { + std::string stackStr = ""; + JS::RootedObject errObj(cx, errorContext.toObjectOrNull()); + JS::RootedValue stack(cx); + if (JS_GetProperty(cx, errObj, "stack", &stack) && stack.isString()) + { + JS::RootedString jsstackStr(cx, stack.toString()); + stackStr = JS_EncodeStringToUTF8(cx, jsstackStr); + js_log("Stack: %s\n", stackStr.c_str()); + } + } + } +} bool ScriptingCore::log(JSContext* cx, uint32_t argc, jsval *vp) @@ -1421,13 +1433,13 @@ bool ScriptingCore::handleTouchesEvent(void* nativeObj, cocos2d::EventTouch::Eve js_type_class_t *typeClassEvent = nullptr; js_type_class_t *typeClassTouch = nullptr; - if (touches.size()>0) + if (!touches.empty()) typeClassTouch = js_get_type_from_native(touches[0]); typeClassEvent = js_get_type_from_native((cocos2d::EventTouch*)event); for (const auto& touch : touches) { - JS::RootedValue jsret(_cx, OBJECT_TO_JSVAL(jsb_get_or_create_weak_jsobject(_cx, touch, typeClassTouch))); + JS::RootedValue jsret(_cx, OBJECT_TO_JSVAL(jsb_ref_get_or_create_jsobject(_cx, touch, typeClassTouch, "cocos2d::Touch"))); if (!JS_SetElement(_cx, jsretArr, count, jsret)) { break; @@ -1440,7 +1452,7 @@ bool ScriptingCore::handleTouchesEvent(void* nativeObj, cocos2d::EventTouch::Eve { jsval dataVal[2]; dataVal[0] = OBJECT_TO_JSVAL(jsretArr); - dataVal[1] = OBJECT_TO_JSVAL(jsb_get_or_create_weak_jsobject(_cx, event, typeClassEvent)); + dataVal[1] = OBJECT_TO_JSVAL(jsb_ref_get_or_create_jsobject(_cx, event, typeClassEvent, "cocos2d::EventTouch")); ret = executeFunctionWithOwner(OBJECT_TO_JSVAL(p->obj), funcName.c_str(), 2, dataVal, jsvalRet); // event is created on the heap and its destructor won't be invoked, so we need to remove JS object manually removeJSObject(_cx, event); @@ -1467,8 +1479,8 @@ bool ScriptingCore::handleTouchEvent(void* nativeObj, cocos2d::EventTouch::Event js_type_class_t *typeClassEvent = js_get_type_from_native((cocos2d::EventTouch*)event); jsval dataVal[2]; - dataVal[0] = OBJECT_TO_JSVAL(jsb_get_or_create_weak_jsobject(_cx, touch, typeClassTouch)); - dataVal[1] = OBJECT_TO_JSVAL(jsb_get_or_create_weak_jsobject(_cx, event, typeClassEvent)); + dataVal[0] = OBJECT_TO_JSVAL(jsb_ref_get_or_create_jsobject(_cx, touch, typeClassTouch, "cocos2d::Touch")); + dataVal[1] = OBJECT_TO_JSVAL(jsb_ref_get_or_create_jsobject(_cx, event, typeClassEvent, "cocos2d::Touch")); ret = executeFunctionWithOwner(OBJECT_TO_JSVAL(p->obj), funcName.c_str(), 2, dataVal, jsvalRet); // event is created on the heap and its destructor won't be invoked, so we need to remove JS object manually @@ -1493,7 +1505,7 @@ bool ScriptingCore::handleMouseEvent(void* nativeObj, cocos2d::EventMouse::Mouse if (p) { js_type_class_t *typeClass = js_get_type_from_native((cocos2d::EventMouse*)event); - jsval dataVal = OBJECT_TO_JSVAL(jsb_get_or_create_weak_jsobject(_cx, event, typeClass)); + jsval dataVal = OBJECT_TO_JSVAL(jsb_ref_get_or_create_jsobject(_cx, event, typeClass, "cocos2d::EventMouse")); ret = executeFunctionWithOwner(OBJECT_TO_JSVAL(p->obj), funcName.c_str(), 1, &dataVal, jsvalRet); // event is created on the heap and its destructor won't be invoked, so we need to remove JS object manually removeJSObject(_cx, event); @@ -1632,7 +1644,7 @@ int ScriptingCore::executeCustomTouchesEvent(EventTouch::EventCode eventType, { js_type_class_t *typeClass = js_get_type_from_native(touch); - jsval jsret = OBJECT_TO_JSVAL(jsb_get_or_create_weak_jsobject(this->_cx, touch, typeClass)); + jsval jsret = OBJECT_TO_JSVAL(jsb_ref_get_or_create_jsobject(this->_cx, touch, typeClass, "cocos2d::Touch")); JS::RootedValue jsval(_cx, jsret); if (!JS_SetElement(this->_cx, jsretArr, count, jsval)) { break; @@ -1653,7 +1665,7 @@ int ScriptingCore::executeCustomTouchEvent(EventTouch::EventCode eventType, Touc std::string funcName = getTouchFuncName(eventType); js_type_class_t *typeClass = js_get_type_from_native(touch); - jsval jsTouch = OBJECT_TO_JSVAL(jsb_get_or_create_weak_jsobject(this->_cx, touch, typeClass)); + jsval jsTouch = OBJECT_TO_JSVAL(jsb_ref_get_or_create_jsobject(this->_cx, touch, typeClass, "cocos2d::Touch")); executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), funcName.c_str(), 1, &jsTouch, &retval); @@ -1670,7 +1682,7 @@ int ScriptingCore::executeCustomTouchEvent(EventTouch::EventCode eventType, std::string funcName = getTouchFuncName(eventType); js_type_class_t *typeClass = js_get_type_from_native(touch); - jsval jsTouch = OBJECT_TO_JSVAL(jsb_get_or_create_weak_jsobject(this->_cx, touch, typeClass)); + jsval jsTouch = OBJECT_TO_JSVAL(jsb_ref_get_or_create_jsobject(this->_cx, touch, typeClass, "cocos2d::Touch")); executeFunctionWithOwner(OBJECT_TO_JSVAL(obj), funcName.c_str(), 1, &jsTouch, retval); diff --git a/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp b/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp index 451d3dd8eda4..5916844f9408 100644 --- a/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp +++ b/cocos/scripting/js-bindings/manual/cocos2d_specifics.cpp @@ -43,6 +43,7 @@ #include "base/CCEventDispatcher.h" #include "base/CCScheduler.h" #include "platform/CCFileUtils.h" +#include "renderer/ccGLStateCache.h" #include "scripting/js-bindings/manual/js_bindings_config.h" #include "scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp" #include "scripting/js-bindings/manual/jsb_event_dispatcher_manual.h" @@ -183,7 +184,7 @@ bool JSTouchDelegate::onTouchBegan(Touch *touch, Event* /*event*/) } return bRet; -}; +} // optional void JSTouchDelegate::onTouchMoved(Touch *touch, Event* /*event*/) @@ -3253,7 +3254,7 @@ bool js_cocos2dx_ccGLEnableVertexAttribs(JSContext *cx, uint32_t argc, jsval *vp ok &= jsval_to_uint32(cx, args.get(0), &arg0); JSB_PRECONDITION2(ok, cx, false, "Error processing arguments"); - glEnableVertexAttribArray(arg0); + GL::enableVertexAttribs(arg0); args.rval().setUndefined(); return true; } @@ -4516,7 +4517,7 @@ bool js_cocos2dx_SpriteBatchNode_getDescendants(JSContext *cx, uint32_t argc, js JS::RootedValue jsret(cx); js_type_class_t *typeClass = nullptr; - if (ret.size() > 0) + if (!ret.empty()) typeClass = js_get_type_from_native(ret[0]); for (size_t i = 0; i < vSize; i++) { @@ -5254,7 +5255,7 @@ void get_or_create_js_obj(const std::string &name, JS::MutableHandleObject jsObj JS::RootedObject prop(cx); size_t start = 0; - size_t found = name.find_first_of(".", start); + size_t found = name.find_first_of('.', start); std::string subProp; while (found != std::string::npos) @@ -5267,7 +5268,7 @@ void get_or_create_js_obj(const std::string &name, JS::MutableHandleObject jsObj } start = found+1; - found = name.find_first_of(".", start); + found = name.find_first_of('.', start); } if (start < name.length()) { @@ -5607,8 +5608,7 @@ void js_cocos2d_PolygonInfo_finalize(JSFreeOp *fop, JSObject *obj) { if (proxy) { cocos2d::PolygonInfo *nobj = static_cast(proxy->ptr); - if (nobj) - delete nobj; + delete nobj; jsb_remove_proxy(proxy); } } @@ -5765,8 +5765,7 @@ void js_cocos2d_AutoPolygon_finalize(JSFreeOp *fop, JSObject *obj) { auto proxy = jsb_get_js_proxy(jsobj); if (proxy) { cocos2d::AutoPolygon *nobj = static_cast(proxy->ptr); - if (nobj) - delete nobj; + delete nobj; jsb_remove_proxy(proxy); } } diff --git a/cocos/scripting/js-bindings/manual/cocosbuilder/js_bindings_ccbreader.cpp b/cocos/scripting/js-bindings/manual/cocosbuilder/js_bindings_ccbreader.cpp index b7c7da5f73d6..1545f13eab5d 100644 --- a/cocos/scripting/js-bindings/manual/cocosbuilder/js_bindings_ccbreader.cpp +++ b/cocos/scripting/js-bindings/manual/cocosbuilder/js_bindings_ccbreader.cpp @@ -33,10 +33,10 @@ using namespace cocosbuilder; static void removeSelector(std::string &str) { size_t found; - found = str.find(":"); + found = str.find(':'); while (found!=std::string::npos){ str.replace(found, found+1, ""); - found = str.find(":"); + found = str.find(':'); } } diff --git a/cocos/scripting/js-bindings/manual/cocostudio/jsb_cocos2dx_studio_manual.cpp b/cocos/scripting/js-bindings/manual/cocostudio/jsb_cocos2dx_studio_manual.cpp index 36dd000539ee..a71989294fbb 100644 --- a/cocos/scripting/js-bindings/manual/cocostudio/jsb_cocos2dx_studio_manual.cpp +++ b/cocos/scripting/js-bindings/manual/cocostudio/jsb_cocos2dx_studio_manual.cpp @@ -375,7 +375,7 @@ static bool js_cocos2dx_studio_Frame_getEasingParams(JSContext *cx, uint32_t arg JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object"); if(argc == 0) { - const std::vector ret = cobj->getEasingParams(); + const std::vector& ret = cobj->getEasingParams(); JS::RootedObject jsobj(cx, JS_NewArrayObject(cx, ret.size())); bool ok = true; diff --git a/cocos/scripting/js-bindings/manual/component/CCComponentJS.cpp b/cocos/scripting/js-bindings/manual/component/CCComponentJS.cpp index 60a5a36be224..e48147af1d0a 100644 --- a/cocos/scripting/js-bindings/manual/component/CCComponentJS.cpp +++ b/cocos/scripting/js-bindings/manual/component/CCComponentJS.cpp @@ -104,10 +104,7 @@ ComponentJS::~ComponentJS() jsb_remove_proxy(proxy); } // Delete rooted object - if (jsObj != nullptr) - { - delete jsObj; - } + delete jsObj; } void* ComponentJS::getScriptObject() const diff --git a/cocos/scripting/js-bindings/manual/extension/jsb_cocos2dx_extension_manual.cpp b/cocos/scripting/js-bindings/manual/extension/jsb_cocos2dx_extension_manual.cpp index b64883208f36..4b2068483dfd 100644 --- a/cocos/scripting/js-bindings/manual/extension/jsb_cocos2dx_extension_manual.cpp +++ b/cocos/scripting/js-bindings/manual/extension/jsb_cocos2dx_extension_manual.cpp @@ -156,7 +156,7 @@ class JSB_TableViewDelegate } private: - void callJSDelegate(ScrollView* view, std::string jsFunctionName) + void callJSDelegate(ScrollView* view, const std::string& jsFunctionName) { js_proxy_t * p = jsb_get_native_proxy(view); if (!p) return; @@ -165,7 +165,7 @@ class JSB_TableViewDelegate ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(_JSDelegate), jsFunctionName.c_str(), 1, &arg); } - void callJSDelegate(TableView* table, TableViewCell* cell, std::string jsFunctionName) + void callJSDelegate(TableView* table, TableViewCell* cell, const std::string& jsFunctionName) { js_proxy_t * p = jsb_get_native_proxy(table); if (!p) return; @@ -292,7 +292,7 @@ class JSB_TableViewDataSource } private: - bool callJSDelegate(TableView* table, std::string jsFunctionName, JS::MutableHandleValue retVal) + bool callJSDelegate(TableView* table, const std::string& jsFunctionName, JS::MutableHandleValue retVal) { js_proxy_t * p = jsb_get_native_proxy(table); if (!p) return false; @@ -323,7 +323,7 @@ class JSB_TableViewDataSource return false; } - bool callJSDelegate(TableView* table, ssize_t idx, std::string jsFunctionName, JS::MutableHandleValue retVal) + bool callJSDelegate(TableView* table, ssize_t idx, const std::string& jsFunctionName, JS::MutableHandleValue retVal) { js_proxy_t * p = jsb_get_native_proxy(table); if (!p) return false; diff --git a/cocos/scripting/js-bindings/manual/js_bindings_core.cpp b/cocos/scripting/js-bindings/manual/js_bindings_core.cpp index d7c147e788b0..486477c4eefd 100644 --- a/cocos/scripting/js-bindings/manual/js_bindings_core.cpp +++ b/cocos/scripting/js-bindings/manual/js_bindings_core.cpp @@ -49,7 +49,7 @@ static void reportError(JSContext *cx, const char *message, JSErrorReport *repor report->filename ? report->filename : "", (unsigned int) report->lineno, message); -}; +} // Hash of JSObject -> proxy diff --git a/cocos/scripting/js-bindings/manual/js_manual_conversions.cpp b/cocos/scripting/js-bindings/manual/js_manual_conversions.cpp index 7e32b83745b6..607ef7c015a2 100644 --- a/cocos/scripting/js-bindings/manual/js_manual_conversions.cpp +++ b/cocos/scripting/js-bindings/manual/js_manual_conversions.cpp @@ -2730,7 +2730,7 @@ jsval std_vector_string_to_jsval( JSContext *cx, const std::vector& JS::RootedObject jsretArr(cx, JS_NewArrayObject(cx, v.size())); int i = 0; - for (const std::string obj : v) + for (const std::string& obj : v) { JS::RootedValue arrElement(cx); arrElement = std_string_to_jsval(cx, obj); diff --git a/cocos/scripting/js-bindings/manual/jsb_helper.h b/cocos/scripting/js-bindings/manual/jsb_helper.h index c0d8ceb4e93a..ff044e6c6476 100644 --- a/cocos/scripting/js-bindings/manual/jsb_helper.h +++ b/cocos/scripting/js-bindings/manual/jsb_helper.h @@ -37,12 +37,12 @@ static JSClass js_class; \ static JSObject* js_proto; \ static JSObject* js_parent; \ -static void _js_register(JSContext* cx, JS::HandleObject global); +static void _js_register(JSContext* cx, JS::HandleObject global) #define JS_BINDED_CLASS_GLUE_IMPL(klass) \ JSClass klass::js_class = {}; \ JSObject* klass::js_proto = NULL; \ -JSObject* klass::js_parent = NULL; \ +JSObject* klass::js_parent = NULL #define JS_BINDED_FUNC(klass, name) \ bool name(JSContext *cx, unsigned argc, jsval *vp) @@ -112,7 +112,7 @@ bool klass::_js_set_##propName(JSContext *cx, const JS::CallArgs& args) #define JS_BINDED_PROP_ACCESSOR(klass, propName) \ JS_BINDED_PROP_GET(klass, propName); \ -JS_BINDED_PROP_SET(klass, propName); +JS_BINDED_PROP_SET(klass, propName) #define JS_BINDED_PROP_DEF_GETTER(klass, propName) \ JS_PSG(#propName, _js_get_##klass##_##propName, JSPROP_ENUMERATE | JSPROP_PERMANENT) diff --git a/cocos/scripting/js-bindings/manual/network/XMLHTTPRequest.cpp b/cocos/scripting/js-bindings/manual/network/XMLHTTPRequest.cpp index 5695c0fc1757..a6c08e4d24d8 100644 --- a/cocos/scripting/js-bindings/manual/network/XMLHTTPRequest.cpp +++ b/cocos/scripting/js-bindings/manual/network/XMLHTTPRequest.cpp @@ -29,14 +29,37 @@ #include "scripting/js-bindings/manual/network/XMLHTTPRequest.h" #include +#include #include #include #include "base/CCDirector.h" +#include "base/ZipUtils.h" #include "scripting/js-bindings/manual/cocos2d_specifics.hpp" using namespace std; +// trim from start (in place) +static inline void ltrim(std::string &s) { + s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](int ch) { + return !std::isspace(ch); + })); +} + +// trim from end (in place) +static inline void rtrim(std::string &s) { + s.erase(std::find_if(s.rbegin(), s.rend(), [](int ch) { + return !std::isspace(ch); + }).base(), s.end()); +} + +// trim from both ends (in place) +static inline void trim(std::string &s) { + ltrim(s); + rtrim(s); +} + + //#pragma mark - MinXmlHttpRequest /** @@ -50,7 +73,7 @@ void MinXmlHttpRequest::_gotHeader(string& header) char * cstr = new (std::nothrow) char [header.length()+1]; // check for colon. - size_t found_header_field = header.find_first_of(":"); + size_t found_header_field = header.find_first_of(':'); if (found_header_field != std::string::npos) { @@ -179,13 +202,48 @@ void MinXmlHttpRequest::_setHttpRequestHeader() void MinXmlHttpRequest::_setHttpRequestData(const char *data, size_t len) { if (len > 0 && - (_meth.compare("post") == 0 || _meth.compare("POST") == 0 || - _meth.compare("put") == 0 || _meth.compare("PUT") == 0)) + (_meth == "post" || _meth == "POST" || + _meth == "put" || _meth == "PUT")) { _httpRequest->setRequestData(data, len); } } +MinXmlHttpRequest::EncodingType MinXmlHttpRequest::_getEncodingType() const +{ + auto it = _httpHeader.find("content-encoding"); + if (it == _httpHeader.end()) { + return EncodingType::IDENTITY; + } + + std::string encodingTypeStr = it->second; + trim(encodingTypeStr); + if (encodingTypeStr.empty()) + { + return EncodingType::IDENTITY; + } + else if (encodingTypeStr == "gzip") + { + return EncodingType::GZIP; + } + else if (encodingTypeStr == "deflate") + { + return EncodingType::DEFLATE; + } + else if (encodingTypeStr == "br") + { + return EncodingType::BR; + } + else if (encodingTypeStr == "compress") + { + return EncodingType::COMPRESS; + } + else + { + CCLOG("[error] unrecongized Content-Encoding value %s, %s", encodingTypeStr.c_str(), "use \"identity\" as default"); + return EncodingType::IDENTITY; + } +} /** * @brief Callback for HTTPRequest. Handles the response and invokes Callback. * @param sender Object which initialized callback @@ -271,11 +329,37 @@ void MinXmlHttpRequest::handle_requestResponse(cocos2d::network::HttpClient *sen _status = statusCode; _readyState = DONE; + const auto encodingType = _getEncodingType(); + +#if ( CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 ) + if (encodingType == EncodingType::GZIP && + cocos2d::ZipUtils::ccIsGZipBuffer((unsigned char *)buffer->data(), buffer->size())) + { + unsigned char *deflatedBuffer = nullptr; + auto deflatedSize = cocos2d::ZipUtils::ccInflateMemory((unsigned char *)buffer->data(), buffer->size(), &deflatedBuffer); + CCASSERT(deflatedSize > 0, "ZipUtils::ccInflateMemory error"); + CC_SAFE_DELETE(_data); + _dataSize = deflatedSize; + _data = (char*)malloc(_dataSize + 1); + _data[_dataSize] = 0; + memcpy((void*)_data, (const void*)deflatedBuffer, _dataSize); + free(deflatedBuffer); + } + else + { + _dataSize = static_cast(buffer->size()); + CC_SAFE_FREE(_data); + _data = (char*) malloc(_dataSize + 1); + _data[_dataSize] = 0; + memcpy((void*)_data, (const void*)buffer->data(), _dataSize); + } +#else _dataSize = static_cast(buffer->size()); CC_SAFE_FREE(_data); - _data = (char*) malloc(_dataSize + 1); - _data[_dataSize] = '\0'; + _data = (char*)malloc(_dataSize + 1); + _data[_dataSize] = 0; memcpy((void*)_data, (const void*)buffer->data(), _dataSize); +#endif JS::RootedObject callback(_cx); if (_onreadystateCallback) @@ -776,10 +860,10 @@ JS_BINDED_FUNC_IMPL(MinXmlHttpRequest, open) { auto requestType = - (_meth.compare("get") == 0 || _meth.compare("GET") == 0) ? cocos2d::network::HttpRequest::Type::GET : ( - (_meth.compare("post") == 0 || _meth.compare("POST") == 0) ? cocos2d::network::HttpRequest::Type::POST : ( - (_meth.compare("put") == 0 || _meth.compare("PUT") == 0) ? cocos2d::network::HttpRequest::Type::PUT : ( - (_meth.compare("delete") == 0 || _meth.compare("DELETE") == 0) ? cocos2d::network::HttpRequest::Type::DELETE : ( + (_meth == "get" || _meth == "GET") ? cocos2d::network::HttpRequest::Type::GET : ( + (_meth == "post" || _meth == "POST") ? cocos2d::network::HttpRequest::Type::POST : ( + (_meth == "put" || _meth == "PUT") ? cocos2d::network::HttpRequest::Type::PUT : ( + (_meth == "delete" || _meth == "DELETE") ? cocos2d::network::HttpRequest::Type::DELETE : ( cocos2d::network::HttpRequest::Type::UNKNOWN)))); _httpRequest->setRequestType(requestType); diff --git a/cocos/scripting/js-bindings/manual/network/XMLHTTPRequest.h b/cocos/scripting/js-bindings/manual/network/XMLHTTPRequest.h index fa959712b6b8..20d1805a4306 100644 --- a/cocos/scripting/js-bindings/manual/network/XMLHTTPRequest.h +++ b/cocos/scripting/js-bindings/manual/network/XMLHTTPRequest.h @@ -49,6 +49,15 @@ class MinXmlHttpRequest : public cocos2d::Ref JSON }; + enum class EncodingType + { + GZIP, + COMPRESS, + DEFLATE, + BR, + IDENTITY + }; + // Ready States (http://www.w3.org/TR/XMLHttpRequest/#interface-xmlhttprequest) static const unsigned short UNSENT = 0; static const unsigned short OPENED = 1; @@ -94,6 +103,7 @@ class MinXmlHttpRequest : public cocos2d::Ref void _gotHeader(std::string& header); void _setRequestHeader(const char* field, const char* value); void _setHttpRequestHeader(); + EncodingType _getEncodingType() const; void _setHttpRequestData(const char *data, size_t len); void _sendRequest(JSContext *cx); void _notify(JS::HandleObject callback, JS::HandleValueArray args); diff --git a/cocos/scripting/js-bindings/manual/network/jsb_socketio.cpp b/cocos/scripting/js-bindings/manual/network/jsb_socketio.cpp index 8762b9a9f71e..675aa0580065 100644 --- a/cocos/scripting/js-bindings/manual/network/jsb_socketio.cpp +++ b/cocos/scripting/js-bindings/manual/network/jsb_socketio.cpp @@ -23,7 +23,9 @@ */ #include "scripting/js-bindings/manual/network/jsb_socketio.h" + #include "scripting/js-bindings/manual/jsb_helper.h" +#include #include "network/WebSocket.h" #include "network/SocketIO.h" @@ -87,7 +89,7 @@ class JSB_SocketIODelegate : public SocketIO::SIODelegate JSContext* cx = ScriptingCore::getInstance()->getGlobalContext(); jsval args; - if(data == "") + if(data.empty()) { args = JSVAL_NULL; } else @@ -116,7 +118,7 @@ class JSB_SocketIODelegate : public SocketIO::SIODelegate void addEvent(const std::string& eventName, std::shared_ptr callback) { - _eventRegistry[eventName] = callback; + _eventRegistry[eventName] = std::move(callback); } private: diff --git a/cocos/scripting/js-bindings/manual/platform/android/CCJavascriptJavaBridge.cpp b/cocos/scripting/js-bindings/manual/platform/android/CCJavascriptJavaBridge.cpp index 9df562297c4c..698a41b475cf 100644 --- a/cocos/scripting/js-bindings/manual/platform/android/CCJavascriptJavaBridge.cpp +++ b/cocos/scripting/js-bindings/manual/platform/android/CCJavascriptJavaBridge.cpp @@ -55,7 +55,7 @@ JNIEXPORT jint JNICALL Java_org_cocos2dx_lib_Cocos2dxJavascriptJavaBridge_evalSt } #endif -JavascriptJavaBridge::CallInfo::~CallInfo(void) +JavascriptJavaBridge::CallInfo::~CallInfo() { if (m_returnType == TypeString && m_ret.stringValue) { @@ -66,7 +66,7 @@ JavascriptJavaBridge::CallInfo::~CallInfo(void) m_env->DeleteLocalRef(m_classID); } -bool JavascriptJavaBridge::CallInfo::execute(void) +bool JavascriptJavaBridge::CallInfo::execute() { switch (m_returnType) { @@ -234,7 +234,7 @@ JavascriptJavaBridge::ValueType JavascriptJavaBridge::CallInfo::checkType(const } -bool JavascriptJavaBridge::CallInfo::getMethodInfo(void) +bool JavascriptJavaBridge::CallInfo::getMethodInfo() { m_methodID = 0; m_env = 0; diff --git a/cocos/scripting/js-bindings/manual/platform/android/CCJavascriptJavaBridge.h b/cocos/scripting/js-bindings/manual/platform/android/CCJavascriptJavaBridge.h index 28c2a139c7ad..51c3bfb50787 100644 --- a/cocos/scripting/js-bindings/manual/platform/android/CCJavascriptJavaBridge.h +++ b/cocos/scripting/js-bindings/manual/platform/android/CCJavascriptJavaBridge.h @@ -86,17 +86,17 @@ class JavascriptJavaBridge memset(&m_ret, 0, sizeof(m_ret)); m_valid = validateMethodSig() && getMethodInfo(); } - ~CallInfo(void); + ~CallInfo(); - bool isValid(void) { + bool isValid() { return m_valid; } - int getErrorCode(void) { + int getErrorCode() { return m_error; } - JNIEnv *getEnv(void) { + JNIEnv *getEnv() { return m_env; } @@ -116,7 +116,7 @@ class JavascriptJavaBridge return m_ret; } - bool execute(void); + bool execute(); bool executeWithArgs(jvalue *args); @@ -137,8 +137,8 @@ class JavascriptJavaBridge jclass m_classID; jmethodID m_methodID; - bool validateMethodSig(void); - bool getMethodInfo(void); + bool validateMethodSig(); + bool getMethodInfo(); ValueType checkType(const string& sig, size_t *pos); }; diff --git a/cocos/scripting/js-bindings/manual/platform/ios/JavaScriptObjCBridge.h b/cocos/scripting/js-bindings/manual/platform/ios/JavaScriptObjCBridge.h index edd563178d59..5e0dc38d177b 100644 --- a/cocos/scripting/js-bindings/manual/platform/ios/JavaScriptObjCBridge.h +++ b/cocos/scripting/js-bindings/manual/platform/ios/JavaScriptObjCBridge.h @@ -74,12 +74,12 @@ class JavaScriptObjCBridge{ ,m_returnType(TypeVoid) { } - ~CallInfo(void); - bool isValid(void) { + ~CallInfo(); + bool isValid() { return m_valid; } - int getErrorCode(void) { + int getErrorCode() { return m_error; } ValueType getReturnValueType(){ diff --git a/cocos/scripting/js-bindings/manual/ui/jsb_cocos2dx_ui_manual.cpp b/cocos/scripting/js-bindings/manual/ui/jsb_cocos2dx_ui_manual.cpp index d2ee206be89d..fdfdb03f9677 100755 --- a/cocos/scripting/js-bindings/manual/ui/jsb_cocos2dx_ui_manual.cpp +++ b/cocos/scripting/js-bindings/manual/ui/jsb_cocos2dx_ui_manual.cpp @@ -149,7 +149,7 @@ class JSB_EditBoxDelegate jsval dataVal[2]; dataVal[0] = OBJECT_TO_JSVAL(p->obj); - std::string arg1 = text; + const std::string& arg1 = text; dataVal[1] = std_string_to_jsval(cx, arg1); JS::RootedValue delegateVal(cx, _JSDelegate); diff --git a/cocos/scripting/js-bindings/proj.android/CMakeLists.txt b/cocos/scripting/js-bindings/proj.android/CMakeLists.txt index 29bbcb8357fe..60f2a9b82b85 100644 --- a/cocos/scripting/js-bindings/proj.android/CMakeLists.txt +++ b/cocos/scripting/js-bindings/proj.android/CMakeLists.txt @@ -13,6 +13,9 @@ add_library(${target_name} STATIC ${${target_name}_src} ) +# WARN, CCJavascriptJavaBridge.h:51 char TypeInvalid = -1 [-Wc++11-narrowing] +target_compile_options(${target_name} PUBLIC -Wno-c++11-narrowing) + get_target_property(spiderm_header ext_spidermonkey INTERFACE_INCLUDE_DIRECTORIES) target_include_directories(${target_name} PRIVATE ../../.. diff --git a/cocos/scripting/js-bindings/proj.ios_mac/cocos2d_js_bindings.xcodeproj/project.pbxproj b/cocos/scripting/js-bindings/proj.ios_mac/cocos2d_js_bindings.xcodeproj/project.pbxproj index b3a6fdf23a5a..0b2d8e3f0495 100644 --- a/cocos/scripting/js-bindings/proj.ios_mac/cocos2d_js_bindings.xcodeproj/project.pbxproj +++ b/cocos/scripting/js-bindings/proj.ios_mac/cocos2d_js_bindings.xcodeproj/project.pbxproj @@ -475,6 +475,7 @@ 1A5410A418B785A10016A3AF /* libjscocos2d Mac.a */, 1A119E4118BDF19200352BAA /* manual */, 507B427D1C31DCC60067B53E /* libjscocos2d tvOS.a */, + 46AF3B3822154F3100D5AFCD /* Recovered References */, ); sourceTree = ""; }; @@ -716,6 +717,14 @@ name = experimental; sourceTree = ""; }; + 46AF3B3822154F3100D5AFCD /* Recovered References */ = { + isa = PBXGroup; + children = ( + 4BE089EA1ADF967400D65D4B /* jsb_cocos2dx_experimental_webView_manual.h */, + ); + name = "Recovered References"; + sourceTree = ""; + }; BA9FD5CF1BAC0A4600996C85 /* component */ = { isa = PBXGroup; children = ( @@ -1171,7 +1180,7 @@ 1551A34A158F2AB200E66CFE /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = YES; + ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_WARN_BOOL_CONVERSION = YES; @@ -1208,7 +1217,7 @@ 1551A34B158F2AB200E66CFE /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = YES; + ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_WARN_BOOL_CONVERSION = YES; diff --git a/cocos/scripting/js-bindings/proj.win32/libjscocos2d.vcxproj b/cocos/scripting/js-bindings/proj.win32/libjscocos2d.vcxproj index d1a41f005c7c..afd746795a84 100644 --- a/cocos/scripting/js-bindings/proj.win32/libjscocos2d.vcxproj +++ b/cocos/scripting/js-bindings/proj.win32/libjscocos2d.vcxproj @@ -124,6 +124,7 @@ {39379840-825A-45A0-B363-C09FFEF864BD} Win32Proj libjscocos2d + 10.0.17134.0 diff --git a/cocos/scripting/js-bindings/script/jsb_cocos2d.js b/cocos/scripting/js-bindings/script/jsb_cocos2d.js index 62c4e3abc097..9a78f0bdef20 100644 --- a/cocos/scripting/js-bindings/script/jsb_cocos2d.js +++ b/cocos/scripting/js-bindings/script/jsb_cocos2d.js @@ -1779,7 +1779,7 @@ cc._DrawNode.prototype.drawPoly = function (verts, fillColor, borderWidth, borde cc._DrawNode.prototype.drawPolygon.call(this, verts, verts.length, fillColor, borderWidth, borderColor); } cc.DrawNode = cc._DrawNode.extend({ - _drawColor: cc.color(255, 255, 255, 255), + _drawColor: null, _lineWidth: 1, release: function () {}, @@ -1895,7 +1895,9 @@ cc.DrawNode = cc._DrawNode.extend({ cc._DrawNode.prototype.drawDot.call(this, pos, radius, color); }, - drawSegment:function (from, to, lineWidth = this._lineWidth, color = this._drawColor) { + drawSegment:function (from, to, lineWidth, color) { + lineWidth = lineWidth || this._lineWidth; + color = color || this._drawColor; cc._DrawNode.prototype.drawSegment.call(this, from, to, lineWidth, color); }, diff --git a/cocos/scripting/js-bindings/script/jsb_create_apis.js b/cocos/scripting/js-bindings/script/jsb_create_apis.js index 8946bcb7f062..ec0f38501c34 100644 --- a/cocos/scripting/js-bindings/script/jsb_create_apis.js +++ b/cocos/scripting/js-bindings/script/jsb_create_apis.js @@ -774,6 +774,7 @@ cc.ClippingNode.prototype._ctor = function(stencil) { cc.DrawNode.prototype._ctor = function() { cc.DrawNode.prototype.init.call(this); + this._drawColor = cc.color(255, 255, 255, 255); }; cc.LabelAtlas.prototype._ctor = function(strText, charMapFile, itemWidth, itemHeight, startCharMap) { diff --git a/cocos/scripting/lua-bindings/CMakeLists.txt b/cocos/scripting/lua-bindings/CMakeLists.txt index 1128bf93edee..06fbe5b9bddd 100644 --- a/cocos/scripting/lua-bindings/CMakeLists.txt +++ b/cocos/scripting/lua-bindings/CMakeLists.txt @@ -179,7 +179,7 @@ target_include_directories(luacocos2d ) if(WINDOWS) - target_compile_definitions(luacocos2d PRIVATE _USRLUASTATIC) + target_compile_definitions(luacocos2d PUBLIC _USRLUASTATIC) endif() diff --git a/cocos/scripting/lua-bindings/auto/api/Application.lua b/cocos/scripting/lua-bindings/auto/api/Application.lua index c6ddb743d6da..1b14874a9cd7 100644 --- a/cocos/scripting/lua-bindings/auto/api/Application.lua +++ b/cocos/scripting/lua-bindings/auto/api/Application.lua @@ -39,14 +39,13 @@ -- @return string#string ret (return value: string) -------------------------------- --- @overload self, float, int --- @overload self, float --- @function [parent=#Application] setAnimationInterval +-- brief Callback by Director to limit FPS.
+-- param interval The time, expressed in seconds, between current frame and next. +-- @function [parent=#Application] setAnimationInterval -- @param self -- @param #float interval --- @param #int reason -- @return Application#Application self (return value: cc.Application) - + -------------------------------- -- brief Get current application instance.
-- return Current application instance pointer. diff --git a/cocos/scripting/lua-bindings/auto/api/Director.lua b/cocos/scripting/lua-bindings/auto/api/Director.lua index f62adda80020..1470ed6a6591 100644 --- a/cocos/scripting/lua-bindings/auto/api/Director.lua +++ b/cocos/scripting/lua-bindings/auto/api/Director.lua @@ -515,6 +515,13 @@ -- @param self -- @return float#float ret (return value: float) +-------------------------------- +-- Gets clear values for the color buffers.
+-- js NA +-- @function [parent=#Director] getClearColor +-- @param self +-- @return color4f_table#color4f_table ret (return value: color4f_table) + -------------------------------- -- Whether or not the Director is paused. -- @function [parent=#Director] isPaused diff --git a/cocos/scripting/lua-bindings/auto/api/EventDispatcher.lua b/cocos/scripting/lua-bindings/auto/api/EventDispatcher.lua index fb8b038269b1..050c2633562f 100644 --- a/cocos/scripting/lua-bindings/auto/api/EventDispatcher.lua +++ b/cocos/scripting/lua-bindings/auto/api/EventDispatcher.lua @@ -94,18 +94,6 @@ -- @param #int fixedPriority -- @return EventDispatcher#EventDispatcher self (return value: cc.EventDispatcher) --------------------------------- --- Adds a Custom event listener.
--- It will use a fixed priority of 1.
--- param eventName A given name of the event.
--- param callback A given callback method that associated the event name.
--- return the generated event. Needed in order to remove the event from the dispatcher --- @function [parent=#EventDispatcher] addCustomEventListener --- @param self --- @param #string eventName --- @param #function callback --- @return EventListenerCustom#EventListenerCustom ret (return value: cc.EventListenerCustom) - -------------------------------- -- Dispatches the event.
-- Also removes all EventListeners marked for deletion from the
diff --git a/cocos/scripting/lua-bindings/auto/api/GLView.lua b/cocos/scripting/lua-bindings/auto/api/GLView.lua index a3a087536cde..6ad0dbb7844d 100644 --- a/cocos/scripting/lua-bindings/auto/api/GLView.lua +++ b/cocos/scripting/lua-bindings/auto/api/GLView.lua @@ -159,6 +159,12 @@ -- @param #string filename -- @return GLView#GLView self (return value: cc.GLView) +-------------------------------- +-- Sets the cursor for the window back to default. +-- @function [parent=#GLView] setDefaultCursor +-- @param self +-- @return GLView#GLView self (return value: cc.GLView) + -------------------------------- -- When the window is closed, it will return false if the platforms is Ios or Android.
-- If the platforms is windows or Mac,it will return true.
@@ -247,6 +253,16 @@ -- @param self -- @return rect_table#rect_table ret (return value: rect_table) +-------------------------------- +-- Sets the cursor for the window with custom image.
+-- param filename A path to image file, e.g., "cursors/custom.png".
+-- param hotspot Cursor hotspot, as a anchor point, default is top left (0, 1) +-- @function [parent=#GLView] setCursor +-- @param self +-- @param #string filename +-- @param #vec2_table hotspot +-- @return GLView#GLView self (return value: cc.GLView) + -------------------------------- -- Get retina factor.
-- return The retina factor. diff --git a/cocos/scripting/lua-bindings/auto/api/Label.lua b/cocos/scripting/lua-bindings/auto/api/Label.lua index 376b5b84d464..661c76e410a9 100644 --- a/cocos/scripting/lua-bindings/auto/api/Label.lua +++ b/cocos/scripting/lua-bindings/auto/api/Label.lua @@ -63,7 +63,7 @@ -- Returns type of label
-- warning Not support system font.
-- return the type of label
--- since v3.18.0 +-- since v3.17.1 -- @function [parent=#Label] getLabelType -- @param self -- @return int#int ret (return value: int) diff --git a/cocos/scripting/lua-bindings/auto/api/Slider.lua b/cocos/scripting/lua-bindings/auto/api/Slider.lua index d3b7a4d4a7c3..c1b2ca8a909b 100644 --- a/cocos/scripting/lua-bindings/auto/api/Slider.lua +++ b/cocos/scripting/lua-bindings/auto/api/Slider.lua @@ -142,6 +142,12 @@ -- @param self -- @return rect_table#rect_table ret (return value: rect_table) +-------------------------------- +-- Updates the visual elements of the slider. +-- @function [parent=#Slider] updateVisualSlider +-- @param self +-- @return Slider#Slider self (return value: ccui.Slider) + -------------------------------- -- Gets capinsets for progress bar slider, if slider is using scale9 renderer.
-- return Capinsets for progress bar slider.
diff --git a/cocos/scripting/lua-bindings/auto/api/VideoPlayer.lua b/cocos/scripting/lua-bindings/auto/api/VideoPlayer.lua index b229a0e7e6d3..846a8af89bf6 100644 --- a/cocos/scripting/lua-bindings/auto/api/VideoPlayer.lua +++ b/cocos/scripting/lua-bindings/auto/api/VideoPlayer.lua @@ -24,6 +24,13 @@ -- @param self -- @return experimental::ui::VideoPlayer#experimental::ui::VideoPlayer self (return value: cc.experimental::ui::VideoPlayer) +-------------------------------- +-- Checks whether the VideoPlayer is set to listen user input to resume and pause the video
+-- return true if the videoplayer user input is set, false otherwise. +-- @function [parent=#VideoPlayer] isUserInputEnabled +-- @param self +-- @return bool#bool ret (return value: bool) + -------------------------------- -- Causes the video player to keep aspect ratio or no when displaying the video.
-- param enable Specify true to keep aspect ratio or false to scale the video until
@@ -61,6 +68,22 @@ -- @param #string _videoURL -- @return experimental::ui::VideoPlayer#experimental::ui::VideoPlayer self (return value: cc.experimental::ui::VideoPlayer) +-------------------------------- +-- Set the style of the player
+-- param style The corresponding style +-- @function [parent=#VideoPlayer] setStyle +-- @param self +-- @param #int style +-- @return experimental::ui::VideoPlayer#experimental::ui::VideoPlayer self (return value: cc.experimental::ui::VideoPlayer) + +-------------------------------- +-- Seeks to specified time position.
+-- param sec The offset in seconds from the start to seek to. +-- @function [parent=#VideoPlayer] seekTo +-- @param self +-- @param #float sec +-- @return experimental::ui::VideoPlayer#experimental::ui::VideoPlayer self (return value: cc.experimental::ui::VideoPlayer) + -------------------------------- -- Indicates whether the video player keep aspect ratio when displaying the video. -- @function [parent=#VideoPlayer] isKeepAspectRatioEnabled @@ -82,6 +105,13 @@ -- @param self -- @return bool#bool ret (return value: bool) +-------------------------------- +-- Checks whether the VideoPlayer is set with looping mode.
+-- return true if the videoplayer is set to loop, false otherwise. +-- @function [parent=#VideoPlayer] isLooping +-- @param self +-- @return bool#bool ret (return value: bool) + -------------------------------- -- Checks whether the VideoPlayer is playing.
-- return True if currently playing, false otherwise. @@ -90,11 +120,19 @@ -- @return bool#bool ret (return value: bool) -------------------------------- --- Seeks to specified time position.
--- param sec The offset in seconds from the start to seek to. --- @function [parent=#VideoPlayer] seekTo +-- brief Set if playback is done in loop mode
+-- param looping the video will or not automatically restart at the end +-- @function [parent=#VideoPlayer] setLooping -- @param self --- @param #float sec +-- @param #bool looping +-- @return experimental::ui::VideoPlayer#experimental::ui::VideoPlayer self (return value: cc.experimental::ui::VideoPlayer) + +-------------------------------- +-- Set if the player will enable user input for basic pause and resume of video
+-- param enableInput If true, input will be handled for basic functionality (pause/resume) +-- @function [parent=#VideoPlayer] setUserInputEnabled +-- @param self +-- @param #bool enableInput -- @return experimental::ui::VideoPlayer#experimental::ui::VideoPlayer self (return value: cc.experimental::ui::VideoPlayer) -------------------------------- diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp index d3520ecdf7e4..17e232ccc9d2 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp @@ -12698,6 +12698,53 @@ int lua_cocos2dx_GLView_setIcon(lua_State* tolua_S) return 0; } +int lua_cocos2dx_GLView_setDefaultCursor(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::GLView* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.GLView",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::GLView*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_GLView_setDefaultCursor'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_GLView_setDefaultCursor'", nullptr); + return 0; + } + cobj->setDefaultCursor(); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.GLView:setDefaultCursor",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_GLView_setDefaultCursor'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_GLView_windowShouldClose(lua_State* tolua_S) { int argc = 0; @@ -13198,6 +13245,73 @@ int lua_cocos2dx_GLView_getScissorRect(lua_State* tolua_S) return 0; } +int lua_cocos2dx_GLView_setCursor(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::GLView* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.GLView",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::GLView*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_GLView_setCursor'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + std::string arg0; + + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.GLView:setCursor"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_GLView_setCursor'", nullptr); + return 0; + } + cobj->setCursor(arg0); + lua_settop(tolua_S, 1); + return 1; + } + if (argc == 2) + { + std::string arg0; + cocos2d::Vec2 arg1; + + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.GLView:setCursor"); + + ok &= luaval_to_vec2(tolua_S, 3, &arg1, "cc.GLView:setCursor"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_GLView_setCursor'", nullptr); + return 0; + } + cobj->setCursor(arg0, arg1); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.GLView:setCursor",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_GLView_setCursor'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_GLView_getRetinaFactor(lua_State* tolua_S) { int argc = 0; @@ -13586,6 +13700,7 @@ int lua_register_cocos2dx_GLView(lua_State* tolua_S) tolua_function(tolua_S,"getFrameZoomFactor",lua_cocos2dx_GLView_getFrameZoomFactor); tolua_function(tolua_S,"getDesignResolutionSize",lua_cocos2dx_GLView_getDesignResolutionSize); tolua_function(tolua_S,"setIcon",lua_cocos2dx_GLView_setIcon); + tolua_function(tolua_S,"setDefaultCursor",lua_cocos2dx_GLView_setDefaultCursor); tolua_function(tolua_S,"windowShouldClose",lua_cocos2dx_GLView_windowShouldClose); tolua_function(tolua_S,"swapBuffers",lua_cocos2dx_GLView_swapBuffers); tolua_function(tolua_S,"setDesignResolutionSize",lua_cocos2dx_GLView_setDesignResolutionSize); @@ -13596,6 +13711,7 @@ int lua_register_cocos2dx_GLView(lua_State* tolua_S) tolua_function(tolua_S,"setVR",lua_cocos2dx_GLView_setVR); tolua_function(tolua_S,"setViewPortInPoints",lua_cocos2dx_GLView_setViewPortInPoints); tolua_function(tolua_S,"getScissorRect",lua_cocos2dx_GLView_getScissorRect); + tolua_function(tolua_S,"setCursor",lua_cocos2dx_GLView_setCursor); tolua_function(tolua_S,"getRetinaFactor",lua_cocos2dx_GLView_getRetinaFactor); tolua_function(tolua_S,"setViewName",lua_cocos2dx_GLView_setViewName); tolua_function(tolua_S,"getVisibleRect",lua_cocos2dx_GLView_getVisibleRect); @@ -16813,6 +16929,53 @@ int lua_cocos2dx_Director_getAnimationInterval(lua_State* tolua_S) return 0; } +int lua_cocos2dx_Director_getClearColor(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Director* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Director",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Director*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Director_getClearColor'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Director_getClearColor'", nullptr); + return 0; + } + const cocos2d::Color4F& ret = cobj->getClearColor(); + color4f_to_luaval(tolua_S, ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Director:getClearColor",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Director_getClearColor'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_Director_isPaused(lua_State* tolua_S) { int argc = 0; @@ -17216,6 +17379,7 @@ int lua_register_cocos2dx_Director(lua_State* tolua_S) tolua_function(tolua_S,"getScheduler",lua_cocos2dx_Director_getScheduler); tolua_function(tolua_S,"pushScene",lua_cocos2dx_Director_pushScene); tolua_function(tolua_S,"getAnimationInterval",lua_cocos2dx_Director_getAnimationInterval); + tolua_function(tolua_S,"getClearColor",lua_cocos2dx_Director_getClearColor); tolua_function(tolua_S,"isPaused",lua_cocos2dx_Director_isPaused); tolua_function(tolua_S,"setDisplayStats",lua_cocos2dx_Director_setDisplayStats); tolua_function(tolua_S,"getEventDispatcher",lua_cocos2dx_Director_getEventDispatcher); @@ -19754,6 +19918,53 @@ int lua_cocos2dx_Image_hasPremultipliedAlpha(lua_State* tolua_S) return 0; } +int lua_cocos2dx_Image_reversePremultipliedAlpha(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Image* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Image",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Image*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Image_reversePremultipliedAlpha'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Image_reversePremultipliedAlpha'", nullptr); + return 0; + } + cobj->reversePremultipliedAlpha(); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Image:reversePremultipliedAlpha",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Image_reversePremultipliedAlpha'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_Image_saveToFile(lua_State* tolua_S) { int argc = 0; @@ -19962,6 +20173,53 @@ int lua_cocos2dx_Image_getHeight(lua_State* tolua_S) return 0; } +int lua_cocos2dx_Image_premultiplyAlpha(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::Image* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.Image",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::Image*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Image_premultiplyAlpha'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Image_premultiplyAlpha'", nullptr); + return 0; + } + cobj->premultiplyAlpha(); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Image:premultiplyAlpha",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Image_premultiplyAlpha'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_Image_initWithImageFile(lua_State* tolua_S) { int argc = 0; @@ -20417,10 +20675,12 @@ int lua_register_cocos2dx_Image(lua_State* tolua_S) tolua_beginmodule(tolua_S,"Image"); tolua_function(tolua_S,"new",lua_cocos2dx_Image_constructor); tolua_function(tolua_S,"hasPremultipliedAlpha",lua_cocos2dx_Image_hasPremultipliedAlpha); + tolua_function(tolua_S,"reversePremultipliedAlpha",lua_cocos2dx_Image_reversePremultipliedAlpha); tolua_function(tolua_S,"saveToFile",lua_cocos2dx_Image_saveToFile); tolua_function(tolua_S,"hasAlpha",lua_cocos2dx_Image_hasAlpha); tolua_function(tolua_S,"isCompressed",lua_cocos2dx_Image_isCompressed); tolua_function(tolua_S,"getHeight",lua_cocos2dx_Image_getHeight); + tolua_function(tolua_S,"premultiplyAlpha",lua_cocos2dx_Image_premultiplyAlpha); tolua_function(tolua_S,"initWithImageFile",lua_cocos2dx_Image_initWithImageFile); tolua_function(tolua_S,"getWidth",lua_cocos2dx_Image_getWidth); tolua_function(tolua_S,"getBitPerPixel",lua_cocos2dx_Image_getBitPerPixel); @@ -36126,63 +36386,6 @@ int lua_cocos2dx_EventDispatcher_setPriority(lua_State* tolua_S) return 0; } -int lua_cocos2dx_EventDispatcher_addCustomEventListener(lua_State* tolua_S) -{ - int argc = 0; - cocos2d::EventDispatcher* cobj = nullptr; - bool ok = true; - -#if COCOS2D_DEBUG >= 1 - tolua_Error tolua_err; -#endif - - -#if COCOS2D_DEBUG >= 1 - if (!tolua_isusertype(tolua_S,1,"cc.EventDispatcher",0,&tolua_err)) goto tolua_lerror; -#endif - - cobj = (cocos2d::EventDispatcher*)tolua_tousertype(tolua_S,1,0); - -#if COCOS2D_DEBUG >= 1 - if (!cobj) - { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_EventDispatcher_addCustomEventListener'", nullptr); - return 0; - } -#endif - - argc = lua_gettop(tolua_S)-1; - if (argc == 2) - { - std::string arg0; - std::function arg1; - - ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.EventDispatcher:addCustomEventListener"); - - do { - // Lambda binding for lua is not supported. - assert(false); - } while(0) - ; - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_EventDispatcher_addCustomEventListener'", nullptr); - return 0; - } - cocos2d::EventListenerCustom* ret = cobj->addCustomEventListener(arg0, arg1); - object_to_luaval(tolua_S, "cc.EventListenerCustom",(cocos2d::EventListenerCustom*)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.EventDispatcher:addCustomEventListener",argc, 2); - return 0; - -#if COCOS2D_DEBUG >= 1 - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_EventDispatcher_addCustomEventListener'.",&tolua_err); -#endif - - return 0; -} int lua_cocos2dx_EventDispatcher_dispatchEvent(lua_State* tolua_S) { int argc = 0; @@ -36536,7 +36739,6 @@ int lua_register_cocos2dx_EventDispatcher(lua_State* tolua_S) tolua_function(tolua_S,"resumeEventListenersForTarget",lua_cocos2dx_EventDispatcher_resumeEventListenersForTarget); tolua_function(tolua_S,"removeEventListenersForTarget",lua_cocos2dx_EventDispatcher_removeEventListenersForTarget); tolua_function(tolua_S,"setPriority",lua_cocos2dx_EventDispatcher_setPriority); - tolua_function(tolua_S,"addCustomEventListener",lua_cocos2dx_EventDispatcher_addCustomEventListener); tolua_function(tolua_S,"dispatchEvent",lua_cocos2dx_EventDispatcher_dispatchEvent); tolua_function(tolua_S,"hasEventListener",lua_cocos2dx_EventDispatcher_hasEventListener); tolua_function(tolua_S,"removeAllEventListeners",lua_cocos2dx_EventDispatcher_removeAllEventListeners); @@ -55574,79 +55776,131 @@ int lua_cocos2dx_Label_setBMFontFilePath(lua_State* tolua_S) int argc = 0; cocos2d::Label* cobj = nullptr; bool ok = true; - #if COCOS2D_DEBUG >= 1 tolua_Error tolua_err; #endif - #if COCOS2D_DEBUG >= 1 if (!tolua_isusertype(tolua_S,1,"cc.Label",0,&tolua_err)) goto tolua_lerror; #endif - cobj = (cocos2d::Label*)tolua_tousertype(tolua_S,1,0); - #if COCOS2D_DEBUG >= 1 - if (!cobj) + if (!cobj) { tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Label_setBMFontFilePath'", nullptr); return 0; } #endif - argc = lua_gettop(tolua_S)-1; - if (argc == 1) - { - std::string arg0; + do{ + if (argc == 3) { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Label:setBMFontFilePath"); - ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Label:setBMFontFilePath"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_setBMFontFilePath'", nullptr); - return 0; + if (!ok) { break; } + cocos2d::Rect arg1; + ok &= luaval_to_rect(tolua_S, 3, &arg1, "cc.Label:setBMFontFilePath"); + + if (!ok) { break; } + bool arg2; + ok &= luaval_to_boolean(tolua_S, 4,&arg2, "cc.Label:setBMFontFilePath"); + + if (!ok) { break; } + bool ret = cobj->setBMFontFilePath(arg0, arg1, arg2); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; } - bool ret = cobj->setBMFontFilePath(arg0); - tolua_pushboolean(tolua_S,(bool)ret); - return 1; - } - if (argc == 2) - { - std::string arg0; - cocos2d::Vec2 arg1; + }while(0); + ok = true; + do{ + if (argc == 4) { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Label:setBMFontFilePath"); - ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Label:setBMFontFilePath"); + if (!ok) { break; } + cocos2d::Rect arg1; + ok &= luaval_to_rect(tolua_S, 3, &arg1, "cc.Label:setBMFontFilePath"); - ok &= luaval_to_vec2(tolua_S, 3, &arg1, "cc.Label:setBMFontFilePath"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_setBMFontFilePath'", nullptr); - return 0; + if (!ok) { break; } + bool arg2; + ok &= luaval_to_boolean(tolua_S, 4,&arg2, "cc.Label:setBMFontFilePath"); + + if (!ok) { break; } + double arg3; + ok &= luaval_to_number(tolua_S, 5,&arg3, "cc.Label:setBMFontFilePath"); + + if (!ok) { break; } + bool ret = cobj->setBMFontFilePath(arg0, arg1, arg2, arg3); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; } - bool ret = cobj->setBMFontFilePath(arg0, arg1); - tolua_pushboolean(tolua_S,(bool)ret); - return 1; - } - if (argc == 3) - { - std::string arg0; - cocos2d::Vec2 arg1; - double arg2; + }while(0); + ok = true; + do{ + if (argc == 1) { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Label:setBMFontFilePath"); - ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Label:setBMFontFilePath"); + if (!ok) { break; } + bool ret = cobj->setBMFontFilePath(arg0); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + }while(0); + ok = true; + do{ + if (argc == 2) { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Label:setBMFontFilePath"); - ok &= luaval_to_vec2(tolua_S, 3, &arg1, "cc.Label:setBMFontFilePath"); + if (!ok) { break; } + double arg1; + ok &= luaval_to_number(tolua_S, 3,&arg1, "cc.Label:setBMFontFilePath"); - ok &= luaval_to_number(tolua_S, 4,&arg2, "cc.Label:setBMFontFilePath"); - if(!ok) - { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_setBMFontFilePath'", nullptr); - return 0; + if (!ok) { break; } + bool ret = cobj->setBMFontFilePath(arg0, arg1); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; } - bool ret = cobj->setBMFontFilePath(arg0, arg1, arg2); - tolua_pushboolean(tolua_S,(bool)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:setBMFontFilePath",argc, 1); + }while(0); + ok = true; + do{ + if (argc == 2) { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Label:setBMFontFilePath"); + + if (!ok) { break; } + std::string arg1; + ok &= luaval_to_std_string(tolua_S, 3,&arg1, "cc.Label:setBMFontFilePath"); + + if (!ok) { break; } + bool ret = cobj->setBMFontFilePath(arg0, arg1); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + }while(0); + ok = true; + do{ + if (argc == 3) { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Label:setBMFontFilePath"); + + if (!ok) { break; } + std::string arg1; + ok &= luaval_to_std_string(tolua_S, 3,&arg1, "cc.Label:setBMFontFilePath"); + + if (!ok) { break; } + double arg2; + ok &= luaval_to_number(tolua_S, 4,&arg2, "cc.Label:setBMFontFilePath"); + + if (!ok) { break; } + bool ret = cobj->setBMFontFilePath(arg0, arg1, arg2); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + }while(0); + ok = true; + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Label:setBMFontFilePath",argc, 2); return 0; #if COCOS2D_DEBUG >= 1 @@ -58000,7 +58254,6 @@ int lua_cocos2dx_Label_createWithBMFont(lua_State* tolua_S) { int argc = 0; bool ok = true; - #if COCOS2D_DEBUG >= 1 tolua_Error tolua_err; #endif @@ -58009,81 +58262,119 @@ int lua_cocos2dx_Label_createWithBMFont(lua_State* tolua_S) if (!tolua_isusertable(tolua_S,1,"cc.Label",0,&tolua_err)) goto tolua_lerror; #endif - argc = lua_gettop(tolua_S) - 1; + argc = lua_gettop(tolua_S)-1; - if (argc == 2) + do { - std::string arg0; - std::string arg1; - ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Label:createWithBMFont"); - ok &= luaval_to_std_string(tolua_S, 3,&arg1, "cc.Label:createWithBMFont"); - if(!ok) + if (argc == 6) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_createWithBMFont'", nullptr); - return 0; + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Label:createWithBMFont"); + if (!ok) { break; } + std::string arg1; + ok &= luaval_to_std_string(tolua_S, 3,&arg1, "cc.Label:createWithBMFont"); + if (!ok) { break; } + cocos2d::TextHAlignment arg2; + ok &= luaval_to_int32(tolua_S, 4,(int *)&arg2, "cc.Label:createWithBMFont"); + if (!ok) { break; } + int arg3; + ok &= luaval_to_int32(tolua_S, 5,(int *)&arg3, "cc.Label:createWithBMFont"); + if (!ok) { break; } + cocos2d::Rect arg4; + ok &= luaval_to_rect(tolua_S, 6, &arg4, "cc.Label:createWithBMFont"); + if (!ok) { break; } + bool arg5; + ok &= luaval_to_boolean(tolua_S, 7,&arg5, "cc.Label:createWithBMFont"); + if (!ok) { break; } + cocos2d::Label* ret = cocos2d::Label::createWithBMFont(arg0, arg1, arg2, arg3, arg4, arg5); + object_to_luaval(tolua_S, "cc.Label",(cocos2d::Label*)ret); + return 1; } - cocos2d::Label* ret = cocos2d::Label::createWithBMFont(arg0, arg1); - object_to_luaval(tolua_S, "cc.Label",(cocos2d::Label*)ret); - return 1; - } - if (argc == 3) + } while (0); + ok = true; + do { - std::string arg0; - std::string arg1; - cocos2d::TextHAlignment arg2; - ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Label:createWithBMFont"); - ok &= luaval_to_std_string(tolua_S, 3,&arg1, "cc.Label:createWithBMFont"); - ok &= luaval_to_int32(tolua_S, 4,(int *)&arg2, "cc.Label:createWithBMFont"); - if(!ok) + if (argc == 2) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_createWithBMFont'", nullptr); - return 0; + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Label:createWithBMFont"); + if (!ok) { break; } + std::string arg1; + ok &= luaval_to_std_string(tolua_S, 3,&arg1, "cc.Label:createWithBMFont"); + if (!ok) { break; } + cocos2d::Label* ret = cocos2d::Label::createWithBMFont(arg0, arg1); + object_to_luaval(tolua_S, "cc.Label",(cocos2d::Label*)ret); + return 1; } - cocos2d::Label* ret = cocos2d::Label::createWithBMFont(arg0, arg1, arg2); - object_to_luaval(tolua_S, "cc.Label",(cocos2d::Label*)ret); - return 1; - } - if (argc == 4) + } while (0); + ok = true; + do { - std::string arg0; - std::string arg1; - cocos2d::TextHAlignment arg2; - int arg3; - ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Label:createWithBMFont"); - ok &= luaval_to_std_string(tolua_S, 3,&arg1, "cc.Label:createWithBMFont"); - ok &= luaval_to_int32(tolua_S, 4,(int *)&arg2, "cc.Label:createWithBMFont"); - ok &= luaval_to_int32(tolua_S, 5,(int *)&arg3, "cc.Label:createWithBMFont"); - if(!ok) + if (argc == 3) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_createWithBMFont'", nullptr); - return 0; + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Label:createWithBMFont"); + if (!ok) { break; } + std::string arg1; + ok &= luaval_to_std_string(tolua_S, 3,&arg1, "cc.Label:createWithBMFont"); + if (!ok) { break; } + cocos2d::TextHAlignment arg2; + ok &= luaval_to_int32(tolua_S, 4,(int *)&arg2, "cc.Label:createWithBMFont"); + if (!ok) { break; } + cocos2d::Label* ret = cocos2d::Label::createWithBMFont(arg0, arg1, arg2); + object_to_luaval(tolua_S, "cc.Label",(cocos2d::Label*)ret); + return 1; } - cocos2d::Label* ret = cocos2d::Label::createWithBMFont(arg0, arg1, arg2, arg3); - object_to_luaval(tolua_S, "cc.Label",(cocos2d::Label*)ret); - return 1; - } - if (argc == 5) + } while (0); + ok = true; + do { - std::string arg0; - std::string arg1; - cocos2d::TextHAlignment arg2; - int arg3; - cocos2d::Vec2 arg4; - ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Label:createWithBMFont"); - ok &= luaval_to_std_string(tolua_S, 3,&arg1, "cc.Label:createWithBMFont"); - ok &= luaval_to_int32(tolua_S, 4,(int *)&arg2, "cc.Label:createWithBMFont"); - ok &= luaval_to_int32(tolua_S, 5,(int *)&arg3, "cc.Label:createWithBMFont"); - ok &= luaval_to_vec2(tolua_S, 6, &arg4, "cc.Label:createWithBMFont"); - if(!ok) + if (argc == 4) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Label_createWithBMFont'", nullptr); - return 0; + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Label:createWithBMFont"); + if (!ok) { break; } + std::string arg1; + ok &= luaval_to_std_string(tolua_S, 3,&arg1, "cc.Label:createWithBMFont"); + if (!ok) { break; } + cocos2d::TextHAlignment arg2; + ok &= luaval_to_int32(tolua_S, 4,(int *)&arg2, "cc.Label:createWithBMFont"); + if (!ok) { break; } + int arg3; + ok &= luaval_to_int32(tolua_S, 5,(int *)&arg3, "cc.Label:createWithBMFont"); + if (!ok) { break; } + cocos2d::Label* ret = cocos2d::Label::createWithBMFont(arg0, arg1, arg2, arg3); + object_to_luaval(tolua_S, "cc.Label",(cocos2d::Label*)ret); + return 1; } - cocos2d::Label* ret = cocos2d::Label::createWithBMFont(arg0, arg1, arg2, arg3, arg4); - object_to_luaval(tolua_S, "cc.Label",(cocos2d::Label*)ret); - return 1; - } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d\n ", "cc.Label:createWithBMFont",argc, 2); + } while (0); + ok = true; + do + { + if (argc == 5) + { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.Label:createWithBMFont"); + if (!ok) { break; } + std::string arg1; + ok &= luaval_to_std_string(tolua_S, 3,&arg1, "cc.Label:createWithBMFont"); + if (!ok) { break; } + cocos2d::TextHAlignment arg2; + ok &= luaval_to_int32(tolua_S, 4,(int *)&arg2, "cc.Label:createWithBMFont"); + if (!ok) { break; } + int arg3; + ok &= luaval_to_int32(tolua_S, 5,(int *)&arg3, "cc.Label:createWithBMFont"); + if (!ok) { break; } + std::string arg4; + ok &= luaval_to_std_string(tolua_S, 6,&arg4, "cc.Label:createWithBMFont"); + if (!ok) { break; } + cocos2d::Label* ret = cocos2d::Label::createWithBMFont(arg0, arg1, arg2, arg3, arg4); + object_to_luaval(tolua_S, "cc.Label",(cocos2d::Label*)ret); + return 1; + } + } while (0); + ok = true; + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d", "cc.Label:createWithBMFont",argc, 5); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: @@ -78703,6 +78994,117 @@ int lua_cocos2dx_RenderTexture_isAutoDraw(lua_State* tolua_S) return 0; } +int lua_cocos2dx_RenderTexture_saveToFileAsNonPMA(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::RenderTexture* cobj = nullptr; + bool ok = true; +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.RenderTexture",0,&tolua_err)) goto tolua_lerror; +#endif + cobj = (cocos2d::RenderTexture*)tolua_tousertype(tolua_S,1,0); +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_RenderTexture_saveToFileAsNonPMA'", nullptr); + return 0; + } +#endif + argc = lua_gettop(tolua_S)-1; + do{ + if (argc == 4) { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.RenderTexture:saveToFileAsNonPMA"); + + if (!ok) { break; } + cocos2d::Image::Format arg1; + ok &= luaval_to_int32(tolua_S, 3,(int *)&arg1, "cc.RenderTexture:saveToFileAsNonPMA"); + + if (!ok) { break; } + bool arg2; + ok &= luaval_to_boolean(tolua_S, 4,&arg2, "cc.RenderTexture:saveToFileAsNonPMA"); + + if (!ok) { break; } + std::function arg3; + do { + // Lambda binding for lua is not supported. + assert(false); + } while(0) + ; + + if (!ok) { break; } + bool ret = cobj->saveToFileAsNonPMA(arg0, arg1, arg2, arg3); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + }while(0); + ok = true; + do{ + if (argc == 1) { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.RenderTexture:saveToFileAsNonPMA"); + + if (!ok) { break; } + bool ret = cobj->saveToFileAsNonPMA(arg0); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + }while(0); + ok = true; + do{ + if (argc == 2) { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.RenderTexture:saveToFileAsNonPMA"); + + if (!ok) { break; } + bool arg1; + ok &= luaval_to_boolean(tolua_S, 3,&arg1, "cc.RenderTexture:saveToFileAsNonPMA"); + + if (!ok) { break; } + bool ret = cobj->saveToFileAsNonPMA(arg0, arg1); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + }while(0); + ok = true; + do{ + if (argc == 3) { + std::string arg0; + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.RenderTexture:saveToFileAsNonPMA"); + + if (!ok) { break; } + bool arg1; + ok &= luaval_to_boolean(tolua_S, 3,&arg1, "cc.RenderTexture:saveToFileAsNonPMA"); + + if (!ok) { break; } + std::function arg2; + do { + // Lambda binding for lua is not supported. + assert(false); + } while(0) + ; + + if (!ok) { break; } + bool ret = cobj->saveToFileAsNonPMA(arg0, arg1, arg2); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + }while(0); + ok = true; + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.RenderTexture:saveToFileAsNonPMA",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_RenderTexture_saveToFileAsNonPMA'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_RenderTexture_setKeepMatrix(lua_State* tolua_S) { int argc = 0; @@ -79785,6 +80187,7 @@ int lua_register_cocos2dx_RenderTexture(lua_State* tolua_S) tolua_function(tolua_S,"setSprite",lua_cocos2dx_RenderTexture_setSprite); tolua_function(tolua_S,"getSprite",lua_cocos2dx_RenderTexture_getSprite); tolua_function(tolua_S,"isAutoDraw",lua_cocos2dx_RenderTexture_isAutoDraw); + tolua_function(tolua_S,"saveToFileAsNonPMA",lua_cocos2dx_RenderTexture_saveToFileAsNonPMA); tolua_function(tolua_S,"setKeepMatrix",lua_cocos2dx_RenderTexture_setKeepMatrix); tolua_function(tolua_S,"setClearFlags",lua_cocos2dx_RenderTexture_setClearFlags); tolua_function(tolua_S,"begin",lua_cocos2dx_RenderTexture_begin); @@ -95034,51 +95437,42 @@ int lua_cocos2dx_Application_setAnimationInterval(lua_State* tolua_S) int argc = 0; cocos2d::Application* cobj = nullptr; bool ok = true; + #if COCOS2D_DEBUG >= 1 tolua_Error tolua_err; #endif + #if COCOS2D_DEBUG >= 1 if (!tolua_isusertype(tolua_S,1,"cc.Application",0,&tolua_err)) goto tolua_lerror; #endif + cobj = (cocos2d::Application*)tolua_tousertype(tolua_S,1,0); + #if COCOS2D_DEBUG >= 1 - if (!cobj) + if (!cobj) { tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Application_setAnimationInterval'", nullptr); return 0; } #endif - argc = lua_gettop(tolua_S)-1; - do{ - if (argc == 2) { - double arg0; - ok &= luaval_to_number(tolua_S, 2,&arg0, "cc.Application:setAnimationInterval"); - - if (!ok) { break; } - cocos2d::SetIntervalReason arg1; - ok &= luaval_to_int32(tolua_S, 3,(int *)&arg1, "cc.Application:setAnimationInterval"); - if (!ok) { break; } - cobj->setAnimationInterval(arg0, arg1); - lua_settop(tolua_S, 1); - return 1; - } - }while(0); - ok = true; - do{ - if (argc == 1) { - double arg0; - ok &= luaval_to_number(tolua_S, 2,&arg0, "cc.Application:setAnimationInterval"); + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + double arg0; - if (!ok) { break; } - cobj->setAnimationInterval(arg0); - lua_settop(tolua_S, 1); - return 1; + ok &= luaval_to_number(tolua_S, 2,&arg0, "cc.Application:setAnimationInterval"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Application_setAnimationInterval'", nullptr); + return 0; } - }while(0); - ok = true; - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Application:setAnimationInterval",argc, 1); + cobj->setAnimationInterval(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Application:setAnimationInterval",argc, 1); return 0; #if COCOS2D_DEBUG >= 1 @@ -100872,6 +101266,53 @@ int lua_register_cocos2dx_TMXMapInfo(lua_State* tolua_S) return 1; } +int lua_cocos2dx_TMXLayer_getAnimTileCoord(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::TMXLayer* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.TMXLayer",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::TMXLayer*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_TMXLayer_getAnimTileCoord'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_TMXLayer_getAnimTileCoord'", nullptr); + return 0; + } + const std::map>* ret = cobj->getAnimTileCoord(); + object_to_luaval>>(tolua_S, "std::map>*",(std::map>*)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.TMXLayer:getAnimTileCoord",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_TMXLayer_getAnimTileCoord'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_TMXLayer_getPositionAt(lua_State* tolua_S) { int argc = 0; @@ -101019,6 +101460,53 @@ int lua_cocos2dx_TMXLayer_releaseMap(lua_State* tolua_S) return 0; } +int lua_cocos2dx_TMXLayer_hasTileAnimation(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::TMXLayer* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.TMXLayer",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::TMXLayer*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_TMXLayer_hasTileAnimation'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_TMXLayer_hasTileAnimation'", nullptr); + return 0; + } + bool ret = cobj->hasTileAnimation(); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.TMXLayer:hasTileAnimation",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_TMXLayer_hasTileAnimation'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_TMXLayer_getLayerSize(lua_State* tolua_S) { int argc = 0; @@ -101871,6 +102359,53 @@ int lua_cocos2dx_TMXLayer_getTileAt(lua_State* tolua_S) return 0; } +int lua_cocos2dx_TMXLayer_getTileAnimManager(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::TMXLayer* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.TMXLayer",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::TMXLayer*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_TMXLayer_getTileAnimManager'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_TMXLayer_getTileAnimManager'", nullptr); + return 0; + } + cocos2d::TMXTileAnimManager* ret = cobj->getTileAnimManager(); + object_to_luaval(tolua_S, "cc.TMXTileAnimManager",(cocos2d::TMXTileAnimManager*)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.TMXLayer:getTileAnimManager",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_TMXLayer_getTileAnimManager'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_TMXLayer_create(lua_State* tolua_S) { int argc = 0; @@ -101961,9 +102496,11 @@ int lua_register_cocos2dx_TMXLayer(lua_State* tolua_S) tolua_beginmodule(tolua_S,"TMXLayer"); tolua_function(tolua_S,"new",lua_cocos2dx_TMXLayer_constructor); + tolua_function(tolua_S,"getAnimTileCoord",lua_cocos2dx_TMXLayer_getAnimTileCoord); tolua_function(tolua_S,"getPositionAt",lua_cocos2dx_TMXLayer_getPositionAt); tolua_function(tolua_S,"setLayerOrientation",lua_cocos2dx_TMXLayer_setLayerOrientation); tolua_function(tolua_S,"releaseMap",lua_cocos2dx_TMXLayer_releaseMap); + tolua_function(tolua_S,"hasTileAnimation",lua_cocos2dx_TMXLayer_hasTileAnimation); tolua_function(tolua_S,"getLayerSize",lua_cocos2dx_TMXLayer_getLayerSize); tolua_function(tolua_S,"setMapTileSize",lua_cocos2dx_TMXLayer_setMapTileSize); tolua_function(tolua_S,"getLayerOrientation",lua_cocos2dx_TMXLayer_getLayerOrientation); @@ -101981,6 +102518,7 @@ int lua_register_cocos2dx_TMXLayer(lua_State* tolua_S) tolua_function(tolua_S,"getTileSet",lua_cocos2dx_TMXLayer_getTileSet); tolua_function(tolua_S,"getProperties",lua_cocos2dx_TMXLayer_getProperties); tolua_function(tolua_S,"getTileAt",lua_cocos2dx_TMXLayer_getTileAt); + tolua_function(tolua_S,"getTileAnimManager",lua_cocos2dx_TMXLayer_getTileAnimManager); tolua_function(tolua_S,"create", lua_cocos2dx_TMXLayer_create); tolua_endmodule(tolua_S); std::string typeName = typeid(cocos2d::TMXLayer).name(); @@ -101989,6 +102527,500 @@ int lua_register_cocos2dx_TMXLayer(lua_State* tolua_S) return 1; } +int lua_cocos2dx_TMXTileAnimTask_start(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::TMXTileAnimTask* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.TMXTileAnimTask",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::TMXTileAnimTask*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_TMXTileAnimTask_start'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_TMXTileAnimTask_start'", nullptr); + return 0; + } + cobj->start(); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.TMXTileAnimTask:start",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_TMXTileAnimTask_start'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_TMXTileAnimTask_stop(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::TMXTileAnimTask* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.TMXTileAnimTask",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::TMXTileAnimTask*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_TMXTileAnimTask_stop'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_TMXTileAnimTask_stop'", nullptr); + return 0; + } + cobj->stop(); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.TMXTileAnimTask:stop",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_TMXTileAnimTask_stop'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_TMXTileAnimTask_isRunning(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::TMXTileAnimTask* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.TMXTileAnimTask",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::TMXTileAnimTask*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_TMXTileAnimTask_isRunning'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_TMXTileAnimTask_isRunning'", nullptr); + return 0; + } + bool ret = cobj->isRunning(); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.TMXTileAnimTask:isRunning",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_TMXTileAnimTask_isRunning'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_TMXTileAnimTask_create(lua_State* tolua_S) +{ + int argc = 0; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertable(tolua_S,1,"cc.TMXTileAnimTask",0,&tolua_err)) goto tolua_lerror; +#endif + + argc = lua_gettop(tolua_S) - 1; + + if (argc == 3) + { + cocos2d::TMXLayer* arg0; + cocos2d::TMXTileAnimInfo* arg1; + cocos2d::Vec2 arg2; + ok &= luaval_to_object(tolua_S, 2, "cc.TMXLayer",&arg0, "cc.TMXTileAnimTask:create"); + #pragma warning NO CONVERSION TO NATIVE FOR TMXTileAnimInfo* + ok = false; + ok &= luaval_to_vec2(tolua_S, 4, &arg2, "cc.TMXTileAnimTask:create"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_TMXTileAnimTask_create'", nullptr); + return 0; + } + cocos2d::TMXTileAnimTask* ret = cocos2d::TMXTileAnimTask::create(arg0, arg1, arg2); + object_to_luaval(tolua_S, "cc.TMXTileAnimTask",(cocos2d::TMXTileAnimTask*)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d\n ", "cc.TMXTileAnimTask:create",argc, 3); + return 0; +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_TMXTileAnimTask_create'.",&tolua_err); +#endif + return 0; +} +int lua_cocos2dx_TMXTileAnimTask_constructor(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::TMXTileAnimTask* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + + + argc = lua_gettop(tolua_S)-1; + if (argc == 3) + { + cocos2d::TMXLayer* arg0; + cocos2d::TMXTileAnimInfo* arg1; + cocos2d::Vec2 arg2; + + ok &= luaval_to_object(tolua_S, 2, "cc.TMXLayer",&arg0, "cc.TMXTileAnimTask:TMXTileAnimTask"); + + #pragma warning NO CONVERSION TO NATIVE FOR TMXTileAnimInfo* + ok = false; + + ok &= luaval_to_vec2(tolua_S, 4, &arg2, "cc.TMXTileAnimTask:TMXTileAnimTask"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_TMXTileAnimTask_constructor'", nullptr); + return 0; + } + cobj = new cocos2d::TMXTileAnimTask(arg0, arg1, arg2); + cobj->autorelease(); + int ID = (int)cobj->_ID ; + int* luaID = &cobj->_luaID ; + toluafix_pushusertype_ccobject(tolua_S, ID, luaID, (void*)cobj,"cc.TMXTileAnimTask"); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.TMXTileAnimTask:TMXTileAnimTask",argc, 3); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_TMXTileAnimTask_constructor'.",&tolua_err); +#endif + + return 0; +} + +static int lua_cocos2dx_TMXTileAnimTask_finalize(lua_State* tolua_S) +{ + printf("luabindings: finalizing LUA object (TMXTileAnimTask)"); + return 0; +} + +int lua_register_cocos2dx_TMXTileAnimTask(lua_State* tolua_S) +{ + tolua_usertype(tolua_S,"cc.TMXTileAnimTask"); + tolua_cclass(tolua_S,"TMXTileAnimTask","cc.TMXTileAnimTask","cc.Ref",nullptr); + + tolua_beginmodule(tolua_S,"TMXTileAnimTask"); + tolua_function(tolua_S,"new",lua_cocos2dx_TMXTileAnimTask_constructor); + tolua_function(tolua_S,"start",lua_cocos2dx_TMXTileAnimTask_start); + tolua_function(tolua_S,"stop",lua_cocos2dx_TMXTileAnimTask_stop); + tolua_function(tolua_S,"isRunning",lua_cocos2dx_TMXTileAnimTask_isRunning); + tolua_function(tolua_S,"create", lua_cocos2dx_TMXTileAnimTask_create); + tolua_endmodule(tolua_S); + std::string typeName = typeid(cocos2d::TMXTileAnimTask).name(); + g_luaType[typeName] = "cc.TMXTileAnimTask"; + g_typeCast["TMXTileAnimTask"] = "cc.TMXTileAnimTask"; + return 1; +} + +int lua_cocos2dx_TMXTileAnimManager_getTasks(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::TMXTileAnimManager* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.TMXTileAnimManager",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::TMXTileAnimManager*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_TMXTileAnimManager_getTasks'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_TMXTileAnimManager_getTasks'", nullptr); + return 0; + } + const cocos2d::Vector& ret = cobj->getTasks(); + ccvector_to_luaval(tolua_S, ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.TMXTileAnimManager:getTasks",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_TMXTileAnimManager_getTasks'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_TMXTileAnimManager_startAll(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::TMXTileAnimManager* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.TMXTileAnimManager",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::TMXTileAnimManager*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_TMXTileAnimManager_startAll'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_TMXTileAnimManager_startAll'", nullptr); + return 0; + } + cobj->startAll(); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.TMXTileAnimManager:startAll",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_TMXTileAnimManager_startAll'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_TMXTileAnimManager_stopAll(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::TMXTileAnimManager* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.TMXTileAnimManager",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::TMXTileAnimManager*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_TMXTileAnimManager_stopAll'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_TMXTileAnimManager_stopAll'", nullptr); + return 0; + } + cobj->stopAll(); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.TMXTileAnimManager:stopAll",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_TMXTileAnimManager_stopAll'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_TMXTileAnimManager_create(lua_State* tolua_S) +{ + int argc = 0; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertable(tolua_S,1,"cc.TMXTileAnimManager",0,&tolua_err)) goto tolua_lerror; +#endif + + argc = lua_gettop(tolua_S) - 1; + + if (argc == 1) + { + cocos2d::TMXLayer* arg0; + ok &= luaval_to_object(tolua_S, 2, "cc.TMXLayer",&arg0, "cc.TMXTileAnimManager:create"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_TMXTileAnimManager_create'", nullptr); + return 0; + } + cocos2d::TMXTileAnimManager* ret = cocos2d::TMXTileAnimManager::create(arg0); + object_to_luaval(tolua_S, "cc.TMXTileAnimManager",(cocos2d::TMXTileAnimManager*)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d\n ", "cc.TMXTileAnimManager:create",argc, 1); + return 0; +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_TMXTileAnimManager_create'.",&tolua_err); +#endif + return 0; +} +int lua_cocos2dx_TMXTileAnimManager_constructor(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::TMXTileAnimManager* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + cocos2d::TMXLayer* arg0; + + ok &= luaval_to_object(tolua_S, 2, "cc.TMXLayer",&arg0, "cc.TMXTileAnimManager:TMXTileAnimManager"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_TMXTileAnimManager_constructor'", nullptr); + return 0; + } + cobj = new cocos2d::TMXTileAnimManager(arg0); + cobj->autorelease(); + int ID = (int)cobj->_ID ; + int* luaID = &cobj->_luaID ; + toluafix_pushusertype_ccobject(tolua_S, ID, luaID, (void*)cobj,"cc.TMXTileAnimManager"); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.TMXTileAnimManager:TMXTileAnimManager",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_TMXTileAnimManager_constructor'.",&tolua_err); +#endif + + return 0; +} + +static int lua_cocos2dx_TMXTileAnimManager_finalize(lua_State* tolua_S) +{ + printf("luabindings: finalizing LUA object (TMXTileAnimManager)"); + return 0; +} + +int lua_register_cocos2dx_TMXTileAnimManager(lua_State* tolua_S) +{ + tolua_usertype(tolua_S,"cc.TMXTileAnimManager"); + tolua_cclass(tolua_S,"TMXTileAnimManager","cc.TMXTileAnimManager","cc.Ref",nullptr); + + tolua_beginmodule(tolua_S,"TMXTileAnimManager"); + tolua_function(tolua_S,"new",lua_cocos2dx_TMXTileAnimManager_constructor); + tolua_function(tolua_S,"getTasks",lua_cocos2dx_TMXTileAnimManager_getTasks); + tolua_function(tolua_S,"startAll",lua_cocos2dx_TMXTileAnimManager_startAll); + tolua_function(tolua_S,"stopAll",lua_cocos2dx_TMXTileAnimManager_stopAll); + tolua_function(tolua_S,"create", lua_cocos2dx_TMXTileAnimManager_create); + tolua_endmodule(tolua_S); + std::string typeName = typeid(cocos2d::TMXTileAnimManager).name(); + g_luaType[typeName] = "cc.TMXTileAnimManager"; + g_typeCast["TMXTileAnimManager"] = "cc.TMXTileAnimManager"; + return 1; +} + int lua_cocos2dx_TMXTiledMap_setObjectGroups(lua_State* tolua_S) { int argc = 0; @@ -102474,6 +103506,56 @@ int lua_cocos2dx_TMXTiledMap_getMapSize(lua_State* tolua_S) return 0; } +int lua_cocos2dx_TMXTiledMap_setTileAnimEnabled(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::TMXTiledMap* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.TMXTiledMap",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::TMXTiledMap*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_TMXTiledMap_setTileAnimEnabled'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + bool arg0; + + ok &= luaval_to_boolean(tolua_S, 2,&arg0, "cc.TMXTiledMap:setTileAnimEnabled"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_TMXTiledMap_setTileAnimEnabled'", nullptr); + return 0; + } + cobj->setTileAnimEnabled(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.TMXTiledMap:setTileAnimEnabled",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_TMXTiledMap_setTileAnimEnabled'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_TMXTiledMap_initWithXML(lua_State* tolua_S) { int argc = 0; @@ -102955,6 +104037,7 @@ int lua_register_cocos2dx_TMXTiledMap(lua_State* tolua_S) tolua_function(tolua_S,"initWithTMXFile",lua_cocos2dx_TMXTiledMap_initWithTMXFile); tolua_function(tolua_S,"getTileSize",lua_cocos2dx_TMXTiledMap_getTileSize); tolua_function(tolua_S,"getMapSize",lua_cocos2dx_TMXTiledMap_getMapSize); + tolua_function(tolua_S,"setTileAnimEnabled",lua_cocos2dx_TMXTiledMap_setTileAnimEnabled); tolua_function(tolua_S,"initWithXML",lua_cocos2dx_TMXTiledMap_initWithXML); tolua_function(tolua_S,"getProperties",lua_cocos2dx_TMXTiledMap_getProperties); tolua_function(tolua_S,"setTileSize",lua_cocos2dx_TMXTiledMap_setTileSize); @@ -104411,6 +105494,7 @@ TOLUA_API int register_all_cocos2dx(lua_State* tolua_S) lua_register_cocos2dx_EventAcceleration(tolua_S); lua_register_cocos2dx_EaseCubicActionIn(tolua_S); lua_register_cocos2dx_TextureCache(tolua_S); + lua_register_cocos2dx_TMXTileAnimManager(tolua_S); lua_register_cocos2dx_ActionTween(tolua_S); lua_register_cocos2dx_TransitionFadeDown(tolua_S); lua_register_cocos2dx_ParticleSun(tolua_S); @@ -104531,6 +105615,7 @@ TOLUA_API int register_all_cocos2dx(lua_State* tolua_S) lua_register_cocos2dx_EventCustom(tolua_S); lua_register_cocos2dx_ParticleBatchNode(tolua_S); lua_register_cocos2dx_Component(tolua_S); + lua_register_cocos2dx_TMXTileAnimTask(tolua_S); lua_register_cocos2dx_EaseCubicActionOut(tolua_S); lua_register_cocos2dx_EventListenerTouchOneByOne(tolua_S); lua_register_cocos2dx_ParticleRain(tolua_S); diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp index e0fe55df478b..7bbebad28f13 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_auto.hpp @@ -2275,6 +2275,27 @@ int register_all_cocos2dx(lua_State* tolua_S); + + + + + + + + + + + + + + + + + + + + + diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_experimental_video_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_experimental_video_auto.cpp index 6529911d2b8b..57860b50561f 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_experimental_video_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_experimental_video_auto.cpp @@ -145,6 +145,53 @@ int lua_cocos2dx_experimental_video_VideoPlayer_play(lua_State* tolua_S) return 0; } +int lua_cocos2dx_experimental_video_VideoPlayer_isUserInputEnabled(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::experimental::ui::VideoPlayer* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccexp.VideoPlayer",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::experimental::ui::VideoPlayer*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_video_VideoPlayer_isUserInputEnabled'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_experimental_video_VideoPlayer_isUserInputEnabled'", nullptr); + return 0; + } + bool ret = cobj->isUserInputEnabled(); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccexp.VideoPlayer:isUserInputEnabled",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_video_VideoPlayer_isUserInputEnabled'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_experimental_video_VideoPlayer_setKeepAspectRatioEnabled(lua_State* tolua_S) { int argc = 0; @@ -392,6 +439,106 @@ int lua_cocos2dx_experimental_video_VideoPlayer_setURL(lua_State* tolua_S) return 0; } +int lua_cocos2dx_experimental_video_VideoPlayer_setStyle(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::experimental::ui::VideoPlayer* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccexp.VideoPlayer",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::experimental::ui::VideoPlayer*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_video_VideoPlayer_setStyle'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + cocos2d::experimental::ui::VideoPlayer::StyleType arg0; + + ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccexp.VideoPlayer:setStyle"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_experimental_video_VideoPlayer_setStyle'", nullptr); + return 0; + } + cobj->setStyle(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccexp.VideoPlayer:setStyle",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_video_VideoPlayer_setStyle'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_experimental_video_VideoPlayer_seekTo(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::experimental::ui::VideoPlayer* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccexp.VideoPlayer",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::experimental::ui::VideoPlayer*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_video_VideoPlayer_seekTo'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + double arg0; + + ok &= luaval_to_number(tolua_S, 2,&arg0, "ccexp.VideoPlayer:seekTo"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_experimental_video_VideoPlayer_seekTo'", nullptr); + return 0; + } + cobj->seekTo(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccexp.VideoPlayer:seekTo",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_video_VideoPlayer_seekTo'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_experimental_video_VideoPlayer_isKeepAspectRatioEnabled(lua_State* tolua_S) { int argc = 0; @@ -536,6 +683,53 @@ int lua_cocos2dx_experimental_video_VideoPlayer_isFullScreenEnabled(lua_State* t return 0; } +int lua_cocos2dx_experimental_video_VideoPlayer_isLooping(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::experimental::ui::VideoPlayer* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccexp.VideoPlayer",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::experimental::ui::VideoPlayer*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_video_VideoPlayer_isLooping'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_experimental_video_VideoPlayer_isLooping'", nullptr); + return 0; + } + bool ret = cobj->isLooping(); + tolua_pushboolean(tolua_S,(bool)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccexp.VideoPlayer:isLooping",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_video_VideoPlayer_isLooping'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_experimental_video_VideoPlayer_isPlaying(lua_State* tolua_S) { int argc = 0; @@ -583,7 +777,7 @@ int lua_cocos2dx_experimental_video_VideoPlayer_isPlaying(lua_State* tolua_S) return 0; } -int lua_cocos2dx_experimental_video_VideoPlayer_seekTo(lua_State* tolua_S) +int lua_cocos2dx_experimental_video_VideoPlayer_setLooping(lua_State* tolua_S) { int argc = 0; cocos2d::experimental::ui::VideoPlayer* cobj = nullptr; @@ -603,7 +797,7 @@ int lua_cocos2dx_experimental_video_VideoPlayer_seekTo(lua_State* tolua_S) #if COCOS2D_DEBUG >= 1 if (!cobj) { - tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_video_VideoPlayer_seekTo'", nullptr); + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_video_VideoPlayer_setLooping'", nullptr); return 0; } #endif @@ -611,24 +805,74 @@ int lua_cocos2dx_experimental_video_VideoPlayer_seekTo(lua_State* tolua_S) argc = lua_gettop(tolua_S)-1; if (argc == 1) { - double arg0; + bool arg0; - ok &= luaval_to_number(tolua_S, 2,&arg0, "ccexp.VideoPlayer:seekTo"); + ok &= luaval_to_boolean(tolua_S, 2,&arg0, "ccexp.VideoPlayer:setLooping"); if(!ok) { - tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_experimental_video_VideoPlayer_seekTo'", nullptr); + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_experimental_video_VideoPlayer_setLooping'", nullptr); return 0; } - cobj->seekTo(arg0); + cobj->setLooping(arg0); lua_settop(tolua_S, 1); return 1; } - luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccexp.VideoPlayer:seekTo",argc, 1); + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccexp.VideoPlayer:setLooping",argc, 1); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_video_VideoPlayer_seekTo'.",&tolua_err); + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_video_VideoPlayer_setLooping'.",&tolua_err); +#endif + + return 0; +} +int lua_cocos2dx_experimental_video_VideoPlayer_setUserInputEnabled(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::experimental::ui::VideoPlayer* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccexp.VideoPlayer",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::experimental::ui::VideoPlayer*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_experimental_video_VideoPlayer_setUserInputEnabled'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + bool arg0; + + ok &= luaval_to_boolean(tolua_S, 2,&arg0, "ccexp.VideoPlayer:setUserInputEnabled"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_experimental_video_VideoPlayer_setUserInputEnabled'", nullptr); + return 0; + } + cobj->setUserInputEnabled(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccexp.VideoPlayer:setUserInputEnabled",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_experimental_video_VideoPlayer_setUserInputEnabled'.",&tolua_err); #endif return 0; @@ -720,16 +964,21 @@ int lua_register_cocos2dx_experimental_video_VideoPlayer(lua_State* tolua_S) tolua_function(tolua_S,"getFileName",lua_cocos2dx_experimental_video_VideoPlayer_getFileName); tolua_function(tolua_S,"getURL",lua_cocos2dx_experimental_video_VideoPlayer_getURL); tolua_function(tolua_S,"play",lua_cocos2dx_experimental_video_VideoPlayer_play); + tolua_function(tolua_S,"isUserInputEnabled",lua_cocos2dx_experimental_video_VideoPlayer_isUserInputEnabled); tolua_function(tolua_S,"setKeepAspectRatioEnabled",lua_cocos2dx_experimental_video_VideoPlayer_setKeepAspectRatioEnabled); tolua_function(tolua_S,"stop",lua_cocos2dx_experimental_video_VideoPlayer_stop); tolua_function(tolua_S,"setFullScreenEnabled",lua_cocos2dx_experimental_video_VideoPlayer_setFullScreenEnabled); tolua_function(tolua_S,"setFileName",lua_cocos2dx_experimental_video_VideoPlayer_setFileName); tolua_function(tolua_S,"setURL",lua_cocos2dx_experimental_video_VideoPlayer_setURL); + tolua_function(tolua_S,"setStyle",lua_cocos2dx_experimental_video_VideoPlayer_setStyle); + tolua_function(tolua_S,"seekTo",lua_cocos2dx_experimental_video_VideoPlayer_seekTo); tolua_function(tolua_S,"isKeepAspectRatioEnabled",lua_cocos2dx_experimental_video_VideoPlayer_isKeepAspectRatioEnabled); tolua_function(tolua_S,"onPlayEvent",lua_cocos2dx_experimental_video_VideoPlayer_onPlayEvent); tolua_function(tolua_S,"isFullScreenEnabled",lua_cocos2dx_experimental_video_VideoPlayer_isFullScreenEnabled); + tolua_function(tolua_S,"isLooping",lua_cocos2dx_experimental_video_VideoPlayer_isLooping); tolua_function(tolua_S,"isPlaying",lua_cocos2dx_experimental_video_VideoPlayer_isPlaying); - tolua_function(tolua_S,"seekTo",lua_cocos2dx_experimental_video_VideoPlayer_seekTo); + tolua_function(tolua_S,"setLooping",lua_cocos2dx_experimental_video_VideoPlayer_setLooping); + tolua_function(tolua_S,"setUserInputEnabled",lua_cocos2dx_experimental_video_VideoPlayer_setUserInputEnabled); tolua_function(tolua_S,"create", lua_cocos2dx_experimental_video_VideoPlayer_create); tolua_endmodule(tolua_S); std::string typeName = typeid(cocos2d::experimental::ui::VideoPlayer).name(); diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_experimental_video_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_experimental_video_auto.hpp index 0892c03b49ae..eb3ac2043d8a 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_experimental_video_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_experimental_video_auto.hpp @@ -27,6 +27,11 @@ int register_all_cocos2dx_experimental_video(lua_State* tolua_S); + + + + + #endif // __cocos2dx_experimental_video_h__ diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.cpp index 179d213e9985..5595e7e0a339 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.cpp @@ -12642,6 +12642,56 @@ int lua_cocos2dx_physics_PhysicsWorld_getShape(lua_State* tolua_S) return 0; } +int lua_cocos2dx_physics_PhysicsWorld_setDebugDrawGlobalZOrder(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::PhysicsWorld* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.PhysicsWorld",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::PhysicsWorld*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_physics_PhysicsWorld_setDebugDrawGlobalZOrder'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + double arg0; + + ok &= luaval_to_number(tolua_S, 2,&arg0, "cc.PhysicsWorld:setDebugDrawGlobalZOrder"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_physics_PhysicsWorld_setDebugDrawGlobalZOrder'", nullptr); + return 0; + } + cobj->setDebugDrawGlobalZOrder(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.PhysicsWorld:setDebugDrawGlobalZOrder",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_physics_PhysicsWorld_setDebugDrawGlobalZOrder'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_physics_PhysicsWorld_getBody(lua_State* tolua_S) { int argc = 0; @@ -12729,6 +12779,7 @@ int lua_register_cocos2dx_physics_PhysicsWorld(lua_State* tolua_S) tolua_function(tolua_S,"removeAllBodies",lua_cocos2dx_physics_PhysicsWorld_removeAllBodies); tolua_function(tolua_S,"setSpeed",lua_cocos2dx_physics_PhysicsWorld_setSpeed); tolua_function(tolua_S,"getShape",lua_cocos2dx_physics_PhysicsWorld_getShape); + tolua_function(tolua_S,"setDebugDrawGlobalZOrder",lua_cocos2dx_physics_PhysicsWorld_setDebugDrawGlobalZOrder); tolua_function(tolua_S,"getBody",lua_cocos2dx_physics_PhysicsWorld_getBody); tolua_endmodule(tolua_S); std::string typeName = typeid(cocos2d::PhysicsWorld).name(); diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.hpp index b69e71c60b52..ba68c24f96ee 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_physics_auto.hpp @@ -280,6 +280,7 @@ int register_all_cocos2dx_physics(lua_State* tolua_S); + #endif // __cocos2dx_physics_h__ diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp index 97e1137c79d6..63014509af99 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp @@ -20931,6 +20931,53 @@ int lua_cocos2dx_ui_Slider_getCapInsetsBarRenderer(lua_State* tolua_S) return 0; } +int lua_cocos2dx_ui_Slider_updateVisualSlider(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::Slider* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.Slider",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::Slider*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_Slider_updateVisualSlider'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_Slider_updateVisualSlider'", nullptr); + return 0; + } + cobj->updateVisualSlider(); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.Slider:updateVisualSlider",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_Slider_updateVisualSlider'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_Slider_getCapInsetsProgressBarRenderer(lua_State* tolua_S) { int argc = 0; @@ -21712,6 +21759,7 @@ int lua_register_cocos2dx_ui_Slider(lua_State* tolua_S) tolua_function(tolua_S,"loadBarTexture",lua_cocos2dx_ui_Slider_loadBarTexture); tolua_function(tolua_S,"getProgressBarFile",lua_cocos2dx_ui_Slider_getProgressBarFile); tolua_function(tolua_S,"getCapInsetsBarRenderer",lua_cocos2dx_ui_Slider_getCapInsetsBarRenderer); + tolua_function(tolua_S,"updateVisualSlider",lua_cocos2dx_ui_Slider_updateVisualSlider); tolua_function(tolua_S,"getCapInsetsProgressBarRenderer",lua_cocos2dx_ui_Slider_getCapInsetsProgressBarRenderer); tolua_function(tolua_S,"getSlidBallPressedRenderer",lua_cocos2dx_ui_Slider_getSlidBallPressedRenderer); tolua_function(tolua_S,"loadSlidBallTexturePressed",lua_cocos2dx_ui_Slider_loadSlidBallTexturePressed); diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.hpp index 10228fbb759b..0a0f20bde6e2 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.hpp @@ -807,6 +807,7 @@ int register_all_cocos2dx_ui(lua_State* tolua_S); + #endif // __cocos2dx_ui_h__ diff --git a/cocos/scripting/lua-bindings/manual/CCLuaBridge.cpp b/cocos/scripting/lua-bindings/manual/CCLuaBridge.cpp index d1afcbd63abb..feca8244e90c 100644 --- a/cocos/scripting/lua-bindings/manual/CCLuaBridge.cpp +++ b/cocos/scripting/lua-bindings/manual/CCLuaBridge.cpp @@ -30,7 +30,7 @@ NS_CC_BEGIN lua_State *LuaBridge::s_luaState = NULL; int LuaBridge::s_newFunctionId = 0; -LuaStack *LuaBridge::getStack(void) +LuaStack *LuaBridge::getStack() { return LuaEngine::getInstance()->getLuaStack(); } diff --git a/cocos/scripting/lua-bindings/manual/CCLuaBridge.h b/cocos/scripting/lua-bindings/manual/CCLuaBridge.h index 54a352ad1f3b..cb9a5015fa60 100644 --- a/cocos/scripting/lua-bindings/manual/CCLuaBridge.h +++ b/cocos/scripting/lua-bindings/manual/CCLuaBridge.h @@ -70,7 +70,7 @@ class LuaBridge * * @return the LuaStack object. */ - static LuaStack *getStack(void); + static LuaStack *getStack(); /** * Push the function pointer corresponding to functionId on the top of lua stack by searching the `lua_bridge_function_id` table. * If it don't find the function pointer corresponding to functionId, it will reset stack top index to the index before searching. diff --git a/cocos/scripting/lua-bindings/manual/CCLuaEngine.cpp b/cocos/scripting/lua-bindings/manual/CCLuaEngine.cpp index 4e6df93a4ba0..58a0e2065c12 100644 --- a/cocos/scripting/lua-bindings/manual/CCLuaEngine.cpp +++ b/cocos/scripting/lua-bindings/manual/CCLuaEngine.cpp @@ -37,13 +37,11 @@ #include "base/CCDirector.h" #include "base/CCEventCustom.h" -#pragma comment(lib,"lua51.lib") - NS_CC_BEGIN LuaEngine* LuaEngine::_defaultEngine = nullptr; -LuaEngine* LuaEngine::getInstance(void) +LuaEngine* LuaEngine::getInstance() { if (!_defaultEngine) { @@ -53,13 +51,13 @@ LuaEngine* LuaEngine::getInstance(void) return _defaultEngine; } -LuaEngine::~LuaEngine(void) +LuaEngine::~LuaEngine() { CC_SAFE_RELEASE(_stack); _defaultEngine = nullptr; } -bool LuaEngine::init(void) +bool LuaEngine::init() { _stack = LuaStack::create(); _stack->retain(); @@ -511,7 +509,7 @@ int LuaEngine::handleTouchesEvent(void* data) return 0; TouchesScriptData* touchesScriptData = static_cast(data); - if (NULL == touchesScriptData->nativeObject || touchesScriptData->touches.size() == 0) + if (NULL == touchesScriptData->nativeObject || touchesScriptData->touches.empty()) return 0; int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)touchesScriptData->nativeObject, ScriptHandlerMgr::HandlerType::TOUCHES); @@ -687,7 +685,7 @@ int LuaEngine::handleEventTouches(ScriptHandlerMgr::HandlerType type,void* data) return 0; LuaEventTouchesData * touchesData = static_cast(basicScriptData->value); - if (nullptr == touchesData->event || touchesData->touches.size() == 0) + if (nullptr == touchesData->event || touchesData->touches.empty()) return 0; int handler = ScriptHandlerMgr::getInstance()->getObjectHandler((void*)basicScriptData->nativeObject, type); diff --git a/cocos/scripting/lua-bindings/manual/CCLuaEngine.h b/cocos/scripting/lua-bindings/manual/CCLuaEngine.h index 6580e16d8052..8e6f899316a2 100644 --- a/cocos/scripting/lua-bindings/manual/CCLuaEngine.h +++ b/cocos/scripting/lua-bindings/manual/CCLuaEngine.h @@ -60,18 +60,18 @@ class CC_LUA_DLL LuaEngine : public ScriptEngineProtocol * * @return the instance of LuaEngine. */ - static LuaEngine* getInstance(void); + static LuaEngine* getInstance(); /** * Get defaultEngine of LuaEngine, it was deprecated. * * @return the instance of LuaEngine. */ - CC_DEPRECATED_ATTRIBUTE static LuaEngine* defaultEngine(void) { return LuaEngine::getInstance(); } + CC_DEPRECATED_ATTRIBUTE static LuaEngine* defaultEngine() { return LuaEngine::getInstance(); } /** * Destructor of LuaEngine. */ - virtual ~LuaEngine(void); + virtual ~LuaEngine(); /** * Get ccScriptType of LuaEngine used, it is always kScriptTypeLua. @@ -88,7 +88,7 @@ class CC_LUA_DLL LuaEngine : public ScriptEngineProtocol * * @return LuaStack object. */ - LuaStack *getLuaStack(void) { + LuaStack *getLuaStack() { return _stack; } @@ -217,11 +217,11 @@ class CC_LUA_DLL LuaEngine : public ScriptEngineProtocol */ virtual int handleEvent(ScriptHandlerMgr::HandlerType type, void* data, int numResults, const std::function& func); private: - LuaEngine(void) + LuaEngine() : _stack(nullptr) { } - bool init(void); + bool init(); int handleNodeEvent(void* data); int handleMenuClickedEvent(void* data); int handleCallFuncActionEvent(void* data); diff --git a/cocos/scripting/lua-bindings/manual/CCLuaStack.cpp b/cocos/scripting/lua-bindings/manual/CCLuaStack.cpp index 72768d22001f..38d4b0883cf6 100644 --- a/cocos/scripting/lua-bindings/manual/CCLuaStack.cpp +++ b/cocos/scripting/lua-bindings/manual/CCLuaStack.cpp @@ -113,7 +113,7 @@ LuaStack::~LuaStack() } } -LuaStack *LuaStack::create(void) +LuaStack *LuaStack::create() { LuaStack *stack = new (std::nothrow) LuaStack(); stack->init(); @@ -129,14 +129,14 @@ LuaStack *LuaStack::attach(lua_State *L) return stack; } -bool LuaStack::init(void) +bool LuaStack::init() { _state = lua_open(); luaL_openlibs(_state); toluafix_open(_state); // Register our version of the global "print" function - const luaL_reg global_functions [] = { + const luaL_Reg global_functions [] = { {"print", lua_print}, {"release_print",lua_release_print}, {nullptr, nullptr} @@ -304,7 +304,7 @@ int LuaStack::executeGlobalFunction(const char* functionName) return executeFunction(0); } -void LuaStack::clean(void) +void LuaStack::clean() { lua_settop(_state, 0); } @@ -339,7 +339,7 @@ void LuaStack::pushString(const char* stringValue, int length) lua_pushlstring(_state, stringValue, length); } -void LuaStack::pushNil(void) +void LuaStack::pushNil() { lua_pushnil(_state); } @@ -801,7 +801,7 @@ int LuaStack::luaLoadChunksFromZIP(lua_State *L) std::string filename = zip->getFirstFilename(); while (filename.length()) { ssize_t bufferSize = 0; - unsigned char *zbuffer = zip->getFileData(filename.c_str(), &bufferSize); + unsigned char *zbuffer = zip->getFileData(filename, &bufferSize); if (bufferSize) { // remove .lua or .luac extension size_t pos = filename.find_last_of('.'); diff --git a/cocos/scripting/lua-bindings/manual/CCLuaStack.h b/cocos/scripting/lua-bindings/manual/CCLuaStack.h index d4e62391a50c..d73e81747596 100644 --- a/cocos/scripting/lua-bindings/manual/CCLuaStack.h +++ b/cocos/scripting/lua-bindings/manual/CCLuaStack.h @@ -55,7 +55,7 @@ class LuaStack : public Ref /** * Create a LuaStack object, it will new a lua_State. */ - static LuaStack *create(void); + static LuaStack *create(); /** * Create a LuaStack object with the existed lua_State. */ @@ -69,7 +69,7 @@ class LuaStack : public Ref * * @return A pointer to the lua_State that the script module is attached to. */ - lua_State* getLuaState(void) { + lua_State* getLuaState() { return _state; } @@ -149,7 +149,7 @@ class LuaStack : public Ref /** * Set the stack top index 0. */ - virtual void clean(void); + virtual void clean(); /** * Pushes a integer number with value intValue onto the stack. @@ -197,7 +197,7 @@ class LuaStack : public Ref /** * Pushes a nil value onto the stack. */ - virtual void pushNil(void); + virtual void pushNil(); /** * Pushes a Ref object onto the stack. @@ -339,7 +339,7 @@ class LuaStack : public Ref int luaLoadChunksFromZIP(lua_State *L); protected: - LuaStack(void) + LuaStack() : _state(nullptr) , _callFromLua(0) , _xxteaEnabled(false) @@ -350,7 +350,7 @@ class LuaStack : public Ref { } - bool init(void); + bool init(); bool initWithLuaState(lua_State *L); lua_State *_state; diff --git a/cocos/scripting/lua-bindings/manual/CCLuaValue.cpp b/cocos/scripting/lua-bindings/manual/CCLuaValue.cpp index a7f4b796a0ca..95550c63ad94 100644 --- a/cocos/scripting/lua-bindings/manual/CCLuaValue.cpp +++ b/cocos/scripting/lua-bindings/manual/CCLuaValue.cpp @@ -111,7 +111,7 @@ LuaValue& LuaValue::operator=(const LuaValue& rhs) return *this; } -LuaValue::~LuaValue(void) +LuaValue::~LuaValue() { if (_type == LuaValueTypeString) { diff --git a/cocos/scripting/lua-bindings/manual/CCLuaValue.h b/cocos/scripting/lua-bindings/manual/CCLuaValue.h index fd05bdbadc3c..8ae951cc52d1 100644 --- a/cocos/scripting/lua-bindings/manual/CCLuaValue.h +++ b/cocos/scripting/lua-bindings/manual/CCLuaValue.h @@ -175,7 +175,7 @@ class LuaValue * Default constructor of LuaValue. * Set the default value for _type(LuaValueTypeInt) and _ccobjectType(nullptr),and init the _field. */ - LuaValue(void) + LuaValue() : _type(LuaValueTypeInt) , _ccobjectType(nullptr) { @@ -195,7 +195,7 @@ class LuaValue /** * Destructor. */ - ~LuaValue(void); + ~LuaValue(); /** * Get the type of LuaValue object. @@ -211,7 +211,7 @@ class LuaValue * * @return the reference of _ccobjectType. */ - const std::string& getObjectTypename(void) const { + const std::string& getObjectTypename() const { return *_ccobjectType; } @@ -220,7 +220,7 @@ class LuaValue * * @return the int value. */ - int intValue(void) const { + int intValue() const { return _field.intValue; } @@ -229,7 +229,7 @@ class LuaValue * * @return the float value. */ - float floatValue(void) const { + float floatValue() const { return _field.floatValue; } @@ -238,7 +238,7 @@ class LuaValue * * @return the boolean value. */ - bool booleanValue(void) const { + bool booleanValue() const { return _field.booleanValue; } @@ -247,7 +247,7 @@ class LuaValue * * @return the reference about string value. */ - const std::string& stringValue(void) const { + const std::string& stringValue() const { return *_field.stringValue; } @@ -256,7 +256,7 @@ class LuaValue * * @return the LuaValueDict value. */ - const LuaValueDict& dictValue(void) const { + const LuaValueDict& dictValue() const { return *_field.dictValue; } @@ -265,7 +265,7 @@ class LuaValue * * @return the LuaValueArray value. */ - const LuaValueArray& arrayValue(void) const { + const LuaValueArray& arrayValue() const { return *_field.arrayValue; } @@ -274,7 +274,7 @@ class LuaValue * * @return the pointer point to a Ref object. */ - Ref* ccobjectValue(void) const { + Ref* ccobjectValue() const { return _field.ccobjectValue; } diff --git a/cocos/scripting/lua-bindings/manual/Cocos2dxLuaLoader.cpp b/cocos/scripting/lua-bindings/manual/Cocos2dxLuaLoader.cpp index 0574a046091c..5e1a50de6af4 100644 --- a/cocos/scripting/lua-bindings/manual/Cocos2dxLuaLoader.cpp +++ b/cocos/scripting/lua-bindings/manual/Cocos2dxLuaLoader.cpp @@ -51,11 +51,11 @@ extern "C" filename = filename.substr(0, pos); } - pos = filename.find_first_of("."); + pos = filename.find_first_of('.'); while (pos != std::string::npos) { filename.replace(pos, 1, "/"); - pos = filename.find_first_of("."); + pos = filename.find_first_of('.'); } // search file in package.path @@ -68,7 +68,7 @@ extern "C" std::string searchpath(lua_tostring(L, -1)); lua_pop(L, 1); size_t begin = 0; - size_t next = searchpath.find_first_of(";", 0); + size_t next = searchpath.find_first_of(';', 0); do { @@ -89,14 +89,14 @@ extern "C" if (pos != std::string::npos && pos == prefix.length() - NOT_BYTECODE_FILE_EXT.length()) prefix = prefix.substr(0, pos); } - pos = prefix.find_first_of("?", 0); + pos = prefix.find_first_of('?', 0); while (pos != std::string::npos) { prefix.replace(pos, 1, filename); - pos = prefix.find_first_of("?", pos + filename.length() + 1); + pos = prefix.find_first_of('?', pos + filename.length() + 1); } chunkName = prefix + BYTECODE_FILE_EXT; - if (utils->isFileExist(chunkName) && !utils->isDirectoryExist(chunkName)) + if (utils->isFileExist(chunkName)) // && !utils->isDirectoryExist(chunkName)) { chunk = utils->getDataFromFile(chunkName); break; @@ -104,7 +104,7 @@ extern "C" else { chunkName = prefix + NOT_BYTECODE_FILE_EXT; - if (utils->isFileExist(chunkName) && !utils->isDirectoryExist(chunkName)) + if (utils->isFileExist(chunkName) ) //&& !utils->isDirectoryExist(chunkName)) { chunk = utils->getDataFromFile(chunkName); break; @@ -112,7 +112,7 @@ extern "C" else { chunkName = prefix; - if (utils->isFileExist(chunkName) && !utils->isDirectoryExist(chunkName)) + if (utils->isFileExist(chunkName)) // && !utils->isDirectoryExist(chunkName)) { chunk = utils->getDataFromFile(chunkName); break; @@ -121,7 +121,7 @@ extern "C" } begin = next + 1; - next = searchpath.find_first_of(";", begin); + next = searchpath.find_first_of(';', begin); } while (begin < searchpath.length()); if (chunk.getSize() > 0) { diff --git a/cocos/scripting/lua-bindings/manual/cocos2d/LuaOpengl.cpp b/cocos/scripting/lua-bindings/manual/cocos2d/LuaOpengl.cpp index 48bfb261ab46..edc0e14a089f 100644 --- a/cocos/scripting/lua-bindings/manual/cocos2d/LuaOpengl.cpp +++ b/cocos/scripting/lua-bindings/manual/cocos2d/LuaOpengl.cpp @@ -35,7 +35,7 @@ #include "2d/CCActionCatmullRom.h" #include "2d/CCDrawingPrimitives.h" #include "renderer/CCRenderer.h" -#include "platform/CCGL.h" +#include "renderer/ccGLStateCache.h" using namespace cocos2d; @@ -406,7 +406,7 @@ static int tolua_Cocos2d_glBlendColor00(lua_State* tolua_S) if ( !tolua_isnumber(tolua_S, 1, 0, &tolua_err) || !tolua_isnumber(tolua_S, 2, 0, &tolua_err) || - !tolua_isnumber(tolua_S, 2, 0, &tolua_err) || + !tolua_isnumber(tolua_S, 3, 0, &tolua_err) || !tolua_isnumber(tolua_S, 4, 0, &tolua_err) || !tolua_isnoobj(tolua_S, 5, &tolua_err) ) @@ -4405,7 +4405,7 @@ static int tolua_Cocos2d_glEnableVertexAttribs00(lua_State* tolua_S) #endif { int arg0 = (int)tolua_tonumber(tolua_S, 1, 0); - glEnableVertexAttribArray(arg0); + GL::enableVertexAttribs(arg0); } return 0; #ifndef TOLUA_RELEASE diff --git a/cocos/scripting/lua-bindings/manual/cocos2d/LuaScriptHandlerMgr.h b/cocos/scripting/lua-bindings/manual/cocos2d/LuaScriptHandlerMgr.h index f2560bbfd8b2..2d7208a2eb16 100644 --- a/cocos/scripting/lua-bindings/manual/cocos2d/LuaScriptHandlerMgr.h +++ b/cocos/scripting/lua-bindings/manual/cocos2d/LuaScriptHandlerMgr.h @@ -235,7 +235,7 @@ class ScriptHandlerMgr * @lua NA * @js NA */ - ScriptHandlerMgr(void); + ScriptHandlerMgr(); /** * Destructor. @@ -243,7 +243,7 @@ class ScriptHandlerMgr * @lua NA * @js NA */ - virtual ~ScriptHandlerMgr(void); + virtual ~ScriptHandlerMgr(); /** * Get the instance of the ScriptHandlerMgr. @@ -251,7 +251,7 @@ class ScriptHandlerMgr * @return the instance of the ScriptHandlerMgr. * @js NA */ - static ScriptHandlerMgr* getInstance(void); + static ScriptHandlerMgr* getInstance(); /** * Destroy the instance of the ScriptHandlerMgr. @@ -259,7 +259,7 @@ class ScriptHandlerMgr * @lua NA * @js NA */ - static void destroyInstance(void); + static void destroyInstance(); /** * Construct or update the mapping relationship among c++ Ref object ,HandlerType and the reference index corresponding to the pointer of Lua function. @@ -318,7 +318,7 @@ class ScriptHandlerMgr ScriptHandlerMgr::HandlerType addCustomHandler(void* object, int handler); private: - void init(void); + void init(); static ScriptHandlerMgr* _scriptHandlerMgr; MapObjectHandlers _mapObjectHandlers; }; diff --git a/cocos/scripting/lua-bindings/manual/cocos2d/lua_cocos2dx_manual.cpp b/cocos/scripting/lua-bindings/manual/cocos2d/lua_cocos2dx_manual.cpp index 79ace8196d50..deb0096d0aae 100644 --- a/cocos/scripting/lua-bindings/manual/cocos2d/lua_cocos2dx_manual.cpp +++ b/cocos/scripting/lua-bindings/manual/cocos2d/lua_cocos2dx_manual.cpp @@ -64,6 +64,123 @@ #include "platform/CCGLView.h" #include "renderer/CCTextureCache.h" +struct LuaCustomEventListener { + LuaCustomEventListener(lua_State* state, int index): L(state), ref(LUA_NOREF) + { + luaL_checktype(L, index, LUA_TFUNCTION); + lua_pushvalue(L, index); + ref = luaL_ref(L, LUA_REGISTRYINDEX); + } + ~LuaCustomEventListener() + { + unref(); + } + + void operator()(cocos2d::EventCustom* e) + { + lua_rawgeti(L, LUA_REGISTRYINDEX, ref); + + object_to_luaval(L, "cc.EventCustom", e); + lua_call(L, 1, 0); + } + + LuaCustomEventListener(const LuaCustomEventListener& other): L(nullptr), ref(LUA_NOREF) + { + *this = other; + } + LuaCustomEventListener& operator=(const LuaCustomEventListener& rhs) + { + if (this != &rhs) + { + unref(); + L = rhs.L; + lua_rawgeti(L, LUA_REGISTRYINDEX, rhs.ref); + ref = luaL_ref(L, LUA_REGISTRYINDEX); + } + return *this; + } + + LuaCustomEventListener(LuaCustomEventListener&& other): L(nullptr), ref(LUA_NOREF) + { + *this = std::move(other); + } + + LuaCustomEventListener& operator=(LuaCustomEventListener&& rhs) + { + if (this != &rhs) + { + unref(); + + L = rhs.L; + ref = rhs.ref; + + rhs.L = nullptr; + rhs.ref = LUA_NOREF; + } + return *this; + } +private: + inline void unref() { + if (L && ref != LUA_NOREF && ref != LUA_REFNIL) + luaL_unref(L, LUA_REGISTRYINDEX, ref); + } + + lua_State* L; + int ref; +}; +int lua_cocos2dx_EventDispatcher_addCustomEventListener(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::EventDispatcher* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.EventDispatcher",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::EventDispatcher*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_EventDispatcher_addCustomEventListener'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 2) + { + std::string arg0; + + ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.EventDispatcher:addCustomEventListener"); + auto callback = LuaCustomEventListener(tolua_S, 3); + + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_EventDispatcher_addCustomEventListener'", nullptr); + return 0; + } + cocos2d::EventListenerCustom* ret = cobj->addCustomEventListener(arg0, std::function(std::move(callback))); + object_to_luaval(tolua_S, "cc.EventListenerCustom",(cocos2d::EventListenerCustom*)ret); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.EventDispatcher:addCustomEventListener",argc, 2); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_EventDispatcher_addCustomEventListener'.",&tolua_err); +#endif + + return 0; +} + static int tolua_cocos2d_MenuItemImage_create(lua_State* tolua_S) { if (nullptr == tolua_S) @@ -3662,7 +3779,7 @@ static int tolua_cocos2dx_FileUtils_getStringFromFile(lua_State* tolua_S) if (ok) { std::string fullPathName = FileUtils::getInstance()->fullPathForFilename(arg0); - __String* contentsOfFile = __String::createWithContentsOfFile(fullPathName.c_str()); + __String* contentsOfFile = __String::createWithContentsOfFile(fullPathName); if (nullptr != contentsOfFile) { const char* tolua_ret = contentsOfFile->getCString(); @@ -8126,6 +8243,12 @@ int register_all_cocos2dx_module_manual(lua_State* tolua_S) tolua_function(tolua_S, "findChildren", tolua_cocos2d_utils_findChildren); tolua_function(tolua_S, "findChild", tolua_cocos2d_utils_findChild); tolua_endmodule(tolua_S); + + tolua_module(tolua_S, "EventDispatcher", 0); + tolua_beginmodule(tolua_S,"EventDispatcher"); + tolua_function(tolua_S,"addCustomEventListener",lua_cocos2dx_EventDispatcher_addCustomEventListener); + tolua_endmodule(tolua_S); + tolua_endmodule(tolua_S); return 0; @@ -8540,6 +8663,75 @@ static int tolua_cocos2d_Vec3_cross(lua_State* tolua_S) #endif } +static int tolua_cocos2d_random01(lua_State* tolua_S) +{ + lua_pushnumber(tolua_S, CCRANDOM_0_1()); + return 1; +} + +static int tolua_cocos2d_Vec2_isLineIntersect(lua_State* tolua_S) +{ + int argc = lua_gettop(tolua_S); + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + if (4 == argc) + { +#if COCOS2D_DEBUG >= 1 + if (!tolua_istable(tolua_S, 1, 0, &tolua_err) || + !tolua_istable(tolua_S, 2, 0, &tolua_err) || + !tolua_istable(tolua_S, 3, 0, &tolua_err)|| + !tolua_istable(tolua_S, 4, 0, &tolua_err)) + goto tolua_lerror; + else +#endif + { + cocos2d::Vec2 x1,y1; + cocos2d::Vec2 x2,y2; + + float s =0.0f, t = 0.0f; + + bool ok = true; + + ok &= luaval_to_vec2(tolua_S, 1, &x1); + if (!ok) + return 0; + + ok &= luaval_to_vec2(tolua_S, 2, &y1); + if (!ok) + return 0; + + ok &= luaval_to_vec2(tolua_S, 3, &x2); + if (!ok) + return 0; + + ok &= luaval_to_vec2(tolua_S, 4, &y2); + if (!ok) + return 0; + + bool intersects = Vec2::isLineIntersect(x1, y1, x2, y2, &s, &t); + + lua_pushboolean(tolua_S, intersects); + lua_pushnumber(tolua_S, s); + lua_pushnumber(tolua_S, t); + return 3; + } + }else + { + lua_pushboolean(tolua_S, false); + lua_pushnumber(tolua_S, 0); + lua_pushnumber(tolua_S, 0); + return 3; + } +#if COCOS2D_DEBUG >= 1 +tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'vec2_isLineIntersect'.",&tolua_err); + return 0; +#endif +} + static int tolua_cocos2d_Mat4_multiply(lua_State* tolua_S) { #if COCOS2D_DEBUG >= 1 @@ -8825,6 +9017,8 @@ int register_all_cocos2dx_math_manual(lua_State* tolua_S) tolua_function(tolua_S, "mat4_createTranslation", tolua_cocos2d_Mat4_createTranslation); tolua_function(tolua_S, "mat4_createRotation", tolua_cocos2d_Mat4_createRotation); tolua_function(tolua_S, "vec3_cross", tolua_cocos2d_Vec3_cross); + tolua_function(tolua_S, "vec2_isLineIntersect", tolua_cocos2d_Vec2_isLineIntersect); + tolua_function(tolua_S, "cc_mathutils_random", tolua_cocos2d_random01); tolua_endmodule(tolua_S); return 0; } diff --git a/cocos/scripting/lua-bindings/manual/cocos2d/lua_cocos2dx_physics_manual.cpp b/cocos/scripting/lua-bindings/manual/cocos2d/lua_cocos2dx_physics_manual.cpp index 9fd08aef30b0..87203429c066 100644 --- a/cocos/scripting/lua-bindings/manual/cocos2d/lua_cocos2dx_physics_manual.cpp +++ b/cocos/scripting/lua-bindings/manual/cocos2d/lua_cocos2dx_physics_manual.cpp @@ -135,7 +135,7 @@ int lua_cocos2dx_physics_PhysicsWorld_getScene(lua_State* tolua_S) auto iter = g_luaType.find(hashName); std::string className = ""; if(iter != g_luaType.end()){ - className = iter->second.c_str(); + className = iter->second; } else { className = "cc.Scene"; } diff --git a/cocos/scripting/lua-bindings/manual/cocostudio/lua_cocos2dx_coco_studio_manual.cpp b/cocos/scripting/lua-bindings/manual/cocostudio/lua_cocos2dx_coco_studio_manual.cpp index 925bb5b68895..cbbfd6b5c974 100644 --- a/cocos/scripting/lua-bindings/manual/cocostudio/lua_cocos2dx_coco_studio_manual.cpp +++ b/cocos/scripting/lua-bindings/manual/cocostudio/lua_cocos2dx_coco_studio_manual.cpp @@ -115,7 +115,7 @@ static int lua_cocos2dx_ArmatureAnimation_setMovementEventCallFunc(lua_State* L) if (0 != handler) { - std::string strMovementID = movementID; + const std::string& strMovementID = movementID; LuaArmatureMovementEventData movementData(armature,(int)movementType, strMovementID); LuaArmatureWrapperEventData wrapperData(LuaArmatureWrapperEventData::LuaArmatureWrapperEventType::MOVEMENT_EVENT , (void*)&movementData); @@ -185,7 +185,7 @@ static int lua_cocos2dx_ArmatureAnimation_setFrameEventCallFunc(lua_State* L) if (0 != handler) { - std::string strFrameEventName(frameEventName); + const std::string& strFrameEventName(frameEventName); LuaArmatureFrameEventData frameData(bone,frameEventName,originFrameIndex,currentFrameIndex); diff --git a/cocos/scripting/lua-bindings/manual/network/lua_downloader.cpp b/cocos/scripting/lua-bindings/manual/network/lua_downloader.cpp index e987d20484fc..ca26d0e0fd33 100644 --- a/cocos/scripting/lua-bindings/manual/network/lua_downloader.cpp +++ b/cocos/scripting/lua-bindings/manual/network/lua_downloader.cpp @@ -23,6 +23,7 @@ THE SOFTWARE. ****************************************************************************/ #include "lua_downloader.h" +#include "cocos2d.h" #include "network/CCDownloader.h" #include "lua_extensions.h" #include @@ -42,6 +43,7 @@ static int get_field_int(lua_State *L, const char *field, int def) if (lua_isnil(L, -1)) { //luaL_error(L, "get_field_int: field '%s' no exists.", field); + lua_pop(L, 1); return ret; } ret = (int)lua_tointeger(L, -1); @@ -56,7 +58,8 @@ static std::string get_field_string(lua_State *L, const char *field, const char lua_gettable(L, -2); if (lua_isnil(L, -1)) { - //luaL_error(L, "get_field_string: field '%s' no exists.", field); + //CCLOGERROR("get_field_string: field '%s' no exists.", field); + lua_pop(L, 1); return ret; } ret = std::string(lua_tostring(L, -1)); @@ -115,7 +118,7 @@ static int lua_downloader_new(lua_State *L) if (argc >= 1) { //parse DownloaderHints if (!lua_istable(L, -1)) { - luaL_error(L, "cc.Downloader.new: first argument should be table if set"); + CCLOGERROR("cc.Downloader.new: first argument should be table if set"); return 0; } DownloaderHints hints; @@ -132,13 +135,13 @@ static int lua_downloader_new(lua_State *L) downloader = new (ptr) Downloader(); } - luaL_getmetatable(L, "cc.Downloader"); - lua_setmetatable(L, -2); + luaL_getmetatable(L, "cc.Downloader"); //stack downloader, cc.Downloader + lua_setmetatable(L, -2); //stack downloader //register callback table - lua_pushlightuserdata(L, (void*)downloader); - lua_newtable(L); - lua_settable(L, LUA_REGISTRYINDEX); + lua_pushlightuserdata(L, (void*)downloader); //stack downloader, key[*downloader] + lua_newtable(L); //stack downloader, key[*downloader], {} + lua_settable(L, LUA_REGISTRYINDEX); //stack downloaders return 1; } @@ -153,7 +156,7 @@ static int lua_downloader_createDownloadDataTask(lua_State *L) if (argc == 0) { - luaL_error(L, "cc.Downloader.createDownloadDataTask parameter error"); + CCLOGERROR("cc.Downloader.createDownloadDataTask parameter error"); return 0; } @@ -175,7 +178,7 @@ static int lua_downloader_createDownloadFileTask(lua_State *L) if (argc < 2) { - luaL_error(L, "cc.Downloader.createDownloadFileTask parameter error!"); + CCLOGERROR("cc.Downloader.createDownloadFileTask parameter error!"); return 0; } @@ -193,7 +196,7 @@ static int lua_downloader_setOnFileTaskSuccess(lua_State *L) int argc = lua_gettop(L) - 1; Downloader *d = checkDownloader(L); if (argc != 1) { - luaL_error(L, "cc.Downloader.setOnFileTaskSuccess parameter error!"); + CCLOGERROR("cc.Downloader.setOnFileTaskSuccess parameter error!"); return 0; } luaL_argcheck(L, lua_isfunction(L, 2), 2, "should be a function"); @@ -207,7 +210,7 @@ static int lua_downloader_setOnFileTaskSuccess(lua_State *L) if (lua_pcall(L, 1, 0, 0) != 0) { lua_pop(L, 1); // remove callback or nil - luaL_error(L, "cc.Downloader.setOnFileTaskSuccess invoke callback error!"); + CCLOGERROR("cc.Downloader.setOnFileTaskSuccess invoke callback error!"); return; } } @@ -223,7 +226,7 @@ static int lua_downloader_setOnTaskProgress(lua_State *L) Downloader *d = checkDownloader(L); int argc = lua_gettop(L) - 1; if (argc != 1) { - luaL_error(L, "cc.Downloader.setOnTaskProgress parameter error!"); + CCLOGERROR("cc.Downloader.setOnTaskProgress parameter error!"); return 0; } luaL_argcheck(L, lua_isfunction(L, 2), 2, "should be a function"); @@ -243,7 +246,7 @@ static int lua_downloader_setOnTaskProgress(lua_State *L) if (lua_pcall(L, 4, 0, 0) != 0) { lua_pop(L, 1); // remove callback or nil - luaL_error(L, "cc.Downloader.setOnTaskProgress invoke callback error!"); + CCLOGERROR("cc.Downloader.setOnTaskProgress invoke callback error!"); return; } } @@ -259,7 +262,7 @@ static int lua_downloader_setOnTaskError(lua_State *L) Downloader *d = checkDownloader(L); int argc = lua_gettop(L) - 1; if (argc != 1) { - luaL_error(L, "cc.Downloader.setOnTaskError parameter error!"); + CCLOGERROR("cc.Downloader.setOnTaskError parameter error!"); return 0; } luaL_argcheck(L, lua_isfunction(L, 2), 2, "should be a function"); @@ -279,7 +282,7 @@ static int lua_downloader_setOnTaskError(lua_State *L) if (lua_pcall(L, 4, 0, 0) != 0) { lua_pop(L, 1); // remove callback or nil - luaL_error(L, "cc.Downloader.setOnTaskError invoke callback error!"); + CCLOGERROR("cc.Downloader.setOnTaskError invoke callback error!"); return; } } @@ -311,7 +314,7 @@ static int lua_downloader_tostring(lua_State *L) return 1; } -static const struct luaL_reg downloaderStaticFns[] = { +static const struct luaL_Reg downloaderStaticFns[] = { { "new", lua_downloader_new }, /* * cocos2d::Downloader is not a subclass of cocos2d::Ref, @@ -322,7 +325,7 @@ static const struct luaL_reg downloaderStaticFns[] = { }; -static const struct luaL_reg downloaderMemberFns[] = { +static const struct luaL_Reg downloaderMemberFns[] = { { "createDownloadDataTask", lua_downloader_createDownloadDataTask }, { "createDownloadFileTask", lua_downloader_createDownloadFileTask }, { "setOnFileTaskSuccess", lua_downloader_setOnFileTaskSuccess }, @@ -335,13 +338,16 @@ static const struct luaL_reg downloaderMemberFns[] = { int register_downloader(lua_State* L) { - luaL_newmetatable(L, "cc.Downloader"); - lua_pushstring(L, "__index"); - lua_pushvalue(L, -2); /* pushes the metatable */ - lua_settable(L, -3); /* metatable.__index = metatable */ - - luaL_openlib(L, nullptr, downloaderMemberFns, 0); - luaL_openlib(L, "cc.Downloader", downloaderStaticFns, 0); + int stackSize = lua_gettop(L); + luaL_newmetatable(L, "cc.Downloader"); //stack metatable(cc.Downloader) + lua_pushstring(L, "__index"); //stack metatable(*), __index + lua_pushvalue(L, -2); //stack metatable(*), __index, metatable(*) + lua_settable(L, -3); //stack metatable(*) + luaL_register(L, nullptr, downloaderMemberFns); //stack metatable(*) + lua_pop(L, 1); //stack *empty* + luaL_register(L, "cc.Downloader", downloaderStaticFns); //stack *empty* + lua_pop(L, 1); + assert(stackSize == lua_gettop(L)); return 1; } diff --git a/cocos/scripting/lua-bindings/manual/network/lua_xml_http_request.cpp b/cocos/scripting/lua-bindings/manual/network/lua_xml_http_request.cpp index c15bfdfc1ae7..788d4aec7a50 100644 --- a/cocos/scripting/lua-bindings/manual/network/lua_xml_http_request.cpp +++ b/cocos/scripting/lua-bindings/manual/network/lua_xml_http_request.cpp @@ -163,12 +163,8 @@ LuaMinXmlHttpRequest::~LuaMinXmlHttpRequest() */ void LuaMinXmlHttpRequest::_gotHeader(const std::string& header) { - // Get Header and Set StatusText - // Split String into Tokens - char * cstr = new (std::nothrow) char [header.length()+1]; - // check for colon. - size_t found_header_field = header.find_first_of(":"); + size_t found_header_field = header.find_first_of(':'); if (found_header_field != std::string::npos) { @@ -190,40 +186,17 @@ void LuaMinXmlHttpRequest::_gotHeader(const std::string& header) else { // Seems like we have the response Code! Parse it and check for it. - char * pch; - strcpy(cstr, header.c_str()); - - pch = strtok(cstr," "); - while (pch != nullptr) + std::istringstream in(header); + std::string token; + while (std::getline(in, token, ' ')) { - std::stringstream ss; - std::string val; - - ss << pch; - val = ss.str(); - size_t found_http = val.find("HTTP"); - - // Check for HTTP Header to set statusText - if (found_http != std::string::npos) { - - std::stringstream mystream; - - // Get Response Status - pch = strtok (NULL, " "); - mystream << pch; - - pch = strtok (NULL, "\n"); - mystream << " " << pch; - - _statusText = mystream.str(); - + if (token.find("HTTP") != std::string::npos) + { + std::getline(in, _statusText); + break; } - - pch = strtok (NULL, " "); } } - - CC_SAFE_DELETE_ARRAY(cstr); } /** @@ -849,19 +822,19 @@ static int lua_cocos2dx_XMLHttpRequest_open(lua_State* L) if (nullptr != self->getHttpRequest()) { - if (method.compare("post") == 0 || method.compare("POST") == 0) + if (method == "post" || method == "POST") { self->getHttpRequest()->setRequestType(network::HttpRequest::Type::POST); } - else if(method.compare("get") == 0 || method.compare("GET") == 0) + else if(method == "get" || method == "GET") { self->getHttpRequest()->setRequestType(network::HttpRequest::Type::GET); } - else if(method.compare("put") == 0 || method.compare("PUT") == 0) + else if(method == "put" || method == "PUT") { self->getHttpRequest()->setRequestType(network::HttpRequest::Type::PUT); } - else if(method.compare("delete") == 0 || method.compare("DELETE") == 0) + else if(method == "delete" || method == "DELETE") { self->getHttpRequest()->setRequestType(network::HttpRequest::Type::DELETE); } @@ -929,8 +902,8 @@ static int lua_cocos2dx_XMLHttpRequest_send(lua_State* L) } if (size > 0 && - (self->getMethod().compare("post") == 0 || self->getMethod().compare("POST") == 0 - || self->getMethod().compare("put") == 0 || self->getMethod().compare("PUT") == 0 )&& + (self->getMethod() == "post" || self->getMethod() == "POST" + || self->getMethod() == "put" || self->getMethod() == "PUT" )&& nullptr != self->getHttpRequest()) { self->getHttpRequest()->setRequestData(data,size); diff --git a/cocos/scripting/lua-bindings/manual/physics3d/lua_cocos2dx_physics3d_manual.cpp b/cocos/scripting/lua-bindings/manual/physics3d/lua_cocos2dx_physics3d_manual.cpp index c7db1215b07a..147edefd0d30 100644 --- a/cocos/scripting/lua-bindings/manual/physics3d/lua_cocos2dx_physics3d_manual.cpp +++ b/cocos/scripting/lua-bindings/manual/physics3d/lua_cocos2dx_physics3d_manual.cpp @@ -760,7 +760,7 @@ int lua_cocos2dx_physics3d_Physics3DObject_setCollisionCallback(lua_State* L) { int vecIndex = 1; lua_newtable(L); - for (auto value : ci.collisionPointList) + for (const auto& value : ci.collisionPointList) { lua_pushnumber(L, vecIndex); CollisionPoint_to_luaval(L, value); diff --git a/cocos/scripting/lua-bindings/manual/platform/android/CCLuaJavaBridge.cpp b/cocos/scripting/lua-bindings/manual/platform/android/CCLuaJavaBridge.cpp index be8005eab4b3..5cfcb256e2fa 100644 --- a/cocos/scripting/lua-bindings/manual/platform/android/CCLuaJavaBridge.cpp +++ b/cocos/scripting/lua-bindings/manual/platform/android/CCLuaJavaBridge.cpp @@ -35,7 +35,7 @@ extern "C" { #include "scripting/lua-bindings/manual/tolua_fix.h" } -LuaJavaBridge::CallInfo::~CallInfo(void) +LuaJavaBridge::CallInfo::~CallInfo() { if (m_returnType == TypeString && m_ret.stringValue) { @@ -43,7 +43,7 @@ LuaJavaBridge::CallInfo::~CallInfo(void) } } -bool LuaJavaBridge::CallInfo::execute(void) +bool LuaJavaBridge::CallInfo::execute() { switch (m_returnType) { @@ -170,7 +170,7 @@ int LuaJavaBridge::CallInfo::pushReturnValue(lua_State *L) } -bool LuaJavaBridge::CallInfo::validateMethodSig(void) +bool LuaJavaBridge::CallInfo::validateMethodSig() { size_t len = m_methodSig.length(); if (len < 3 || m_methodSig[0] != '(') // min sig is "()V" @@ -244,7 +244,7 @@ LuaJavaBridge::ValueType LuaJavaBridge::CallInfo::checkType(const string& sig, s } -bool LuaJavaBridge::CallInfo::getMethodInfo(void) +bool LuaJavaBridge::CallInfo::getMethodInfo() { m_methodID = 0; m_env = 0; diff --git a/cocos/scripting/lua-bindings/manual/platform/android/CCLuaJavaBridge.h b/cocos/scripting/lua-bindings/manual/platform/android/CCLuaJavaBridge.h index 5c0e0ebb7c78..46cca760e84f 100644 --- a/cocos/scripting/lua-bindings/manual/platform/android/CCLuaJavaBridge.h +++ b/cocos/scripting/lua-bindings/manual/platform/android/CCLuaJavaBridge.h @@ -158,17 +158,17 @@ class LuaJavaBridge memset(&m_ret, 0, sizeof(m_ret)); m_valid = validateMethodSig() && getMethodInfo(); } - ~CallInfo(void); + ~CallInfo(); - bool isValid(void) { + bool isValid() { return m_valid; } - int getErrorCode(void) { + int getErrorCode() { return m_error; } - JNIEnv *getEnv(void) { + JNIEnv *getEnv() { return m_env; } @@ -176,7 +176,7 @@ class LuaJavaBridge return m_argumentsType.at(index); } - bool execute(void); + bool execute(); bool executeWithArgs(jvalue *args); int pushReturnValue(lua_State *L); @@ -199,8 +199,8 @@ class LuaJavaBridge jclass m_classID; jmethodID m_methodID; - bool validateMethodSig(void); - bool getMethodInfo(void); + bool validateMethodSig(); + bool getMethodInfo(); ValueType checkType(const string& sig, size_t *pos); }; diff --git a/cocos/scripting/lua-bindings/manual/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxLuaJavaBridge.cpp b/cocos/scripting/lua-bindings/manual/platform/android/jni/Cocos2dxLuaJavaBridge.cpp similarity index 96% rename from cocos/scripting/lua-bindings/manual/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxLuaJavaBridge.cpp rename to cocos/scripting/lua-bindings/manual/platform/android/jni/Cocos2dxLuaJavaBridge.cpp index 1e936ac860f1..4050cc1f1ce4 100644 --- a/cocos/scripting/lua-bindings/manual/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxLuaJavaBridge.cpp +++ b/cocos/scripting/lua-bindings/manual/platform/android/jni/Cocos2dxLuaJavaBridge.cpp @@ -23,7 +23,7 @@ ****************************************************************************/ -#include "scripting/lua-bindings/manual/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxLuaJavaBridge.h" +#include "scripting/lua-bindings/manual/platform/android/jni/Cocos2dxLuaJavaBridge.h" #include diff --git a/cocos/scripting/lua-bindings/manual/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxLuaJavaBridge.h b/cocos/scripting/lua-bindings/manual/platform/android/jni/Cocos2dxLuaJavaBridge.h similarity index 100% rename from cocos/scripting/lua-bindings/manual/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxLuaJavaBridge.h rename to cocos/scripting/lua-bindings/manual/platform/android/jni/Cocos2dxLuaJavaBridge.h diff --git a/cocos/scripting/lua-bindings/manual/spine/lua_cocos2dx_spine_manual.cpp b/cocos/scripting/lua-bindings/manual/spine/lua_cocos2dx_spine_manual.cpp index 347e159b2d57..c757030bdaad 100644 --- a/cocos/scripting/lua-bindings/manual/spine/lua_cocos2dx_spine_manual.cpp +++ b/cocos/scripting/lua-bindings/manual/spine/lua_cocos2dx_spine_manual.cpp @@ -209,9 +209,9 @@ int executeSpineEvent(LuaSkeletonAnimation* skeletonAnimation, int handler, spEv { LuaValueDict eventData; eventData.insert(eventData.end(), LuaValueDict::value_type("name", LuaValue::stringValue(event->data->name))); - eventData.insert(eventData.end(), LuaValueDict::value_type("intValue", LuaValue::intValue(event->intValue))); - eventData.insert(eventData.end(), LuaValueDict::value_type("floatValue", LuaValue::floatValue(event->floatValue))); - eventData.insert(eventData.end(), LuaValueDict::value_type("stringValue", LuaValue::stringValue(event->stringValue))); + eventData.insert(eventData.end(), LuaValueDict::value_type("intValue", LuaValue::intValue(event->data->intValue))); + eventData.insert(eventData.end(), LuaValueDict::value_type("floatValue", LuaValue::floatValue(event->data->floatValue))); + eventData.insert(eventData.end(), LuaValueDict::value_type("stringValue", LuaValue::stringValue(event->data->stringValue))); spineEvent.insert(spineEvent.end(), LuaValueDict::value_type("eventData", LuaValue::dictValue(eventData))); } diff --git a/cocos/scripting/lua-bindings/manual/tolua_fix.h b/cocos/scripting/lua-bindings/manual/tolua_fix.h index 9490fd57b5ae..df9d5f6ba85d 100644 --- a/cocos/scripting/lua-bindings/manual/tolua_fix.h +++ b/cocos/scripting/lua-bindings/manual/tolua_fix.h @@ -27,7 +27,15 @@ #define __TOLUA_FIX_H_ #include "tolua++.h" - + +#if LUA_VERSION_NUM > 501 +#define lua_setfenv lua_setuservalue +#define lua_open luaL_newstate +#if !defined(LUA_COMPAT_5_1) && !defined(LUA_COMPAT_ALL) +#define lua_objlen(L,i) lua_rawlen(L, (i)) +#endif +#endif + #define TOLUA_REFID_PTR_MAPPING "toluafix_refid_ptr_mapping" #define TOLUA_REFID_TYPE_MAPPING "toluafix_refid_type_mapping" #define TOLUA_REFID_FUNCTION_MAPPING "toluafix_refid_function_mapping" diff --git a/cocos/scripting/lua-bindings/proj.android/Android.mk b/cocos/scripting/lua-bindings/proj.android/Android.mk index 2ef2b81e1d4f..06ad2fad43d7 100644 --- a/cocos/scripting/lua-bindings/proj.android/Android.mk +++ b/cocos/scripting/lua-bindings/proj.android/Android.mk @@ -9,7 +9,7 @@ LOCAL_MODULE_FILENAME := libluaccandroid LOCAL_ARM_MODE := arm LOCAL_SRC_FILES := ../manual/platform/android/CCLuaJavaBridge.cpp \ - ../manual/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxLuaJavaBridge.cpp + ../manual/platform/android/jni/Cocos2dxLuaJavaBridge.cpp LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../.. \ $(LOCAL_PATH)/../manual \ diff --git a/cocos/scripting/lua-bindings/proj.android/CMakeLists.txt b/cocos/scripting/lua-bindings/proj.android/CMakeLists.txt index 298bf5b06cdc..19560eb8f8be 100644 --- a/cocos/scripting/lua-bindings/proj.android/CMakeLists.txt +++ b/cocos/scripting/lua-bindings/proj.android/CMakeLists.txt @@ -7,14 +7,14 @@ project(${target_name}) set(${target_name}_src ../manual/platform/android/CCLuaJavaBridge.cpp - ../manual/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxLuaJavaBridge.cpp + ../manual/platform/android/jni/Cocos2dxLuaJavaBridge.cpp ) add_library(${target_name} STATIC ${${target_name}_src} ) -get_target_property(lua_header ext_lua INTERFACE_INCLUDE_DIRECTORIES) +get_target_property(lua_header ext_luajit INTERFACE_INCLUDE_DIRECTORIES) get_target_property(tolua_header ext_tolua INTERFACE_INCLUDE_DIRECTORIES) target_include_directories(${target_name} PRIVATE ../../.. diff --git a/cocos/scripting/lua-bindings/proj.ios_mac/cocos2d_lua_bindings.xcodeproj/project.pbxproj b/cocos/scripting/lua-bindings/proj.ios_mac/cocos2d_lua_bindings.xcodeproj/project.pbxproj index 4d40a4e945ab..8d014a79eae3 100644 --- a/cocos/scripting/lua-bindings/proj.ios_mac/cocos2d_lua_bindings.xcodeproj/project.pbxproj +++ b/cocos/scripting/lua-bindings/proj.ios_mac/cocos2d_lua_bindings.xcodeproj/project.pbxproj @@ -1647,7 +1647,7 @@ 15C1C2CA198748D200A46ACC /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = YES; + ALWAYS_SEARCH_USER_PATHS = NO; COMBINE_HIDPI_IMAGES = YES; EXECUTABLE_PREFIX = ""; GCC_PRECOMPILE_PREFIX_HEADER = YES; @@ -1672,7 +1672,7 @@ 15C1C2CB198748D200A46ACC /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = YES; + ALWAYS_SEARCH_USER_PATHS = NO; COMBINE_HIDPI_IMAGES = YES; EXECUTABLE_PREFIX = ""; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; @@ -1698,7 +1698,7 @@ 15EFA614198B2DAA000C57D3 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = YES; + ALWAYS_SEARCH_USER_PATHS = NO; ENABLE_BITCODE = NO; EXECUTABLE_PREFIX = ""; GCC_PRECOMPILE_PREFIX_HEADER = YES; @@ -1719,7 +1719,7 @@ 15EFA615198B2DAA000C57D3 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = YES; + ALWAYS_SEARCH_USER_PATHS = NO; ENABLE_BITCODE = NO; EXECUTABLE_PREFIX = ""; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; @@ -1741,7 +1741,7 @@ 507B43511C31FA0C0067B53E /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = YES; + ALWAYS_SEARCH_USER_PATHS = NO; EXECUTABLE_PREFIX = ""; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = ""; @@ -1759,7 +1759,7 @@ 507B43521C31FA0C0067B53E /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = YES; + ALWAYS_SEARCH_USER_PATHS = NO; EXECUTABLE_PREFIX = ""; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_PRECOMPILE_PREFIX_HEADER = YES; diff --git a/cocos/scripting/lua-bindings/proj.win32/libluacocos2d.vcxproj b/cocos/scripting/lua-bindings/proj.win32/libluacocos2d.vcxproj index 462c1092e4cc..e1e807d99163 100644 --- a/cocos/scripting/lua-bindings/proj.win32/libluacocos2d.vcxproj +++ b/cocos/scripting/lua-bindings/proj.win32/libluacocos2d.vcxproj @@ -234,6 +234,7 @@ {9F2D6CE6-C893-4400-B50C-6DB70CC2562F} libluacocos2d Win32Proj + 10.0.17134.0
diff --git a/cocos/scripting/lua-bindings/script/cocos2d/Cocos2d.lua b/cocos/scripting/lua-bindings/script/cocos2d/Cocos2d.lua index 89cca9e91843..27d306e54934 100644 --- a/cocos/scripting/lua-bindings/script/cocos2d/Cocos2d.lua +++ b/cocos/scripting/lua-bindings/script/cocos2d/Cocos2d.lua @@ -1,6 +1,11 @@ cc = cc or {} + +function cc.random() + return cc_mathutils_random() +end + function cc.clampf(value, min_inclusive, max_inclusive) -- body local temp = 0 @@ -89,33 +94,7 @@ function cc.pGetDistance(startP,endP) end function cc.pIsLineIntersect(A, B, C, D, s, t) - if ((A.x == B.x) and (A.y == B.y)) or ((C.x == D.x) and (C.y == D.y))then - return false, s, t - end - - local BAx = B.x - A.x - local BAy = B.y - A.y - local DCx = D.x - C.x - local DCy = D.y - C.y - local ACx = A.x - C.x - local ACy = A.y - C.y - - local denom = DCy * BAx - DCx * BAy - s = DCx * ACy - DCy * ACx - t = BAx * ACy - BAy * ACx - - if (denom == 0) then - if (s == 0 or t == 0) then - return true, s , t - end - - return false, s, t - end - - s = s / denom - t = t / denom - - return true,s,t + return vec2_isLineIntersect(A, B, C, D) end function cc.pPerp(pt) diff --git a/cocos/ui/CMakeLists.txt b/cocos/ui/CMakeLists.txt index cd635d6b9615..28b2bbdce5a5 100644 --- a/cocos/ui/CMakeLists.txt +++ b/cocos/ui/CMakeLists.txt @@ -1,8 +1,3 @@ - -if(WINDOWS AND BUILD_SHARED_LIBS) - add_definitions(-D_USEGUIDLL) -endif() - if(WINDOWS) set(COCOS_UI_SPECIFIC_HEADER ui/UIEditBox/UIEditBoxImpl-win32.h diff --git a/cocos/ui/GUIDefine.h b/cocos/ui/GUIDefine.h index 2731b4701733..ef6759c6a44a 100644 --- a/cocos/ui/GUIDefine.h +++ b/cocos/ui/GUIDefine.h @@ -37,10 +37,10 @@ #define DECLARE_CLASS_GUI_INFO \ public: \ static cocos2d::ObjectFactory::TInfo __Type; \ - static cocos2d::Ref* createInstance(void); \ + static cocos2d::Ref* createInstance(); \ #define IMPLEMENT_CLASS_GUI_INFO(className) \ - cocos2d::Ref* className::createInstance(void) \ + cocos2d::Ref* className::createInstance() \ { \ return className::create(); \ } \ @@ -57,10 +57,10 @@ #define DECLARE_CLASS_WIDGET_READER_INFO \ public: \ static cocos2d::ObjectFactory::TInfo __Type; \ - static cocos2d::Ref* createInstance(void); \ + static cocos2d::Ref* createInstance(); \ #define IMPLEMENT_CLASS_WIDGET_READER_INFO(className) \ - cocos2d::Ref* className::createInstance(void) \ + cocos2d::Ref* className::createInstance() \ { \ return className::getInstance(); \ } \ diff --git a/cocos/ui/UIAbstractCheckButton.h b/cocos/ui/UIAbstractCheckButton.h index e3376dc93802..3237af15c416 100644 --- a/cocos/ui/UIAbstractCheckButton.h +++ b/cocos/ui/UIAbstractCheckButton.h @@ -115,7 +115,7 @@ class CC_GUI_DLL AbstractCheckButton : public Widget * Set to true will cause the CheckBox's state to "selected", false otherwise. *@param selected Set to true will change CheckBox to selected state, false otherwise. */ - void setSelected(bool selected); + virtual void setSelected(bool selected); //override functions virtual Size getVirtualRendererSize() const override; @@ -196,22 +196,22 @@ class CC_GUI_DLL AbstractCheckButton : public Widget virtual void onPressStateChangedToPressed() override; virtual void onPressStateChangedToDisabled() override; - void setupBackgroundTexture(); + virtual void setupBackgroundTexture(); void loadTextureBackGround(SpriteFrame* spriteFrame); - void setupBackgroundSelectedTexture(); + virtual void setupBackgroundSelectedTexture(); void loadTextureBackGroundSelected(SpriteFrame* spriteFrame); - void setupFrontCrossTexture(); + virtual void setupFrontCrossTexture(); void loadTextureFrontCross(SpriteFrame* spriteframe); - void setupBackgroundDisable(); + virtual void setupBackgroundDisable(); void loadTextureBackGroundDisabled(SpriteFrame* spriteframe); - void setupFrontCrossDisableTexture(); + virtual void setupFrontCrossDisableTexture(); void loadTextureFrontCrossDisabled(SpriteFrame* spriteframe); virtual void dispatchSelectChangedEvent(bool selected) = 0; virtual void onSizeChanged() override; - void backGroundTextureScaleChangedWithSize(); + virtual void backGroundTextureScaleChangedWithSize(); void backGroundSelectedTextureScaleChangedWithSize(); void frontCrossTextureScaleChangedWithSize(); void backGroundDisabledTextureScaleChangedWithSize(); diff --git a/cocos/ui/UIButton.cpp b/cocos/ui/UIButton.cpp index 2e69dd117d66..da1cf1679571 100644 --- a/cocos/ui/UIButton.cpp +++ b/cocos/ui/UIButton.cpp @@ -158,19 +158,17 @@ bool Button::createTitleRendererIfNull() { void Button::createTitleRenderer() { - _titleRenderer = Label::create(); - _titleRenderer->setAnchorPoint(Vec2::ANCHOR_MIDDLE); - addProtectedChild(_titleRenderer, TITLE_RENDERER_Z, -1); + setTitleLabel(Label::create()); } /** replaces the current Label node with a new one */ void Button::setTitleLabel(Label* label) { - if (_titleRenderer != label) { - CC_SAFE_RELEASE(_titleRenderer); - _titleRenderer = label; - CC_SAFE_RETAIN(_titleRenderer); + if (label && _titleRenderer != label) { + + if (_titleRenderer) removeProtectedChild(_titleRenderer); + _titleRenderer = label; addProtectedChild(_titleRenderer, TITLE_RENDERER_Z, -1); updateTitleLocation(); } @@ -650,7 +648,7 @@ Size Button::getVirtualRendererSize() const if (nullptr != _titleRenderer) { Size titleSize = _titleRenderer->getContentSize(); - if (!_normalTextureLoaded && _titleRenderer->getString().size() > 0) + if (!_normalTextureLoaded && !_titleRenderer->getString().empty()) { return titleSize; } @@ -718,7 +716,7 @@ void Button::setTitleAlignment(TextHAlignment hAlignment, TextVAlignment vAlignm void Button::setTitleText(const std::string& text) { - if (text.compare(getTitleText()) == 0) { + if (text == getTitleText()) { return; } diff --git a/cocos/ui/UIButton.h b/cocos/ui/UIButton.h index 3d097cf55cb4..04a8a6542529 100644 --- a/cocos/ui/UIButton.h +++ b/cocos/ui/UIButton.h @@ -341,7 +341,7 @@ class CC_GUI_DLL Button : public Widget void disabledTextureScaleChangedWithSize(); virtual void adaptRenderers() override; - void updateTitleLocation(); + virtual void updateTitleLocation(); void updateContentSize(); virtual void createTitleRenderer(); bool createTitleRendererIfNull(); diff --git a/cocos/ui/UIDeprecated.cpp b/cocos/ui/UIDeprecated.cpp index 1821e3d5ee93..e384985b183e 100644 --- a/cocos/ui/UIDeprecated.cpp +++ b/cocos/ui/UIDeprecated.cpp @@ -31,4 +31,6 @@ namespace ui { const Margin MarginZero = Margin::ZERO ; -}} +} + +NS_CC_END diff --git a/cocos/ui/UIEditBox/UIEditBoxImpl-common.cpp b/cocos/ui/UIEditBox/UIEditBoxImpl-common.cpp index 21ac3983f7b7..2ac707c59578 100755 --- a/cocos/ui/UIEditBox/UIEditBoxImpl-common.cpp +++ b/cocos/ui/UIEditBox/UIEditBoxImpl-common.cpp @@ -238,7 +238,7 @@ void EditBoxImplCommon::refreshInactiveText() refreshLabelAlignment(); if (!_editingMode) { - if (_text.size() == 0) { + if (_text.empty()) { _label->setVisible(false); _labelPlaceHolder->setVisible(true); } else { @@ -300,7 +300,7 @@ void EditBoxImplCommon::draw(Renderer* /*renderer*/, const Mat4& /*transform*/, } } -void EditBoxImplCommon::onEnter(void) +void EditBoxImplCommon::onEnter() { const char* pText = getText(); if (pText) { diff --git a/cocos/ui/UIEditBox/UIEditBoxImpl-common.h b/cocos/ui/UIEditBox/UIEditBoxImpl-common.h index 1904a65c1547..6e193077a001 100755 --- a/cocos/ui/UIEditBox/UIEditBoxImpl-common.h +++ b/cocos/ui/UIEditBox/UIEditBoxImpl-common.h @@ -69,8 +69,8 @@ class CC_GUI_DLL EditBoxImplCommon : public EditBoxImpl virtual void setTextHorizontalAlignment(TextHAlignment alignment) override; virtual int getMaxLength() override { return _maxLength; } - virtual const char* getText(void) override { return _text.c_str(); } - virtual const char* getPlaceHolder(void) override { return _placeHolder.c_str(); } + virtual const char* getText() override { return _text.c_str(); } + virtual const char* getPlaceHolder() override { return _placeHolder.c_str(); } virtual const char* getFontName() override { return _fontName.c_str(); } virtual int getFontSize() override { return _fontSize; } @@ -101,7 +101,7 @@ class CC_GUI_DLL EditBoxImplCommon : public EditBoxImpl * @js NA * @lua NA */ - virtual void onEnter(void) override; + virtual void onEnter() override; virtual void openKeyboard() override; virtual void closeKeyboard() override; diff --git a/cocos/ui/UIEditBox/UIEditBoxImpl-ios.h b/cocos/ui/UIEditBox/UIEditBoxImpl-ios.h index df60aa2a443f..105ec6480b81 100644 --- a/cocos/ui/UIEditBox/UIEditBoxImpl-ios.h +++ b/cocos/ui/UIEditBox/UIEditBoxImpl-ios.h @@ -74,7 +74,7 @@ class EditBoxImplIOS : public EditBoxImplCommon virtual void nativeCloseKeyboard() override; //need to remove siri text - virtual const char* getText(void)override; + virtual const char* getText()override; virtual void doAnimationWhenKeyboardMove(float duration, float distance) override; private: diff --git a/cocos/ui/UIEditBox/UIEditBoxImpl-linux.h b/cocos/ui/UIEditBox/UIEditBoxImpl-linux.h index 837182a42aa4..61da3c22166b 100644 --- a/cocos/ui/UIEditBox/UIEditBoxImpl-linux.h +++ b/cocos/ui/UIEditBox/UIEditBoxImpl-linux.h @@ -56,23 +56,23 @@ class EditBoxImplLinux: public EditBoxImplCommon virtual bool isEditing() override; - virtual void createNativeControl(const Rect& frame) override {}; - virtual void setNativeFont(const char* pFontName, int fontSize) override {}; - virtual void setNativeFontColor(const Color4B& color) override {}; - virtual void setNativePlaceholderFont(const char* pFontName, int fontSize) override {}; - virtual void setNativePlaceholderFontColor(const Color4B& color) override {}; - virtual void setNativeInputMode(EditBox::InputMode inputMode) override {}; - virtual void setNativeInputFlag(EditBox::InputFlag inputFlag) override {}; - virtual void setNativeReturnType(EditBox::KeyboardReturnType returnType)override {}; - virtual void setNativeTextHorizontalAlignment(cocos2d::TextHAlignment alignment) {}; - virtual void setNativeText(const char* pText) override {}; - virtual void setNativePlaceHolder(const char* pText) override {}; - virtual void setNativeVisible(bool visible) override {}; - virtual void updateNativeFrame(const Rect& rect) override {}; - virtual const char* getNativeDefaultFontName() override {}; + virtual void createNativeControl(const Rect& frame) override {} + virtual void setNativeFont(const char* pFontName, int fontSize) override {} + virtual void setNativeFontColor(const Color4B& color) override {} + virtual void setNativePlaceholderFont(const char* pFontName, int fontSize) override {} + virtual void setNativePlaceholderFontColor(const Color4B& color) override {} + virtual void setNativeInputMode(EditBox::InputMode inputMode) override {} + virtual void setNativeInputFlag(EditBox::InputFlag inputFlag) override {} + virtual void setNativeReturnType(EditBox::KeyboardReturnType returnType)override {} + virtual void setNativeTextHorizontalAlignment(cocos2d::TextHAlignment alignment) {} + virtual void setNativeText(const char* pText) override {} + virtual void setNativePlaceHolder(const char* pText) override {} + virtual void setNativeVisible(bool visible) override {} + virtual void updateNativeFrame(const Rect& rect) override {} + virtual const char* getNativeDefaultFontName() override { return nullptr; } virtual void nativeOpenKeyboard() override; - virtual void nativeCloseKeyboard() override {}; - virtual void setNativeMaxLength(int maxLength) override {}; + virtual void nativeCloseKeyboard() override {} + virtual void setNativeMaxLength(int maxLength) override {} private: diff --git a/cocos/ui/UIEditBox/UIEditBoxImpl-tizen.cpp b/cocos/ui/UIEditBox/UIEditBoxImpl-tizen.cpp index cf9759fdf33e..4206339b3df9 100644 --- a/cocos/ui/UIEditBox/UIEditBoxImpl-tizen.cpp +++ b/cocos/ui/UIEditBox/UIEditBoxImpl-tizen.cpp @@ -213,7 +213,7 @@ void EditBoxImplTizen::setText(const char* pText) } } -const char* EditBoxImplTizen::getText(void) +const char* EditBoxImplTizen::getText() { return _text.c_str(); } @@ -232,7 +232,7 @@ void EditBoxImplTizen::setPlaceHolder(const char* pText) } } -const char* EditBoxImplTizen::getPlaceHolder(void) +const char* EditBoxImplTizen::getPlaceHolder() { return _placeHolder.c_str(); } @@ -257,12 +257,12 @@ void EditBoxImplTizen::setAnchorPoint(const Vec2& anchorPoint) } -void EditBoxImplTizen::visit(void) +void EditBoxImplTizen::visit() { // don't need to be implemented on tizen platform. } -void EditBoxImplTizen::onEnter(void) +void EditBoxImplTizen::onEnter() { // don't need to be implemented on tizen platform. } diff --git a/cocos/ui/UIEditBox/UIEditBoxImpl-tizen.h b/cocos/ui/UIEditBox/UIEditBoxImpl-tizen.h index 5b7ac011f9c3..bbd56209585e 100644 --- a/cocos/ui/UIEditBox/UIEditBoxImpl-tizen.h +++ b/cocos/ui/UIEditBox/UIEditBoxImpl-tizen.h @@ -71,9 +71,9 @@ class EditBoxImplTizen : public EditBoxImpl virtual bool isEditing(); virtual void setText(const char* pText); - virtual const char* getText(void); + virtual const char* getText(); virtual void setPlaceHolder(const char* pText); - virtual const char* getPlaceHolder(void); + virtual const char* getPlaceHolder(); virtual const char* getFontName() override { return _fontName.c_str(); } virtual int getFontSize() override { return _fontSize; } @@ -96,12 +96,12 @@ class EditBoxImplTizen : public EditBoxImpl * @js NA * @lua NA */ - virtual void visit(void); + virtual void visit(); /** * @js NA * @lua NA */ - virtual void onEnter(void); + virtual void onEnter(); virtual void doAnimationWhenKeyboardMove(float duration, float distance); virtual void openKeyboard(); virtual void closeKeyboard(); diff --git a/cocos/ui/UIEditBox/UIEditBoxImpl.h b/cocos/ui/UIEditBox/UIEditBoxImpl.h index f0ccf25e6afd..d016bedc1208 100644 --- a/cocos/ui/UIEditBox/UIEditBoxImpl.h +++ b/cocos/ui/UIEditBox/UIEditBoxImpl.h @@ -60,9 +60,9 @@ namespace cocos2d { virtual bool isEditing() = 0; virtual void setText(const char* pText) = 0; - virtual const char* getText(void) = 0; + virtual const char* getText() = 0; virtual void setPlaceHolder(const char* pText) = 0; - virtual const char* getPlaceHolder(void) = 0; + virtual const char* getPlaceHolder() = 0; virtual const char* getFontName() = 0; virtual int getFontSize() = 0; @@ -100,7 +100,7 @@ namespace cocos2d { * @js NA * @lua NA */ - virtual void onEnter(void) = 0; + virtual void onEnter() = 0; void setDelegate(EditBoxDelegate* pDelegate) { _delegate = pDelegate; }; diff --git a/cocos/ui/UIEditBox/iOS/CCUIEditBoxIOS.mm b/cocos/ui/UIEditBox/iOS/CCUIEditBoxIOS.mm index 677374af4dcf..eb33fd0a2bdd 100644 --- a/cocos/ui/UIEditBox/iOS/CCUIEditBoxIOS.mm +++ b/cocos/ui/UIEditBox/iOS/CCUIEditBoxIOS.mm @@ -389,6 +389,12 @@ - (BOOL)textViewShouldEndEditing:(UITextView *)textView - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text { + if ( self.keyboardReturnType == cocos2d::ui::EditBox::KeyboardReturnType::DONE && + [text isEqualToString: @"\n"] ) + { + [self closeKeyboard]; + } + int maxLength = getEditBoxImplIOS()->getMaxLength(); if (maxLength < 0) { diff --git a/cocos/ui/UILayout.cpp b/cocos/ui/UILayout.cpp index c89bf152232f..519cc89bbacf 100644 --- a/cocos/ui/UILayout.cpp +++ b/cocos/ui/UILayout.cpp @@ -28,6 +28,7 @@ THE SOFTWARE. #include "ui/UIScale9Sprite.h" #include "renderer/CCGLProgram.h" #include "renderer/CCGLProgramCache.h" +#include "renderer/ccGLStateCache.h" #include "renderer/CCRenderState.h" #include "base/CCDirector.h" #include "2d/CCDrawingPrimitives.h" @@ -462,11 +463,10 @@ const Rect& Layout::getClippingRect() { if (_clippingRectDirty) { - Vec2 worldPos = convertToWorldSpace(Vec2::ZERO); - AffineTransform t = getNodeToWorldAffineTransform(); - float scissorWidth = _contentSize.width*t.a; - float scissorHeight = _contentSize.height*t.d; - Rect parentClippingRect; + const Vec2 worldPos = convertToWorldSpace(Vec2::ZERO); + const AffineTransform t = getNodeToWorldAffineTransform(); + const float scissorWidth = _contentSize.width * t.a; + const float scissorHeight = _contentSize.height * t.d; Layout* parent = this; while (parent) @@ -484,29 +484,29 @@ const Rect& Layout::getClippingRect() if (_clippingParent) { - parentClippingRect = _clippingParent->getClippingRect(); - float finalX = worldPos.x - (scissorWidth * _anchorPoint.x); - float finalY = worldPos.y - (scissorHeight * _anchorPoint.y); + const Rect& parentClippingRect = _clippingParent->getClippingRect(); + float finalX = worldPos.x; + float finalY = worldPos.y; float finalWidth = scissorWidth; float finalHeight = scissorHeight; - float leftOffset = worldPos.x - parentClippingRect.origin.x; + const float leftOffset = worldPos.x - parentClippingRect.origin.x; if (leftOffset < 0.0f) { finalX = parentClippingRect.origin.x; finalWidth += leftOffset; } - float rightOffset = (worldPos.x + scissorWidth) - (parentClippingRect.origin.x + parentClippingRect.size.width); + const float rightOffset = (worldPos.x + scissorWidth) - (parentClippingRect.origin.x + parentClippingRect.size.width); if (rightOffset > 0.0f) { finalWidth -= rightOffset; } - float topOffset = (worldPos.y + scissorHeight) - (parentClippingRect.origin.y + parentClippingRect.size.height); + const float topOffset = (worldPos.y + scissorHeight) - (parentClippingRect.origin.y + parentClippingRect.size.height); if (topOffset > 0.0f) { finalHeight -= topOffset; } - float bottomOffset = worldPos.y - parentClippingRect.origin.y; + const float bottomOffset = worldPos.y - parentClippingRect.origin.y; if (bottomOffset < 0.0f) { finalY = parentClippingRect.origin.y; @@ -527,8 +527,8 @@ const Rect& Layout::getClippingRect() } else { - _clippingRect.origin.x = worldPos.x - (scissorWidth * _anchorPoint.x); - _clippingRect.origin.y = worldPos.y - (scissorHeight * _anchorPoint.y); + _clippingRect.origin.x = worldPos.x; + _clippingRect.origin.y = worldPos.y; _clippingRect.size.width = scissorWidth; _clippingRect.size.height = scissorHeight; } diff --git a/cocos/ui/UILayoutManager.cpp b/cocos/ui/UILayoutManager.cpp index 03f7b5dbe151..6863a8fdcf54 100644 --- a/cocos/ui/UILayoutManager.cpp +++ b/cocos/ui/UILayoutManager.cpp @@ -183,7 +183,7 @@ Widget* RelativeLayoutManager::getRelativeWidget(Widget* widget) { Widget* relativeWidget = nullptr; RelativeLayoutParameter* layoutParameter = dynamic_cast(widget->getLayoutParameter()); - const std::string relativeName = layoutParameter->getRelativeToWidgetName(); + const std::string& relativeName = layoutParameter->getRelativeToWidgetName(); if (!relativeName.empty()) { diff --git a/cocos/ui/UILayoutParameter.cpp b/cocos/ui/UILayoutParameter.cpp index 7783e35e5edd..9abe0631bc9f 100644 --- a/cocos/ui/UILayoutParameter.cpp +++ b/cocos/ui/UILayoutParameter.cpp @@ -32,7 +32,7 @@ namespace ui { const Margin Margin::ZERO = Margin(0,0,0,0); -Margin::Margin(void) : left(0), top(0), right(0), bottom(0) +Margin::Margin() : left(0), top(0), right(0), bottom(0) { } diff --git a/cocos/ui/UIRadioButton.cpp b/cocos/ui/UIRadioButton.cpp index 52bd2342d0c0..d80f69d1cb3f 100644 --- a/cocos/ui/UIRadioButton.cpp +++ b/cocos/ui/UIRadioButton.cpp @@ -314,7 +314,7 @@ void RadioButtonGroup::setAllowedNoSelection(bool allowedNoSelection) _allowedNoSelection = allowedNoSelection; if(!_allowedNoSelection && _selectedRadioButton == nullptr) { - if (_radioButtons.size() > 0) + if (!_radioButtons.empty()) { setSelectedButton(_radioButtons.at(0)); } diff --git a/cocos/ui/UIRichText.cpp b/cocos/ui/UIRichText.cpp index 272a5817f893..a7931a248eff 100755 --- a/cocos/ui/UIRichText.cpp +++ b/cocos/ui/UIRichText.cpp @@ -25,10 +25,11 @@ #include "ui/UIRichText.h" +#include +#include #include +#include #include -#include -#include #include "platform/CCFileUtils.h" #include "platform/CCApplication.h" @@ -50,14 +51,14 @@ class ListenerComponent : public Component public: static const std::string COMPONENT_NAME; /*!< component name */ - static ListenerComponent* create(Node* parent, const std::string& url, const RichText::OpenUrlHandler handleOpenUrl = nullptr) + static ListenerComponent* create(Node* parent, const std::string& url, const RichText::OpenUrlHandler& handleOpenUrl = nullptr) { auto component = new (std::nothrow) ListenerComponent(parent, url, handleOpenUrl); component->autorelease(); return component; } - explicit ListenerComponent(Node* parent, const std::string& url, const RichText::OpenUrlHandler handleOpenUrl) + explicit ListenerComponent(Node* parent, const std::string& url, const RichText::OpenUrlHandler& handleOpenUrl) : _parent(parent) , _url(url) , _handleOpenUrl(handleOpenUrl) @@ -346,7 +347,7 @@ class MyXMLVisitor : public SAXDelegator void pushBackElement(RichElement* element); - static void setTagDescription(const std::string& tag, bool isFontElement, RichText::VisitEnterHandler handleVisitEnter); + static void setTagDescription(const std::string& tag, bool isFontElement, const RichText::VisitEnterHandler& handleVisitEnter); static void removeTagDescription(const std::string& tag); @@ -544,7 +545,7 @@ std::string MyXMLVisitor::getFace() const { for (auto i = _fontElements.rbegin(), iRend = _fontElements.rend(); i != iRend; ++i) { - if (i->face.size() != 0) + if (!i->face.empty()) return i->face; } return "fonts/Marker Felt.ttf"; @@ -554,7 +555,7 @@ std::string MyXMLVisitor::getURL() const { for (auto i = _fontElements.rbegin(), iRend = _fontElements.rend(); i != iRend; ++i) { - if (i->url.size() != 0) + if (!i->url.empty()) return i->url; } return ""; @@ -789,7 +790,7 @@ void MyXMLVisitor::textHandler(void* /*ctx*/, const char *str, size_t len) flags |= RichElementText::UNDERLINE_FLAG; if (strikethrough) flags |= RichElementText::STRIKETHROUGH_FLAG; - if (url.size() > 0) + if (!url.empty()) flags |= RichElementText::URL_FLAG; if (std::get<0>(outline)) flags |= RichElementText::OUTLINE_FLAG; @@ -820,7 +821,7 @@ void MyXMLVisitor::pushBackElement(RichElement* element) _richText->pushBackElement(element); } -void MyXMLVisitor::setTagDescription(const std::string& tag, bool isFontElement, RichText::VisitEnterHandler handleVisitEnter) +void MyXMLVisitor::setTagDescription(const std::string& tag, bool isFontElement, const RichText::VisitEnterHandler& handleVisitEnter) { MyXMLVisitor::_tagTables[tag] = {isFontElement, handleVisitEnter}; } @@ -1325,7 +1326,7 @@ std::string RichText::stringWithColor4B(const cocos2d::Color4B& color4b) return std::string(buf, 9); } -void RichText::setTagDescription(const std::string& tag, bool isFontElement, VisitEnterHandler handleVisitEnter) +void RichText::setTagDescription(const std::string& tag, bool isFontElement, const VisitEnterHandler& handleVisitEnter) { MyXMLVisitor::setTagDescription(tag, isFontElement, handleVisitEnter); } @@ -1472,7 +1473,7 @@ void RichText::formatText() case RichElement::Type::IMAGE: { RichElementImage* elmtImage = static_cast(element); - handleImageRenderer(elmtImage->_filePath, elmtImage->_color, elmtImage->_opacity, elmtImage->_width, elmtImage->_height, elmtImage->_url); + handleImageRenderer(elmtImage->_filePath, elmtImage->_textureType, elmtImage->_color, elmtImage->_opacity, elmtImage->_width, elmtImage->_height, elmtImage->_url); break; } case RichElement::Type::CUSTOM: @@ -1740,9 +1741,14 @@ void RichText::handleTextRenderer(const std::string& text, const std::string& fo } } -void RichText::handleImageRenderer(const std::string& filePath, const Color3B &/*color*/, GLubyte /*opacity*/, int width, int height, const std::string& url) +void RichText::handleImageRenderer(const std::string& filePath, Widget::TextureResType textureType, const Color3B &/*color*/, GLubyte /*opacity*/, int width, int height, const std::string& url) { - Sprite* imageRenderer = Sprite::create(filePath); + Sprite* imageRenderer; + if (textureType == Widget::TextureResType::LOCAL) + imageRenderer = Sprite::create(filePath); + else + imageRenderer = Sprite::createWithSpriteFrameName(filePath); + if (imageRenderer) { auto currentSize = imageRenderer->getContentSize(); @@ -1937,7 +1943,7 @@ void RichText::adaptRenderers() void RichText::pushToContainer(cocos2d::Node *renderer) { - if (_elementRenders.size() <= 0) + if (_elementRenders.empty()) { return; } diff --git a/cocos/ui/UIRichText.h b/cocos/ui/UIRichText.h index 4a119c2a9398..0a3f51f90feb 100644 --- a/cocos/ui/UIRichText.h +++ b/cocos/ui/UIRichText.h @@ -533,7 +533,7 @@ class CC_GUI_DLL RichText : public Widget * @param isFontElement use attributes of text tag * @param handleVisitEnter callback */ - static void setTagDescription(const std::string& tag, bool isFontElement, VisitEnterHandler handleVisitEnter); + static void setTagDescription(const std::string& tag, bool isFontElement, const VisitEnterHandler& handleVisitEnter); /** * @brief remove a callback to own tag. @@ -565,7 +565,7 @@ class CC_GUI_DLL RichText : public Widget const Color3B& outlineColor = Color3B::WHITE, int outlineSize = -1, const Color3B& shadowColor = Color3B::BLACK, const Size& shadowOffset = Size(2.0, -2.0), int shadowBlurRadius = 0, const Color3B& glowColor = Color3B::WHITE); - void handleImageRenderer(const std::string& filePath, const Color3B& color, GLubyte opacity, int width, int height, const std::string& url); + void handleImageRenderer(const std::string& filePath, Widget::TextureResType textureType, const Color3B& color, GLubyte opacity, int width, int height, const std::string& url); void handleCustomRenderer(Node* renderer); void formatRenderers(); void addNewLine(); diff --git a/cocos/ui/UISlider.cpp b/cocos/ui/UISlider.cpp index 2b9455e934f1..dc7cb2270049 100644 --- a/cocos/ui/UISlider.cpp +++ b/cocos/ui/UISlider.cpp @@ -455,13 +455,32 @@ void Slider::setPercent(int percent) { percent = 0; } - _percent = percent; - float res = 1.0 * percent / _maxPercent; + + // Only send event if value has changed + if (_percent != percent) + { + _percent = percent; + updateVisualSlider(); + percentChangedEvent(EventType::ON_PERCENTAGE_CHANGED); + } +} + +void Slider::updateVisualSlider() +{ + float res; + if (_maxPercent > 0) + { + res = 1.0f * _percent / _maxPercent; + } + else + { + res = 0.f; + } float dis = _barLength * res; _slidBallRenderer->setPosition(dis, _contentSize.height / 2.0f); if (_scale9Enabled) { - _progressBarRenderer->setPreferredSize(Size(dis,_contentSize.height)); + _progressBarRenderer->setPreferredSize(Size(dis, _contentSize.height)); } else { @@ -498,13 +517,11 @@ void Slider::onTouchMoved(Touch *touch, Event* /*unusedEvent*/) { _touchMovePosition = touch->getLocation(); setPercent(getPercentWithBallPos(_touchMovePosition)); - percentChangedEvent(EventType::ON_PERCENTAGE_CHANGED); } void Slider::onTouchEnded(Touch *touch, Event *unusedEvent) { Widget::onTouchEnded(touch, unusedEvent); - percentChangedEvent(EventType::ON_PERCENTAGE_CHANGED); percentChangedEvent(EventType::ON_SLIDEBALL_UP); } @@ -624,7 +641,7 @@ void Slider::barRendererScaleChangedWithSize() } } _barRenderer->setPosition(_contentSize.width / 2.0f, _contentSize.height / 2.0f); - setPercent(_percent); + updateVisualSlider(); } void Slider::progressBarRendererScaleChangedWithSize() @@ -666,7 +683,7 @@ void Slider::progressBarRendererScaleChangedWithSize() } } _progressBarRenderer->setPosition(0.0f, _contentSize.height / 2.0f); - setPercent(_percent); + updateVisualSlider(); } void Slider::onPressStateChangedToNormal() diff --git a/cocos/ui/UISlider.h b/cocos/ui/UISlider.h index cd9c8d0e7f59..8170a4c9aeb3 100644 --- a/cocos/ui/UISlider.h +++ b/cocos/ui/UISlider.h @@ -204,6 +204,11 @@ class CC_GUI_DLL Slider : public Widget */ void setPercent(int percent); + /** + * Updates the visual elements of the slider. + */ + void updateVisualSlider(); + /** * Gets the progress direction of slider. * diff --git a/cocos/ui/UIVideoPlayer-android.cpp b/cocos/ui/UIVideoPlayer-android.cpp index f0ad1199f6a8..344f7960ad6f 100644 --- a/cocos/ui/UIVideoPlayer-android.cpp +++ b/cocos/ui/UIVideoPlayer-android.cpp @@ -65,6 +65,26 @@ int createVideoWidgetJNI() return ret; } +void setLoopingJNI(int index, bool looping) +{ + JniMethodInfo t; + if (JniHelper::getStaticMethodInfo(t, videoHelperClassName.c_str(), "setLooping", "(IZ)V")) { + t.env->CallStaticVoidMethod(t.classID, t.methodID, index, looping); + + t.env->DeleteLocalRef(t.classID); + } +} + +void setUserInputEnabledJNI(int index, bool enableInput) +{ + JniMethodInfo t; + if (JniHelper::getStaticMethodInfo(t, videoHelperClassName.c_str(), "setUserInputEnabled", "(IZ)V")) { + t.env->CallStaticVoidMethod(t.classID, t.methodID, index, enableInput); + + t.env->DeleteLocalRef(t.classID); + } +} + //----------------------------------------------------------------------------------------------------------- using namespace cocos2d::experimental::ui; @@ -77,6 +97,10 @@ VideoPlayer::VideoPlayer() , _keepAspectRatioEnabled(false) , _videoPlayerIndex(-1) , _eventCallback(nullptr) +, _isPlaying(false) +, _isLooping(false) +, _isUserInputEnabled(true) +, _styleType(StyleType::DEFAULT) { _videoPlayerIndex = createVideoWidgetJNI(); s_allVideoPlayers[_videoPlayerIndex] = this; @@ -109,6 +133,23 @@ void VideoPlayer::setURL(const std::string& videoUrl) (int)Source::URL,_videoURL); } +void VideoPlayer::setLooping(bool looping) +{ + _isLooping = looping; + setLoopingJNI(_videoPlayerIndex, _isLooping); +} + +void VideoPlayer::setUserInputEnabled(bool enableInput) +{ + _isUserInputEnabled = enableInput; + setUserInputEnabledJNI(_videoPlayerIndex, enableInput); +} + +void VideoPlayer::setStyle(StyleType style) +{ + _styleType = style; +} + void VideoPlayer::draw(Renderer* renderer, const Mat4 &transform, uint32_t flags) { cocos2d::ui::Widget::draw(renderer,transform,flags); @@ -231,6 +272,16 @@ bool VideoPlayer::isPlaying() const return _isPlaying; } +bool VideoPlayer::isLooping() const +{ + return _isLooping; +} + +bool VideoPlayer::isUserInputEnabled() const +{ + return _isUserInputEnabled; +} + void VideoPlayer::setVisible(bool visible) { cocos2d::ui::Widget::setVisible(visible); @@ -294,6 +345,9 @@ void VideoPlayer::copySpecialProperties(Widget *widget) if (videoPlayer) { _isPlaying = videoPlayer->_isPlaying; + _isLooping = videoPlayer->_isLooping; + _isUserInputEnabled = videoPlayer->_isUserInputEnabled; + _styleType = videoPlayer->_styleType; _fullScreenEnabled = videoPlayer->_fullScreenEnabled; _fullScreenDirty = videoPlayer->_fullScreenDirty; _videoURL = videoPlayer->_videoURL; diff --git a/cocos/ui/UIVideoPlayer-ios.mm b/cocos/ui/UIVideoPlayer-ios.mm index 9b9b0867d31b..9000177dcd4a 100644 --- a/cocos/ui/UIVideoPlayer-ios.mm +++ b/cocos/ui/UIVideoPlayer-ios.mm @@ -32,13 +32,22 @@ of this software and associated documentation files (the "Software"), to deal //------------------------------------------------------------------------------------- #include "platform/ios/CCEAGLView-ios.h" -#import +#import +#import #include "base/CCDirector.h" #include "platform/CCFileUtils.h" @interface UIVideoViewWrapperIos : NSObject -@property (strong,nonatomic) MPMoviePlayerController * moviePlayer; +typedef NS_ENUM(NSInteger, PlayerbackState) { + PlayerbackStateUnknown = 0, + PlayerbackStatePaused, + PlayerbackStopped, + PlayerbackStatePlaying, + PlayerbackStateCompleted +}; + +@property (assign, nonatomic) AVPlayerViewController * playerController; - (void) setFrame:(int) left :(int) top :(int) width :(int) height; - (void) setURL:(int) videoSource :(std::string&) videoUrl; @@ -51,12 +60,13 @@ - (void) setVisible:(BOOL) visible; - (void) setKeepRatioEnabled:(BOOL) enabled; - (void) setFullScreenEnabled:(BOOL) enabled; - (BOOL) isFullScreenEnabled; +- (void) showPlaybackControls:(BOOL) value; +- (void) setRepeatEnabled:(BOOL)enabled; +- (void) setUserInteractionEnabled:(BOOL)userInteractionEnabled; --(id) init:(void*) videoPlayer; +-(id) init:(void*) videoPlayer; -(void) videoFinished:(NSNotification*) notification; --(void) playStateChange; - @end @@ -66,17 +76,26 @@ @implementation UIVideoViewWrapperIos int _top; int _width; int _height; - bool _keepRatioEnabled; - + BOOL _keepRatioEnabled; + BOOL _repeatEnabled; + BOOL _showPlaybackControls; + BOOL _userInteractionEnabled; + PlayerbackState _state; VideoPlayer* _videoPlayer; } -(id)init:(void*)videoPlayer { if (self = [super init]) { - self.moviePlayer = nullptr; + self.playerController = [AVPlayerViewController new]; + + [self setRepeatEnabled:FALSE]; + [self showPlaybackControls:TRUE]; + [self setUserInteractionEnabled:TRUE]; + [self setKeepRatioEnabled:FALSE]; + _videoPlayer = (VideoPlayer*)videoPlayer; - _keepRatioEnabled = false; + _state = PlayerbackStateUnknown; } return self; @@ -84,182 +103,172 @@ -(id)init:(void*)videoPlayer -(void) dealloc { - if (self.moviePlayer != nullptr) { - [[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:self.moviePlayer]; - [[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackStateDidChangeNotification object:self.moviePlayer]; - - [self.moviePlayer stop]; - [self.moviePlayer.view removeFromSuperview]; - self.moviePlayer = nullptr; - _videoPlayer = nullptr; - } + _videoPlayer = nullptr; + [self clean]; + [self.playerController release]; [super dealloc]; } +-(void) clean +{ + [self stop]; + [self removePlayerEventListener]; + [self.playerController.view removeFromSuperview]; +} + -(void) setFrame:(int)left :(int)top :(int)width :(int)height { _left = left; _width = width; _top = top; _height = height; - if (self.moviePlayer != nullptr) { - [self.moviePlayer.view setFrame:CGRectMake(left, top, width, height)]; - } + [self.playerController.view setFrame:CGRectMake(left, top, width, height)]; } -(void) setFullScreenEnabled:(BOOL) enabled { - if (self.moviePlayer != nullptr) { - [self.moviePlayer setFullscreen:enabled animated:(true)]; - } + // AVPlayerViewController doesn't provide API to enable fullscreen. But you can toggle + // fullsreen by the playback controllers. } -(BOOL) isFullScreenEnabled { - if (self.moviePlayer != nullptr) { - return [self.moviePlayer isFullscreen]; - } - return false; } --(void) setURL:(int)videoSource :(std::string &)videoUrl + +-(void) showPlaybackControls:(BOOL)value { - if (self.moviePlayer != nullptr) { - [[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:self.moviePlayer]; - [[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackStateDidChangeNotification object:self.moviePlayer]; + _showPlaybackControls = value; + self.playerController.showsPlaybackControls = value; +} - [self.moviePlayer stop]; - [self.moviePlayer.view removeFromSuperview]; - self.moviePlayer = nullptr; +-(void) setRepeatEnabled:(BOOL)enabled +{ + _repeatEnabled = enabled; + if (self.playerController.player) { + if (_repeatEnabled) + self.playerController.player.actionAtItemEnd = AVPlayerActionAtItemEndNone; + else + self.playerController.player.actionAtItemEnd = AVPlayerActionAtItemEndPause; } +} - if (videoSource == 1) { - self.moviePlayer = [[[MPMoviePlayerController alloc] init] autorelease]; - self.moviePlayer.movieSourceType = MPMovieSourceTypeStreaming; - [self.moviePlayer setContentURL:[NSURL URLWithString:@(videoUrl.c_str())]]; - } else { - self.moviePlayer = [[[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:@(videoUrl.c_str())]] autorelease]; - self.moviePlayer.movieSourceType = MPMovieSourceTypeFile; - } - self.moviePlayer.allowsAirPlay = false; - self.moviePlayer.controlStyle = MPMovieControlStyleEmbedded; - self.moviePlayer.view.userInteractionEnabled = true; - - auto clearColor = [UIColor clearColor]; - self.moviePlayer.backgroundView.backgroundColor = clearColor; - self.moviePlayer.view.backgroundColor = clearColor; - for (UIView * subView in self.moviePlayer.view.subviews) { - subView.backgroundColor = clearColor; - } +-(void) setUserInteractionEnabled:(BOOL)userInteractionEnabled +{ + _userInteractionEnabled = userInteractionEnabled; + self.playerController.view.userInteractionEnabled = _userInteractionEnabled; +} - if (_keepRatioEnabled) { - self.moviePlayer.scalingMode = MPMovieScalingModeAspectFit; - } else { - self.moviePlayer.scalingMode = MPMovieScalingModeFill; - } +-(void) setURL:(int)videoSource :(std::string &)videoUrl +{ + [self clean]; + + if (videoSource == 1) + self.playerController.player = [[[AVPlayer alloc] initWithURL:[NSURL URLWithString:@(videoUrl.c_str())]] autorelease]; + else + self.playerController.player = [[[AVPlayer alloc] initWithURL:[NSURL fileURLWithPath:@(videoUrl.c_str())]] autorelease]; + + [self setRepeatEnabled:_repeatEnabled]; + [self setKeepRatioEnabled:_keepRatioEnabled]; + [self setUserInteractionEnabled:_userInteractionEnabled]; + [self showPlaybackControls:_showPlaybackControls]; auto view = cocos2d::Director::getInstance()->getOpenGLView(); auto eaglview = (CCEAGLView *) view->getEAGLView(); - [eaglview addSubview:self.moviePlayer.view]; - - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(videoFinished:) name:MPMoviePlayerPlaybackDidFinishNotification object:self.moviePlayer]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playStateChange) name:MPMoviePlayerPlaybackStateDidChangeNotification object:self.moviePlayer]; + [eaglview addSubview:self.playerController.view]; + [self registerPlayerEventListener]; } -(void) videoFinished:(NSNotification *)notification { - if(_videoPlayer != nullptr) - { - if([self.moviePlayer playbackState] != MPMoviePlaybackStateStopped) - { - _videoPlayer->onPlayEvent((int)VideoPlayer::EventType::COMPLETED); - } - } -} + if(_videoPlayer != nullptr) { + _videoPlayer->onPlayEvent((int)VideoPlayer::EventType::COMPLETED); + _state = PlayerbackStateCompleted; --(void) playStateChange -{ - MPMoviePlaybackState state = [self.moviePlayer playbackState]; - switch (state) { - case MPMoviePlaybackStatePaused: - _videoPlayer->onPlayEvent((int)VideoPlayer::EventType::PAUSED); - break; - case MPMoviePlaybackStateStopped: - _videoPlayer->onPlayEvent((int)VideoPlayer::EventType::STOPPED); - break; - case MPMoviePlaybackStatePlaying: - _videoPlayer->onPlayEvent((int)VideoPlayer::EventType::PLAYING); - break; - case MPMoviePlaybackStateInterrupted: - break; - case MPMoviePlaybackStateSeekingBackward: - break; - case MPMoviePlaybackStateSeekingForward: - break; - default: - break; + if (_repeatEnabled) { + [self seekTo:0]; + [self play]; + } } } -(void) seekTo:(float)sec { - if (self.moviePlayer != NULL) { - [self.moviePlayer setCurrentPlaybackTime:(sec)]; - } + if (self.playerController.player) + [self.playerController.player seekToTime:CMTimeMake(sec, 1)]; } -(void) setVisible:(BOOL)visible { - if (self.moviePlayer != NULL) { - [self.moviePlayer.view setHidden:!visible]; - } + [self.playerController.view setHidden:!visible]; } -(void) setKeepRatioEnabled:(BOOL)enabled { _keepRatioEnabled = enabled; - if (self.moviePlayer != NULL) { - if (enabled) { - self.moviePlayer.scalingMode = MPMovieScalingModeAspectFit; - } else { - self.moviePlayer.scalingMode = MPMovieScalingModeFill; - } - } + if (_keepRatioEnabled) + self.playerController.videoGravity = AVLayerVideoGravityResizeAspect; + else + self.playerController.videoGravity = AVLayerVideoGravityResizeAspectFill; } -(void) play { - if (self.moviePlayer != NULL) { - [self.moviePlayer.view setFrame:CGRectMake(_left, _top, _width, _height)]; - [self.moviePlayer play]; + if (self.playerController.player && _state != PlayerbackStatePlaying) { + [self.playerController.player play]; + _state = PlayerbackStatePlaying; + _videoPlayer->onPlayEvent((int)VideoPlayer::EventType::PLAYING); } } -(void) pause { - if (self.moviePlayer != NULL) { - [self.moviePlayer pause]; + if (self.playerController.player && _state == PlayerbackStatePlaying) { + [self.playerController.player pause]; + _state = PlayerbackStatePaused; + _videoPlayer->onPlayEvent((int)VideoPlayer::EventType::PAUSED); } } -(void) resume { - if (self.moviePlayer != NULL) { - if([self.moviePlayer playbackState] == MPMoviePlaybackStatePaused) - { - [self.moviePlayer play]; - } - } + if (self.playerController.player && _state == PlayerbackStatePaused) + [self play]; } -(void) stop { - if (self.moviePlayer != NULL) { - [self.moviePlayer stop]; + // AVPlayer doesn't have stop, so just pause it, and seek time to 0. + if (self.playerController.player && _state != PlayerbackStopped) { + [self seekTo:0]; + [self.playerController.player pause]; + _state = PlayerbackStopped; + + // stop() will be invoked in dealloc, which is invoked by _videoPlayer's destructor, + // so do't send the message when _videoPlayer is being deleted. + if (_videoPlayer) + _videoPlayer->onPlayEvent((int)VideoPlayer::EventType::STOPPED); } } +-(void) registerPlayerEventListener +{ + if (self.playerController.player) + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(videoFinished:) + name:AVPlayerItemDidPlayToEndTimeNotification + object:self.playerController.player.currentItem]; +} + +-(void) removePlayerEventListener +{ + if (self.playerController.player) + [[NSNotificationCenter defaultCenter] removeObserver:self + name:AVPlayerItemDidPlayToEndTimeNotification + object:self.playerController.player.currentItem]; +} + @end //------------------------------------------------------------------------------------------------------------ @@ -270,6 +279,9 @@ -(void) stop , _keepAspectRatioEnabled(false) , _videoPlayerIndex(-1) , _eventCallback(nullptr) +, _isLooping(false) +, _isUserInputEnabled(true) +, _styleType(StyleType::DEFAULT) { _videoView = [[UIVideoViewWrapperIos alloc] init:this]; @@ -301,6 +313,33 @@ -(void) stop [((UIVideoViewWrapperIos*)_videoView) setURL:(int)_videoSource :_videoURL]; } +void VideoPlayer::setLooping(bool looping) +{ + _isLooping = looping; + [((UIVideoViewWrapperIos*)_videoView) setRepeatEnabled:_isLooping]; +} + +void VideoPlayer::setUserInputEnabled(bool enableInput) +{ + _isUserInputEnabled = enableInput; + [((UIVideoViewWrapperIos*)_videoView) setUserInteractionEnabled:enableInput]; +} + +void VideoPlayer::setStyle(StyleType style) +{ + _styleType = style; + + switch (style) { + case StyleType::DEFAULT: + [((UIVideoViewWrapperIos*)_videoView) showPlaybackControls:TRUE]; + break; + + case StyleType::NONE: + [((UIVideoViewWrapperIos*)_videoView) showPlaybackControls:FALSE]; + break; + } +} + void VideoPlayer::draw(Renderer* renderer, const Mat4 &transform, uint32_t flags) { cocos2d::ui::Widget::draw(renderer,transform,flags); @@ -403,6 +442,16 @@ -(void) stop return _isPlaying; } +bool VideoPlayer::isLooping() const +{ + return _isLooping; +} + +bool VideoPlayer::isUserInputEnabled() const +{ + return _isUserInputEnabled; +} + void VideoPlayer::setVisible(bool visible) { cocos2d::ui::Widget::setVisible(visible); @@ -462,6 +511,9 @@ -(void) stop if (videoPlayer) { _isPlaying = videoPlayer->_isPlaying; + _isLooping = videoPlayer->_isLooping; + _isUserInputEnabled = videoPlayer->_isUserInputEnabled; + _styleType = videoPlayer->_styleType; _fullScreenEnabled = videoPlayer->_fullScreenEnabled; _fullScreenDirty = videoPlayer->_fullScreenDirty; _videoURL = videoPlayer->_videoURL; diff --git a/cocos/ui/UIVideoPlayer-tizen.cpp b/cocos/ui/UIVideoPlayer-tizen.cpp index 132fad543b12..ee9480fa35fd 100644 --- a/cocos/ui/UIVideoPlayer-tizen.cpp +++ b/cocos/ui/UIVideoPlayer-tizen.cpp @@ -60,6 +60,7 @@ class _VideoPlayerTizen _image = evas_object_image_filled_add(evas); evas_object_show(_image); player_create(&_player); + player_set_looping(_player, videoPlayer->isLooping() ); evas_object_event_callback_add(_image, EVAS_CALLBACK_MOUSE_UP, _VideoPlayerTizen::mouse_up_cb, this); eext_object_event_callback_add(app->_win, EEXT_CALLBACK_BACK, _VideoPlayerTizen::win_back_cb, this); @@ -80,14 +81,17 @@ class _VideoPlayerTizen static void mouse_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) { - _VideoPlayerTizen* videoPlayerTizen = (_VideoPlayerTizen*)data; - if (videoPlayerTizen->_videoPlayer->isPlaying()) - { - videoPlayerTizen->_videoPlayer->pause(); - } - else + if (_videoPlayer->_isUserInputEnabled()) { - videoPlayerTizen->_videoPlayer->resume(); + _VideoPlayerTizen* videoPlayerTizen = (_VideoPlayerTizen*)data; + if (videoPlayerTizen->_videoPlayer->isPlaying()) + { + videoPlayerTizen->_videoPlayer->pause(); + } + else + { + videoPlayerTizen->_videoPlayer->resume(); + } } } @@ -122,6 +126,9 @@ VideoPlayer::VideoPlayer() , _fullScreenEnabled(false) , _fullScreenDirty(false) , _keepAspectRatioEnabled(false) +, _isLooping(false) +, _isUserInputEnabled(true) +, _styleType(StyleType::DEFAULT) { _videoView = (void*) new (std::nothrow) _VideoPlayerTizen(this); @@ -159,6 +166,24 @@ void VideoPlayer::setURL(const std::string& videoUrl) player_set_uri(impl->_player, videoUrl.c_str()); } +void VideoPlayer::setLooping(bool looping) +{ + _isLooping = looping; + _VideoPlayerTizen* impl = (_VideoPlayerTizen*)_videoView; + player_set_looping(impl->_player, looping ); +} + +void VideoPlayer::setUserInputEnabled(bool enableInput) +{ + _isUserInputEnabled = enableInput + +} + +void VideoPlayer::setStyle(StyleType style) +{ + _styleType = style; +} + void VideoPlayer::draw(Renderer* renderer, const Mat4 &transform, uint32_t flags) { cocos2d::ui::Widget::draw(renderer,transform,flags); @@ -436,6 +461,9 @@ void VideoPlayer::copySpecialProperties(Widget *widget) if (videoPlayer) { _isPlaying = videoPlayer->_isPlaying; + _isLooping = videoPlayer->_isLooping; + _isUserInputEnabled = videoPlayer->_isUserInputEnabled; + _styleType = videoPlayer->_styleType; _fullScreenEnabled = videoPlayer->_fullScreenEnabled; _fullScreenDirty = videoPlayer->_fullScreenDirty; _videoURL = videoPlayer->_videoURL; diff --git a/cocos/ui/UIVideoPlayer.h b/cocos/ui/UIVideoPlayer.h index 71bc51b7026e..4e8be1c9c5c9 100644 --- a/cocos/ui/UIVideoPlayer.h +++ b/cocos/ui/UIVideoPlayer.h @@ -58,7 +58,19 @@ namespace experimental{ PLAYING = 0, PAUSED, STOPPED, - COMPLETED + COMPLETED, + ERROR + }; + + /** + * Styles of how the the video player is presented + * For now only used on iOS to use either MPMovieControlStyleEmbedded (DEFAULT) or + * MPMovieControlStyleNone (NONE) + */ + enum class StyleType + { + DEFAULT = 0, + NONE }; /** @@ -95,6 +107,27 @@ namespace experimental{ * @return A remoting URL address. */ virtual const std::string& getURL() const { return _videoURL;} + + /** + * @brief Set if playback is done in loop mode + * + * @param looping the video will or not automatically restart at the end + */ + virtual void setLooping(bool looping); + + /** + * Set if the player will enable user input for basic pause and resume of video + * + * @param enableInput If true, input will be handled for basic functionality (pause/resume) + */ + virtual void setUserInputEnabled(bool enableInput); + + /** + * Set the style of the player + * + * @param style The corresponding style + */ + virtual void setStyle(StyleType style); /** * Starts playback. @@ -129,6 +162,22 @@ namespace experimental{ * @return True if currently playing, false otherwise. */ virtual bool isPlaying() const; + + /** + * Checks whether the VideoPlayer is set with looping mode. + * + * @return true if the videoplayer is set to loop, false otherwise. + */ + virtual bool isLooping() const; + + + /** + * Checks whether the VideoPlayer is set to listen user input to resume and pause the video + * + * @return true if the videoplayer user input is set, false otherwise. + */ + virtual bool isUserInputEnabled() const; + /** * Causes the video player to keep aspect ratio or no when displaying the video. @@ -196,16 +245,20 @@ namespace experimental{ }; bool _isPlaying; + bool _isLooping; + bool _isUserInputEnabled; bool _fullScreenDirty; bool _fullScreenEnabled; bool _keepAspectRatioEnabled; + StyleType _styleType; + std::string _videoURL; Source _videoSource; int _videoPlayerIndex; ccVideoPlayerCallback _eventCallback; - + void* _videoView; }; } diff --git a/cocos/ui/UIWebViewImpl-ios.mm b/cocos/ui/UIWebViewImpl-ios.mm index 2ed5d885c03a..a41b1c79c3e1 100644 --- a/cocos/ui/UIWebViewImpl-ios.mm +++ b/cocos/ui/UIWebViewImpl-ios.mm @@ -28,6 +28,10 @@ of this software and associated documentation files (the "Software"), to deal // Webview not available on tvOS #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) && !defined(CC_TARGET_OS_TVOS) +#import +#import +#import + #include "ui/UIWebViewImpl-ios.h" #include "renderer/CCRenderer.h" #include "base/CCDirector.h" @@ -36,30 +40,6 @@ of this software and associated documentation files (the "Software"), to deal #include "platform/CCFileUtils.h" #include "ui/UIWebView.h" -static std::string getFixedBaseUrl(const std::string& baseUrl) -{ - std::string fixedBaseUrl; - if (baseUrl.empty() || baseUrl.at(0) != '/') { - fixedBaseUrl = [[[NSBundle mainBundle] resourcePath] UTF8String]; - fixedBaseUrl += "/"; - fixedBaseUrl += baseUrl; - } - else { - fixedBaseUrl = baseUrl; - } - - size_t pos = 0; - while ((pos = fixedBaseUrl.find(" ")) != std::string::npos) { - fixedBaseUrl.replace(pos, 1, "%20"); - } - - if (fixedBaseUrl.at(fixedBaseUrl.length() - 1) != '/') { - fixedBaseUrl += "/"; - } - - return fixedBaseUrl; -} - @interface UIWebViewWrapper : NSObject @property (nonatomic) std::function shouldStartLoading; @property (nonatomic) std::function didFinishLoading; @@ -107,8 +87,9 @@ - (void)setScalesPageToFit:(const bool)scalesPageToFit; @end -@interface UIWebViewWrapper () -@property(nonatomic, retain) UIWebView *uiWebView; +@interface UIWebViewWrapper () +@property(nonatomic) WKWebView *wkWebView; + @property(nonatomic, copy) NSString *jsScheme; @end @@ -123,7 +104,7 @@ + (instancetype) newWebViewWrapper { - (instancetype)init { self = [super init]; if (self) { - self.uiWebView = nil; + self.wkWebView = nil; self.shouldStartLoading = nullptr; self.didFinishLoading = nullptr; self.didFailLoading = nullptr; @@ -132,56 +113,58 @@ - (instancetype)init { } - (void)dealloc { - self.uiWebView.delegate = nil; - [self.uiWebView removeFromSuperview]; - [self.uiWebView release]; - self.uiWebView = nil; + self.wkWebView.UIDelegate = nil; + self.wkWebView.navigationDelegate = nil; + [self.wkWebView removeFromSuperview]; + [self.wkWebView release]; + self.wkWebView = nil; self.jsScheme = nil; [super dealloc]; } - (void)setupWebView { - if (!self.uiWebView) { - self.uiWebView = [[UIWebView alloc] init]; - self.uiWebView.delegate = self; + if (!self.wkWebView) { + self.wkWebView = [[WKWebView alloc] init]; + self.wkWebView.UIDelegate = self; + self.wkWebView.navigationDelegate = self; } - if (!self.uiWebView.superview) { + if (!self.wkWebView.superview) { auto view = cocos2d::Director::getInstance()->getOpenGLView(); auto eaglview = (CCEAGLView *) view->getEAGLView(); - [eaglview addSubview:self.uiWebView]; + [eaglview addSubview:self.wkWebView]; } } - (void)setVisible:(bool)visible { - if (!self.uiWebView) {[self setupWebView];} - self.uiWebView.hidden = !visible; + if (!self.wkWebView) {[self setupWebView];} + self.wkWebView.hidden = !visible; } - (void)setBounces:(bool)bounces { - self.uiWebView.scrollView.bounces = bounces; + self.wkWebView.scrollView.bounces = bounces; } - (void)setOpacityWebView:(float)opacity { - if (!self.uiWebView) {[self setupWebView];} - self.uiWebView.alpha=opacity; - [self.uiWebView setOpaque:NO]; + if (!self.wkWebView) { [self setupWebView]; } + self.wkWebView.alpha = opacity; + [self.wkWebView setOpaque:YES]; } -(float) getOpacityWebView{ - return self.uiWebView.alpha; + return self.wkWebView.alpha; } -(void) setBackgroundTransparent{ - if (!self.uiWebView) {[self setupWebView];} - [self.uiWebView setOpaque:NO]; - [self.uiWebView setBackgroundColor:[UIColor clearColor]]; + if (!self.wkWebView) {[self setupWebView];} + [self.wkWebView setOpaque:NO]; + [self.wkWebView setBackgroundColor:[UIColor clearColor]]; } - (void)setFrameWithX:(float)x y:(float)y width:(float)width height:(float)height { - if (!self.uiWebView) {[self setupWebView];} + if (!self.wkWebView) {[self setupWebView];} CGRect newFrame = CGRectMake(x, y, width, height); - if (!CGRectEqualToRect(self.uiWebView.frame, newFrame)) { - self.uiWebView.frame = CGRectMake(x, y, width, height); + if (!CGRectEqualToRect(self.wkWebView.frame, newFrame)) { + self.wkWebView.frame = CGRectMake(x, y, width, height); } } @@ -190,19 +173,26 @@ - (void)setJavascriptInterfaceScheme:(const std::string &)scheme { } - (void)loadData:(const std::string &)data MIMEType:(const std::string &)MIMEType textEncodingName:(const std::string &)encodingName baseURL:(const std::string &)baseURL { - [self.uiWebView loadData:[NSData dataWithBytes:data.c_str() length:data.length()] + auto path = [[NSBundle mainBundle] resourcePath]; + path = [path stringByAppendingPathComponent:@(baseURL.c_str() )]; + auto url = [NSURL fileURLWithPath:path]; + + [self.wkWebView loadData:[NSData dataWithBytes:data.c_str() length:data.length()] MIMEType:@(MIMEType.c_str()) - textEncodingName:@(encodingName.c_str()) - baseURL:[NSURL URLWithString:@(getFixedBaseUrl(baseURL).c_str())]]; + characterEncodingName:@(encodingName.c_str()) + baseURL:url]; } - (void)loadHTMLString:(const std::string &)string baseURL:(const std::string &)baseURL { - if (!self.uiWebView) {[self setupWebView];} - [self.uiWebView loadHTMLString:@(string.c_str()) baseURL:[NSURL URLWithString:@(getFixedBaseUrl(baseURL).c_str())]]; + if (!self.wkWebView) {[self setupWebView];} + auto path = [[NSBundle mainBundle] resourcePath]; + path = [path stringByAppendingPathComponent:@(baseURL.c_str() )]; + auto url = [NSURL fileURLWithPath:path]; + [self.wkWebView loadHTMLString:@(string.c_str()) baseURL:url]; } - (void)loadUrl:(const std::string &)urlString cleanCachedData:(BOOL) needCleanCachedData { - if (!self.uiWebView) {[self setupWebView];} + if (!self.wkWebView) {[self setupWebView];} NSURL *url = [NSURL URLWithString:@(urlString.c_str())]; NSURLRequest *request = nil; @@ -211,83 +201,107 @@ - (void)loadUrl:(const std::string &)urlString cleanCachedData:(BOOL) needCleanC else request = [NSURLRequest requestWithURL:url]; - [self.uiWebView loadRequest:request]; + [self.wkWebView loadRequest:request]; } - - - (void)loadFile:(const std::string &)filePath { - if (!self.uiWebView) {[self setupWebView];} + if (!self.wkWebView) {[self setupWebView];} NSURL *url = [NSURL fileURLWithPath:@(filePath.c_str())]; NSURLRequest *request = [NSURLRequest requestWithURL:url]; - [self.uiWebView loadRequest:request]; + [self.wkWebView loadRequest:request]; } - (void)stopLoading { - [self.uiWebView stopLoading]; + [self.wkWebView stopLoading]; } - (void)reload { - [self.uiWebView reload]; + [self.wkWebView reload]; } - (BOOL)canGoForward { - return self.uiWebView.canGoForward; + return self.wkWebView.canGoForward; } - (BOOL)canGoBack { - return self.uiWebView.canGoBack; + return self.wkWebView.canGoBack; } - (void)goBack { - [self.uiWebView goBack]; + [self.wkWebView goBack]; } - (void)goForward { - [self.uiWebView goForward]; + [self.wkWebView goForward]; } - (void)evaluateJS:(const std::string &)js { - if (!self.uiWebView) {[self setupWebView];} - [self.uiWebView stringByEvaluatingJavaScriptFromString:@(js.c_str())]; + if (!self.wkWebView) {[self setupWebView];} + [self.wkWebView evaluateJavaScript:@(js.c_str()) completionHandler:nil]; } - (void)setScalesPageToFit:(const bool)scalesPageToFit { - if (!self.uiWebView) {[self setupWebView];} - self.uiWebView.scalesPageToFit = scalesPageToFit; +// TODO: there is not corresponding API in WK. +// https://stackoverflow.com/questions/26295277/wkwebview-equivalent-for-uiwebviews-scalespagetofit/43048514 seems has a solution, +// but it doesn't support setting it dynamically. If we want to set this feature dynamically, then it will be too complex. } -#pragma mark - UIWebViewDelegate -- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { - NSString *url = [[request URL] absoluteString]; - if ([[[request URL] scheme] isEqualToString:self.jsScheme]) { +#pragma mark - WKNavigationDelegate +- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler { + NSString *url = [[[navigationAction request] URL] absoluteString]; + if ([[webView.URL scheme] isEqualToString:self.jsScheme]) { self.onJsCallback([url UTF8String]); - return NO; + decisionHandler(WKNavigationActionPolicyCancel); + return; } if (self.shouldStartLoading && url) { - return self.shouldStartLoading([url UTF8String]); + if (self.shouldStartLoading([url UTF8String]) ) + decisionHandler(WKNavigationActionPolicyAllow); + else + decisionHandler(WKNavigationActionPolicyCancel); + + return; } - return YES; + + decisionHandler(WKNavigationActionPolicyAllow); } -- (void)webViewDidFinishLoad:(UIWebView *)webView { +- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation { if (self.didFinishLoading) { - NSString *url = [[webView.request URL] absoluteString]; + NSString *url = [webView.URL absoluteString]; self.didFinishLoading([url UTF8String]); } } -- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error { +- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(NSError *)error { if (self.didFailLoading) { - NSString *url = error.userInfo[NSURLErrorFailingURLStringErrorKey]; - if (url) { - self.didFailLoading([url UTF8String]); + NSString *errorInfo = error.userInfo[NSURLErrorFailingURLStringErrorKey]; + if (errorInfo) { + self.didFailLoading([errorInfo UTF8String]); } } } +#pragma WKUIDelegate + +// Implement js alert function. +- (void)webView:(WKWebView *)webView runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)())completionHandler +{ + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:message + message:nil + preferredStyle:UIAlertControllerStyleAlert]; + [alertController addAction:[UIAlertAction actionWithTitle:@"Ok" + style:UIAlertActionStyleCancel + handler:^(UIAlertAction *action) { + completionHandler(); + }]]; + + auto rootViewController = [UIApplication sharedApplication].keyWindow.rootViewController; + [rootViewController presentViewController:alertController animated:YES completion:^{}]; +} + @end diff --git a/cocos/ui/UIWidget.h b/cocos/ui/UIWidget.h index 17a7b1eadd5d..d436e6ee15a2 100644 --- a/cocos/ui/UIWidget.h +++ b/cocos/ui/UIWidget.h @@ -159,7 +159,7 @@ class CC_GUI_DLL Widget : public ProtectedNode, public LayoutParameterProtocol * @js ctor * @lua new */ - Widget(void); + Widget(); /** * Default destructor diff --git a/cocos/vr/CCVRGenericRenderer.cpp b/cocos/vr/CCVRGenericRenderer.cpp index 8d10af437135..c67bb3b9cb9d 100644 --- a/cocos/vr/CCVRGenericRenderer.cpp +++ b/cocos/vr/CCVRGenericRenderer.cpp @@ -30,6 +30,7 @@ #include "vr/CCVRGenericHeadTracker.h" #include "renderer/CCRenderer.h" #include "renderer/CCGLProgramState.h" +#include "renderer/ccGLStateCache.h" #include "base/CCDirector.h" #include "2d/CCScene.h" #include "2d/CCCamera.h" @@ -125,8 +126,7 @@ void VRGenericRenderer::render(Scene* scene, Renderer* renderer) _fb->restoreFBO(); auto texture = _fb->getRenderTarget()->getTexture(); - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, texture->getName()); + GL::bindTexture2D(texture->getName()); _glProgramState->apply(Mat4::IDENTITY); GLint origViewport[4]; diff --git a/docs/CODING_STYLE.md b/docs/CODING_STYLE.md index 808cf7a0c86e..0d37d76a39e4 100644 --- a/docs/CODING_STYLE.md +++ b/docs/CODING_STYLE.md @@ -2453,7 +2453,7 @@ if (condition) { } ``` -## Loops and Switch Statements +## Loops and Switch Statement Switch statements may use braces for blocks. Annotate non-trivial fall-through between cases. Empty loop bodies should use {} or continue. diff --git a/docs/RELEASE_NOTES.md b/docs/RELEASE_NOTES.md index da4ca4b8055f..7d2c5d4770a4 100644 --- a/docs/RELEASE_NOTES.md +++ b/docs/RELEASE_NOTES.md @@ -2,69 +2,20 @@ **Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* -- [Cocos2d-x 3.17 Release Notes](#cocos2d-x-317-release-notes) - - [Android requirements](#android-requirements) +- [Cocos2d-x 3.17.2 Release Notes](#cocos2d-x-3172-release-notes) - [Highlights](#highlights) - - [added support for iPhone X](#added-support-for-iphone-x) - - [added support Android Studio 3.0+](#added-support-android-studio-30) - - [CMake is now supported on all platforms](#cmake-is-now-supported-on-all-platforms) - - [upgrade 3rd-party libraries](#upgrade-3rd-party-libraries) - - [remove outdated](#remove-outdated) - - [misc bugs fix and stability improvements](#misc-bugs-fix-and-stability-improvements) -# Cocos2d-x 3.17 Release Notes # -The 3.17 release focuses on stability and increased performance with some under the hood enhancements that will make cross-platform development easier. +# Cocos2d-x 3.17.2 Release Notes # -## Android requirements - -v3.17 has been tested using Android Studio (3.0, 3.1, 3.1.1) with NDK r16 +Version 3.17.2 focuses on bugs fixing and performance opimization on OPPO devices. ## Highlights -- added support for iPhone X -- added support Android Studio 3.0+ -- CMake is now supported on all platforms -- upgraded Spine runtime to v3.6.39 -- upgraded GLFW to 3.2.1 -- misc bugs fix and stability improvements - -### added support for iPhone X - -3.17 brings support for iPhone X including supporting full screen mode, using Storyboards for launch images, __safe area__ API and support for auto hiding the Home indicator. It is important to note exactly what and where the safe area is: - -

- -

- -Developers can get the safe area easily by calling: `Director::getSafeAreaRect()`. - -### added support Android Studio 3.0+ - -Android Studio is the only official IDE for Google's Android operating system. -Cocos2d-x supports Android Studio using NDK version r16 to r16. Gradle configurations have been updated, including simplifying Gradle PROP_* values, changing the deprecated `compile` to the new `implementation`in dependency declaration, and added Proguard configuration to reduce Release package size. - -### CMake is now supported on all platforms - -CMake is now supported on all platforms, including Android(NDK), iOS, macOS, Windows (VC++ compiler), Linux. Supports precompile libraries for engine, and reusing precompiled libraries in the new build process. Your projects build time will be greatly reduced. For detailed usage, please refer to [CMake Doc](https://github.com/cocos2d/cocos2d-x/blob/v3/cmake/README.md) - -### upgrade 3rd-party libraries - -Spine skeleton animation is widely used in games developed by Cocos2d-x. Spine runtime has been upgraded to 3.6.39 to keep current. - -GLFW has been upgraded to 3.2.1 to help fix joystick issues. You can also now use GLFW as a precompiled library. - -Box2D hasn't been updated in quite some time. A new production version has yet to be released so far in 2018. We felt GitHub commit f655c603ba9d83 was stable. You can also now use Box2D as a precompiled library. - -Each Cocos2d-x release comes with a specific version of third-party libraries. If you want to upgrade third-party libraries due to your projects needs, please refer to: [3rd-party Doc](https://github.com/cocos2d/cocos2d-x-3rd-party-libs-src/blob/v3/README.md) - -### remove outdated - -Google officially deprecated ant build support starting in [Android SDK Tools 25.3.0](http://tools.android.com/recent/androidsdktoolsrevision2530feb2017). The old ant based `proj.android` and been dropped and now `proj.android` is an Android Studio project. The default architecture is changed from `armeabi` to `armeabi-v7a`. - -Visual Studio 2013 support has been dropped. Visual Studio 2015/2017 are still currently supported. The existing win32 project files is quite suitable for 2015. To use 2017, you can open a 2015 project file, modify the configuration to suit your needs, or use CMake (See above). - -### misc bugs fix and stability improvements +- Performance optimization on OPPO devices +- Fixed bug that`FileUtils::listFiles()` can not work correctly if the file path starts with `assets/` on Android +- Fixed crash caused by Audio on iOS +- Fixed bug that `VideoPlayer` can not play video in obb file on Android -This release contains more than 51 bugs fixed and 33 misc improvements, please refer to [Changelog](https://github.com/cocos2d/cocos2d-x/blob/v3/CHANGELOG) +More detail change log please refer to [ChangeLog](https://github.com/cocos2d/cocos2d-x/blob/v3/CHANGELOG). diff --git a/docs/RELEASE_NOTES_CN.md b/docs/RELEASE_NOTES_CN.md index e8cb6991cca5..ce7673ca70d0 100644 --- a/docs/RELEASE_NOTES_CN.md +++ b/docs/RELEASE_NOTES_CN.md @@ -2,79 +2,20 @@ **Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* -- [Cocos2d-x 3.17 Release Notes](#cocos2d-x-317-release-notes) - - [测试环境](#%E6%B5%8B%E8%AF%95%E7%8E%AF%E5%A2%83) - - [版本特性](#%E7%89%88%E6%9C%AC%E7%89%B9%E6%80%A7) - - [详细介绍](#%E8%AF%A6%E7%BB%86%E4%BB%8B%E7%BB%8D) - - [支持 iPhone X](#%E6%94%AF%E6%8C%81-iphone-x) - - [支持 Android Studio 3.0+](#%E6%94%AF%E6%8C%81-android-studio-30) - - [CMake 支持全平台](#cmake-%E6%94%AF%E6%8C%81%E5%85%A8%E5%B9%B3%E5%8F%B0) - - [升级第三方库](#%E5%8D%87%E7%BA%A7%E7%AC%AC%E4%B8%89%E6%96%B9%E5%BA%93) - - [移除过时的内容](#%E7%A7%BB%E9%99%A4%E8%BF%87%E6%97%B6%E7%9A%84%E5%86%85%E5%AE%B9) - - [Bugs 修复,提高稳定性](#bugs-%E4%BF%AE%E5%A4%8D%E6%8F%90%E9%AB%98%E7%A8%B3%E5%AE%9A%E6%80%A7) +- [Cocos2d-x 3.17.2 Release Notes](#cocos2d-x-3172-release-notes) + - [版本变动](#%E7%89%88%E6%9C%AC%E5%8F%98%E5%8A%A8) -# Cocos2d-x 3.17 Release Notes # +# Cocos2d-x 3.17.2 Release Notes # -Cocos2d-x 3.17 版本着重于工具链的更新,和稳定性的增强。 +Cocos2d-x 3.17.2 侧重于稳定性的提升, 已有问题的修复和针对 OPPO 手机的性能优化。 -## 测试环境 +## 版本变动 - Android 平台使用 Android Studio (3.0, 3.1, 3.1.1) 和 NDK r16 进行测试。 - -## 版本特性 - -- 支持 iPhone X -- 支持 Android Studio 3.0+ -- CMake 支持全平台,支持预编译引擎库 -- 升级 Spine runtime 至 v3.6.39 -- 升级 GLFW 至 3.2.1,并提供预编译库 -- 更新 Box2D,并提供预编译库 -- 去除 Android 的 ant 工程 -- 去除 Visual Studio 2013 的支持 - -## 详细介绍 - -### 支持 iPhone X - -3.17 带来对 iPhone X 的支持,包含支持全屏模式,支持自动隐藏 Home 指示器,改用 Storyboard 作为启动屏幕,和增加获取 Safe Area 的接口。在开发支持 iPhone X 的应用时,最需要了解清楚的就是 Safe Area: - -

- -

- -开发者可以通过调用 `Director::getSafeAreaRect()` 来获取 Safe Area 区域。 - -### 支持 Android Studio 3.0+ - -Android Studio 是 Google 官方唯一支持的 Android 开发 IDE。 - -该版本增加了对 Android Studio 3.0+ 的支持。在支持的过程中,同时将 NDK 版本从 r14 升级到 r16。对 Gradle 工程配置也进行了诸多改进,包括简化 Gradle 变量 PROP_*,将依赖声明中弃用的 `compile` 改为新的 `implementation`,增加用以削减 Release 包体积的 Proguard 文件。 - -### CMake 支持全平台 - -扩展 CMake 构建支持至全平台,包括 Android (NDK)、iOS、macOS、Linux、Windows(VC++ compiler)。支持将引擎部分进行预编译,并在新的构建过程中重用预编译的引擎库。通过使用预编译库,可以极大的缩短工程构建时间。 - -详细的使用方法请参考 [CMake 文档](https://github.com/cocos2d/cocos2d-x/blob/v3/cmake/README.md) - -### 升级第三方库 - -Spine 骨骼动画广泛用于 Cocos2d-x 开发的游戏,引擎跟进 Spine 的升级,升级 Runtime 至 3.6.39。 - -升级 GLFW 至 3.2.1 以修复支持游戏手柄时存在的问题,同时提供 GLFW 预编译库。 - -社区希望引擎升级 Box2D,可 Box2D 的新版本迟迟未发布,根据反馈 GitHub 提交 f655c603ba9d83 是稳定的,升级 Box2D 至该提交,同时提供 Box2D 的预编译库。 - -每一次版本发布,都会附带特定版本的第三方预编译库,如果由于项目需要想对第三方库进行定制,请参考: [第三方库文档](https://github.com/cocos2d/cocos2d-x-3rd-party-libs-src/blob/v3/README.md) - -### 移除过时的内容 - -由于 Google 官方自 [Android SDK Tools 25.3.0](http://tools.android.com/recent/androidsdktoolsrevision2530feb2017) 就已放弃 ant 支持。移除旧有的 `proj.android` ant 工程,新的 `proj.android` 是 Android Studio 工程。[NDK r16](https://developer.android.com/ndk/guides/abis) 弃用了 armeabi,引擎调整默认的编译架构从 armeabi 为 armeabi-v7a。 - -在 win32 平台,越来越多的开发者已经使用 Visual Studio 2015/2017 进行开发,移除对年代久远的 2013 的支持。现存的工程配置适合于 2015 ,如果需要使用 2017,可打开现有的 sln 文件,调整配置,或使用 CMake。 - -### Bugs 修复,提高稳定性 - -改版本包含 51 项 bugs 修复和 33 项小改进,不再列举,请参考 [Changelog](https://github.com/cocos2d/cocos2d-x/blob/v3/CHANGELOG)。 +- 针对 OPPO 手机的性能优化 +- 修复 bug:在安卓设备,当文件路径开头为 `assets/` 时, `FileUtils::listFiles()` 无法正常工作 +- 修复了 Audio 在 iOS 设备上的崩溃问题 +- 修复了在安卓设备, `VideoPlayer` 无法播放 OBB 包里的视频文件的问题 +详细的改动请参考 [ChangeLog](https://github.com/cocos2d/cocos2d-x/blob/v3/CHANGELOG)。 diff --git a/docs/cocos2dx_portrait.png b/docs/cocos2dx_portrait.png index 8f17d0ec8d8f..977637ede5c3 100644 Binary files a/docs/cocos2dx_portrait.png and b/docs/cocos2dx_portrait.png differ diff --git a/docs/doxygen.config b/docs/doxygen.config index 05acd8e65f76..1a111610ab5e 100644 --- a/docs/doxygen.config +++ b/docs/doxygen.config @@ -38,7 +38,7 @@ PROJECT_NAME = Cocos2d-x # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = v3.16 +PROJECT_NUMBER = v3.17.2 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/download-deps.py b/download-deps.py index 2f471319fdcb..07afedb174b9 100755 --- a/download-deps.py +++ b/download-deps.py @@ -1,5 +1,6 @@ #!/usr/bin/env python -#coding=utf-8 + +# coding=utf-8 # # ./download-deps.py # @@ -42,14 +43,12 @@ import sys import traceback import distutils -import fileinput import json from optparse import OptionParser from time import time from time import sleep from sys import stdout -from distutils.errors import DistutilsError from distutils.dir_util import copy_tree, remove_tree @@ -92,10 +91,16 @@ def __init__(self, workpath, config_path, version_path, remote_version_key=None) except: self._move_dirs = None self._filename = self._current_version + '.zip' - self._url = data["repo_parent"] + self._repo_name + '/archive/' + self._filename + self._url = data["repo_parent"] + \ + self._repo_name + '/archive/' + self._filename self._zip_file_size = int(data["zip_file_size"]) # 'v' letter was swallowed by github, so we need to substring it from the 2nd letter - self._extracted_folder_name = os.path.join(self._workpath, self._repo_name + '-' + self._current_version[1:]) + if self._current_version[0] == 'v': + self._extracted_folder_name = os.path.join( + self._workpath, self._repo_name + '-' + self._current_version[1:]) + else: + self._extracted_folder_name = os.path.join( + self._workpath, self._repo_name + '-' + self._current_version) try: data = self.load_json_file(version_path) @@ -107,7 +112,10 @@ def __init__(self, workpath, config_path, version_path, remote_version_key=None) print("==> version file doesn't exist") def get_input_value(self, prompt): - ret = raw_input(prompt) + if(python_2): + ret = raw_input(prompt) + else: + ret = input(prompt) ret.rstrip(" \t") return ret @@ -117,19 +125,30 @@ def download_file(self): os.remove(self._filename) except OSError: pass - print("==> Ready to download '%s' from '%s'" % (self._filename, self._url)) - import urllib2 + print("==> Ready to download '%s' from '%s'" % + (self._filename, self._url)) + if(python_2): + import urllib2 as urllib + else: + import urllib.request as urllib try: - u = urllib2.urlopen(self._url) - except urllib2.HTTPError as e: + u = urllib.urlopen(self._url) + except Exception as e: if e.code == 404: - print("==> Error: Could not find the file from url: '%s'" % (self._url)) - print("==> Http request failed, error code: " + str(e.code) + ", reason: " + e.read()) + print("==> Error: Could not find the file from url: '%s'" % + (self._url)) + print("==> Http request failed, error code: " + + str(e.code) + ", reason: " + str(e.read())) sys.exit(1) f = open(self._filename, 'wb') meta = u.info() - content_len = meta.getheaders("Content-Length") + content_len = 0 + if(python_2): + content_len = meta.getheaders("Content-Length") + else: + content_len = meta['Content-Length'] + file_size = 0 if content_len and len(content_len) > 0: file_size = int(content_len[0]) @@ -137,7 +156,8 @@ def download_file(self): # github server may not reponse a header information which contains `Content-Length`, # therefore, the size needs to be written hardcode here. While server doesn't return # `Content-Length`, use it instead - print("==> WARNING: Couldn't grab the file size from remote, use 'zip_file_size' section in '%s'" % self._config_path) + print("==> WARNING: Couldn't grab the file size from remote, use 'zip_file_size' section in '%s'" % + self._config_path) file_size = self._zip_file_size print("==> Start to download, please wait ...") @@ -162,9 +182,11 @@ def download_file(self): speed = block_size_per_second / (new_time - old_time) / 1000.0 if file_size != 0: percent = file_size_dl * 100. / file_size - status = r"Downloaded: %6dK / Total: %dK, Percent: %3.2f%%, Speed: %6.2f KB/S " % (file_size_dl / 1000, file_size / 1000, percent, speed) + status = r"Downloaded: %6dK / Total: %dK, Percent: %3.2f%%, Speed: %6.2f KB/S " % ( + file_size_dl / 1000, file_size / 1000, percent, speed) else: - status = r"Downloaded: %6dK, Speed: %6.2f KB/S " % (file_size_dl / 1000, speed) + status = r"Downloaded: %6dK, Speed: %6.2f KB/S " % ( + file_size_dl / 1000, speed) print(status), sys.stdout.flush() print("\r"), @@ -221,7 +243,8 @@ def unpack_zipfile(self, extract_dir): print("==> Extraction done!") def ask_to_delete_downloaded_zip_file(self): - ret = self.get_input_value("==> Would you like to save '%s'? So you don't have to download it later. [Yes/no]: " % self._filename) + ret = self.get_input_value( + "==> Would you like to save '%s'? So you don't have to download it later. [Yes/no]: " % self._filename) ret = ret.strip() if ret != 'yes' and ret != 'y' and ret != 'no' and ret != 'n': print("==> Saving the dependency libraries by default") @@ -234,16 +257,17 @@ def download_zip_file(self): self.download_file_with_retry(5, 3) try: if not zipfile.is_zipfile(self._filename): - raise UnrecognizedFormat("%s is not a zip file" % (self._filename)) + raise UnrecognizedFormat( + "%s is not a zip file" % (self._filename)) except UnrecognizedFormat as e: - print("==> Unrecognized zip format from your local '%s' file!" % (self._filename)) + print("==> Unrecognized zip format from your local '%s' file!" % + (self._filename)) if os.path.isfile(self._filename): os.remove(self._filename) print("==> Download it from internet again, please wait...") self.download_zip_file() def download_file_with_retry(self, times, delay): - import urllib2 times_count = 0 while(times_count < times): times_count += 1 @@ -287,15 +311,17 @@ def fix_fmod_link(self, extract_dir): import platform if platform.system() != "Linux": return - print("==> Fix fmod link ... ") - fmod_path = os.path.join(extract_dir, "linux-specific/fmod/prebuilt/64-bit") + print("==> Fix fmod link ... ") + fmod_path = os.path.join( + extract_dir, "linux-specific/fmod/prebuilt/64-bit") if os.path.exists(fmod_path): os.unlink(os.path.join(fmod_path, "libfmod.so.6")) os.unlink(os.path.join(fmod_path, "libfmodL.so.6")) os.symlink("libfmod.so", os.path.join(fmod_path, "libfmod.so.6")) os.symlink("libfmodL.so", os.path.join(fmod_path, "libfmodL.so.6")) else: - print("==> fmod directory not found `%s`, failed to fix fmod link!"%fmod_path) + print( + "==> fmod directory not found `%s`, failed to fix fmod link!" % fmod_path) def run(self, workpath, folder_for_extracting, remove_downloaded, force_update, download_only): if not force_update and not self.need_to_update(): @@ -315,13 +341,16 @@ def run(self, workpath, folder_for_extracting, remove_downloaded, force_update, self.clean_external_folder(folder_for_extracting) print("==> Copying files...") - distutils.dir_util.copy_tree(self._extracted_folder_name, folder_for_extracting) + distutils.dir_util.copy_tree( + self._extracted_folder_name, folder_for_extracting) if self._move_dirs is not None: for srcDir in self._move_dirs.keys(): - distDir = os.path.join( os.path.join(workpath, self._move_dirs[srcDir]), srcDir) + distDir = os.path.join(os.path.join( + workpath, self._move_dirs[srcDir]), srcDir) if os.path.exists(distDir): shutil.rmtree(distDir) - shutil.move( os.path.join(folder_for_extracting, srcDir), distDir) + shutil.move(os.path.join( + folder_for_extracting, srcDir), distDir) self.fix_fmod_link(folder_for_extracting) print("==> Cleaning...") if os.path.exists(self._extracted_folder_name): @@ -336,22 +365,17 @@ def run(self, workpath, folder_for_extracting, remove_downloaded, force_update, print("==> Download (%s) finish!" % self._filename) -def _check_python_version(): +def _is_python_version_2(): major_ver = sys.version_info[0] + print("The python version is %d.%d." % (major_ver, sys.version_info[1])) if major_ver > 2: - print ("The python version is %d.%d. But python 2.x is required. (Version 2.7 is well tested)\n" - "Download it here: https://www.python.org/" % (major_ver, sys.version_info[1])) return False - return True def main(): workpath = os.path.dirname(os.path.realpath(__file__)) - if not _check_python_version(): - exit() - parser = OptionParser() parser.add_option('-r', '--remove-download', action="store", type="string", dest='remove_downloaded', default=None, @@ -370,11 +394,15 @@ def main(): print("=======================================================") print("==> Prepare to download external libraries!") external_path = os.path.join(workpath, 'external') - installer = CocosZipInstaller(workpath, os.path.join(workpath, 'external', 'config.json'), os.path.join(workpath, 'external', 'version.json'), "prebuilt_libs_version") - installer.run(workpath, external_path, opts.remove_downloaded, opts.force_update, opts.download_only) + installer = CocosZipInstaller(workpath, os.path.join(workpath, 'external', 'config.json'), os.path.join( + workpath, 'external', 'version.json'), "prebuilt_libs_version") + installer.run(workpath, external_path, opts.remove_downloaded, + opts.force_update, opts.download_only) + # -------------- main -------------- if __name__ == '__main__': + python_2 = _is_python_version_2() try: main() except Exception as e: diff --git a/extensions/CMakeLists.txt b/extensions/CMakeLists.txt index f14a89327780..f50b92fe22c2 100644 --- a/extensions/CMakeLists.txt +++ b/extensions/CMakeLists.txt @@ -1,7 +1,3 @@ -if(WINDOWS AND BUILD_SHARED_LIBS) - add_definitions(-D_USREXDLL) -endif() - set(COCOS_EXTENSIONS_HEADER ../extensions/ExtensionMacros.h ../extensions/assets-manager/AssetsManagerEx.h diff --git a/extensions/GUI/CCControlExtension/CCControl.h b/extensions/GUI/CCControlExtension/CCControl.h index c8b79d2ceb7d..d281eca15420 100644 --- a/extensions/GUI/CCControlExtension/CCControl.h +++ b/extensions/GUI/CCControlExtension/CCControl.h @@ -187,7 +187,7 @@ class CC_EX_DLL Control : public Layer */ virtual ~Control(); - virtual bool init(void) override; + virtual bool init() override; protected: /** diff --git a/extensions/GUI/CCControlExtension/CCControlButton.h b/extensions/GUI/CCControlExtension/CCControlButton.h index e1c447565a60..29f465477170 100644 --- a/extensions/GUI/CCControlExtension/CCControlButton.h +++ b/extensions/GUI/CCControlExtension/CCControlButton.h @@ -62,7 +62,7 @@ class CC_EX_DLL ControlButton : public Control static ControlButton* create(const std::string& title, const std::string& fontName, float fontSize); static ControlButton* create(Node* label, cocos2d::ui::Scale9Sprite* backgroundSprite, bool adjustBackGroundSize); - virtual void needsLayout(void) override; + virtual void needsLayout() override; virtual void setEnabled(bool enabled) override; virtual void setSelected(bool enabled) override; diff --git a/extensions/GUI/CCControlExtension/CCControlPotentiometer.cpp b/extensions/GUI/CCControlExtension/CCControlPotentiometer.cpp index ddb8838ce5e5..3710bfaa9180 100644 --- a/extensions/GUI/CCControlExtension/CCControlPotentiometer.cpp +++ b/extensions/GUI/CCControlExtension/CCControlPotentiometer.cpp @@ -28,6 +28,7 @@ */ #include "CCControlPotentiometer.h" +#include NS_CC_EXT_BEGIN @@ -206,7 +207,7 @@ float ControlPotentiometer::distanceBetweenPointAndPoint(Vec2 point1, Vec2 point { float dx = point1.x - point2.x; float dy = point1.y - point2.y; - return sqrt(dx*dx + dy*dy); + return std::sqrt(dx*dx + dy*dy); } float ControlPotentiometer::angleInDegreesBetweenLineFromPoint_toPoint_toLineFromPoint_toPoint( @@ -220,8 +221,8 @@ float ControlPotentiometer::angleInDegreesBetweenLineFromPoint_toPoint_toLineFro float c = endLineB.x - beginLineB.x; float d = endLineB.y - beginLineB.y; - float atanA = atan2(a, b); - float atanB = atan2(c, d); + float atanA = std::atan2(a, b); + float atanB = std::atan2(c, d); // convert radiants to degrees return (atanA - atanB) * 180 / M_PI; diff --git a/extensions/GUI/CCControlExtension/CCControlSaturationBrightnessPicker.cpp b/extensions/GUI/CCControlExtension/CCControlSaturationBrightnessPicker.cpp index 1338709bef7c..f4b0dbc06d83 100644 --- a/extensions/GUI/CCControlExtension/CCControlSaturationBrightnessPicker.cpp +++ b/extensions/GUI/CCControlExtension/CCControlSaturationBrightnessPicker.cpp @@ -32,6 +32,7 @@ */ #include "CCControlSaturationBrightnessPicker.h" +#include NS_CC_EXT_BEGIN @@ -154,8 +155,8 @@ void ControlSaturationBrightnessPicker::updateSliderPosition(Vec2 sliderPosition else if (sliderPosition.y > _startPos.y + boxPos + boxSize) sliderPosition.y = _startPos.y + boxPos + boxSize; // Use the position / slider width to determine the percentage the dragger is at - _saturation = 1.0f - fabs((_startPos.x + (float)boxPos - sliderPosition.x)/(float)boxSize); - _brightness = fabs((_startPos.y + (float)boxPos - sliderPosition.y)/(float)boxSize); + _saturation = 1.0f - std::fabs((_startPos.x + (float)boxPos - sliderPosition.x)/(float)boxSize); + _brightness = std::fabs((_startPos.y + (float)boxPos - sliderPosition.y)/(float)boxSize); } bool ControlSaturationBrightnessPicker::checkSliderPosition(Vec2 location) diff --git a/extensions/GUI/CCControlExtension/CCControlSwitch.h b/extensions/GUI/CCControlExtension/CCControlSwitch.h index 346a4b5da935..a460ca23522d 100644 --- a/extensions/GUI/CCControlExtension/CCControlSwitch.h +++ b/extensions/GUI/CCControlExtension/CCControlSwitch.h @@ -81,7 +81,7 @@ class CC_EX_DLL ControlSwitch : public Control */ void setOn(bool isOn, bool animated); void setOn(bool isOn); - bool isOn(void) const { return _on; } + bool isOn() const { return _on; } bool hasMoved() const { return _moved; } virtual void setEnabled(bool enabled) override; diff --git a/extensions/GUI/CCScrollView/CCScrollView.cpp b/extensions/GUI/CCScrollView/CCScrollView.cpp index aa5aba77a096..9191b7c1dfce 100644 --- a/extensions/GUI/CCScrollView/CCScrollView.cpp +++ b/extensions/GUI/CCScrollView/CCScrollView.cpp @@ -25,6 +25,7 @@ ****************************************************************************/ #include "CCScrollView.h" +#include #include "platform/CCDevice.h" #include "2d/CCActionInstant.h" #include "2d/CCActionInterval.h" @@ -787,7 +788,7 @@ void ScrollView::onTouchMoved(Touch* touch, Event* /*event*/) } } - if (!_touchMoved && fabs(convertDistanceFromPointToInch(dis)) < MOVE_INCH ) + if (!_touchMoved && std::fabs(convertDistanceFromPointToInch(dis)) < MOVE_INCH ) { //CCLOG("Invalid movement, distance = [%f, %f], disInch = %f", moveDistance.x, moveDistance.y); return; @@ -849,7 +850,7 @@ void ScrollView::onTouchEnded(Touch* touch, Event* /*event*/) _touches.erase(touchIter); } - if (_touches.size() == 0) + if (_touches.empty()) { _dragging = false; _touchMoved = false; @@ -870,7 +871,7 @@ void ScrollView::onTouchCancelled(Touch* touch, Event* /*event*/) _touches.erase(touchIter); - if (_touches.size() == 0) + if (_touches.empty()) { _dragging = false; _touchMoved = false; diff --git a/extensions/GUI/CCScrollView/CCScrollView.h b/extensions/GUI/CCScrollView/CCScrollView.h index fd791d2fa100..b3b0af1e90ef 100644 --- a/extensions/GUI/CCScrollView/CCScrollView.h +++ b/extensions/GUI/CCScrollView/CCScrollView.h @@ -54,12 +54,12 @@ class CC_EX_DLL ScrollViewDelegate * @js NA * @lua NA */ - virtual void scrollViewDidScroll(ScrollView* view) {}; + virtual void scrollViewDidScroll(ScrollView* view) {} /** * @js NA * @lua NA */ - virtual void scrollViewDidZoom(ScrollView* view) {}; + virtual void scrollViewDidZoom(ScrollView* view) {} }; diff --git a/extensions/Particle3D/CCParticle3DAffector.h b/extensions/Particle3D/CCParticle3DAffector.h index c4ee80d4b4bf..5f1c4e769032 100644 --- a/extensions/Particle3D/CCParticle3DAffector.h +++ b/extensions/Particle3D/CCParticle3DAffector.h @@ -45,7 +45,7 @@ class CC_DLL Particle3DAffector : public Ref */ void setEnabled (bool enabled) { _isEnabled = enabled; } - bool isEnabled(void) const { return _isEnabled; } + bool isEnabled() const { return _isEnabled; } CC_CONSTRUCTOR_ACCESS: Particle3DAffector(); diff --git a/extensions/Particle3D/CCParticle3DEmitter.h b/extensions/Particle3D/CCParticle3DEmitter.h index 9d43a44efdf6..85c7d2da2945 100644 --- a/extensions/Particle3D/CCParticle3DEmitter.h +++ b/extensions/Particle3D/CCParticle3DEmitter.h @@ -49,7 +49,7 @@ class CC_DLL Particle3DEmitter : public Ref */ void setEnabled (bool enabled) { _isEnabled = enabled; } - bool isEnabled(void) const { return _isEnabled; } + bool isEnabled() const { return _isEnabled; } CC_CONSTRUCTOR_ACCESS: Particle3DEmitter(); diff --git a/extensions/Particle3D/CCParticle3DRender.cpp b/extensions/Particle3D/CCParticle3DRender.cpp index 8e909e0d7fe3..4648f4d31add 100755 --- a/extensions/Particle3D/CCParticle3DRender.cpp +++ b/extensions/Particle3D/CCParticle3DRender.cpp @@ -319,7 +319,7 @@ Particle3DRender::Particle3DRender() _stateBlock->setDepthTest(false); _stateBlock->setDepthWrite(false); _stateBlock->setBlend(true); -}; +} Particle3DRender::~Particle3DRender() { diff --git a/extensions/Particle3D/CCParticleSystem3D.h b/extensions/Particle3D/CCParticleSystem3D.h index 6ec7001579c1..c68165b57987 100644 --- a/extensions/Particle3D/CCParticleSystem3D.h +++ b/extensions/Particle3D/CCParticleSystem3D.h @@ -259,7 +259,7 @@ class CC_DLL ParticleSystem3D : public Node, public BlendProtocol */ State getState() const { return _state; } - bool isKeepLocal(void) const { return _keepLocal; } + bool isKeepLocal() const { return _keepLocal; } void setKeepLocal(bool keepLocal); /** @@ -270,7 +270,7 @@ class CC_DLL ParticleSystem3D : public Node, public BlendProtocol /** * is enabled */ - bool isEnabled(void) const { return _isEnabled; } + bool isEnabled() const { return _isEnabled; } CC_CONSTRUCTOR_ACCESS: ParticleSystem3D(); diff --git a/extensions/Particle3D/PU/CCPUAffector.h b/extensions/Particle3D/PU/CCPUAffector.h index 3fbf0047d0e7..9ca8244a2b9c 100644 --- a/extensions/Particle3D/PU/CCPUAffector.h +++ b/extensions/Particle3D/PU/CCPUAffector.h @@ -82,12 +82,12 @@ class CC_DLL PUAffector : public Particle3DAffector /** Todo */ - const AffectSpecialisation& getAffectSpecialisation(void) const {return _affectSpecialisation;}; + const AffectSpecialisation& getAffectSpecialisation() const {return _affectSpecialisation;}; void setAffectSpecialisation(const AffectSpecialisation& affectSpecialisation) {_affectSpecialisation = affectSpecialisation;}; /** Todo */ - const std::string& getAffectorType(void) const {return _affectorType;}; + const std::string& getAffectorType() const {return _affectorType;}; void setAffectorType(const std::string& affectorType) {_affectorType = affectorType;}; /** Add a ParticleEmitter name that excludes Particles emitted by this ParticleEmitter from being @@ -101,7 +101,7 @@ class CC_DLL PUAffector : public Particle3DAffector /** Todo */ - const std::string& getName(void) const {return _name;}; + const std::string& getName() const {return _name;}; void setName(const std::string& name) {_name = name;}; virtual void copyAttributesTo (PUAffector* affector); diff --git a/extensions/Particle3D/PU/CCPUAffectorTranslator.h b/extensions/Particle3D/PU/CCPUAffectorTranslator.h index 328132e5d1e4..032cdec43cab 100644 --- a/extensions/Particle3D/PU/CCPUAffectorTranslator.h +++ b/extensions/Particle3D/PU/CCPUAffectorTranslator.h @@ -40,8 +40,8 @@ class PUAffectorTranslator : public PUScriptTranslator PUAffector* _affector; public: - PUAffectorTranslator(void); - virtual ~PUAffectorTranslator(void){}; + PUAffectorTranslator(); + virtual ~PUAffectorTranslator(){}; virtual void translate(PUScriptCompiler* compiler, PUAbstractNode *node); }; diff --git a/extensions/Particle3D/PU/CCPUBeamRender.cpp b/extensions/Particle3D/PU/CCPUBeamRender.cpp index dcf10ced109f..123c955b43f4 100644 --- a/extensions/Particle3D/PU/CCPUBeamRender.cpp +++ b/extensions/Particle3D/PU/CCPUBeamRender.cpp @@ -154,7 +154,7 @@ void PUBeamRender::particleExpired( PUParticleSystem3D* /*particleSystem*/, PUPa } //----------------------------------------------------------------------- -bool PUBeamRender::isUseVertexColours(void) const +bool PUBeamRender::isUseVertexColours() const { return _useVertexColours; } @@ -169,7 +169,7 @@ void PUBeamRender::setUseVertexColours(bool useVertexColours) _billboardChain->setUseTextureCoords(!_useVertexColours); } //----------------------------------------------------------------------- -size_t PUBeamRender::getMaxChainElements(void) const +size_t PUBeamRender::getMaxChainElements() const { return _maxChainElements; } @@ -179,7 +179,7 @@ void PUBeamRender::setMaxChainElements(size_t maxChainElements) _maxChainElements = maxChainElements; } //----------------------------------------------------------------------- -float PUBeamRender::getUpdateInterval(void) const +float PUBeamRender::getUpdateInterval() const { return _updateInterval; } @@ -189,7 +189,7 @@ void PUBeamRender::setUpdateInterval(float updateInterval) _updateInterval = updateInterval; } //----------------------------------------------------------------------- -float PUBeamRender::getDeviation(void) const +float PUBeamRender::getDeviation() const { return _deviation; } @@ -199,7 +199,7 @@ void PUBeamRender::setDeviation(float deviation) _deviation = deviation; } //----------------------------------------------------------------------- -size_t PUBeamRender::getNumberOfSegments(void) const +size_t PUBeamRender::getNumberOfSegments() const { return _numberOfSegments; } @@ -209,7 +209,7 @@ void PUBeamRender::setNumberOfSegments(size_t numberOfSegments) _numberOfSegments = numberOfSegments; } //----------------------------------------------------------------------- -bool PUBeamRender::isJump(void) const +bool PUBeamRender::isJump() const { return _jump; } @@ -219,7 +219,7 @@ void PUBeamRender::setJump(bool jump) _jump = jump; } //----------------------------------------------------------------------- -PUBillboardChain::TexCoordDirection PUBeamRender::getTexCoordDirection(void) const +PUBillboardChain::TexCoordDirection PUBeamRender::getTexCoordDirection() const { return _texCoordDirection; } @@ -328,7 +328,7 @@ void PUBeamRender::updateRender( PUParticle3D *particle, float deltaTime, bool / } //----------------------------------------------------------------------- -void PUBeamRender::destroyAll(void) +void PUBeamRender::destroyAll() { if (!_particleSystem || !_billboardChain) return; diff --git a/extensions/Particle3D/PU/CCPUBeamRender.h b/extensions/Particle3D/PU/CCPUBeamRender.h index de85b6b309f5..924b3d2f2fb1 100644 --- a/extensions/Particle3D/PU/CCPUBeamRender.h +++ b/extensions/Particle3D/PU/CCPUBeamRender.h @@ -102,30 +102,30 @@ class CC_DLL PUBeamRender : public PURender, public PUListener /** Getters and Setters */ - bool isUseVertexColours(void) const; + bool isUseVertexColours() const; void setUseVertexColours(bool useVertexColours); - size_t getMaxChainElements(void) const; + size_t getMaxChainElements() const; void setMaxChainElements(size_t maxChainElements); - float getUpdateInterval(void) const; + float getUpdateInterval() const; void setUpdateInterval(float updateInterval); - float getDeviation(void) const; + float getDeviation() const; void setDeviation(float deviation); - size_t getNumberOfSegments(void) const; + size_t getNumberOfSegments() const; void setNumberOfSegments(size_t numberOfSegments); - bool isJump(void) const; + bool isJump() const; void setJump(bool jump); - PUBillboardChain::TexCoordDirection getTexCoordDirection(void) const; + PUBillboardChain::TexCoordDirection getTexCoordDirection() const; void setTexCoordDirection(PUBillboardChain::TexCoordDirection texCoordDirection); /** Destroys the BillboarChain */ - void destroyAll(void); + void destroyAll(); virtual PUBeamRender* clone() override; void copyAttributesTo(PUBeamRender *render); diff --git a/extensions/Particle3D/PU/CCPUBehaviour.cpp b/extensions/Particle3D/PU/CCPUBehaviour.cpp index 02fcd125d752..c5a5260b4f19 100644 --- a/extensions/Particle3D/PU/CCPUBehaviour.cpp +++ b/extensions/Particle3D/PU/CCPUBehaviour.cpp @@ -29,12 +29,12 @@ NS_CC_BEGIN -PUBehaviour::PUBehaviour( void ): +PUBehaviour::PUBehaviour(): _particleSystem(nullptr), _behaviourScale(Vec3::ONE) {} -PUBehaviour::~PUBehaviour( void ) +PUBehaviour::~PUBehaviour() {} void PUBehaviour::updateBehaviour(PUParticle3D* /*particle*/, float /*deltaTime*/) diff --git a/extensions/Particle3D/PU/CCPUBehaviour.h b/extensions/Particle3D/PU/CCPUBehaviour.h index c859b2e8de51..59a8b640aa5c 100644 --- a/extensions/Particle3D/PU/CCPUBehaviour.h +++ b/extensions/Particle3D/PU/CCPUBehaviour.h @@ -45,7 +45,7 @@ class CC_DLL PUBehaviour : public Ref /** Todo */ - const std::string& getBehaviourType(void) const {return _behaviourType;}; + const std::string& getBehaviourType() const {return _behaviourType;}; void setBehaviourType(const std::string& behaviourType) {_behaviourType = behaviourType;}; /** Notify that the Behaviour is rescaled. @@ -70,8 +70,8 @@ class CC_DLL PUBehaviour : public Ref virtual void copyAttributesTo (PUBehaviour* behaviour); CC_CONSTRUCTOR_ACCESS: - PUBehaviour(void); - virtual ~PUBehaviour(void); + PUBehaviour(); + virtual ~PUBehaviour(); protected: PUParticleSystem3D* _particleSystem; diff --git a/extensions/Particle3D/PU/CCPUBillboardChain.cpp b/extensions/Particle3D/PU/CCPUBillboardChain.cpp index 45187cf61b21..77bd7e8666ff 100644 --- a/extensions/Particle3D/PU/CCPUBillboardChain.cpp +++ b/extensions/Particle3D/PU/CCPUBillboardChain.cpp @@ -108,7 +108,7 @@ PUBillboardChain::~PUBillboardChain() CC_SAFE_RELEASE(_indexBuffer); } //----------------------------------------------------------------------- -void PUBillboardChain::setupChainContainers(void) +void PUBillboardChain::setupChainContainers() { // Allocate enough space for everything _chainElementList.resize(_chainCount * _maxElementsPerChain); @@ -124,7 +124,7 @@ void PUBillboardChain::setupChainContainers(void) } } //----------------------------------------------------------------------- -void PUBillboardChain::setupVertexDeclaration(void) +void PUBillboardChain::setupVertexDeclaration() { //if (_vertexDeclDirty) //{ @@ -159,7 +159,7 @@ void PUBillboardChain::setupVertexDeclaration(void) //} } //----------------------------------------------------------------------- -void PUBillboardChain::setupBuffers(void) +void PUBillboardChain::setupBuffers() { //setupVertexDeclaration(); if (_buffersNeedRecreating) @@ -345,7 +345,7 @@ void PUBillboardChain::clearChain(size_t chainIndex) } //----------------------------------------------------------------------- -void PUBillboardChain::clearAllChains(void) +void PUBillboardChain::clearAllChains() { for (size_t i = 0; i < _chainCount; ++i) { @@ -587,7 +587,7 @@ void PUBillboardChain::updateVertexBuffer(const Mat4 &camMat) } //----------------------------------------------------------------------- -void PUBillboardChain::updateIndexBuffer(void) +void PUBillboardChain::updateIndexBuffer() { setupBuffers(); diff --git a/extensions/Particle3D/PU/CCPUBillboardChain.h b/extensions/Particle3D/PU/CCPUBillboardChain.h index 2322f5a9faba..9d5143859d15 100644 --- a/extensions/Particle3D/PU/CCPUBillboardChain.h +++ b/extensions/Particle3D/PU/CCPUBillboardChain.h @@ -92,7 +92,7 @@ class PUBillboardChain virtual void setMaxChainElements(size_t maxElements); /** Get the maximum number of chain elements per chain */ - virtual size_t getMaxChainElements(void) const { return _maxElementsPerChain; } + virtual size_t getMaxChainElements() const { return _maxElementsPerChain; } /** Set the number of chain segments (this class can render multiple chains at once using the same material). */ @@ -100,7 +100,7 @@ class PUBillboardChain /** Get the number of chain segments (this class can render multiple chains at once using the same material). */ - virtual size_t getNumberOfChains(void) const { return _chainCount; } + virtual size_t getNumberOfChains() const { return _chainCount; } /** Sets whether texture coordinate information should be included in the final buffers generated. @@ -112,7 +112,7 @@ class PUBillboardChain /** Gets whether texture coordinate information should be included in the final buffers generated. */ - virtual bool getUseTextureCoords(void) const { return _useTexCoords; } + virtual bool getUseTextureCoords() const { return _useTexCoords; } /** The direction in which texture coordinates from elements of the chain are used. @@ -132,7 +132,7 @@ class PUBillboardChain /** Gets the direction in which texture coords specified on each element are deemed to run. */ - virtual TexCoordDirection getTextureCoordDirection(void) { return _texCoordDir; } + virtual TexCoordDirection getTextureCoordDirection() { return _texCoordDir; } /** Set the range of the texture coordinates generated across the width of the chain elements. @@ -143,7 +143,7 @@ class PUBillboardChain /** Get the range of the texture coordinates generated across the width of the chain elements. */ - virtual const float* getOtherTextureCoordRange(void) const { return _otherTexCoordRange; } + virtual const float* getOtherTextureCoordRange() const { return _otherTexCoordRange; } /** Sets whether vertex colour information should be included in the final buffers generated. @@ -155,7 +155,7 @@ class PUBillboardChain /** Gets whether vertex colour information should be included in the final buffers generated. */ - virtual bool getUseVertexColours(void) const { return _useVertexColour; } + virtual bool getUseVertexColours() const { return _useVertexColour; } /** Sets whether or not the buffers created for this object are suitable for dynamic alteration. @@ -165,7 +165,7 @@ class PUBillboardChain /** Gets whether or not the buffers created for this object are suitable for dynamic alteration. */ - virtual bool getDynamic(void) const { return _dynamic; } + virtual bool getDynamic() const { return _dynamic; } /** Add an element to the 'head' of a chain. @remarks @@ -202,7 +202,7 @@ class PUBillboardChain /** Remove all elements of a given chain (but leave the chain intact). */ virtual void clearChain(size_t chainIndex); /** Remove all elements from all chains (but leave the chains themselves intact). */ - virtual void clearAllChains(void); + virtual void clearAllChains(); /** Sets whether the billboard should always be facing the camera or a custom direction set by each point element. @@ -240,15 +240,15 @@ class PUBillboardChain protected: /// Setup the STL collections - virtual void setupChainContainers(void); + virtual void setupChainContainers(); /// Setup vertex declaration - virtual void setupVertexDeclaration(void); + virtual void setupVertexDeclaration(); // Setup buffers - virtual void setupBuffers(void); + virtual void setupBuffers(); /// Update the contents of the vertex buffer virtual void updateVertexBuffer(const Mat4& camMat); /// Update the contents of the index buffer - virtual void updateIndexBuffer(void); + virtual void updateIndexBuffer(); void init(const std::string& texFile); diff --git a/extensions/Particle3D/PU/CCPUBoxCollider.cpp b/extensions/Particle3D/PU/CCPUBoxCollider.cpp index 9d5a88ca928c..cffbdcb90728 100644 --- a/extensions/Particle3D/PU/CCPUBoxCollider.cpp +++ b/extensions/Particle3D/PU/CCPUBoxCollider.cpp @@ -85,7 +85,7 @@ void PUBoxCollider::setDepth(const float depth) _depth = depth; } //----------------------------------------------------------------------- -bool PUBoxCollider::isInnerCollision(void) const +bool PUBoxCollider::isInnerCollision() const { return _innerCollision; } diff --git a/extensions/Particle3D/PU/CCPUBoxEmitter.cpp b/extensions/Particle3D/PU/CCPUBoxEmitter.cpp index fe9acf826996..e1b47f5dad63 100644 --- a/extensions/Particle3D/PU/CCPUBoxEmitter.cpp +++ b/extensions/Particle3D/PU/CCPUBoxEmitter.cpp @@ -35,7 +35,7 @@ const float CCPUBoxEmitter::DEFAULT_HEIGHT = 100.0f; const float CCPUBoxEmitter::DEFAULT_DEPTH = 100.0f; //----------------------------------------------------------------------- -CCPUBoxEmitter::CCPUBoxEmitter(void) : +CCPUBoxEmitter::CCPUBoxEmitter() : PUEmitter(), _height(DEFAULT_HEIGHT), _width(DEFAULT_WIDTH), diff --git a/extensions/Particle3D/PU/CCPUBoxEmitter.h b/extensions/Particle3D/PU/CCPUBoxEmitter.h index 788f1cf40ba6..6ba8d2c243ec 100644 --- a/extensions/Particle3D/PU/CCPUBoxEmitter.h +++ b/extensions/Particle3D/PU/CCPUBoxEmitter.h @@ -61,8 +61,8 @@ class CC_DLL CCPUBoxEmitter : public PUEmitter virtual void copyAttributesTo (PUEmitter* emitter) override; CC_CONSTRUCTOR_ACCESS: - CCPUBoxEmitter(void); - virtual ~CCPUBoxEmitter(void) {}; + CCPUBoxEmitter(); + virtual ~CCPUBoxEmitter() {}; protected: diff --git a/extensions/Particle3D/PU/CCPUCircleEmitter.cpp b/extensions/Particle3D/PU/CCPUCircleEmitter.cpp index 5caac7c452cf..eea0fc9b54ac 100644 --- a/extensions/Particle3D/PU/CCPUCircleEmitter.cpp +++ b/extensions/Particle3D/PU/CCPUCircleEmitter.cpp @@ -39,7 +39,7 @@ const bool PUCircleEmitter::DEFAULT_RANDOM = true; const Vec3 PUCircleEmitter::DEFAULT_NORMAL(0, 0, 0); //----------------------------------------------------------------------- -PUCircleEmitter::PUCircleEmitter(void) : +PUCircleEmitter::PUCircleEmitter() : PUEmitter(), _radius(DEFAULT_RADIUS), _circleAngle(DEFAULT_ANGLE), @@ -94,12 +94,12 @@ void PUCircleEmitter::setRandom(const bool random) _random = random; } //----------------------------------------------------------------------- -const Quaternion& PUCircleEmitter::getOrientation(void) const +const Quaternion& PUCircleEmitter::getOrientation() const { return _orientation; } //----------------------------------------------------------------------- -const Vec3& PUCircleEmitter::getNormal(void) const +const Vec3& PUCircleEmitter::getNormal() const { return _normal; } @@ -111,7 +111,7 @@ void PUCircleEmitter::setNormal(const Vec3& normal) _normal = normal; } //----------------------------------------------------------------------- -void PUCircleEmitter::notifyStart (void) +void PUCircleEmitter::notifyStart () { // Reset the attributes to allow a restart. _circleAngle = _originalCircleAngle; diff --git a/extensions/Particle3D/PU/CCPUCircleEmitter.h b/extensions/Particle3D/PU/CCPUCircleEmitter.h index 3b9d9d0bd872..29ba7d1addb8 100644 --- a/extensions/Particle3D/PU/CCPUCircleEmitter.h +++ b/extensions/Particle3D/PU/CCPUCircleEmitter.h @@ -66,20 +66,20 @@ class CC_DLL PUCircleEmitter : public PUEmitter /* */ - const Quaternion& getOrientation(void) const; - const Vec3& getNormal(void) const; + const Quaternion& getOrientation() const; + const Vec3& getNormal() const; void setNormal(const Vec3 &normal); /** See ParticleEmiter */ - virtual void notifyStart(void) override; + virtual void notifyStart() override; virtual PUCircleEmitter* clone() override; virtual void copyAttributesTo (PUEmitter* emitter) override; CC_CONSTRUCTOR_ACCESS: - PUCircleEmitter(void); - virtual ~PUCircleEmitter(void) {}; + PUCircleEmitter(); + virtual ~PUCircleEmitter() {}; protected: diff --git a/extensions/Particle3D/PU/CCPUCollisionAvoidanceAffector.cpp b/extensions/Particle3D/PU/CCPUCollisionAvoidanceAffector.cpp index b32a10bdb61c..2cb6a71687cb 100644 --- a/extensions/Particle3D/PU/CCPUCollisionAvoidanceAffector.cpp +++ b/extensions/Particle3D/PU/CCPUCollisionAvoidanceAffector.cpp @@ -32,7 +32,7 @@ NS_CC_BEGIN const float PUCollisionAvoidanceAffector::DEFAULT_RADIUS = 100.0f; //----------------------------------------------------------------------- -PUCollisionAvoidanceAffector::PUCollisionAvoidanceAffector(void) : +PUCollisionAvoidanceAffector::PUCollisionAvoidanceAffector() : PUAffector(), _radius(DEFAULT_RADIUS) { @@ -42,7 +42,7 @@ PUCollisionAvoidanceAffector::~PUCollisionAvoidanceAffector() } //----------------------------------------------------------------------- -float PUCollisionAvoidanceAffector::getRadius(void) const +float PUCollisionAvoidanceAffector::getRadius() const { return _radius; } diff --git a/extensions/Particle3D/PU/CCPUDoAffectorEventHandler.cpp b/extensions/Particle3D/PU/CCPUDoAffectorEventHandler.cpp index 47c1012813ae..3ca3c3cdb78c 100644 --- a/extensions/Particle3D/PU/CCPUDoAffectorEventHandler.cpp +++ b/extensions/Particle3D/PU/CCPUDoAffectorEventHandler.cpp @@ -33,7 +33,7 @@ NS_CC_BEGIN const bool PUDoAffectorEventHandler::DEFAULT_PRE_POST = false; //----------------------------------------------------------------------- -PUDoAffectorEventHandler::PUDoAffectorEventHandler(void) : +PUDoAffectorEventHandler::PUDoAffectorEventHandler() : PUEventHandler(), _prePost(DEFAULT_PRE_POST) { diff --git a/extensions/Particle3D/PU/CCPUDoAffectorEventHandler.h b/extensions/Particle3D/PU/CCPUDoAffectorEventHandler.h index f727f1835b39..e23c15a2bfa5 100644 --- a/extensions/Particle3D/PU/CCPUDoAffectorEventHandler.h +++ b/extensions/Particle3D/PU/CCPUDoAffectorEventHandler.h @@ -57,7 +57,7 @@ class CC_DLL PUDoAffectorEventHandler : public PUEventHandler /** Get the name of the affector that must be enabled or disabled. */ - const std::string& getAffectorName(void) const {return _affectorName;}; + const std::string& getAffectorName() const {return _affectorName;}; /** Set the name of the affector. */ @@ -74,8 +74,8 @@ class CC_DLL PUDoAffectorEventHandler : public PUEventHandler virtual void copyAttributesTo (PUEventHandler* eventHandler) override; CC_CONSTRUCTOR_ACCESS: - PUDoAffectorEventHandler(void); - virtual ~PUDoAffectorEventHandler(void) {}; + PUDoAffectorEventHandler(); + virtual ~PUDoAffectorEventHandler() {}; protected: // Identifies the name of affector diff --git a/extensions/Particle3D/PU/CCPUDoEnableComponentEventHandler.cpp b/extensions/Particle3D/PU/CCPUDoEnableComponentEventHandler.cpp index 16a76460fc3a..c4ec2922b834 100644 --- a/extensions/Particle3D/PU/CCPUDoEnableComponentEventHandler.cpp +++ b/extensions/Particle3D/PU/CCPUDoEnableComponentEventHandler.cpp @@ -31,10 +31,10 @@ NS_CC_BEGIN //----------------------------------------------------------------------- -PUDoEnableComponentEventHandler::PUDoEnableComponentEventHandler(void) : - PUEventHandler(), - _componentType(CT_EMITTER), - _componentEnabled(true) +PUDoEnableComponentEventHandler::PUDoEnableComponentEventHandler() +: PUEventHandler() +, _componentType(CT_EMITTER) +, _componentEnabled(true) { } //----------------------------------------------------------------------- diff --git a/extensions/Particle3D/PU/CCPUDoEnableComponentEventHandler.h b/extensions/Particle3D/PU/CCPUDoEnableComponentEventHandler.h index cdca09483193..962ff9663d13 100644 --- a/extensions/Particle3D/PU/CCPUDoEnableComponentEventHandler.h +++ b/extensions/Particle3D/PU/CCPUDoEnableComponentEventHandler.h @@ -48,7 +48,7 @@ class CC_DLL PUDoEnableComponentEventHandler : public PUEventHandler /** Get the name of the component that must be enabled or disabled. */ - const std::string& getComponentName(void) const {return _componentName;}; + const std::string& getComponentName() const {return _componentName;}; /** Set the name of the component that must be enabled or disables. */ @@ -56,7 +56,7 @@ class CC_DLL PUDoEnableComponentEventHandler : public PUEventHandler /** Get the value that identifies whether the component must be enabled or disabled. */ - bool isComponentEnabled(void) const {return _componentEnabled;}; + bool isComponentEnabled() const {return _componentEnabled;}; /** Set the value that identifies whether the component must be enabled or disabled. */ @@ -64,7 +64,7 @@ class CC_DLL PUDoEnableComponentEventHandler : public PUEventHandler /** Get the value that identifies whether the component must be enabled or disabled. */ - PUComponentType getComponentType(void) const {return _componentType;}; + PUComponentType getComponentType() const {return _componentType;}; /** Set the value that identifies whether the component must be enabled or disabled. */ @@ -81,8 +81,8 @@ class CC_DLL PUDoEnableComponentEventHandler : public PUEventHandler virtual void copyAttributesTo (PUEventHandler* eventHandler) override; CC_CONSTRUCTOR_ACCESS: - PUDoEnableComponentEventHandler(void); - virtual ~PUDoEnableComponentEventHandler(void) {}; + PUDoEnableComponentEventHandler(); + virtual ~PUDoEnableComponentEventHandler() {}; protected: // Identifies the name of component diff --git a/extensions/Particle3D/PU/CCPUDoExpireEventHandler.h b/extensions/Particle3D/PU/CCPUDoExpireEventHandler.h index c40c9c099481..4bbd0e88c1a6 100644 --- a/extensions/Particle3D/PU/CCPUDoExpireEventHandler.h +++ b/extensions/Particle3D/PU/CCPUDoExpireEventHandler.h @@ -47,7 +47,7 @@ class CC_DLL PUDoExpireEventHandler : public PUEventHandler ///** Get indication that all particles are expired //*/ - //bool getExpireAll(void); + //bool getExpireAll(); ///** Set indication that all particles are expired //*/ @@ -58,10 +58,10 @@ class CC_DLL PUDoExpireEventHandler : public PUEventHandler virtual void handle (PUParticleSystem3D* particleSystem, PUParticle3D* particle, float timeElapsed) override; CC_CONSTRUCTOR_ACCESS: - PUDoExpireEventHandler(void) : PUEventHandler() + PUDoExpireEventHandler() : PUEventHandler() { } - virtual ~PUDoExpireEventHandler(void) {}; + virtual ~PUDoExpireEventHandler() {}; }; NS_CC_END diff --git a/extensions/Particle3D/PU/CCPUDoFreezeEventHandler.h b/extensions/Particle3D/PU/CCPUDoFreezeEventHandler.h index 66ca35cd5b28..7836cbb2e312 100644 --- a/extensions/Particle3D/PU/CCPUDoFreezeEventHandler.h +++ b/extensions/Particle3D/PU/CCPUDoFreezeEventHandler.h @@ -50,10 +50,10 @@ class CC_DLL PUDoFreezeEventHandler : public PUEventHandler virtual void handle (PUParticleSystem3D* particleSystem, PUParticle3D* particle, float timeElapsed) override; CC_CONSTRUCTOR_ACCESS: - PUDoFreezeEventHandler(void) : PUEventHandler() + PUDoFreezeEventHandler() : PUEventHandler() { } - virtual ~PUDoFreezeEventHandler(void) {}; + virtual ~PUDoFreezeEventHandler() {}; }; NS_CC_END diff --git a/extensions/Particle3D/PU/CCPUDoPlacementParticleEventHandler.cpp b/extensions/Particle3D/PU/CCPUDoPlacementParticleEventHandler.cpp index a251ac1fba57..f9b6db338017 100644 --- a/extensions/Particle3D/PU/CCPUDoPlacementParticleEventHandler.cpp +++ b/extensions/Particle3D/PU/CCPUDoPlacementParticleEventHandler.cpp @@ -34,7 +34,7 @@ NS_CC_BEGIN const unsigned int PUDoPlacementParticleEventHandler::DEFAULT_NUMBER_OF_PARTICLES = 1; //----------------------------------------------------------------------- -PUDoPlacementParticleEventHandler::PUDoPlacementParticleEventHandler(void) : +PUDoPlacementParticleEventHandler::PUDoPlacementParticleEventHandler() : PUEventHandler(), PUListener(), _numberOfParticles(DEFAULT_NUMBER_OF_PARTICLES), @@ -56,7 +56,7 @@ PUDoPlacementParticleEventHandler::PUDoPlacementParticleEventHandler(void) : { } //----------------------------------------------------------------------- -PUDoPlacementParticleEventHandler::~PUDoPlacementParticleEventHandler(void) +PUDoPlacementParticleEventHandler::~PUDoPlacementParticleEventHandler() { // We cannot remove this listener from mTechnique, because it is undetermined whether the ParticleTechnique // still exist. @@ -232,12 +232,12 @@ void PUDoPlacementParticleEventHandler::setForceEmitterName(const std::string& f _forceEmitterName = forceEmitterName; } //----------------------------------------------------------------------- -PUEmitter* PUDoPlacementParticleEventHandler::getForceEmitter(void) const +PUEmitter* PUDoPlacementParticleEventHandler::getForceEmitter() const { return _emitter; } //----------------------------------------------------------------------- -void PUDoPlacementParticleEventHandler::removeAsListener(void) +void PUDoPlacementParticleEventHandler::removeAsListener() { // Reset some values and remove this as a listener from the old technique. if (_system) diff --git a/extensions/Particle3D/PU/CCPUDoPlacementParticleEventHandler.h b/extensions/Particle3D/PU/CCPUDoPlacementParticleEventHandler.h index b5d4b1beadd4..afa06f80f8f5 100644 --- a/extensions/Particle3D/PU/CCPUDoPlacementParticleEventHandler.h +++ b/extensions/Particle3D/PU/CCPUDoPlacementParticleEventHandler.h @@ -51,16 +51,16 @@ class CC_DLL PUDoPlacementParticleEventHandler : public PUEventHandler, public P /** Getters/Setters */ - bool isInheritPosition(void) const {return _inheritPosition;}; - bool isInheritDirection(void) const {return _inheritDirection;}; - bool isInheritOrientation(void) const {return _inheritOrientation;}; - bool isInheritTimeToLive(void) const {return _inheritTimeToLive;}; - bool isInheritMass(void) const {return _inheritMass;}; - bool isInheritTextureCoordinate(void) const {return _inheritTextureCoordinate;}; - bool isInheritColour(void) const {return _inheritColour;}; - bool isInheritParticleWidth(void) const {return _inheritParticleWidth;}; - bool isInheritParticleHeight(void) const {return _inheritParticleHeight;}; - bool isInheritParticleDepth(void) const {return _inheritParticleDepth;}; + bool isInheritPosition() const {return _inheritPosition;}; + bool isInheritDirection() const {return _inheritDirection;}; + bool isInheritOrientation() const {return _inheritOrientation;}; + bool isInheritTimeToLive() const {return _inheritTimeToLive;}; + bool isInheritMass() const {return _inheritMass;}; + bool isInheritTextureCoordinate() const {return _inheritTextureCoordinate;}; + bool isInheritColour() const {return _inheritColour;}; + bool isInheritParticleWidth() const {return _inheritParticleWidth;}; + bool isInheritParticleHeight() const {return _inheritParticleHeight;}; + bool isInheritParticleDepth() const {return _inheritParticleDepth;}; void setInheritPosition(bool inheritPosition) {_inheritPosition = inheritPosition;}; void setInheritDirection(bool inheritDirection) {_inheritDirection = inheritDirection;}; @@ -75,7 +75,7 @@ class CC_DLL PUDoPlacementParticleEventHandler : public PUEventHandler, public P /** Get the name of the emitter that is used to emit its particles. */ - const std::string& getForceEmitterName(void) const {return _forceEmitterName;}; + const std::string& getForceEmitterName() const {return _forceEmitterName;}; /** Set the name of the emitter that is used to emit its particles. */ @@ -83,7 +83,7 @@ class CC_DLL PUDoPlacementParticleEventHandler : public PUEventHandler, public P /** Returns a pointer to the emitter that is used as a force emitter. */ - PUEmitter* getForceEmitter(void) const; + PUEmitter* getForceEmitter() const; /** Remove this as a listener from the technique. @remarks @@ -92,11 +92,11 @@ class CC_DLL PUDoPlacementParticleEventHandler : public PUEventHandler, public P The reason why it is not called automatically in the setForceEmitterName() function is to offer some flexibility on the moment the removeAsListener() is called. */ - void removeAsListener(void); + void removeAsListener(); /** Get the number of particles to emit. */ - unsigned int getNumberOfParticles(void) const {return _numberOfParticles;}; + unsigned int getNumberOfParticles() const {return _numberOfParticles;}; /** Set the number of particles to emit. */ @@ -105,7 +105,7 @@ class CC_DLL PUDoPlacementParticleEventHandler : public PUEventHandler, public P /** Boolean that determines whether always the position of the particle that is handled must be used for emission of the new particle. */ - bool alwaysUsePosition(void) const {return _alwaysUsePosition;}; + bool alwaysUsePosition() const {return _alwaysUsePosition;}; /** Set the boolean to indicate whether the position of the particle that is handled must be used for emission of the new particle or whether the contact point of the physics actor must be used. This only applies if a physics engine @@ -132,8 +132,8 @@ class CC_DLL PUDoPlacementParticleEventHandler : public PUEventHandler, public P virtual void copyAttributesTo (PUEventHandler* eventHandler) override; CC_CONSTRUCTOR_ACCESS: - PUDoPlacementParticleEventHandler(void); - virtual ~PUDoPlacementParticleEventHandler(void); + PUDoPlacementParticleEventHandler(); + virtual ~PUDoPlacementParticleEventHandler(); protected: // Identifies the name of emitter diff --git a/extensions/Particle3D/PU/CCPUDoScaleEventHandler.cpp b/extensions/Particle3D/PU/CCPUDoScaleEventHandler.cpp index 18e28974941b..6ea4a0d353ee 100644 --- a/extensions/Particle3D/PU/CCPUDoScaleEventHandler.cpp +++ b/extensions/Particle3D/PU/CCPUDoScaleEventHandler.cpp @@ -34,14 +34,14 @@ const PUDoScaleEventHandler::ScaleType PUDoScaleEventHandler::DEFAULT_SCALE_TYPE const float PUDoScaleEventHandler::DEFAULT_SCALE_FRACTION = 0.2f; //----------------------------------------------------------------------- -PUDoScaleEventHandler::PUDoScaleEventHandler(void) : - PUEventHandler(), - _scaleFraction(DEFAULT_SCALE_FRACTION), - _scaleType(DEFAULT_SCALE_TYPE) +PUDoScaleEventHandler::PUDoScaleEventHandler() +: PUEventHandler() +, _scaleFraction(DEFAULT_SCALE_FRACTION) +, _scaleType(DEFAULT_SCALE_TYPE) { } //----------------------------------------------------------------------- -const PUDoScaleEventHandler::ScaleType& PUDoScaleEventHandler::getScaleType(void) const +const PUDoScaleEventHandler::ScaleType& PUDoScaleEventHandler::getScaleType() const { return _scaleType; } diff --git a/extensions/Particle3D/PU/CCPUDoScaleEventHandler.h b/extensions/Particle3D/PU/CCPUDoScaleEventHandler.h index d712d84ec083..5410733794a0 100644 --- a/extensions/Particle3D/PU/CCPUDoScaleEventHandler.h +++ b/extensions/Particle3D/PU/CCPUDoScaleEventHandler.h @@ -55,7 +55,7 @@ class CC_DLL PUDoScaleEventHandler : public PUEventHandler /** Returns the scale type */ - const ScaleType& getScaleType(void) const; + const ScaleType& getScaleType() const; /** Set the scale type. This scale type identifies to which attribute the scale factor is applied. */ @@ -77,8 +77,8 @@ class CC_DLL PUDoScaleEventHandler : public PUEventHandler virtual void copyAttributesTo (PUEventHandler* eventHandler) override; CC_CONSTRUCTOR_ACCESS: - PUDoScaleEventHandler(void); - virtual ~PUDoScaleEventHandler(void) {}; + PUDoScaleEventHandler(); + virtual ~PUDoScaleEventHandler() {}; protected: float _scaleFraction; diff --git a/extensions/Particle3D/PU/CCPUDoStopSystemEventHandler.h b/extensions/Particle3D/PU/CCPUDoStopSystemEventHandler.h index bcdadb918acf..fc9734bf7135 100644 --- a/extensions/Particle3D/PU/CCPUDoStopSystemEventHandler.h +++ b/extensions/Particle3D/PU/CCPUDoStopSystemEventHandler.h @@ -52,10 +52,10 @@ class CC_DLL PUDoStopSystemEventHandler : public PUEventHandler virtual void handle(PUParticleSystem3D* particleSystem, PUParticle3D* particle, float timeElapsed) override; CC_CONSTRUCTOR_ACCESS: - PUDoStopSystemEventHandler(void) : PUEventHandler() + PUDoStopSystemEventHandler() : PUEventHandler() { } - virtual ~PUDoStopSystemEventHandler(void) {}; + virtual ~PUDoStopSystemEventHandler() {}; }; NS_CC_END diff --git a/extensions/Particle3D/PU/CCPUDynamicAttribute.cpp b/extensions/Particle3D/PU/CCPUDynamicAttribute.cpp index e66cfa898b13..61350a514b46 100644 --- a/extensions/Particle3D/PU/CCPUDynamicAttribute.cpp +++ b/extensions/Particle3D/PU/CCPUDynamicAttribute.cpp @@ -30,15 +30,15 @@ NS_CC_BEGIN //----------------------------------------------------------------------- - PUDynamicAttribute::PUDynamicAttribute (void) + PUDynamicAttribute::PUDynamicAttribute () { } //----------------------------------------------------------------------- -PUDynamicAttribute::~PUDynamicAttribute (void) +PUDynamicAttribute::~PUDynamicAttribute () { } //----------------------------------------------------------------------- -PUDynamicAttribute::DynamicAttributeType PUDynamicAttribute::getType (void) const +PUDynamicAttribute::DynamicAttributeType PUDynamicAttribute::getType () const { return _type; } @@ -49,7 +49,7 @@ void PUDynamicAttribute::setType (PUDynamicAttribute::DynamicAttributeType type) } //----------------------------------------------------------------------- -PUDynamicAttributeFixed::PUDynamicAttributeFixed (void) : _value(0) +PUDynamicAttributeFixed::PUDynamicAttributeFixed () : _value(0) { _type = PUDynamicAttribute::DAT_FIXED; } @@ -60,7 +60,7 @@ PUDynamicAttributeFixed::PUDynamicAttributeFixed (const PUDynamicAttributeFixed& _value = dynamicAttributeFixed._value; } //----------------------------------------------------------------------- -PUDynamicAttributeFixed::~PUDynamicAttributeFixed (void) +PUDynamicAttributeFixed::~PUDynamicAttributeFixed () { } //----------------------------------------------------------------------- @@ -91,7 +91,7 @@ PUDynamicAttributeFixed* PUDynamicAttributeFixed::clone() } //----------------------------------------------------------------------- -PUDynamicAttributeRandom::PUDynamicAttributeRandom (void) : _min(0), _max(0) +PUDynamicAttributeRandom::PUDynamicAttributeRandom () : _min(0), _max(0) { _type = PUDynamicAttribute::DAT_RANDOM; } @@ -103,11 +103,11 @@ PUDynamicAttributeRandom::PUDynamicAttributeRandom (const PUDynamicAttributeRand _max = dynamicAttributeRandom._max; } //----------------------------------------------------------------------- -PUDynamicAttributeRandom::~PUDynamicAttributeRandom (void) +PUDynamicAttributeRandom::~PUDynamicAttributeRandom () { } //----------------------------------------------------------------------- -float PUDynamicAttributeRandom::getMin (void) const +float PUDynamicAttributeRandom::getMin () const { return _min; } @@ -117,7 +117,7 @@ void PUDynamicAttributeRandom::setMin (float min) _min = min; } //----------------------------------------------------------------------- -float PUDynamicAttributeRandom::getMax (void) const +float PUDynamicAttributeRandom::getMax () const { return _max; } @@ -156,7 +156,7 @@ PUDynamicAttributeRandom* PUDynamicAttributeRandom::clone() } //----------------------------------------------------------------------- -PUDynamicAttributeCurved::PUDynamicAttributeCurved (void) : +PUDynamicAttributeCurved::PUDynamicAttributeCurved () : _range(0), _interpolationType(IT_LINEAR) { @@ -170,10 +170,10 @@ PUDynamicAttributeCurved::PUDynamicAttributeCurved (PUInterpolationType interpol _type = PUDynamicAttribute::DAT_CURVED; } //----------------------------------------------------------------------- -PUDynamicAttributeCurved::PUDynamicAttributeCurved (const PUDynamicAttributeCurved& dynamicAttributeCurved) : - _range(dynamicAttributeCurved._range), - _spline(dynamicAttributeCurved._spline), - _interpolationType(dynamicAttributeCurved._interpolationType) +PUDynamicAttributeCurved::PUDynamicAttributeCurved(const PUDynamicAttributeCurved& dynamicAttributeCurved) +: _range(dynamicAttributeCurved._range) +, _spline(dynamicAttributeCurved._spline) +, _interpolationType(dynamicAttributeCurved._interpolationType) { _type = PUDynamicAttribute::DAT_CURVED; @@ -185,7 +185,7 @@ PUDynamicAttributeCurved::PUDynamicAttributeCurved (const PUDynamicAttributeCurv processControlPoints(); } //----------------------------------------------------------------------- -PUDynamicAttributeCurved::~PUDynamicAttributeCurved (void) +PUDynamicAttributeCurved::~PUDynamicAttributeCurved () { } //----------------------------------------------------------------------- @@ -199,7 +199,7 @@ void PUDynamicAttributeCurved::setInterpolationType (PUInterpolationType interpo } } //----------------------------------------------------------------------- -PUInterpolationType PUDynamicAttributeCurved::getInterpolationType (void) const +PUInterpolationType PUDynamicAttributeCurved::getInterpolationType () const { return _interpolationType; } @@ -248,12 +248,12 @@ void PUDynamicAttributeCurved::addControlPoint (float x, float y) _controlPoints.push_back(Vec2(x, y)); } //----------------------------------------------------------------------- -const PUDynamicAttributeCurved::ControlPointList& PUDynamicAttributeCurved::getControlPoints (void) const +const PUDynamicAttributeCurved::ControlPointList& PUDynamicAttributeCurved::getControlPoints () const { return _controlPoints; } //----------------------------------------------------------------------- -void PUDynamicAttributeCurved::processControlPoints(void) +void PUDynamicAttributeCurved::processControlPoints() { if (_controlPoints.empty()) return; @@ -271,12 +271,12 @@ void PUDynamicAttributeCurved::processControlPoints(void) } } //----------------------------------------------------------------------- -size_t PUDynamicAttributeCurved::getNumControlPoints(void) const +size_t PUDynamicAttributeCurved::getNumControlPoints() const { return _controlPoints.size(); } //----------------------------------------------------------------------- -void PUDynamicAttributeCurved::removeAllControlPoints(void) +void PUDynamicAttributeCurved::removeAllControlPoints() { _controlPoints.clear(); } @@ -301,12 +301,12 @@ PUDynamicAttributeCurved::ControlPointList::iterator PUDynamicAttributeCurved::f return --it; } //----------------------------------------------------------------------- -PUDynamicAttributeCurved::ControlPointList::iterator PUDynamicAttributeCurved::getFirstValidIterator(void) +PUDynamicAttributeCurved::ControlPointList::iterator PUDynamicAttributeCurved::getFirstValidIterator() { return _controlPoints.begin(); } //----------------------------------------------------------------------- -PUDynamicAttributeCurved::ControlPointList::iterator PUDynamicAttributeCurved::getLastValidIterator(void) +PUDynamicAttributeCurved::ControlPointList::iterator PUDynamicAttributeCurved::getLastValidIterator() { return _controlPoints.end() - 1; } @@ -340,7 +340,7 @@ PUDynamicAttributeCurved* PUDynamicAttributeCurved::clone() } //----------------------------------------------------------------------- -PUDynamicAttributeOscillate::PUDynamicAttributeOscillate (void) : +PUDynamicAttributeOscillate::PUDynamicAttributeOscillate () : _oscillationType(PUDynamicAttributeOscillate::OSCT_SINE), _frequency(1.0f), _phase(0.0f), @@ -355,11 +355,11 @@ PUDynamicAttributeOscillate::PUDynamicAttributeOscillate (const PUDynamicAttribu _type = PUDynamicAttribute::DAT_OSCILLATE; } //----------------------------------------------------------------------- -PUDynamicAttributeOscillate::~PUDynamicAttributeOscillate (void) +PUDynamicAttributeOscillate::~PUDynamicAttributeOscillate () { } //----------------------------------------------------------------------- -PUDynamicAttributeOscillate::OscillationType PUDynamicAttributeOscillate::getOscillationType (void) const +PUDynamicAttributeOscillate::OscillationType PUDynamicAttributeOscillate::getOscillationType () const { return _oscillationType; } @@ -369,7 +369,7 @@ void PUDynamicAttributeOscillate::setOscillationType (PUDynamicAttributeOscillat _oscillationType = oscillationType; } //----------------------------------------------------------------------- -float PUDynamicAttributeOscillate::getFrequency (void) const +float PUDynamicAttributeOscillate::getFrequency () const { return _frequency; } @@ -379,7 +379,7 @@ void PUDynamicAttributeOscillate::setFrequency (float frequency) _frequency = frequency; } //----------------------------------------------------------------------- -float PUDynamicAttributeOscillate::getPhase (void) const +float PUDynamicAttributeOscillate::getPhase () const { return _phase; } @@ -389,7 +389,7 @@ void PUDynamicAttributeOscillate::setPhase (float phase) _phase = phase; } //----------------------------------------------------------------------- -float PUDynamicAttributeOscillate::getBase (void) const +float PUDynamicAttributeOscillate::getBase () const { return _base; } @@ -399,7 +399,7 @@ void PUDynamicAttributeOscillate::setBase (float base) _base = base; } //----------------------------------------------------------------------- -float PUDynamicAttributeOscillate::getAmplitude (void) const +float PUDynamicAttributeOscillate::getAmplitude () const { return _amplitude; } diff --git a/extensions/Particle3D/PU/CCPUDynamicAttribute.h b/extensions/Particle3D/PU/CCPUDynamicAttribute.h index 9d4cc444c6fa..ef3f554f8bf6 100644 --- a/extensions/Particle3D/PU/CCPUDynamicAttribute.h +++ b/extensions/Particle3D/PU/CCPUDynamicAttribute.h @@ -73,11 +73,11 @@ class CC_DLL PUDynamicAttribute : public Ref /** Constructor */ - PUDynamicAttribute (void); + PUDynamicAttribute (); /** Destructor */ - virtual ~PUDynamicAttribute (void); + virtual ~PUDynamicAttribute (); /** Virtual function that needs to be implemented by its childs. */ @@ -85,7 +85,7 @@ class CC_DLL PUDynamicAttribute : public Ref /** Todo */ - DynamicAttributeType getType (void) const; + DynamicAttributeType getType () const; /** Todo */ @@ -93,7 +93,7 @@ class CC_DLL PUDynamicAttribute : public Ref /** Returns true if one of the attributes was changed by an external source. */ - bool isValueChangedExternally(void) const; + bool isValueChangedExternally() const; virtual void copyAttributesTo(PUDynamicAttribute* dynamicAttribute) = 0; virtual PUDynamicAttribute* clone() = 0; @@ -114,7 +114,7 @@ class CC_DLL PUDynamicAttributeFixed : public PUDynamicAttribute public: /** Constructor */ - PUDynamicAttributeFixed (void); + PUDynamicAttributeFixed (); /** Copy constructor */ @@ -122,7 +122,7 @@ class CC_DLL PUDynamicAttributeFixed : public PUDynamicAttribute /** Destructor */ - ~PUDynamicAttributeFixed (void); + ~PUDynamicAttributeFixed (); /** Todo */ @@ -146,7 +146,7 @@ class CC_DLL PUDynamicAttributeRandom : public PUDynamicAttribute public: /** Constructor */ - PUDynamicAttributeRandom (void); + PUDynamicAttributeRandom (); /** Copy constructor */ @@ -154,7 +154,7 @@ class CC_DLL PUDynamicAttributeRandom : public PUDynamicAttribute /** Destructor */ - ~PUDynamicAttributeRandom (void); + ~PUDynamicAttributeRandom (); /** Todo */ @@ -163,9 +163,9 @@ class CC_DLL PUDynamicAttributeRandom : public PUDynamicAttribute /** Todo */ void setMin (float min); - float getMin (void) const; + float getMin () const; void setMax (float max); - float getMax (void) const; + float getMax () const; void setMinMax (float min, float max); virtual PUDynamicAttributeRandom* clone() override; @@ -188,7 +188,7 @@ class CC_DLL PUDynamicAttributeCurved : public PUDynamicAttribute /** Constructor */ - PUDynamicAttributeCurved (void); + PUDynamicAttributeCurved (); PUDynamicAttributeCurved (PUInterpolationType interpolationType); /** Copy constructor @@ -197,12 +197,12 @@ class CC_DLL PUDynamicAttributeCurved : public PUDynamicAttribute /** Destructor */ - ~PUDynamicAttributeCurved (void); + ~PUDynamicAttributeCurved (); /** Get and set the curve type */ void setInterpolationType (PUInterpolationType interpolationType); - PUInterpolationType getInterpolationType (void) const; + PUInterpolationType getInterpolationType () const; /** Todo */ @@ -214,19 +214,19 @@ class CC_DLL PUDynamicAttributeCurved : public PUDynamicAttribute /** Todo */ - const ControlPointList& getControlPoints (void) const; + const ControlPointList& getControlPoints () const; /** Todo */ - void processControlPoints (void); + void processControlPoints (); /** Todo */ - size_t getNumControlPoints(void) const; + size_t getNumControlPoints() const; /** Todo */ - void removeAllControlPoints(void); + void removeAllControlPoints(); virtual PUDynamicAttributeCurved* clone() override; virtual void copyAttributesTo(PUDynamicAttribute* dynamicAttribute) override; @@ -255,8 +255,8 @@ class CC_DLL PUDynamicAttributeCurved : public PUDynamicAttribute /** Helper functions */ - inline ControlPointList::iterator getFirstValidIterator(void); - inline ControlPointList::iterator getLastValidIterator(void); + inline ControlPointList::iterator getFirstValidIterator(); + inline ControlPointList::iterator getLastValidIterator(); }; /* This class generates values based on an oscillating function (i.e. Sine). @@ -272,7 +272,7 @@ class CC_DLL PUDynamicAttributeOscillate : public PUDynamicAttribute /** Constructor */ - PUDynamicAttributeOscillate (void); + PUDynamicAttributeOscillate (); /** Copy constructor */ @@ -280,7 +280,7 @@ class CC_DLL PUDynamicAttributeOscillate : public PUDynamicAttribute /** Destructor */ - ~PUDynamicAttributeOscillate (void); + ~PUDynamicAttributeOscillate (); /** Todo */ @@ -288,27 +288,27 @@ class CC_DLL PUDynamicAttributeOscillate : public PUDynamicAttribute /** Get and set the OscillationType */ - OscillationType getOscillationType (void) const; + OscillationType getOscillationType () const; void setOscillationType (OscillationType oscillationType); /** Get and set the Frequency */ - float getFrequency (void) const; + float getFrequency () const; void setFrequency (float frequency); /** Get and set the Phase */ - float getPhase (void) const; + float getPhase () const; void setPhase (float phase); /** Get and set the Base */ - float getBase (void) const; + float getBase () const; void setBase (float base); /** Get and set the Amplitude */ - float getAmplitude (void) const; + float getAmplitude () const; void setAmplitude (float amplitude); virtual PUDynamicAttributeOscillate* clone() override; diff --git a/extensions/Particle3D/PU/CCPUEmitter.cpp b/extensions/Particle3D/PU/CCPUEmitter.cpp index 3d5c998ccdd4..cd7894024cf8 100755 --- a/extensions/Particle3D/PU/CCPUEmitter.cpp +++ b/extensions/Particle3D/PU/CCPUEmitter.cpp @@ -131,41 +131,30 @@ PUEmitter::~PUEmitter() { _particleSystem = nullptr; - if (_dynEmissionRate) - delete _dynEmissionRate; + delete _dynEmissionRate; - if (_dynTotalTimeToLive) - delete _dynTotalTimeToLive; + delete _dynTotalTimeToLive; - if (_dynParticleMass) - delete _dynParticleMass; + delete _dynParticleMass; - if (_dynVelocity) - delete _dynVelocity; + delete _dynVelocity; - if (_dynDuration) - delete _dynDuration; + delete _dynDuration; - if (_dynRepeatDelay) - delete _dynRepeatDelay; + delete _dynRepeatDelay; - if (_dynParticleAllDimensions) - delete _dynParticleAllDimensions; + delete _dynParticleAllDimensions; - if (_dynParticleWidth) - delete _dynParticleWidth; + delete _dynParticleWidth; - if (_dynParticleHeight) - delete _dynParticleHeight; + delete _dynParticleHeight; - if (_dynParticleDepth) - delete _dynParticleDepth; + delete _dynParticleDepth; //if (mEmissionRateCameraDependency) // mCameraDependencyFactory.destroy(mEmissionRateCameraDependency); - if (_dynAngle) - delete _dynAngle; + delete _dynAngle; } void PUEmitter::updateEmitter(Particle3D* /*particle*/, float /*deltaTime*/) @@ -328,7 +317,7 @@ void PUEmitter::setEnabled( bool enabled ) initTimeBased(); } -bool PUEmitter::isEnabled( void ) const +bool PUEmitter::isEnabled() const { return _isEnabled; } @@ -410,7 +399,7 @@ void PUEmitter::postUpdateEmitter( float /*deltaTime*/ ) } //----------------------------------------------------------------------- -bool PUEmitter::isKeepLocal(void) const +bool PUEmitter::isKeepLocal() const { return _keepLocal; } @@ -433,7 +422,7 @@ bool PUEmitter::makeParticleLocal(PUParticle3D* particle) } //----------------------------------------------------------------------- -const Vec4& PUEmitter::getParticleColor(void) const +const Vec4& PUEmitter::getParticleColor() const { return _particleColor; } @@ -443,7 +432,7 @@ void PUEmitter::setParticleColor(const Vec4& particleColor) _particleColor = particleColor; } //----------------------------------------------------------------------- -const Vec4& PUEmitter::getParticleColorRangeStart(void) const +const Vec4& PUEmitter::getParticleColorRangeStart() const { return _particleColorRangeStart; } @@ -454,7 +443,7 @@ void PUEmitter::setParticleColorRangeStart(const Vec4& particleColorRangeStart) _particleColorRangeSet = true; } //----------------------------------------------------------------------- -const Vec4& PUEmitter::getParticleColorRangeEnd(void) const +const Vec4& PUEmitter::getParticleColorRangeEnd() const { return _particleColorRangeEnd; } @@ -465,7 +454,7 @@ void PUEmitter::setParticleColorRangeEnd(const Vec4& particleColorRangeEnd) _particleColorRangeSet = true; } //----------------------------------------------------------------------- -const unsigned short& PUEmitter::getParticleTextureCoords(void) const +const unsigned short& PUEmitter::getParticleTextureCoords() const { return _particleTextureCoords; } @@ -475,7 +464,7 @@ void PUEmitter::setParticleTextureCoords(const unsigned short& particleTextureCo _particleTextureCoords = particleTextureCoords; } //----------------------------------------------------------------------- -const unsigned short& PUEmitter::getParticleTextureCoordsRangeStart(void) const +const unsigned short& PUEmitter::getParticleTextureCoordsRangeStart() const { return _particleTextureCoordsRangeStart; } @@ -486,7 +475,7 @@ void PUEmitter::setParticleTextureCoordsRangeStart(const unsigned short& particl _particleTextureCoordsRangeSet = true; } //----------------------------------------------------------------------- -const unsigned short& PUEmitter::getParticleTextureCoordsRangeEnd(void) const +const unsigned short& PUEmitter::getParticleTextureCoordsRangeEnd() const { return _particleTextureCoordsRangeEnd; } @@ -516,48 +505,42 @@ void PUEmitter::setEmitsName(const std::string& emitsName) //----------------------------------------------------------------------- void PUEmitter::setDynEmissionRate(PUDynamicAttribute* dynEmissionRate) { - if (_dynEmissionRate) - delete _dynEmissionRate; + delete _dynEmissionRate; _dynEmissionRate = dynEmissionRate; } //----------------------------------------------------------------------- void PUEmitter::setDynTotalTimeToLive(PUDynamicAttribute* dynTotalTimeToLive) { - if (_dynTotalTimeToLive) - delete _dynTotalTimeToLive; + delete _dynTotalTimeToLive; _dynTotalTimeToLive = dynTotalTimeToLive; } //----------------------------------------------------------------------- void PUEmitter::setDynParticleMass(PUDynamicAttribute* dynParticleMass) { - if (_dynParticleMass) - delete _dynParticleMass; + delete _dynParticleMass; _dynParticleMass = dynParticleMass; } //----------------------------------------------------------------------- void PUEmitter::setDynAngle(PUDynamicAttribute* dynAngle) { - if (_dynAngle) - delete _dynAngle; + delete _dynAngle; _dynAngle = dynAngle; } //----------------------------------------------------------------------- void PUEmitter::setDynVelocity(PUDynamicAttribute* dynVelocity) { - if (_dynVelocity) - delete _dynVelocity; + delete _dynVelocity; _dynVelocity = dynVelocity; } //----------------------------------------------------------------------- void PUEmitter::setDynDuration(PUDynamicAttribute* dynDuration) { - if (_dynDuration) - delete _dynDuration; + delete _dynDuration; _dynDuration = dynDuration; _dynDurationSet = true; @@ -571,8 +554,7 @@ void PUEmitter::setDynDurationSet(bool durationSet) //----------------------------------------------------------------------- void PUEmitter::setDynRepeatDelay(PUDynamicAttribute* dynRepeatDelay) { - if (_dynRepeatDelay) - delete _dynRepeatDelay; + delete _dynRepeatDelay; _dynRepeatDelay = dynRepeatDelay; _dynRepeatDelaySet = true; @@ -586,8 +568,7 @@ void PUEmitter::setDynRepeatDelaySet(bool repeatDelaySet) //----------------------------------------------------------------------- void PUEmitter::setDynParticleAllDimensions(PUDynamicAttribute* dynParticleAllDimensions) { - if (_dynParticleAllDimensions) - delete _dynParticleAllDimensions; + delete _dynParticleAllDimensions; _dynParticleAllDimensions = dynParticleAllDimensions; _dynParticleAllDimensionsSet = true; @@ -600,8 +581,7 @@ void PUEmitter::setDynParticleAllDimensionsSet(bool particleAllDimensionsSet) //----------------------------------------------------------------------- void PUEmitter::setDynParticleWidth(PUDynamicAttribute* dynParticleWidth) { - if (_dynParticleWidth) - delete _dynParticleWidth; + delete _dynParticleWidth; _dynParticleWidth = dynParticleWidth; _dynParticleWidthSet = true; @@ -614,8 +594,7 @@ void PUEmitter::setDynParticleWidthSet(bool particleWidthSet) //----------------------------------------------------------------------- void PUEmitter::setDynParticleHeight(PUDynamicAttribute* dynParticleHeight) { - if (_dynParticleHeight) - delete _dynParticleHeight; + delete _dynParticleHeight; _dynParticleHeight = dynParticleHeight; _dynParticleHeightSet = true; @@ -628,8 +607,7 @@ void PUEmitter::setDynParticleHeightSet(bool particleHeightSet) //----------------------------------------------------------------------- void PUEmitter::setDynParticleDepth(PUDynamicAttribute* dynParticleDepth) { - if (_dynParticleDepth) - delete _dynParticleDepth; + delete _dynParticleDepth; _dynParticleDepth = dynParticleDepth; _dynParticleDepthSet = true; @@ -640,7 +618,7 @@ void PUEmitter::setDynParticleDepthSet(bool particleDepthSet) _dynParticleDepthSet = particleDepthSet; } //----------------------------------------------------------------------- -const Vec3& PUEmitter::getParticleDirection(void) +const Vec3& PUEmitter::getParticleDirection() { return _particleDirection; } @@ -655,12 +633,12 @@ void PUEmitter::setParticleDirection(const Vec3& direction) _upVector.normalize(); } //----------------------------------------------------------------------- -const Vec3& PUEmitter::getOriginalParticleDirection(void) const +const Vec3& PUEmitter::getOriginalParticleDirection() const { return _originalParticleDirection; } //----------------------------------------------------------------------- -const Quaternion& PUEmitter::getParticleOrientation(void) const +const Quaternion& PUEmitter::getParticleOrientation() const { return _particleOrientation; } @@ -670,7 +648,7 @@ void PUEmitter::setParticleOrientation(const Quaternion& orientation) _particleOrientation = orientation; } //----------------------------------------------------------------------- -const Quaternion& PUEmitter::getParticleOrientationRangeStart(void) const +const Quaternion& PUEmitter::getParticleOrientationRangeStart() const { return _particleOrientationRangeStart; } @@ -681,7 +659,7 @@ void PUEmitter::setParticleOrientationRangeStart(const Quaternion& orientationRa _particleOrientationRangeSet = true; } //----------------------------------------------------------------------- -const Quaternion& PUEmitter::getParticleOrientationRangeEnd(void) const +const Quaternion& PUEmitter::getParticleOrientationRangeEnd() const { return _particleOrientationRangeEnd; } @@ -692,7 +670,7 @@ void PUEmitter::setParticleOrientationRangeEnd(const Quaternion& orientationRang _particleOrientationRangeSet = true; } //----------------------------------------------------------------------- -bool PUEmitter::isAutoDirection(void) const +bool PUEmitter::isAutoDirection() const { return _autoDirection; } @@ -702,7 +680,7 @@ void PUEmitter::setAutoDirection(bool autoDirection) _autoDirection = autoDirection; } //----------------------------------------------------------------------- -bool PUEmitter::isForceEmission(void) const +bool PUEmitter::isForceEmission() const { return _forceEmission; } @@ -715,7 +693,7 @@ void PUEmitter::setForceEmission(bool forceEmission) _originalForceEmissionExecuted = false; } -void PUEmitter::initTimeBased( void ) +void PUEmitter::initTimeBased() { if (_isEnabled) { diff --git a/extensions/Particle3D/PU/CCPUEmitter.h b/extensions/Particle3D/PU/CCPUEmitter.h index db03e6da03f2..fe7c32ca1863 100644 --- a/extensions/Particle3D/PU/CCPUEmitter.h +++ b/extensions/Particle3D/PU/CCPUEmitter.h @@ -106,7 +106,7 @@ class CC_DLL PUEmitter : public Particle3DEmitter */ void setEnabled (bool enabled); - bool isEnabled(void) const; + bool isEnabled() const; bool isEmitterDone() const; @@ -198,15 +198,15 @@ class CC_DLL PUEmitter : public Particle3DEmitter /** Returns the base direction of the particle that is going to be emitted. */ - const Vec3& getParticleDirection(void); + const Vec3& getParticleDirection(); /** Returns the originally set particle direction. This value is not affected by affectors, angle, etc. */ - const Vec3& getOriginalParticleDirection(void) const; + const Vec3& getOriginalParticleDirection() const; /** Returns the base orientation of the particle that is going to be emitted. */ - const Quaternion& getParticleOrientation(void) const; + const Quaternion& getParticleOrientation() const; /** Set the orientation of the particle. */ @@ -216,7 +216,7 @@ class CC_DLL PUEmitter : public Particle3DEmitter @remarks The orientation is generated random between mParticleOrientationRangeStart and mParticleOrientationRangeEnd. */ - const Quaternion& getParticleOrientationRangeStart(void) const; + const Quaternion& getParticleOrientationRangeStart() const; /** Set start orientation of the particle that is going to be emitted. @remarks @@ -228,7 +228,7 @@ class CC_DLL PUEmitter : public Particle3DEmitter @remarks The orientation is generated random between mParticleOrientationRangeStart and mParticleOrientationRangeEnd. */ - const Quaternion& getParticleOrientationRangeEnd(void) const; + const Quaternion& getParticleOrientationRangeEnd() const; /** Set end orientation of the particle that is going to be emitted. @remarks @@ -245,7 +245,7 @@ class CC_DLL PUEmitter : public Particle3DEmitter /** Todo */ - bool isAutoDirection(void) const; + bool isAutoDirection() const; /** Todo */ @@ -253,7 +253,7 @@ class CC_DLL PUEmitter : public Particle3DEmitter /** Todo */ - bool isForceEmission(void) const; + bool isForceEmission() const; /** Todo */ @@ -261,7 +261,7 @@ class CC_DLL PUEmitter : public Particle3DEmitter /** Get the colour of a particle that will be emitted. */ - const Vec4& getParticleColor(void) const; + const Vec4& getParticleColor() const; /** Set the colour of an emitted particle. */ @@ -269,7 +269,7 @@ class CC_DLL PUEmitter : public Particle3DEmitter /** Get the colour range start of an emitted particle. */ - const Vec4& getParticleColorRangeStart(void) const; + const Vec4& getParticleColorRangeStart() const; /** Set the colour range start of an emitted particle. This is the lower value used to generate a random colour. */ @@ -277,7 +277,7 @@ class CC_DLL PUEmitter : public Particle3DEmitter /** Get the colour range end of an emitted particle. */ - const Vec4& getParticleColorRangeEnd(void) const; + const Vec4& getParticleColorRangeEnd() const; /** Set the colour range end of an emitted particle. This is the upper value used to generate a random colour. */ @@ -285,7 +285,7 @@ class CC_DLL PUEmitter : public Particle3DEmitter /** Get the texture coords of an emitted particle. */ - const unsigned short& getParticleTextureCoords(void) const; + const unsigned short& getParticleTextureCoords() const; /** Set the texture coords of an emitted particle. */ @@ -293,7 +293,7 @@ class CC_DLL PUEmitter : public Particle3DEmitter /** Get the texture coords range start of an emitted particle. */ - const unsigned short& getParticleTextureCoordsRangeStart(void) const; + const unsigned short& getParticleTextureCoordsRangeStart() const; /** Set the texture coords range start of an emitted particle. This is the lower value used to set a random texture coords. */ @@ -301,7 +301,7 @@ class CC_DLL PUEmitter : public Particle3DEmitter /** Get the texture coords range end of an emitted particle. */ - const unsigned short& getParticleTextureCoordsRangeEnd(void) const; + const unsigned short& getParticleTextureCoordsRangeEnd() const; /** Set the texture coords range end of an emitted particle. This is the upper value used to set a random texture coords. */ @@ -309,7 +309,7 @@ class CC_DLL PUEmitter : public Particle3DEmitter /** Todo */ - bool isKeepLocal(void) const; + bool isKeepLocal() const; /** If this attribute is set to 'true', the particles are emitted relative to the emitter */ @@ -352,7 +352,7 @@ class CC_DLL PUEmitter : public Particle3DEmitter /** Initialise some attributes that are time-based. */ - inline void initTimeBased(void); + inline void initTimeBased(); /** Internal method for generating the angle. */ diff --git a/extensions/Particle3D/PU/CCPUEventHandler.cpp b/extensions/Particle3D/PU/CCPUEventHandler.cpp index e760f23b3a36..7f28510a9f78 100644 --- a/extensions/Particle3D/PU/CCPUEventHandler.cpp +++ b/extensions/Particle3D/PU/CCPUEventHandler.cpp @@ -35,7 +35,7 @@ _parentObserver(0), _eventHandlerScale(Vec3::ONE) { //mAliasType = AT_HANDLER; -}; +} PUEventHandler::~PUEventHandler( ) { diff --git a/extensions/Particle3D/PU/CCPUEventHandler.h b/extensions/Particle3D/PU/CCPUEventHandler.h index 3be219da0b12..b499ee53a74d 100644 --- a/extensions/Particle3D/PU/CCPUEventHandler.h +++ b/extensions/Particle3D/PU/CCPUEventHandler.h @@ -44,17 +44,17 @@ class CC_DLL PUEventHandler : public Ref /** Todo */ - const std::string& getName(void) const {return _name;}; + const std::string& getName() const {return _name;}; void setName(const std::string& name) {_name = name;}; /** Todo */ - PUObserver* getParentObserver(void) const {return _parentObserver;}; + PUObserver* getParentObserver() const {return _parentObserver;}; void setParentObserver(PUObserver* parentObserver) {_parentObserver = parentObserver;}; /** Todo */ - const std::string& getEventHandlerType(void) const {return _eventHandlerType;}; + const std::string& getEventHandlerType() const {return _eventHandlerType;}; void setEventHandlerType(const std::string& eventHandlerType) {_eventHandlerType = eventHandlerType;}; /** Notify that the event handler is rescaled. diff --git a/extensions/Particle3D/PU/CCPUEventHandlerTranslator.h b/extensions/Particle3D/PU/CCPUEventHandlerTranslator.h index 5f71e41daca1..7e300f8f4abd 100644 --- a/extensions/Particle3D/PU/CCPUEventHandlerTranslator.h +++ b/extensions/Particle3D/PU/CCPUEventHandlerTranslator.h @@ -39,8 +39,8 @@ class PUEventHandlerTranslator : public PUScriptTranslator PUEventHandler* _handler; public: - PUEventHandlerTranslator(void); - virtual ~PUEventHandlerTranslator(void){}; + PUEventHandlerTranslator(); + virtual ~PUEventHandlerTranslator(){}; virtual void translate(PUScriptCompiler* compiler, PUAbstractNode *node); }; diff --git a/extensions/Particle3D/PU/CCPUForceField.cpp b/extensions/Particle3D/PU/CCPUForceField.cpp index 590733bbb5fa..47e0b89b7281 100644 --- a/extensions/Particle3D/PU/CCPUForceField.cpp +++ b/extensions/Particle3D/PU/CCPUForceField.cpp @@ -31,7 +31,7 @@ NS_CC_BEGIN const Vec3 PUForceFieldCalculationFactory::DEFAULT_WORLDSIZE(500.0f, 500.0f, 500.0f); //----------------------------------------------------------------------- -unsigned short PUForceFieldCalculationFactory::getOctaves(void) const +unsigned short PUForceFieldCalculationFactory::getOctaves() const { return _octaves; } @@ -42,7 +42,7 @@ void PUForceFieldCalculationFactory::setOctaves(unsigned short octaves) generate(getForceFieldSize(), _octaves, _frequency, _amplitude, _persistence, _worldSize); } //----------------------------------------------------------------------- -double PUForceFieldCalculationFactory::getFrequency(void) const +double PUForceFieldCalculationFactory::getFrequency() const { return _frequency; } @@ -53,7 +53,7 @@ void PUForceFieldCalculationFactory::setFrequency(double frequency) generate(getForceFieldSize(), _octaves, _frequency, _amplitude, _persistence, _worldSize); } //----------------------------------------------------------------------- -double PUForceFieldCalculationFactory::getAmplitude(void) const +double PUForceFieldCalculationFactory::getAmplitude() const { return _amplitude; } @@ -64,7 +64,7 @@ void PUForceFieldCalculationFactory::setAmplitude(double amplitude) generate(getForceFieldSize(), _octaves, _frequency, _amplitude, _persistence, _worldSize); } //----------------------------------------------------------------------- -double PUForceFieldCalculationFactory::getPersistence(void) const +double PUForceFieldCalculationFactory::getPersistence() const { return _persistence; } @@ -75,7 +75,7 @@ void PUForceFieldCalculationFactory::setPersistence(double persistence) generate(getForceFieldSize(), _octaves, _frequency, _amplitude, _persistence, _worldSize); } //----------------------------------------------------------------------- -unsigned int PUForceFieldCalculationFactory::getForceFieldSize(void) const +unsigned int PUForceFieldCalculationFactory::getForceFieldSize() const { return 1; // Return default cubic size } @@ -89,7 +89,7 @@ void PUForceFieldCalculationFactory::setForceFieldSize(unsigned int forceFieldSi generate(forceFieldSize, _octaves, _frequency, _amplitude, _persistence, _worldSize); } //----------------------------------------------------------------------- -Vec3 PUForceFieldCalculationFactory::getWorldSize(void) const +Vec3 PUForceFieldCalculationFactory::getWorldSize() const { return _worldSize; } @@ -152,7 +152,7 @@ void PURealTimeForceFieldCalculationFactory::determineForce(const Vec3& position //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- -PUForceField::PUForceField(void) : +PUForceField::PUForceField() : _octaves(2), _frequency(1.0f), _amplitude(1.0f), @@ -164,12 +164,9 @@ PUForceField::PUForceField(void) : { } //----------------------------------------------------------------------- -PUForceField::~PUForceField(void) +PUForceField::~PUForceField() { - if (_forceFieldCalculationFactory) - { - delete _forceFieldCalculationFactory; - } + delete _forceFieldCalculationFactory; } //----------------------------------------------------------------------- void PUForceField::initialise(ForceFieldType type, @@ -207,7 +204,7 @@ void PUForceField::initialise(ForceFieldType type, _forceFieldCalculationFactory->generate(forceFieldSize, octaves, frequency, amplitude, persistence, worldSize); } //----------------------------------------------------------------------- -const Vec3& PUForceField::getForceFieldPositionBase(void) const +const Vec3& PUForceField::getForceFieldPositionBase() const { return _forceFieldPositionBase; } @@ -236,10 +233,7 @@ PUForceFieldCalculationFactory* PUForceField::getForceFieldCalculationFactory() //----------------------------------------------------------------------- void PUForceField::setForceFieldCalculationFactory(PUForceFieldCalculationFactory* forceFieldCalculationFactory) { - if (_forceFieldCalculationFactory) - { - delete _forceFieldCalculationFactory; - } + delete _forceFieldCalculationFactory; _forceFieldCalculationFactory = forceFieldCalculationFactory; } //----------------------------------------------------------------------- @@ -274,7 +268,7 @@ void PUForceField::setForceFieldType(const PUForceField::ForceFieldType forceFie } } //----------------------------------------------------------------------- -unsigned short PUForceField::getOctaves(void) const +unsigned short PUForceField::getOctaves() const { return _octaves; } @@ -288,7 +282,7 @@ void PUForceField::setOctaves(unsigned short octaves) } } //----------------------------------------------------------------------- -double PUForceField::getFrequency(void) const +double PUForceField::getFrequency() const { return _frequency; } @@ -302,7 +296,7 @@ void PUForceField::setFrequency(double frequency) } } //----------------------------------------------------------------------- -double PUForceField::getAmplitude(void) const +double PUForceField::getAmplitude() const { return _amplitude; } @@ -316,7 +310,7 @@ void PUForceField::setAmplitude(double amplitude) } } //----------------------------------------------------------------------- -double PUForceField::getPersistence(void) const +double PUForceField::getPersistence() const { return _persistence; } @@ -330,7 +324,7 @@ void PUForceField::setPersistence(double persistence) } } //----------------------------------------------------------------------- -unsigned int PUForceField::getForceFieldSize(void) const +unsigned int PUForceField::getForceFieldSize() const { return _forceFieldSize; } @@ -344,7 +338,7 @@ void PUForceField::setForceFieldSize(unsigned int forceFieldSize) } } //----------------------------------------------------------------------- -Vec3 PUForceField::getWorldSize(void) const +Vec3 PUForceField::getWorldSize() const { return _worldSize; } diff --git a/extensions/Particle3D/PU/CCPUForceField.h b/extensions/Particle3D/PU/CCPUForceField.h index 716256e035a6..b43ba5e60681 100644 --- a/extensions/Particle3D/PU/CCPUForceField.h +++ b/extensions/Particle3D/PU/CCPUForceField.h @@ -41,15 +41,15 @@ class PUForceFieldCalculationFactory // Const static const Vec3 DEFAULT_WORLDSIZE; - PUForceFieldCalculationFactory(void) : - _octaves(2), - _frequency(1.0f), - _amplitude(1.0f), - _persistence(1.0f), - _worldSize(DEFAULT_WORLDSIZE) + PUForceFieldCalculationFactory() + : _octaves(2) + , _frequency(1.0f) + , _amplitude(1.0f) + , _persistence(1.0f) + , _worldSize(DEFAULT_WORLDSIZE) { } - virtual ~PUForceFieldCalculationFactory(void){}; + virtual ~PUForceFieldCalculationFactory(){}; /** Generates the force field @remarks @@ -74,17 +74,17 @@ class PUForceFieldCalculationFactory /** Default Getters/Setters */ - virtual unsigned short getOctaves(void) const; + virtual unsigned short getOctaves() const; virtual void setOctaves(unsigned short octaves); - virtual double getFrequency(void) const; + virtual double getFrequency() const; virtual void setFrequency(double frequency); - virtual double getAmplitude(void) const; + virtual double getAmplitude() const; virtual void setAmplitude(double amplitude); - virtual double getPersistence(void) const; + virtual double getPersistence() const; virtual void setPersistence(double persistence); - virtual unsigned int getForceFieldSize(void) const; + virtual unsigned int getForceFieldSize() const; virtual void setForceFieldSize(unsigned int forceFieldSize); - virtual Vec3 getWorldSize(void) const; + virtual Vec3 getWorldSize() const; virtual void setWorldSize(const Vec3& worldSize); protected: @@ -106,8 +106,8 @@ class PUForceFieldCalculationFactory class PURealTimeForceFieldCalculationFactory : public PUForceFieldCalculationFactory { public: - PURealTimeForceFieldCalculationFactory(void) : PUForceFieldCalculationFactory() {}; - virtual ~PURealTimeForceFieldCalculationFactory(void){}; + PURealTimeForceFieldCalculationFactory() : PUForceFieldCalculationFactory() {}; + virtual ~PURealTimeForceFieldCalculationFactory(){}; /** Override from ForceFieldCalculationFactory */ @@ -164,7 +164,7 @@ class PUForceField const Vec3& worldSize); /** Get/Set the base position of the force field */ - const Vec3& getForceFieldPositionBase(void) const; + const Vec3& getForceFieldPositionBase() const; void setForceFieldPositionBase(const Vec3& position); /** Calculate the force, based on a certain position */ @@ -172,17 +172,17 @@ class PUForceField /** Getters/Setters */ - virtual unsigned short getOctaves(void) const; + virtual unsigned short getOctaves() const; virtual void setOctaves(unsigned short octaves); - virtual double getFrequency(void) const; + virtual double getFrequency() const; virtual void setFrequency(double frequency); - virtual double getAmplitude(void) const; + virtual double getAmplitude() const; virtual void setAmplitude(double amplitude); - virtual double getPersistence(void) const; + virtual double getPersistence() const; virtual void setPersistence(double persistence); - virtual unsigned int getForceFieldSize(void) const; + virtual unsigned int getForceFieldSize() const; virtual void setForceFieldSize(unsigned int forceFieldSize); - virtual Vec3 getWorldSize(void) const; + virtual Vec3 getWorldSize() const; virtual void setWorldSize(const Vec3& worldSize); /** Get/Set the Forcefield type diff --git a/extensions/Particle3D/PU/CCPUForceFieldAffector.cpp b/extensions/Particle3D/PU/CCPUForceFieldAffector.cpp index 6f77ea7965e4..a0c38110c926 100644 --- a/extensions/Particle3D/PU/CCPUForceFieldAffector.cpp +++ b/extensions/Particle3D/PU/CCPUForceFieldAffector.cpp @@ -63,11 +63,11 @@ PUForceFieldAffector::PUForceFieldAffector() : _movementFrequencyCount(0.0f), _suppressGeneration(false) { -}; +} //----------------------------------------------------------------------- PUForceFieldAffector::~PUForceFieldAffector() { -}; +} //----------------------------------------------------------------------- PUForceField::ForceFieldType PUForceFieldAffector::getForceFieldType() const { @@ -83,7 +83,7 @@ void PUForceFieldAffector::setForceFieldType(const PUForceField::ForceFieldType _forceField.setForceFieldType(forceFieldType); } //----------------------------------------------------------------------- -float PUForceFieldAffector::getDelta(void) const +float PUForceFieldAffector::getDelta() const { return _delta; } @@ -93,7 +93,7 @@ void PUForceFieldAffector::setDelta(float delta) _delta = delta; } //----------------------------------------------------------------------- -float PUForceFieldAffector::getScaleForce(void) const +float PUForceFieldAffector::getScaleForce() const { return _scaleForce; } @@ -103,7 +103,7 @@ void PUForceFieldAffector::setScaleForce(float scaleForce) _scaleForce = scaleForce; } //----------------------------------------------------------------------- -unsigned short PUForceFieldAffector::getOctaves(void) const +unsigned short PUForceFieldAffector::getOctaves() const { return _octaves; } @@ -117,7 +117,7 @@ void PUForceFieldAffector::setOctaves(unsigned short octaves) _forceField.setOctaves(octaves); } //----------------------------------------------------------------------- -double PUForceFieldAffector::getFrequency(void) const +double PUForceFieldAffector::getFrequency() const { return _frequency; } @@ -131,7 +131,7 @@ void PUForceFieldAffector::setFrequency(double frequency) _forceField.setFrequency(frequency); } //----------------------------------------------------------------------- -double PUForceFieldAffector::getAmplitude(void) const +double PUForceFieldAffector::getAmplitude() const { return _amplitude; } @@ -145,7 +145,7 @@ void PUForceFieldAffector::setAmplitude(double amplitude) _forceField.setAmplitude(amplitude); } //----------------------------------------------------------------------- -double PUForceFieldAffector::getPersistence(void) const +double PUForceFieldAffector::getPersistence() const { return _persistence; } @@ -159,7 +159,7 @@ void PUForceFieldAffector::setPersistence(double persistence) _forceField.setPersistence(persistence); } //----------------------------------------------------------------------- -unsigned int PUForceFieldAffector::getForceFieldSize(void) const +unsigned int PUForceFieldAffector::getForceFieldSize() const { return _forceFieldSize; } @@ -173,7 +173,7 @@ void PUForceFieldAffector::setForceFieldSize(unsigned int forceFieldSize) _forceField.setForceFieldSize(forceFieldSize); } //----------------------------------------------------------------------- -Vec3 PUForceFieldAffector::getWorldSize(void) const +Vec3 PUForceFieldAffector::getWorldSize() const { return _worldSize; } @@ -187,7 +187,7 @@ void PUForceFieldAffector::setWorldSize(const Vec3& worldSize) _forceField.setWorldSize(worldSize); } //----------------------------------------------------------------------- -bool PUForceFieldAffector::getIgnoreNegativeX(void) const +bool PUForceFieldAffector::getIgnoreNegativeX() const { return _ignoreNegativeX; } @@ -197,7 +197,7 @@ void PUForceFieldAffector::setIgnoreNegativeX(bool ignoreNegativeX) _ignoreNegativeX = ignoreNegativeX; } //----------------------------------------------------------------------- -bool PUForceFieldAffector::getIgnoreNegativeY(void) const +bool PUForceFieldAffector::getIgnoreNegativeY() const { return _ignoreNegativeY; } @@ -207,7 +207,7 @@ void PUForceFieldAffector::setIgnoreNegativeY(bool ignoreNegativeY) _ignoreNegativeY = ignoreNegativeY; } //----------------------------------------------------------------------- -bool PUForceFieldAffector::getIgnoreNegativeZ(void) const +bool PUForceFieldAffector::getIgnoreNegativeZ() const { return _ignoreNegativeZ; } @@ -217,7 +217,7 @@ void PUForceFieldAffector::setIgnoreNegativeZ(bool ignoreNegativeZ) _ignoreNegativeZ = ignoreNegativeZ; } //----------------------------------------------------------------------- -float PUForceFieldAffector::getMovementFrequency(void) const +float PUForceFieldAffector::getMovementFrequency() const { return _movementFrequency; } @@ -228,7 +228,7 @@ void PUForceFieldAffector::setMovementFrequency(float movementFrequency) _movementSet = (movementFrequency > 0.0f); } //----------------------------------------------------------------------- -const Vec3& PUForceFieldAffector::getMovement(void) const +const Vec3& PUForceFieldAffector::getMovement() const { return _movement; } diff --git a/extensions/Particle3D/PU/CCPUForceFieldAffector.h b/extensions/Particle3D/PU/CCPUForceFieldAffector.h index e2d685252437..bbb8280631b0 100644 --- a/extensions/Particle3D/PU/CCPUForceFieldAffector.h +++ b/extensions/Particle3D/PU/CCPUForceFieldAffector.h @@ -63,51 +63,51 @@ class CC_DLL PUForceFieldAffector : public PUAffector /** Get/Set Delta */ - float getDelta(void) const; + float getDelta() const; void setDelta(float delta); /** Get/Set scale Force */ - float getScaleForce(void) const; + float getScaleForce() const; void setScaleForce(float scaleForce); /** Get/Set scale Octaves */ - unsigned short getOctaves(void) const; + unsigned short getOctaves() const; void setOctaves(unsigned short octaves); /** Get/Set scale Frequency */ - double getFrequency(void) const; + double getFrequency() const; void setFrequency(double frequency); /** Get/Set scale Amplitude */ - double getAmplitude(void) const; + double getAmplitude() const; void setAmplitude(double amplitude); /** Get/Set scale Persistence */ - double getPersistence(void) const; + double getPersistence() const; void setPersistence(double persistence); /** Get/Set scale ForceFieldSize */ - unsigned int getForceFieldSize(void) const; + unsigned int getForceFieldSize() const; void setForceFieldSize(unsigned int forceFieldSize); /** Get/Set scale worldSize */ - Vec3 getWorldSize(void) const; + Vec3 getWorldSize() const; void setWorldSize(const Vec3& worldSize); /** Get/Set scale flip attributes */ - bool getIgnoreNegativeX(void) const; + bool getIgnoreNegativeX() const; void setIgnoreNegativeX(bool ignoreNegativeX); - bool getIgnoreNegativeY(void) const; + bool getIgnoreNegativeY() const; void setIgnoreNegativeY(bool ignoreNegativeY); - bool getIgnoreNegativeZ(void) const; + bool getIgnoreNegativeZ() const; void setIgnoreNegativeZ(bool ignoreNegativeZ); /** Get/Set Movement @@ -115,12 +115,12 @@ class CC_DLL PUForceFieldAffector : public PUAffector The movement vector determines the position of the movement. This movement is a displacement of the particle position mapped to the forcefield. */ - const Vec3& getMovement(void) const; + const Vec3& getMovement() const; void setMovement(const Vec3& movement); /** Get/Set Movement frequency */ - float getMovementFrequency(void) const; + float getMovementFrequency() const; void setMovementFrequency(float movementFrequency); /** Suppress (re)generation of the forcefield everytime an attribute is changed. diff --git a/extensions/Particle3D/PU/CCPUGeometryRotator.cpp b/extensions/Particle3D/PU/CCPUGeometryRotator.cpp index 10e864c88aac..5b4ad2e5e4ce 100644 --- a/extensions/Particle3D/PU/CCPUGeometryRotator.cpp +++ b/extensions/Particle3D/PU/CCPUGeometryRotator.cpp @@ -45,7 +45,7 @@ PUGeometryRotator::PUGeometryRotator() : { _dynRotationSpeed = new (std::nothrow) PUDynamicAttributeFixed(); (static_cast(_dynRotationSpeed))->setValue(DEFAULT_ROTATION_SPEED); -}; +} //----------------------------------------------------------------------- PUGeometryRotator::~PUGeometryRotator() { @@ -64,14 +64,14 @@ void PUGeometryRotator::setRotationAxis(const Vec3& rotationAxis) _rotationAxisSet = true; } //----------------------------------------------------------------------- -void PUGeometryRotator::resetRotationAxis(void) +void PUGeometryRotator::resetRotationAxis() { _dynRotationSpeed = new (std::nothrow) PUDynamicAttributeFixed(); (static_cast(_dynRotationSpeed))->setValue(DEFAULT_ROTATION_SPEED); _rotationAxisSet = false; } //----------------------------------------------------------------------- -PUDynamicAttribute* PUGeometryRotator::getRotationSpeed(void) const +PUDynamicAttribute* PUGeometryRotator::getRotationSpeed() const { return _dynRotationSpeed; } @@ -83,7 +83,7 @@ void PUGeometryRotator::setRotationSpeed(PUDynamicAttribute* dynRotationSpeed) _dynRotationSpeed = dynRotationSpeed; } //----------------------------------------------------------------------- -bool PUGeometryRotator::useOwnRotationSpeed (void) const +bool PUGeometryRotator::useOwnRotationSpeed () const { return _useOwnRotationSpeed; } diff --git a/extensions/Particle3D/PU/CCPUGeometryRotator.h b/extensions/Particle3D/PU/CCPUGeometryRotator.h index e00642600928..d29c1e4c5831 100644 --- a/extensions/Particle3D/PU/CCPUGeometryRotator.h +++ b/extensions/Particle3D/PU/CCPUGeometryRotator.h @@ -50,7 +50,7 @@ class CC_DLL PUGeometryRotator : public PUAffector /** Returns the rotation speed. This is the speed controlled by the affector. Besides the default rotation speed, it is also possible to use the particles own rotation speed. */ - PUDynamicAttribute* getRotationSpeed(void) const; + PUDynamicAttribute* getRotationSpeed() const; /** */ @@ -59,7 +59,7 @@ class CC_DLL PUGeometryRotator : public PUAffector /** Returns an indication whether the rotation speed is the same for all particles in this particle technique, or whether the rotation speed of the particle itself is used. */ - bool useOwnRotationSpeed (void) const; + bool useOwnRotationSpeed () const; /** Set the indication whether rotation speed of the particle itself is used. */ @@ -67,7 +67,7 @@ class CC_DLL PUGeometryRotator : public PUAffector /** */ - const Vec3& getRotationAxis(void) const; + const Vec3& getRotationAxis() const; /** */ @@ -75,7 +75,7 @@ class CC_DLL PUGeometryRotator : public PUAffector /** */ - void resetRotationAxis(void); + void resetRotationAxis(); virtual void copyAttributesTo (PUAffector* affector) override; diff --git a/extensions/Particle3D/PU/CCPUGravityAffector.cpp b/extensions/Particle3D/PU/CCPUGravityAffector.cpp index 7521dbfd76d4..6070571d5a65 100644 --- a/extensions/Particle3D/PU/CCPUGravityAffector.cpp +++ b/extensions/Particle3D/PU/CCPUGravityAffector.cpp @@ -33,18 +33,18 @@ NS_CC_BEGIN const float PUGravityAffector::DEFAULT_GRAVITY = 1.0f; //----------------------------------------------------------------------- -PUGravityAffector::PUGravityAffector(void) : - PUAffector(), - _gravity(DEFAULT_GRAVITY) +PUGravityAffector::PUGravityAffector() +: PUAffector() +, _gravity(DEFAULT_GRAVITY) { } //----------------------------------------------------------------------- -PUGravityAffector::~PUGravityAffector( void ) +PUGravityAffector::~PUGravityAffector() { } //----------------------------------------------------------------------- -float PUGravityAffector::getGravity(void) const +float PUGravityAffector::getGravity() const { return _gravity; } diff --git a/extensions/Particle3D/PU/CCPUGravityAffector.h b/extensions/Particle3D/PU/CCPUGravityAffector.h index e89c157f2996..a879e3631570 100644 --- a/extensions/Particle3D/PU/CCPUGravityAffector.h +++ b/extensions/Particle3D/PU/CCPUGravityAffector.h @@ -46,14 +46,14 @@ class CC_DLL PUGravityAffector : public PUAffector /** */ - float getGravity(void) const; + float getGravity() const; void setGravity(float gravity); virtual void copyAttributesTo (PUAffector* affector) override; CC_CONSTRUCTOR_ACCESS: - PUGravityAffector(void); - virtual ~PUGravityAffector(void); + PUGravityAffector(); + virtual ~PUGravityAffector(); protected: diff --git a/extensions/Particle3D/PU/CCPUInterParticleCollider.cpp b/extensions/Particle3D/PU/CCPUInterParticleCollider.cpp index b7679cc69ed8..69ac7970b667 100644 --- a/extensions/Particle3D/PU/CCPUInterParticleCollider.cpp +++ b/extensions/Particle3D/PU/CCPUInterParticleCollider.cpp @@ -35,19 +35,19 @@ const PUParticle3DInterParticleCollider::InterParticleCollisionResponse PUPartic PUParticle3DInterParticleCollider::IPCR_AVERAGE_VELOCITY; //----------------------------------------------------------------------- -PUParticle3DInterParticleCollider::PUParticle3DInterParticleCollider(void) : +PUParticle3DInterParticleCollider::PUParticle3DInterParticleCollider() : PUBaseCollider(), _adjustment(DEFAULT_ADJUSTMENT), _interParticleCollisionResponse(DEFAULT_COLLISION_RESPONSE) { } -PUParticle3DInterParticleCollider::~PUParticle3DInterParticleCollider( void ) +PUParticle3DInterParticleCollider::~PUParticle3DInterParticleCollider() { } //----------------------------------------------------------------------- -float PUParticle3DInterParticleCollider::getAdjustment(void) const +float PUParticle3DInterParticleCollider::getAdjustment() const { return _adjustment; } @@ -57,7 +57,7 @@ void PUParticle3DInterParticleCollider::setAdjustment(float adjustment) _adjustment = adjustment; } //----------------------------------------------------------------------- -PUParticle3DInterParticleCollider::InterParticleCollisionResponse PUParticle3DInterParticleCollider::getInterParticleCollisionResponse(void) const +PUParticle3DInterParticleCollider::InterParticleCollisionResponse PUParticle3DInterParticleCollider::getInterParticleCollisionResponse() const { return _interParticleCollisionResponse; } diff --git a/extensions/Particle3D/PU/CCPUInterParticleCollider.h b/extensions/Particle3D/PU/CCPUInterParticleCollider.h index e93dd90fc8e6..d387b3735c37 100644 --- a/extensions/Particle3D/PU/CCPUInterParticleCollider.h +++ b/extensions/Particle3D/PU/CCPUInterParticleCollider.h @@ -55,7 +55,7 @@ class CC_DLL PUParticle3DInterParticleCollider : public PUBaseCollider /** Todo */ - float getAdjustment(void) const; + float getAdjustment() const; /** Todo */ @@ -63,7 +63,7 @@ class CC_DLL PUParticle3DInterParticleCollider : public PUBaseCollider /** Todo */ - InterParticleCollisionResponse getInterParticleCollisionResponse(void) const; + InterParticleCollisionResponse getInterParticleCollisionResponse() const; /** Todo */ @@ -72,8 +72,8 @@ class CC_DLL PUParticle3DInterParticleCollider : public PUBaseCollider virtual void copyAttributesTo (PUAffector* affector) override; CC_CONSTRUCTOR_ACCESS: - PUParticle3DInterParticleCollider(void); - virtual ~PUParticle3DInterParticleCollider(void); + PUParticle3DInterParticleCollider(); + virtual ~PUParticle3DInterParticleCollider(); protected: diff --git a/extensions/Particle3D/PU/CCPUJetAffector.cpp b/extensions/Particle3D/PU/CCPUJetAffector.cpp index b40036dc5a35..ebb465d54669 100644 --- a/extensions/Particle3D/PU/CCPUJetAffector.cpp +++ b/extensions/Particle3D/PU/CCPUJetAffector.cpp @@ -33,15 +33,13 @@ NS_CC_BEGIN const float PUJetAffector::DEFAULT_ACCELERATION = 1.0f; //----------------------------------------------------------------------- -PUJetAffector::PUJetAffector (void) : - PUAffector(), - _scaled(0.0f) +PUJetAffector::PUJetAffector() : PUAffector(), _scaled(0.0f) { _dynAcceleration = new (std::nothrow) PUDynamicAttributeFixed(); (static_cast(_dynAcceleration))->setValue(DEFAULT_ACCELERATION); } //----------------------------------------------------------------------- -PUJetAffector::~PUJetAffector (void) +PUJetAffector::~PUJetAffector () { if (!_dynAcceleration) return; diff --git a/extensions/Particle3D/PU/CCPUJetAffector.h b/extensions/Particle3D/PU/CCPUJetAffector.h index a9e6e4a106a1..f1c83ed0148c 100644 --- a/extensions/Particle3D/PU/CCPUJetAffector.h +++ b/extensions/Particle3D/PU/CCPUJetAffector.h @@ -46,14 +46,14 @@ class CC_DLL PUJetAffector : public PUAffector /** */ - PUDynamicAttribute* getDynAcceleration(void) const {return _dynAcceleration;}; + PUDynamicAttribute* getDynAcceleration() const {return _dynAcceleration;}; void setDynAcceleration(PUDynamicAttribute* dynAcceleration); virtual void copyAttributesTo (PUAffector* affector) override; CC_CONSTRUCTOR_ACCESS: - PUJetAffector(void); - virtual ~PUJetAffector(void); + PUJetAffector(); + virtual ~PUJetAffector(); protected: diff --git a/extensions/Particle3D/PU/CCPULineAffector.cpp b/extensions/Particle3D/PU/CCPULineAffector.cpp index 96963a03934b..0d81dadd2f4f 100644 --- a/extensions/Particle3D/PU/CCPULineAffector.cpp +++ b/extensions/Particle3D/PU/CCPULineAffector.cpp @@ -36,7 +36,7 @@ const Vec3 PULineAffector::DEFAULT_END(0, 0, 0); const float PULineAffector::DEFAULT_DRIFT = 0.0f; //----------------------------------------------------------------------- -PULineAffector::PULineAffector(void) : +PULineAffector::PULineAffector() : PUAffector(), _maxDeviation(DEFAULT_MAX_DEVIATION), _scaledMaxDeviation(1.0f), @@ -50,12 +50,11 @@ PULineAffector::PULineAffector(void) : { } -PULineAffector::~PULineAffector( void ) +PULineAffector::~PULineAffector() { - } //----------------------------------------------------------------------- -float PULineAffector::getMaxDeviation(void) const +float PULineAffector::getMaxDeviation() const { return _maxDeviation; } @@ -66,7 +65,7 @@ void PULineAffector::setMaxDeviation(float maxDeviation) _scaledMaxDeviation = _maxDeviation * _affectorScale.length(); } //----------------------------------------------------------------------- -const Vec3& PULineAffector::getEnd(void) const +const Vec3& PULineAffector::getEnd() const { return _end; } @@ -76,7 +75,7 @@ void PULineAffector::setEnd(const Vec3& end) _end = end; } //----------------------------------------------------------------------- -float PULineAffector::getTimeStep(void) const +float PULineAffector::getTimeStep() const { return _timeStep; } @@ -86,7 +85,7 @@ void PULineAffector::setTimeStep(float timeStep) _timeStep = timeStep; } //----------------------------------------------------------------------- -float PULineAffector::getDrift(void) const +float PULineAffector::getDrift() const { return _drift; } diff --git a/extensions/Particle3D/PU/CCPULineAffector.h b/extensions/Particle3D/PU/CCPULineAffector.h index 4f74cd855c90..8b8961605c64 100644 --- a/extensions/Particle3D/PU/CCPULineAffector.h +++ b/extensions/Particle3D/PU/CCPULineAffector.h @@ -53,29 +53,29 @@ class CC_DLL PULineAffector : public PUAffector virtual void firstParticleUpdate(PUParticle3D *particle, float deltaTime) override; /** */ - float getMaxDeviation(void) const; + float getMaxDeviation() const; void setMaxDeviation(float maxDeviation); /** */ - const Vec3& getEnd(void) const; + const Vec3& getEnd() const; void setEnd(const Vec3& end); /** */ - float getTimeStep(void) const; + float getTimeStep() const; void setTimeStep(float timeStep); /** */ - float getDrift(void) const; + float getDrift() const; void setDrift(float drift); virtual void copyAttributesTo (PUAffector* affector) override; CC_CONSTRUCTOR_ACCESS: - PULineAffector(void); - virtual ~PULineAffector(void); + PULineAffector(); + virtual ~PULineAffector(); protected: diff --git a/extensions/Particle3D/PU/CCPULineEmitter.cpp b/extensions/Particle3D/PU/CCPULineEmitter.cpp index 052006de7268..0c0271856b01 100644 --- a/extensions/Particle3D/PU/CCPULineEmitter.cpp +++ b/extensions/Particle3D/PU/CCPULineEmitter.cpp @@ -36,7 +36,7 @@ const float PULineEmitter::DEFAULT_MAX_INCREMENT = 0.0f; const float PULineEmitter::DEFAULT_MAX_DEVIATION = 0.0f; //----------------------------------------------------------------------- -PULineEmitter::PULineEmitter(void) : +PULineEmitter::PULineEmitter() : PUEmitter(), _end(DEFAULT_END), _maxDeviation(DEFAULT_MAX_DEVIATION), @@ -53,7 +53,7 @@ PULineEmitter::PULineEmitter(void) : { } //----------------------------------------------------------------------- -void PULineEmitter::notifyStart (void) +void PULineEmitter::notifyStart () { // Reset the incremental attributes to allow a restart. PUEmitter::notifyStart(); @@ -99,7 +99,7 @@ unsigned short PULineEmitter::calculateRequestedParticles(float timeElapsed) return requested; } //----------------------------------------------------------------------- -const Vec3& PULineEmitter::getEnd(void) const +const Vec3& PULineEmitter::getEnd() const { return _end; } @@ -111,7 +111,7 @@ void PULineEmitter::setEnd(const Vec3& end) _length = _end.length(); } //----------------------------------------------------------------------- -float PULineEmitter::getMaxIncrement(void) const +float PULineEmitter::getMaxIncrement() const { return _maxIncrement; } @@ -122,7 +122,7 @@ void PULineEmitter::setMaxIncrement(float maxIncrement) _scaledMaxIncrement = _maxIncrement * _emitterScale.length(); } //----------------------------------------------------------------------- -float PULineEmitter::getMinIncrement(void) const +float PULineEmitter::getMinIncrement() const { return _minIncrement; } @@ -133,7 +133,7 @@ void PULineEmitter::setMinIncrement(float minIncrement) _scaledMinIncrement = _minIncrement * _emitterScale.length(); } //----------------------------------------------------------------------- -float PULineEmitter::getMaxDeviation(void) const +float PULineEmitter::getMaxDeviation() const { return _maxDeviation; } @@ -252,4 +252,4 @@ PULineEmitter* PULineEmitter::clone() return be; } -NS_CC_END \ No newline at end of file +NS_CC_END diff --git a/extensions/Particle3D/PU/CCPULineEmitter.h b/extensions/Particle3D/PU/CCPULineEmitter.h index d20c2326ead8..1dbf8f8b4d79 100644 --- a/extensions/Particle3D/PU/CCPULineEmitter.h +++ b/extensions/Particle3D/PU/CCPULineEmitter.h @@ -45,7 +45,7 @@ class CC_DLL PULineEmitter : public PUEmitter static PULineEmitter* create(); /** */ - virtual void notifyStart (void) override; + virtual void notifyStart () override; /** Override the default implementation, to allow that no particles are emitted if there is an incremental emission of particles (along a path), and the end of the line has @@ -55,22 +55,22 @@ class CC_DLL PULineEmitter : public PUEmitter /** */ - float getMaxDeviation(void) const; + float getMaxDeviation() const; void setMaxDeviation(float maxDeviation); /** */ - float getMaxIncrement(void) const; + float getMaxIncrement() const; void setMaxIncrement(float maxIncrement); /** */ - float getMinIncrement(void) const; + float getMinIncrement() const; void setMinIncrement(float minIncrement); /** Get the end vector. This is the vector that defines the end of the line (in local space). */ - const Vec3& getEnd(void) const; + const Vec3& getEnd() const; /** Set the end vector. */ @@ -92,8 +92,8 @@ class CC_DLL PULineEmitter : public PUEmitter virtual void copyAttributesTo (PUEmitter* emitter) override; CC_CONSTRUCTOR_ACCESS: - PULineEmitter(void); - virtual ~PULineEmitter(void) {}; + PULineEmitter(); + virtual ~PULineEmitter() {}; protected: diff --git a/extensions/Particle3D/PU/CCPULinearForceAffector.h b/extensions/Particle3D/PU/CCPULinearForceAffector.h index 71ac66773eb7..5575ff70b17b 100644 --- a/extensions/Particle3D/PU/CCPULinearForceAffector.h +++ b/extensions/Particle3D/PU/CCPULinearForceAffector.h @@ -45,8 +45,8 @@ class CC_DLL PULinearForceAffector : public PUBaseForceAffector virtual void copyAttributesTo (PUAffector* affector) override; CC_CONSTRUCTOR_ACCESS: - PULinearForceAffector(void){}; - virtual ~PULinearForceAffector(void){}; + PULinearForceAffector(){}; + virtual ~PULinearForceAffector(){}; }; NS_CC_END diff --git a/extensions/Particle3D/PU/CCPUMeshSurfaceEmitter.cpp b/extensions/Particle3D/PU/CCPUMeshSurfaceEmitter.cpp index 48e6d28c5a78..f96456b1fa17 100644 --- a/extensions/Particle3D/PU/CCPUMeshSurfaceEmitter.cpp +++ b/extensions/Particle3D/PU/CCPUMeshSurfaceEmitter.cpp @@ -25,6 +25,7 @@ ****************************************************************************/ #include "CCPUMeshSurfaceEmitter.h" +#include #include "extensions/Particle3D/PU/CCPUParticleSystem3D.h" #include "extensions/Particle3D/PU/CCPUUtil.h" @@ -34,7 +35,7 @@ const Vec3 PUMeshSurfaceEmitter::DEFAULT_SCALE(1, 1, 1); const MeshInfo::MeshSurfaceDistribution PUMeshSurfaceEmitter::DEFAULT_DISTRIBUTION = MeshInfo::MSD_HOMOGENEOUS; //----------------------------------------------------------------------- -inline void PUTriangle::calculateSquareSurface (void) +inline void PUTriangle::calculateSquareSurface () { /* Calculating the surface of a triangle with the following algorithm: v1 = Vector3(x1, y1, z1) @@ -48,14 +49,14 @@ inline void PUTriangle::calculateSquareSurface (void) */ // a, b and c are the length of each triangle - float a = sqrt ( (v1.x - v3.x) * (v1.x - v3.x) + - (v1.y - v3.y) * (v1.y - v3.y) + + float a = std::sqrt ((v1.x - v3.x) * (v1.x - v3.x) + + (v1.y - v3.y) * (v1.y - v3.y) + (v1.z - v3.z) * (v1.z - v3.z)); - float b = sqrt ( (v2.x - v1.x) * (v2.x - v1.x) + - (v2.y - v1.y) * (v2.y - v1.y) + + float b = std::sqrt ((v2.x - v1.x) * (v2.x - v1.x) + + (v2.y - v1.y) * (v2.y - v1.y) + (v2.z - v1.z) * (v2.z - v1.z)); - float c = sqrt ( (v3.x - v2.x) * (v3.x - v2.x) + - (v3.y - v2.y) * (v3.y - v2.y) + + float c = std::sqrt ((v3.x - v2.x) * (v3.x - v2.x) + + (v3.y - v2.y) * (v3.y - v2.y) + (v3.z - v2.z) * (v3.z - v2.z)); float p = 0.5f * (a + b + c); @@ -63,7 +64,7 @@ inline void PUTriangle::calculateSquareSurface (void) squareSurface = p * (p-a) * (p-b) * (p-c); } //----------------------------------------------------------------------- -inline void PUTriangle::calculateSurfaceNormal (void) +inline void PUTriangle::calculateSurfaceNormal () { /* Calculating the surface normal of a triangle with the following algorithm: v1 = Vector3(x1, y1, z1) @@ -75,7 +76,7 @@ inline void PUTriangle::calculateSurfaceNormal (void) surfaceNormal.normalize(); } //----------------------------------------------------------------------- -inline void PUTriangle::calculateEdgeNormals (void) +inline void PUTriangle::calculateEdgeNormals () { Vec3::cross(v1, v2, &en1); en1.normalize(); @@ -85,7 +86,7 @@ inline void PUTriangle::calculateEdgeNormals (void) en3.normalize(); } //----------------------------------------------------------------------- -const Vec3 PUTriangle::getRandomTrianglePosition (void) +const Vec3 PUTriangle::getRandomTrianglePosition () { // Use barycentric coordinates. Let A, B, C be the three vertices of the triangle. Any point P inside can // be expressed uniquely as P = aA + bB + cC, where a+b+c=1 and a,b,c are each >= 0. @@ -107,7 +108,7 @@ const Vec3 PUTriangle::getRandomTrianglePosition (void) return a * v1 + b * v2 + c * v3; } //----------------------------------------------------------------------- -const PUTriangle::PositionAndNormal PUTriangle::getRandomEdgePositionAndNormal (void) +const PUTriangle::PositionAndNormal PUTriangle::getRandomEdgePositionAndNormal () { float mult = CCRANDOM_0_1(); float randomVal = CCRANDOM_0_1() * 3.0f; @@ -137,7 +138,7 @@ const PUTriangle::PositionAndNormal PUTriangle::getRandomEdgePositionAndNormal ( return pAndN; } //----------------------------------------------------------------------- -const PUTriangle::PositionAndNormal PUTriangle::getRandomVertexAndNormal (void) +const PUTriangle::PositionAndNormal PUTriangle::getRandomVertexAndNormal () { float randomVal = CCRANDOM_0_1() * 3.0f; PositionAndNormal pAndN; @@ -178,7 +179,7 @@ MeshInfo::MeshInfo (const std::string& /*meshName*/, //getMeshInformation(mesh, Vec3::ZERO, orientation, scale); } //----------------------------------------------------------------------- -MeshInfo::~MeshInfo (void) +MeshInfo::~MeshInfo () { _triangles.clear(); } @@ -203,7 +204,7 @@ inline float MeshInfo::getGaussianRandom (float high, float cutoff) } while (w >= 1.0f); - w = sqrt((-2.0f * ::log(w)) / w); + w = std::sqrt((-2.0f * std::log(w)) / w); y1 = std::abs(x1 * w); y1 = y1 > cutoff ? cutoff : y1; y1 *= high / cutoff; @@ -404,19 +405,19 @@ const PUTriangle::PositionAndNormal MeshInfo::getRandomPositionAndNormal (const //----------------------------------------------------------------------- //----------------------------------------------------------------------- //----------------------------------------------------------------------- -PUMeshSurfaceEmitter::PUMeshSurfaceEmitter(void) : - PUEmitter(), - _meshName(), - _orientation(), - _scale(DEFAULT_SCALE), - _distribution(DEFAULT_DISTRIBUTION), - _meshInfo(0), - _triangleIndex(0), - _directionSet(false) +PUMeshSurfaceEmitter::PUMeshSurfaceEmitter() +: PUEmitter() +, _meshName() +, _orientation() +, _scale(DEFAULT_SCALE) +, _distribution(DEFAULT_DISTRIBUTION) +, _meshInfo(0) +, _triangleIndex(0) +, _directionSet(false) { } //----------------------------------------------------------------------- -PUMeshSurfaceEmitter::~PUMeshSurfaceEmitter(void) +PUMeshSurfaceEmitter::~PUMeshSurfaceEmitter() { if (_meshInfo) { @@ -523,7 +524,7 @@ void PUMeshSurfaceEmitter::initParticleDirection(PUParticle3D* particle) } } //----------------------------------------------------------------------- -const std::string& PUMeshSurfaceEmitter::getMeshName(void) const +const std::string& PUMeshSurfaceEmitter::getMeshName() const { return _meshName; } @@ -549,7 +550,7 @@ void PUMeshSurfaceEmitter::setDistribution(MeshInfo::MeshSurfaceDistribution dis _distribution = distribution; } //----------------------------------------------------------------------- -const Vec3& PUMeshSurfaceEmitter::getScale (void) const +const Vec3& PUMeshSurfaceEmitter::getScale () const { return _scale; } @@ -559,7 +560,7 @@ void PUMeshSurfaceEmitter::setScale (const Vec3& scale) _scale = scale; } //----------------------------------------------------------------------- -void PUMeshSurfaceEmitter::build(void) +void PUMeshSurfaceEmitter::build() { // Delete the mesh info if already existing if (_meshInfo) diff --git a/extensions/Particle3D/PU/CCPUMeshSurfaceEmitter.h b/extensions/Particle3D/PU/CCPUMeshSurfaceEmitter.h index c0c3267a5724..6a4c892cc994 100644 --- a/extensions/Particle3D/PU/CCPUMeshSurfaceEmitter.h +++ b/extensions/Particle3D/PU/CCPUMeshSurfaceEmitter.h @@ -59,25 +59,25 @@ class PUTriangle Vec3 en3; // Normal of edge v3-v1 /** Constructor **/ - PUTriangle(void){}; + PUTriangle(){}; /** Calculate the (square) surface of the triangle **/ - void calculateSquareSurface (void); + void calculateSquareSurface (); /** Calculate the surface normal of the triangle **/ - void calculateSurfaceNormal (void); + void calculateSurfaceNormal (); /** Calculate the edge normals of the 3 edges **/ - void calculateEdgeNormals (void); + void calculateEdgeNormals (); /** Determine a random position on this triangle **/ - const Vec3 getRandomTrianglePosition (void); + const Vec3 getRandomTrianglePosition (); /** Determine a random position including its normal on a one of the edges **/ - const PositionAndNormal getRandomEdgePositionAndNormal (void); + const PositionAndNormal getRandomEdgePositionAndNormal (); /** Determine a random vertex including its normal of this triangle **/ - const PositionAndNormal getRandomVertexAndNormal (void); + const PositionAndNormal getRandomVertexAndNormal (); }; /** Comparer used for sorting vector in ascending order @@ -132,7 +132,7 @@ class MeshInfo const Vec3& scale = Vec3::ZERO); /** Destructor **/ - ~MeshInfo (void); + ~MeshInfo (); /** Generate a random number. The high argument determines that numbers are returned between [0..high] **/ @@ -180,7 +180,7 @@ class CC_DLL PUMeshSurfaceEmitter : public PUEmitter /** Returns the mesh name. */ - const std::string& getMeshName(void) const; + const std::string& getMeshName() const; /** Sets the mesh name. */ @@ -188,7 +188,7 @@ class CC_DLL PUMeshSurfaceEmitter : public PUEmitter /** Returns true if normals are used for the particle direction. */ - bool useNormals (void) const; + bool useNormals () const; /** Set indication whether normals are used for the particle direction. */ @@ -207,7 +207,7 @@ class CC_DLL PUMeshSurfaceEmitter : public PUEmitter /** Returns the scale of the mesh. */ - const Vec3& getScale (void) const; + const Vec3& getScale () const; /** Set the scale of the mesh. @remarks @@ -217,7 +217,7 @@ class CC_DLL PUMeshSurfaceEmitter : public PUEmitter /** Build all the data needed to generate the particles. */ - void build(void); + void build(); /** Build the data if the mesh name has been set. */ @@ -243,8 +243,8 @@ class CC_DLL PUMeshSurfaceEmitter : public PUEmitter virtual void copyAttributesTo (PUEmitter* emitter) override; CC_CONSTRUCTOR_ACCESS: - PUMeshSurfaceEmitter(void); - virtual ~PUMeshSurfaceEmitter(void); + PUMeshSurfaceEmitter(); + virtual ~PUMeshSurfaceEmitter(); protected: std::string _meshName; diff --git a/extensions/Particle3D/PU/CCPUNoise.cpp b/extensions/Particle3D/PU/CCPUNoise.cpp index 6b87a1b15491..a58cb13da224 100644 --- a/extensions/Particle3D/PU/CCPUNoise.cpp +++ b/extensions/Particle3D/PU/CCPUNoise.cpp @@ -44,15 +44,15 @@ NS_CC_BEGIN }; //----------------------------------------------------------------------- -PUNoise3D::PUNoise3D(void) : - _octaves(2), - _frequency(1.0f), - _amplitude(1.0f), - _persistence(1.0f) +PUNoise3D::PUNoise3D() +: _octaves(2) +, _frequency(1.0f) +, _amplitude(1.0f) +, _persistence(1.0f) { } //----------------------------------------------------------------------- -PUNoise3D::~PUNoise3D(void) +PUNoise3D::~PUNoise3D() { } //----------------------------------------------------------------------- diff --git a/extensions/Particle3D/PU/CCPUNoise.h b/extensions/Particle3D/PU/CCPUNoise.h index cd4a86bcd495..738b56dcfe6a 100644 --- a/extensions/Particle3D/PU/CCPUNoise.h +++ b/extensions/Particle3D/PU/CCPUNoise.h @@ -36,8 +36,8 @@ class PUNoise3D { public: /* Constructor / Destructor */ - PUNoise3D(void); - virtual ~PUNoise3D(void); + PUNoise3D(); + virtual ~PUNoise3D(); /* Inititialises the noise function */ void initialise(unsigned short octaves, double frequency = 1.0, double amplitude = 1.0, double persistence = 1.0); diff --git a/extensions/Particle3D/PU/CCPUObserver.cpp b/extensions/Particle3D/PU/CCPUObserver.cpp index a944872f3b13..b433feeae1cf 100644 --- a/extensions/Particle3D/PU/CCPUObserver.cpp +++ b/extensions/Particle3D/PU/CCPUObserver.cpp @@ -38,42 +38,42 @@ const float PUObserver::DEFAULT_INTERVAL = 0.05f; const bool PUObserver::DEFAULT_UNTIL_EVENT = false; //----------------------------------------------------------------------- -PUObserver::PUObserver(void) : - _particleSystem(nullptr), - _enabled(DEFAULT_ENABLED), - _originalEnabled(DEFAULT_ENABLED), - _originalEnabledSet(false), - _observe(true), - _observeUntilEvent(DEFAULT_UNTIL_EVENT), - _eventHandlersExecuted(false), - _observerScale(Vec3::ONE), - _particleTypeToObserve(DEFAULT_PARTICLE_TYPE), - _particleTypeToObserveSet(false), - _observerInterval(DEFAULT_INTERVAL), - _observerIntervalRemainder(0.0), - _observerIntervalSet(false) +PUObserver::PUObserver() +: _particleSystem(nullptr) +, _enabled(DEFAULT_ENABLED) +, _originalEnabled(DEFAULT_ENABLED) +, _originalEnabledSet(false) +, _observe(true) +, _observeUntilEvent(DEFAULT_UNTIL_EVENT) +, _eventHandlersExecuted(false) +, _observerScale(Vec3::ONE) +, _particleTypeToObserve(DEFAULT_PARTICLE_TYPE) +, _particleTypeToObserveSet(false) +, _observerInterval(DEFAULT_INTERVAL) +, _observerIntervalRemainder(0.0) +, _observerIntervalSet(false) { //mAliasType = AT_OBSERVER; } //----------------------------------------------------------------------- -PUObserver::~PUObserver(void) +PUObserver::~PUObserver() { destroyAllEventHandlers(); } //----------------------------------------------------------------------- -void PUObserver::notifyStart (void) +void PUObserver::notifyStart () { _eventHandlersExecuted = false; _observe = true; setEnabled(_originalEnabled); } //----------------------------------------------------------------------- -bool PUObserver::isEnabled(void) const +bool PUObserver::isEnabled() const { return _enabled; } //----------------------------------------------------------------------- -bool PUObserver::_getOriginalEnabled(void) const +bool PUObserver::_getOriginalEnabled() const { return _originalEnabled; } @@ -89,12 +89,12 @@ void PUObserver::setEnabled(bool enabled) } } //----------------------------------------------------------------------- -void PUObserver::_resetEnabled(void) +void PUObserver::_resetEnabled() { _originalEnabledSet = false; } //----------------------------------------------------------------------- -float PUObserver::getObserverInterval(void) const +float PUObserver::getObserverInterval() const { return _observerInterval; } @@ -105,7 +105,7 @@ void PUObserver::setObserverInterval(float observerInterval) _observerIntervalSet = true; } //----------------------------------------------------------------------- -bool PUObserver::getObserveUntilEvent(void) const +bool PUObserver::getObserveUntilEvent() const { return _observeUntilEvent; } @@ -186,7 +186,7 @@ PUEventHandler* PUObserver::getEventHandler (const std::string& eventHandlerName return nullptr; } //----------------------------------------------------------------------- -size_t PUObserver::getNumEventHandlers (void) const +size_t PUObserver::getNumEventHandlers () const { return _eventHandlers.size(); } @@ -213,7 +213,7 @@ void PUObserver::destroyEventHandler (size_t index) destroyEventHandler(getEventHandler(index)); } //----------------------------------------------------------------------- -void PUObserver::destroyAllEventHandlers (void) +void PUObserver::destroyAllEventHandlers () { ParticleEventHandlerIterator it; for (it = _eventHandlers.begin(); it != _eventHandlers.end(); ++it) @@ -261,7 +261,7 @@ void PUObserver::handleEvent (PUParticle3D* particle, float timeElapsed) _eventHandlersExecuted = true; } //----------------------------------------------------------------------- -bool PUObserver::isParticleTypeToObserveSet(void) const +bool PUObserver::isParticleTypeToObserveSet() const { return _particleTypeToObserveSet; } diff --git a/extensions/Particle3D/PU/CCPUObserver.h b/extensions/Particle3D/PU/CCPUObserver.h index f45fb4215fe6..cb3a16fbd190 100644 --- a/extensions/Particle3D/PU/CCPUObserver.h +++ b/extensions/Particle3D/PU/CCPUObserver.h @@ -62,16 +62,16 @@ class CC_DLL PUObserver : public Ref /** Todo */ - const std::string& getObserverType(void) const {return _observerType;}; + const std::string& getObserverType() const {return _observerType;}; void setObserverType(const std::string& observerType) {_observerType = observerType;}; /** Todo */ - virtual bool isEnabled(void) const; + virtual bool isEnabled() const; /** Returns the 'enabled' value that was set in setEnabled() and not altered during execution. */ - bool _getOriginalEnabled(void) const; + bool _getOriginalEnabled() const; /** Todo */ @@ -81,26 +81,26 @@ class CC_DLL PUObserver : public Ref @remarks Using _resetEnabled() makes it possible to use setEnabled() without the restriction of having a fixed mOriginalEnabled value. */ - void _resetEnabled(void); + void _resetEnabled(); ///** Todo //*/ - //PUParticleSystem3D* getParentSystem(void) const {return mParentTechnique;}; + //PUParticleSystem3D* getParentSystem() const {return mParentTechnique;}; //void setParentSystem(PUParticleSystem3D* parentTechnique){mParentTechnique = parentTechnique;}; /** Todo */ - const std::string& getName(void) const {return _name;}; + const std::string& getName() const {return _name;}; void setName(const std::string& name) {_name = name;}; /** Todo */ - const PUParticle3D::ParticleType& getParticleTypeToObserve(void) const {return _particleTypeToObserve;}; + const PUParticle3D::ParticleType& getParticleTypeToObserve() const {return _particleTypeToObserve;}; void setParticleTypeToObserve(const PUParticle3D::ParticleType particleTypeToObserve); - virtual void notifyStart (void); - virtual void notifyStop (void){/* Do nothing */}; + virtual void notifyStart (); + virtual void notifyStop (){/* Do nothing */}; virtual void notifyRescaled(const Vec3& scale); virtual void preUpdateObserver(float deltaTime); virtual void updateObserver(PUParticle3D *particle, float deltaTime, bool firstParticle); @@ -133,7 +133,7 @@ class CC_DLL PUObserver : public Ref /** Todo */ - size_t getNumEventHandlers (void) const; + size_t getNumEventHandlers () const; /** Todo */ @@ -145,11 +145,11 @@ class CC_DLL PUObserver : public Ref /** Todo */ - void destroyAllEventHandlers (void); + void destroyAllEventHandlers (); /** Return the interval value, which defines at what interval the observer is called. */ - float getObserverInterval(void) const; + float getObserverInterval() const; /** Set the interval value, which defines at what interval the observer is called. */ @@ -157,7 +157,7 @@ class CC_DLL PUObserver : public Ref /** Return the value of mObserveUntilEvent. */ - bool getObserveUntilEvent(void) const; + bool getObserveUntilEvent() const; /** Sets the value of mObserveUntilEvent. This value determines whether observation must be continued after an event occurred and the event handlers are called. @@ -166,13 +166,13 @@ class CC_DLL PUObserver : public Ref /** Returns true if the particle type to observe specifically has been set. */ - bool isParticleTypeToObserveSet(void) const; + bool isParticleTypeToObserveSet() const; virtual void copyAttributesTo (PUObserver* observer); CC_CONSTRUCTOR_ACCESS: - PUObserver(void); - virtual ~PUObserver(void); + PUObserver(); + virtual ~PUObserver(); protected: diff --git a/extensions/Particle3D/PU/CCPUObserverTranslator.h b/extensions/Particle3D/PU/CCPUObserverTranslator.h index 5b756b81ded6..e37b795ee1ff 100644 --- a/extensions/Particle3D/PU/CCPUObserverTranslator.h +++ b/extensions/Particle3D/PU/CCPUObserverTranslator.h @@ -40,8 +40,8 @@ class PUObserverTranslator : public PUScriptTranslator PUObserver* _observer; public: - PUObserverTranslator(void); - virtual ~PUObserverTranslator(void){}; + PUObserverTranslator(); + virtual ~PUObserverTranslator(){}; virtual void translate(PUScriptCompiler* compiler, PUAbstractNode *node); }; diff --git a/extensions/Particle3D/PU/CCPUOnClearObserver.cpp b/extensions/Particle3D/PU/CCPUOnClearObserver.cpp index 5c624e778450..bdb77195ad9a 100644 --- a/extensions/Particle3D/PU/CCPUOnClearObserver.cpp +++ b/extensions/Particle3D/PU/CCPUOnClearObserver.cpp @@ -30,7 +30,7 @@ NS_CC_BEGIN //----------------------------------------------------------------------- -void PUOnClearObserver::notifyStart (void) +void PUOnClearObserver::notifyStart () { PUObserver::notifyStart(); _continue = false; diff --git a/extensions/Particle3D/PU/CCPUOnClearObserver.h b/extensions/Particle3D/PU/CCPUOnClearObserver.h index 46a0c01b8ba7..d423ad13fede 100644 --- a/extensions/Particle3D/PU/CCPUOnClearObserver.h +++ b/extensions/Particle3D/PU/CCPUOnClearObserver.h @@ -62,11 +62,11 @@ class CC_DLL PUOnClearObserver : public PUObserver virtual void postUpdateObserver(float timeElapsed) override; CC_CONSTRUCTOR_ACCESS: - PUOnClearObserver(void) : PUObserver(), + PUOnClearObserver() : PUObserver(), _continue(false) { } - virtual ~PUOnClearObserver(void) {}; + virtual ~PUOnClearObserver() {}; protected: bool _continue; diff --git a/extensions/Particle3D/PU/CCPUOnCollisionObserver.h b/extensions/Particle3D/PU/CCPUOnCollisionObserver.h index 2e793d21df78..5d0b087b6231 100644 --- a/extensions/Particle3D/PU/CCPUOnCollisionObserver.h +++ b/extensions/Particle3D/PU/CCPUOnCollisionObserver.h @@ -45,10 +45,10 @@ class CC_DLL PUOnCollisionObserver : public PUObserver virtual bool observe (PUParticle3D* particle, float timeElapsed) override; CC_CONSTRUCTOR_ACCESS: - PUOnCollisionObserver(void) : PUObserver() + PUOnCollisionObserver() : PUObserver() { } - virtual ~PUOnCollisionObserver(void) {}; + virtual ~PUOnCollisionObserver() {}; }; NS_CC_END diff --git a/extensions/Particle3D/PU/CCPUOnCountObserver.cpp b/extensions/Particle3D/PU/CCPUOnCountObserver.cpp index f816dd99441b..a784c80c340f 100644 --- a/extensions/Particle3D/PU/CCPUOnCountObserver.cpp +++ b/extensions/Particle3D/PU/CCPUOnCountObserver.cpp @@ -34,14 +34,14 @@ const unsigned int PUOnCountObserver::DEFAULT_THRESHOLD = 0; const PUComparisionOperator PUOnCountObserver::DEFAULT_COMPARE = CO_LESS_THAN; //----------------------------------------------------------------------- -PUOnCountObserver::PUOnCountObserver(void) : PUObserver(), +PUOnCountObserver::PUOnCountObserver() : PUObserver(), _count(1), _threshold(DEFAULT_THRESHOLD), _compare(DEFAULT_COMPARE) { } //----------------------------------------------------------------------- -void PUOnCountObserver::notifyStart (void) +void PUOnCountObserver::notifyStart () { PUObserver::notifyStart(); diff --git a/extensions/Particle3D/PU/CCPUOnCountObserver.h b/extensions/Particle3D/PU/CCPUOnCountObserver.h index f1cb88df5b7b..70a8d29a29e0 100644 --- a/extensions/Particle3D/PU/CCPUOnCountObserver.h +++ b/extensions/Particle3D/PU/CCPUOnCountObserver.h @@ -54,7 +54,7 @@ class CC_DLL PUOnCountObserver : public PUObserver static const PUComparisionOperator DEFAULT_COMPARE; /** */ - virtual void notifyStart (void) override; + virtual void notifyStart () override; /** */ @@ -62,7 +62,7 @@ class CC_DLL PUOnCountObserver : public PUObserver /** */ - unsigned int getThreshold(void) const {return _threshold;}; + unsigned int getThreshold() const {return _threshold;}; void setThreshold(unsigned int threshold){_threshold = threshold;}; /** @@ -73,8 +73,8 @@ class CC_DLL PUOnCountObserver : public PUObserver virtual void copyAttributesTo (PUObserver* observer) override; CC_CONSTRUCTOR_ACCESS: - PUOnCountObserver(void); - virtual ~PUOnCountObserver(void) {}; + PUOnCountObserver(); + virtual ~PUOnCountObserver() {}; }; NS_CC_END diff --git a/extensions/Particle3D/PU/CCPUOnEmissionObserver.h b/extensions/Particle3D/PU/CCPUOnEmissionObserver.h index 1938a30bc66e..10a7725a395c 100644 --- a/extensions/Particle3D/PU/CCPUOnEmissionObserver.h +++ b/extensions/Particle3D/PU/CCPUOnEmissionObserver.h @@ -47,10 +47,10 @@ class CC_DLL PUOnEmissionObserver : public PUObserver virtual bool observe (PUParticle3D* particle, float timeElapsed) override; CC_CONSTRUCTOR_ACCESS: - PUOnEmissionObserver(void) : PUObserver() + PUOnEmissionObserver() : PUObserver() { } - virtual ~PUOnEmissionObserver(void) {}; + virtual ~PUOnEmissionObserver() {}; }; NS_CC_END diff --git a/extensions/Particle3D/PU/CCPUOnEventFlagObserver.cpp b/extensions/Particle3D/PU/CCPUOnEventFlagObserver.cpp index 7fde96f82b41..1d756c9a5f11 100644 --- a/extensions/Particle3D/PU/CCPUOnEventFlagObserver.cpp +++ b/extensions/Particle3D/PU/CCPUOnEventFlagObserver.cpp @@ -33,9 +33,9 @@ NS_CC_BEGIN const unsigned int PUOnEventFlagObserver::DEFAULT_EVENT_FLAG = 0; //----------------------------------------------------------------------- -PUOnEventFlagObserver::PUOnEventFlagObserver(void) : - PUObserver(), - _eventFlag(DEFAULT_EVENT_FLAG) +PUOnEventFlagObserver::PUOnEventFlagObserver() +: PUObserver() +, _eventFlag(DEFAULT_EVENT_FLAG) { } //----------------------------------------------------------------------- diff --git a/extensions/Particle3D/PU/CCPUOnEventFlagObserver.h b/extensions/Particle3D/PU/CCPUOnEventFlagObserver.h index 7df4d132c644..5fa75c965583 100644 --- a/extensions/Particle3D/PU/CCPUOnEventFlagObserver.h +++ b/extensions/Particle3D/PU/CCPUOnEventFlagObserver.h @@ -55,14 +55,14 @@ class CC_DLL PUOnEventFlagObserver : public PUObserver /** */ - unsigned int getEventFlag(void) const {return _eventFlag;}; + unsigned int getEventFlag() const {return _eventFlag;}; void setEventFlag(unsigned int eventFlag){_eventFlag = eventFlag;}; virtual void copyAttributesTo (PUObserver* observer) override; CC_CONSTRUCTOR_ACCESS: - PUOnEventFlagObserver(void); - virtual ~PUOnEventFlagObserver(void) {}; + PUOnEventFlagObserver(); + virtual ~PUOnEventFlagObserver() {}; }; NS_CC_END diff --git a/extensions/Particle3D/PU/CCPUOnExpireObserver.h b/extensions/Particle3D/PU/CCPUOnExpireObserver.h index f5e510bbcf8d..e34196655d3e 100644 --- a/extensions/Particle3D/PU/CCPUOnExpireObserver.h +++ b/extensions/Particle3D/PU/CCPUOnExpireObserver.h @@ -50,10 +50,10 @@ class CC_DLL PUOnExpireObserver : public PUObserver virtual bool observe (PUParticle3D* particle, float timeElapsed) override; CC_CONSTRUCTOR_ACCESS: - PUOnExpireObserver(void) : PUObserver() + PUOnExpireObserver() : PUObserver() { } - virtual ~PUOnExpireObserver(void) {}; + virtual ~PUOnExpireObserver() {}; }; NS_CC_END diff --git a/extensions/Particle3D/PU/CCPUOnPositionObserver.cpp b/extensions/Particle3D/PU/CCPUOnPositionObserver.cpp index c560328ec98f..85ce45437b90 100644 --- a/extensions/Particle3D/PU/CCPUOnPositionObserver.cpp +++ b/extensions/Particle3D/PU/CCPUOnPositionObserver.cpp @@ -33,17 +33,17 @@ NS_CC_BEGIN const Vec3 PUOnPositionObserver::DEFAULT_POSITION_THRESHOLD(0, 0, 0); //----------------------------------------------------------------------- -PUOnPositionObserver::PUOnPositionObserver(void) : - PUObserver(), - _positionXThreshold(DEFAULT_POSITION_THRESHOLD.x), - _positionYThreshold(DEFAULT_POSITION_THRESHOLD.y), - _positionZThreshold(DEFAULT_POSITION_THRESHOLD.z), - _positionXThresholdSet(false), - _positionYThresholdSet(false), - _positionZThresholdSet(false), - _comparePositionX(CO_LESS_THAN), - _comparePositionY(CO_LESS_THAN), - _comparePositionZ(CO_LESS_THAN) +PUOnPositionObserver::PUOnPositionObserver() +: PUObserver() +, _positionXThreshold(DEFAULT_POSITION_THRESHOLD.x) +, _positionYThreshold(DEFAULT_POSITION_THRESHOLD.y) +, _positionZThreshold(DEFAULT_POSITION_THRESHOLD.z) +, _positionXThresholdSet(false) +, _positionYThresholdSet(false) +, _positionZThresholdSet(false) +, _comparePositionX(CO_LESS_THAN) +, _comparePositionY(CO_LESS_THAN) +, _comparePositionZ(CO_LESS_THAN) { } //----------------------------------------------------------------------- diff --git a/extensions/Particle3D/PU/CCPUOnPositionObserver.h b/extensions/Particle3D/PU/CCPUOnPositionObserver.h index 640f6fde14fd..4902f79d460f 100644 --- a/extensions/Particle3D/PU/CCPUOnPositionObserver.h +++ b/extensions/Particle3D/PU/CCPUOnPositionObserver.h @@ -57,21 +57,21 @@ class CC_DLL PUOnPositionObserver : public PUObserver /** */ - float getPositionXThreshold(void) const {return _positionXThreshold;}; - float getPositionYThreshold(void) const {return _positionYThreshold;}; - float getPositionZThreshold(void) const {return _positionZThreshold;}; + float getPositionXThreshold() const {return _positionXThreshold;}; + float getPositionYThreshold() const {return _positionYThreshold;}; + float getPositionZThreshold() const {return _positionZThreshold;}; /** */ - bool isPositionXThresholdSet(void) const {return _positionXThresholdSet;}; - bool isPositionYThresholdSet(void) const {return _positionYThresholdSet;}; - bool isPositionZThresholdSet(void) const {return _positionZThresholdSet;}; + bool isPositionXThresholdSet() const {return _positionXThresholdSet;}; + bool isPositionYThresholdSet() const {return _positionYThresholdSet;}; + bool isPositionZThresholdSet() const {return _positionZThresholdSet;}; /** */ - void resetPositionXThreshold(void) {_positionXThresholdSet = false;}; - void resetPositionYThreshold(void) {_positionYThresholdSet = false;}; - void resetPositionZThreshold(void) {_positionZThresholdSet = false;}; + void resetPositionXThreshold() {_positionXThresholdSet = false;}; + void resetPositionYThreshold() {_positionYThresholdSet = false;}; + void resetPositionZThreshold() {_positionZThresholdSet = false;}; /** */ @@ -88,8 +88,8 @@ class CC_DLL PUOnPositionObserver : public PUObserver virtual void copyAttributesTo (PUObserver* observer) override; CC_CONSTRUCTOR_ACCESS: - PUOnPositionObserver(void); - virtual ~PUOnPositionObserver(void) {}; + PUOnPositionObserver(); + virtual ~PUOnPositionObserver() {}; protected: diff --git a/extensions/Particle3D/PU/CCPUOnQuotaObserver.h b/extensions/Particle3D/PU/CCPUOnQuotaObserver.h index 65917b99eef6..ee4a40e8e35f 100644 --- a/extensions/Particle3D/PU/CCPUOnQuotaObserver.h +++ b/extensions/Particle3D/PU/CCPUOnQuotaObserver.h @@ -50,11 +50,10 @@ class CC_DLL PUOnQuotaObserver : public PUObserver virtual void postUpdateObserver(float deltaTime) override; CC_CONSTRUCTOR_ACCESS: - PUOnQuotaObserver(void) : PUObserver(), - _result(false) + PUOnQuotaObserver() : PUObserver(), _result(false) { } - virtual ~PUOnQuotaObserver(void) {}; + virtual ~PUOnQuotaObserver() {}; protected: diff --git a/extensions/Particle3D/PU/CCPUOnRandomObserver.cpp b/extensions/Particle3D/PU/CCPUOnRandomObserver.cpp index 7df9cd562d95..44a17ad6111a 100644 --- a/extensions/Particle3D/PU/CCPUOnRandomObserver.cpp +++ b/extensions/Particle3D/PU/CCPUOnRandomObserver.cpp @@ -33,9 +33,9 @@ NS_CC_BEGIN const float PUOnRandomObserver::DEFAULT_THRESHOLD = 0.5f; //----------------------------------------------------------------------- -PUOnRandomObserver::PUOnRandomObserver(void) : - PUObserver(), - _threshold(DEFAULT_THRESHOLD) +PUOnRandomObserver::PUOnRandomObserver() +: PUObserver() +, _threshold(DEFAULT_THRESHOLD) { } //----------------------------------------------------------------------- diff --git a/extensions/Particle3D/PU/CCPUOnRandomObserver.h b/extensions/Particle3D/PU/CCPUOnRandomObserver.h index 285d89dbe384..78d03ad3969d 100644 --- a/extensions/Particle3D/PU/CCPUOnRandomObserver.h +++ b/extensions/Particle3D/PU/CCPUOnRandomObserver.h @@ -59,14 +59,14 @@ class CC_DLL PUOnRandomObserver : public PUObserver /** */ - float getThreshold(void) const {return _threshold;}; + float getThreshold() const {return _threshold;}; void setThreshold(float threshold){_threshold = threshold;}; virtual void copyAttributesTo (PUObserver* observer) override; CC_CONSTRUCTOR_ACCESS: - PUOnRandomObserver(void); - virtual ~PUOnRandomObserver(void) {}; + PUOnRandomObserver(); + virtual ~PUOnRandomObserver() {}; protected: float _threshold; // Value between 0..1 diff --git a/extensions/Particle3D/PU/CCPUOnTimeObserver.cpp b/extensions/Particle3D/PU/CCPUOnTimeObserver.cpp index e89757e7c633..f3addbbfc5ce 100644 --- a/extensions/Particle3D/PU/CCPUOnTimeObserver.cpp +++ b/extensions/Particle3D/PU/CCPUOnTimeObserver.cpp @@ -25,6 +25,7 @@ ****************************************************************************/ #include "extensions/Particle3D/PU/CCPUOnTimeObserver.h" +#include #include "extensions/Particle3D/PU/CCPUParticleSystem3D.h" NS_CC_BEGIN @@ -35,16 +36,16 @@ const bool PUOnTimeObserver::DEFAULT_SINCE_START_SYSTEM = false; static bool almostEquals(float a, float b, float epsilon = std::numeric_limits::epsilon()) { - return fabs(a - b) <= ( (fabs(a) < fabs(b) ? fabs(b) : fabs(a)) * epsilon); -}; + return std::fabs(a - b) <= ( (std::fabs(a) < std::fabs(b) ? std::fabs(b) : std::fabs(a)) * epsilon); +} //----------------------------------------------------------------------- -PUOnTimeObserver::PUOnTimeObserver(void) : PUObserver(), +PUOnTimeObserver::PUOnTimeObserver() : PUObserver(), _threshold(DEFAULT_THRESHOLD), _compare(CO_GREATER_THAN), _sinceStartSystem(DEFAULT_SINCE_START_SYSTEM) { -}; +} //----------------------------------------------------------------------- void PUOnTimeObserver::preUpdateObserver(float deltaTime) { diff --git a/extensions/Particle3D/PU/CCPUOnTimeObserver.h b/extensions/Particle3D/PU/CCPUOnTimeObserver.h index a55ec446f101..0be41b7d4bdd 100644 --- a/extensions/Particle3D/PU/CCPUOnTimeObserver.h +++ b/extensions/Particle3D/PU/CCPUOnTimeObserver.h @@ -57,7 +57,7 @@ class CC_DLL PUOnTimeObserver : public PUObserver /** */ - float getThreshold(void) const {return _threshold;}; + float getThreshold() const {return _threshold;}; void setThreshold(float threshold){_threshold = threshold;}; /** @@ -67,14 +67,14 @@ class CC_DLL PUOnTimeObserver : public PUObserver /** */ - bool isSinceStartSystem(void) const {return _sinceStartSystem;}; + bool isSinceStartSystem() const {return _sinceStartSystem;}; void setSinceStartSystem(bool sinceStartSystem){_sinceStartSystem = sinceStartSystem;}; virtual void copyAttributesTo (PUObserver* observer) override; CC_CONSTRUCTOR_ACCESS: - PUOnTimeObserver(void); - virtual ~PUOnTimeObserver(void) {}; + PUOnTimeObserver(); + virtual ~PUOnTimeObserver() {}; protected: float _threshold; diff --git a/extensions/Particle3D/PU/CCPUOnVelocityObserver.cpp b/extensions/Particle3D/PU/CCPUOnVelocityObserver.cpp index 92d370028c2e..dd74c467b668 100644 --- a/extensions/Particle3D/PU/CCPUOnVelocityObserver.cpp +++ b/extensions/Particle3D/PU/CCPUOnVelocityObserver.cpp @@ -25,25 +25,26 @@ ****************************************************************************/ #include "extensions/Particle3D/PU/CCPUOnVelocityObserver.h" +#include #include "extensions/Particle3D/PU/CCPUParticleSystem3D.h" NS_CC_BEGIN static bool almostEquals(float a, float b, float epsilon = std::numeric_limits::epsilon()) { - return fabs(a - b) <= ( (fabs(a) < fabs(b) ? fabs(b) : fabs(a)) * epsilon); -}; + return std::fabs(a - b) <= ( (std::fabs(a) < std::fabs(b) ? std::fabs(b) : std::fabs(a)) * epsilon); +} // Constants const float PUOnVelocityObserver::DEFAULT_VELOCITY_THRESHOLD = 0.0f; //----------------------------------------------------------------------- -PUOnVelocityObserver::PUOnVelocityObserver(void) : - PUObserver(), - _threshold(DEFAULT_VELOCITY_THRESHOLD), - _compare(CO_LESS_THAN) +PUOnVelocityObserver::PUOnVelocityObserver() +: PUObserver() +, _threshold(DEFAULT_VELOCITY_THRESHOLD) +, _compare(CO_LESS_THAN) { -}; +} //----------------------------------------------------------------------- bool PUOnVelocityObserver::observe (PUParticle3D* particle, float /*timeElapsed*/) { diff --git a/extensions/Particle3D/PU/CCPUOnVelocityObserver.h b/extensions/Particle3D/PU/CCPUOnVelocityObserver.h index b98ba3a3571a..b9891e1d0bb3 100644 --- a/extensions/Particle3D/PU/CCPUOnVelocityObserver.h +++ b/extensions/Particle3D/PU/CCPUOnVelocityObserver.h @@ -51,7 +51,7 @@ class CC_DLL PUOnVelocityObserver : public PUObserver /** */ - float getThreshold(void) const {return _threshold;}; + float getThreshold() const {return _threshold;}; void setThreshold(float threshold){_threshold = threshold;}; /** @@ -62,8 +62,8 @@ class CC_DLL PUOnVelocityObserver : public PUObserver virtual void copyAttributesTo (PUObserver* observer) override; CC_CONSTRUCTOR_ACCESS: - PUOnVelocityObserver(void); - virtual ~PUOnVelocityObserver(void) {}; + PUOnVelocityObserver(); + virtual ~PUOnVelocityObserver() {}; protected: float _threshold; diff --git a/extensions/Particle3D/PU/CCPUParticleFollower.cpp b/extensions/Particle3D/PU/CCPUParticleFollower.cpp index 8ab3f52fac4c..36be63cbd8c4 100644 --- a/extensions/Particle3D/PU/CCPUParticleFollower.cpp +++ b/extensions/Particle3D/PU/CCPUParticleFollower.cpp @@ -34,7 +34,7 @@ const float PUParticleFollower::DEFAULT_MAX_DISTANCE = 3.40282e+038f; const float PUParticleFollower::DEFAULT_MIN_DISTANCE = 10.0f; //----------------------------------------------------------------------- -PUParticleFollower::PUParticleFollower(void) : +PUParticleFollower::PUParticleFollower() : PUAffector(), _minDistance(DEFAULT_MIN_DISTANCE), _maxDistance(DEFAULT_MAX_DISTANCE), @@ -42,12 +42,12 @@ PUParticleFollower::PUParticleFollower(void) : { } -PUParticleFollower::~PUParticleFollower( void ) +PUParticleFollower::~PUParticleFollower() { } //----------------------------------------------------------------------- -float PUParticleFollower::getMaxDistance(void) const +float PUParticleFollower::getMaxDistance() const { return _maxDistance; } @@ -57,7 +57,7 @@ void PUParticleFollower::setMaxDistance(float maxDistance) _maxDistance = maxDistance; } //----------------------------------------------------------------------- -float PUParticleFollower::getMinDistance(void) const +float PUParticleFollower::getMinDistance() const { return _minDistance; } diff --git a/extensions/Particle3D/PU/CCPUParticleFollower.h b/extensions/Particle3D/PU/CCPUParticleFollower.h index aa25170083b8..1874f30fad9d 100644 --- a/extensions/Particle3D/PU/CCPUParticleFollower.h +++ b/extensions/Particle3D/PU/CCPUParticleFollower.h @@ -47,19 +47,19 @@ class CC_DLL PUParticleFollower : public PUAffector /** */ - float getMaxDistance(void) const; + float getMaxDistance() const; void setMaxDistance(float maxDistance); /** */ - float getMinDistance(void) const; + float getMinDistance() const; void setMinDistance(float minDistance); virtual void copyAttributesTo (PUAffector* affector) override; CC_CONSTRUCTOR_ACCESS: - PUParticleFollower(void); - virtual ~PUParticleFollower(void); + PUParticleFollower(); + virtual ~PUParticleFollower(); protected: float _minDistance; diff --git a/extensions/Particle3D/PU/CCPUParticleSystem3D.cpp b/extensions/Particle3D/PU/CCPUParticleSystem3D.cpp index d557f49b0090..be2332a98255 100755 --- a/extensions/Particle3D/PU/CCPUParticleSystem3D.cpp +++ b/extensions/Particle3D/PU/CCPUParticleSystem3D.cpp @@ -277,11 +277,11 @@ bool PUParticleSystem3D::initWithFilePath( const std::string &filePath ) { std::string fullPath = FileUtils::getInstance()->fullPathForFilename(filePath); convertToUnixStylePath(fullPath); - std::string::size_type pos = fullPath.find_last_of("/"); + std::string::size_type pos = fullPath.find_last_of('/'); std::string materialFolder = "materials"; if (pos != std::string::npos){ std::string temp = fullPath.substr(0, pos); - pos = temp.find_last_of("/"); + pos = temp.find_last_of('/'); if (pos != std::string::npos){ materialFolder = temp.substr(0, pos + 1) + materialFolder; } @@ -1363,7 +1363,7 @@ void PUParticleSystem3D::processMotion( PUParticle3D* particle, float timeElapse , particle->direction.z * scl.z * _particleSystemScaleVelocity * timeElapsed); } -void PUParticleSystem3D::calulateRotationOffset( void ) +void PUParticleSystem3D::calulateRotationOffset() { if (_isMarkedForEmission) { diff --git a/extensions/Particle3D/PU/CCPUParticleSystem3D.h b/extensions/Particle3D/PU/CCPUParticleSystem3D.h index f1be7a9e64c6..8f08cc9b0937 100644 --- a/extensions/Particle3D/PU/CCPUParticleSystem3D.h +++ b/extensions/Particle3D/PU/CCPUParticleSystem3D.h @@ -169,7 +169,7 @@ struct CC_DLL PUParticle3D : public Particle3D unsigned int eventFlags; - bool isFreezed(void) const + bool isFreezed() const { return freezed; } @@ -349,7 +349,7 @@ class CC_DLL PUParticleSystem3D : public ParticleSystem3D const ParticlePoolMap& getEmittedSystemParticlePool() const { return _emittedSystemParticlePool; }; bool makeParticleLocal(PUParticle3D* particle); - void calulateRotationOffset(void); + void calulateRotationOffset(); virtual PUParticleSystem3D* clone(); virtual void copyAttributesTo(PUParticleSystem3D* system); diff --git a/extensions/Particle3D/PU/CCPUPathFollower.cpp b/extensions/Particle3D/PU/CCPUPathFollower.cpp index 3015bba158f8..845e01ae8ff3 100644 --- a/extensions/Particle3D/PU/CCPUPathFollower.cpp +++ b/extensions/Particle3D/PU/CCPUPathFollower.cpp @@ -29,12 +29,12 @@ NS_CC_BEGIN -PUPathFollower::PUPathFollower( void ) +PUPathFollower::PUPathFollower() { } -PUPathFollower::~PUPathFollower( void ) +PUPathFollower::~PUPathFollower() { } @@ -45,7 +45,7 @@ void PUPathFollower::addPoint(const Vec3& point) _spline.addPoint(point); } //----------------------------------------------------------------------- -void PUPathFollower::clearPoints (void) +void PUPathFollower::clearPoints () { _spline.clear(); } diff --git a/extensions/Particle3D/PU/CCPUPathFollower.h b/extensions/Particle3D/PU/CCPUPathFollower.h index 0b30df1b34f0..122f3f823ecb 100644 --- a/extensions/Particle3D/PU/CCPUPathFollower.h +++ b/extensions/Particle3D/PU/CCPUPathFollower.h @@ -47,11 +47,11 @@ class CC_DLL PUPathFollower : public PUAffector /** Clear all points */ - void clearPoints (void); + void clearPoints (); /** */ - unsigned short getNumPoints(void) const {return _spline.getNumPoints();}; + unsigned short getNumPoints() const {return _spline.getNumPoints();}; /** */ @@ -60,8 +60,8 @@ class CC_DLL PUPathFollower : public PUAffector virtual void copyAttributesTo (PUAffector* affector) override; CC_CONSTRUCTOR_ACCESS: - PUPathFollower(void); - virtual ~PUPathFollower(void); + PUPathFollower(); + virtual ~PUPathFollower(); protected: diff --git a/extensions/Particle3D/PU/CCPUPlane.cpp b/extensions/Particle3D/PU/CCPUPlane.cpp index cf7d7c4adcd2..93f004526fea 100644 --- a/extensions/Particle3D/PU/CCPUPlane.cpp +++ b/extensions/Particle3D/PU/CCPUPlane.cpp @@ -155,7 +155,7 @@ Vec3 PUPlane::projectVector(const Vec3& p) const } //----------------------------------------------------------------------- -float PUPlane::normalize(void) +float PUPlane::normalize() { float fLength = normal.length(); diff --git a/extensions/Particle3D/PU/CCPUPlane.h b/extensions/Particle3D/PU/CCPUPlane.h index 9055775ba0d9..3f7f3f425e5f 100644 --- a/extensions/Particle3D/PU/CCPUPlane.h +++ b/extensions/Particle3D/PU/CCPUPlane.h @@ -124,7 +124,7 @@ class PUPlane will be no changes made to their components. @return The previous length of the plane's normal. */ - float normalize(void); + float normalize(); Vec3 normal; float d; diff --git a/extensions/Particle3D/PU/CCPUPlaneCollider.cpp b/extensions/Particle3D/PU/CCPUPlaneCollider.cpp index 6b2c5ab588c5..827cd834e42d 100644 --- a/extensions/Particle3D/PU/CCPUPlaneCollider.cpp +++ b/extensions/Particle3D/PU/CCPUPlaneCollider.cpp @@ -33,17 +33,17 @@ NS_CC_BEGIN const Vec3 PUPlaneCollider::DEFAULT_NORMAL(0, 0, 0); //----------------------------------------------------------------------- -PUPlaneCollider::PUPlaneCollider(void) : - PUBaseCollider(), - _normal(DEFAULT_NORMAL) +PUPlaneCollider::PUPlaneCollider() +: PUBaseCollider() +, _normal(DEFAULT_NORMAL) { } -PUPlaneCollider::~PUPlaneCollider( void ) +PUPlaneCollider::~PUPlaneCollider() { } //----------------------------------------------------------------------- -const Vec3 PUPlaneCollider::getNormal(void) const +const Vec3 PUPlaneCollider::getNormal() const { return _normal; } diff --git a/extensions/Particle3D/PU/CCPUPlaneCollider.h b/extensions/Particle3D/PU/CCPUPlaneCollider.h index bb8ca3b0b692..20092ac44c68 100644 --- a/extensions/Particle3D/PU/CCPUPlaneCollider.h +++ b/extensions/Particle3D/PU/CCPUPlaneCollider.h @@ -47,7 +47,7 @@ class CC_DLL PUPlaneCollider : public PUBaseCollider /** Returns the normal of the plane */ - const Vec3 getNormal(void) const; + const Vec3 getNormal() const; /** Sets the normal of the plane */ @@ -60,8 +60,8 @@ class CC_DLL PUPlaneCollider : public PUBaseCollider virtual void copyAttributesTo (PUAffector* affector) override; CC_CONSTRUCTOR_ACCESS: - PUPlaneCollider(void); - virtual ~PUPlaneCollider(void); + PUPlaneCollider(); + virtual ~PUPlaneCollider(); protected: Vec3 _normal; diff --git a/extensions/Particle3D/PU/CCPUPointEmitter.cpp b/extensions/Particle3D/PU/CCPUPointEmitter.cpp index cfe35f592c8c..e60ff0cf0dfd 100644 --- a/extensions/Particle3D/PU/CCPUPointEmitter.cpp +++ b/extensions/Particle3D/PU/CCPUPointEmitter.cpp @@ -30,12 +30,12 @@ NS_CC_BEGIN -PUPointEmitter::PUPointEmitter( void ) +PUPointEmitter::PUPointEmitter() { } -PUPointEmitter::~PUPointEmitter( void ) +PUPointEmitter::~PUPointEmitter() { } diff --git a/extensions/Particle3D/PU/CCPUPointEmitter.h b/extensions/Particle3D/PU/CCPUPointEmitter.h index d703f1e4dcf6..63ee934444b2 100644 --- a/extensions/Particle3D/PU/CCPUPointEmitter.h +++ b/extensions/Particle3D/PU/CCPUPointEmitter.h @@ -41,8 +41,8 @@ class CC_DLL PUPointEmitter : public PUEmitter virtual void copyAttributesTo (PUEmitter* emitter) override; CC_CONSTRUCTOR_ACCESS: - PUPointEmitter(void); - virtual ~PUPointEmitter(void); + PUPointEmitter(); + virtual ~PUPointEmitter(); }; NS_CC_END diff --git a/extensions/Particle3D/PU/CCPUPositionEmitter.cpp b/extensions/Particle3D/PU/CCPUPositionEmitter.cpp index 25d25e6544e3..3d8e5bc74e4d 100644 --- a/extensions/Particle3D/PU/CCPUPositionEmitter.cpp +++ b/extensions/Particle3D/PU/CCPUPositionEmitter.cpp @@ -32,7 +32,7 @@ NS_CC_BEGIN const bool PUPositionEmitter::DEFAULT_RANDOMIZE = true; //----------------------------------------------------------------------- -PUPositionEmitter::PUPositionEmitter(void) : +PUPositionEmitter::PUPositionEmitter() : PUEmitter(), _randomized(DEFAULT_RANDOMIZE), _index(0) @@ -49,7 +49,7 @@ void PUPositionEmitter::setRandomized(bool randomized) _randomized = randomized; } //----------------------------------------------------------------------- -const std::vector& PUPositionEmitter::getPositions(void) const +const std::vector& PUPositionEmitter::getPositions() const { return _positionList; } @@ -59,13 +59,13 @@ void PUPositionEmitter::addPosition(const Vec3& position) _positionList.push_back(position); } //----------------------------------------------------------------------- -void PUPositionEmitter::notifyStart(void) +void PUPositionEmitter::notifyStart() { PUEmitter::notifyStart(); _index = 0; } //----------------------------------------------------------------------- -void PUPositionEmitter::removeAllPositions(void) +void PUPositionEmitter::removeAllPositions() { _index = 0; _positionList.clear(); diff --git a/extensions/Particle3D/PU/CCPUPositionEmitter.h b/extensions/Particle3D/PU/CCPUPositionEmitter.h index cdc9f55efd6d..24d03c132860 100644 --- a/extensions/Particle3D/PU/CCPUPositionEmitter.h +++ b/extensions/Particle3D/PU/CCPUPositionEmitter.h @@ -41,7 +41,7 @@ class CC_DLL PUPositionEmitter : public PUEmitter static PUPositionEmitter* create(); /** */ - bool isRandomized(void) const; + bool isRandomized() const; /** */ @@ -49,7 +49,7 @@ class CC_DLL PUPositionEmitter : public PUEmitter /** Returns a list with positions */ - const std::vector& getPositions(void) const; + const std::vector& getPositions() const; /** Add a new position to this emitter */ @@ -57,11 +57,11 @@ class CC_DLL PUPositionEmitter : public PUEmitter /** Remove all positions from this emitter */ - void removeAllPositions(void); + void removeAllPositions(); /** See ParticleEmitter */ - void notifyStart(void) override; + void notifyStart() override; /** See ParticleEmitter */ @@ -75,8 +75,8 @@ class CC_DLL PUPositionEmitter : public PUEmitter virtual void copyAttributesTo (PUEmitter* emitter) override; CC_CONSTRUCTOR_ACCESS: - PUPositionEmitter(void); - virtual ~PUPositionEmitter(void) {}; + PUPositionEmitter(); + virtual ~PUPositionEmitter() {}; protected: std::vector _positionList; diff --git a/extensions/Particle3D/PU/CCPURandomiser.cpp b/extensions/Particle3D/PU/CCPURandomiser.cpp index e39b22651362..3dbddc6f0183 100644 --- a/extensions/Particle3D/PU/CCPURandomiser.cpp +++ b/extensions/Particle3D/PU/CCPURandomiser.cpp @@ -35,7 +35,7 @@ const float PURandomiser::DEFAULT_TIME_STEP = 0.0f; const bool PURandomiser::DEFAULT_RANDOM_DIRECTION = true; //----------------------------------------------------------------------- -PURandomiser::PURandomiser(void) : +PURandomiser::PURandomiser() : PUAffector(), _maxDeviationX(DEFAULT_MAX_DEVIATION.x), _maxDeviationY(DEFAULT_MAX_DEVIATION.y), @@ -46,12 +46,12 @@ PURandomiser::PURandomiser(void) : _update(true) { } -PURandomiser::~PURandomiser( void ) +PURandomiser::~PURandomiser() { } //----------------------------------------------------------------------- -float PURandomiser::getMaxDeviationX(void) const +float PURandomiser::getMaxDeviationX() const { return _maxDeviationX; } @@ -61,7 +61,7 @@ void PURandomiser::setMaxDeviationX(float maxDeviationX) _maxDeviationX = maxDeviationX; } //----------------------------------------------------------------------- -float PURandomiser::getMaxDeviationY(void) const +float PURandomiser::getMaxDeviationY() const { return _maxDeviationY; } @@ -71,7 +71,7 @@ void PURandomiser::setMaxDeviationY(float maxDeviationY) _maxDeviationY = maxDeviationY; } //----------------------------------------------------------------------- -float PURandomiser::getMaxDeviationZ(void) const +float PURandomiser::getMaxDeviationZ() const { return _maxDeviationZ; } @@ -81,7 +81,7 @@ void PURandomiser::setMaxDeviationZ(float maxDeviationZ) _maxDeviationZ = maxDeviationZ; } //----------------------------------------------------------------------- -float PURandomiser::getTimeStep(void) const +float PURandomiser::getTimeStep() const { return _timeStep; } @@ -92,7 +92,7 @@ void PURandomiser::setTimeStep(float timeStep) _timeSinceLastUpdate = timeStep; } //----------------------------------------------------------------------- -bool PURandomiser::isRandomDirection(void) const +bool PURandomiser::isRandomDirection() const { return _randomDirection; } diff --git a/extensions/Particle3D/PU/CCPURandomiser.h b/extensions/Particle3D/PU/CCPURandomiser.h index 02b4f9bd616e..ab1c86a5b0ad 100644 --- a/extensions/Particle3D/PU/CCPURandomiser.h +++ b/extensions/Particle3D/PU/CCPURandomiser.h @@ -48,34 +48,34 @@ class CC_DLL PURandomiser : public PUAffector virtual void postUpdateAffector(float deltaTime) override; /** */ - float getMaxDeviationX(void) const; + float getMaxDeviationX() const; void setMaxDeviationX(const float maxDeviationX); /** */ - float getMaxDeviationY(void) const; + float getMaxDeviationY() const; void setMaxDeviationY(const float maxDeviationZ); /** */ - float getMaxDeviationZ(void) const; + float getMaxDeviationZ() const; void setMaxDeviationZ(const float maxDeviationZ); /** */ - float getTimeStep(void) const; + float getTimeStep() const; void setTimeStep(const float timeStep); /** */ - bool isRandomDirection(void) const; + bool isRandomDirection() const; void setRandomDirection(bool randomDirection); virtual void copyAttributesTo (PUAffector* affector) override; CC_CONSTRUCTOR_ACCESS: - PURandomiser(void); - virtual ~PURandomiser(void); + PURandomiser(); + virtual ~PURandomiser(); protected: float _maxDeviationX; diff --git a/extensions/Particle3D/PU/CCPURender.h b/extensions/Particle3D/PU/CCPURender.h index 9fcb4800ffb6..ad86b77eb631 100644 --- a/extensions/Particle3D/PU/CCPURender.h +++ b/extensions/Particle3D/PU/CCPURender.h @@ -47,7 +47,7 @@ class CC_DLL PURender : public Particle3DRender virtual void unPrepare(){}; virtual void updateRender(PUParticle3D* particle, float deltaTime, bool firstParticle); - const std::string& getRenderType(void) const {return _renderType;}; + const std::string& getRenderType() const {return _renderType;}; void setRenderType(const std::string& observerType) {_renderType = observerType;}; virtual PURender* clone() = 0; diff --git a/extensions/Particle3D/PU/CCPURendererTranslator.cpp b/extensions/Particle3D/PU/CCPURendererTranslator.cpp index a99648959bd3..5d2168ec3ab5 100644 --- a/extensions/Particle3D/PU/CCPURendererTranslator.cpp +++ b/extensions/Particle3D/PU/CCPURendererTranslator.cpp @@ -74,12 +74,12 @@ void PURendererTranslator::translate(PUScriptCompiler* compiler, PUAbstractNode PUMaterial *material = PUMaterialCache::Instance()->getMaterial(system->getMaterialName()); std::string texFolder = "textures/"; if (material){ - std::string::size_type pos = obj->file.find_last_of("/"); + std::string::size_type pos = obj->file.find_last_of('/'); //if (pos != std::string::npos) // texFolder = obj->file.substr(0, pos + 1) + texFolder; if (pos != std::string::npos){ std::string temp = obj->file.substr(0, pos); - pos = temp.find_last_of("/"); + pos = temp.find_last_of('/'); if (pos != std::string::npos){ texFolder = temp.substr(0, pos + 1) + texFolder; } @@ -261,7 +261,7 @@ void PURendererTranslator::translate(PUScriptCompiler* compiler, PUAbstractNode std::string val; if(getString(*prop->values.front(), &val)) { - std::string::size_type pos = val.find_last_of("."); + std::string::size_type pos = val.find_last_of('.'); val = val.substr(0, pos + 1) + std::string("c3b"); if (material) _renderer = PUParticle3DModelRender::create(val, texFolder + material->textureFile); diff --git a/extensions/Particle3D/PU/CCPURibbonTrail.cpp b/extensions/Particle3D/PU/CCPURibbonTrail.cpp index 2da5dbdc7118..7681a6627b08 100644 --- a/extensions/Particle3D/PU/CCPURibbonTrail.cpp +++ b/extensions/Particle3D/PU/CCPURibbonTrail.cpp @@ -245,7 +245,7 @@ float PURibbonTrail::getWidthChange(size_t chainIndex) const } //----------------------------------------------------------------------- -void PURibbonTrail::manageController(void) +void PURibbonTrail::manageController() { _needTimeUpdate = false; for (size_t i = 0; i < _chainCount; ++i) @@ -404,7 +404,7 @@ void PURibbonTrail::resetTrail(size_t index, const Node* node) addChainElement(index, e); } //----------------------------------------------------------------------- -void PURibbonTrail::resetAllTrails(void) +void PURibbonTrail::resetAllTrails() { for (size_t i = 0; i < _nodeList.size(); ++i) { diff --git a/extensions/Particle3D/PU/CCPURibbonTrail.h b/extensions/Particle3D/PU/CCPURibbonTrail.h index 584f2337aaec..983209174314 100644 --- a/extensions/Particle3D/PU/CCPURibbonTrail.h +++ b/extensions/Particle3D/PU/CCPURibbonTrail.h @@ -74,7 +74,7 @@ class PURibbonTrail : public PUBillboardChain */ virtual void setTrailLength(float len); /** Get the length of the trail. */ - virtual float getTrailLength(void) const { return _trailLength; } + virtual float getTrailLength() const { return _trailLength; } /** @copydoc BillboardChain::setMaxChainElements */ void setMaxChainElements(size_t maxElements) override; @@ -144,13 +144,13 @@ class PURibbonTrail : public PUBillboardChain protected: /// Manage updates to the time controller - void manageController(void); + void manageController(); /// Node has changed position, update void updateTrail(size_t index, const Node* node); /// Reset the tracked chain to initial state void resetTrail(size_t index, const Node* node); /// Reset all tracked chains to initial state - void resetAllTrails(void); + void resetAllTrails(); protected: diff --git a/extensions/Particle3D/PU/CCPURibbonTrailRender.cpp b/extensions/Particle3D/PU/CCPURibbonTrailRender.cpp index 55adc27241da..21b438fd7b82 100644 --- a/extensions/Particle3D/PU/CCPURibbonTrailRender.cpp +++ b/extensions/Particle3D/PU/CCPURibbonTrailRender.cpp @@ -73,7 +73,7 @@ void PURibbonTrailRender::render( Renderer* renderer, const Mat4 &transform, Par const PUParticleSystem3D::ParticlePoolMap &emitterPool = static_cast(particleSystem)->getEmittedEmitterParticlePool(); if (!emitterPool.empty()){ - for (auto iter : emitterPool){ + for (const auto& iter : emitterPool){ updateParticles(iter.second); needDraw = true; } @@ -81,7 +81,7 @@ void PURibbonTrailRender::render( Renderer* renderer, const Mat4 &transform, Par const PUParticleSystem3D::ParticlePoolMap &systemPool = static_cast(particleSystem)->getEmittedSystemParticlePool(); if (!systemPool.empty()){ - for (auto iter : systemPool){ + for (const auto& iter : systemPool){ updateParticles(iter.second); needDraw = true; } @@ -134,7 +134,7 @@ void PURibbonTrailRender::particleExpired( PUParticleSystem3D* /*particleSystem* } //----------------------------------------------------------------------- -bool PURibbonTrailRender::isUseVertexColors(void) const +bool PURibbonTrailRender::isUseVertexColors() const { return _useVertexColours; } @@ -144,7 +144,7 @@ void PURibbonTrailRender::setUseVertexColors(bool useVertexColours) _useVertexColours = useVertexColours; } //----------------------------------------------------------------------- -size_t PURibbonTrailRender::getMaxChainElements(void) const +size_t PURibbonTrailRender::getMaxChainElements() const { return _maxChainElements; } @@ -154,7 +154,7 @@ void PURibbonTrailRender::setMaxChainElements(size_t maxChainElements) _maxChainElements = maxChainElements; } //----------------------------------------------------------------------- -float PURibbonTrailRender::getTrailLength(void) const +float PURibbonTrailRender::getTrailLength() const { return _trailLength; } @@ -165,7 +165,7 @@ void PURibbonTrailRender::setTrailLength(float trailLength) _setLength = true; } //----------------------------------------------------------------------- -float PURibbonTrailRender::getTrailWidth(void) const +float PURibbonTrailRender::getTrailWidth() const { return _trailWidth; } @@ -176,7 +176,7 @@ void PURibbonTrailRender::setTrailWidth(float trailWidth) _setWidth = true; } //----------------------------------------------------------------------- -bool PURibbonTrailRender::isRandomInitialColor(void) const +bool PURibbonTrailRender::isRandomInitialColor() const { return _randomInitialColor; } @@ -186,7 +186,7 @@ void PURibbonTrailRender::setRandomInitialColor(bool randomInitialColour) _randomInitialColor = randomInitialColour; } //----------------------------------------------------------------------- -const Vec4& PURibbonTrailRender::getInitialColor(void) const +const Vec4& PURibbonTrailRender::getInitialColor() const { return _initialColor; } @@ -196,7 +196,7 @@ void PURibbonTrailRender::setInitialColor(const Vec4& initialColour) _initialColor = initialColour; } //----------------------------------------------------------------------- -const Vec4& PURibbonTrailRender::getColorChange(void) const +const Vec4& PURibbonTrailRender::getColorChange() const { return _colorChange; } @@ -307,7 +307,7 @@ void PURibbonTrailRender::updateRender( PUParticle3D* /*particle*/, float deltaT } //----------------------------------------------------------------------- -void PURibbonTrailRender::destroyAll(void) +void PURibbonTrailRender::destroyAll() { if (!_particleSystem || !_trail || !_childNode) return; diff --git a/extensions/Particle3D/PU/CCPURibbonTrailRender.h b/extensions/Particle3D/PU/CCPURibbonTrailRender.h index d6cf207b9d67..c8c1e5063dfc 100644 --- a/extensions/Particle3D/PU/CCPURibbonTrailRender.h +++ b/extensions/Particle3D/PU/CCPURibbonTrailRender.h @@ -101,30 +101,30 @@ class CC_DLL PURibbonTrailRender : public PURender, public PUListener /** Getters and Setters */ - bool isUseVertexColors(void) const; + bool isUseVertexColors() const; void setUseVertexColors(bool useVertexColours); - size_t getMaxChainElements(void) const; + size_t getMaxChainElements() const; void setMaxChainElements(size_t maxChainElements); - float getTrailLength(void) const; + float getTrailLength() const; void setTrailLength(float trailLength); - float getTrailWidth(void) const; + float getTrailWidth() const; void setTrailWidth(float trailWidth); - bool isRandomInitialColor(void) const; + bool isRandomInitialColor() const; void setRandomInitialColor(bool randomInitialColour); - const Vec4& getInitialColor(void) const; + const Vec4& getInitialColor() const; void setInitialColor(const Vec4& initialColour); - const Vec4& getColorChange(void) const; + const Vec4& getColorChange() const; void setColorChange(const Vec4& colourChange); /** Deletes all ChildSceneNodes en Entities. */ - void destroyAll(void); + void destroyAll(); virtual PURibbonTrailRender* clone() override; void copyAttributesTo(PURibbonTrailRender *render); diff --git a/extensions/Particle3D/PU/CCPUScaleAffector.cpp b/extensions/Particle3D/PU/CCPUScaleAffector.cpp index 56af15c52925..c0c1a6e79ebd 100644 --- a/extensions/Particle3D/PU/CCPUScaleAffector.cpp +++ b/extensions/Particle3D/PU/CCPUScaleAffector.cpp @@ -36,13 +36,13 @@ const float PUScaleAffector::DEFAULT_Z_SCALE = 1.0f; const float PUScaleAffector::DEFAULT_XYZ_SCALE = 1.0f; //----------------------------------------------------------------------- -PUScaleAffector::PUScaleAffector(void) : - PUAffector(), - _dynScaleXSet(false), - _dynScaleYSet(false), - _dynScaleZSet(false), - _dynScaleXYZSet(false), - _sinceStartSystem(false) +PUScaleAffector::PUScaleAffector() +: PUAffector() +, _dynScaleXSet(false) +, _dynScaleYSet(false) +, _dynScaleZSet(false) +, _dynScaleXYZSet(false) +, _sinceStartSystem(false) { _dynScaleX = new (std::nothrow) PUDynamicAttributeFixed(); _dynScaleY = new (std::nothrow) PUDynamicAttributeFixed(); @@ -55,7 +55,7 @@ PUScaleAffector::PUScaleAffector(void) : _latestTimeElapsed = 1.0f; } //----------------------------------------------------------------------- -PUScaleAffector::~PUScaleAffector(void) +PUScaleAffector::~PUScaleAffector() { if (_dynScaleX) { diff --git a/extensions/Particle3D/PU/CCPUScaleAffector.h b/extensions/Particle3D/PU/CCPUScaleAffector.h index 4de44c588aab..c3b8a7062041 100644 --- a/extensions/Particle3D/PU/CCPUScaleAffector.h +++ b/extensions/Particle3D/PU/CCPUScaleAffector.h @@ -49,38 +49,38 @@ class CC_DLL PUScaleAffector : public PUAffector /** */ - PUDynamicAttribute* getDynScaleX(void) const {return _dynScaleX;}; + PUDynamicAttribute* getDynScaleX() const {return _dynScaleX;}; void setDynScaleX(PUDynamicAttribute* dynScaleX); void resetDynScaleX(bool resetToDefault = true); /** */ - PUDynamicAttribute* getDynScaleY(void) const {return _dynScaleY;}; + PUDynamicAttribute* getDynScaleY() const {return _dynScaleY;}; void setDynScaleY(PUDynamicAttribute* dynScaleY); void resetDynScaleY(bool resetToDefault = true); /** */ - PUDynamicAttribute* getDynScaleZ(void) const {return _dynScaleZ;}; + PUDynamicAttribute* getDynScaleZ() const {return _dynScaleZ;}; void setDynScaleZ(PUDynamicAttribute* dynScaleZ); void resetDynScaleZ(bool resetToDefault = true); /** */ - PUDynamicAttribute* getDynScaleXYZ(void) const {return _dynScaleXYZ;}; + PUDynamicAttribute* getDynScaleXYZ() const {return _dynScaleXYZ;}; void setDynScaleXYZ(PUDynamicAttribute* dynScaleXYZ); void resetDynScaleXYZ(bool resetToDefault = true); /** */ - bool isSinceStartSystem(void) const {return _sinceStartSystem;}; + bool isSinceStartSystem() const {return _sinceStartSystem;}; void setSinceStartSystem(bool sinceStartSystem){_sinceStartSystem = sinceStartSystem;}; virtual void copyAttributesTo (PUAffector* affector) override; CC_CONSTRUCTOR_ACCESS: - PUScaleAffector(void); - virtual ~PUScaleAffector(void); + PUScaleAffector(); + virtual ~PUScaleAffector(); protected: diff --git a/extensions/Particle3D/PU/CCPUScaleVelocityAffector.cpp b/extensions/Particle3D/PU/CCPUScaleVelocityAffector.cpp index 03ef696853da..5db17fcaed55 100644 --- a/extensions/Particle3D/PU/CCPUScaleVelocityAffector.cpp +++ b/extensions/Particle3D/PU/CCPUScaleVelocityAffector.cpp @@ -32,16 +32,16 @@ NS_CC_BEGIN const float PUScaleVelocityAffector::DEFAULT_VELOCITY_SCALE = 1.0f; //----------------------------------------------------------------------- -PUScaleVelocityAffector::PUScaleVelocityAffector(void) : - PUAffector(), - _sinceStartSystem(false), - _stopAtFlip(false) +PUScaleVelocityAffector::PUScaleVelocityAffector() +: PUAffector() +, _sinceStartSystem(false) +, _stopAtFlip(false) { _dynScaleVelocity = new (std::nothrow) PUDynamicAttributeFixed(); (static_cast(_dynScaleVelocity))->setValue(DEFAULT_VELOCITY_SCALE); } //----------------------------------------------------------------------- -PUScaleVelocityAffector::~PUScaleVelocityAffector(void) +PUScaleVelocityAffector::~PUScaleVelocityAffector() { if (_dynScaleVelocity) { diff --git a/extensions/Particle3D/PU/CCPUScaleVelocityAffector.h b/extensions/Particle3D/PU/CCPUScaleVelocityAffector.h index 701692b10c4c..0b98c1750fb4 100644 --- a/extensions/Particle3D/PU/CCPUScaleVelocityAffector.h +++ b/extensions/Particle3D/PU/CCPUScaleVelocityAffector.h @@ -46,25 +46,25 @@ class CC_DLL PUScaleVelocityAffector : public PUAffector /** */ - PUDynamicAttribute* getDynScaleVelocity(void) const {return _dynScaleVelocity;}; + PUDynamicAttribute* getDynScaleVelocity() const {return _dynScaleVelocity;}; void setDynScaleVelocity(PUDynamicAttribute* dynScaleVelocity); void resetDynScaleVelocity(bool resetToDefault = true); /** */ - bool isSinceStartSystem(void) const {return _sinceStartSystem;}; + bool isSinceStartSystem() const {return _sinceStartSystem;}; void setSinceStartSystem(bool sinceStartSystem){_sinceStartSystem = sinceStartSystem;}; /** */ - bool isStopAtFlip(void) const {return _stopAtFlip;}; + bool isStopAtFlip() const {return _stopAtFlip;}; void setStopAtFlip(bool stopAtFlip){_stopAtFlip = stopAtFlip;}; virtual void copyAttributesTo (PUAffector* affector) override; CC_CONSTRUCTOR_ACCESS: - PUScaleVelocityAffector(void); - virtual ~PUScaleVelocityAffector(void); + PUScaleVelocityAffector(); + virtual ~PUScaleVelocityAffector(); protected: PUDynamicAttribute* _dynScaleVelocity; diff --git a/extensions/Particle3D/PU/CCPUScriptCompiler.cpp b/extensions/Particle3D/PU/CCPUScriptCompiler.cpp index c17cc1f2a42c..e06e6d75e394 100644 --- a/extensions/Particle3D/PU/CCPUScriptCompiler.cpp +++ b/extensions/Particle3D/PU/CCPUScriptCompiler.cpp @@ -185,7 +185,7 @@ PUScriptCompiler::PUScriptCompiler():_current(nullptr),_nodes(nullptr), _PUParti } PUScriptCompiler::~PUScriptCompiler() { - for (auto iter : _compiledScripts){ + for (const auto& iter : _compiledScripts){ for (auto miter : iter.second){ delete miter; } diff --git a/extensions/Particle3D/PU/CCPUScriptLexer.cpp b/extensions/Particle3D/PU/CCPUScriptLexer.cpp index 79d43cf6faf5..cdde136cae17 100644 --- a/extensions/Particle3D/PU/CCPUScriptLexer.cpp +++ b/extensions/Particle3D/PU/CCPUScriptLexer.cpp @@ -172,8 +172,10 @@ void PUScriptLexer::openLexer(const std::string &str,const std::string &source,P else { // Backtrack here and allow a backslash normally within the quote - if(lastc == backslash) - lexeme = lexeme + "\\" + c; + if(lastc == backslash) { + lexeme += '\\'; + lexeme += c; + } else lexeme += c; } diff --git a/extensions/Particle3D/PU/CCPUScriptParser.cpp b/extensions/Particle3D/PU/CCPUScriptParser.cpp index 959efb6ffd2e..6dfc56153f1c 100644 --- a/extensions/Particle3D/PU/CCPUScriptParser.cpp +++ b/extensions/Particle3D/PU/CCPUScriptParser.cpp @@ -42,7 +42,7 @@ void traceScriptParserCell(PUConcreteNodeList& nodes,int level) for(const auto& node : nodes) { printf("%s,##%d\n",node->token.c_str(),level); - if(node->children.size() != 0) + if(!node->children.empty()) { traceScriptParserCell(node->children,level+1); } diff --git a/extensions/Particle3D/PU/CCPUScriptTranslator.cpp b/extensions/Particle3D/PU/CCPUScriptTranslator.cpp index 19b0d25039f2..f91cf8843f8a 100644 --- a/extensions/Particle3D/PU/CCPUScriptTranslator.cpp +++ b/extensions/Particle3D/PU/CCPUScriptTranslator.cpp @@ -28,11 +28,605 @@ #include "extensions/Particle3D/PU/CCPUTranslateManager.h" NS_CC_BEGIN -PUScriptTranslator::PUScriptTranslator(void) + +const std::string token[1000] = +{ + // Generic + "group_mask", + "acceleration", + "max_increment", + "min_increment", + "number_of_iterations", + "colour_change", + "initial_colour", + "random_initial_colour", + "use_vertex_colours", + "use_own_rotation", + "max_deviation", + "time_step", + "box_width", + "box_height", + "box_depth", + "velocity", + "speed", + "rotation_speed", + "rotation", + "rotation_axis", + "normal", + "step", + "number_of_segments", + "max_elements", + "update_interval", + "distance_threshold", + "material", + "mesh_name", + "radius", + "enabled", + "position", + "keep_local", + "less_than", + "greater_than", + "equals", + "visual_particle", + "emitter_particle", + "affector_particle", + "technique_particle", + "system_particle", + "point", + "vertex", + "increase", + "alias", + "use_alias", + "since_start_system", + + // Particle System + "system", + "iteration_interval", + "nonvisible_update_timeout", + "fixed_timeout", + "lod_distances", + "main_camera_name", + "smooth_lod", + "fast_forward", + "scale", + "scale_velocity", + "scale_time", + "tight_bounding_box", + "category", + + // Particle Technique + "technique", + "visual_particle_quota", + "emitted_emitter_quota", + "emitted_affector_quota", + "emitted_technique_quota", + "emitted_system_quota", + "lod_index", + "default_particle_width", + "default_particle_height", + "default_particle_depth", + "spatial_hashing_cell_dimension", + "spatial_hashing_cell_overlap", + "spatial_hashtable_size", + "spatial_hashing_update_interval", + "max_velocity", + + // Particle Renderer + "renderer", + "render_queue_group", + "sorting", + "texture_coords_define", + "texture_coords_rows", + "texture_coords_set", + "texture_coords_columns", + "use_soft_particles", + "soft_particles_contrast_power", + "soft_particles_scale", + "soft_particles_delta", + + // Particle Emitter + "emitter", + "direction", + "orientation", + "range_start_orientation", + "range_end_orientation", + "start_orientation_range", + "end_orientation_range", + "duration", + "repeat_delay", + "emits", + "angle", + "emission_rate", + "time_to_live", + "mass", + "start_texture_coords", + "end_texture_coords", + "start_texture_coords_range", + "end_texture_coords_range", + "texture_coords", + "start_colour_range", + "end_colour_range", + "colour", + "all_particle_dimensions", + "particle_width", + "particle_height", + "particle_depth", + "auto_direction", + "force_emission", + + // Particle Affector + "affector", + "mass_affector", + "exclude_emitter", + "affect_specialisation", + "special_default", + "special_ttl_increase", + "special_ttl_decrease", + + // Particle Observer + "observer", + "observe_particle_type", + "observe_interval", + "observe_until_event", + + // Particle Event Handler + "handler", + + // Particle Behaviour + "behaviour", + + // Extern + "extern", + "attachable_distance_threshold", + + // Dynamic Attribute + "control_point", + "min", + "max", + "oscillate_frequency", + "oscillate_phase", + "oscillate_base", + "oscillate_amplitude", + "oscillate_type", + "dyn_oscillate", + "dyn_random", + "dyn_curved_linear", + "dyn_curved_spline", + "sine", + "square", + + // CameraDependency (unused) + "camera_dependency", + + // ------------------------- Renderers ------------------------- + // BeamRenderer + "beam_update_interval", + "beam_max_elements", + "beam_deviation", + "beam_number_segments", + "beam_jump_segments", + "beam_texcoord_direction", + "beam_vertex_colours", + "tcd_u", + "tcd_v", + + // BillboardRenderer + "billboard_type", + "billboard_origin", + "billboard_rotation_type", + "common_direction", + "common_up_vector", + "point_rendering", + "accurate_facing", + "oriented_common", + "oriented_self", + "oriented_shape", + "perpendicular_common", + "perpendicular_self", + "top_left", + "top_center", + "top_right", + "center_left", + "center_right", + "center", + "bottom_left", + "bottom_center", + "bottom_right", + "texcoord", + + // BoxRenderer: No properties itself + + // EntityRenderer + "entity_renderer_mesh_name", + "entity_orientation_type", + "ent_oriented_self", + "ent_oriented_self_mirrored", + "ent_oriented_shape", + + // LightRenderer + "light_renderer_light_type", + "light_renderer_queue_group", + "light_renderer_specular", + "light_renderer_att_range", + "light_renderer_att_constant", + "light_renderer_att_linear", + "light_renderer_att_quadratic", + "light_renderer_spot_inner", + "light_renderer_spot_outer", + "light_renderer_falloff", + "light_renderer_powerscale", + "spot", + "flash_frequency", + "flash_length", + "flash_random", + + // RibbonTrailRenderer + "ribbontrail_vertex_colours", + "ribbontrail_max_elements", + "ribbontrail_length", + "ribbontrail_width", + "ribbontrail_random_initial_colour", + "ribbontrail_initial_colour", + "ribbontrail_colour_change", + + // SphereRenderer: No properties itself + + // ------------------------- Emitters ------------------------- + // BoxEmitter + "box_em_width", + "box_em_height", + "box_em_depth", + + // CircleEmitter + "circle_em_radius", + "circle_em_step", + "circle_em_angle", + "circle_em_random", + "emit_random", + "circle_em_normal", + + // LineEmitter + "line_em_end", + "line_em_max_increment", + "line_em_min_increment", + "line_em_max_deviation", + + // MeshSurfaceEmitter + "mesh_surface_mesh_name", + "mesh_surface_distribution", + "mesh_surface_scale", + "edge", + "heterogeneous_1", + "heterogeneous_2", + "homogeneous", + + // PointEmitter: No properties itself + + // PositionEmitter + "add_position", + "random_position", + + // SlaveEmitter + "master_technique_name", + "master_emitter_name", + + // SphereSurfaceEmitter + "sphere_surface_em_radius", + + // VertexEmitter + "vertex_em_step", + "vertex_em_segments", + "vertex_em_iterations", + "vertex_em_mesh_name", + + // ------------------------- Affectors ------------------------- + // AlignAffector + "align_aff_resize", + "resize", + + // BoxCollider + "box_collider_width", + "box_collider_height", + "box_collider_depth", + + // BaseCollider + "friction", + "bouncyness", + "intersection", + "collision_friction", + "collision_bouncyness", + "collision_intersection", + "collision_type", + "bounce", + "flow", + "none", + "point", + "box", + "inner_collision", + + // CollisionAvoidanceAffector + "avoidance_radius", + + // ColourAffector + "time_colour", + "colour_aff_time_colour", + "colour_operation", + "multiply", + "set", + + // FlockCenteringAffector: No properties itself + + // BaseForceAffector + "force_vector", + "force_application", + "force_aff_vector", + "force_aff_application", + "add", + "average", + + // ForceFieldAffector + "forcefield_type", + "realtime", + "matrix", + "delta", + "force", + "octaves", + "frequency", + "amplitude", + "persistence", + "forcefield_size", + "worldsize", + "ignore_negative_x", + "ignore_negative_y", + "ignore_negative_z", + "movement", + "movement_frequency", + + // GeometryRotator + "geom_rot_use_own_rotation", + "geom_rot_rotation_speed", + "geom_rot_axis", + + // GravityAffector + "gravity", + + // InterParticleCollider + "adjustment", + "collision_response", + "ip_adjustment", + "ip_collision_response", + "average_velocity", + "angle_based_velocity", + + // JetAffector + "jet_aff_accel", + + // LineAffector + "end", + "drift", + "line_aff_max_deviation", + "line_aff_time_step", + "line_aff_end", + "line_aff_drift", + + // LinearForceAffector: No properties itself + + // ParticleFollower + "follower_max_distance", + "follower_min_distance", + "max_distance", + "min_distance", + + // PathFollower + "path_follower_point", + + // PlaneCollider + "plane_collider_normal", + + // Randomiser + "rand_aff_max_deviation_x", + "rand_aff_max_deviation_y", + "rand_aff_max_deviation_z", + "max_deviation_x", + "max_deviation_y", + "max_deviation_z", + "rand_aff_time_step", + "rand_aff_direction", + "use_direction", + + // ScaleAffector + "xyz_scale", + "x_scale", + "y_scale", + "z_scale", + + // ScaleVelocityAffector + "velocity_scale", + "stop_at_flip", + + // SineForceAffector + "sinef_aff_frequency_min", + "sinef_aff_frequency_max", + "min_frequency", + "max_frequency", + + // SphereCollider + "sphere_collider_radius", + + // TextureAnimator + "time_step_animation", + "texture_coords_start", + "texture_coords_end", + "start_texture_coords_range", + "end_texture_coords_range", + "texture_animation_type", + "texture_start_random", + "loop", + "up_down", + "random", + + // TextureRotator + "tex_rot_use_own_rotation", + "tex_rot_speed", + "tex_rot_rotation", + + // VelocityMatchingAffector + "velocity_matching_radius", + + // VortexAffector + "vortex_aff_vector", + "vortex_aff_speed", + + // ------------------------- Observers ------------------------- + // OnClearObserver: No properties itself + + // OnCollisionObserver: No properties itself + + // OnCountObserver + "count_threshold", + + // OnEmissionObserver: No properties itself + + // OnEventFlagObserver + "event_flag", + + // OnExpireObserver: No properties itself + + // OnPositionObserver + "position_x", + "position_y", + "position_z", + + // OnQuotaObserver: No properties itself + + // OnRandomObserver + "random_threshold", + + // OnTimeObserver + "on_time", + + // OnVelocityObserver + "velocity_threshold", + + // ------------------------- Event Handlers ------------------------- + // DoAffectorEventHandler + "force_affector", + "pre_post", + + // DoEnableComponentEventHandler + "enable_component", + "emitter_component", + "affector_component", + "technique_component", + "observer_component", + + // DoExpireEventHandler: No properties itself + + // DoFreezeEventHandler: No properties itself + + // DoPlacementParticleEventHandler + "force_emitter", + "number_of_particles", + "inherit_position", + "inherit_direction", + "inherit_orientation", + "inherit_time_to_live", + "inherit_mass", + "inherit_texture_coord", + "inherit_colour", + "inherit_width", + "inherit_height", + "inherit_depth", + + // DoScaleEventHandler + "scale_fraction", + "scale_type", + "st_time_to_live", + "st_velocity", + + // DoStopSystemEventHandler: No properties itself + + // ------------------------- Behaviours ------------------------- + // SlaveBehaviour: No properties itself + + // ------------------------- Externs ------------------------- + // BoxColliderExtern: Defined in BoxCollider + + // GravityExtern: Defined in GravityAffector + + // PhysXActorExtern + "physx_shape", + "physx_actor_group", + "physx_shape_group", + "physx_group_mask", + "physx_angular_velocity", + "physx_angular_damping", + "physx_material_index", + "shape", + "actor_group", + "shape_group", + "angular_velocity", + "angular_damping", + "material_index", + "Box", + "Sphere", + "Capsule", + + // PhysXFluidExtern + "rest_particles_per_meter", + "rest_density", + "kernel_radius_multiplier", + "motion_limit_multiplier", + "collision_distance_multiplier", + "packet_size_multiplier", + "stiffness", + "viscosity", + "surface_tension", + "damping", + "external_acceleration", + "restitution_for_static_shapes", + "dynamic_friction_for_static_shapes", + "static_friction_for_static_shapes", + "attraction_for_static_shapes", + "restitution_for_dynamic_shapes", + "dynamic_friction_for_dynamic_shapes", + "static_friction_for_dynamic_shapes", + "attraction_for_dynamic_shapes", + "collision_response_coefficient", + "collision_group", + "simulation_method", + "collision_method", + "flags", + "visualization", + "disable_gravity", + "collision_twoway", + "fluid_enabled", + "hardware", + "priority_mode", + "project_to_plane", + "strict_cooking_format", + "intercollision", + "no_intercollision", + "mix_intercollision", + "static", + "dynamic", + + // SceneDecoratorExtern + "scene_mesh_name", + "scene_material_name", + "scene_node_scale", + "scene_node_position", + + // SphereColliderExtern: Defined in SphereCollider + + // VortexExtern: Defined in VortexAffector +}; + +PUScriptTranslator::PUScriptTranslator() { } -PUScriptTranslator::~PUScriptTranslator(void) +PUScriptTranslator::~PUScriptTranslator() { } //------------------------------------------------------------------------- diff --git a/extensions/Particle3D/PU/CCPUScriptTranslator.h b/extensions/Particle3D/PU/CCPUScriptTranslator.h index b90c64e2ddd5..4655c4cc4b0e 100644 --- a/extensions/Particle3D/PU/CCPUScriptTranslator.h +++ b/extensions/Particle3D/PU/CCPUScriptTranslator.h @@ -589,600 +589,8 @@ enum eDefineStaticToken TOKEN_SCENE_POSITION }; -// Static tokens: Note, that the order must be the same as the enum -static const std::string token[1000] = -{ - // Generic - "group_mask", - "acceleration", - "max_increment", - "min_increment", - "number_of_iterations", - "colour_change", - "initial_colour", - "random_initial_colour", - "use_vertex_colours", - "use_own_rotation", - "max_deviation", - "time_step", - "box_width", - "box_height", - "box_depth", - "velocity", - "speed", - "rotation_speed", - "rotation", - "rotation_axis", - "normal", - "step", - "number_of_segments", - "max_elements", - "update_interval", - "distance_threshold", - "material", - "mesh_name", - "radius", - "enabled", - "position", - "keep_local", - "less_than", - "greater_than", - "equals", - "visual_particle", - "emitter_particle", - "affector_particle", - "technique_particle", - "system_particle", - "point", - "vertex", - "increase", - "alias", - "use_alias", - "since_start_system", - - // Particle System - "system", - "iteration_interval", - "nonvisible_update_timeout", - "fixed_timeout", - "lod_distances", - "main_camera_name", - "smooth_lod", - "fast_forward", - "scale", - "scale_velocity", - "scale_time", - "tight_bounding_box", - "category", - - // Particle Technique - "technique", - "visual_particle_quota", - "emitted_emitter_quota", - "emitted_affector_quota", - "emitted_technique_quota", - "emitted_system_quota", - "lod_index", - "default_particle_width", - "default_particle_height", - "default_particle_depth", - "spatial_hashing_cell_dimension", - "spatial_hashing_cell_overlap", - "spatial_hashtable_size", - "spatial_hashing_update_interval", - "max_velocity", - - // Particle Renderer - "renderer", - "render_queue_group", - "sorting", - "texture_coords_define", - "texture_coords_rows", - "texture_coords_set", - "texture_coords_columns", - "use_soft_particles", - "soft_particles_contrast_power", - "soft_particles_scale", - "soft_particles_delta", - - // Particle Emitter - "emitter", - "direction", - "orientation", - "range_start_orientation", - "range_end_orientation", - "start_orientation_range", - "end_orientation_range", - "duration", - "repeat_delay", - "emits", - "angle", - "emission_rate", - "time_to_live", - "mass", - "start_texture_coords", - "end_texture_coords", - "start_texture_coords_range", - "end_texture_coords_range", - "texture_coords", - "start_colour_range", - "end_colour_range", - "colour", - "all_particle_dimensions", - "particle_width", - "particle_height", - "particle_depth", - "auto_direction", - "force_emission", - - // Particle Affector - "affector", - "mass_affector", - "exclude_emitter", - "affect_specialisation", - "special_default", - "special_ttl_increase", - "special_ttl_decrease", - - // Particle Observer - "observer", - "observe_particle_type", - "observe_interval", - "observe_until_event", - - // Particle Event Handler - "handler", - - // Particle Behaviour - "behaviour", - - // Extern - "extern", - "attachable_distance_threshold", - - // Dynamic Attribute - "control_point", - "min", - "max", - "oscillate_frequency", - "oscillate_phase", - "oscillate_base", - "oscillate_amplitude", - "oscillate_type", - "dyn_oscillate", - "dyn_random", - "dyn_curved_linear", - "dyn_curved_spline", - "sine", - "square", - - // CameraDependency (unused) - "camera_dependency", - - // ------------------------- Renderers ------------------------- - // BeamRenderer - "beam_update_interval", - "beam_max_elements", - "beam_deviation", - "beam_number_segments", - "beam_jump_segments", - "beam_texcoord_direction", - "beam_vertex_colours", - "tcd_u", - "tcd_v", - - // BillboardRenderer - "billboard_type", - "billboard_origin", - "billboard_rotation_type", - "common_direction", - "common_up_vector", - "point_rendering", - "accurate_facing", - "oriented_common", - "oriented_self", - "oriented_shape", - "perpendicular_common", - "perpendicular_self", - "top_left", - "top_center", - "top_right", - "center_left", - "center_right", - "center", - "bottom_left", - "bottom_center", - "bottom_right", - "texcoord", - - // BoxRenderer: No properties itself - - // EntityRenderer - "entity_renderer_mesh_name", - "entity_orientation_type", - "ent_oriented_self", - "ent_oriented_self_mirrored", - "ent_oriented_shape", - - // LightRenderer - "light_renderer_light_type", - "light_renderer_queue_group", - "light_renderer_specular", - "light_renderer_att_range", - "light_renderer_att_constant", - "light_renderer_att_linear", - "light_renderer_att_quadratic", - "light_renderer_spot_inner", - "light_renderer_spot_outer", - "light_renderer_falloff", - "light_renderer_powerscale", - "spot", - "flash_frequency", - "flash_length", - "flash_random", - - // RibbonTrailRenderer - "ribbontrail_vertex_colours", - "ribbontrail_max_elements", - "ribbontrail_length", - "ribbontrail_width", - "ribbontrail_random_initial_colour", - "ribbontrail_initial_colour", - "ribbontrail_colour_change", - - // SphereRenderer: No properties itself - - // ------------------------- Emitters ------------------------- - // BoxEmitter - "box_em_width", - "box_em_height", - "box_em_depth", - - // CircleEmitter - "circle_em_radius", - "circle_em_step", - "circle_em_angle", - "circle_em_random", - "emit_random", - "circle_em_normal", - - // LineEmitter - "line_em_end", - "line_em_max_increment", - "line_em_min_increment", - "line_em_max_deviation", - - // MeshSurfaceEmitter - "mesh_surface_mesh_name", - "mesh_surface_distribution", - "mesh_surface_scale", - "edge", - "heterogeneous_1", - "heterogeneous_2", - "homogeneous", - - // PointEmitter: No properties itself - - // PositionEmitter - "add_position", - "random_position", - - // SlaveEmitter - "master_technique_name", - "master_emitter_name", - - // SphereSurfaceEmitter - "sphere_surface_em_radius", - - // VertexEmitter - "vertex_em_step", - "vertex_em_segments", - "vertex_em_iterations", - "vertex_em_mesh_name", - - // ------------------------- Affectors ------------------------- - // AlignAffector - "align_aff_resize", - "resize", - - // BoxCollider - "box_collider_width", - "box_collider_height", - "box_collider_depth", - - // BaseCollider - "friction", - "bouncyness", - "intersection", - "collision_friction", - "collision_bouncyness", - "collision_intersection", - "collision_type", - "bounce", - "flow", - "none", - "point", - "box", - "inner_collision", - - // CollisionAvoidanceAffector - "avoidance_radius", - - // ColourAffector - "time_colour", - "colour_aff_time_colour", - "colour_operation", - "multiply", - "set", - - // FlockCenteringAffector: No properties itself - - // BaseForceAffector - "force_vector", - "force_application", - "force_aff_vector", - "force_aff_application", - "add", - "average", - - // ForceFieldAffector - "forcefield_type", - "realtime", - "matrix", - "delta", - "force", - "octaves", - "frequency", - "amplitude", - "persistence", - "forcefield_size", - "worldsize", - "ignore_negative_x", - "ignore_negative_y", - "ignore_negative_z", - "movement", - "movement_frequency", - - // GeometryRotator - "geom_rot_use_own_rotation", - "geom_rot_rotation_speed", - "geom_rot_axis", - - // GravityAffector - "gravity", - - // InterParticleCollider - "adjustment", - "collision_response", - "ip_adjustment", - "ip_collision_response", - "average_velocity", - "angle_based_velocity", - - // JetAffector - "jet_aff_accel", - - // LineAffector - "end", - "drift", - "line_aff_max_deviation", - "line_aff_time_step", - "line_aff_end", - "line_aff_drift", - - // LinearForceAffector: No properties itself - - // ParticleFollower - "follower_max_distance", - "follower_min_distance", - "max_distance", - "min_distance", - - // PathFollower - "path_follower_point", - - // PlaneCollider - "plane_collider_normal", - - // Randomiser - "rand_aff_max_deviation_x", - "rand_aff_max_deviation_y", - "rand_aff_max_deviation_z", - "max_deviation_x", - "max_deviation_y", - "max_deviation_z", - "rand_aff_time_step", - "rand_aff_direction", - "use_direction", - - // ScaleAffector - "xyz_scale", - "x_scale", - "y_scale", - "z_scale", - - // ScaleVelocityAffector - "velocity_scale", - "stop_at_flip", - - // SineForceAffector - "sinef_aff_frequency_min", - "sinef_aff_frequency_max", - "min_frequency", - "max_frequency", - - // SphereCollider - "sphere_collider_radius", - - // TextureAnimator - "time_step_animation", - "texture_coords_start", - "texture_coords_end", - "start_texture_coords_range", - "end_texture_coords_range", - "texture_animation_type", - "texture_start_random", - "loop", - "up_down", - "random", - - // TextureRotator - "tex_rot_use_own_rotation", - "tex_rot_speed", - "tex_rot_rotation", - - // VelocityMatchingAffector - "velocity_matching_radius", - - // VortexAffector - "vortex_aff_vector", - "vortex_aff_speed", - - // ------------------------- Observers ------------------------- - // OnClearObserver: No properties itself - - // OnCollisionObserver: No properties itself - - // OnCountObserver - "count_threshold", - - // OnEmissionObserver: No properties itself - - // OnEventFlagObserver - "event_flag", - - // OnExpireObserver: No properties itself - - // OnPositionObserver - "position_x", - "position_y", - "position_z", - - // OnQuotaObserver: No properties itself - - // OnRandomObserver - "random_threshold", - - // OnTimeObserver - "on_time", - - // OnVelocityObserver - "velocity_threshold", - - // ------------------------- Event Handlers ------------------------- - // DoAffectorEventHandler - "force_affector", - "pre_post", - - // DoEnableComponentEventHandler - "enable_component", - "emitter_component", - "affector_component", - "technique_component", - "observer_component", - - // DoExpireEventHandler: No properties itself - - // DoFreezeEventHandler: No properties itself - - // DoPlacementParticleEventHandler - "force_emitter", - "number_of_particles", - "inherit_position", - "inherit_direction", - "inherit_orientation", - "inherit_time_to_live", - "inherit_mass", - "inherit_texture_coord", - "inherit_colour", - "inherit_width", - "inherit_height", - "inherit_depth", - - // DoScaleEventHandler - "scale_fraction", - "scale_type", - "st_time_to_live", - "st_velocity", - - // DoStopSystemEventHandler: No properties itself - - // ------------------------- Behaviours ------------------------- - // SlaveBehaviour: No properties itself - - // ------------------------- Externs ------------------------- - // BoxColliderExtern: Defined in BoxCollider - - // GravityExtern: Defined in GravityAffector - - // PhysXActorExtern - "physx_shape", - "physx_actor_group", - "physx_shape_group", - "physx_group_mask", - "physx_angular_velocity", - "physx_angular_damping", - "physx_material_index", - "shape", - "actor_group", - "shape_group", - "angular_velocity", - "angular_damping", - "material_index", - "Box", - "Sphere", - "Capsule", - - // PhysXFluidExtern - "rest_particles_per_meter", - "rest_density", - "kernel_radius_multiplier", - "motion_limit_multiplier", - "collision_distance_multiplier", - "packet_size_multiplier", - "stiffness", - "viscosity", - "surface_tension", - "damping", - "external_acceleration", - "restitution_for_static_shapes", - "dynamic_friction_for_static_shapes", - "static_friction_for_static_shapes", - "attraction_for_static_shapes", - "restitution_for_dynamic_shapes", - "dynamic_friction_for_dynamic_shapes", - "static_friction_for_dynamic_shapes", - "attraction_for_dynamic_shapes", - "collision_response_coefficient", - "collision_group", - "simulation_method", - "collision_method", - "flags", - "visualization", - "disable_gravity", - "collision_twoway", - "fluid_enabled", - "hardware", - "priority_mode", - "project_to_plane", - "strict_cooking_format", - "intercollision", - "no_intercollision", - "mix_intercollision", - "static", - "dynamic", - - // SceneDecoratorExtern - "scene_mesh_name", - "scene_material_name", - "scene_node_scale", - "scene_node_position", - - // SphereColliderExtern: Defined in SphereCollider - - // VortexExtern: Defined in VortexAffector -}; - +// tokens: Note, that the order must be the same as the enum +extern const std::string token[]; /**script translator*/ class PUScriptTranslator diff --git a/extensions/Particle3D/PU/CCPUSimpleSpline.cpp b/extensions/Particle3D/PU/CCPUSimpleSpline.cpp index 060403eb2c59..1e41893380ba 100644 --- a/extensions/Particle3D/PU/CCPUSimpleSpline.cpp +++ b/extensions/Particle3D/PU/CCPUSimpleSpline.cpp @@ -148,7 +148,7 @@ Vec3 PUSimpleSpline::interpolate(unsigned int fromIndex, float t) const } //--------------------------------------------------------------------- -void PUSimpleSpline::recalcTangents(void) +void PUSimpleSpline::recalcTangents() { // Catmull-Rom approach // @@ -226,12 +226,12 @@ const Vec3& PUSimpleSpline::getPoint(unsigned short index) const return _points[index]; } //--------------------------------------------------------------------- -unsigned short PUSimpleSpline::getNumPoints(void) const +unsigned short PUSimpleSpline::getNumPoints() const { return (unsigned short)_points.size(); } //--------------------------------------------------------------------- -void PUSimpleSpline::clear(void) +void PUSimpleSpline::clear() { _points.clear(); _tangents.clear(); diff --git a/extensions/Particle3D/PU/CCPUSimpleSpline.h b/extensions/Particle3D/PU/CCPUSimpleSpline.h index 6ca364302adb..0447681a155d 100644 --- a/extensions/Particle3D/PU/CCPUSimpleSpline.h +++ b/extensions/Particle3D/PU/CCPUSimpleSpline.h @@ -45,10 +45,10 @@ class PUSimpleSpline const Vec3& getPoint(unsigned short index) const; /** Gets the number of control points in the spline. */ - unsigned short getNumPoints(void) const; + unsigned short getNumPoints() const; /** Clears all the points in the spline. */ - void clear(void); + void clear(); /** Updates a single point in the spline. @remarks @@ -90,7 +90,7 @@ class PUSimpleSpline If you tell the spline not to update on demand by calling setAutoCalculate(false) then you must call this after completing your updates to the spline points. */ - void recalcTangents(void); + void recalcTangents(); protected: diff --git a/extensions/Particle3D/PU/CCPUSineForceAffector.cpp b/extensions/Particle3D/PU/CCPUSineForceAffector.cpp index d8ab22bc9c96..8930638db919 100644 --- a/extensions/Particle3D/PU/CCPUSineForceAffector.cpp +++ b/extensions/Particle3D/PU/CCPUSineForceAffector.cpp @@ -25,6 +25,7 @@ ****************************************************************************/ #include "CCPUSineForceAffector.h" +#include #include "extensions/Particle3D/PU/CCPUParticleSystem3D.h" NS_CC_BEGIN @@ -33,15 +34,15 @@ const float PUSineForceAffector::DEFAULT_FREQ_MIN = 1.0f; const float PUSineForceAffector::DEFAULT_FREQ_MAX = 1.0f; //----------------------------------------------------------------------- -PUSineForceAffector::PUSineForceAffector(void) : - PUBaseForceAffector(), - _angle(361), - _frequencyMin(DEFAULT_FREQ_MIN), - _frequencyMax(DEFAULT_FREQ_MAX), - _frequency(1.0f) +PUSineForceAffector::PUSineForceAffector() +: PUBaseForceAffector() +, _angle(361) +, _frequencyMin(DEFAULT_FREQ_MIN) +, _frequencyMax(DEFAULT_FREQ_MAX) +, _frequency(1.0f) { } -PUSineForceAffector::~PUSineForceAffector( void ) +PUSineForceAffector::~PUSineForceAffector() { } @@ -50,7 +51,7 @@ void PUSineForceAffector::preUpdateAffector(float deltaTime) { // Scale by time _angle += _frequency * deltaTime; - float sineValue = sin(_angle); + float sineValue = std::sin(_angle); _scaledVector = _forceVector * deltaTime * sineValue; if (_angle > M_PI * 2.0f) diff --git a/extensions/Particle3D/PU/CCPUSineForceAffector.h b/extensions/Particle3D/PU/CCPUSineForceAffector.h index 54e7bae4d32e..ea0b177f7172 100644 --- a/extensions/Particle3D/PU/CCPUSineForceAffector.h +++ b/extensions/Particle3D/PU/CCPUSineForceAffector.h @@ -58,8 +58,8 @@ class CC_DLL PUSineForceAffector : public PUBaseForceAffector virtual void copyAttributesTo (PUAffector* affector) override; CC_CONSTRUCTOR_ACCESS: - PUSineForceAffector(void); - virtual ~PUSineForceAffector(void); + PUSineForceAffector(); + virtual ~PUSineForceAffector(); protected: float _angle; diff --git a/extensions/Particle3D/PU/CCPUSlaveEmitter.cpp b/extensions/Particle3D/PU/CCPUSlaveEmitter.cpp index e928c7e4182f..d5db17c7bff1 100644 --- a/extensions/Particle3D/PU/CCPUSlaveEmitter.cpp +++ b/extensions/Particle3D/PU/CCPUSlaveEmitter.cpp @@ -30,7 +30,7 @@ NS_CC_BEGIN //----------------------------------------------------------------------- -PUSlaveEmitter::PUSlaveEmitter(void) : +PUSlaveEmitter::PUSlaveEmitter() : PUEmitter(), PUListener(), _masterParticle(0), @@ -40,7 +40,7 @@ PUSlaveEmitter::PUSlaveEmitter(void) : { } //----------------------------------------------------------------------- -const std::string& PUSlaveEmitter::getMasterTechniqueName(void) const +const std::string& PUSlaveEmitter::getMasterTechniqueName() const { return _masterTechniqueName; } @@ -50,7 +50,7 @@ void PUSlaveEmitter::setMasterTechniqueName(const std::string& masterTechniqueNa _masterTechniqueName = masterTechniqueName; } //----------------------------------------------------------------------- -const std::string& PUSlaveEmitter::getMasterEmitterName(void) const +const std::string& PUSlaveEmitter::getMasterEmitterName() const { return _masterEmitterName; } @@ -143,7 +143,7 @@ void PUSlaveEmitter::unPrepare() PUEmitter::unPrepare(); } //----------------------------------------------------------------------- -void PUSlaveEmitter::notifyStart (void) +void PUSlaveEmitter::notifyStart () { PUEmitter::notifyStart(); setEnabled(false); diff --git a/extensions/Particle3D/PU/CCPUSlaveEmitter.h b/extensions/Particle3D/PU/CCPUSlaveEmitter.h index ee3d0e55db1d..0a06debf1ae8 100644 --- a/extensions/Particle3D/PU/CCPUSlaveEmitter.h +++ b/extensions/Particle3D/PU/CCPUSlaveEmitter.h @@ -41,7 +41,7 @@ class CC_DLL PUSlaveEmitter : public PUEmitter, public PUListener /** */ - const std::string& getMasterTechniqueName(void) const; + const std::string& getMasterTechniqueName() const; /** */ @@ -49,7 +49,7 @@ class CC_DLL PUSlaveEmitter : public PUEmitter, public PUListener /** */ - const std::string& getMasterEmitterName(void) const; + const std::string& getMasterEmitterName() const; /** See ParticleEmitter. */ @@ -69,7 +69,7 @@ class CC_DLL PUSlaveEmitter : public PUEmitter, public PUListener /** See ParticleEmitter. */ - virtual void notifyStart (void) override; + virtual void notifyStart () override; /** Initialise the emitted particle. This means that its position is set. */ @@ -87,8 +87,8 @@ class CC_DLL PUSlaveEmitter : public PUEmitter, public PUListener virtual void copyAttributesTo (PUEmitter* emitter) override; CC_CONSTRUCTOR_ACCESS: - PUSlaveEmitter(void); - virtual ~PUSlaveEmitter(void){}; + PUSlaveEmitter(); + virtual ~PUSlaveEmitter(){}; protected: diff --git a/extensions/Particle3D/PU/CCPUSphere.h b/extensions/Particle3D/PU/CCPUSphere.h index 16f78d26b9bb..689c1e28d450 100644 --- a/extensions/Particle3D/PU/CCPUSphere.h +++ b/extensions/Particle3D/PU/CCPUSphere.h @@ -54,13 +54,13 @@ class PUSphere PUSphere(const Vec3& center, float radius); /** Returns the radius of the sphere. */ - float getRadius(void) const { return _radius; } + float getRadius() const { return _radius; } /** Sets the radius of the sphere. */ void setRadius(float radius) { _radius = radius; } /** Returns the center point of the sphere. */ - const Vec3& getCenter(void) const { return _center; } + const Vec3& getCenter() const { return _center; } /** Sets the center point of the sphere. */ void setCenter(const Vec3& center) { _center = center; } diff --git a/extensions/Particle3D/PU/CCPUSphereCollider.cpp b/extensions/Particle3D/PU/CCPUSphereCollider.cpp index f8f80bbff0d2..567271146995 100644 --- a/extensions/Particle3D/PU/CCPUSphereCollider.cpp +++ b/extensions/Particle3D/PU/CCPUSphereCollider.cpp @@ -32,14 +32,14 @@ NS_CC_BEGIN const float PUSphereCollider::DEFAULT_RADIUS = 100.0f; //----------------------------------------------------------------------- -PUSphereCollider::PUSphereCollider(void) : +PUSphereCollider::PUSphereCollider() : PUBaseCollider(), _radius(DEFAULT_RADIUS), _innerCollision(false) { } -PUSphereCollider::~PUSphereCollider( void ) +PUSphereCollider::~PUSphereCollider() { } @@ -56,7 +56,7 @@ void PUSphereCollider::setRadius(const float radius) _sphere.setRadius(_radius); } //----------------------------------------------------------------------- -bool PUSphereCollider::isInnerCollision(void) const +bool PUSphereCollider::isInnerCollision() const { return _innerCollision; } diff --git a/extensions/Particle3D/PU/CCPUSphereCollider.h b/extensions/Particle3D/PU/CCPUSphereCollider.h index cf0dbf1bdbf4..3ad19cd100a6 100644 --- a/extensions/Particle3D/PU/CCPUSphereCollider.h +++ b/extensions/Particle3D/PU/CCPUSphereCollider.h @@ -57,7 +57,7 @@ class CC_DLL PUSphereCollider : public PUBaseCollider @remarks If value is true, the collision is inside of the box. */ - bool isInnerCollision(void) const; + bool isInnerCollision() const; /** Set indication whether the collision is inside or outside of the box @remarks @@ -72,8 +72,8 @@ class CC_DLL PUSphereCollider : public PUBaseCollider virtual void copyAttributesTo (PUAffector* affector) override; CC_CONSTRUCTOR_ACCESS: - PUSphereCollider(void); - virtual ~PUSphereCollider(void); + PUSphereCollider(); + virtual ~PUSphereCollider(); protected: float _radius; diff --git a/extensions/Particle3D/PU/CCPUSphereSurfaceEmitter.cpp b/extensions/Particle3D/PU/CCPUSphereSurfaceEmitter.cpp index c5f557f449f6..a5c8a8659f6a 100644 --- a/extensions/Particle3D/PU/CCPUSphereSurfaceEmitter.cpp +++ b/extensions/Particle3D/PU/CCPUSphereSurfaceEmitter.cpp @@ -33,7 +33,7 @@ NS_CC_BEGIN const float PUSphereSurfaceEmitter::DEFAULT_RADIUS = 10.0f; //----------------------------------------------------------------------- -PUSphereSurfaceEmitter::PUSphereSurfaceEmitter(void) : +PUSphereSurfaceEmitter::PUSphereSurfaceEmitter() : PUEmitter(), _radius(DEFAULT_RADIUS) { diff --git a/extensions/Particle3D/PU/CCPUSphereSurfaceEmitter.h b/extensions/Particle3D/PU/CCPUSphereSurfaceEmitter.h index 619a12acba57..1cbb8a83929c 100644 --- a/extensions/Particle3D/PU/CCPUSphereSurfaceEmitter.h +++ b/extensions/Particle3D/PU/CCPUSphereSurfaceEmitter.h @@ -56,8 +56,8 @@ class CC_DLL PUSphereSurfaceEmitter : public PUEmitter virtual void copyAttributesTo (PUEmitter* emitter) override; CC_CONSTRUCTOR_ACCESS: - PUSphereSurfaceEmitter(void); - virtual ~PUSphereSurfaceEmitter(void) {}; + PUSphereSurfaceEmitter(); + virtual ~PUSphereSurfaceEmitter() {}; protected: float _radius; diff --git a/extensions/Particle3D/PU/CCPUTextureAnimator.cpp b/extensions/Particle3D/PU/CCPUTextureAnimator.cpp index bbed8d6010dc..06bd5287ac57 100644 --- a/extensions/Particle3D/PU/CCPUTextureAnimator.cpp +++ b/extensions/Particle3D/PU/CCPUTextureAnimator.cpp @@ -36,24 +36,24 @@ const PUTextureAnimator::TextureAnimationType PUTextureAnimator::DEFAULT_ANIMATI const bool PUTextureAnimator::DEFAULT_START_RANDOM = true; //----------------------------------------------------------------------- -PUTextureAnimator::PUTextureAnimator(void) : - PUAffector(), - _animationTimeStep(DEFAULT_TIME_STEP), - _animationTimeStepCount(0.0f), - _startRandom(DEFAULT_START_RANDOM), - _animationTimeStepSet(false), - _nextIndex(false), - _textureAnimationType(DEFAULT_ANIMATION_TYPE), - _textureCoordsStart(DEFAULT_TEXCOORDS_START), - _textureCoordsEnd(DEFAULT_TEXCOORDS_END) +PUTextureAnimator::PUTextureAnimator() +: PUAffector() +, _animationTimeStep(DEFAULT_TIME_STEP) +, _animationTimeStepCount(0.0f) +, _startRandom(DEFAULT_START_RANDOM) +, _animationTimeStepSet(false) +, _nextIndex(false) +, _textureAnimationType(DEFAULT_ANIMATION_TYPE) +, _textureCoordsStart(DEFAULT_TEXCOORDS_START) +, _textureCoordsEnd(DEFAULT_TEXCOORDS_END) { } //----------------------------------------------------------------------- -PUTextureAnimator::~PUTextureAnimator(void) +PUTextureAnimator::~PUTextureAnimator() { } //----------------------------------------------------------------------- -float PUTextureAnimator::getAnimationTimeStep(void) const +float PUTextureAnimator::getAnimationTimeStep() const { return _animationTimeStep; } @@ -64,7 +64,7 @@ void PUTextureAnimator::setAnimationTimeStep(float animationTimeStep) _animationTimeStepSet = true; } //----------------------------------------------------------------------- -PUTextureAnimator::TextureAnimationType PUTextureAnimator::getTextureAnimationType(void) const +PUTextureAnimator::TextureAnimationType PUTextureAnimator::getTextureAnimationType() const { return _textureAnimationType; } @@ -74,7 +74,7 @@ void PUTextureAnimator::setTextureAnimationType(PUTextureAnimator::TextureAnimat _textureAnimationType = textureAnimationType; } //----------------------------------------------------------------------- -unsigned short PUTextureAnimator::getTextureCoordsStart(void) const +unsigned short PUTextureAnimator::getTextureCoordsStart() const { return _textureCoordsStart; } @@ -84,7 +84,7 @@ void PUTextureAnimator::setTextureCoordsStart(unsigned short textureCoordsStart) _textureCoordsStart = textureCoordsStart; } //----------------------------------------------------------------------- -unsigned short PUTextureAnimator::getTextureCoordsEnd(void) const +unsigned short PUTextureAnimator::getTextureCoordsEnd() const { return _textureCoordsEnd; } @@ -94,7 +94,7 @@ void PUTextureAnimator::setTextureCoordsEnd(unsigned short textureCoordsEnd) _textureCoordsEnd = textureCoordsEnd; } //----------------------------------------------------------------------- -bool PUTextureAnimator::isStartRandom(void) const +bool PUTextureAnimator::isStartRandom() const { return _startRandom; } diff --git a/extensions/Particle3D/PU/CCPUTextureAnimator.h b/extensions/Particle3D/PU/CCPUTextureAnimator.h index 166af9061091..1361409c5dfe 100644 --- a/extensions/Particle3D/PU/CCPUTextureAnimator.h +++ b/extensions/Particle3D/PU/CCPUTextureAnimator.h @@ -57,31 +57,31 @@ class CC_DLL PUTextureAnimator : public PUAffector virtual void updatePUAffector(PUParticle3D *particle, float deltaTime) override; /** Returns the AnimationTimeStep. The AnimationTimeStep defines the time between each animation frame. */ - float getAnimationTimeStep(void) const; + float getAnimationTimeStep() const; /** Set the AnimationTimeStep */ void setAnimationTimeStep(float animationTimeStep); /** Returns the type of texture animation. */ - TextureAnimationType getTextureAnimationType(void) const; + TextureAnimationType getTextureAnimationType() const; /** Set the type of texture animation. */ void setTextureAnimationType(TextureAnimationType textureAnimationType); /** Todo */ - unsigned short getTextureCoordsStart(void) const; + unsigned short getTextureCoordsStart() const; /** Todo */ void setTextureCoordsStart(unsigned short textureCoordsStart); /** Todo */ - unsigned short getTextureCoordsEnd(void) const; + unsigned short getTextureCoordsEnd() const; /** Todo */ void setTextureCoordsEnd(unsigned short textureCoordsEnd); /** Todo */ - bool isStartRandom(void) const; + bool isStartRandom() const; /** Todo */ void setStartRandom(bool startRandom); @@ -89,8 +89,8 @@ class CC_DLL PUTextureAnimator : public PUAffector virtual void copyAttributesTo (PUAffector* affector) override; CC_CONSTRUCTOR_ACCESS: - PUTextureAnimator(void); - virtual ~PUTextureAnimator(void); + PUTextureAnimator(); + virtual ~PUTextureAnimator(); protected: diff --git a/extensions/Particle3D/PU/CCPUTextureRotator.cpp b/extensions/Particle3D/PU/CCPUTextureRotator.cpp index e913609284bd..54eaf12e69d6 100644 --- a/extensions/Particle3D/PU/CCPUTextureRotator.cpp +++ b/extensions/Particle3D/PU/CCPUTextureRotator.cpp @@ -34,11 +34,11 @@ const float PUTextureRotator::DEFAULT_ROTATION_SPEED = 10.0f; const float PUTextureRotator::DEFAULT_ROTATION = 0.0f; //----------------------------------------------------------------------- -PUTextureRotator::PUTextureRotator(void) : - PUAffector(), - _useOwnRotationSpeed(DEFAULT_USE_OWN_SPEED), - _scaledRotationSpeed(0.0f), - _twoPiRad(float(2.0 * M_PI)) +PUTextureRotator::PUTextureRotator() +: PUAffector() +, _useOwnRotationSpeed(DEFAULT_USE_OWN_SPEED) +, _scaledRotationSpeed(0.0f) +, _twoPiRad(float(2.0 * M_PI)) { _dynRotation = new (std::nothrow) PUDynamicAttributeFixed(); (static_cast(_dynRotation))->setValue(DEFAULT_ROTATION); @@ -46,7 +46,7 @@ PUTextureRotator::PUTextureRotator(void) : (static_cast(_dynRotationSpeed))->setValue(DEFAULT_ROTATION_SPEED); } //----------------------------------------------------------------------- -PUTextureRotator::~PUTextureRotator(void) +PUTextureRotator::~PUTextureRotator() { if (_dynRotation) { @@ -59,7 +59,7 @@ PUTextureRotator::~PUTextureRotator(void) } } //----------------------------------------------------------------------- -bool PUTextureRotator::useOwnRotationSpeed (void) const +bool PUTextureRotator::useOwnRotationSpeed () const { return _useOwnRotationSpeed; } @@ -69,7 +69,7 @@ void PUTextureRotator::setUseOwnRotationSpeed (bool useOwnRotationSpeed) _useOwnRotationSpeed = useOwnRotationSpeed; } //----------------------------------------------------------------------- -PUDynamicAttribute* PUTextureRotator::getRotation(void) const +PUDynamicAttribute* PUTextureRotator::getRotation() const { return _dynRotation; } @@ -82,7 +82,7 @@ void PUTextureRotator::setRotation(PUDynamicAttribute* dynRotation) _dynRotation = dynRotation; } //----------------------------------------------------------------------- -PUDynamicAttribute* PUTextureRotator::getRotationSpeed(void) const +PUDynamicAttribute* PUTextureRotator::getRotationSpeed() const { return _dynRotationSpeed; } @@ -95,7 +95,7 @@ void PUTextureRotator::setRotationSpeed(PUDynamicAttribute* dynRotationSpeed) _dynRotationSpeed = dynRotationSpeed; } //----------------------------------------------------------------------- -float PUTextureRotator::calculateRotation(void) +float PUTextureRotator::calculateRotation() { return _dynamicAttributeHelper.calculate(_dynRotation, (static_cast(_particleSystem))->getTimeElapsedSinceStart()); } diff --git a/extensions/Particle3D/PU/CCPUTextureRotator.h b/extensions/Particle3D/PU/CCPUTextureRotator.h index 6d3538264546..b72816fcb50f 100644 --- a/extensions/Particle3D/PU/CCPUTextureRotator.h +++ b/extensions/Particle3D/PU/CCPUTextureRotator.h @@ -49,7 +49,7 @@ class CC_DLL PUTextureRotator : public PUAffector /** Returns an indication whether the 2D rotation speed is the same for all particles in this particle technique, or whether the 2D rotation speed of the particle itself is used. */ - bool useOwnRotationSpeed (void) const; + bool useOwnRotationSpeed () const; /** Set the indication whether the 2D rotation speed of the particle itself is used. */ @@ -57,7 +57,7 @@ class CC_DLL PUTextureRotator : public PUAffector /** Returns the rotation speed. This is the speed controlled by the affector. */ - PUDynamicAttribute* getRotationSpeed(void) const; + PUDynamicAttribute* getRotationSpeed() const; /** */ @@ -65,7 +65,7 @@ class CC_DLL PUTextureRotator : public PUAffector /** Returns the rotation defined in the affector. */ - PUDynamicAttribute* getRotation(void) const; + PUDynamicAttribute* getRotation() const; /** */ @@ -73,7 +73,7 @@ class CC_DLL PUTextureRotator : public PUAffector /** Returns a rotation set in the affector, depending on the type of dynamic attribute. */ - float calculateRotation (void); + float calculateRotation (); /** Returns a rotation speed value, depending on the type of dynamic attribute. */ @@ -85,8 +85,8 @@ class CC_DLL PUTextureRotator : public PUAffector virtual void copyAttributesTo (PUAffector* affector) override; CC_CONSTRUCTOR_ACCESS: - PUTextureRotator(void); - virtual ~PUTextureRotator(void); + PUTextureRotator(); + virtual ~PUTextureRotator(); protected: bool _useOwnRotationSpeed; diff --git a/extensions/Particle3D/PU/CCPUTranslateManager.h b/extensions/Particle3D/PU/CCPUTranslateManager.h index 15da72cf99b9..15ca76f631db 100644 --- a/extensions/Particle3D/PU/CCPUTranslateManager.h +++ b/extensions/Particle3D/PU/CCPUTranslateManager.h @@ -66,7 +66,7 @@ class PUTranslateManager static PUTranslateManager* Instance(); /** */ - //virtual size_t getNumTranslators(void) const; + //virtual size_t getNumTranslators() const; /** */ diff --git a/extensions/Particle3D/PU/CCPUVelocityMatchingAffector.cpp b/extensions/Particle3D/PU/CCPUVelocityMatchingAffector.cpp index 0c86bf0d3467..0d507e4ba27a 100644 --- a/extensions/Particle3D/PU/CCPUVelocityMatchingAffector.cpp +++ b/extensions/Particle3D/PU/CCPUVelocityMatchingAffector.cpp @@ -32,19 +32,19 @@ NS_CC_BEGIN const float PUVelocityMatchingAffector::DEFAULT_RADIUS = 100.0f; //----------------------------------------------------------------------- -PUVelocityMatchingAffector::PUVelocityMatchingAffector(void) : - PUAffector(), - _radius(DEFAULT_RADIUS) +PUVelocityMatchingAffector::PUVelocityMatchingAffector() +: PUAffector() +, _radius(DEFAULT_RADIUS) { } -PUVelocityMatchingAffector::~PUVelocityMatchingAffector( void ) +PUVelocityMatchingAffector::~PUVelocityMatchingAffector() { } //----------------------------------------------------------------------- -float PUVelocityMatchingAffector::getRadius(void) const +float PUVelocityMatchingAffector::getRadius() const { return _radius; } diff --git a/extensions/Particle3D/PU/CCPUVelocityMatchingAffector.h b/extensions/Particle3D/PU/CCPUVelocityMatchingAffector.h index 7f64c9d9b666..4d0d0ac09857 100644 --- a/extensions/Particle3D/PU/CCPUVelocityMatchingAffector.h +++ b/extensions/Particle3D/PU/CCPUVelocityMatchingAffector.h @@ -44,7 +44,7 @@ class CC_DLL PUVelocityMatchingAffector : public PUAffector virtual void updatePUAffector(PUParticle3D *particle, float deltaTime) override; /** Todo */ - float getRadius(void) const; + float getRadius() const; /** Todo */ @@ -59,8 +59,8 @@ class CC_DLL PUVelocityMatchingAffector : public PUAffector //virtual void _unprepare(ParticleTechnique* particleTechnique); CC_CONSTRUCTOR_ACCESS: - PUVelocityMatchingAffector(void); - virtual ~PUVelocityMatchingAffector(void); + PUVelocityMatchingAffector(); + virtual ~PUVelocityMatchingAffector(); protected: float _radius; diff --git a/extensions/Particle3D/PU/CCPUVertexEmitter.cpp b/extensions/Particle3D/PU/CCPUVertexEmitter.cpp index 8eb022566b33..e3140cb548a7 100644 --- a/extensions/Particle3D/PU/CCPUVertexEmitter.cpp +++ b/extensions/Particle3D/PU/CCPUVertexEmitter.cpp @@ -34,7 +34,7 @@ NS_CC_BEGIN //const unsigned short Particle3DVertexEmitter::DEFAULT_ITERATIONS = 1; // ////----------------------------------------------------------------------- -//Particle3DVertexEmitter::Particle3DVertexEmitter(void) : ParticleEmitter(), +//Particle3DVertexEmitter::Particle3DVertexEmitter() : ParticleEmitter(), // mPositionElement(0), // mVertexData(0), // mVertexBuffer(0), @@ -54,7 +54,7 @@ NS_CC_BEGIN // mBuffer.setNull(); //} ////----------------------------------------------------------------------- -//unsigned short Particle3DVertexEmitter::getIterations(void) const +//unsigned short Particle3DVertexEmitter::getIterations() const //{ // return mIterations; //} @@ -64,7 +64,7 @@ NS_CC_BEGIN // mIterations = iterations; //} ////----------------------------------------------------------------------- -//unsigned short Particle3DVertexEmitter::getSegments(void) const +//unsigned short Particle3DVertexEmitter::getSegments() const //{ // return mSegments; //} @@ -74,7 +74,7 @@ NS_CC_BEGIN // mSegments = segments; //} ////----------------------------------------------------------------------- -//unsigned short Particle3DVertexEmitter::getStep(void) const +//unsigned short Particle3DVertexEmitter::getStep() const //{ // return mStep; //} @@ -84,7 +84,7 @@ NS_CC_BEGIN // mStep = step; //} ////----------------------------------------------------------------------- -//const std::string& Particle3DVertexEmitter::getMeshName(void) const +//const std::string& Particle3DVertexEmitter::getMeshName() const //{ // return mMeshName; //} @@ -95,7 +95,7 @@ NS_CC_BEGIN // mMeshName = meshName; //} ////----------------------------------------------------------------------- -//void Particle3DVertexEmitter::_notifyStart (void) +//void Particle3DVertexEmitter::_notifyStart () //{ // ParticleEmitter::_notifyStart(); // _setDefaults(); @@ -155,7 +155,7 @@ NS_CC_BEGIN // getDerivedPosition(); //} ////----------------------------------------------------------------------- -//void Particle3DVertexEmitter::_setDefaults(void) +//void Particle3DVertexEmitter::_setDefaults() //{ // // Set the default values except the name of the mesh, which may only be changed by the // // setMeshName() function @@ -181,7 +181,7 @@ NS_CC_BEGIN // } //} ////----------------------------------------------------------------------- -//void Particle3DVertexEmitter::_loadMesh (void) +//void Particle3DVertexEmitter::_loadMesh () //{ // Ogre::MeshPtr mesh = Ogre::MeshManager::getSingleton().load(mMeshName, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); // mMesh = mesh.getPointer(); @@ -197,7 +197,7 @@ NS_CC_BEGIN // } //} ////----------------------------------------------------------------------- -//void Particle3DVertexEmitter::_generatePoints (void) +//void Particle3DVertexEmitter::_generatePoints () //{ // if (mAllVerticesProcessed) // { @@ -244,7 +244,7 @@ NS_CC_BEGIN // } //} ////----------------------------------------------------------------------- -//void Particle3DVertexEmitter::_generatePointsFromMesh (void) +//void Particle3DVertexEmitter::_generatePointsFromMesh () //{ // if (mMaxVertexCount == 0 && mMesh) // { @@ -264,7 +264,7 @@ NS_CC_BEGIN // } //} ////----------------------------------------------------------------------- -//void Particle3DVertexEmitter::_generatePointsFromSubMesh (void) +//void Particle3DVertexEmitter::_generatePointsFromSubMesh () //{ // if (mMaxVertexCount == 0 && mSubMesh) // { @@ -279,7 +279,7 @@ NS_CC_BEGIN // _generatePointsFromVertexBuffer(); //} ////----------------------------------------------------------------------- -//void Particle3DVertexEmitter::_fillVertexBuffer(void) +//void Particle3DVertexEmitter::_fillVertexBuffer() //{ // mVertexCount = 0; // mMaxVertexCount = mVertexData->vertexCount - mStep; @@ -289,7 +289,7 @@ NS_CC_BEGIN // mVertexBuffer = static_cast(mBuffer->lock(Ogre::HardwareBuffer::HBL_READ_ONLY)); //} ////----------------------------------------------------------------------- -//void Particle3DVertexEmitter::_generatePointsFromVertexBuffer(void) +//void Particle3DVertexEmitter::_generatePointsFromVertexBuffer() //{ // if (mMaxVertexCount > 1) // { diff --git a/extensions/Particle3D/PU/CCPUVertexEmitter.h b/extensions/Particle3D/PU/CCPUVertexEmitter.h index 1340a9c76bb4..c2beb87dc87f 100644 --- a/extensions/Particle3D/PU/CCPUVertexEmitter.h +++ b/extensions/Particle3D/PU/CCPUVertexEmitter.h @@ -79,34 +79,34 @@ NS_CC_BEGIN // // /** // */ -// void _setDefaults(void); +// void _setDefaults(); // // /** // */ -// void _loadMesh (void); +// void _loadMesh (); // // /** Generate spawn points from a mesh. The points will not be generated all at once, but // gradually. In each call, the points on an edge are generated, until all vertices // have been processed. In that case, mAllVerticesProcessed is set to true and this // function stops further processing. // */ -// void _generatePoints (void); +// void _generatePoints (); // // /** // */ -// void _generatePointsFromMesh (void); +// void _generatePointsFromMesh (); // // /** // */ -// void _generatePointsFromSubMesh (void); +// void _generatePointsFromSubMesh (); // // /** // */ -// void _fillVertexBuffer(void); +// void _fillVertexBuffer(); // // /** // */ -// void _generatePointsFromVertexBuffer(void); +// void _generatePointsFromVertexBuffer(); // // /** // */ @@ -120,12 +120,12 @@ NS_CC_BEGIN // static const unsigned short DEFAULT_SEGMENTS; // static const unsigned short DEFAULT_ITERATIONS; // -// Particle3DVertexEmitter(void); -// virtual ~Particle3DVertexEmitter(void) {}; +// Particle3DVertexEmitter(); +// virtual ~Particle3DVertexEmitter() {}; // // /** // */ -// unsigned short getIterations(void) const; +// unsigned short getIterations() const; // // /** // */ @@ -133,7 +133,7 @@ NS_CC_BEGIN // // /** // */ -// unsigned short getSegments(void) const; +// unsigned short getSegments() const; // // /** // */ @@ -141,7 +141,7 @@ NS_CC_BEGIN // // /** // */ -// unsigned short getStep(void) const; +// unsigned short getStep() const; // // /** // */ @@ -149,11 +149,11 @@ NS_CC_BEGIN // // /** // */ -// const std::string& getMeshName(void) const; +// const std::string& getMeshName() const; // // /** // */ -// virtual void _notifyStart (void); +// virtual void _notifyStart (); // // /** // */ diff --git a/extensions/Particle3D/PU/CCPUVortexAffector.cpp b/extensions/Particle3D/PU/CCPUVortexAffector.cpp index 9b42981f229f..a7b31a0ab6d9 100644 --- a/extensions/Particle3D/PU/CCPUVortexAffector.cpp +++ b/extensions/Particle3D/PU/CCPUVortexAffector.cpp @@ -34,15 +34,15 @@ const Vec3 PUVortexAffector::DEFAULT_ROTATION_VECTOR(0, 0, 0); const float PUVortexAffector::DEFAULT_ROTATION_SPEED = 1.0f; //----------------------------------------------------------------------- -PUVortexAffector::PUVortexAffector(void) : - PUAffector(), - _rotationVector(DEFAULT_ROTATION_VECTOR) +PUVortexAffector::PUVortexAffector() +: PUAffector() +, _rotationVector(DEFAULT_ROTATION_VECTOR) { _dynRotationSpeed = new (std::nothrow) PUDynamicAttributeFixed(); (static_cast(_dynRotationSpeed))->setValue(DEFAULT_ROTATION_SPEED); } //----------------------------------------------------------------------- -PUVortexAffector::~PUVortexAffector(void) +PUVortexAffector::~PUVortexAffector() { if (_dynRotationSpeed) { @@ -50,7 +50,7 @@ PUVortexAffector::~PUVortexAffector(void) } } //----------------------------------------------------------------------- -const Vec3& PUVortexAffector::getRotationVector(void) const +const Vec3& PUVortexAffector::getRotationVector() const { return _rotationVector; } @@ -60,7 +60,7 @@ void PUVortexAffector::setRotationVector(const Vec3& rotationVector) _rotationVector = rotationVector; } //----------------------------------------------------------------------- -PUDynamicAttribute* PUVortexAffector::getRotationSpeed(void) const +PUDynamicAttribute* PUVortexAffector::getRotationSpeed() const { return _dynRotationSpeed; } @@ -73,7 +73,7 @@ void PUVortexAffector::setRotationSpeed(PUDynamicAttribute* dynRotationSpeed) _dynRotationSpeed = dynRotationSpeed; } //----------------------------------------------------------------------- -float PUVortexAffector::calculateRotationSpeed(void) +float PUVortexAffector::calculateRotationSpeed() { return float(_dynamicAttributeHelper.calculate(_dynRotationSpeed, (static_cast(_particleSystem))->getTimeElapsedSinceStart())); } diff --git a/extensions/Particle3D/PU/CCPUVortexAffector.h b/extensions/Particle3D/PU/CCPUVortexAffector.h index 52939b81cdbc..9d904f9479f5 100644 --- a/extensions/Particle3D/PU/CCPUVortexAffector.h +++ b/extensions/Particle3D/PU/CCPUVortexAffector.h @@ -47,7 +47,7 @@ class CC_DLL PUVortexAffector : public PUAffector virtual void updatePUAffector(PUParticle3D *particle, float deltaTime) override; /** */ - const Vec3& getRotationVector(void) const; + const Vec3& getRotationVector() const; /** */ @@ -55,7 +55,7 @@ class CC_DLL PUVortexAffector : public PUAffector /** */ - PUDynamicAttribute* getRotationSpeed(void) const; + PUDynamicAttribute* getRotationSpeed() const; /** */ @@ -64,14 +64,14 @@ class CC_DLL PUVortexAffector : public PUAffector virtual void copyAttributesTo (PUAffector* affector) override; CC_CONSTRUCTOR_ACCESS: - PUVortexAffector(void); - virtual ~PUVortexAffector(void); + PUVortexAffector(); + virtual ~PUVortexAffector(); protected: /** */ - float calculateRotationSpeed(void); + float calculateRotationSpeed(); protected: Vec3 _rotationVector; @@ -81,4 +81,4 @@ class CC_DLL PUVortexAffector : public PUAffector }; NS_CC_END -#endif \ No newline at end of file +#endif diff --git a/extensions/assets-manager/AssetsManager.cpp b/extensions/assets-manager/AssetsManager.cpp index c8c4468ee791..254b513d9556 100644 --- a/extensions/assets-manager/AssetsManager.cpp +++ b/extensions/assets-manager/AssetsManager.cpp @@ -38,7 +38,7 @@ #include "unzip.h" #endif -NS_CC_EXT_BEGIN; +NS_CC_EXT_BEGIN using namespace std; using namespace cocos2d; @@ -168,7 +168,7 @@ AssetsManager::~AssetsManager() void AssetsManager::checkStoragePath() { - if (_storagePath.size() > 0 && _storagePath[_storagePath.size() - 1] != '/') + if (!_storagePath.empty() && _storagePath[_storagePath.size() - 1] != '/') { _storagePath.append("/"); } @@ -196,7 +196,7 @@ std::string AssetsManager::keyOfDownloadedVersion() const bool AssetsManager::checkUpdate() { - if (_versionFileUrl.size() == 0 || _isDownloading) return false; + if (_versionFileUrl.empty() || _isDownloading) return false; // Clear _version before assign new value. _version.clear(); @@ -226,7 +226,7 @@ void AssetsManager::downloadAndUncompress() Director::getInstance()->getScheduler()->performFunctionInCocosThread([&, this] { // Record new version code. - UserDefault::getInstance()->setStringForKey(this->keyOfVersion().c_str(), this->_version.c_str()); + UserDefault::getInstance()->setStringForKey(this->keyOfVersion().c_str(), this->_version); // Unrecord downloaded version code. UserDefault::getInstance()->setStringForKey(this->keyOfDownloadedVersion().c_str(), ""); @@ -328,7 +328,7 @@ bool AssetsManager::uncompress() size_t startIndex=0; - size_t index=fileNameStr.find("/",startIndex); + size_t index=fileNameStr.find('/',startIndex); while(index != std::string::npos) { @@ -356,7 +356,7 @@ bool AssetsManager::uncompress() startIndex=index+1; - index=fileNameStr.find("/",startIndex); + index=fileNameStr.find('/',startIndex); } @@ -513,4 +513,4 @@ AssetsManager* AssetsManager::create(const char* packageUrl, const char* version return manager; } -NS_CC_EXT_END; +NS_CC_EXT_END diff --git a/extensions/assets-manager/AssetsManager.h b/extensions/assets-manager/AssetsManager.h index 3f59dfb57742..7fd6a4412748 100644 --- a/extensions/assets-manager/AssetsManager.h +++ b/extensions/assets-manager/AssetsManager.h @@ -91,7 +91,7 @@ class CC_EX_DLL AssetsManager : public Node typedef std::function ErrorCallback; typedef std::function ProgressCallback; - typedef std::function SuccessCallback; + typedef std::function SuccessCallback; /* @brief To access within scripting environment */ @@ -205,7 +205,7 @@ class AssetsManagerDelegateProtocol * @js NA * @lua NA */ - virtual void onError(AssetsManager::ErrorCode errorCode) {}; + virtual void onError(AssetsManager::ErrorCode errorCode) {} /** @brief Call back function for recording downloading percent @param percent How much percent downloaded @warning This call back function just for recording downloading percent. @@ -214,18 +214,18 @@ class AssetsManagerDelegateProtocol * @js NA * @lua NA */ - virtual void onProgress(int percent) {}; + virtual void onProgress(int percent) {} /** @brief Call back function for success * @js NA * @lua NA */ - virtual void onSuccess() {}; + virtual void onSuccess() {} }; // Deprecated declaration CC_DEPRECATED_ATTRIBUTE typedef AssetsManager CCAssetsManager; CC_DEPRECATED_ATTRIBUTE typedef AssetsManagerDelegateProtocol CCAssetsManagerDelegateProtocol; -NS_CC_EXT_END; +NS_CC_EXT_END #endif /* defined(__AssetsManager__) */ diff --git a/extensions/assets-manager/AssetsManagerEx.cpp b/extensions/assets-manager/AssetsManagerEx.cpp index 381686bace6a..a29f7573b24d 100644 --- a/extensions/assets-manager/AssetsManagerEx.cpp +++ b/extensions/assets-manager/AssetsManagerEx.cpp @@ -38,7 +38,7 @@ NS_CC_EXT_BEGIN -#define TEMP_PACKAGE_SUFFIX "_temp" +#define TEMP_FOLDERNAME "_temp" #define VERSION_FILENAME "version.manifest" #define TEMP_MANIFEST_FILENAME "project.manifest.temp" #define MANIFEST_FILENAME "project.manifest" @@ -224,7 +224,7 @@ void AssetsManagerEx::loadLocalManifest(const std::string& /*manifestUrl*/) { std::vector cacheSearchPaths = cachedManifest->getSearchPaths(); std::vector trimmedPaths = searchPaths; - for (auto path : cacheSearchPaths) + for (const auto& path : cacheSearchPaths) { const auto pos = std::find(trimmedPaths.begin(), trimmedPaths.end(), path); if (pos != trimmedPaths.end()) @@ -314,13 +314,14 @@ void AssetsManagerEx::setStoragePath(const std::string& storagePath) _fileUtils->createDirectory(_storagePath); _tempStoragePath = _storagePath; - _tempStoragePath.insert(_storagePath.size() - 1, TEMP_PACKAGE_SUFFIX); + _tempStoragePath.append(TEMP_FOLDERNAME); + adjustPath(_tempStoragePath); _fileUtils->createDirectory(_tempStoragePath); } void AssetsManagerEx::adjustPath(std::string &path) { - if (path.size() > 0 && path[path.size() - 1] != '/') + if (!path.empty() && path[path.size() - 1] != '/') { path.append("/"); } @@ -548,7 +549,7 @@ void AssetsManagerEx::downloadVersion() std::string versionUrl = _localManifest->getVersionFileUrl(); - if (versionUrl.size() > 0) + if (!versionUrl.empty()) { _updateState = State::DOWNLOADING_VERSION; // Download version file asynchronously @@ -616,7 +617,7 @@ void AssetsManagerEx::downloadManifest() manifestUrl = _localManifest->getManifestFileUrl(); } - if (manifestUrl.size() > 0) + if (!manifestUrl.empty()) { _updateState = State::DOWNLOADING_MANIFEST; // Download version file asynchronously @@ -710,7 +711,7 @@ void AssetsManagerEx::startUpdate() // Check difference between local manifest and remote manifest std::unordered_map diff_map = _localManifest->genDiff(_remoteManifest); - if (diff_map.size() == 0) + if (diff_map.empty()) { updateSucceed(); } @@ -989,7 +990,7 @@ void AssetsManagerEx::fileSuccess(const std::string &customId, const std::string // Reduce count only when unit found in _downloadUnits _totalWaitToDownload--; - _percentByFile = 100 * (float)(_totalToDownload - _totalWaitToDownload) / _totalToDownload; + _percent = _percentByFile = 100 * (float)(_totalToDownload - _totalWaitToDownload) / _totalToDownload; // Notify progression event dispatchUpdateEvent(EventAssetsManagerEx::EventCode::UPDATE_PROGRESSION, ""); } @@ -1133,7 +1134,7 @@ void AssetsManagerEx::destroyDownloadedVersion() void AssetsManagerEx::batchDownload() { _queue.clear(); - for(auto iter : _downloadUnits) + for(const auto& iter : _downloadUnits) { const DownloadUnit& unit = iter.second; if (unit.size > 0) @@ -1161,7 +1162,7 @@ void AssetsManagerEx::queueDowload() return; } - while (_currConcurrentTask < _maxConcurrentTask && _queue.size() > 0) + while (_currConcurrentTask < _maxConcurrentTask && !_queue.empty()) { std::string key = _queue.back(); _queue.pop_back(); @@ -1184,7 +1185,7 @@ void AssetsManagerEx::queueDowload() void AssetsManagerEx::onDownloadUnitsFinished() { // Finished with error check - if (_failedUnits.size() > 0) + if (!_failedUnits.empty()) { // Save current download manifest information for resuming _tempManifest->saveToFile(_tempManifestPath); diff --git a/extensions/assets-manager/Manifest.cpp b/extensions/assets-manager/Manifest.cpp index b91779dd546c..3ea6573fd3e6 100644 --- a/extensions/assets-manager/Manifest.cpp +++ b/extensions/assets-manager/Manifest.cpp @@ -82,7 +82,7 @@ Manifest::Manifest(const std::string& manifestUrl/* = ""*/) { // Init variables _fileUtils = FileUtils::getInstance(); - if (manifestUrl.size() > 0) + if (!manifestUrl.empty()) parse(manifestUrl); } @@ -95,7 +95,7 @@ void Manifest::loadJson(const std::string& url) // Load file content content = _fileUtils->getStringFromFile(url); - if (content.size() == 0) + if (content.empty()) { CCLOG("Fail to retrieve local file content: %s\n", url.c_str()); } @@ -183,7 +183,7 @@ bool Manifest::versionEquals(const Manifest *b) const bool Manifest::versionGreater(const Manifest *b, const std::function& handle) const { std::string localVersion = getVersion(); - std::string bVersion = b->getVersion(); + const std::string& bVersion = b->getVersion(); bool greater; if (handle) { @@ -275,7 +275,7 @@ std::vector Manifest::getSearchPaths() const for (int i = (int)_searchPaths.size()-1; i >= 0; i--) { std::string path = _searchPaths[i]; - if (path.size() > 0 && path[path.size() - 1] != '/') + if (!path.empty() && path[path.size() - 1] != '/') path.append("/"); path = _manifestRoot + path; searchPaths.push_back(path); @@ -297,7 +297,7 @@ void Manifest::prependSearchPaths() for (int i = (int)_searchPaths.size()-1; i >= 0; i--) { std::string path = _searchPaths[i]; - if (path.size() > 0 && path[path.size() - 1] != '/') + if (!path.empty() && path[path.size() - 1] != '/') path.append("/"); path = _manifestRoot + path; iter = searchPaths.begin(); @@ -502,7 +502,7 @@ void Manifest::loadManifest(const rapidjson::Document &json) { _packageUrl = json[KEY_PACKAGE_URL].GetString(); // Append automatically "/" - if (_packageUrl.size() > 0 && _packageUrl[_packageUrl.size() - 1] != '/') + if (!_packageUrl.empty() && _packageUrl[_packageUrl.size() - 1] != '/') { _packageUrl.append("/"); } @@ -532,7 +532,7 @@ void Manifest::loadManifest(const rapidjson::Document &json) for (rapidjson::SizeType i = 0; i < paths.Size(); ++i) { if (paths[i].IsString()) { - _searchPaths.push_back(paths[i].GetString()); + _searchPaths.emplace_back(paths[i].GetString()); } } } diff --git a/external/config.json b/external/config.json index 397689bc81d4..3814299ca8a0 100644 --- a/external/config.json +++ b/external/config.json @@ -1,6 +1,6 @@ { - "version": "v3-deps-145", - "zip_file_size": "146254799", + "version": "v3-deps-172", + "zip_file_size": "141133955", "repo_name": "cocos2d-x-3rd-party-libs-bin", "repo_parent": "https://github.com/cocos2d/", "move_dirs": { diff --git a/templates/cocos2dx_files.json b/templates/cocos2dx_files.json index 2942d19e6a68..8789aa6b0e79 100644 --- a/templates/cocos2dx_files.json +++ b/templates/cocos2dx_files.json @@ -1,6 +1,7 @@ { "common": [ ".appveyor.yml", + ".clang-tidy", "AUTHORS", "CHANGELOG", "CMakeLists.txt", @@ -13,9 +14,8 @@ "build/install-deps-linux.sh", "cmake/Modules/CocosBuildHelpers.cmake", "cmake/Modules/CocosBuildSet.cmake", - "cmake/Modules/CocosCompileOptions.cmake", + "cmake/Modules/CocosConfigDefine.cmake", "cmake/Modules/CocosConfigDepend.cmake", - "cmake/Modules/CocosSelectModule.cmake", "cmake/Modules/FindChipmunk.cmake", "cmake/Modules/FindFMOD.cmake", "cmake/Modules/FindFontconfig.cmake", @@ -32,6 +32,7 @@ "cmake/Modules/FindWebP.cmake", "cmake/Modules/Findflatbuffers.cmake", "cmake/Modules/Findxxhash.cmake", + "cmake/Modules/PreventInSourceBuilds.cmake", "cmake/Modules/iOSBundleInfo.plist.in", "cmake/README.md", "cmake/ios.toolchain.cmake", @@ -973,6 +974,8 @@ "cocos/platform/CCApplication.h", "cocos/platform/CCApplicationProtocol.h", "cocos/platform/CCCommon.h", + "cocos/platform/CCDataManager.cpp", + "cocos/platform/CCDataManager.h", "cocos/platform/CCDevice.h", "cocos/platform/CCFileUtils.cpp", "cocos/platform/CCFileUtils.h", @@ -1033,10 +1036,10 @@ "cocos/platform/android/java/ant.properties", "cocos/platform/android/java/build.xml", "cocos/platform/android/java/libs/", - "cocos/platform/android/java/libs/EngineDataManager.jar", "cocos/platform/android/java/libs/android-async-http-1.4.9.jar", "cocos/platform/android/java/libs/com.android.vending.expansion.zipfile.jar", "cocos/platform/android/java/libs/httpclient-4.4.1.1.jar", + "cocos/platform/android/java/libs/oppoSDK.jar", "cocos/platform/android/java/lint.xml", "cocos/platform/android/java/proguard-project.txt", "cocos/platform/android/java/project.properties", @@ -1045,10 +1048,10 @@ "cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxActivity.java", "cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxAudioFocusManager.java", "cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxBitmap.java", + "cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxDataManager.java", "cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxDownloader.java", "cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxEditBox.java", "cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxEditBoxHelper.java", - "cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxEngineDataManager.java", "cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxGLSurfaceView.java", "cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxHandler.java", "cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxHelper.java", @@ -1074,15 +1077,11 @@ "cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxAccelerometer.cpp", "cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxBitmap.cpp", "cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxBitmap.h", - "cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxEngineDataManager.cpp", - "cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxEngineDataManager.h", "cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.cpp", "cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.h", "cocos/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxRenderer.cpp", "cocos/platform/android/jni/JniHelper.cpp", "cocos/platform/android/jni/JniHelper.h", - "cocos/platform/android/jni/ProcessCpuTracker.cpp", - "cocos/platform/android/jni/ProcessCpuTracker.h", "cocos/platform/android/jni/TouchesJni.cpp", "cocos/platform/android/libcocos2dx-with-controller/AndroidManifest.xml", "cocos/platform/android/libcocos2dx-with-controller/build.gradle", @@ -1114,6 +1113,8 @@ "cocos/platform/ios/CCGLViewImpl-ios.h", "cocos/platform/ios/CCGLViewImpl-ios.mm", "cocos/platform/ios/CCImage-ios.mm", + "cocos/platform/ios/CCInputView-ios.h", + "cocos/platform/ios/CCInputView-ios.mm", "cocos/platform/ios/CCPlatformDefine-ios.h", "cocos/platform/ios/CCStdC-ios.h", "cocos/platform/ios/OpenGL_Internal-ios.h", @@ -1136,18 +1137,6 @@ "cocos/platform/mac/CCPlatformDefine-mac.h", "cocos/platform/mac/CCStdC-mac.h", "cocos/platform/mac/cocos2d-prefix.pch", - "cocos/platform/tizen/CCApplication-tizen.cpp", - "cocos/platform/tizen/CCApplication-tizen.h", - "cocos/platform/tizen/CCCommon-tizen.cpp", - "cocos/platform/tizen/CCDevice-tizen.cpp", - "cocos/platform/tizen/CCFileUtils-tizen.cpp", - "cocos/platform/tizen/CCFileUtils-tizen.h", - "cocos/platform/tizen/CCGL-tizen.h", - "cocos/platform/tizen/CCGLViewImpl-tizen.cpp", - "cocos/platform/tizen/CCGLViewImpl-tizen.h", - "cocos/platform/tizen/CCPlatformDefine-tizen.h", - "cocos/platform/tizen/CCStdC-tizen.cpp", - "cocos/platform/tizen/CCStdC-tizen.h", "cocos/platform/win32/CCApplication-win32.cpp", "cocos/platform/win32/CCApplication-win32.h", "cocos/platform/win32/CCCommon-win32.cpp", @@ -1163,55 +1152,6 @@ "cocos/platform/win32/compat/stdint.h", "cocos/platform/win32/inet_pton_mingw.cpp", "cocos/platform/win32/inet_pton_mingw.h", - "cocos/platform/win8.1-universal/Cocos2dRenderer.cpp", - "cocos/platform/win8.1-universal/Cocos2dRenderer.h", - "cocos/platform/win8.1-universal/OpenGLES.cpp", - "cocos/platform/win8.1-universal/OpenGLES.h", - "cocos/platform/win8.1-universal/OpenGLESPage.xaml", - "cocos/platform/win8.1-universal/OpenGLESPage.xaml.cpp", - "cocos/platform/win8.1-universal/OpenGLESPage.xaml.h", - "cocos/platform/win8.1-universal/cocos2d-js/pch.h", - "cocos/platform/win8.1-universal/pch.cpp", - "cocos/platform/win8.1-universal/pch.h", - "cocos/platform/winrt/CCApplication.cpp", - "cocos/platform/winrt/CCApplication.h", - "cocos/platform/winrt/CCCommon.cpp", - "cocos/platform/winrt/CCDevice.cpp", - "cocos/platform/winrt/CCFileUtilsWinRT.cpp", - "cocos/platform/winrt/CCFileUtilsWinRT.h", - "cocos/platform/winrt/CCFreeTypeFont.cpp", - "cocos/platform/winrt/CCFreeTypeFont.h", - "cocos/platform/winrt/CCGL.h", - "cocos/platform/winrt/CCGLViewImpl-winrt.cpp", - "cocos/platform/winrt/CCGLViewImpl-winrt.h", - "cocos/platform/winrt/CCGLViewImpl.cpp", - "cocos/platform/winrt/CCGLViewImpl.h", - "cocos/platform/winrt/CCPThreadWinRT.cpp", - "cocos/platform/winrt/CCPThreadWinRT.h", - "cocos/platform/winrt/CCPlatformDefine-winrt.h", - "cocos/platform/winrt/CCPrecompiledShaders.cpp", - "cocos/platform/winrt/CCPrecompiledShaders.h", - "cocos/platform/winrt/CCStdC.cpp", - "cocos/platform/winrt/CCStdC.h", - "cocos/platform/winrt/CCWinRTUtils.cpp", - "cocos/platform/winrt/CCWinRTUtils.h", - "cocos/platform/winrt/InputEvent.cpp", - "cocos/platform/winrt/InputEvent.h", - "cocos/platform/winrt/InputEventTypes.h", - "cocos/platform/winrt/Keyboard-winrt.cpp", - "cocos/platform/winrt/Keyboard-winrt.h", - "cocos/platform/winrt/WICImageLoader-winrt.cpp", - "cocos/platform/winrt/WICImageLoader-winrt.h", - "cocos/platform/winrt/inet_ntop_winrt.cpp", - "cocos/platform/winrt/inet_ntop_winrt.h", - "cocos/platform/winrt/inet_pton_winrt.cpp", - "cocos/platform/winrt/inet_pton_winrt.h", - "cocos/platform/winrt/pch.cpp", - "cocos/platform/winrt/pch.h", - "cocos/platform/winrt/sha1.cpp", - "cocos/platform/winrt/sha1.h", - "cocos/platform/winrt/shaders/precompiledshaders.h", - "cocos/platform/winrt/targetver.h", "cocos/precheader.cpp", "cocos/precheader.h", "cocos/renderer/CCBatchCommand.cpp", @@ -1268,6 +1208,8 @@ "cocos/renderer/CCVertexIndexData.cpp", "cocos/renderer/CCVertexIndexData.h", "cocos/renderer/CMakeLists.txt", + "cocos/renderer/ccGLStateCache.cpp", + "cocos/renderer/ccGLStateCache.h", "cocos/renderer/ccShader_3D_Color.frag", "cocos/renderer/ccShader_3D_ColorNormal.frag", "cocos/renderer/ccShader_3D_ColorNormalTex.frag", @@ -2344,9 +2286,6 @@ "external/chipmunk/prebuilt/tizen/arm/libchipmunk.a", "external/chipmunk/prebuilt/tizen/x86/libchipmunk.a", "external/chipmunk/prebuilt/tvos/libchipmunk.a", - "external/chipmunk/prebuilt/win10/arm/chipmunk.lib", - "external/chipmunk/prebuilt/win10/win32/chipmunk.lib", - "external/chipmunk/prebuilt/win10/x64/chipmunk.lib", "external/chipmunk/prebuilt/win32/debug-lib/libchipmunk.lib", "external/chipmunk/prebuilt/win32/release-lib/libchipmunk.lib", "external/clipper/CMakeLists.txt", @@ -5580,8 +5519,8 @@ "cocos/scripting/lua-bindings/manual/physics3d/lua_cocos2dx_physics3d_manual.h", "cocos/scripting/lua-bindings/manual/platform/android/CCLuaJavaBridge.cpp", "cocos/scripting/lua-bindings/manual/platform/android/CCLuaJavaBridge.h", - "cocos/scripting/lua-bindings/manual/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxLuaJavaBridge.cpp", - "cocos/scripting/lua-bindings/manual/platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxLuaJavaBridge.h", + "cocos/scripting/lua-bindings/manual/platform/android/jni/Cocos2dxLuaJavaBridge.cpp", + "cocos/scripting/lua-bindings/manual/platform/android/jni/Cocos2dxLuaJavaBridge.h", "cocos/scripting/lua-bindings/manual/platform/ios/CCLuaObjcBridge.h", "cocos/scripting/lua-bindings/manual/platform/ios/CCLuaObjcBridge.mm", "cocos/scripting/lua-bindings/manual/spine/LuaSkeletonAnimation.cpp", @@ -5684,63 +5623,6 @@ "external/lua/cjson/lua_cjson.h", "external/lua/cjson/strbuf.c", "external/lua/cjson/strbuf.h", - "external/lua/lua/Android.mk", - "external/lua/lua/CMakeLists.txt", - "external/lua/lua/lapi.c", - "external/lua/lua/lapi.h", - "external/lua/lua/lauxlib.c", - "external/lua/lua/lauxlib.h", - "external/lua/lua/lbaselib.c", - "external/lua/lua/lcode.c", - "external/lua/lua/lcode.h", - "external/lua/lua/ldblib.c", - "external/lua/lua/ldebug.c", - "external/lua/lua/ldebug.h", - "external/lua/lua/ldo.c", - "external/lua/lua/ldo.h", - "external/lua/lua/ldump.c", - "external/lua/lua/lfunc.c", - "external/lua/lua/lfunc.h", - "external/lua/lua/lgc.c", - "external/lua/lua/lgc.h", - "external/lua/lua/linit.c", - "external/lua/lua/liolib.c", - "external/lua/lua/llex.c", - "external/lua/lua/llex.h", - "external/lua/lua/llimits.h", - "external/lua/lua/lmathlib.c", - "external/lua/lua/lmem.c", - "external/lua/lua/lmem.h", - "external/lua/lua/loadlib.c", - "external/lua/lua/lobject.c", - "external/lua/lua/lobject.h", - "external/lua/lua/lopcodes.c", - "external/lua/lua/lopcodes.h", - "external/lua/lua/loslib.c", - "external/lua/lua/lparser.c", - "external/lua/lua/lparser.h", - "external/lua/lua/lstate.c", - "external/lua/lua/lstate.h", - "external/lua/lua/lstring.c", - "external/lua/lua/lstring.h", - "external/lua/lua/lstrlib.c", - "external/lua/lua/ltable.c", - "external/lua/lua/ltable.h", - "external/lua/lua/ltablib.c", - "external/lua/lua/ltm.c", - "external/lua/lua/ltm.h", - "external/lua/lua/lua.c", - "external/lua/lua/lua.h", - "external/lua/lua/luaconf.h", - "external/lua/lua/lualib.h", - "external/lua/lua/lundump.c", - "external/lua/lua/lundump.h", - "external/lua/lua/lvm.c", - "external/lua/lua/lvm.h", - "external/lua/lua/lzio.c", - "external/lua/lua/lzio.h", - "external/lua/lua/prebuilt/ios/liblua.a", - "external/lua/lua/print.c", "external/lua/luajit/CMakeLists.txt", "external/lua/luajit/include/lauxlib.h", "external/lua/luajit/include/lua.h", diff --git a/templates/cpp-template-default/CMakeLists.txt b/templates/cpp-template-default/CMakeLists.txt index 5375c9488e29..bbe2df49532e 100644 --- a/templates/cpp-template-default/CMakeLists.txt +++ b/templates/cpp-template-default/CMakeLists.txt @@ -33,9 +33,7 @@ set(COCOS2DX_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cocos2d) set(CMAKE_MODULE_PATH ${COCOS2DX_ROOT_PATH}/cmake/Modules/) include(CocosBuildSet) -if(NOT USE_COCOS_PREBUILT) - add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos ${ENGINE_BINARY_PATH}/cocos/core) -endif() +add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos ${ENGINE_BINARY_PATH}/cocos/core) # record sources, headers, resources... set(GAME_SOURCE) @@ -140,11 +138,14 @@ if(APPLE) elseif(IOS) cocos_pak_xcode(${APP_NAME} INFO_PLIST "iOSBundleInfo.plist.in") set_xcode_property(${APP_NAME} ASSETCATALOG_COMPILER_APPICON_NAME "AppIcon") + set_xcode_property(${APP_NAME} DEVELOPMENT_TEAM "") + set_xcode_property(${APP_NAME} CODE_SIGN_IDENTITY "iPhone Developer") endif() elseif(WINDOWS) - cocos_copy_target_dll(${APP_NAME} COPY_TO ${APP_RES_DIR}) + cocos_copy_target_dll(${APP_NAME}) endif() if(LINUX OR WINDOWS) - cocos_copy_res(COPY_TO ${APP_RES_DIR} FOLDERS ${GAME_RES_FOLDER}) + set(APP_RES_DIR "$/Resources") + cocos_copy_target_res(${APP_NAME} COPY_TO ${APP_RES_DIR} FOLDERS ${GAME_RES_FOLDER}) endif() diff --git a/templates/cpp-template-default/Classes/HelloWorldScene.cpp b/templates/cpp-template-default/Classes/HelloWorldScene.cpp index fd2d4484ffc2..5737362918fb 100644 --- a/templates/cpp-template-default/Classes/HelloWorldScene.cpp +++ b/templates/cpp-template-default/Classes/HelloWorldScene.cpp @@ -124,11 +124,7 @@ void HelloWorld::menuCloseCallback(Ref* pSender) //Close the cocos2d-x game scene and quit the application Director::getInstance()->end(); - #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) - exit(0); -#endif - - /*To navigate back to native iOS screen(if present) without quitting the application ,do not use Director::getInstance()->end() and exit(0) as given above,instead trigger a custom event created in RootViewController.mm as below*/ + /*To navigate back to native iOS screen(if present) without quitting the application ,do not use Director::getInstance()->end() as given above,instead trigger a custom event created in RootViewController.mm as below*/ //EventCustom customEndEvent("game_scene_close_event"); //_eventDispatcher->dispatchEvent(&customEndEvent); diff --git a/templates/cpp-template-default/Resources/CloseNormal.png b/templates/cpp-template-default/Resources/CloseNormal.png index b45c89c56b57..b65498c94159 100644 Binary files a/templates/cpp-template-default/Resources/CloseNormal.png and b/templates/cpp-template-default/Resources/CloseNormal.png differ diff --git a/templates/cpp-template-default/Resources/CloseSelected.png b/templates/cpp-template-default/Resources/CloseSelected.png index cbb2549eb391..306749ecd20d 100644 Binary files a/templates/cpp-template-default/Resources/CloseSelected.png and b/templates/cpp-template-default/Resources/CloseSelected.png differ diff --git a/templates/cpp-template-default/Resources/HelloWorld.png b/templates/cpp-template-default/Resources/HelloWorld.png index 7b9c94cdf1f9..21d4326855d2 100644 Binary files a/templates/cpp-template-default/Resources/HelloWorld.png and b/templates/cpp-template-default/Resources/HelloWorld.png differ diff --git a/templates/cpp-template-default/proj.android/app/build.gradle b/templates/cpp-template-default/proj.android/app/build.gradle index 853e2a298a47..37f771e03e76 100644 --- a/templates/cpp-template-default/proj.android/app/build.gradle +++ b/templates/cpp-template-default/proj.android/app/build.gradle @@ -34,9 +34,8 @@ android { else if (PROP_BUILD_TYPE == 'cmake') { cmake { targets 'MyGame' - arguments "-DCMAKE_FIND_ROOT_PATH=", "-DANDROID_STL=c++_static", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE", \ - "-DUSE_CHIPMUNK=TRUE", "-DUSE_BULLET=TRUE" - cppFlags "-frtti -fexceptions" + arguments "-DCMAKE_FIND_ROOT_PATH=", "-DANDROID_STL=c++_static", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE" + cppFlags "-frtti -fexceptions -fsigned-char" } } } @@ -51,7 +50,7 @@ android { java.srcDir "src" res.srcDir "res" manifest.srcFile "AndroidManifest.xml" - assets.srcDir "../../Resources" + assets.srcDir "assets" } externalNativeBuild { @@ -112,16 +111,22 @@ android { } android.applicationVariants.all { variant -> - // delete previous files first - delete "${buildDir}/intermediates/assets/${variant.dirName}" + def project_root_folder = "${projectDir}/../.." + def dest_assets_folder = "${projectDir}/assets" - variant.mergeAssets.doLast { + // delete previous files first + delete dest_assets_folder + def targetName = variant.name.capitalize() + def copyTaskName = "copy${targetName}ResourcesToAssets" + + tasks.register(copyTaskName) { copy { - from "${buildDir}/../../../Resources" - into "${buildDir}/intermediates/assets/${variant.dirName}" + from project_root_folder + "/Resources" + into dest_assets_folder exclude "**/*.gz" } } + tasks.getByName("pre${targetName}Build").dependsOn copyTaskName } dependencies { diff --git a/templates/cpp-template-default/proj.android/app/proguard-rules.pro b/templates/cpp-template-default/proj.android/app/proguard-rules.pro index 2c062c494602..9f6d4ff6bfb0 100644 --- a/templates/cpp-template-default/proj.android/app/proguard-rules.pro +++ b/templates/cpp-template-default/proj.android/app/proguard-rules.pro @@ -23,6 +23,8 @@ -dontwarn com.chukong.** -keep public class com.huawei.android.** { *; } -dontwarn com.huawei.android.** +-keep public class com.oppo.oiface.engine.** { *; } +-dontwarn com.oppo.oiface.engine.** # Proguard Apache HTTP for release -keep class org.apache.http.** { *; } diff --git a/templates/cpp-template-default/proj.android/app/res/mipmap-hdpi/ic_launcher.png b/templates/cpp-template-default/proj.android/app/res/mipmap-hdpi/ic_launcher.png index bfaa190919f6..45ee51d15f96 100644 Binary files a/templates/cpp-template-default/proj.android/app/res/mipmap-hdpi/ic_launcher.png and b/templates/cpp-template-default/proj.android/app/res/mipmap-hdpi/ic_launcher.png differ diff --git a/templates/cpp-template-default/proj.android/app/res/mipmap-mdpi/ic_launcher.png b/templates/cpp-template-default/proj.android/app/res/mipmap-mdpi/ic_launcher.png index a645020762e3..0dd2a608998e 100644 Binary files a/templates/cpp-template-default/proj.android/app/res/mipmap-mdpi/ic_launcher.png and b/templates/cpp-template-default/proj.android/app/res/mipmap-mdpi/ic_launcher.png differ diff --git a/templates/cpp-template-default/proj.android/app/res/mipmap-xhdpi/ic_launcher.png b/templates/cpp-template-default/proj.android/app/res/mipmap-xhdpi/ic_launcher.png index fe20b650dd25..a32f16f930b3 100644 Binary files a/templates/cpp-template-default/proj.android/app/res/mipmap-xhdpi/ic_launcher.png and b/templates/cpp-template-default/proj.android/app/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/templates/cpp-template-default/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png b/templates/cpp-template-default/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png index 2c741020fbfc..332f268edc46 100644 Binary files a/templates/cpp-template-default/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png and b/templates/cpp-template-default/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/templates/cpp-template-default/proj.android/app/src/org/cocos2dx/cpp/AppActivity.java b/templates/cpp-template-default/proj.android/app/src/org/cocos2dx/cpp/AppActivity.java index 3164b839ae0a..661fe75fda9b 100644 --- a/templates/cpp-template-default/proj.android/app/src/org/cocos2dx/cpp/AppActivity.java +++ b/templates/cpp-template-default/proj.android/app/src/org/cocos2dx/cpp/AppActivity.java @@ -26,6 +26,9 @@ of this software and associated documentation files (the "Software"), to deal import android.os.Bundle; import org.cocos2dx.lib.Cocos2dxActivity; +import android.os.Build; +import android.view.WindowManager; +import android.view.WindowManager.LayoutParams; public class AppActivity extends Cocos2dxActivity { @@ -41,6 +44,13 @@ protected void onCreate(Bundle savedInstanceState) { // Don't need to finish it again since it's finished in super.onCreate . return; } + // Make sure we're running on Pie or higher to change cutout mode + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { + // Enable rendering into the cutout area + WindowManager.LayoutParams lp = getWindow().getAttributes(); + lp.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES; + getWindow().setAttributes(lp); + } // DO OTHER INITIALIZATION BELOW } diff --git a/templates/cpp-template-default/proj.android/build.gradle b/templates/cpp-template-default/proj.android/build.gradle index 5dff94de2a97..63697d83ac6c 100644 --- a/templates/cpp-template-default/proj.android/build.gradle +++ b/templates/cpp-template-default/proj.android/build.gradle @@ -7,7 +7,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.1.0' + classpath 'com.android.tools.build:gradle:3.4.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/templates/cpp-template-default/proj.android/gradle/wrapper/gradle-wrapper.properties b/templates/cpp-template-default/proj.android/gradle/wrapper/gradle-wrapper.properties index fa27d140c9ad..8e341b7af5a7 100644 --- a/templates/cpp-template-default/proj.android/gradle/wrapper/gradle-wrapper.properties +++ b/templates/cpp-template-default/proj.android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip diff --git a/templates/cpp-template-default/proj.ios_mac/HelloCpp.xcodeproj/project.pbxproj b/templates/cpp-template-default/proj.ios_mac/HelloCpp.xcodeproj/project.pbxproj index 208e90649099..fa5c0c88cec7 100644 --- a/templates/cpp-template-default/proj.ios_mac/HelloCpp.xcodeproj/project.pbxproj +++ b/templates/cpp-template-default/proj.ios_mac/HelloCpp.xcodeproj/project.pbxproj @@ -21,6 +21,9 @@ 294D0D641D0D56D500F7F5D4 /* CoreText.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 294D0D631D0D56D500F7F5D4 /* CoreText.framework */; }; 3EACC98F19EE6D4300EB3C5E /* res in Resources */ = {isa = PBXBuildFile; fileRef = 3EACC98E19EE6D4300EB3C5E /* res */; }; 3EACC99019EE6D4300EB3C5E /* res in Resources */ = {isa = PBXBuildFile; fileRef = 3EACC98E19EE6D4300EB3C5E /* res */; }; + 467AF5B1231E4C9200770112 /* AVKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 467AF5B0231E4C9200770112 /* AVKit.framework */; }; + 467AF5B3231E4C9900770112 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 467AF5B2231E4C9900770112 /* CoreMedia.framework */; }; + 467AF5E8231FA90800770112 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 467AF5E7231FA90800770112 /* WebKit.framework */; }; 46880B7B19C43A67006E1F66 /* CloseNormal.png in Resources */ = {isa = PBXBuildFile; fileRef = 46880B7619C43A67006E1F66 /* CloseNormal.png */; }; 46880B7C19C43A67006E1F66 /* CloseNormal.png in Resources */ = {isa = PBXBuildFile; fileRef = 46880B7619C43A67006E1F66 /* CloseNormal.png */; }; 46880B7D19C43A67006E1F66 /* CloseSelected.png in Resources */ = {isa = PBXBuildFile; fileRef = 46880B7719C43A67006E1F66 /* CloseSelected.png */; }; @@ -114,6 +117,9 @@ 288765A40DF7441C002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 294D0D631D0D56D500F7F5D4 /* CoreText.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreText.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/CoreText.framework; sourceTree = DEVELOPER_DIR; }; 3EACC98E19EE6D4300EB3C5E /* res */ = {isa = PBXFileReference; lastKnownFileType = folder; path = res; sourceTree = ""; }; + 467AF5B0231E4C9200770112 /* AVKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/AVKit.framework; sourceTree = DEVELOPER_DIR; }; + 467AF5B2231E4C9900770112 /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/CoreMedia.framework; sourceTree = DEVELOPER_DIR; }; + 467AF5E7231FA90800770112 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/WebKit.framework; sourceTree = DEVELOPER_DIR; }; 46880B7619C43A67006E1F66 /* CloseNormal.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = CloseNormal.png; sourceTree = ""; }; 46880B7719C43A67006E1F66 /* CloseSelected.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = CloseSelected.png; sourceTree = ""; }; 46880B7A19C43A67006E1F66 /* HelloWorld.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = HelloWorld.png; sourceTree = ""; }; @@ -149,6 +155,9 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 467AF5E8231FA90800770112 /* WebKit.framework in Frameworks */, + 467AF5B3231E4C9900770112 /* CoreMedia.framework in Frameworks */, + 467AF5B1231E4C9200770112 /* AVKit.framework in Frameworks */, 294D0D641D0D56D500F7F5D4 /* CoreText.framework in Frameworks */, ED545A7C1B68A1F400C3958E /* libiconv.dylib in Frameworks */, 52B47A471A53D09C004E4C60 /* Security.framework in Frameworks */, @@ -241,6 +250,9 @@ 29B97323FDCFA39411CA2CEA /* Frameworks */ = { isa = PBXGroup; children = ( + 467AF5E7231FA90800770112 /* WebKit.framework */, + 467AF5B2231E4C9900770112 /* CoreMedia.framework */, + 467AF5B0231E4C9200770112 /* AVKit.framework */, 294D0D631D0D56D500F7F5D4 /* CoreText.framework */, ED545A7D1B68A1FA00C3958E /* libiconv.dylib */, ED545A7B1B68A1F400C3958E /* libiconv.dylib */, diff --git a/templates/cpp-template-default/proj.ios_mac/ios/AppController.mm b/templates/cpp-template-default/proj.ios_mac/ios/AppController.mm index 18c90ebbfc14..edcd92178a39 100644 --- a/templates/cpp-template-default/proj.ios_mac/ios/AppController.mm +++ b/templates/cpp-template-default/proj.ios_mac/ios/AppController.mm @@ -73,6 +73,12 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( [[UIApplication sharedApplication] setStatusBarHidden:true]; + //Launching the app with the arguments -NSAllowsDefaultLineBreakStrategy NO to force back to the old behavior. + if ( [[UIDevice currentDevice].systemVersion floatValue] >= 13.0f) + { + [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"NSAllowsDefaultLineBreakStrategy"]; + } + // IMPORTANT: Setting the GLView should be done after creating the RootViewController cocos2d::GLView *glview = cocos2d::GLViewImpl::createWithEAGLView((__bridge void *)_viewController.view); cocos2d::Director::getInstance()->setOpenGLView(glview); diff --git a/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-20.png b/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-20.png index 8e39c19f8ce9..8ead23e36507 100644 Binary files a/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-20.png and b/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-20.png differ diff --git a/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-20@2x.png b/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-20@2x.png index 2057b64dc0e1..775685daca94 100644 Binary files a/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-20@2x.png and b/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-20@2x.png differ diff --git a/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-20@3x.png b/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-20@3x.png index b92db3c69211..a5b49ccbb199 100644 Binary files a/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-20@3x.png and b/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-20@3x.png differ diff --git a/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-29.png b/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-29.png index e2a06e67e7ed..0500184c869c 100644 Binary files a/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-29.png and b/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-29.png differ diff --git a/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-29@2x.png b/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-29@2x.png index 05edea8beaa6..f0f8b7fe9833 100644 Binary files a/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-29@2x.png and b/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-29@2x.png differ diff --git a/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-29@3x.png b/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-29@3x.png index 4c2e5218109a..5287e50a7986 100644 Binary files a/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-29@3x.png and b/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-29@3x.png differ diff --git a/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-40.png b/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-40.png index 2057b64dc0e1..775685daca94 100644 Binary files a/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-40.png and b/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-40.png differ diff --git a/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-40@2x.png b/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-40@2x.png index eac54d0dd34d..d9c7ab446bb7 100644 Binary files a/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-40@2x.png and b/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-40@2x.png differ diff --git a/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-40@3x.png b/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-40@3x.png index b92db3c69211..a5b49ccbb199 100644 Binary files a/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-40@3x.png and b/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-40@3x.png differ diff --git a/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-50.png b/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-50.png index 4064e72d9c59..ac381bc20e85 100644 Binary files a/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-50.png and b/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-50.png differ diff --git a/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-50@2x.png b/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-50@2x.png index 6462379729d3..ef38d4500a80 100644 Binary files a/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-50@2x.png and b/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-50@2x.png differ diff --git a/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-57.png b/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-57.png index 9fdebe2d4fb4..4fcc6fddffe1 100644 Binary files a/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-57.png and b/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-57.png differ diff --git a/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-57@2x.png b/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-57@2x.png index 621a5ef39632..c3807861ad29 100644 Binary files a/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-57@2x.png and b/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-57@2x.png differ diff --git a/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png b/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png index b92db3c69211..a5b49ccbb199 100644 Binary files a/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png and b/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png differ diff --git a/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png b/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png index db78708ef41d..d4bc53132ce3 100644 Binary files a/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png and b/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png differ diff --git a/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-72.png b/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-72.png index faf1ddab0f65..2c573c8df4c3 100644 Binary files a/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-72.png and b/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-72.png differ diff --git a/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-72@2x.png b/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-72@2x.png index 79157e79f86f..1526615c02d1 100644 Binary files a/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-72@2x.png and b/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-72@2x.png differ diff --git a/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-76.png b/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-76.png index ef5c3ada3a3a..8a1fa1850c03 100644 Binary files a/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-76.png and b/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-76.png differ diff --git a/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-76@2x.png b/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-76@2x.png index ba865da88d1d..8aa82506d0d1 100644 Binary files a/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-76@2x.png and b/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-76@2x.png differ diff --git a/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-83.5@2x.png b/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-83.5@2x.png index 32451e130ccd..6bf801d17507 100644 Binary files a/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-83.5@2x.png and b/templates/cpp-template-default/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-83.5@2x.png differ diff --git a/templates/cpp-template-default/proj.ios_mac/ios/Info.plist b/templates/cpp-template-default/proj.ios_mac/ios/Info.plist index 03fd094df359..1095ad9bd1a2 100644 --- a/templates/cpp-template-default/proj.ios_mac/ios/Info.plist +++ b/templates/cpp-template-default/proj.ios_mac/ios/Info.plist @@ -19,7 +19,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - + 1.0 CFBundleSignature ???? CFBundleVersion diff --git a/templates/cpp-template-default/proj.ios_mac/ios/LaunchScreenBackground.png b/templates/cpp-template-default/proj.ios_mac/ios/LaunchScreenBackground.png index 167cdcb73ed6..dadccee68624 100644 Binary files a/templates/cpp-template-default/proj.ios_mac/ios/LaunchScreenBackground.png and b/templates/cpp-template-default/proj.ios_mac/ios/LaunchScreenBackground.png differ diff --git a/templates/cpp-template-default/proj.ios_mac/ios/RootViewController.mm b/templates/cpp-template-default/proj.ios_mac/ios/RootViewController.mm index a4c37af784ab..e3c7fcb301a6 100644 --- a/templates/cpp-template-default/proj.ios_mac/ios/RootViewController.mm +++ b/templates/cpp-template-default/proj.ios_mac/ios/RootViewController.mm @@ -27,6 +27,7 @@ of this software and associated documentation files (the "Software"), to deal #import "RootViewController.h" #import "cocos2d.h" #import "platform/ios/CCEAGLView-ios.h" +#import "platform/ios/CCDirectorCaller-ios.h" @implementation RootViewController @@ -68,6 +69,13 @@ - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; } +//In iOS 12.0+, Screen Time's bug cause UIApplicationDidBecomeActiveNotification and UIApplicationWillResignActiveNotification do not fired +//so we need to active CCDirectorCaller manually +-(void)viewDidAppear:(BOOL)animated{ + [super viewDidAppear:animated]; + [[CCDirectorCaller sharedDirectorCaller] setActive:YES]; +} + - (void)viewDidDisappear:(BOOL)animated { [super viewDidDisappear:animated]; } @@ -107,8 +115,15 @@ - (BOOL)prefersStatusBarHidden { } // Controls the application's preferred home indicator auto-hiding when this view controller is shown. +// (better use preferredScreenEdgesDeferringSystemGestures for controlling the home indicator) - (BOOL)prefersHomeIndicatorAutoHidden { - return YES; + return NO; +} + +// HOME Indicator need to be tapped twice +-(UIRectEdge)preferredScreenEdgesDeferringSystemGestures +{ + return UIRectEdgeBottom; } - (void)didReceiveMemoryWarning { diff --git a/templates/cpp-template-default/proj.win32/HelloCpp.vcxproj b/templates/cpp-template-default/proj.win32/HelloCpp.vcxproj index bedc593a5e6c..957b98e9746f 100644 --- a/templates/cpp-template-default/proj.win32/HelloCpp.vcxproj +++ b/templates/cpp-template-default/proj.win32/HelloCpp.vcxproj @@ -106,7 +106,7 @@ if not exist "$(OutDir)" mkdir "$(OutDir)" -xcopy "$(ProjectDir)..\Resources" "$(OutDir)" /D /E /I /F /Y +xcopy "$(ProjectDir)..\Resources" "$(OutDir)\Resources\" /D /E /I /F /Y $(TargetName).cab $(TargetFileName) @@ -164,9 +164,6 @@ xcopy "$(ProjectDir)..\Resources" "$(OutDir)" /D /E /I /F /Y {b7c2a162-dec9-4418-972e-240ab3cbfcae} - - {929480e7-23c0-4df6-8456-096d71547116} -
diff --git a/templates/js-template-default/CMakeLists.txt b/templates/js-template-default/CMakeLists.txt index 6b5928698bdc..6210b1a97eb5 100644 --- a/templates/js-template-default/CMakeLists.txt +++ b/templates/js-template-default/CMakeLists.txt @@ -35,10 +35,8 @@ set(COCOS2DX_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/cocos2d-x) set(CMAKE_MODULE_PATH ${COCOS2DX_ROOT_PATH}/cmake/Modules/) include(CocosBuildSet) -if(NOT USE_COCOS_PREBUILT) - set(BUILD_JS_LIBS ON) - add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos ${ENGINE_BINARY_PATH}/cocos/core) -endif() +set(BUILD_JS_LIBS ON) +add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos ${ENGINE_BINARY_PATH}/cocos/core) # script and source files info, not need to compile set(res_main_files @@ -121,6 +119,8 @@ else() add_library(${APP_NAME} SHARED ${APP_SRC}) add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos/platform/android ${ENGINE_BINARY_PATH}/cocos/platform) target_link_libraries(${APP_NAME} -Wl,--whole-archive cpp_android_spec -Wl,--no-whole-archive) + add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos/scripting/js-bindings/proj.android ${ENGINE_BINARY_PATH}/cocos/js-android) + target_link_libraries(${APP_NAME} -Wl,--whole-archive js_android_spec -Wl,--no-whole-archive) endif() target_link_libraries(${APP_NAME} jscocos2d) @@ -137,15 +137,18 @@ if(APPLE) elseif(IOS) cocos_pak_xcode(${APP_NAME} INFO_PLIST "iOSBundleInfo.plist.in") set_xcode_property(${APP_NAME} ASSETCATALOG_COMPILER_APPICON_NAME "AppIcon") + set_xcode_property(${APP_NAME} DEVELOPMENT_TEAM "") + set_xcode_property(${APP_NAME} CODE_SIGN_IDENTITY "iPhone Developer") endif() elseif(WINDOWS) - cocos_copy_target_dll(${APP_NAME} COPY_TO ${APP_RES_DIR}) + cocos_copy_target_dll(${APP_NAME}) endif() # copy resource on linux or WINDOWS if(LINUX OR WINDOWS) - cocos_copy_res(COPY_TO ${APP_RES_DIR} FILES ${res_main_files}) - cocos_copy_res(COPY_TO ${APP_RES_DIR}/res FOLDERS ${res_res_folders}) - cocos_copy_res(COPY_TO ${APP_RES_DIR}/src FOLDERS ${res_src_folders}) - cocos_copy_res(COPY_TO ${APP_RES_DIR}/script FOLDERS ${res_script_folders}) + set(APP_RES_DIR "$/Resources") + cocos_copy_target_res(${APP_NAME} COPY_TO ${APP_RES_DIR} FILES ${res_main_files}) + cocos_copy_target_res(${APP_NAME} COPY_TO ${APP_RES_DIR}/res FOLDERS ${res_res_folders}) + cocos_copy_target_res(${APP_NAME} COPY_TO ${APP_RES_DIR}/src FOLDERS ${res_src_folders}) + cocos_copy_target_res(${APP_NAME} COPY_TO ${APP_RES_DIR}/script FOLDERS ${res_script_folders}) endif() diff --git a/templates/js-template-default/frameworks/runtime-src/Classes/AppDelegate.cpp b/templates/js-template-default/frameworks/runtime-src/Classes/AppDelegate.cpp index 35bd4b2aee30..31af380fb11a 100644 --- a/templates/js-template-default/frameworks/runtime-src/Classes/AppDelegate.cpp +++ b/templates/js-template-default/frameworks/runtime-src/Classes/AppDelegate.cpp @@ -95,7 +95,6 @@ AppDelegate::~AppDelegate() #elif USE_SIMPLE_AUDIO_ENGINE SimpleAudioEngine::end(); #endif - ScriptEngineManager::destroyInstance(); } void AppDelegate::initGLContextAttrs() diff --git a/templates/js-template-default/frameworks/runtime-src/proj.android/app/build.gradle b/templates/js-template-default/frameworks/runtime-src/proj.android/app/build.gradle index 6e9be754e89b..55b4de85aea2 100644 --- a/templates/js-template-default/frameworks/runtime-src/proj.android/app/build.gradle +++ b/templates/js-template-default/frameworks/runtime-src/proj.android/app/build.gradle @@ -33,9 +33,8 @@ android { } else if (PROP_BUILD_TYPE == 'cmake') { cmake { - arguments "-DCMAKE_FIND_ROOT_PATH=", "-DANDROID_STL=c++_static", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE", \ - "-DUSE_CHIPMUNK=TRUE", "-DUSE_BULLET=TRUE", "-DBUILD_JS_LIBS=TRUE" - cppFlags "-frtti -fexceptions" + arguments "-DCMAKE_FIND_ROOT_PATH=", "-DANDROID_STL=c++_static", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE" + cppFlags "-frtti -fexceptions -fsigned-char" } } } @@ -50,6 +49,7 @@ android { res.srcDir "res" jniLibs.srcDir "libs" manifest.srcFile "AndroidManifest.xml" + assets.srcDir "assets" } externalNativeBuild { @@ -114,11 +114,19 @@ def getCocosCommandPath() { return 'cocos.bat' } else { + + def env_console_path = System.getenv("COCOS_CONSOLE_ROOT") + + if (env_console_path != null && !env_console_path.trim().isEmpty()) { + return new File(env_console_path.trim() + '/cocos').absolutePath + } + // on unix like system, can not get environments variables easily // so run a shell script to get environment variable sets by cocos2d-x setup.py new ByteArrayOutputStream().withStream { os -> def result = exec { - executable = project.file('get_environment.sh') + executable = "/bin/bash" + args = [ "-i", project.file('get_environment.sh')] standardOutput = os } ext.console_path = os.toString().trim() @@ -146,29 +154,34 @@ def compileJS(srcDir, dstDir) { } android.applicationVariants.all { variant -> - // delete previous files first - delete "${buildDir}/intermediates/assets/${variant.dirName}" + def project_root_folder = "${projectDir}/../../../.." + def dest_assets_folder = "${projectDir}/assets" - variant.mergeAssets.doLast { + // delete previous files first + delete dest_assets_folder + def targetName = variant.name.capitalize() + def copyTaskName = "copy${targetName}ResourcesToAssets" + + tasks.register(copyTaskName) { copy { - from "${buildDir}/../../../../../res" - into "${buildDir}/intermediates/assets/${variant.dirName}/res" + from project_root_folder + "/res" + into dest_assets_folder + "/res" } copy { - from "${buildDir}/../../../../../src" - into "${buildDir}/intermediates/assets/${variant.dirName}/src" + from project_root_folder + "/src" + into dest_assets_folder + "/src" } copy { - from "${buildDir}/../../../../cocos2d-x/cocos/scripting/js-bindings/script" - into "${buildDir}/intermediates/assets/${variant.dirName}/script" + from project_root_folder + "/frameworks/cocos2d-x/cocos/scripting/js-bindings/script" + into dest_assets_folder + "/script" } copy { - from "${buildDir}/../../../../../main.js" - from "${buildDir}/../../../../../project.json" - into "${buildDir}/intermediates/assets/${variant.dirName}" + from project_root_folder + "/main.js" + from project_root_folder + "/project.json" + into dest_assets_folder } // compile the scripts if necessary @@ -178,10 +191,10 @@ android.applicationVariants.all { variant -> } if (compileScript) { - compileJS("${buildDir}/intermediates/assets/${variant.dirName}", - "${buildDir}/intermediates/assets/${variant.dirName}") + compileJS(dest_assets_folder, dest_assets_folder) } } + tasks.getByName("pre${targetName}Build").dependsOn copyTaskName } dependencies { diff --git a/templates/js-template-default/frameworks/runtime-src/proj.android/app/get_environment.sh b/templates/js-template-default/frameworks/runtime-src/proj.android/app/get_environment.sh index 102f7247e70a..61ce03524ccb 100755 --- a/templates/js-template-default/frameworks/runtime-src/proj.android/app/get_environment.sh +++ b/templates/js-template-default/frameworks/runtime-src/proj.android/app/get_environment.sh @@ -1,4 +1,11 @@ #!/bin/bash -source ~/.bash_profile -echo $COCOS_CONSOLE_ROOT \ No newline at end of file +if [ -f $HOME/.bashrc ]; then + source $HOME/.bashrc +fi + +if [ -f $HOME/.bash_profile ]; then + source $HOME/.bash_profile +fi + +echo $COCOS_CONSOLE_ROOT diff --git a/templates/js-template-default/frameworks/runtime-src/proj.android/app/jni/Android.mk b/templates/js-template-default/frameworks/runtime-src/proj.android/app/jni/Android.mk index 1a2a6f9dfefb..88eba2f5e707 100644 --- a/templates/js-template-default/frameworks/runtime-src/proj.android/app/jni/Android.mk +++ b/templates/js-template-default/frameworks/runtime-src/proj.android/app/jni/Android.mk @@ -4,7 +4,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := cocos2djs_shared -LOCAL_MODULE_FILENAME := libccjs +LOCAL_MODULE_FILENAME := libcocos2djs LOCAL_SRC_FILES := hellojavascript/main.cpp \ ../../../Classes/AppDelegate.cpp diff --git a/templates/js-template-default/frameworks/runtime-src/proj.android/app/proguard-rules.pro b/templates/js-template-default/frameworks/runtime-src/proj.android/app/proguard-rules.pro index 2c062c494602..9f6d4ff6bfb0 100644 --- a/templates/js-template-default/frameworks/runtime-src/proj.android/app/proguard-rules.pro +++ b/templates/js-template-default/frameworks/runtime-src/proj.android/app/proguard-rules.pro @@ -23,6 +23,8 @@ -dontwarn com.chukong.** -keep public class com.huawei.android.** { *; } -dontwarn com.huawei.android.** +-keep public class com.oppo.oiface.engine.** { *; } +-dontwarn com.oppo.oiface.engine.** # Proguard Apache HTTP for release -keep class org.apache.http.** { *; } diff --git a/templates/js-template-default/frameworks/runtime-src/proj.android/app/res/mipmap-hdpi/ic_launcher.png b/templates/js-template-default/frameworks/runtime-src/proj.android/app/res/mipmap-hdpi/ic_launcher.png index bfaa190919f6..45ee51d15f96 100644 Binary files a/templates/js-template-default/frameworks/runtime-src/proj.android/app/res/mipmap-hdpi/ic_launcher.png and b/templates/js-template-default/frameworks/runtime-src/proj.android/app/res/mipmap-hdpi/ic_launcher.png differ diff --git a/templates/js-template-default/frameworks/runtime-src/proj.android/app/res/mipmap-mdpi/ic_launcher.png b/templates/js-template-default/frameworks/runtime-src/proj.android/app/res/mipmap-mdpi/ic_launcher.png index a645020762e3..0dd2a608998e 100644 Binary files a/templates/js-template-default/frameworks/runtime-src/proj.android/app/res/mipmap-mdpi/ic_launcher.png and b/templates/js-template-default/frameworks/runtime-src/proj.android/app/res/mipmap-mdpi/ic_launcher.png differ diff --git a/templates/js-template-default/frameworks/runtime-src/proj.android/app/res/mipmap-xhdpi/ic_launcher.png b/templates/js-template-default/frameworks/runtime-src/proj.android/app/res/mipmap-xhdpi/ic_launcher.png index fe20b650dd25..a32f16f930b3 100644 Binary files a/templates/js-template-default/frameworks/runtime-src/proj.android/app/res/mipmap-xhdpi/ic_launcher.png and b/templates/js-template-default/frameworks/runtime-src/proj.android/app/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/templates/js-template-default/frameworks/runtime-src/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png b/templates/js-template-default/frameworks/runtime-src/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png index 2c741020fbfc..332f268edc46 100644 Binary files a/templates/js-template-default/frameworks/runtime-src/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png and b/templates/js-template-default/frameworks/runtime-src/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/templates/js-template-default/frameworks/runtime-src/proj.android/build.gradle b/templates/js-template-default/frameworks/runtime-src/proj.android/build.gradle index 5dff94de2a97..63697d83ac6c 100644 --- a/templates/js-template-default/frameworks/runtime-src/proj.android/build.gradle +++ b/templates/js-template-default/frameworks/runtime-src/proj.android/build.gradle @@ -7,7 +7,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.1.0' + classpath 'com.android.tools.build:gradle:3.4.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/templates/js-template-default/frameworks/runtime-src/proj.android/gradle/wrapper/gradle-wrapper.properties b/templates/js-template-default/frameworks/runtime-src/proj.android/gradle/wrapper/gradle-wrapper.properties index fa27d140c9ad..8e341b7af5a7 100644 --- a/templates/js-template-default/frameworks/runtime-src/proj.android/gradle/wrapper/gradle-wrapper.properties +++ b/templates/js-template-default/frameworks/runtime-src/proj.android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip diff --git a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/HelloJavascript.xcodeproj/project.pbxproj b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/HelloJavascript.xcodeproj/project.pbxproj index fcbf09cfc991..42b0f41024ea 100644 --- a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/HelloJavascript.xcodeproj/project.pbxproj +++ b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/HelloJavascript.xcodeproj/project.pbxproj @@ -18,6 +18,9 @@ 1AF87B9D1F6F7C80007BE51C /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1AF87B9B1F6F7C7B007BE51C /* LaunchScreen.storyboard */; }; 1AF87B9E1F6F7C80007BE51C /* LaunchScreenBackground.png in Resources */ = {isa = PBXBuildFile; fileRef = 1AF87B9C1F6F7C7C007BE51C /* LaunchScreenBackground.png */; }; 294D0D681D0D56F400F7F5D4 /* CoreText.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 294D0D671D0D56F400F7F5D4 /* CoreText.framework */; }; + 467AF5B7231E4CCB00770112 /* AVKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 467AF5B6231E4CCB00770112 /* AVKit.framework */; }; + 467AF5B9231E4CD100770112 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 467AF5B8231E4CD100770112 /* CoreMedia.framework */; }; + 467AF5EC231FA92300770112 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 467AF5EB231FA92300770112 /* WebKit.framework */; }; 46EFD4681F6A809E00164EE0 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 46EFD4671F6A809E00164EE0 /* GameController.framework */; }; 502380DC17EBB88200990C9B /* libcurl.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 502380DB17EBB88200990C9B /* libcurl.dylib */; }; 509D4A8117EBB24E00697056 /* AppDelegate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D4545215156E28EF00887EB5 /* AppDelegate.cpp */; }; @@ -46,7 +49,6 @@ A922754E1517C094001B78AA /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A922754D1517C094001B78AA /* Foundation.framework */; }; A92275501517C094001B78AA /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A922754F1517C094001B78AA /* CoreGraphics.framework */; }; BA3A85EC1A724AE900924D24 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BA3A85EB1A724AE900924D24 /* Security.framework */; }; - BA4E718119EB6E3F00932425 /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BA4E718019EB6E3E00932425 /* MediaPlayer.framework */; }; BAEE4D841AC40C11003BEB0F /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BAEE4D831AC40C11003BEB0F /* Security.framework */; }; BAF426FB19484B3E002B22EF /* script in Resources */ = {isa = PBXBuildFile; fileRef = BAF426FA19484B3E002B22EF /* script */; }; BAF426FC19484B3E002B22EF /* script in Resources */ = {isa = PBXBuildFile; fileRef = BAF426FA19484B3E002B22EF /* script */; }; @@ -147,6 +149,9 @@ 1AF87B9B1F6F7C7B007BE51C /* LaunchScreen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = ios/LaunchScreen.storyboard; sourceTree = ""; }; 1AF87B9C1F6F7C7C007BE51C /* LaunchScreenBackground.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = LaunchScreenBackground.png; path = ios/LaunchScreenBackground.png; sourceTree = ""; }; 294D0D671D0D56F400F7F5D4 /* CoreText.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreText.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/CoreText.framework; sourceTree = DEVELOPER_DIR; }; + 467AF5B6231E4CCB00770112 /* AVKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/AVKit.framework; sourceTree = DEVELOPER_DIR; }; + 467AF5B8231E4CD100770112 /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/CoreMedia.framework; sourceTree = DEVELOPER_DIR; }; + 467AF5EB231FA92300770112 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/WebKit.framework; sourceTree = DEVELOPER_DIR; }; 46EFD4671F6A809E00164EE0 /* GameController.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameController.framework; path = System/Library/Frameworks/GameController.framework; sourceTree = SDKROOT; }; 502380DB17EBB88200990C9B /* libcurl.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libcurl.dylib; path = usr/lib/libcurl.dylib; sourceTree = SDKROOT; }; 509D4AAA17EBB24E00697056 /* HelloJavascript-desktop.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "HelloJavascript-desktop.app"; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -218,11 +223,13 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 467AF5EC231FA92300770112 /* WebKit.framework in Frameworks */, + 467AF5B9231E4CD100770112 /* CoreMedia.framework in Frameworks */, + 467AF5B7231E4CCB00770112 /* AVKit.framework in Frameworks */, 294D0D681D0D56F400F7F5D4 /* CoreText.framework in Frameworks */, 9FA3AE461BE9BBCA00FC9645 /* GameController.framework in Frameworks */, ED545A821B68A21500C3958E /* libiconv.dylib in Frameworks */, BA3A85EC1A724AE900924D24 /* Security.framework in Frameworks */, - BA4E718119EB6E3F00932425 /* MediaPlayer.framework in Frameworks */, C037820C18BF77C500FE4F13 /* libjscocos2d iOS.a in Frameworks */, 1A676839180E9C1E0076BC67 /* libcocos2d iOS.a in Frameworks */, D6B061241803AB9F0077942B /* CoreMotion.framework in Frameworks */, @@ -301,6 +308,9 @@ A92275401517C094001B78AA /* Frameworks */ = { isa = PBXGroup; children = ( + 467AF5EB231FA92300770112 /* WebKit.framework */, + 467AF5B8231E4CD100770112 /* CoreMedia.framework */, + 467AF5B6231E4CCB00770112 /* AVKit.framework */, 46EFD4671F6A809E00164EE0 /* GameController.framework */, 294D0D671D0D56F400F7F5D4 /* CoreText.framework */, 9FA3AE451BE9BBCA00FC9645 /* GameController.framework */, @@ -420,6 +430,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, ); mainGroup = A92275321517C094001B78AA; diff --git a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/AppController.mm b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/AppController.mm index 18c90ebbfc14..6c5700be8441 100644 --- a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/AppController.mm +++ b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/AppController.mm @@ -73,6 +73,12 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( [[UIApplication sharedApplication] setStatusBarHidden:true]; + //Launching the app with the arguments -NSAllowsDefaultLineBreakStrategy NO to force back to the old behavior. + if ( [[UIDevice currentDevice].systemVersion floatValue] >= 13.0f) + { + [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"NSAllowsDefaultLineBreakStrategy"]; + } + // IMPORTANT: Setting the GLView should be done after creating the RootViewController cocos2d::GLView *glview = cocos2d::GLViewImpl::createWithEAGLView((__bridge void *)_viewController.view); cocos2d::Director::getInstance()->setOpenGLView(glview); diff --git a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-20.png b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-20.png index 8e39c19f8ce9..8ead23e36507 100644 Binary files a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-20.png and b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-20.png differ diff --git a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-20@2x.png b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-20@2x.png index 2057b64dc0e1..775685daca94 100644 Binary files a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-20@2x.png and b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-20@2x.png differ diff --git a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-20@3x.png b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-20@3x.png index b92db3c69211..a5b49ccbb199 100644 Binary files a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-20@3x.png and b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-20@3x.png differ diff --git a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-29.png b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-29.png index e2a06e67e7ed..0500184c869c 100644 Binary files a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-29.png and b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-29.png differ diff --git a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-29@2x.png b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-29@2x.png index 05edea8beaa6..f0f8b7fe9833 100644 Binary files a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-29@2x.png and b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-29@2x.png differ diff --git a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-29@3x.png b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-29@3x.png index 4c2e5218109a..5287e50a7986 100644 Binary files a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-29@3x.png and b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-29@3x.png differ diff --git a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-40.png b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-40.png index 2057b64dc0e1..775685daca94 100644 Binary files a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-40.png and b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-40.png differ diff --git a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-40@2x.png b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-40@2x.png index eac54d0dd34d..d9c7ab446bb7 100644 Binary files a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-40@2x.png and b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-40@2x.png differ diff --git a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-40@3x.png b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-40@3x.png index b92db3c69211..a5b49ccbb199 100644 Binary files a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-40@3x.png and b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-40@3x.png differ diff --git a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-50.png b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-50.png index 4064e72d9c59..ac381bc20e85 100644 Binary files a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-50.png and b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-50.png differ diff --git a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-50@2x.png b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-50@2x.png index 6462379729d3..ef38d4500a80 100644 Binary files a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-50@2x.png and b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-50@2x.png differ diff --git a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-57.png b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-57.png index 9fdebe2d4fb4..4fcc6fddffe1 100644 Binary files a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-57.png and b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-57.png differ diff --git a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-57@2x.png b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-57@2x.png index 621a5ef39632..c3807861ad29 100644 Binary files a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-57@2x.png and b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-57@2x.png differ diff --git a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png index b92db3c69211..a5b49ccbb199 100644 Binary files a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png and b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png differ diff --git a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png index db78708ef41d..d4bc53132ce3 100644 Binary files a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png and b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png differ diff --git a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-72.png b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-72.png index faf1ddab0f65..2c573c8df4c3 100644 Binary files a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-72.png and b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-72.png differ diff --git a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-72@2x.png b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-72@2x.png index 79157e79f86f..1526615c02d1 100644 Binary files a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-72@2x.png and b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-72@2x.png differ diff --git a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-76.png b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-76.png index ef5c3ada3a3a..8a1fa1850c03 100644 Binary files a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-76.png and b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-76.png differ diff --git a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-76@2x.png b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-76@2x.png index ba865da88d1d..8aa82506d0d1 100644 Binary files a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-76@2x.png and b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-76@2x.png differ diff --git a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-83.5@2x.png b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-83.5@2x.png index 32451e130ccd..6bf801d17507 100644 Binary files a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-83.5@2x.png and b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-83.5@2x.png differ diff --git a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Info.plist b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Info.plist index cc6fb997ccfa..344c40154900 100644 --- a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Info.plist +++ b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/Info.plist @@ -18,6 +18,8 @@ ${PRODUCT_NAME} CFBundlePackageType APPL + CFBundleShortVersionString + 1.0 CFBundleSignature ???? CFBundleVersion diff --git a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/LaunchScreenBackground.png b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/LaunchScreenBackground.png index 0fc9c728be92..dadccee68624 100644 Binary files a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/LaunchScreenBackground.png and b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/LaunchScreenBackground.png differ diff --git a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/RootViewController.mm b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/RootViewController.mm index 37144e420fce..dbede85f0ba8 100644 --- a/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/RootViewController.mm +++ b/templates/js-template-default/frameworks/runtime-src/proj.ios_mac/ios/RootViewController.mm @@ -27,6 +27,7 @@ of this software and associated documentation files (the "Software"), to deal #import "RootViewController.h" #import "cocos2d.h" #import "platform/ios/CCEAGLView-ios.h" +#import "platform/ios/CCDirectorCaller-ios.h" @implementation RootViewController @@ -68,6 +69,13 @@ - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; } +//In iOS 12.0+, Screen Time's bug cause UIApplicationDidBecomeActiveNotification and UIApplicationWillResignActiveNotification do not fired +//so we need to active CCDirectorCaller manually +-(void)viewDidAppear:(BOOL)animated{ + [super viewDidAppear:animated]; + [[CCDirectorCaller sharedDirectorCaller] setActive:YES]; +} + - (void)viewDidDisappear:(BOOL)animated { [super viewDidDisappear:animated]; } @@ -107,8 +115,15 @@ - (BOOL)prefersStatusBarHidden { } // Controls the application's preferred home indicator auto-hiding when this view controller is shown. +// (better use preferredScreenEdgesDeferringSystemGestures for controlling the home indicator) - (BOOL)prefersHomeIndicatorAutoHidden { - return YES; + return NO; +} + +// HOME Indicator need to be tapped twice +-(UIRectEdge)preferredScreenEdgesDeferringSystemGestures +{ + return UIRectEdgeBottom; } - (void)didReceiveMemoryWarning { diff --git a/templates/js-template-default/frameworks/runtime-src/proj.win32/HelloJavascript.sln b/templates/js-template-default/frameworks/runtime-src/proj.win32/HelloJavascript.sln index eeea8258df5d..8486def35509 100644 --- a/templates/js-template-default/frameworks/runtime-src/proj.win32/HelloJavascript.sln +++ b/templates/js-template-default/frameworks/runtime-src/proj.win32/HelloJavascript.sln @@ -13,8 +13,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "External", "External", "{8C EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libSpine", "..\..\cocos2d-x\cocos\editor-support\spine\proj.win32\libSpine.vcxproj", "{B7C2A162-DEC9-4418-972E-240AB3CBFCAE}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbox2d", "..\..\cocos2d-x\external\Box2D\proj.win32\libbox2d.vcxproj", "{929480E7-23C0-4DF6-8456-096D71547116}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d", "..\..\cocos2d-x\cocos\2d\libcocos2d.vcxproj", "{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libjscocos2d", "..\..\cocos2d-x\cocos\scripting\js-bindings\proj.win32\libjscocos2d.vcxproj", "{39379840-825A-45A0-B363-C09FFEF864BD}" diff --git a/templates/js-template-default/frameworks/runtime-src/proj.win32/HelloJavascript.vcxproj b/templates/js-template-default/frameworks/runtime-src/proj.win32/HelloJavascript.vcxproj index 7f85742ed92c..f9bc5d6374b5 100644 --- a/templates/js-template-default/frameworks/runtime-src/proj.win32/HelloJavascript.vcxproj +++ b/templates/js-template-default/frameworks/runtime-src/proj.win32/HelloJavascript.vcxproj @@ -121,11 +121,11 @@ - xcopy "$(ProjectDir)..\..\cocos2d-x\cocos\scripting\js-bindings\script" "$(OutDir)\script" /D /E /I /F /Y -xcopy "$(ProjectDir)..\..\..\src" "$(OutDir)\src" /D /E /I /F /Y -xcopy "$(ProjectDir)..\..\..\res" "$(OutDir)\res" /D /E /I /F /Y -copy "$(ProjectDir)..\..\..\main.js" "$(OutDir)\" /Y -copy "$(ProjectDir)..\..\..\project.json" "$(OutDir)\" /Y + xcopy "$(ProjectDir)..\..\cocos2d-x\cocos\scripting\js-bindings\script" "$(OutDir)\Resources\script\" /D /E /I /F /Y +xcopy "$(ProjectDir)..\..\..\src" "$(OutDir)\Resources\src\" /D /E /I /F /Y +xcopy "$(ProjectDir)..\..\..\res" "$(OutDir)\Resources\res\" /D /E /I /F /Y +copy "$(ProjectDir)..\..\..\main.js" "$(OutDir)\Resources\" /Y +copy "$(ProjectDir)..\..\..\project.json" "$(OutDir)\Resources\" /Y $(TargetName).cab $(TargetFileName) diff --git a/templates/js-template-default/res/HelloWorld.png b/templates/js-template-default/res/HelloWorld.png index 663b27026c3c..21d4326855d2 100644 Binary files a/templates/js-template-default/res/HelloWorld.png and b/templates/js-template-default/res/HelloWorld.png differ diff --git a/templates/lua-template-default/CMakeLists.txt b/templates/lua-template-default/CMakeLists.txt index 60fe55257a4c..4e3422b6b4bc 100644 --- a/templates/lua-template-default/CMakeLists.txt +++ b/templates/lua-template-default/CMakeLists.txt @@ -32,11 +32,8 @@ set(COCOS2DX_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/cocos2d-x) set(CMAKE_MODULE_PATH ${COCOS2DX_ROOT_PATH}/cmake/Modules/) include(CocosBuildSet) -if(NOT USE_COCOS_PREBUILT) - set(BUILD_LUA_LIBS ON) - set(BUILD_SIMU_LIB ON) - add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos ${ENGINE_BINARY_PATH}/cocos/core) -endif() +set(BUILD_LUA_LIBS ON) +add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos ${ENGINE_BINARY_PATH}/cocos/core) # script and source files info, not need to compile set(res_res_folders @@ -45,13 +42,9 @@ set(res_res_folders set(res_src_folders "${CMAKE_CURRENT_SOURCE_DIR}/src" ) -set(res_script_folders - "${COCOS2DX_ROOT_PATH}/cocos/scripting/lua-bindings/script" - ) if(APPLE OR VS) cocos_mark_multi_resources(res_res RES_TO "Resources/res" FOLDERS ${res_res_folders}) cocos_mark_multi_resources(res_src RES_TO "Resources/src" FOLDERS ${res_src_folders}) - cocos_mark_multi_resources(res_script RES_TO "Resources/src/cocos" FOLDERS ${res_script_folders}) set(cc_common_res ${res_res} ${res_src} ${res_script}) endif() @@ -74,7 +67,6 @@ if(ANDROID) elseif(LINUX) list(APPEND GAME_SOURCE ${RUNTIME_SRC_ROOT}/proj.linux/main.cpp) elseif(WINDOWS) - add_definitions(-D_USRLUASTATIC -D_USRLIBSIMSTATIC) list(APPEND GAME_HEADER ${RUNTIME_SRC_ROOT}/proj.win32/main.h ${RUNTIME_SRC_ROOT}/proj.win32/stdafx.h @@ -141,11 +133,18 @@ else() add_library(${APP_NAME} SHARED ${APP_SRC}) add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos/platform/android ${ENGINE_BINARY_PATH}/cocos/platform) target_link_libraries(${APP_NAME} -Wl,--whole-archive cpp_android_spec -Wl,--no-whole-archive) + add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos/scripting/lua-bindings/proj.android ${ENGINE_BINARY_PATH}/cocos/lua-android) + target_link_libraries(${APP_NAME} -Wl,--whole-archive lua_android_spec -Wl,--no-whole-archive) endif() target_link_libraries(${APP_NAME} luacocos2d) target_include_directories(${APP_NAME} PRIVATE ${RUNTIME_SRC_ROOT}/Classes) +if(WINDOWS OR MACOSX) + add_subdirectory(${COCOS2DX_ROOT_PATH}/tools/simulator/libsimulator ${ENGINE_BINARY_PATH}/cocos/simulatorlib) + target_link_libraries(${APP_NAME} simulatorlib) +endif() + # mark app resources, resource will be copy auto after mark setup_cocos_app_config(${APP_NAME}) if(APPLE) @@ -153,17 +152,20 @@ if(APPLE) if(MACOSX) set_target_properties(${APP_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${RUNTIME_SRC_ROOT}/proj.ios_mac/mac/Info.plist" + LINK_FLAGS "-pagezero_size 10000 -image_base 100000000" ) elseif(IOS) cocos_pak_xcode(${APP_NAME} INFO_PLIST "iOSBundleInfo.plist.in") set_xcode_property(${APP_NAME} ASSETCATALOG_COMPILER_APPICON_NAME "AppIcon") + set_xcode_property(${APP_NAME} DEVELOPMENT_TEAM "") + set_xcode_property(${APP_NAME} CODE_SIGN_IDENTITY "iPhone Developer") endif() elseif(WINDOWS) - cocos_copy_target_dll(${APP_NAME} COPY_TO ${APP_RES_DIR}) + cocos_copy_target_dll(${APP_NAME}) endif() # copy resource on linux or WINDOWS if(LINUX OR WINDOWS) - cocos_copy_res(COPY_TO ${APP_RES_DIR}/res FOLDERS ${res_res_folders}) - cocos_copy_res(COPY_TO ${APP_RES_DIR}/src FOLDERS ${res_src_folders}) - cocos_copy_res(COPY_TO ${APP_RES_DIR}/src/cocos FOLDERS ${res_script_folders}) + set(APP_RES_DIR "$/Resources") + cocos_copy_target_res(${APP_NAME} COPY_TO ${APP_RES_DIR}/res FOLDERS ${res_res_folders}) + cocos_copy_target_res(${APP_NAME} COPY_TO ${APP_RES_DIR}/src FOLDERS ${res_src_folders}) endif() diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.android/app/build.gradle b/templates/lua-template-default/frameworks/runtime-src/proj.android/app/build.gradle index 8ee0ea73bab2..4e5f0dc20afe 100644 --- a/templates/lua-template-default/frameworks/runtime-src/proj.android/app/build.gradle +++ b/templates/lua-template-default/frameworks/runtime-src/proj.android/app/build.gradle @@ -33,9 +33,8 @@ android { } else if (PROP_BUILD_TYPE == 'cmake') { cmake { - arguments "-DCMAKE_FIND_ROOT_PATH=", "-DANDROID_STL=c++_static", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE", \ - "-DUSE_CHIPMUNK=TRUE", "-DUSE_BULLET=TRUE", "-DBUILD_LUA_LIBS=TRUE" - cppFlags "-frtti -fexceptions" + arguments "-DCMAKE_FIND_ROOT_PATH=", "-DANDROID_STL=c++_static", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE" + cppFlags "-frtti -fexceptions -fsigned-char" } } } @@ -51,6 +50,7 @@ android { res.srcDir "res" jniLibs.srcDir "libs" manifest.srcFile "AndroidManifest.xml" + assets.srcDir "assets" } externalNativeBuild { @@ -115,11 +115,19 @@ def getCocosCommandPath() { return 'cocos.bat' } else { + + def env_console_path = System.getenv("COCOS_CONSOLE_ROOT") + + if (env_console_path != null && !env_console_path.trim().isEmpty()) { + return new File(env_console_path.trim() + '/cocos').absolutePath + } + // on unix like system, can not get environments variables easily // so run a shell script to get environment variable sets by cocos2d-x setup.py new ByteArrayOutputStream().withStream { os -> def result = exec { - executable = project.file('get_environment.sh') + executable = "/bin/bash" + args = [ "-i", project.file('get_environment.sh')] standardOutput = os } ext.console_path = os.toString().trim() @@ -161,23 +169,29 @@ def compileLua(srcDir, dstDir, doCompile, is64bit, doEncrypt) { } android.applicationVariants.all { variant -> + def project_root_folder = "${projectDir}/../../../.." + def dest_assets_folder = "${projectDir}/assets" + // delete previous files first - delete "${buildDir}/intermediates/assets/${variant.dirName}" + delete dest_assets_folder - variant.mergeAssets.doLast { + def targetName = variant.name.capitalize() + def copyTaskName = "copy${targetName}ResourcesToAssets" + + tasks.register(copyTaskName) { copy { - from "${buildDir}/../../../../../res" - into "${buildDir}/intermediates/assets/${variant.dirName}/res" + from project_root_folder + "/res" + into dest_assets_folder + "/res" } copy { - from "${buildDir}/../../../../../src" - into "${buildDir}/intermediates/assets/${variant.dirName}/src" + from project_root_folder + "/src" + into dest_assets_folder + "/src" } // copy { - // from "${buildDir}/../../../../cocos2d-x/cocos/scripting/lua-bindings/script" - // into "${buildDir}/intermediates/assets/${variant.dirName}/src/cocos" + // from "${projectDir}/../../../cocos2d-x/cocos/scripting/lua-bindings/script" + // into dest_assets_folder + "/src/cocos" // } // compile & encrypt the scripts if necessary @@ -221,37 +235,38 @@ android.applicationVariants.all { variant -> // invoke cocos command to compile & encrypt the lua files switch (buildType) { case -1: - compileLua("${buildDir}/intermediates/assets/${variant.dirName}/src", - "${buildDir}/intermediates/assets/${variant.dirName}/src", + compileLua(dest_assets_folder + "/src", + dest_assets_folder + "/src", false, false, encryptLua) break case 0: - compileLua("${buildDir}/intermediates/assets/${variant.dirName}/src", - "${buildDir}/intermediates/assets/${variant.dirName}/src", + compileLua(dest_assets_folder + "/src", + dest_assets_folder + "/src", true, false, encryptLua) break case 1: - compileLua("${buildDir}/intermediates/assets/${variant.dirName}/src", - "${buildDir}/intermediates/assets/${variant.dirName}/src/64bit", + compileLua(dest_assets_folder + "/src", + dest_assets_folder + "/src/64bit", true, true, encryptLua) // remove the lua files in src dir - delete fileTree("${buildDir}/intermediates/assets/${variant.dirName}/src") { + delete fileTree(dest_assets_folder + "/src") { include '**/*.lua' } - delete "${buildDir}/intermediates/assets/${variant.dirName}/src/cocos" + delete dest_assets_folder + "/src/cocos" break case 2: - compileLua("${buildDir}/intermediates/assets/${variant.dirName}/src", - "${buildDir}/intermediates/assets/${variant.dirName}/src/64bit", + compileLua(dest_assets_folder + "/src", + dest_assets_folder + "/src/64bit", true, true, encryptLua) - compileLua("${buildDir}/intermediates/assets/${variant.dirName}/src", - "${buildDir}/intermediates/assets/${variant.dirName}/src", + compileLua(dest_assets_folder + "/src", + dest_assets_folder + "/src", true, false, encryptLua) break } } } + tasks.getByName("pre${targetName}Build").dependsOn copyTaskName } dependencies { diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.android/app/get_environment.sh b/templates/lua-template-default/frameworks/runtime-src/proj.android/app/get_environment.sh index 102f7247e70a..61ce03524ccb 100755 --- a/templates/lua-template-default/frameworks/runtime-src/proj.android/app/get_environment.sh +++ b/templates/lua-template-default/frameworks/runtime-src/proj.android/app/get_environment.sh @@ -1,4 +1,11 @@ #!/bin/bash -source ~/.bash_profile -echo $COCOS_CONSOLE_ROOT \ No newline at end of file +if [ -f $HOME/.bashrc ]; then + source $HOME/.bashrc +fi + +if [ -f $HOME/.bash_profile ]; then + source $HOME/.bash_profile +fi + +echo $COCOS_CONSOLE_ROOT diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.android/app/jni/Android.mk b/templates/lua-template-default/frameworks/runtime-src/proj.android/app/jni/Android.mk index cbaf6fa7572e..ac8ad7b13703 100644 --- a/templates/lua-template-default/frameworks/runtime-src/proj.android/app/jni/Android.mk +++ b/templates/lua-template-default/frameworks/runtime-src/proj.android/app/jni/Android.mk @@ -4,7 +4,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := cocos2dlua_shared -LOCAL_MODULE_FILENAME := libcclua +LOCAL_MODULE_FILENAME := libcocos2dlua LOCAL_SRC_FILES := \ ../../../Classes/AppDelegate.cpp \ diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.android/app/proguard-rules.pro b/templates/lua-template-default/frameworks/runtime-src/proj.android/app/proguard-rules.pro index 2c062c494602..9f6d4ff6bfb0 100644 --- a/templates/lua-template-default/frameworks/runtime-src/proj.android/app/proguard-rules.pro +++ b/templates/lua-template-default/frameworks/runtime-src/proj.android/app/proguard-rules.pro @@ -23,6 +23,8 @@ -dontwarn com.chukong.** -keep public class com.huawei.android.** { *; } -dontwarn com.huawei.android.** +-keep public class com.oppo.oiface.engine.** { *; } +-dontwarn com.oppo.oiface.engine.** # Proguard Apache HTTP for release -keep class org.apache.http.** { *; } diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.android/app/res/mipmap-hdpi/ic_launcher.png b/templates/lua-template-default/frameworks/runtime-src/proj.android/app/res/mipmap-hdpi/ic_launcher.png index f1ad748a1788..45ee51d15f96 100644 Binary files a/templates/lua-template-default/frameworks/runtime-src/proj.android/app/res/mipmap-hdpi/ic_launcher.png and b/templates/lua-template-default/frameworks/runtime-src/proj.android/app/res/mipmap-hdpi/ic_launcher.png differ diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.android/app/res/mipmap-mdpi/ic_launcher.png b/templates/lua-template-default/frameworks/runtime-src/proj.android/app/res/mipmap-mdpi/ic_launcher.png index 547cbba56958..0dd2a608998e 100644 Binary files a/templates/lua-template-default/frameworks/runtime-src/proj.android/app/res/mipmap-mdpi/ic_launcher.png and b/templates/lua-template-default/frameworks/runtime-src/proj.android/app/res/mipmap-mdpi/ic_launcher.png differ diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.android/app/res/mipmap-xhdpi/ic_launcher.png b/templates/lua-template-default/frameworks/runtime-src/proj.android/app/res/mipmap-xhdpi/ic_launcher.png index b27bce848462..a32f16f930b3 100644 Binary files a/templates/lua-template-default/frameworks/runtime-src/proj.android/app/res/mipmap-xhdpi/ic_launcher.png and b/templates/lua-template-default/frameworks/runtime-src/proj.android/app/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png b/templates/lua-template-default/frameworks/runtime-src/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png index 723f6a591ece..332f268edc46 100644 Binary files a/templates/lua-template-default/frameworks/runtime-src/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png and b/templates/lua-template-default/frameworks/runtime-src/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.android/build.gradle b/templates/lua-template-default/frameworks/runtime-src/proj.android/build.gradle index 5dff94de2a97..63697d83ac6c 100644 --- a/templates/lua-template-default/frameworks/runtime-src/proj.android/build.gradle +++ b/templates/lua-template-default/frameworks/runtime-src/proj.android/build.gradle @@ -7,7 +7,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.1.0' + classpath 'com.android.tools.build:gradle:3.4.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.android/gradle/wrapper/gradle-wrapper.properties b/templates/lua-template-default/frameworks/runtime-src/proj.android/gradle/wrapper/gradle-wrapper.properties index fa27d140c9ad..8e341b7af5a7 100644 --- a/templates/lua-template-default/frameworks/runtime-src/proj.android/gradle/wrapper/gradle-wrapper.properties +++ b/templates/lua-template-default/frameworks/runtime-src/proj.android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/HelloLua.xcodeproj/project.pbxproj b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/HelloLua.xcodeproj/project.pbxproj index 055ca81435fa..6a676295010c 100644 --- a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/HelloLua.xcodeproj/project.pbxproj +++ b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/HelloLua.xcodeproj/project.pbxproj @@ -23,7 +23,9 @@ 1AF87BAA1F6F8733007BE51C /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1AF87BA91F6F8730007BE51C /* LaunchScreen.storyboard */; }; 1AF87BAB1F6F8733007BE51C /* LaunchScreenBackground.png in Resources */ = {isa = PBXBuildFile; fileRef = 1AF87BA81F6F872F007BE51C /* LaunchScreenBackground.png */; }; 294D0D721D0D572600F7F5D4 /* CoreText.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 294D0D711D0D572600F7F5D4 /* CoreText.framework */; }; - 3EEEDB61197107C0006A9FF8 /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3EEEDB60197107C0006A9FF8 /* MediaPlayer.framework */; }; + 467AF5BE231E4CFF00770112 /* AVKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 467AF5BD231E4CFF00770112 /* AVKit.framework */; }; + 467AF5C0231E4D0600770112 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 467AF5BF231E4D0600770112 /* CoreMedia.framework */; }; + 467AF5F1231FA94700770112 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 467AF5F0231FA94700770112 /* WebKit.framework */; }; 5023811817EBBCAC00990C9B /* AppController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5023810817EBBCAC00990C9B /* AppController.mm */; }; 5023812417EBBCAC00990C9B /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 5023811417EBBCAC00990C9B /* main.m */; }; 5023812517EBBCAC00990C9B /* RootViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5023811717EBBCAC00990C9B /* RootViewController.mm */; }; @@ -176,6 +178,9 @@ 1AF87BA91F6F8730007BE51C /* LaunchScreen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = ""; }; 294D0D711D0D572600F7F5D4 /* CoreText.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreText.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/CoreText.framework; sourceTree = DEVELOPER_DIR; }; 3EEEDB60197107C0006A9FF8 /* MediaPlayer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MediaPlayer.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MediaPlayer.framework; sourceTree = DEVELOPER_DIR; }; + 467AF5BD231E4CFF00770112 /* AVKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/AVKit.framework; sourceTree = DEVELOPER_DIR; }; + 467AF5BF231E4D0600770112 /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/CoreMedia.framework; sourceTree = DEVELOPER_DIR; }; + 467AF5F0231FA94700770112 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/WebKit.framework; sourceTree = DEVELOPER_DIR; }; 5023810717EBBCAC00990C9B /* AppController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppController.h; sourceTree = ""; }; 5023810817EBBCAC00990C9B /* AppController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AppController.mm; sourceTree = ""; }; 5023811317EBBCAC00990C9B /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -248,6 +253,9 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 467AF5F1231FA94700770112 /* WebKit.framework in Frameworks */, + 467AF5C0231E4D0600770112 /* CoreMedia.framework in Frameworks */, + 467AF5BE231E4CFF00770112 /* AVKit.framework in Frameworks */, 294D0D721D0D572600F7F5D4 /* CoreText.framework in Frameworks */, 9FA3AE4E1BE9BCC900FC9645 /* CFNetwork.framework in Frameworks */, ED545A891B68A23E00C3958E /* libiconv.dylib in Frameworks */, @@ -255,7 +263,6 @@ 5200BECA1A53D9A500AC45E4 /* Security.framework in Frameworks */, 15427CD5198F222200DC375D /* libluacocos2d iOS.a in Frameworks */, 15427CD3198F221400DC375D /* libcocos2d iOS.a in Frameworks */, - 3EEEDB61197107C0006A9FF8 /* MediaPlayer.framework in Frameworks */, D6B061351803AC000077942B /* CoreMotion.framework in Frameworks */, 1AF4C403178663F200122817 /* libz.dylib in Frameworks */, 50805AAF17EBBEAA004CFAD3 /* UIKit.framework in Frameworks */, @@ -372,6 +379,9 @@ F293B3CB15EB7BE500256477 /* Frameworks */ = { isa = PBXGroup; children = ( + 467AF5F0231FA94700770112 /* WebKit.framework */, + 467AF5BF231E4D0600770112 /* CoreMedia.framework */, + 467AF5BD231E4CFF00770112 /* AVKit.framework */, 294D0D711D0D572600F7F5D4 /* CoreText.framework */, 9FA3AE4D1BE9BCC900FC9645 /* CFNetwork.framework */, ED545A8A1B68A24500C3958E /* libiconv.dylib */, @@ -467,6 +477,7 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, Base, "zh-Hans", diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/AppController.mm b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/AppController.mm index 18c90ebbfc14..8116adeba98d 100644 --- a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/AppController.mm +++ b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/AppController.mm @@ -72,6 +72,12 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( [window makeKeyAndVisible]; [[UIApplication sharedApplication] setStatusBarHidden:true]; + + //Launching the app with the arguments -NSAllowsDefaultLineBreakStrategy NO to force back to the old behavior. + if ( [[UIDevice currentDevice].systemVersion floatValue] >= 13.0f) + { + [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"NSAllowsDefaultLineBreakStrategy"]; + } // IMPORTANT: Setting the GLView should be done after creating the RootViewController cocos2d::GLView *glview = cocos2d::GLViewImpl::createWithEAGLView((__bridge void *)_viewController.view); diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-20.png b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-20.png index e145d5ccdbfa..8ead23e36507 100644 Binary files a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-20.png and b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-20.png differ diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-20@2x.png b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-20@2x.png index 85aaa6bfc533..775685daca94 100644 Binary files a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-20@2x.png and b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-20@2x.png differ diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-20@3x.png b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-20@3x.png index bff5912dd6c2..a5b49ccbb199 100644 Binary files a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-20@3x.png and b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-20@3x.png differ diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-29.png b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-29.png index 7b71cd5b0417..0500184c869c 100644 Binary files a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-29.png and b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-29.png differ diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-29@2x.png b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-29@2x.png index 16ae2c0dfc7c..f0f8b7fe9833 100644 Binary files a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-29@2x.png and b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-29@2x.png differ diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-29@3x.png b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-29@3x.png index c46164f01ea9..5287e50a7986 100644 Binary files a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-29@3x.png and b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-29@3x.png differ diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-40.png b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-40.png index 85aaa6bfc533..775685daca94 100644 Binary files a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-40.png and b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-40.png differ diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-40@2x.png b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-40@2x.png index 5b417a417f87..d9c7ab446bb7 100644 Binary files a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-40@2x.png and b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-40@2x.png differ diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-40@3x.png b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-40@3x.png index bff5912dd6c2..a5b49ccbb199 100644 Binary files a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-40@3x.png and b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-40@3x.png differ diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-50.png b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-50.png index 779f80324838..ac381bc20e85 100644 Binary files a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-50.png and b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-50.png differ diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-50@2x.png b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-50@2x.png index 0a6c82fd7f22..ef38d4500a80 100644 Binary files a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-50@2x.png and b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-50@2x.png differ diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-57.png b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-57.png index eb544d174e08..4fcc6fddffe1 100644 Binary files a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-57.png and b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-57.png differ diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-57@2x.png b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-57@2x.png index 76122a30e30d..c3807861ad29 100644 Binary files a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-57@2x.png and b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-57@2x.png differ diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png index bff5912dd6c2..a5b49ccbb199 100644 Binary files a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png and b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png differ diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png index 6eb8b498ac3f..d4bc53132ce3 100644 Binary files a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png and b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png differ diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-72.png b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-72.png index 49860ebe26eb..2c573c8df4c3 100644 Binary files a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-72.png and b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-72.png differ diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-72@2x.png b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-72@2x.png index e45b9f953c23..1526615c02d1 100644 Binary files a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-72@2x.png and b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-72@2x.png differ diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-76.png b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-76.png index 3ca6ce50acb9..8a1fa1850c03 100644 Binary files a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-76.png and b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-76.png differ diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-76@2x.png b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-76@2x.png index 87d9c02800da..8aa82506d0d1 100644 Binary files a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-76@2x.png and b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-76@2x.png differ diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-83.5@2x.png b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-83.5@2x.png index 2635200ed976..6bf801d17507 100644 Binary files a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-83.5@2x.png and b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Images.xcassets/AppIcon.appiconset/Icon-83.5@2x.png differ diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Info.plist b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Info.plist index d1be19f8329a..84b5b663753a 100644 --- a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Info.plist +++ b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/Info.plist @@ -18,6 +18,8 @@ ${PRODUCT_NAME} CFBundlePackageType APPL + CFBundleShortVersionString + 1.0 CFBundleSignature ???? CFBundleVersion diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/LaunchScreenBackground.png b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/LaunchScreenBackground.png index 0fc9c728be92..dadccee68624 100644 Binary files a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/LaunchScreenBackground.png and b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/LaunchScreenBackground.png differ diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/RootViewController.mm b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/RootViewController.mm index 37144e420fce..dbede85f0ba8 100644 --- a/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/RootViewController.mm +++ b/templates/lua-template-default/frameworks/runtime-src/proj.ios_mac/ios/RootViewController.mm @@ -27,6 +27,7 @@ of this software and associated documentation files (the "Software"), to deal #import "RootViewController.h" #import "cocos2d.h" #import "platform/ios/CCEAGLView-ios.h" +#import "platform/ios/CCDirectorCaller-ios.h" @implementation RootViewController @@ -68,6 +69,13 @@ - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; } +//In iOS 12.0+, Screen Time's bug cause UIApplicationDidBecomeActiveNotification and UIApplicationWillResignActiveNotification do not fired +//so we need to active CCDirectorCaller manually +-(void)viewDidAppear:(BOOL)animated{ + [super viewDidAppear:animated]; + [[CCDirectorCaller sharedDirectorCaller] setActive:YES]; +} + - (void)viewDidDisappear:(BOOL)animated { [super viewDidDisappear:animated]; } @@ -107,8 +115,15 @@ - (BOOL)prefersStatusBarHidden { } // Controls the application's preferred home indicator auto-hiding when this view controller is shown. +// (better use preferredScreenEdgesDeferringSystemGestures for controlling the home indicator) - (BOOL)prefersHomeIndicatorAutoHidden { - return YES; + return NO; +} + +// HOME Indicator need to be tapped twice +-(UIRectEdge)preferredScreenEdgesDeferringSystemGestures +{ + return UIRectEdgeBottom; } - (void)didReceiveMemoryWarning { diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.win32/HelloLua.sln b/templates/lua-template-default/frameworks/runtime-src/proj.win32/HelloLua.sln index a542ebadb134..a8e7d19348ee 100644 --- a/templates/lua-template-default/frameworks/runtime-src/proj.win32/HelloLua.sln +++ b/templates/lua-template-default/frameworks/runtime-src/proj.win32/HelloLua.sln @@ -12,8 +12,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d", "..\..\cocos2d EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libluacocos2d", "..\..\cocos2d-x\cocos\scripting\lua-bindings\proj.win32\libluacocos2d.vcxproj", "{9F2D6CE6-C893-4400-B50C-6DB70CC2562F}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbox2d", "..\..\cocos2d-x\external\Box2D\proj.win32\libbox2d.vcxproj", "{929480E7-23C0-4DF6-8456-096D71547116}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libSpine", "..\..\cocos2d-x\cocos\editor-support\spine\proj.win32\libSpine.vcxproj", "{B7C2A162-DEC9-4418-972E-240AB3CBFCAE}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libsimulator", "..\..\cocos2d-x\tools\simulator\libsimulator\proj.win32\libsimulator.vcxproj", "{001B324A-BB91-4E83-875C-C92F75C40857}" diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.win32/HelloLua.vcxproj b/templates/lua-template-default/frameworks/runtime-src/proj.win32/HelloLua.vcxproj index 2e2bd30b3d9e..42560fbd41ca 100644 --- a/templates/lua-template-default/frameworks/runtime-src/proj.win32/HelloLua.vcxproj +++ b/templates/lua-template-default/frameworks/runtime-src/proj.win32/HelloLua.vcxproj @@ -72,7 +72,7 @@
- $(ProjectDir)..\Classes;$(ProjectDir)..\Classes\runtime;$(ProjectDir)..\Classes\protobuf-lite;$(EngineRoot)external\win32-specific\zlib\include;$(EngineRoot)external;$(EngineRoot)external\lua\lua;$(EngineRoot)external\lua\tolua;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\curl\include\win32;$(EngineRoot)extensions;$(EngineRoot)tools\simulator\libsimulator\lib;$(EngineRoot)tools\simulator\libsimulator\lib\protobuf-lite;$(EngineRoot);%(AdditionalIncludeDirectories);$(_COCOS_HEADER_WIN32_BEGIN);$(_COCOS_HEADER_WIN32_END) + $(ProjectDir)..\Classes;$(ProjectDir)..\Classes\runtime;$(ProjectDir)..\Classes\protobuf-lite;$(EngineRoot)external\win32-specific\zlib\include;$(EngineRoot)external;$(EngineRoot)external\lua\tolua;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\curl\include\win32;$(EngineRoot)extensions;$(EngineRoot)tools\simulator\libsimulator\lib;$(EngineRoot)tools\simulator\libsimulator\lib\protobuf-lite;$(EngineRoot);%(AdditionalIncludeDirectories);$(_COCOS_HEADER_WIN32_BEGIN);$(_COCOS_HEADER_WIN32_END) Level3 @@ -91,7 +91,7 @@ MachineX86 true $(OutDir);%(AdditionalLibraryDirectories);$(_COCOS_LIB_PATH_WIN32_BEGIN);$(_COCOS_LIB_PATH_WIN32_END) - libcurl.lib;%(AdditionalDependencies);$(_COCOS_LIB_WIN32_BEGIN);$(_COCOS_LIB_WIN32_END) + lua51.lib;libcurl.lib;%(AdditionalDependencies);$(_COCOS_LIB_WIN32_BEGIN);$(_COCOS_LIB_WIN32_END) libcmt.lib $(ProjectDir)../../../simulator/win32/$(TargetName).pdb $(ProjectDir)../../../simulator/win32/$(TargetName)$(TargetExt) @@ -130,15 +130,15 @@ if not exist "$(LocalDebuggerWorkingDirectory)" mkdir "$(LocalDebuggerWorkingDirectory)" xcopy /Y /Q "$(OutDir)*.dll" "$(LocalDebuggerWorkingDirectory)" -xcopy "$(ProjectDir)..\..\..\res" "$(LocalDebuggerWorkingDirectory)\res" /D /E /I /F /Y -xcopy "$(ProjectDir)..\..\..\src" "$(LocalDebuggerWorkingDirectory)\src" /D /E /I /F /Y +xcopy "$(ProjectDir)..\..\..\res" "$(LocalDebuggerWorkingDirectory)\Resources\res\" /D /E /I /F /Y +xcopy "$(ProjectDir)..\..\..\src" "$(LocalDebuggerWorkingDirectory)\Resources\src\" /D /E /I /F /Y $(TargetName).cab $(TargetFileName) - $(ProjectDir)..\Classes;$(EngineRoot)external\win32-specific\zlib\include;$(EngineRoot)external;$(EngineRoot)external\lua\lua;$(EngineRoot)external\lua\tolua;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)extensions;$(EngineRoot)external\curl\include\win32;$(EngineRoot);$(EngineRoot)tools\simulator\libsimulator\lib;$(EngineRoot)tools\simulator\libsimulator\lib\protobuf-lite;%(AdditionalIncludeDirectories);$(_COCOS_HEADER_WIN32_BEGIN);$(_COCOS_HEADER_WIN32_END) + $(ProjectDir)..\Classes;$(EngineRoot)external\win32-specific\zlib\include;$(EngineRoot)external;$(EngineRoot)external\lua\tolua;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)extensions;$(EngineRoot)external\curl\include\win32;$(EngineRoot);$(EngineRoot)tools\simulator\libsimulator\lib;$(EngineRoot)tools\simulator\libsimulator\lib\protobuf-lite;%(AdditionalIncludeDirectories);$(_COCOS_HEADER_WIN32_BEGIN);$(_COCOS_HEADER_WIN32_END) Level3 @@ -157,7 +157,7 @@ xcopy "$(ProjectDir)..\..\..\src" "$(LocalDebuggerWorkingDirectory)\src" /D /E / Windows MachineX86 $(OutDir);%(AdditionalLibraryDirectories);$(_COCOS_LIB_PATH_WIN32_BEGIN);$(_COCOS_LIB_PATH_WIN32_END) - libcurl.lib;%(AdditionalDependencies);$(_COCOS_LIB_WIN32_BEGIN);$(_COCOS_LIB_WIN32_END) + lua51.lib;libcurl.lib;%(AdditionalDependencies);$(_COCOS_LIB_WIN32_BEGIN);$(_COCOS_LIB_WIN32_END) libcmt.lib true $(ProjectDir)../../../publish/win32/$(TargetName)$(TargetExt) diff --git a/templates/lua-template-default/frameworks/runtime-src/proj.win32/SimulatorWin.cpp b/templates/lua-template-default/frameworks/runtime-src/proj.win32/SimulatorWin.cpp index c1514e7ba041..875c5796ad2d 100644 --- a/templates/lua-template-default/frameworks/runtime-src/proj.win32/SimulatorWin.cpp +++ b/templates/lua-template-default/frameworks/runtime-src/proj.win32/SimulatorWin.cpp @@ -94,7 +94,7 @@ void shutDownApp() ::SendMessage(hWnd, WM_CLOSE, NULL, NULL); } -std::string getCurAppPath(void) +std::string getCurAppPath() { TCHAR szAppDir[MAX_PATH] = { 0 }; if (!GetModuleFileName(NULL, szAppDir, MAX_PATH)) diff --git a/templates/lua-template-default/res/HelloWorld.png b/templates/lua-template-default/res/HelloWorld.png index 663b27026c3c..21d4326855d2 100644 Binary files a/templates/lua-template-default/res/HelloWorld.png and b/templates/lua-template-default/res/HelloWorld.png differ diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt deleted file mode 100644 index bc896b1791c8..000000000000 --- a/tests/CMakeLists.txt +++ /dev/null @@ -1,41 +0,0 @@ -#/**************************************************************************** -# Copyright (c) 2013 cocos2d-x.org -# Copyright (c) 2014 martell malone -# Copyright (c) 2015-2017 Chukong Technologies Inc. -# -# http://www.cocos2d-x.org -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: - -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# ****************************************************************************/ - -# build all test projects, it need the engine library - -# library have been build, on ../CMakeLists.txt, uesed to prevent tests project build engine lib again -set(BUILD_ENGINE_DONE ON) - -# add engine all tests project -add_subdirectory(${COCOS2DX_ROOT_PATH}/tests/cpp-empty-test ${ENGINE_BINARY_PATH}/tests/cpp-empty-test) - -add_subdirectory(${COCOS2DX_ROOT_PATH}/tests/cpp-tests ${ENGINE_BINARY_PATH}/tests/cpp-tests) - -add_subdirectory(${COCOS2DX_ROOT_PATH}/tests/js-tests/project ${ENGINE_BINARY_PATH}/tests/js-tests) - -add_subdirectory(${COCOS2DX_ROOT_PATH}/tests/lua-empty-test/project ${ENGINE_BINARY_PATH}/tests/lua-empty-test) - -add_subdirectory(${COCOS2DX_ROOT_PATH}/tests/lua-tests/project ${ENGINE_BINARY_PATH}/tests/lua-test) diff --git a/tests/cpp-empty-test/CMakeLists.txt b/tests/cpp-empty-test/CMakeLists.txt index f94ed7618007..8dd99e0d5981 100644 --- a/tests/cpp-empty-test/CMakeLists.txt +++ b/tests/cpp-empty-test/CMakeLists.txt @@ -32,9 +32,7 @@ if(NOT DEFINED BUILD_ENGINE_DONE) set(CMAKE_MODULE_PATH ${COCOS2DX_ROOT_PATH}/cmake/Modules/) include(CocosBuildSet) - if(NOT USE_COCOS_PREBUILT) - add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos ${ENGINE_BINARY_PATH}/cocos/core) - endif() + add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos ${ENGINE_BINARY_PATH}/cocos/core) endif() # record sources, headers, resources... @@ -97,7 +95,6 @@ elseif(APPLE) set(APP_UI_RES proj.mac/Icon.icns proj.mac/Info.plist - proj.mac/en.lproj/MainMenu.xib proj.mac/en.lproj/InfoPlist.strings ) list(APPEND GAME_SOURCE @@ -137,11 +134,15 @@ if(APPLE) elseif(IOS) cocos_pak_xcode(${APP_NAME} INFO_PLIST "iOSBundleInfo.plist.in") set_xcode_property(${APP_NAME} ASSETCATALOG_COMPILER_APPICON_NAME "AppIcon-${APP_NAME}") + set_xcode_property(${APP_NAME} CODE_SIGN_IDENTITY "iPhone Developer") + set_xcode_property(${APP_NAME} DEVELOPMENT_TEAM "") + set_xcode_property(${APP_NAME} CODE_SIGN_IDENTITY "iPhone Developer") endif() elseif(WINDOWS) - cocos_copy_target_dll(${APP_NAME} COPY_TO ${APP_RES_DIR}) + cocos_copy_target_dll(${APP_NAME}) endif() if(LINUX OR WINDOWS) - cocos_copy_res(COPY_TO ${APP_RES_DIR} FOLDERS ${GAME_RES_FOLDER}) + set(APP_RES_DIR "$/Resources") + cocos_copy_target_res(${APP_NAME} COPY_TO ${APP_RES_DIR} FOLDERS ${GAME_RES_FOLDER}) endif() diff --git a/tests/cpp-empty-test/Classes/AppDelegate.cpp b/tests/cpp-empty-test/Classes/AppDelegate.cpp index cf07aaf126f9..131455551847 100644 --- a/tests/cpp-empty-test/Classes/AppDelegate.cpp +++ b/tests/cpp-empty-test/Classes/AppDelegate.cpp @@ -91,21 +91,21 @@ bool AppDelegate::applicationDidFinishLaunching() // If the frame's height is larger than the height of medium resource size, select large resource. if (frameSize.height > mediumResource.size.height) { - searchPath.push_back(largeResource.directory); + searchPath.emplace_back(largeResource.directory); director->setContentScaleFactor(MIN(largeResource.size.height/designResolutionSize.height, largeResource.size.width/designResolutionSize.width)); } // If the frame's height is larger than the height of small resource size, select medium resource. else if (frameSize.height > smallResource.size.height) { - searchPath.push_back(mediumResource.directory); + searchPath.emplace_back(mediumResource.directory); director->setContentScaleFactor(MIN(mediumResource.size.height/designResolutionSize.height, mediumResource.size.width/designResolutionSize.width)); } // If the frame's height is smaller than the height of medium resource size, select small resource. else { - searchPath.push_back(smallResource.directory); + searchPath.emplace_back(smallResource.directory); director->setContentScaleFactor(MIN(smallResource.size.height/designResolutionSize.height, smallResource.size.width/designResolutionSize.width)); } diff --git a/tests/cpp-empty-test/Classes/HelloWorldScene.cpp b/tests/cpp-empty-test/Classes/HelloWorldScene.cpp index d8376ddb67b8..7da1770e334d 100644 --- a/tests/cpp-empty-test/Classes/HelloWorldScene.cpp +++ b/tests/cpp-empty-test/Classes/HelloWorldScene.cpp @@ -100,8 +100,4 @@ bool HelloWorld::init() void HelloWorld::menuCloseCallback(Ref* sender) { Director::getInstance()->end(); - -#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) - exit(0); -#endif } diff --git a/tests/cpp-empty-test/Resources/bang.png b/tests/cpp-empty-test/Resources/bang.png index e834f4e6b284..a966d03612e3 100644 Binary files a/tests/cpp-empty-test/Resources/bang.png and b/tests/cpp-empty-test/Resources/bang.png differ diff --git a/tests/cpp-empty-test/Resources/icons/Icon-20.png b/tests/cpp-empty-test/Resources/icons/Icon-20.png index e145d5ccdbfa..8ead23e36507 100644 Binary files a/tests/cpp-empty-test/Resources/icons/Icon-20.png and b/tests/cpp-empty-test/Resources/icons/Icon-20.png differ diff --git a/tests/cpp-empty-test/Resources/icons/Icon-20@2x.png b/tests/cpp-empty-test/Resources/icons/Icon-20@2x.png index 85aaa6bfc533..775685daca94 100644 Binary files a/tests/cpp-empty-test/Resources/icons/Icon-20@2x.png and b/tests/cpp-empty-test/Resources/icons/Icon-20@2x.png differ diff --git a/tests/cpp-empty-test/Resources/icons/Icon-20@3x.png b/tests/cpp-empty-test/Resources/icons/Icon-20@3x.png index bff5912dd6c2..a5b49ccbb199 100644 Binary files a/tests/cpp-empty-test/Resources/icons/Icon-20@3x.png and b/tests/cpp-empty-test/Resources/icons/Icon-20@3x.png differ diff --git a/tests/cpp-empty-test/Resources/icons/Icon-29.png b/tests/cpp-empty-test/Resources/icons/Icon-29.png index 7b71cd5b0417..0500184c869c 100644 Binary files a/tests/cpp-empty-test/Resources/icons/Icon-29.png and b/tests/cpp-empty-test/Resources/icons/Icon-29.png differ diff --git a/tests/cpp-empty-test/Resources/icons/Icon-29@2x.png b/tests/cpp-empty-test/Resources/icons/Icon-29@2x.png index 16ae2c0dfc7c..f0f8b7fe9833 100644 Binary files a/tests/cpp-empty-test/Resources/icons/Icon-29@2x.png and b/tests/cpp-empty-test/Resources/icons/Icon-29@2x.png differ diff --git a/tests/cpp-empty-test/Resources/icons/Icon-29@3x.png b/tests/cpp-empty-test/Resources/icons/Icon-29@3x.png index c46164f01ea9..5287e50a7986 100644 Binary files a/tests/cpp-empty-test/Resources/icons/Icon-29@3x.png and b/tests/cpp-empty-test/Resources/icons/Icon-29@3x.png differ diff --git a/tests/cpp-empty-test/Resources/icons/Icon-40.png b/tests/cpp-empty-test/Resources/icons/Icon-40.png index 85aaa6bfc533..775685daca94 100644 Binary files a/tests/cpp-empty-test/Resources/icons/Icon-40.png and b/tests/cpp-empty-test/Resources/icons/Icon-40.png differ diff --git a/tests/cpp-empty-test/Resources/icons/Icon-40@2x.png b/tests/cpp-empty-test/Resources/icons/Icon-40@2x.png index 5b417a417f87..d9c7ab446bb7 100644 Binary files a/tests/cpp-empty-test/Resources/icons/Icon-40@2x.png and b/tests/cpp-empty-test/Resources/icons/Icon-40@2x.png differ diff --git a/tests/cpp-empty-test/Resources/icons/Icon-40@3x.png b/tests/cpp-empty-test/Resources/icons/Icon-40@3x.png index bff5912dd6c2..a5b49ccbb199 100644 Binary files a/tests/cpp-empty-test/Resources/icons/Icon-40@3x.png and b/tests/cpp-empty-test/Resources/icons/Icon-40@3x.png differ diff --git a/tests/cpp-empty-test/Resources/icons/Icon-50.png b/tests/cpp-empty-test/Resources/icons/Icon-50.png index 779f80324838..ac381bc20e85 100644 Binary files a/tests/cpp-empty-test/Resources/icons/Icon-50.png and b/tests/cpp-empty-test/Resources/icons/Icon-50.png differ diff --git a/tests/cpp-empty-test/Resources/icons/Icon-50@2x.png b/tests/cpp-empty-test/Resources/icons/Icon-50@2x.png index 0a6c82fd7f22..ef38d4500a80 100644 Binary files a/tests/cpp-empty-test/Resources/icons/Icon-50@2x.png and b/tests/cpp-empty-test/Resources/icons/Icon-50@2x.png differ diff --git a/tests/cpp-empty-test/Resources/icons/Icon-57.png b/tests/cpp-empty-test/Resources/icons/Icon-57.png index eb544d174e08..4fcc6fddffe1 100644 Binary files a/tests/cpp-empty-test/Resources/icons/Icon-57.png and b/tests/cpp-empty-test/Resources/icons/Icon-57.png differ diff --git a/tests/cpp-empty-test/Resources/icons/Icon-57@2x.png b/tests/cpp-empty-test/Resources/icons/Icon-57@2x.png index 76122a30e30d..c3807861ad29 100644 Binary files a/tests/cpp-empty-test/Resources/icons/Icon-57@2x.png and b/tests/cpp-empty-test/Resources/icons/Icon-57@2x.png differ diff --git a/tests/cpp-empty-test/Resources/icons/Icon-60@2x.png b/tests/cpp-empty-test/Resources/icons/Icon-60@2x.png index bff5912dd6c2..a5b49ccbb199 100644 Binary files a/tests/cpp-empty-test/Resources/icons/Icon-60@2x.png and b/tests/cpp-empty-test/Resources/icons/Icon-60@2x.png differ diff --git a/tests/cpp-empty-test/Resources/icons/Icon-60@3x.png b/tests/cpp-empty-test/Resources/icons/Icon-60@3x.png index 6eb8b498ac3f..d4bc53132ce3 100644 Binary files a/tests/cpp-empty-test/Resources/icons/Icon-60@3x.png and b/tests/cpp-empty-test/Resources/icons/Icon-60@3x.png differ diff --git a/tests/cpp-empty-test/Resources/icons/Icon-72.png b/tests/cpp-empty-test/Resources/icons/Icon-72.png index 49860ebe26eb..2c573c8df4c3 100644 Binary files a/tests/cpp-empty-test/Resources/icons/Icon-72.png and b/tests/cpp-empty-test/Resources/icons/Icon-72.png differ diff --git a/tests/cpp-empty-test/Resources/icons/Icon-72@2x.png b/tests/cpp-empty-test/Resources/icons/Icon-72@2x.png index e45b9f953c23..1526615c02d1 100644 Binary files a/tests/cpp-empty-test/Resources/icons/Icon-72@2x.png and b/tests/cpp-empty-test/Resources/icons/Icon-72@2x.png differ diff --git a/tests/cpp-empty-test/Resources/icons/Icon-76.png b/tests/cpp-empty-test/Resources/icons/Icon-76.png index 3ca6ce50acb9..8a1fa1850c03 100644 Binary files a/tests/cpp-empty-test/Resources/icons/Icon-76.png and b/tests/cpp-empty-test/Resources/icons/Icon-76.png differ diff --git a/tests/cpp-empty-test/Resources/icons/Icon-76@2x.png b/tests/cpp-empty-test/Resources/icons/Icon-76@2x.png index 87d9c02800da..8aa82506d0d1 100644 Binary files a/tests/cpp-empty-test/Resources/icons/Icon-76@2x.png and b/tests/cpp-empty-test/Resources/icons/Icon-76@2x.png differ diff --git a/tests/cpp-empty-test/Resources/icons/Icon-83.5@2x.png b/tests/cpp-empty-test/Resources/icons/Icon-83.5@2x.png index 2635200ed976..6bf801d17507 100644 Binary files a/tests/cpp-empty-test/Resources/icons/Icon-83.5@2x.png and b/tests/cpp-empty-test/Resources/icons/Icon-83.5@2x.png differ diff --git a/tests/cpp-empty-test/Resources/ipad/CloseNormal.png b/tests/cpp-empty-test/Resources/ipad/CloseNormal.png index d78b8473400b..70030ec75a39 100644 Binary files a/tests/cpp-empty-test/Resources/ipad/CloseNormal.png and b/tests/cpp-empty-test/Resources/ipad/CloseNormal.png differ diff --git a/tests/cpp-empty-test/Resources/ipad/CloseSelected.png b/tests/cpp-empty-test/Resources/ipad/CloseSelected.png index 1bc76293e9c8..2227e6e17532 100644 Binary files a/tests/cpp-empty-test/Resources/ipad/CloseSelected.png and b/tests/cpp-empty-test/Resources/ipad/CloseSelected.png differ diff --git a/tests/cpp-empty-test/Resources/ipad/HelloWorld.png b/tests/cpp-empty-test/Resources/ipad/HelloWorld.png index 1f51700601bf..52f4a6a30002 100644 Binary files a/tests/cpp-empty-test/Resources/ipad/HelloWorld.png and b/tests/cpp-empty-test/Resources/ipad/HelloWorld.png differ diff --git a/tests/cpp-empty-test/Resources/ipadhd/CloseNormal.png b/tests/cpp-empty-test/Resources/ipadhd/CloseNormal.png index 49c2fd70fd85..bee9c18843d7 100644 Binary files a/tests/cpp-empty-test/Resources/ipadhd/CloseNormal.png and b/tests/cpp-empty-test/Resources/ipadhd/CloseNormal.png differ diff --git a/tests/cpp-empty-test/Resources/ipadhd/CloseSelected.png b/tests/cpp-empty-test/Resources/ipadhd/CloseSelected.png index 9afc31ac8260..311603fed616 100644 Binary files a/tests/cpp-empty-test/Resources/ipadhd/CloseSelected.png and b/tests/cpp-empty-test/Resources/ipadhd/CloseSelected.png differ diff --git a/tests/cpp-empty-test/Resources/ipadhd/HelloWorld.png b/tests/cpp-empty-test/Resources/ipadhd/HelloWorld.png index 6024db93c6fe..6775fb99f1fb 100644 Binary files a/tests/cpp-empty-test/Resources/ipadhd/HelloWorld.png and b/tests/cpp-empty-test/Resources/ipadhd/HelloWorld.png differ diff --git a/tests/cpp-empty-test/Resources/iphone/CloseNormal.png b/tests/cpp-empty-test/Resources/iphone/CloseNormal.png index d251e8debda5..a52fde01ea66 100644 Binary files a/tests/cpp-empty-test/Resources/iphone/CloseNormal.png and b/tests/cpp-empty-test/Resources/iphone/CloseNormal.png differ diff --git a/tests/cpp-empty-test/Resources/iphone/CloseSelected.png b/tests/cpp-empty-test/Resources/iphone/CloseSelected.png index 73aa2f96c306..c6527a903f83 100644 Binary files a/tests/cpp-empty-test/Resources/iphone/CloseSelected.png and b/tests/cpp-empty-test/Resources/iphone/CloseSelected.png differ diff --git a/tests/cpp-empty-test/Resources/iphone/HelloWorld.png b/tests/cpp-empty-test/Resources/iphone/HelloWorld.png index 7f5283a35244..ccb48aad5e26 100644 Binary files a/tests/cpp-empty-test/Resources/iphone/HelloWorld.png and b/tests/cpp-empty-test/Resources/iphone/HelloWorld.png differ diff --git a/tests/cpp-empty-test/proj.android/app/AndroidManifest.xml b/tests/cpp-empty-test/proj.android/app/AndroidManifest.xml index a6e5fd179905..9814b1058063 100644 --- a/tests/cpp-empty-test/proj.android/app/AndroidManifest.xml +++ b/tests/cpp-empty-test/proj.android/app/AndroidManifest.xml @@ -6,6 +6,7 @@ diff --git a/tests/cpp-empty-test/proj.android/app/build.gradle b/tests/cpp-empty-test/proj.android/app/build.gradle index 31c4a615c361..69148d806dc5 100644 --- a/tests/cpp-empty-test/proj.android/app/build.gradle +++ b/tests/cpp-empty-test/proj.android/app/build.gradle @@ -36,7 +36,7 @@ android { targets "cpp_empty_test" arguments "-DCMAKE_FIND_ROOT_PATH=", "-DANDROID_STL=c++_static", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE" - cppFlags "-frtti -fexceptions" + cppFlags "-frtti -fexceptions -fsigned-char" } } } @@ -51,7 +51,7 @@ android { java.srcDir "src" res.srcDir "res" manifest.srcFile "AndroidManifest.xml" - assets.srcDir "../../Resources" + assets.srcDir "assets" } externalNativeBuild { @@ -112,16 +112,19 @@ android { } android.applicationVariants.all { variant -> - // delete previous files first - delete "${buildDir}/intermediates/assets/${variant.dirName}" - variant.mergeAssets.doLast { + delete "${projectDir}/assets" + + def targetName = variant.name.capitalize() + def copyTaskName = "copy${targetName}ResourcesToAssets" + tasks.register(copyTaskName) { copy { - from "${buildDir}/../../../Resources" - into "${buildDir}/intermediates/assets/${variant.dirName}" + from "${projectDir}/../../Resources" + into "${projectDir}/assets" exclude "**/*.gz" } } + tasks.getByName("pre${targetName}Build").dependsOn copyTaskName } dependencies { diff --git a/tests/cpp-empty-test/proj.android/app/proguard-rules.pro b/tests/cpp-empty-test/proj.android/app/proguard-rules.pro index c3d6dcccaedf..dcbc4e39da25 100644 --- a/tests/cpp-empty-test/proj.android/app/proguard-rules.pro +++ b/tests/cpp-empty-test/proj.android/app/proguard-rules.pro @@ -23,6 +23,8 @@ -dontwarn com.chukong.** -keep public class com.huawei.android.** { *; } -dontwarn com.huawei.android.** +-keep public class com.oppo.oiface.engine.** { *; } +-dontwarn com.oppo.oiface.engine.** # Proguard Apache HTTP for release -keep class org.apache.http.** { *; } diff --git a/tests/cpp-empty-test/proj.android/app/res/mipmap-hdpi/ic_launcher.png b/tests/cpp-empty-test/proj.android/app/res/mipmap-hdpi/ic_launcher.png index 238793cc136a..45ee51d15f96 100644 Binary files a/tests/cpp-empty-test/proj.android/app/res/mipmap-hdpi/ic_launcher.png and b/tests/cpp-empty-test/proj.android/app/res/mipmap-hdpi/ic_launcher.png differ diff --git a/tests/cpp-empty-test/proj.android/app/res/mipmap-mdpi/ic_launcher.png b/tests/cpp-empty-test/proj.android/app/res/mipmap-mdpi/ic_launcher.png index 4c4e63b86d7c..0dd2a608998e 100644 Binary files a/tests/cpp-empty-test/proj.android/app/res/mipmap-mdpi/ic_launcher.png and b/tests/cpp-empty-test/proj.android/app/res/mipmap-mdpi/ic_launcher.png differ diff --git a/tests/cpp-empty-test/proj.android/app/res/mipmap-xhdpi/ic_launcher.png b/tests/cpp-empty-test/proj.android/app/res/mipmap-xhdpi/ic_launcher.png index c2d496db60ea..a32f16f930b3 100644 Binary files a/tests/cpp-empty-test/proj.android/app/res/mipmap-xhdpi/ic_launcher.png and b/tests/cpp-empty-test/proj.android/app/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/tests/cpp-empty-test/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png b/tests/cpp-empty-test/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png index a122b9079e73..332f268edc46 100644 Binary files a/tests/cpp-empty-test/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png and b/tests/cpp-empty-test/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/tests/cpp-empty-test/proj.android/build.gradle b/tests/cpp-empty-test/proj.android/build.gradle index 5dff94de2a97..63697d83ac6c 100644 --- a/tests/cpp-empty-test/proj.android/build.gradle +++ b/tests/cpp-empty-test/proj.android/build.gradle @@ -7,7 +7,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.1.0' + classpath 'com.android.tools.build:gradle:3.4.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/tests/cpp-empty-test/proj.android/gradle/wrapper/gradle-wrapper.properties b/tests/cpp-empty-test/proj.android/gradle/wrapper/gradle-wrapper.properties index e735da610145..70ce2c656eb3 100644 --- a/tests/cpp-empty-test/proj.android/gradle/wrapper/gradle-wrapper.properties +++ b/tests/cpp-empty-test/proj.android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip \ No newline at end of file +distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip \ No newline at end of file diff --git a/tests/cpp-empty-test/proj.android/settings.gradle b/tests/cpp-empty-test/proj.android/settings.gradle index 6d8165edecd8..9b2b1a1b72b0 100644 --- a/tests/cpp-empty-test/proj.android/settings.gradle +++ b/tests/cpp-empty-test/proj.android/settings.gradle @@ -2,3 +2,4 @@ include ':libcocos2dx' project(':libcocos2dx').projectDir = new File(settingsDir, '../../../cocos/platform/android/libcocos2dx') include ':CppEmptyTest' project(':CppEmptyTest').projectDir = new File(settingsDir, 'app') +rootProject.name = "cpp-empty-test" \ No newline at end of file diff --git a/tests/cpp-empty-test/proj.ios/AppController.mm b/tests/cpp-empty-test/proj.ios/AppController.mm index a167b06ced88..a3db2abcd16e 100644 --- a/tests/cpp-empty-test/proj.ios/AppController.mm +++ b/tests/cpp-empty-test/proj.ios/AppController.mm @@ -78,6 +78,12 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( [[UIApplication sharedApplication] setStatusBarHidden: YES]; + //Launching the app with the arguments -NSAllowsDefaultLineBreakStrategy NO to force back to the old behavior. + if ( [[UIDevice currentDevice].systemVersion floatValue] >= 13.0f) + { + [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"NSAllowsDefaultLineBreakStrategy"]; + } + // IMPORTANT: Setting the GLView should be done after creating the RootViewController cocos2d::GLViewImpl *glview = cocos2d::GLViewImpl::createWithEAGLView(eaglView); cocos2d::Director::getInstance()->setOpenGLView(glview); diff --git a/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-20.png b/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-20.png index 30bbcb86413f..8ead23e36507 100644 Binary files a/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-20.png and b/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-20.png differ diff --git a/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-20@2x.png b/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-20@2x.png index 711efd064543..775685daca94 100644 Binary files a/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-20@2x.png and b/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-20@2x.png differ diff --git a/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-20@3x.png b/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-20@3x.png index 5ae561463249..a5b49ccbb199 100644 Binary files a/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-20@3x.png and b/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-20@3x.png differ diff --git a/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-29.png b/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-29.png index 7e23f539fbae..0500184c869c 100644 Binary files a/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-29.png and b/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-29.png differ diff --git a/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-29@2x.png b/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-29@2x.png index 49b927749a69..f0f8b7fe9833 100644 Binary files a/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-29@2x.png and b/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-29@2x.png differ diff --git a/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-29@3x.png b/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-29@3x.png index 0d82366854e9..5287e50a7986 100644 Binary files a/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-29@3x.png and b/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-29@3x.png differ diff --git a/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-40.png b/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-40.png index 711efd064543..775685daca94 100644 Binary files a/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-40.png and b/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-40.png differ diff --git a/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-40@2x.png b/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-40@2x.png index 5145c41ac9f3..d9c7ab446bb7 100644 Binary files a/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-40@2x.png and b/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-40@2x.png differ diff --git a/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-40@3x.png b/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-40@3x.png index 5ae561463249..a5b49ccbb199 100644 Binary files a/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-40@3x.png and b/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-40@3x.png differ diff --git a/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-50.png b/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-50.png index 71d2f3f9198c..ac381bc20e85 100644 Binary files a/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-50.png and b/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-50.png differ diff --git a/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-50@2x.png b/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-50@2x.png index eba74b036d8d..ef38d4500a80 100644 Binary files a/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-50@2x.png and b/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-50@2x.png differ diff --git a/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-57.png b/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-57.png index 5141e3a7809f..4fcc6fddffe1 100644 Binary files a/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-57.png and b/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-57.png differ diff --git a/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-57@2x.png b/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-57@2x.png index 9ed3105bda85..c3807861ad29 100644 Binary files a/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-57@2x.png and b/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-57@2x.png differ diff --git a/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-60@2x.png b/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-60@2x.png index 5ae561463249..a5b49ccbb199 100644 Binary files a/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-60@2x.png and b/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-60@2x.png differ diff --git a/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-60@3x.png b/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-60@3x.png index c6c09c213bad..d4bc53132ce3 100644 Binary files a/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-60@3x.png and b/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-60@3x.png differ diff --git a/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-72.png b/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-72.png index 3decaa7b4703..2c573c8df4c3 100644 Binary files a/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-72.png and b/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-72.png differ diff --git a/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-72@2x.png b/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-72@2x.png index 08adc5b690a7..1526615c02d1 100644 Binary files a/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-72@2x.png and b/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-72@2x.png differ diff --git a/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-76.png b/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-76.png index 5401e968756c..8a1fa1850c03 100644 Binary files a/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-76.png and b/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-76.png differ diff --git a/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-76@2x.png b/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-76@2x.png index 5666f790797e..8aa82506d0d1 100644 Binary files a/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-76@2x.png and b/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-76@2x.png differ diff --git a/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-83.5@2x.png b/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-83.5@2x.png index 6e3af96874cc..6bf801d17507 100644 Binary files a/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-83.5@2x.png and b/tests/cpp-empty-test/proj.ios/Images.xcassets/AppIcon-cpp-empty-test.appiconset/Icon-83.5@2x.png differ diff --git a/tests/cpp-empty-test/proj.ios/Info.plist b/tests/cpp-empty-test/proj.ios/Info.plist index c0dc67bf4491..7bef6b9177f5 100644 --- a/tests/cpp-empty-test/proj.ios/Info.plist +++ b/tests/cpp-empty-test/proj.ios/Info.plist @@ -32,7 +32,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - + 1.0 CFBundleSignature ???? CFBundleVersion diff --git a/tests/cpp-empty-test/proj.ios/LaunchScreenBackground.png b/tests/cpp-empty-test/proj.ios/LaunchScreenBackground.png index 6015b9ac5616..dadccee68624 100644 Binary files a/tests/cpp-empty-test/proj.ios/LaunchScreenBackground.png and b/tests/cpp-empty-test/proj.ios/LaunchScreenBackground.png differ diff --git a/tests/cpp-empty-test/proj.ios/RootViewController.mm b/tests/cpp-empty-test/proj.ios/RootViewController.mm index 9032b654371d..7d2df0607488 100644 --- a/tests/cpp-empty-test/proj.ios/RootViewController.mm +++ b/tests/cpp-empty-test/proj.ios/RootViewController.mm @@ -25,7 +25,7 @@ of this software and associated documentation files (the "Software"), to deal ****************************************************************************/ #import "RootViewController.h" - +#import "platform/ios/CCDirectorCaller-ios.h" @implementation RootViewController @@ -50,8 +50,15 @@ - (void)loadView { - (void)viewDidLoad { [super viewDidLoad]; } - */ + +//In iOS 12.0+, Screen Time's bug cause UIApplicationDidBecomeActiveNotification and UIApplicationWillResignActiveNotification do not fired +//so we need to active CCDirectorCaller manually +-(void)viewDidAppear:(BOOL)animated{ + [super viewDidAppear:animated]; + [[CCDirectorCaller sharedDirectorCaller] setActive:YES]; +} + // Override to allow orientations other than the default portrait orientation. // This method is deprecated on ios6 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { diff --git a/tests/cpp-empty-test/proj.mac/en.lproj/MainMenu.xib b/tests/cpp-empty-test/proj.mac/en.lproj/MainMenu.xib deleted file mode 100644 index 9f99439250c0..000000000000 --- a/tests/cpp-empty-test/proj.mac/en.lproj/MainMenu.xib +++ /dev/null @@ -1,812 +0,0 @@ - - - - 1060 - 10K549 - 1938 - 1038.36 - 461.00 - - com.apple.InterfaceBuilder.CocoaPlugin - 1938 - - - YES - NSMenuItem - NSCustomObject - NSMenu - - - YES - com.apple.InterfaceBuilder.CocoaPlugin - - - PluginDependencyRecalculationVersion - - - - YES - - NSApplication - - - FirstResponder - - - NSApplication - - - AMainMenu - - YES - - - HelloCpp - - 1048576 - 2147483647 - - NSImage - NSMenuCheckmark - - - NSImage - NSMenuMixedState - - submenuAction: - - HelloCpp - - YES - - - About HelloCpp - - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Preferences… - , - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Services - - 1048576 - 2147483647 - - - submenuAction: - - Services - - YES - - _NSServicesMenu - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Hide HelloCpp - h - 1048576 - 2147483647 - - - - - - Hide Others - h - 1572864 - 2147483647 - - - - - - Show All - - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Quit HelloCpp - q - 1048576 - 2147483647 - - - - - _NSAppleMenu - - - - - View - - 1048576 - 2147483647 - - - submenuAction: - - View - - YES - - - Toggle Fullscreen - f - 1048576 - 2147483647 - - - - - - - - - Window - - 1048576 - 2147483647 - - - submenuAction: - - Window - - YES - - - Minimize - m - 1048576 - 2147483647 - - - - - - Zoom - - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Bring All to Front - - 1048576 - 2147483647 - - - - - _NSWindowsMenu - - - - - Help - - 2147483647 - - - submenuAction: - - Help - - YES - - - HelloCpp Help - ? - 1048576 - 2147483647 - - - - - _NSHelpMenu - - - - _NSMainMenu - - - AppController - - - NSFontManager - - - - - YES - - - terminate: - - - - 449 - - - - orderFrontStandardAboutPanel: - - - - 142 - - - - delegate - - - - 495 - - - - performMiniaturize: - - - - 37 - - - - arrangeInFront: - - - - 39 - - - - performZoom: - - - - 240 - - - - hide: - - - - 367 - - - - hideOtherApplications: - - - - 368 - - - - unhideAllApplications: - - - - 370 - - - - showHelp: - - - - 493 - - - - toggleFullScreen: - - - - 537 - - - - - YES - - 0 - - YES - - - - - - -2 - - - File's Owner - - - -1 - - - First Responder - - - -3 - - - Application - - - 29 - - - YES - - - - - - - - - 19 - - - YES - - - - - - 56 - - - YES - - - - - - 57 - - - YES - - - - - - - - - - - - - - - - 58 - - - - - 134 - - - - - 150 - - - - - 136 - - - - - 144 - - - - - 129 - - - - - 143 - - - - - 236 - - - - - 131 - - - YES - - - - - - 149 - - - - - 145 - - - - - 130 - - - - - 24 - - - YES - - - - - - - - - 92 - - - - - 5 - - - - - 239 - - - - - 23 - - - - - 295 - - - YES - - - - - - 296 - - - YES - - - - - - 420 - - - - - 490 - - - YES - - - - - - 491 - - - YES - - - - - - 492 - - - - - 494 - - - - - 536 - - - - - - - YES - - YES - -1.IBPluginDependency - -2.IBPluginDependency - -3.IBPluginDependency - 129.IBPluginDependency - 130.IBPluginDependency - 131.IBPluginDependency - 134.IBPluginDependency - 136.IBPluginDependency - 143.IBPluginDependency - 144.IBPluginDependency - 145.IBPluginDependency - 149.IBPluginDependency - 150.IBPluginDependency - 19.IBPluginDependency - 23.IBPluginDependency - 236.IBPluginDependency - 239.IBPluginDependency - 24.IBPluginDependency - 29.IBPluginDependency - 295.IBPluginDependency - 296.IBPluginDependency - 420.IBPluginDependency - 490.IBPluginDependency - 491.IBPluginDependency - 492.IBPluginDependency - 494.IBPluginDependency - 5.IBPluginDependency - 536.IBPluginDependency - 56.IBPluginDependency - 57.IBPluginDependency - 58.IBPluginDependency - 92.IBPluginDependency - - - YES - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - - YES - - - - - - YES - - - - - 541 - - - - YES - - AppController - NSObject - - YES - - YES - exitFullScreen: - toggleFullScreen: - - - YES - id - id - - - - YES - - YES - exitFullScreen: - toggleFullScreen: - - - YES - - exitFullScreen: - id - - - toggleFullScreen: - id - - - - - YES - - YES - glView - window - - - YES - EAGLView - Window - - - - YES - - YES - glView - window - - - YES - - glView - EAGLView - - - window - Window - - - - - IBProjectSource - ./Classes/AppController.h - - - - EAGLView - NSOpenGLView - - IBProjectSource - ./Classes/EAGLView.h - - - - - 0 - IBCocoaFramework - - com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 - - - YES - 3 - - YES - - YES - NSMenuCheckmark - NSMenuMixedState - - - YES - {9, 8} - {7, 2} - - - - diff --git a/tests/cpp-empty-test/proj.win10/App.xaml b/tests/cpp-empty-test/proj.win10/App.xaml deleted file mode 100644 index 4851359f9ef2..000000000000 --- a/tests/cpp-empty-test/proj.win10/App.xaml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - HelloCpp - - - diff --git a/tests/cpp-empty-test/proj.win10/App.xaml.cpp b/tests/cpp-empty-test/proj.win10/App.xaml.cpp deleted file mode 100644 index ca656b80e740..000000000000 --- a/tests/cpp-empty-test/proj.win10/App.xaml.cpp +++ /dev/null @@ -1,146 +0,0 @@ -/**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - ****************************************************************************/ - -#include "App.xaml.h" -#include "OpenGLESPage.xaml.h" - -using namespace Platform; -using namespace Windows::ApplicationModel; -using namespace Windows::ApplicationModel::Activation; -using namespace Windows::Foundation; -using namespace Windows::Foundation::Collections; -using namespace Windows::UI::Xaml::Media::Animation; -using namespace Windows::UI::Xaml; -using namespace Windows::UI::Xaml::Controls; -using namespace Windows::UI::Xaml::Controls::Primitives; -using namespace Windows::UI::Xaml::Data; -using namespace Windows::UI::Xaml::Input; -using namespace Windows::UI::Xaml::Interop; -using namespace Windows::UI::Xaml::Media; -using namespace Windows::UI::Xaml::Navigation; -using namespace cocos2d; -using namespace CocosAppWinRT; - -App::App() -{ - InitializeComponent(); - Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending); - Resuming += ref new EventHandler(this, &App::OnResuming); -} - -/// -/// Invoked when the application is launched normally by the end user. Other entry points -/// will be used such as when the application is launched to open a specific file. -/// -/// Details about the launch request and process. -void App::OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e) -{ - // if our app is prelaunched do nothing - // see https://msdn.microsoft.com/en-us/windows/uwp/launch-resume/handle-app-prelaunch - if (e->PrelaunchActivated) - { - return; - } - - auto rootFrame = dynamic_cast(Window::Current->Content); - - // Do not repeat app initialization when the Window already has content, - // just ensure that the window is active - if (rootFrame == nullptr) - { - // Create a Frame to act as the navigation context and associate it with - // a SuspensionManager key - rootFrame = ref new Frame(); - - rootFrame->NavigationFailed += ref new Windows::UI::Xaml::Navigation::NavigationFailedEventHandler(this, &App::OnNavigationFailed); - - if (e->PreviousExecutionState == ApplicationExecutionState::Terminated) - { - // TODO: Restore the saved session state only when appropriate, scheduling the - // final launch steps after the restore is complete - - } - - // Place the frame in the current Window - Window::Current->Content = rootFrame; - // Ensure the current window is active - } - - if (rootFrame->Content == nullptr) - { - // When the navigation stack isn't restored navigate to the first page, - // configuring the new page by passing required information as a navigation - // parameter - rootFrame->Content = mPage = ref new OpenGLESPage(&mOpenGLES); - } - // Ensure the current window is active - Window::Current->Activate(); -} - - -/// -/// Invoked when application execution is being suspended. Application state is saved -/// without knowing whether the application will be terminated or resumed with the contents -/// of memory still intact. -/// -void App::OnSuspending(Object^ sender, SuspendingEventArgs^ e) -{ - (void)sender; // Unused parameter - (void)e; // Unused parameter - - if (mPage) - { - mPage->SetVisibility(false); - } -} - -/// -/// Invoked when application execution is being resumed. -/// -/// The source of the resume request. -/// Details about the resume request. -void App::OnResuming(Object ^sender, Object ^args) -{ - (void)sender; // Unused parameter - (void)args; // Unused parameter - - if (mPage) - { - mPage->SetVisibility(true); - } -} - -/// -/// Invoked when Navigation to a certain page fails -/// -/// The Frame which failed navigation -/// Details about the navigation failure -void App::OnNavigationFailed(Platform::Object ^sender, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs ^e) -{ - throw ref new FailureException("Failed to load Page " + e->SourcePageType.Name); -} - - - - diff --git a/tests/cpp-empty-test/proj.win10/App.xaml.h b/tests/cpp-empty-test/proj.win10/App.xaml.h deleted file mode 100644 index 57c7f8d8c1ab..000000000000 --- a/tests/cpp-empty-test/proj.win10/App.xaml.h +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - ****************************************************************************/ - -#pragma once - -#include "app.g.h" -#include "OpenGLES.h" -#include "OpenGLESPage.xaml.h" - -namespace CocosAppWinRT -{ - ref class App sealed - { - public: - App(); - virtual void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e) override; - - private: - void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ e); - void OnResuming(Platform::Object ^sender, Platform::Object ^args); - void OnNavigationFailed(Platform::Object ^sender, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs ^e); - - OpenGLESPage^ mPage; - OpenGLES mOpenGLES; - }; -} diff --git a/tests/cpp-empty-test/proj.win10/Assets/LockScreenLogo.scale-200.png b/tests/cpp-empty-test/proj.win10/Assets/LockScreenLogo.scale-200.png deleted file mode 100644 index 055398215c83..000000000000 Binary files a/tests/cpp-empty-test/proj.win10/Assets/LockScreenLogo.scale-200.png and /dev/null differ diff --git a/tests/cpp-empty-test/proj.win10/Assets/SplashScreen.scale-200.png b/tests/cpp-empty-test/proj.win10/Assets/SplashScreen.scale-200.png deleted file mode 100644 index 45b53284c7fb..000000000000 Binary files a/tests/cpp-empty-test/proj.win10/Assets/SplashScreen.scale-200.png and /dev/null differ diff --git a/tests/cpp-empty-test/proj.win10/Assets/Square150x150Logo.scale-200.png b/tests/cpp-empty-test/proj.win10/Assets/Square150x150Logo.scale-200.png deleted file mode 100644 index b1fb1b20f2ef..000000000000 Binary files a/tests/cpp-empty-test/proj.win10/Assets/Square150x150Logo.scale-200.png and /dev/null differ diff --git a/tests/cpp-empty-test/proj.win10/Assets/Square44x44Logo.scale-200.png b/tests/cpp-empty-test/proj.win10/Assets/Square44x44Logo.scale-200.png deleted file mode 100644 index 0bec8473566f..000000000000 Binary files a/tests/cpp-empty-test/proj.win10/Assets/Square44x44Logo.scale-200.png and /dev/null differ diff --git a/tests/cpp-empty-test/proj.win10/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/tests/cpp-empty-test/proj.win10/Assets/Square44x44Logo.targetsize-24_altform-unplated.png deleted file mode 100644 index e46502e90b57..000000000000 Binary files a/tests/cpp-empty-test/proj.win10/Assets/Square44x44Logo.targetsize-24_altform-unplated.png and /dev/null differ diff --git a/tests/cpp-empty-test/proj.win10/Assets/StoreLogo.png b/tests/cpp-empty-test/proj.win10/Assets/StoreLogo.png deleted file mode 100644 index b225f8df5956..000000000000 Binary files a/tests/cpp-empty-test/proj.win10/Assets/StoreLogo.png and /dev/null differ diff --git a/tests/cpp-empty-test/proj.win10/Assets/Wide310x150Logo.scale-200.png b/tests/cpp-empty-test/proj.win10/Assets/Wide310x150Logo.scale-200.png deleted file mode 100644 index 1f86329a66b6..000000000000 Binary files a/tests/cpp-empty-test/proj.win10/Assets/Wide310x150Logo.scale-200.png and /dev/null differ diff --git a/tests/cpp-empty-test/proj.win10/Package.appxmanifest b/tests/cpp-empty-test/proj.win10/Package.appxmanifest deleted file mode 100644 index faf45568f3ec..000000000000 --- a/tests/cpp-empty-test/proj.win10/Package.appxmanifest +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - cpp-empty-test - Microsoft Open Technologies, Inc. - Assets\StoreLogo.png - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/cpp-empty-test/proj.win10/cpp-empty-test.vcxproj b/tests/cpp-empty-test/proj.win10/cpp-empty-test.vcxproj deleted file mode 100644 index 149228aed759..000000000000 --- a/tests/cpp-empty-test/proj.win10/cpp-empty-test.vcxproj +++ /dev/null @@ -1,381 +0,0 @@ - - - - {87ed86e7-a850-433f-88d5-d5f65cff7bf5} - CocosAppWinRT - en-US - 14.0 - true - Windows Store - 8.2 - 10.0.10240.0 - 10.0.10240.0 - - - - - Debug - ARM - - - Debug - Win32 - - - Debug - x64 - - - Release - ARM - - - Release - Win32 - - - Release - x64 - - - - Application - true - v141 - - - Application - true - v141 - - - Application - true - v141 - - - Application - false - true - v141 - - - Application - false - true - v141 - - - Application - false - true - v141 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - cpp-empty-test_TemporaryKey.pfx - EC3927E758F5E53DC59521EED57869F363F39357 - - - false - - - false - - - false - - - false - - - false - - - false - - - - /Zm384 /bigobj %(AdditionalOptions) - 4453;28204;4251;4244;4056; - pch.h - false - ..\Classes;$(EngineRoot)cocos\platform\win8.1-universal;%(AdditionalIncludeDirectories) - ProgramDatabase - - - echo "Copying Windows 10.0 Universal App CPP template files" -xcopy "$(EngineRoot)tests\cpp-empty-test\proj.win10\App.xaml" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\*" /iycq -xcopy "$(EngineRoot)tests\cpp-empty-test\proj.win10\App.xaml.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\*" /iycq -xcopy "$(EngineRoot)tests\cpp-empty-test\proj.win10\App.xaml.h" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLESPage.xaml" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\Cocos2dEngine\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLESPage.xaml.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\Cocos2dEngine\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLESPage.xaml.h" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\Cocos2dEngine\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLES.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\Cocos2dEngine\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLES.h" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\Cocos2dEngine\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\Cocos2dRenderer.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\Cocos2dEngine\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\Cocos2dRenderer.h" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\Cocos2dEngine\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\pch.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\pch.h" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\*" /iycq - - - MSVCRT;%(IgnoreSpecificDefaultLibraries) - - - - - /Zm384 /bigobj %(AdditionalOptions) - 4453;28204;4251;4244;4056; - pch.h - false - ..\Classes;$(EngineRoot)cocos\platform\win8.1-universal;%(AdditionalIncludeDirectories) - ProgramDatabase - - - echo "Copying Windows 10.0 Universal App CPP template files" -xcopy "$(EngineRoot)tests\cpp-empty-test\proj.win10\App.xaml" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\*" /iycq -xcopy "$(EngineRoot)tests\cpp-empty-test\proj.win10\App.xaml.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\*" /iycq -xcopy "$(EngineRoot)tests\cpp-empty-test\proj.win10\App.xaml.h" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLESPage.xaml" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\Cocos2dEngine\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLESPage.xaml.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\Cocos2dEngine\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLESPage.xaml.h" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\Cocos2dEngine\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLES.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\Cocos2dEngine\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLES.h" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\Cocos2dEngine\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\Cocos2dRenderer.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\Cocos2dEngine\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\Cocos2dRenderer.h" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\Cocos2dEngine\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\pch.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\pch.h" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\*" /iycq - - - - - /Zm384 /bigobj %(AdditionalOptions) - 4453;28204;4251;4244;4056; - pch.h - false - ..\Classes;$(EngineRoot)cocos\platform\win8.1-universal;%(AdditionalIncludeDirectories) - ProgramDatabase - - - echo "Copying Windows 10.0 Universal App CPP template files" -xcopy "$(EngineRoot)tests\cpp-empty-test\proj.win10\App.xaml" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\*" /iycq -xcopy "$(EngineRoot)tests\cpp-empty-test\proj.win10\App.xaml.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\*" /iycq -xcopy "$(EngineRoot)tests\cpp-empty-test\proj.win10\App.xaml.h" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLESPage.xaml" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\Cocos2dEngine\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLESPage.xaml.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\Cocos2dEngine\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLESPage.xaml.h" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\Cocos2dEngine\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLES.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\Cocos2dEngine\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLES.h" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\Cocos2dEngine\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\Cocos2dRenderer.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\Cocos2dEngine\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\Cocos2dRenderer.h" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\Cocos2dEngine\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\pch.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\pch.h" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\*" /iycq - - - MSVCRT;%(IgnoreSpecificDefaultLibraries) - - - - - /Zm384 /bigobj %(AdditionalOptions) - 4453;28204;4251;4244;4056; - pch.h - false - ..\Classes;$(EngineRoot)cocos\platform\win8.1-universal;%(AdditionalIncludeDirectories) - ProgramDatabase - - - echo "Copying Windows 10.0 Universal App CPP template files" -xcopy "$(EngineRoot)tests\cpp-empty-test\proj.win10\App.xaml" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\*" /iycq -xcopy "$(EngineRoot)tests\cpp-empty-test\proj.win10\App.xaml.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\*" /iycq -xcopy "$(EngineRoot)tests\cpp-empty-test\proj.win10\App.xaml.h" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLESPage.xaml" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\Cocos2dEngine\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLESPage.xaml.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\Cocos2dEngine\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLESPage.xaml.h" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\Cocos2dEngine\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLES.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\Cocos2dEngine\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLES.h" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\Cocos2dEngine\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\Cocos2dRenderer.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\Cocos2dEngine\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\Cocos2dRenderer.h" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\Cocos2dEngine\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\pch.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\pch.h" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\*" /iycq - - - - - /Zm384 /bigobj %(AdditionalOptions) - 4453;28204;4251;4244;4056; - pch.h - false - ..\Classes;$(EngineRoot)cocos\platform\win8.1-universal;%(AdditionalIncludeDirectories) - ProgramDatabase - - - echo "Copying Windows 10.0 Universal App CPP template files" -xcopy "$(EngineRoot)tests\cpp-empty-test\proj.win10\App.xaml" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\*" /iycq -xcopy "$(EngineRoot)tests\cpp-empty-test\proj.win10\App.xaml.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\*" /iycq -xcopy "$(EngineRoot)tests\cpp-empty-test\proj.win10\App.xaml.h" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLESPage.xaml" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\Cocos2dEngine\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLESPage.xaml.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\Cocos2dEngine\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLESPage.xaml.h" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\Cocos2dEngine\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLES.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\Cocos2dEngine\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLES.h" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\Cocos2dEngine\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\Cocos2dRenderer.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\Cocos2dEngine\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\Cocos2dRenderer.h" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\Cocos2dEngine\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\pch.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\pch.h" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\*" /iycq - - - MSVCRT;%(IgnoreSpecificDefaultLibraries) - - - - - /Zm384 /bigobj %(AdditionalOptions) - 4453;28204;4251;4244;4056; - pch.h - false - ..\Classes;$(EngineRoot)cocos\platform\win8.1-universal;%(AdditionalIncludeDirectories) - ProgramDatabase - - - echo "Copying Windows 10.0 Universal App CPP template files" -xcopy "$(EngineRoot)tests\cpp-empty-test\proj.win10\App.xaml" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\*" /iycq -xcopy "$(EngineRoot)tests\cpp-empty-test\proj.win10\App.xaml.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\*" /iycq -xcopy "$(EngineRoot)tests\cpp-empty-test\proj.win10\App.xaml.h" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLESPage.xaml" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\Cocos2dEngine\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLESPage.xaml.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\Cocos2dEngine\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLESPage.xaml.h" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\Cocos2dEngine\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLES.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\Cocos2dEngine\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\OpenGLES.h" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\Cocos2dEngine\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\Cocos2dRenderer.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\Cocos2dEngine\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\Cocos2dRenderer.h" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\Cocos2dEngine\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\pch.cpp" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\*" /iycq -xcopy "$(EngineRoot)cocos\platform\win8.1-universal\pch.h" "$(EngineRoot)templates\cpp-template-default\proj.win10\App\*" /iycq - - - - - - - ..\..\..\cocos\platform\win8.1-universal\OpenGLESPage.xaml - - - - - - - App.xaml - - - - - Designer - - - - - Designer - - - - - - - - ..\..\..\cocos\platform\win8.1-universal\OpenGLESPage.xaml - - - Create - Create - Create - Create - Create - Create - - - - - App.xaml - - - - - {07c2895d-720c-487d-b7b4-12c293ea533f} - - - {4b3ba10a-941f-4e08-8a50-8a7fcb822bb8} - - - {0c32d479-46d5-46c3-9aa9-0a8ff8320516} - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/cpp-empty-test/proj.win10/cpp-empty-test.vcxproj.filters b/tests/cpp-empty-test/proj.win10/cpp-empty-test.vcxproj.filters deleted file mode 100644 index ae117eac6baf..000000000000 --- a/tests/cpp-empty-test/proj.win10/cpp-empty-test.vcxproj.filters +++ /dev/null @@ -1,86 +0,0 @@ - - - - - 3d6eacf1-453c-497e-abc1-ba958539b0a5 - bmp;fbx;gif;jpg;jpeg;tga;tiff;tif;png - - - {482632c3-0bc4-4037-b656-2646b14d761f} - - - - - - - - - Classes - - - Classes - - - - - - - - - - Classes - - - Classes - - - Classes - - - - - - - - - - - - - - - - - - - - - - - - - - - - Assets - - - Assets - - - Assets - - - Assets - - - Assets - - - Assets - - - Assets - - - \ No newline at end of file diff --git a/tests/cpp-empty-test/proj.win10/cpp-empty-test_TemporaryKey.pfx b/tests/cpp-empty-test/proj.win10/cpp-empty-test_TemporaryKey.pfx deleted file mode 100644 index 8275f7ebd84c..000000000000 Binary files a/tests/cpp-empty-test/proj.win10/cpp-empty-test_TemporaryKey.pfx and /dev/null differ diff --git a/tests/cpp-empty-test/proj.win10/resources.props b/tests/cpp-empty-test/proj.win10/resources.props deleted file mode 100644 index 27ed6639498e..000000000000 --- a/tests/cpp-empty-test/proj.win10/resources.props +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - <_CustomResource Include="..\Resources\**\*"> - Assets\Resources\%(RecursiveDir)%(FileName)%(Extension) - true - - - - - - - - - - - diff --git a/tests/cpp-empty-test/proj.win32/cpp-empty-test.vcxproj b/tests/cpp-empty-test/proj.win32/cpp-empty-test.vcxproj index afc79623470e..6222d48ce909 100644 --- a/tests/cpp-empty-test/proj.win32/cpp-empty-test.vcxproj +++ b/tests/cpp-empty-test/proj.win32/cpp-empty-test.vcxproj @@ -14,6 +14,7 @@ {B8BF9E81-35FD-4582-BA1C-B85FA365BABB} cpp-empty-test-win32 Win32Proj + 10.0.17134.0 @@ -99,7 +100,7 @@ -xcopy "$(ProjectDir)..\Resources" "$(OutDir)" /D /E /I /F /Y +xcopy "$(ProjectDir)..\Resources" "$(OutDir)\Resources\" /D /E /I /F /Y xcopy "$(OutDir)..\*.dll" "$(OutDir)" /D /Y @@ -136,7 +137,7 @@ xcopy "$(OutDir)..\*.dll" "$(OutDir)" /D /Y -xcopy "$(ProjectDir)..\Resources" "$(OutDir)" /D /E /I /F /Y +xcopy "$(ProjectDir)..\Resources" "$(OutDir)\Resources\" /D /E /I /F /Y xcopy "$(OutDir)..\*.dll" "$(OutDir)" /D /Y diff --git a/tests/cpp-tests/CMakeLists.txt b/tests/cpp-tests/CMakeLists.txt index 621adf33110e..a9149e9f05c9 100644 --- a/tests/cpp-tests/CMakeLists.txt +++ b/tests/cpp-tests/CMakeLists.txt @@ -9,9 +9,7 @@ if(NOT DEFINED BUILD_ENGINE_DONE) set(CMAKE_MODULE_PATH ${COCOS2DX_ROOT_PATH}/cmake/Modules/) include(CocosBuildSet) - if(NOT USE_COCOS_PREBUILT) - add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos ${ENGINE_BINARY_PATH}/cocos/core) - endif() + add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos ${ENGINE_BINARY_PATH}/cocos/core) endif() # record sources, headers, resources... @@ -70,7 +68,6 @@ elseif(APPLE) proj.mac/Icon.icns proj.mac/Info.plist proj.mac/Prefix.pch - proj.mac/en.lproj/MainMenu.xib proj.mac/en.lproj/InfoPlist.strings ) list(APPEND GAME_SOURCE @@ -347,7 +344,7 @@ if(ANDROID OR IOS) ) endif() -if(WIN32 OR MACOSX OR LINUX) +if(WINDOWS OR MACOSX OR LINUX) list(APPEND GAME_HEADER Classes/WindowTest/WindowTest.h Classes/BugsTest/Bug-14327.h @@ -358,97 +355,86 @@ if(WIN32 OR MACOSX OR LINUX) ) endif() -if(USE_BOX2D) - list(APPEND GAME_HEADER - Classes/Box2DTest/Box2dTest.cpp - Classes/Box2DTestBed/Test.h - Classes/Box2DTestBed/Tests/Chain.h - Classes/Box2DTestBed/Tests/Confined.h - Classes/Box2DTestBed/Tests/PolyCollision.h - Classes/Box2DTestBed/Tests/EdgeTest.h - Classes/Box2DTestBed/Tests/ApplyForce.h - Classes/Box2DTestBed/Tests/Gears.h - Classes/Box2DTestBed/Tests/SliderCrank.h - Classes/Box2DTestBed/Tests/ContinuousTest.h - Classes/Box2DTestBed/Tests/Revolute.h - Classes/Box2DTestBed/Tests/TheoJansen.h - Classes/Box2DTestBed/Tests/Bridge.h - Classes/Box2DTestBed/Tests/CollisionProcessing.h - Classes/Box2DTestBed/Tests/DistanceTest.h - Classes/Box2DTestBed/Tests/PolyShapes.h - Classes/Box2DTestBed/Tests/TimeOfImpact.h - Classes/Box2DTestBed/Tests/ConveyorBelt.h - Classes/Box2DTestBed/Tests/Tiles.h - Classes/Box2DTestBed/Tests/BulletTest.h - Classes/Box2DTestBed/Tests/MotorJoint.h - Classes/Box2DTestBed/Tests/Car.h - Classes/Box2DTestBed/Tests/Mobile.h - Classes/Box2DTestBed/Tests/VaryingFriction.h - Classes/Box2DTestBed/Tests/Rope.h - Classes/Box2DTestBed/Tests/SensorTest.h - Classes/Box2DTestBed/Tests/Pyramid.h - Classes/Box2DTestBed/Tests/VaryingRestitution.h - Classes/Box2DTestBed/Tests/RopeJoint.h - Classes/Box2DTestBed/Tests/VerticalStack.h - Classes/Box2DTestBed/Tests/MobileBalanced.h - Classes/Box2DTestBed/Tests/CompoundShapes.h - Classes/Box2DTestBed/Tests/CollisionFiltering.h - Classes/Box2DTestBed/Tests/Pulleys.h - Classes/Box2DTestBed/Tests/Breakable.h - Classes/Box2DTestBed/Tests/BodyTypes.h - Classes/Box2DTestBed/Tests/DumpShell.h - Classes/Box2DTestBed/Tests/ShapeEditing.h - Classes/Box2DTestBed/Tests/SphereStack.h - Classes/Box2DTestBed/Tests/OneSidedPlatform.h - Classes/Box2DTestBed/Tests/AddPair.h - Classes/Box2DTestBed/Tests/Pinball.h - Classes/Box2DTestBed/Tests/Tumbler.h - Classes/Box2DTestBed/Tests/RayCast.h - Classes/Box2DTestBed/Tests/ConvexHull.h - Classes/Box2DTestBed/Tests/EdgeShapes.h - Classes/Box2DTestBed/Tests/Prismatic.h - Classes/Box2DTestBed/Tests/Dominos.h - Classes/Box2DTestBed/Tests/Web.h - Classes/Box2DTestBed/Tests/CharacterCollision.h - Classes/Box2DTestBed/Tests/DynamicTreeTest.h - Classes/Box2DTestBed/Tests/Cantilever.h - Classes/Box2DTestBed/Box2dView.h - Classes/Box2DTestBed/GLES-Render.h - ) - list(APPEND GAME_SOURCE - Classes/Box2DTest/Box2dTest.cpp - Classes/Box2DTestBed/Box2dView.cpp - Classes/Box2DTestBed/GLES-Render.cpp - Classes/Box2DTestBed/Test.cpp - Classes/Box2DTestBed/TestEntries.cpp - ) - include_directories(${Box2D_INCLUDE_DIRS}) -endif() - -if(USE_BULLET) - list(APPEND GAME_HEADER - Classes/Physics3DTest/Physics3DTest.h - Classes/NavMeshTest/NavMeshTest.h - ) - list(APPEND GAME_SOURCE - Classes/Physics3DTest/Physics3DTest.cpp - Classes/NavMeshTest/NavMeshTest.cpp - ) - include_directories(${BULLET_INCLUDE_DIRS}) -endif() - +list(APPEND GAME_HEADER + Classes/Box2DTest/Box2dTest.cpp + Classes/Box2DTestBed/Test.h + Classes/Box2DTestBed/Tests/Chain.h + Classes/Box2DTestBed/Tests/Confined.h + Classes/Box2DTestBed/Tests/PolyCollision.h + Classes/Box2DTestBed/Tests/EdgeTest.h + Classes/Box2DTestBed/Tests/ApplyForce.h + Classes/Box2DTestBed/Tests/Gears.h + Classes/Box2DTestBed/Tests/SliderCrank.h + Classes/Box2DTestBed/Tests/ContinuousTest.h + Classes/Box2DTestBed/Tests/Revolute.h + Classes/Box2DTestBed/Tests/TheoJansen.h + Classes/Box2DTestBed/Tests/Bridge.h + Classes/Box2DTestBed/Tests/CollisionProcessing.h + Classes/Box2DTestBed/Tests/DistanceTest.h + Classes/Box2DTestBed/Tests/PolyShapes.h + Classes/Box2DTestBed/Tests/TimeOfImpact.h + Classes/Box2DTestBed/Tests/ConveyorBelt.h + Classes/Box2DTestBed/Tests/Tiles.h + Classes/Box2DTestBed/Tests/BulletTest.h + Classes/Box2DTestBed/Tests/MotorJoint.h + Classes/Box2DTestBed/Tests/Car.h + Classes/Box2DTestBed/Tests/Mobile.h + Classes/Box2DTestBed/Tests/VaryingFriction.h + Classes/Box2DTestBed/Tests/Rope.h + Classes/Box2DTestBed/Tests/SensorTest.h + Classes/Box2DTestBed/Tests/Pyramid.h + Classes/Box2DTestBed/Tests/VaryingRestitution.h + Classes/Box2DTestBed/Tests/RopeJoint.h + Classes/Box2DTestBed/Tests/VerticalStack.h + Classes/Box2DTestBed/Tests/MobileBalanced.h + Classes/Box2DTestBed/Tests/CompoundShapes.h + Classes/Box2DTestBed/Tests/CollisionFiltering.h + Classes/Box2DTestBed/Tests/Pulleys.h + Classes/Box2DTestBed/Tests/Breakable.h + Classes/Box2DTestBed/Tests/BodyTypes.h + Classes/Box2DTestBed/Tests/DumpShell.h + Classes/Box2DTestBed/Tests/ShapeEditing.h + Classes/Box2DTestBed/Tests/SphereStack.h + Classes/Box2DTestBed/Tests/OneSidedPlatform.h + Classes/Box2DTestBed/Tests/AddPair.h + Classes/Box2DTestBed/Tests/Pinball.h + Classes/Box2DTestBed/Tests/Tumbler.h + Classes/Box2DTestBed/Tests/RayCast.h + Classes/Box2DTestBed/Tests/ConvexHull.h + Classes/Box2DTestBed/Tests/EdgeShapes.h + Classes/Box2DTestBed/Tests/Prismatic.h + Classes/Box2DTestBed/Tests/Dominos.h + Classes/Box2DTestBed/Tests/Web.h + Classes/Box2DTestBed/Tests/CharacterCollision.h + Classes/Box2DTestBed/Tests/DynamicTreeTest.h + Classes/Box2DTestBed/Tests/Cantilever.h + Classes/Box2DTestBed/Box2dView.h + Classes/Box2DTestBed/GLES-Render.h + ) +list(APPEND GAME_SOURCE + Classes/Box2DTest/Box2dTest.cpp + Classes/Box2DTestBed/Box2dView.cpp + Classes/Box2DTestBed/GLES-Render.cpp + Classes/Box2DTestBed/Test.cpp + Classes/Box2DTestBed/TestEntries.cpp + ) -if(USE_CHIPMUNK) - include_directories(${CHIPMUNK_INCLUDE_DIRS}) - list(APPEND GAME_HEADER - Classes/PhysicsTest/PhysicsTest.h - Classes/ChipmunkTest/ChipmunkTest.h - ) - list(APPEND GAME_SOURCE - Classes/PhysicsTest/PhysicsTest.cpp - Classes/ChipmunkTest/ChipmunkTest.cpp - ) -endif() +list(APPEND GAME_HEADER + Classes/Physics3DTest/Physics3DTest.h + Classes/NavMeshTest/NavMeshTest.h + ) +list(APPEND GAME_SOURCE + Classes/Physics3DTest/Physics3DTest.cpp + Classes/NavMeshTest/NavMeshTest.cpp + ) +list(APPEND GAME_HEADER + Classes/PhysicsTest/PhysicsTest.h + Classes/ChipmunkTest/ChipmunkTest.h + ) +list(APPEND GAME_SOURCE + Classes/PhysicsTest/PhysicsTest.cpp + Classes/ChipmunkTest/ChipmunkTest.cpp + ) if(NOT LINUX) list(APPEND GAME_SOURCE @@ -486,11 +472,22 @@ if(APPLE) elseif(IOS) cocos_pak_xcode(${APP_NAME} INFO_PLIST "iOSBundleInfo.plist.in") set_xcode_property(${APP_NAME} ASSETCATALOG_COMPILER_APPICON_NAME "AppIcon-${APP_NAME}") + set_xcode_property(${APP_NAME} DEVELOPMENT_TEAM "") + set_xcode_property(${APP_NAME} CODE_SIGN_IDENTITY "iPhone Developer") endif() elseif(WINDOWS) - cocos_copy_target_dll(${APP_NAME} COPY_TO ${APP_RES_DIR}) + # "too large PDB" error often occurs in cpp-tests when using default "/Zi" + target_compile_options(${APP_NAME} PRIVATE /Z7) + cocos_copy_target_dll(${APP_NAME}) endif() if(LINUX OR WINDOWS) - cocos_copy_res(COPY_TO ${APP_RES_DIR} FOLDERS ${GAME_RES_FOLDER}) + set(APP_RES_DIR "$/Resources") + cocos_copy_target_res(${APP_NAME} COPY_TO ${APP_RES_DIR} FOLDERS ${GAME_RES_FOLDER}) +endif() + +if(${CMAKE_VERSION} VERSION_GREATER "3.16.0") + message("CMake 3.16 target_precompile_headers") + target_precompile_headers(${APP_NAME} PRIVATE + "$<$:precheader.h>") endif() diff --git a/tests/cpp-tests/Classes/ActionManagerTest/ActionManagerTest.cpp b/tests/cpp-tests/Classes/ActionManagerTest/ActionManagerTest.cpp index 522ebcedb045..2379f1114ab9 100644 --- a/tests/cpp-tests/Classes/ActionManagerTest/ActionManagerTest.cpp +++ b/tests/cpp-tests/Classes/ActionManagerTest/ActionManagerTest.cpp @@ -53,11 +53,11 @@ ActionManagerTests::ActionManagerTests() // //------------------------------------------------------------------ -ActionManagerTest::ActionManagerTest(void) +ActionManagerTest::ActionManagerTest() { } -ActionManagerTest::~ActionManagerTest(void) +ActionManagerTest::~ActionManagerTest() { } diff --git a/tests/cpp-tests/Classes/ActionsEaseTest/ActionsEaseTest.cpp b/tests/cpp-tests/Classes/ActionsEaseTest/ActionsEaseTest.cpp index 7c2bf8e97ad9..5ade740c8e94 100644 --- a/tests/cpp-tests/Classes/ActionsEaseTest/ActionsEaseTest.cpp +++ b/tests/cpp-tests/Classes/ActionsEaseTest/ActionsEaseTest.cpp @@ -1003,11 +1003,11 @@ ActionsEaseTests::ActionsEaseTests() ADD_TEST_CASE(SpeedTest); } -EaseSpriteDemo::EaseSpriteDemo(void) +EaseSpriteDemo::EaseSpriteDemo() { } -EaseSpriteDemo::~EaseSpriteDemo(void) +EaseSpriteDemo::~EaseSpriteDemo() { _grossini->release(); _tamara->release(); diff --git a/tests/cpp-tests/Classes/ActionsProgressTest/ActionsProgressTest.cpp b/tests/cpp-tests/Classes/ActionsProgressTest/ActionsProgressTest.cpp index 32c9672b3160..1d0cf458c63f 100644 --- a/tests/cpp-tests/Classes/ActionsProgressTest/ActionsProgressTest.cpp +++ b/tests/cpp-tests/Classes/ActionsProgressTest/ActionsProgressTest.cpp @@ -45,11 +45,11 @@ ActionsProgressTests::ActionsProgressTests() // SpriteDemo // //------------------------------------------------------------------ -SpriteDemo::SpriteDemo(void) +SpriteDemo::SpriteDemo() { } -SpriteDemo::~SpriteDemo(void) +SpriteDemo::~SpriteDemo() { } diff --git a/tests/cpp-tests/Classes/AppDelegate.cpp b/tests/cpp-tests/Classes/AppDelegate.cpp index 62888b734757..1a226f454d2a 100644 --- a/tests/cpp-tests/Classes/AppDelegate.cpp +++ b/tests/cpp-tests/Classes/AppDelegate.cpp @@ -81,19 +81,19 @@ bool AppDelegate::applicationDidFinishLaunching() if (screenSize.height > 320) { auto resourceSize = Size(960, 640); - searchPaths.push_back("hd"); - searchPaths.push_back("ccs-res/hd"); - searchPaths.push_back("ccs-res"); - searchPaths.push_back("Manifests"); + searchPaths.emplace_back("hd"); + searchPaths.emplace_back("ccs-res/hd"); + searchPaths.emplace_back("ccs-res"); + searchPaths.emplace_back("Manifests"); director->setContentScaleFactor(resourceSize.height/designSize.height); - searchPaths.push_back("hd/ActionTimeline"); + searchPaths.emplace_back("hd/ActionTimeline"); } else { - searchPaths.push_back("ccs-res"); + searchPaths.emplace_back("ccs-res"); - searchPaths.push_back("ActionTimeline"); + searchPaths.emplace_back("ActionTimeline"); } fileUtils->setSearchPaths(searchPaths); diff --git a/tests/cpp-tests/Classes/BaseTest.cpp b/tests/cpp-tests/Classes/BaseTest.cpp index 39aa1f96e0f6..8e568adbcdbf 100644 --- a/tests/cpp-tests/Classes/BaseTest.cpp +++ b/tests/cpp-tests/Classes/BaseTest.cpp @@ -132,7 +132,7 @@ TestList::TestList() _shouldRestoreTableOffset = false; } -void TestList::addTest(const std::string& testName, std::function callback) +void TestList::addTest(const std::string& testName, const std::function& callback) { if (!testName.empty()) { @@ -184,9 +184,6 @@ void TestList::runThisTest() TestController::getInstance()->stopAutoTest(); TestController::destroyInstance(); Director::getInstance()->end(); -#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) - exit(0); -#endif }); closeItem->setPosition(VisibleRect::right().x - 30, VisibleRect::top().y - 30); @@ -194,7 +191,7 @@ void TestList::runThisTest() auto autoTestItem = MenuItemLabel::create(autoTestLabel, [&](Ref* sender){ TestController::getInstance()->startAutoTest(); }); - autoTestItem->setPosition(Vec2(VisibleRect::left().x + 60, VisibleRect::bottom().y + 50)); + autoTestItem->setPosition(Vec2(VisibleRect::right().x - 60, VisibleRect::bottom().y + 50)); auto menu = Menu::create(closeItem, autoTestItem, nullptr); menu->setPosition(Vec2::ZERO); @@ -259,7 +256,7 @@ ssize_t TestList::numberOfCellsInTableView(TableView *table) } //TestSuite -void TestSuite::addTestCase(const std::string& testName, std::function callback) +void TestSuite::addTestCase(const std::string& testName, const std::function& callback) { if (!testName.empty() && callback) { @@ -487,4 +484,4 @@ void TestCase::onBackCallback(Ref* sender) { _testSuite->backsUpOneLevel(); } -} \ No newline at end of file +} diff --git a/tests/cpp-tests/Classes/BaseTest.h b/tests/cpp-tests/Classes/BaseTest.h index 86237bb2e378..9f2a862185cd 100644 --- a/tests/cpp-tests/Classes/BaseTest.h +++ b/tests/cpp-tests/Classes/BaseTest.h @@ -157,7 +157,7 @@ class TestController; class TestSuite : public TestBase { public: - void addTestCase(const std::string& testName, std::function callback); + void addTestCase(const std::string& testName, const std::function& callback); virtual void restartCurrTest(); virtual void enterNextTest(); @@ -181,7 +181,7 @@ class TestList : public TestBase, public cocos2d::extension::TableViewDataSource public: TestList(); - void addTest(const std::string& testName, std::function callback); + void addTest(const std::string& testName, const std::function& callback); virtual void runThisTest() override; diff --git a/tests/cpp-tests/Classes/BillBoardTest/BillBoardTest.cpp b/tests/cpp-tests/Classes/BillBoardTest/BillBoardTest.cpp index 88cddd4632cf..99a28be7c2dd 100644 --- a/tests/cpp-tests/Classes/BillBoardTest/BillBoardTest.cpp +++ b/tests/cpp-tests/Classes/BillBoardTest/BillBoardTest.cpp @@ -28,6 +28,7 @@ #include "3d/CCBillBoard.h" #include +#include #include "../testResource.h" USING_NS_CC; @@ -134,7 +135,7 @@ BillBoardTest::BillBoardTest() for (unsigned int i = 0; i < 4; ++i) { Layer *layer = Layer::create(); - auto billboard = BillBoard::create(imgs[(unsigned int)(CCRANDOM_0_1() * 1 + 0.5)]); + auto billboard = BillBoard::create(imgs[(unsigned int)(std::lround(CCRANDOM_0_1()))]); billboard->setScale(0.5f); billboard->setPosition3D(Vec3(0.0f, 0.0f, CCRANDOM_MINUS1_1() * 150.0f)); billboard->setOpacity(CCRANDOM_0_1() * 128 + 128); @@ -238,7 +239,7 @@ void BillBoardTest::addNewBillBoardWithCoords(Vec3 p) std::string imgs[3] = {"Images/Icon.png", "Images/r2.png"}; for (unsigned int i = 0; i < 10; ++i) { - auto billboard = BillBoard::create(imgs[(unsigned int)(CCRANDOM_0_1() * 1 + 0.5)]); + auto billboard = BillBoard::create(imgs[(unsigned int)(std::lround(CCRANDOM_0_1()))]); billboard->setScale(0.5f); billboard->setPosition3D(Vec3(p.x, p.y, -150.0f + 30 * i)); billboard->setOpacity(CCRANDOM_0_1() * 128 + 128); diff --git a/tests/cpp-tests/Classes/Box2DTestBed/Box2dView.cpp b/tests/cpp-tests/Classes/Box2DTestBed/Box2dView.cpp index e4e2ff688a2f..8d9c123e044f 100644 --- a/tests/cpp-tests/Classes/Box2DTestBed/Box2dView.cpp +++ b/tests/cpp-tests/Classes/Box2DTestBed/Box2dView.cpp @@ -92,7 +92,7 @@ bool Box2dTestBed::initWithEntryID(int entryId) view->setScale(15); view->setAnchorPoint( Vec2(0,0) ); view->setPosition(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height/3); - auto label = Label::createWithTTF(view->title().c_str(), "fonts/arial.ttf", 28); + auto label = Label::createWithTTF(view->title(), "fonts/arial.ttf", 28); addChild(label, 1); label->setPosition(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height-50); @@ -128,7 +128,7 @@ void Box2dTestBed::onTouchMoved(Touch* touch, Event* event) // Box2DView // //------------------------------------------------------------------ -Box2DView::Box2DView(void) +Box2DView::Box2DView() { } @@ -188,7 +188,7 @@ void Box2DView::onDraw(const Mat4 &transform, uint32_t flags) director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, transform); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION); + GL::enableVertexAttribs( cocos2d::GL::VERTEX_ATTRIB_FLAG_POSITION ); m_test->Step(&settings); m_test->m_world->DrawDebugData(); CHECK_GL_ERROR_DEBUG(); diff --git a/tests/cpp-tests/Classes/Box2DTestBed/GLES-Render.cpp b/tests/cpp-tests/Classes/Box2DTestBed/GLES-Render.cpp index 4f9246206c2c..33e8362da37a 100644 --- a/tests/cpp-tests/Classes/Box2DTestBed/GLES-Render.cpp +++ b/tests/cpp-tests/Classes/Box2DTestBed/GLES-Render.cpp @@ -38,7 +38,7 @@ GLESDebugDraw::GLESDebugDraw( float32 ratio ) this->initShader(); } -void GLESDebugDraw::initShader( void ) +void GLESDebugDraw::initShader( ) { mShaderProgram = GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_NAME_POSITION_U_COLOR); diff --git a/tests/cpp-tests/Classes/Box2DTestBed/Test.h b/tests/cpp-tests/Classes/Box2DTestBed/Test.h index 7ec5b1c9f551..e34cfeb1fa25 100644 --- a/tests/cpp-tests/Classes/Box2DTestBed/Test.h +++ b/tests/cpp-tests/Classes/Box2DTestBed/Test.h @@ -19,7 +19,7 @@ #ifndef TEST_H #define TEST_H -#include +#include "Box2D/Box2D.h" #include "GLES-Render.h" #include diff --git a/tests/cpp-tests/Classes/BugsTest/Bug-1159.h b/tests/cpp-tests/Classes/BugsTest/Bug-1159.h index 01495fa91673..1a0e5a6a4998 100644 --- a/tests/cpp-tests/Classes/BugsTest/Bug-1159.h +++ b/tests/cpp-tests/Classes/BugsTest/Bug-1159.h @@ -32,6 +32,7 @@ class Bug1159Layer : public BugsTestBase public: virtual bool init() override; virtual void onExit() override; + virtual std::string title() const override { return "Bug1159";} void callBack(cocos2d::Ref* sender); diff --git a/tests/cpp-tests/Classes/BugsTest/Bug-1174.cpp b/tests/cpp-tests/Classes/BugsTest/Bug-1174.cpp index 0680e587abe7..6694207f939a 100644 --- a/tests/cpp-tests/Classes/BugsTest/Bug-1174.cpp +++ b/tests/cpp-tests/Classes/BugsTest/Bug-1174.cpp @@ -28,6 +28,7 @@ // #include "Bug-1174.h" +#include USING_NS_CC; @@ -47,7 +48,7 @@ int check_for_error( Vec2 p1, Vec2 p2, Vec2 p3, Vec2 p4, float s, float t ) auto hitPoint2 = p1 + p2_p1_s; // Since float has rounding errors, only check if diff is < 0.05 - if( (fabs( hitPoint1.x - hitPoint2.x) > 0.1f) || ( fabs(hitPoint1.y - hitPoint2.y) > 0.1f) ) + if( (std::fabs( hitPoint1.x - hitPoint2.x) > 0.1f) || ( std::fabs(hitPoint1.y - hitPoint2.y) > 0.1f) ) { log("ERROR: (%f,%f) != (%f,%f)", hitPoint1.x, hitPoint1.y, hitPoint2.x, hitPoint2.y); return 1; diff --git a/tests/cpp-tests/Classes/BugsTest/Bug-1174.h b/tests/cpp-tests/Classes/BugsTest/Bug-1174.h index d3d54537f6b3..0e01cc1db96e 100644 --- a/tests/cpp-tests/Classes/BugsTest/Bug-1174.h +++ b/tests/cpp-tests/Classes/BugsTest/Bug-1174.h @@ -31,7 +31,8 @@ class Bug1174Layer : public BugsTestBase { public: CREATE_FUNC(Bug1174Layer); - + virtual std::string title() const override { return "Bug1174";} + virtual std::string subtitle() const override {return "view console output";} virtual bool init() override; }; diff --git a/tests/cpp-tests/Classes/BugsTest/Bug-12847.h b/tests/cpp-tests/Classes/BugsTest/Bug-12847.h index 6322ab05f761..8516ca5432e4 100644 --- a/tests/cpp-tests/Classes/BugsTest/Bug-12847.h +++ b/tests/cpp-tests/Classes/BugsTest/Bug-12847.h @@ -34,6 +34,7 @@ class Bug12847Layer : public BugsTestBase virtual bool init() override; + virtual std::string title() const override { return "12874";} protected: virtual void update(float dt) override; virtual void onEnter() override; diff --git a/tests/cpp-tests/Classes/BugsTest/Bug-14327.h b/tests/cpp-tests/Classes/BugsTest/Bug-14327.h index 95ed5fecdcc9..b3777cc27e72 100644 --- a/tests/cpp-tests/Classes/BugsTest/Bug-14327.h +++ b/tests/cpp-tests/Classes/BugsTest/Bug-14327.h @@ -35,6 +35,7 @@ class Bug14327Layer : public BugsTestBase, public cocos2d::ui::EditBoxDelegate CREATE_FUNC(Bug14327Layer); virtual bool init() override; + virtual std::string title() const override { return "Bug14327";} virtual void editBoxEditingDidBegin(cocos2d::ui::EditBox* editBox) override; virtual void editBoxEditingDidEnd(cocos2d::ui::EditBox* editBox) override; diff --git a/tests/cpp-tests/Classes/BugsTest/Bug-15594.h b/tests/cpp-tests/Classes/BugsTest/Bug-15594.h index c0ac4f5327b5..c1613dd717a0 100644 --- a/tests/cpp-tests/Classes/BugsTest/Bug-15594.h +++ b/tests/cpp-tests/Classes/BugsTest/Bug-15594.h @@ -32,6 +32,7 @@ class Bug15594Layer : public BugsTestBase { public: CREATE_FUNC(Bug15594Layer); + virtual std::string title() const override { return "Bug15594";} virtual bool init() override; }; diff --git a/tests/cpp-tests/Classes/BugsTest/Bug-15776.h b/tests/cpp-tests/Classes/BugsTest/Bug-15776.h index 97d21f907cb7..a033b8d6438e 100644 --- a/tests/cpp-tests/Classes/BugsTest/Bug-15776.h +++ b/tests/cpp-tests/Classes/BugsTest/Bug-15776.h @@ -41,7 +41,6 @@ class Bug15776Layer : public BugsTestBase CREATE_FUNC(Bug15776Layer); virtual bool init() override; - virtual std::string title() const override; virtual std::string subtitle() const override; }; diff --git a/tests/cpp-tests/Classes/BugsTest/Bug-350.h b/tests/cpp-tests/Classes/BugsTest/Bug-350.h index 553fc4cee496..4e8982f70e34 100644 --- a/tests/cpp-tests/Classes/BugsTest/Bug-350.h +++ b/tests/cpp-tests/Classes/BugsTest/Bug-350.h @@ -33,6 +33,7 @@ class Bug350Layer : public BugsTestBase CREATE_FUNC(Bug350Layer); virtual bool init() override; + virtual std::string title() const override { return "Bug350";} }; #endif // __BUG_350_H__ diff --git a/tests/cpp-tests/Classes/BugsTest/Bug-422.h b/tests/cpp-tests/Classes/BugsTest/Bug-422.h index 928f225db1ce..d89182e2589f 100644 --- a/tests/cpp-tests/Classes/BugsTest/Bug-422.h +++ b/tests/cpp-tests/Classes/BugsTest/Bug-422.h @@ -34,6 +34,7 @@ class Bug422Layer : public BugsTestBase virtual bool init() override; + virtual std::string title() const override { return "Bug422";} void reset(); void check(Node* target); void menuCallback(cocos2d::Ref* sender); diff --git a/tests/cpp-tests/Classes/BugsTest/Bug-624.h b/tests/cpp-tests/Classes/BugsTest/Bug-624.h index a921a089950e..6f6b4c8e2c4b 100644 --- a/tests/cpp-tests/Classes/BugsTest/Bug-624.h +++ b/tests/cpp-tests/Classes/BugsTest/Bug-624.h @@ -35,6 +35,7 @@ class Bug624Layer : public BugsTestBase void switchLayer(float dt); virtual void onAcceleration(cocos2d::Acceleration* acc, cocos2d::Event* event); + virtual std::string title() const override { return "Bug624";} CREATE_FUNC(Bug624Layer); }; @@ -44,6 +45,8 @@ class Bug624Layer2 : public BugsTestBase virtual ~Bug624Layer2(); virtual bool init() override; void switchLayer(float dt); + virtual std::string title() const override { return "Bug624-2";} + virtual void onAcceleration(cocos2d::Acceleration* acc, cocos2d::Event* event); CREATE_FUNC(Bug624Layer2); diff --git a/tests/cpp-tests/Classes/BugsTest/Bug-886.h b/tests/cpp-tests/Classes/BugsTest/Bug-886.h index 0407bd552280..99f27e56ea77 100644 --- a/tests/cpp-tests/Classes/BugsTest/Bug-886.h +++ b/tests/cpp-tests/Classes/BugsTest/Bug-886.h @@ -32,6 +32,7 @@ class Bug886Layer : public BugsTestBase public: CREATE_FUNC(Bug886Layer); + virtual std::string title() const override { return "Bug886";} virtual bool init() override; }; diff --git a/tests/cpp-tests/Classes/BugsTest/Bug-899.h b/tests/cpp-tests/Classes/BugsTest/Bug-899.h index 1077ab6f4a84..f92d91228970 100644 --- a/tests/cpp-tests/Classes/BugsTest/Bug-899.h +++ b/tests/cpp-tests/Classes/BugsTest/Bug-899.h @@ -32,6 +32,7 @@ class Bug899Layer : public BugsTestBase public: CREATE_FUNC(Bug899Layer); + virtual std::string title() const override { return "Bug899";} virtual bool init() override; }; diff --git a/tests/cpp-tests/Classes/BugsTest/Bug-914.h b/tests/cpp-tests/Classes/BugsTest/Bug-914.h index 1a9df9133e59..498acaaed85b 100644 --- a/tests/cpp-tests/Classes/BugsTest/Bug-914.h +++ b/tests/cpp-tests/Classes/BugsTest/Bug-914.h @@ -32,6 +32,7 @@ class Bug914Layer : public BugsTestBase public: virtual bool init() override; + virtual std::string title() const override { return "Bug914";} void onTouchesMoved(const std::vector& touches, cocos2d::Event* event); void onTouchesBegan(const std::vector& touches, cocos2d::Event* event); void restart(cocos2d::Ref* sender); diff --git a/tests/cpp-tests/Classes/BugsTest/Bug-CCDrawNode.h b/tests/cpp-tests/Classes/BugsTest/Bug-CCDrawNode.h index ff8b5ec376a5..3f67901e0d60 100644 --- a/tests/cpp-tests/Classes/BugsTest/Bug-CCDrawNode.h +++ b/tests/cpp-tests/Classes/BugsTest/Bug-CCDrawNode.h @@ -32,7 +32,8 @@ class BugDrawNodeLayer : public BugsTestBase public: CREATE_FUNC(BugDrawNodeLayer); + virtual std::string title() const override { return "BugDrawNode";} virtual bool init() override; }; -#endif \ No newline at end of file +#endif diff --git a/tests/cpp-tests/Classes/BugsTest/Bug-Child.h b/tests/cpp-tests/Classes/BugsTest/Bug-Child.h index 5d1ff7d23bc0..118a325c0cdd 100644 --- a/tests/cpp-tests/Classes/BugsTest/Bug-Child.h +++ b/tests/cpp-tests/Classes/BugsTest/Bug-Child.h @@ -41,6 +41,7 @@ class BugChild : public BugsTestBase CREATE_FUNC(BugChild); virtual bool init() override; + virtual std::string title() const override { return "BugChild";} void switchChild(cocos2d::Ref* sender); @@ -61,6 +62,7 @@ class BugCameraMask : public BugsTestBase virtual bool init() override; + virtual std::string title() const override { return "BugCameraMask";} void switchSpriteFlag(cocos2d::Ref* sender); void updateSpriteMaskLabel(); Node* _sprite; diff --git a/tests/cpp-tests/Classes/BugsTest/BugsTest.h b/tests/cpp-tests/Classes/BugsTest/BugsTest.h index 6cf71dbc7728..d06a1cc9c7d4 100644 --- a/tests/cpp-tests/Classes/BugsTest/BugsTest.h +++ b/tests/cpp-tests/Classes/BugsTest/BugsTest.h @@ -30,7 +30,7 @@ class BugsTestBase : public TestCase { public: - + virtual std::string title() const override {return "No Test Title set";} }; DEFINE_TEST_SUITE(BugsTests); diff --git a/tests/cpp-tests/Classes/Camera3DTest/Camera3DTest.cpp b/tests/cpp-tests/Classes/Camera3DTest/Camera3DTest.cpp index 9302cec058e4..e6cb7ab8def7 100644 --- a/tests/cpp-tests/Classes/Camera3DTest/Camera3DTest.cpp +++ b/tests/cpp-tests/Classes/Camera3DTest/Camera3DTest.cpp @@ -25,6 +25,7 @@ THE SOFTWARE. ****************************************************************************/ #include "Camera3DTest.h" +#include #include "testResource.h" #include "ui/UISlider.h" @@ -175,7 +176,7 @@ void CameraRotationTest::update(float dt) // Camera3DTestDemo // //------------------------------------------------------------------ -Camera3DTestDemo::Camera3DTestDemo(void) +Camera3DTestDemo::Camera3DTestDemo() : _cameraType(CameraType::Free) , _incRot(nullptr) , _decRot(nullptr) @@ -186,7 +187,7 @@ Camera3DTestDemo::Camera3DTestDemo(void) , _bRotateRight(false) { } -Camera3DTestDemo::~Camera3DTestDemo(void) +Camera3DTestDemo::~Camera3DTestDemo() { } void Camera3DTestDemo::reachEndCallBack() @@ -378,7 +379,7 @@ void Camera3DTestDemo::onExit() } } -void Camera3DTestDemo::addNewSpriteWithCoords(Vec3 p,std::string fileName,bool playAnimation,float scale,bool bindCamera) +void Camera3DTestDemo::addNewSpriteWithCoords(Vec3 p,const std::string& fileName,bool playAnimation,float scale,bool bindCamera) { auto sprite = Sprite3D::create(fileName); _layer3D->addChild(sprite); @@ -700,7 +701,7 @@ void Camera3DTestDemo::onTouchesRotateRightEnd(Touch* touch, Event* event) //////////////////////////////////////////////////////////// // CameraCullingDemo -CameraCullingDemo::CameraCullingDemo(void) +CameraCullingDemo::CameraCullingDemo() : _layer3D(nullptr) , _cameraType(CameraType::FirstPerson) , _cameraFirst(nullptr) @@ -711,7 +712,7 @@ CameraCullingDemo::CameraCullingDemo(void) , _row(3) { } -CameraCullingDemo::~CameraCullingDemo(void) +CameraCullingDemo::~CameraCullingDemo() { } @@ -981,7 +982,7 @@ void CameraCullingDemo::drawCameraFrustum() //////////////////////////////////////////////////////////// // CameraArcBallDemo -CameraArcBallDemo::CameraArcBallDemo(void) +CameraArcBallDemo::CameraArcBallDemo() : CameraBaseTest() , _layer3D(nullptr) , _cameraType(CameraType::Free) @@ -996,7 +997,7 @@ CameraArcBallDemo::CameraArcBallDemo(void) , _sprite3D2(nullptr) { } -CameraArcBallDemo::~CameraArcBallDemo(void) +CameraArcBallDemo::~CameraArcBallDemo() { } @@ -1137,7 +1138,7 @@ void CameraArcBallDemo::calculateArcBall( cocos2d::Vec3 & axis, float & angle, f //clamp -1 to 1 if (t > 1.0) t = 1.0; if (t < -1.0) t = -1.0; - angle = asin(t); //rotation angle + angle = std::asin(t); //rotation angle } /* project an x,y pair onto a sphere of radius r or a @@ -1145,10 +1146,10 @@ hyperbolic sheet if we are away from the center of the sphere. */ float CameraArcBallDemo::projectToSphere( float r, float x, float y ) { float d, t, z; - d = sqrt(x*x + y*y); + d = std::sqrt(x*x + y*y); if (d < r * 0.70710678118654752440)//inside sphere { - z = sqrt(r*r - d*d); + z = std::sqrt(r*r - d*d); } else //on hyperbola { @@ -1203,7 +1204,7 @@ void CameraArcBallDemo::update(float dt) //////////////////////////////////////////////////////////// // FogTestDemo -FogTestDemo::FogTestDemo(void) +FogTestDemo::FogTestDemo() : CameraBaseTest() , _layer3D(nullptr) , _cameraType(CameraType::Free) @@ -1212,7 +1213,7 @@ FogTestDemo::FogTestDemo(void) , _state(nullptr) { } -FogTestDemo::~FogTestDemo(void) +FogTestDemo::~FogTestDemo() { } diff --git a/tests/cpp-tests/Classes/Camera3DTest/Camera3DTest.h b/tests/cpp-tests/Classes/Camera3DTest/Camera3DTest.h index d5ca24f43c53..e213a1241986 100644 --- a/tests/cpp-tests/Classes/Camera3DTest/Camera3DTest.h +++ b/tests/cpp-tests/Classes/Camera3DTest/Camera3DTest.h @@ -106,7 +106,7 @@ class Camera3DTestDemo : public CameraBaseTest virtual void onExit() override; // overrides virtual std::string title() const override; - void addNewSpriteWithCoords(cocos2d::Vec3 p,std::string fileName,bool playAnimation=false,float scale=1.0f,bool bindCamera=false); + void addNewSpriteWithCoords(cocos2d::Vec3 p,const std::string& fileName,bool playAnimation=false,float scale=1.0f,bool bindCamera=false); void onTouchesBegan(const std::vector& touches, cocos2d::Event *event); void onTouchesMoved(const std::vector& touches, cocos2d::Event *event); diff --git a/tests/cpp-tests/Classes/ClickAndMoveTest/ClickAndMoveTest.cpp b/tests/cpp-tests/Classes/ClickAndMoveTest/ClickAndMoveTest.cpp index 92f8ba1390f9..f513770a6b81 100644 --- a/tests/cpp-tests/Classes/ClickAndMoveTest/ClickAndMoveTest.cpp +++ b/tests/cpp-tests/Classes/ClickAndMoveTest/ClickAndMoveTest.cpp @@ -23,6 +23,7 @@ ****************************************************************************/ #include "ClickAndMoveTest.h" +#include #include "../testResource.h" USING_NS_CC; @@ -78,12 +79,12 @@ void ClickAndMoveTestCase::onTouchEnded(Touch* touch, Event *event) float a = location.y - s->getPosition().y; float at = (float) CC_RADIANS_TO_DEGREES( atanf( o/a) ); - if( a < 0 ) + if( a < 0) { - if( o < 0 ) - at = 180 + fabs(at); + if( o < 0 ) + at = 180 + std::fabs(at); else - at = 180 - fabs(at); + at = 180 - std::fabs(at); } s->runAction( RotateTo::create(1, at) ); diff --git a/tests/cpp-tests/Classes/ClippingNodeTest/ClippingNodeTest.cpp b/tests/cpp-tests/Classes/ClippingNodeTest/ClippingNodeTest.cpp index 6a7eddb8c259..de8516826565 100644 --- a/tests/cpp-tests/Classes/ClippingNodeTest/ClippingNodeTest.cpp +++ b/tests/cpp-tests/Classes/ClippingNodeTest/ClippingNodeTest.cpp @@ -663,7 +663,8 @@ void RawStencilBufferTest::onBeforeDrawClip(int planeIndex, const Vec2& pt) glProgram->setUniformsForBuiltins(); glProgram->setUniformLocationWith4fv(colorLocation, (GLfloat*) &color.r, 1); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION); + GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION ); + glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices); glDrawArrays(GL_TRIANGLE_FAN, 0, 4); @@ -692,7 +693,8 @@ void RawStencilBufferTest::onBeforeDrawSprite(int planeIndex, const Vec2& pt) glProgram->setUniformsForBuiltins(); glProgram->setUniformLocationWith4fv(colorLocation, (GLfloat*) &color.r, 1); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION); + GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION ); + glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices); glDrawArrays(GL_TRIANGLE_FAN, 0, 4); @@ -892,7 +894,8 @@ void RawStencilBufferTest6::setupStencilForClippingOnPlane(GLint plane) glProgram->setUniformsForBuiltins(); glProgram->setUniformLocationWith4fv(colorLocation, (GLfloat*) &color.r, 1); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION); + GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION ); + glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices); glDrawArrays(GL_TRIANGLE_FAN, 0, 4); diff --git a/tests/cpp-tests/Classes/CocosDenshionTest/CocosDenshionTest.cpp b/tests/cpp-tests/Classes/CocosDenshionTest/CocosDenshionTest.cpp index cbdc7094418c..27e6b5e3cb90 100644 --- a/tests/cpp-tests/Classes/CocosDenshionTest/CocosDenshionTest.cpp +++ b/tests/cpp-tests/Classes/CocosDenshionTest/CocosDenshionTest.cpp @@ -23,6 +23,7 @@ ****************************************************************************/ #include "CocosDenshionTest.h" +#include #include "cocos2d.h" #include "extensions/GUI/CCControlExtension/CCControlSlider.h" #include "audio/include/SimpleAudioEngine.h" @@ -426,13 +427,13 @@ void CocosDenshionTest::addChildAt(Node *node, float percentageX, float percenta void CocosDenshionTest::updateVolumes(float) { const float musicVolume = _sliderMusicVolume->getValue(); - if (fabs(musicVolume - _musicVolume) > 0.001) { + if (std::fabs(musicVolume - _musicVolume) > 0.001) { _musicVolume = musicVolume; SimpleAudioEngine::getInstance()->setBackgroundMusicVolume(_musicVolume); } const float effectsVolume = _sliderEffectsVolume->getValue(); - if (fabs(effectsVolume - _effectsVolume) > 0.001) { + if (std::fabs(effectsVolume - _effectsVolume) > 0.001) { _effectsVolume = effectsVolume; SimpleAudioEngine::getInstance()->setEffectsVolume(_effectsVolume); } diff --git a/tests/cpp-tests/Classes/ConsoleTest/ConsoleTest.cpp b/tests/cpp-tests/Classes/ConsoleTest/ConsoleTest.cpp index e177a2545f57..a6aaddfb1edd 100644 --- a/tests/cpp-tests/Classes/ConsoleTest/ConsoleTest.cpp +++ b/tests/cpp-tests/Classes/ConsoleTest/ConsoleTest.cpp @@ -55,7 +55,7 @@ BaseTestConsole::BaseTestConsole() { } -BaseTestConsole::~BaseTestConsole(void) +BaseTestConsole::~BaseTestConsole() { } diff --git a/tests/cpp-tests/Classes/DataVisitorTest/DataVisitorTest.cpp b/tests/cpp-tests/Classes/DataVisitorTest/DataVisitorTest.cpp index 1bfa5c8eab25..f852d0a9e4c8 100644 --- a/tests/cpp-tests/Classes/DataVisitorTest/DataVisitorTest.cpp +++ b/tests/cpp-tests/Classes/DataVisitorTest/DataVisitorTest.cpp @@ -69,14 +69,14 @@ void PrettyPrinterDemo::onEnter() TestCase::onEnter(); auto s = Director::getInstance()->getWinSize(); - auto label = Label::createWithTTF(title().c_str(), "fonts/arial.ttf", 28); + auto label = Label::createWithTTF(title(), "fonts/arial.ttf", 28); label->setPosition(s.width/2, s.height * 4/5); this->addChild(label, 1); std::string strSubtitle = subtitle(); if(strSubtitle.empty() == false) { - auto subLabel = Label::createWithTTF(strSubtitle.c_str(), "fonts/Thonburi.ttf", 16); + auto subLabel = Label::createWithTTF(strSubtitle, "fonts/Thonburi.ttf", 16); subLabel->setPosition(s.width/2, s.height * 3/5); this->addChild(subLabel, 1); } diff --git a/tests/cpp-tests/Classes/DownloaderTest/DownloaderTest.cpp b/tests/cpp-tests/Classes/DownloaderTest/DownloaderTest.cpp index 46c6c3586e0f..4b5a769759a9 100644 --- a/tests/cpp-tests/Classes/DownloaderTest/DownloaderTest.cpp +++ b/tests/cpp-tests/Classes/DownloaderTest/DownloaderTest.cpp @@ -37,15 +37,15 @@ USING_NS_CC; static const char* sURLList[] = { "http://www.cocos2d-x.org/attachments/802/cocos2dx_landscape.png", - "http://www.cocos2d-x.org/docs/manual/framework/native/wiki/logo-resources-of-cocos2d-x/res/2dx_icon_512_rounded.png", + "http://cocos2d-x.org/images/logo.png", "http://www.cocos2d-x.org/attachments/1503/no_exist.txt", // try to download no exist file - "http://download.sdkbox.com/installer/v1/sdkbox-iap_v2.3.6.1.tar.gz", + "https://github.com/openssl/openssl/archive/OpenSSL_1_1_1a.zip", }; const static int sListSize = (sizeof(sURLList)/sizeof(sURLList[0])); static const char* sNameList[sListSize] = { "cocos2dx_landscape.png", - "2dx_icon_512_rounded.png", + "logo.png", "inexist file", "big file", }; @@ -369,4 +369,4 @@ DownloaderTests::DownloaderTests() { ADD_TEST_CASE(DownloaderTest); ADD_TEST_CASE(DownloaderMultiTask); -}; +} diff --git a/tests/cpp-tests/Classes/DrawPrimitivesTest/DrawPrimitivesTest.cpp b/tests/cpp-tests/Classes/DrawPrimitivesTest/DrawPrimitivesTest.cpp index 0d4e4a82dc24..7d6f40bbe24e 100644 --- a/tests/cpp-tests/Classes/DrawPrimitivesTest/DrawPrimitivesTest.cpp +++ b/tests/cpp-tests/Classes/DrawPrimitivesTest/DrawPrimitivesTest.cpp @@ -43,6 +43,7 @@ DrawPrimitivesTests::DrawPrimitivesTests() ADD_TEST_CASE(DrawNodeTest); ADD_TEST_CASE(PrimitivesCommandTest); ADD_TEST_CASE(Issue11942Test); + ADD_TEST_CASE(Issue19641Test); } string DrawPrimitivesBaseTest::title() const @@ -436,6 +437,30 @@ string Issue11942Test::subtitle() const return "drawCircle() with width"; } +// +// Issue19641Tes +// Test draw a concave polygon +// +Issue19641Test::Issue19641Test() +{ + auto draw = DrawNode::create(); + addChild(draw, 10); + + auto s = Director::getInstance()->getWinSize(); + Vec2 concavePoints[] = { Vec2(s.width/2-70,130), Vec2(s.width/2+70,130), Vec2(s.width/2+70,160), Vec2(s.width/2+50,145), Vec2(s.width/2-40,145), Vec2(s.width/2-70,160) }; + draw->drawPolygon(concavePoints, sizeof(concavePoints)/sizeof(concavePoints[0]), Color4F(1,0,0,0.5), 4, Color4F(0,1,0,0.5)); +} + +string Issue19641Test::title() const +{ + return "GitHub Issue #19641"; +} + +string Issue19641Test::subtitle() const +{ + return "draw a concave polygon"; +} + #if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))) #pragma GCC diagnostic warning "-Wdeprecated-declarations" diff --git a/tests/cpp-tests/Classes/DrawPrimitivesTest/DrawPrimitivesTest.h b/tests/cpp-tests/Classes/DrawPrimitivesTest/DrawPrimitivesTest.h index ccbf03e5db40..91a79920d6dc 100644 --- a/tests/cpp-tests/Classes/DrawPrimitivesTest/DrawPrimitivesTest.h +++ b/tests/cpp-tests/Classes/DrawPrimitivesTest/DrawPrimitivesTest.h @@ -96,4 +96,16 @@ class Issue11942Test : public DrawPrimitivesBaseTest }; +class Issue19641Test : public DrawPrimitivesBaseTest +{ +public: + CREATE_FUNC(Issue19641Test); + + Issue19641Test(); + + virtual std::string title() const override; + virtual std::string subtitle() const override; + +}; + #endif diff --git a/tests/cpp-tests/Classes/EffectsAdvancedTest/EffectsAdvancedTest.cpp b/tests/cpp-tests/Classes/EffectsAdvancedTest/EffectsAdvancedTest.cpp index b7b6a64ac062..d0a9797bdfc0 100644 --- a/tests/cpp-tests/Classes/EffectsAdvancedTest/EffectsAdvancedTest.cpp +++ b/tests/cpp-tests/Classes/EffectsAdvancedTest/EffectsAdvancedTest.cpp @@ -307,7 +307,7 @@ std::string Issue631::subtitle() const // //------------------------------------------------------------------ -void EffectAdvanceBaseTest::onEnter(void) +void EffectAdvanceBaseTest::onEnter() { TestCase::onEnter(); @@ -344,7 +344,7 @@ void EffectAdvanceBaseTest::onEnter(void) } -EffectAdvanceBaseTest::~EffectAdvanceBaseTest(void) +EffectAdvanceBaseTest::~EffectAdvanceBaseTest() { } diff --git a/tests/cpp-tests/Classes/EffectsTest/EffectsTest.cpp b/tests/cpp-tests/Classes/EffectsTest/EffectsTest.cpp index e85330495a9a..985313baa74a 100644 --- a/tests/cpp-tests/Classes/EffectsTest/EffectsTest.cpp +++ b/tests/cpp-tests/Classes/EffectsTest/EffectsTest.cpp @@ -402,6 +402,6 @@ void EffectBaseTest::checkAnim(float dt) _gridNodeTarget->setGrid(nullptr); } -EffectBaseTest::~EffectBaseTest(void) +EffectBaseTest::~EffectBaseTest() { } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp index 6a73ca2cacbd..c9ba65df3f4d 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp @@ -33,6 +33,7 @@ using namespace cocos2d::network; HttpClientTests::HttpClientTests() { ADD_TEST_CASE(HttpClientTest); + ADD_TEST_CASE(HttpClientClearRequestsTest); } HttpClientTest::HttpClientTest() @@ -214,7 +215,7 @@ void HttpClientTest::onMenuPostTestClicked(cocos2d::Ref *sender, bool isImmediat request->setUrl("http://httpbin.org/post"); request->setRequestType(HttpRequest::Type::POST); std::vector headers; - headers.push_back("Content-Type: application/json; charset=utf-8"); + headers.emplace_back("Content-Type: application/json; charset=utf-8"); request->setHeaders(headers); request->setResponseCallback(CC_CALLBACK_2(HttpClientTest::onHttpRequestCompleted, this)); @@ -294,7 +295,7 @@ void HttpClientTest::onMenuPutTestClicked(Ref *sender, bool isImmediate) request->setUrl("http://httpbin.org/put"); request->setRequestType(HttpRequest::Type::PUT); std::vector headers; - headers.push_back("Content-Type: application/json; charset=utf-8"); + headers.emplace_back("Content-Type: application/json; charset=utf-8"); request->setHeaders(headers); request->setResponseCallback(CC_CALLBACK_2(HttpClientTest::onHttpRequestCompleted, this)); @@ -398,3 +399,149 @@ void HttpClientTest::onHttpRequestCompleted(HttpClient *sender, HttpResponse *re log("request ref count not 2, is %d", response->getHttpRequest()->getReferenceCount()); } } + + + + +HttpClientClearRequestsTest::HttpClientClearRequestsTest() +: _labelStatusCode(nullptr) +{ + auto winSize = Director::getInstance()->getWinSize(); + + const int MARGIN = 40; + const int SPACE = 35; + + const int CENTER = winSize.width / 2; + + auto menuRequest = Menu::create(); + menuRequest->setPosition(Vec2::ZERO); + addChild(menuRequest); + + // Get + auto labelGet = Label::createWithTTF("Test Clear all Get", "fonts/arial.ttf", 22); + auto itemGet = MenuItemLabel::create(labelGet, CC_CALLBACK_1(HttpClientClearRequestsTest::onMenuCancelAllClicked, this)); + itemGet->setPosition(CENTER, winSize.height - MARGIN - SPACE); + menuRequest->addChild(itemGet); + + // Post + auto labelPost = Label::createWithTTF("Test Clear but only with the tag DELETE", "fonts/arial.ttf", 22); + auto itemPost = MenuItemLabel::create(labelPost, CC_CALLBACK_1(HttpClientClearRequestsTest::onMenuCancelSomeClicked, this)); + itemPost->setPosition(CENTER, winSize.height - MARGIN - 2 * SPACE); + menuRequest->addChild(itemPost); + + // Response Code Label + _labelStatusCode = Label::createWithTTF("HTTP Status Code", "fonts/arial.ttf", 18); + _labelStatusCode->setPosition(winSize.width / 2, winSize.height - MARGIN - 6 * SPACE); + addChild(_labelStatusCode); + + // Tracking Data Label + _labelTrakingData = Label::createWithTTF("Got 0 of 0 expected http requests", "fonts/arial.ttf", 16); + _labelTrakingData->setPosition(CENTER, winSize.height - MARGIN - 5 * SPACE); + addChild(_labelTrakingData); + + _totalExpectedRequests = 0; + _totalProcessedRequests = 0; +} + +HttpClientClearRequestsTest::~HttpClientClearRequestsTest() +{ + HttpClient::destroyInstance(); +} + +void HttpClientClearRequestsTest::onMenuCancelAllClicked(cocos2d::Ref *sender) +{ + for (int i=0; i < 10; i++) + { + HttpRequest* request = new (std::nothrow) HttpRequest(); + std::stringstream url; + url << "http://cocos2d-x.org/images/logo.png?id=" << std::to_string(i); + request->setUrl(url.str()); + request->setRequestType(HttpRequest::Type::GET); + request->setResponseCallback(CC_CALLBACK_2(HttpClientClearRequestsTest::onHttpRequestCompleted, this)); + + url.str(""); + url << "TEST_" << std::to_string(i); + request->setTag(url.str()); + HttpClient::getInstance()->send(request); + request->release(); + } + + _totalProcessedRequests = 0; + _totalExpectedRequests = 1; + + HttpClient::getInstance()->setClearRequestPredicate(nullptr); + HttpClient::getInstance()->setClearResponsePredicate(nullptr); + HttpClient::getInstance()->clearResponseAndRequestQueue(); + + // waiting + _labelStatusCode->setString("waiting..."); +} + +void HttpClientClearRequestsTest::onMenuCancelSomeClicked(cocos2d::Ref *sender) +{ + // test 1 + for (int i=0; i < 10; i++) + { + HttpRequest* request = new (std::nothrow) HttpRequest(); + std::stringstream url; + url << "http://cocos2d-x.org/images/logo.png?id=" << std::to_string(i); + request->setUrl(url.str()); + request->setRequestType(HttpRequest::Type::GET); + request->setResponseCallback(CC_CALLBACK_2(HttpClientClearRequestsTest::onHttpRequestCompleted, this)); + + url.str(""); + if (i < 5) { + url << "TEST_" << std::to_string(i); + _totalExpectedRequests++; + } + else { + url << "DELETE_" << std::to_string(i); + } + request->setTag(url.str()); + HttpClient::getInstance()->send(request); + request->release(); + } + + HttpClient::getInstance()->setClearRequestPredicate([&](HttpRequest* req) + { + auto r = !!strstr(req->getTag(), "DELETE_"); + return r; + }); + HttpClient::getInstance()->setClearResponsePredicate(nullptr); + HttpClient::getInstance()->clearResponseAndRequestQueue(); + + + // waiting + _labelStatusCode->setString("waiting..."); + +} + +void HttpClientClearRequestsTest::onHttpRequestCompleted(HttpClient *sender, HttpResponse *response) +{ + if (!response) + { + return; + } + + // You can get original request type from: response->request->reqType + if (0 != strlen(response->getHttpRequest()->getTag())) + { + log("%s completed", response->getHttpRequest()->getTag()); + } + + long statusCode = response->getResponseCode(); + char statusString[64] = {}; + sprintf(statusString, "HTTP Status Code: %ld, tag = %s", statusCode, response->getHttpRequest()->getTag()); + _labelStatusCode->setString(statusString); + log("response code: %ld", statusCode); + + _totalProcessedRequests++; + sprintf(statusString, "Got %d of %d expected http requests", _totalProcessedRequests, _totalExpectedRequests); + _labelTrakingData->setString(statusString); + + if (!response->isSucceed()) + { + log("response failed"); + log("error buffer: %s", response->getErrorBuffer()); + } +} diff --git a/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/HttpClientTest.h b/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/HttpClientTest.h index 6605ff3b6038..72f88b23575f 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/HttpClientTest.h +++ b/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/HttpClientTest.h @@ -56,4 +56,28 @@ class HttpClientTest : public TestCase cocos2d::Label* _labelStatusCode; }; +class HttpClientClearRequestsTest : public TestCase +{ +public: + CREATE_FUNC(HttpClientClearRequestsTest); + + HttpClientClearRequestsTest(); + virtual ~HttpClientClearRequestsTest(); + + //Menu Callbacks + void onMenuCancelAllClicked(cocos2d::Ref *sender); + void onMenuCancelSomeClicked(cocos2d::Ref *sender); + + //Http Response Callback + void onHttpRequestCompleted(cocos2d::network::HttpClient *sender, cocos2d::network::HttpResponse *response); + + virtual std::string title() const override { return "Http Request Test"; } + +private: + int _totalExpectedRequests; + int _totalProcessedRequests; + cocos2d::Label* _labelTrakingData; + cocos2d::Label* _labelStatusCode; +}; + #endif //__HTTPREQUESTHTTP_H diff --git a/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/SocketIOTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/SocketIOTest.cpp index 98547525ec32..e67682dcf2fd 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/SocketIOTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/SocketIOTest.cpp @@ -108,7 +108,7 @@ SocketIOTest::SocketIOTest() } -SocketIOTest::~SocketIOTest(void) +SocketIOTest::~SocketIOTest() { } @@ -120,7 +120,7 @@ void SocketIOTest::testevent(SIOClient *client, const std::string& data) { std::stringstream s; s << client->getTag() << " received event testevent with data: " << data.c_str(); - _sioClientStatus->setString(s.str().c_str()); + _sioClientStatus->setString(s.str()); } @@ -131,7 +131,7 @@ void SocketIOTest::echotest(SIOClient *client, const std::string& data) { std::stringstream s; s << client->getTag() << " received event echotest with data: " << data.c_str(); - _sioClientStatus->setString(s.str().c_str()); + _sioClientStatus->setString(s.str()); } @@ -143,7 +143,7 @@ void SocketIOTest::message(network::SIOClient* client, const std::string& data) std::stringstream s; s << client->getTag() << " received message with content: " << data.c_str(); - _sioClientStatus->setString(s.str().c_str()); + _sioClientStatus->setString(s.str()); } @@ -153,7 +153,7 @@ void SocketIOTest::json(network::SIOClient* client, const std::string& data) std::stringstream s; s << client->getTag() << " received json message with content: " << data.c_str(); - _sioClientStatus->setString(s.str().c_str()); + _sioClientStatus->setString(s.str()); } @@ -163,7 +163,7 @@ void SocketIOTest::connect(network::SIOClient* client, const std::string& data) std::stringstream s; s << client->getTag() << " connected!"; - _sioClientStatus->setString(s.str().c_str()); + _sioClientStatus->setString(s.str()); } @@ -173,7 +173,7 @@ void SocketIOTest::disconnect(network::SIOClient* client, const std::string& dat std::stringstream s; s << client->getTag() << " disconnected by server!"; - _sioClientStatus->setString(s.str().c_str()); + _sioClientStatus->setString(s.str()); this->closedSocketAction(client); @@ -271,7 +271,7 @@ void SocketIOTest::onMenuTestClientDisconnectClicked(cocos2d::Ref *sender) s << "Socket.io Test Client not initialized!"; } - _sioClientStatus->setString(s.str().c_str()); + _sioClientStatus->setString(s.str()); } @@ -288,7 +288,7 @@ void SocketIOTest::onMenuTestEndpointDisconnectClicked(cocos2d::Ref *sender) s << "Socket.io Test Endpoint not initialized!"; } - _sioClientStatus->setString(s.str().c_str()); + _sioClientStatus->setString(s.str()); } @@ -300,7 +300,7 @@ void SocketIOTest::onClose(network::SIOClient* client) std::stringstream s; s << client->getTag() << " closed!"; - _sioClientStatus->setString(s.str().c_str()); + _sioClientStatus->setString(s.str()); this->closedSocketAction(client); @@ -312,5 +312,5 @@ void SocketIOTest::onError(network::SIOClient* client, const std::string& data) std::stringstream s; s << client->getTag() << " received error with content: " << data.c_str(); - _sioClientStatus->setString(s.str().c_str()); + _sioClientStatus->setString(s.str()); } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/WebSocketDelayTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/WebSocketDelayTest.cpp index 9cf7239f7100..926995864427 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/WebSocketDelayTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/WebSocketDelayTest.cpp @@ -98,8 +98,8 @@ void WebSocketDelayTest::startTestCallback(Ref* sender) _wsiSendText = new network::WebSocket(); std::vector protocols; - protocols.push_back("myprotocol_1"); - protocols.push_back("myprotocol_2"); + protocols.emplace_back("myprotocol_1"); + protocols.emplace_back("myprotocol_2"); if (!_wsiSendText->init(*this, "wss://echo.websocket.org", &protocols, "cacert.pem")) { CC_SAFE_DELETE(_wsiSendText); @@ -213,6 +213,6 @@ void WebSocketDelayTest::onMenuSendTextClicked(cocos2d::Ref *sender) { std::string warningStr = "send text websocket instance wasn't ready..."; log("%s", warningStr.c_str()); - _sendTextStatus->setString(warningStr.c_str()); + _sendTextStatus->setString(warningStr); } } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/WebSocketTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/WebSocketTest.cpp index 71177832cee0..c86e89271b4d 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/WebSocketTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/WebSocketTest.cpp @@ -135,8 +135,8 @@ void WebSocketTest::startTestCallback(Ref* sender) _wsiError = new network::WebSocket(); std::vector protocols; - protocols.push_back("myprotocol_1"); - protocols.push_back("myprotocol_2"); + protocols.emplace_back("myprotocol_1"); + protocols.emplace_back("myprotocol_2"); if (!_wsiSendText->init(*this, "wss://echo.websocket.org", &protocols, "cacert.pem")) { CC_SAFE_DELETE(_wsiSendText); @@ -147,7 +147,7 @@ void WebSocketTest::startTestCallback(Ref* sender) } protocols.erase(protocols.begin()); - if (!_wsiSendBinary->init(*this, "wss://echo.websocket.org", &protocols)) + if (!_wsiSendBinary->init(*this, "wss://echo.websocket.org", &protocols, "cacert.pem")) { CC_SAFE_DELETE(_wsiSendBinary); } @@ -197,7 +197,7 @@ void WebSocketTest::onMessage(network::WebSocket* ws, const network::WebSocket:: std::string textStr = std::string("response text msg: ")+data.bytes+", "+times; log("%s", textStr.c_str()); - _sendTextStatus->setString(textStr.c_str()); + _sendTextStatus->setString(textStr); } else { @@ -220,7 +220,7 @@ void WebSocketTest::onMessage(network::WebSocket* ws, const network::WebSocket:: binaryStr += std::string(", ")+times; log("%s", binaryStr.c_str()); - _sendBinaryStatus->setString(binaryStr.c_str()); + _sendBinaryStatus->setString(binaryStr); } } @@ -285,7 +285,7 @@ void WebSocketTest::onMenuSendTextClicked(cocos2d::Ref *sender) { std::string warningStr = "send text websocket instance wasn't ready..."; log("%s", warningStr.c_str()); - _sendTextStatus->setString(warningStr.c_str()); + _sendTextStatus->setString(warningStr); } } @@ -307,7 +307,7 @@ void WebSocketTest::onMenuSendMultipleTextClicked(cocos2d::Ref *sender) { std::string warningStr = "send text websocket instance wasn't ready..."; log("%s", warningStr.c_str()); - _sendTextStatus->setString(warningStr.c_str()); + _sendTextStatus->setString(warningStr); } } @@ -327,7 +327,7 @@ void WebSocketTest::onMenuSendBinaryClicked(cocos2d::Ref *sender) { std::string warningStr = "send binary websocket instance wasn't ready..."; log("%s", warningStr.c_str()); - _sendBinaryStatus->setString(warningStr.c_str()); + _sendBinaryStatus->setString(warningStr); } } @@ -346,9 +346,6 @@ WebSocketCloseTest::WebSocketCloseTest() auto closeItem = MenuItemImage::create(s_pathClose, s_pathClose, [](Ref* sender){ Director::getInstance()->end(); -#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) - exit(0); -#endif }); closeItem->setPosition(VisibleRect::right().x / 2, VisibleRect::top().y * 2 / 3); diff --git a/tests/cpp-tests/Classes/FileUtilsTest/FileUtilsTest.cpp b/tests/cpp-tests/Classes/FileUtilsTest/FileUtilsTest.cpp index 187dfe4a8fd7..60e60d8c1fb3 100644 --- a/tests/cpp-tests/Classes/FileUtilsTest/FileUtilsTest.cpp +++ b/tests/cpp-tests/Classes/FileUtilsTest/FileUtilsTest.cpp @@ -47,6 +47,8 @@ FileUtilsTests::FileUtilsTests() ADD_TEST_CASE(TestFileFuncsAsync); ADD_TEST_CASE(TestWriteStringAsync); ADD_TEST_CASE(TestWriteDataAsync); + ADD_TEST_CASE(TestListFiles); + ADD_TEST_CASE(TestIsFileExistRejectFolder); } // TestResolutionDirectories @@ -202,7 +204,7 @@ std::string TestSearchPath::title() const std::string TestSearchPath::subtitle() const { - return "See the console, can see a orange box and a 'about' picture"; + return "See the console, can see a orange box and a 'about' picture, except Android"; } // TestFilenameLookup @@ -561,7 +563,7 @@ void TextWritePlist::onEnter() else log("write plist file failed"); - auto label = Label::createWithTTF(fullPath.c_str(), "fonts/Thonburi.ttf", 6); + auto label = Label::createWithTTF(fullPath, "fonts/Thonburi.ttf", 6); this->addChild(label); auto winSize = Director::getInstance()->getWinSize(); label->setPosition(winSize.width/2, winSize.height/3); @@ -591,7 +593,7 @@ std::string TextWritePlist::title() const std::string TextWritePlist::subtitle() const { - std::string writablePath = FileUtils::getInstance()->getWritablePath().c_str(); + std::string writablePath = FileUtils::getInstance()->getWritablePath(); return ("See plist file at your writablePath"); } @@ -615,7 +617,7 @@ void TestWriteString::onEnter() // writeTest std::string writeDataStr = "the string data will be write into a file"; std::string fullPath = writablePath + fileName; - if (FileUtils::getInstance()->writeStringToFile(writeDataStr, fullPath.c_str())) + if (FileUtils::getInstance()->writeStringToFile(writeDataStr, fullPath)) { log("see the plist file at %s", fullPath.c_str()); writeResult->setString("write success:" + writeDataStr); @@ -715,7 +717,7 @@ void TestGetContents::onEnter() // Text read string in text mode std::string ts = fs->getStringFromFile(_generatedFile); - if (ts != "\r\n\r\n") + if (strcmp(ts.c_str(), "\r\n\r\n")!=0) return std::string("failed: read as zero terminated string"); @@ -791,7 +793,7 @@ void TestWriteData::onEnter() Data writeData; writeData.copy((unsigned char *)writeDataStr.c_str(), writeDataStr.size()); std::string fullPath = writablePath + fileName; - if (FileUtils::getInstance()->writeDataToFile(writeData, fullPath.c_str())) + if (FileUtils::getInstance()->writeDataToFile(writeData, fullPath)) { log("see the plist file at %s", fullPath.c_str()); writeResult->setString("write success:" + writeDataStr); @@ -879,7 +881,7 @@ void TestWriteValueMap::onEnter() // end with / std::string writablePath = FileUtils::getInstance()->getWritablePath(); std::string fullPath = writablePath + "testWriteValueMap.plist"; - if (FileUtils::getInstance()->writeValueMapToFile(valueMap, fullPath.c_str())) + if (FileUtils::getInstance()->writeValueMapToFile(valueMap, fullPath)) { log("see the plist file at %s", fullPath.c_str()); writeResult->setString("write success"); @@ -890,7 +892,7 @@ void TestWriteValueMap::onEnter() writeResult->setString("write failed"); } - ValueMap readValueMap = FileUtils::getInstance()->getValueMapFromFile(fullPath.c_str()); + ValueMap readValueMap = FileUtils::getInstance()->getValueMapFromFile(fullPath); std::string readDataStr = "read data:\n"; // read value map data ValueMap readMapInMap = readValueMap["data0"].asValueMap(); @@ -982,7 +984,7 @@ void TestWriteValueVector::onEnter() // end with / std::string writablePath = FileUtils::getInstance()->getWritablePath(); std::string fullPath = writablePath + "testWriteValueVector.plist"; - if (FileUtils::getInstance()->writeValueVectorToFile(array, fullPath.c_str())) + if (FileUtils::getInstance()->writeValueVectorToFile(array, fullPath)) { log("see the plist file at %s", fullPath.c_str()); writeResult->setString("write success"); @@ -993,7 +995,7 @@ void TestWriteValueVector::onEnter() writeResult->setString("write failed"); } - ValueVector readArray = FileUtils::getInstance()->getValueVectorFromFile(fullPath.c_str()); + ValueVector readArray = FileUtils::getInstance()->getValueVectorFromFile(fullPath); std::string readDataStr = "read data:\n"; // read value map data ValueMap readMapInArray = readArray.at(0).asValueMap(); @@ -1391,3 +1393,94 @@ std::string TestWriteDataAsync::subtitle() const { return ""; } + +void TestListFiles::onEnter() +{ + FileUtilsDemo::onEnter(); + + auto winSize = Director::getInstance()->getWinSize(); + + auto infoLabel = Label::createWithTTF("show file count, should not be 0", "fonts/Thonburi.ttf", 18); + this->addChild(infoLabel); + infoLabel->setPosition(winSize.width / 2, winSize.height * 3 / 4); + + auto cntLabel = Label::createWithTTF("show readResult", "fonts/Thonburi.ttf", 18); + this->addChild(cntLabel); + cntLabel->setPosition(winSize.width / 2, winSize.height / 3); + // writeTest + std::vector listFonts = FileUtils::getInstance()->listFiles("fonts"); + auto defaultPath = FileUtils::getInstance()->getDefaultResourceRootPath(); + std::vector list = FileUtils::getInstance()->listFiles (defaultPath); + + char cntBuffer[200] = { 0 }; + snprintf(cntBuffer, 200, "'fonts/' %zu, $defaultResourceRootPath %zu",listFonts.size(), list.size()); + + for(int i=0;isetString(cntBuffer); + +} + +void TestListFiles::onExit() +{ + FileUtilsDemo::onExit(); +} + +std::string TestListFiles::title() const +{ + return "FileUtils: list files of directory"; +} + +std::string TestListFiles::subtitle() const +{ + return ""; +} + + + +void TestIsFileExistRejectFolder::onEnter() +{ + FileUtilsDemo::onEnter(); + + auto winSize = Director::getInstance()->getWinSize(); + + auto infoLabel = Label::createWithTTF("tests folder 'NavMesh/maps', expect to be false", "fonts/Thonburi.ttf", 18); + this->addChild(infoLabel); + infoLabel->setPosition(winSize.width / 2, winSize.height * 3 / 4); + + auto cntLabel = Label::createWithTTF("waiting...", "fonts/Thonburi.ttf", 18); + this->addChild(cntLabel); + cntLabel->setPosition(winSize.width / 2, winSize.height / 3); + + auto exists = FileUtils::getInstance()->isFileExist("NavMesh/maps"); + auto isDirectory = FileUtils::getInstance()->isDirectoryExist("NavMesh/maps"); + + char cntBuffer[200] = { 0 }; + snprintf(cntBuffer, 200, "isDir: %s, isFile: %s", isDirectory ? "true": "false" , exists ? "true" : "false"); + cntLabel->setString(cntBuffer); + +} + +void TestIsFileExistRejectFolder::onExit() +{ + FileUtilsDemo::onExit(); +} + +std::string TestIsFileExistRejectFolder::title() const +{ + return "FileUtils: isFileExist(direname)"; +} + +std::string TestIsFileExistRejectFolder::subtitle() const +{ + return ""; +} diff --git a/tests/cpp-tests/Classes/FileUtilsTest/FileUtilsTest.h b/tests/cpp-tests/Classes/FileUtilsTest/FileUtilsTest.h index 3706ebc80019..34b8915dbc91 100644 --- a/tests/cpp-tests/Classes/FileUtilsTest/FileUtilsTest.h +++ b/tests/cpp-tests/Classes/FileUtilsTest/FileUtilsTest.h @@ -258,4 +258,26 @@ class TestWriteDataAsync : public FileUtilsDemo virtual std::string subtitle() const override; }; +class TestListFiles : public FileUtilsDemo +{ +public: + CREATE_FUNC(TestListFiles); + + virtual void onEnter() override; + virtual void onExit() override; + virtual std::string title() const override; + virtual std::string subtitle() const override; +}; + +class TestIsFileExistRejectFolder : public FileUtilsDemo +{ +public: + CREATE_FUNC(TestIsFileExistRejectFolder); + + virtual void onEnter() override; + virtual void onExit() override; + virtual std::string title() const override; + virtual std::string subtitle() const override; +}; + #endif /* __FILEUTILSTEST_H__ */ diff --git a/tests/cpp-tests/Classes/InputTest/MouseTest.cpp b/tests/cpp-tests/Classes/InputTest/MouseTest.cpp index c810030515bd..4f8ab456874d 100644 --- a/tests/cpp-tests/Classes/InputTest/MouseTest.cpp +++ b/tests/cpp-tests/Classes/InputTest/MouseTest.cpp @@ -32,6 +32,7 @@ MouseTests::MouseTests() { ADD_TEST_CASE(MouseEventTest); ADD_TEST_CASE(HideMouseTest); + ADD_TEST_CASE(CursorTest); } //------------------------------------------------------------------ @@ -73,7 +74,7 @@ void MouseEventTest::onMouseDown(Event *event) EventMouse* e = (EventMouse*)event; std::string str = "Mouse Down detected, Key: "; str += tostr(static_cast(e->getMouseButton())); - _labelAction->setString(str.c_str()); + _labelAction->setString(str); } void MouseEventTest::onMouseUp(Event *event) @@ -81,7 +82,7 @@ void MouseEventTest::onMouseUp(Event *event) EventMouse* e = (EventMouse*)event; std::string str = "Mouse Up detected, Key: "; str += tostr(static_cast(e->getMouseButton())); - _labelAction->setString(str.c_str()); + _labelAction->setString(str); } void MouseEventTest::onMouseMove(Event *event) @@ -89,7 +90,7 @@ void MouseEventTest::onMouseMove(Event *event) EventMouse* e = (EventMouse*)event; std::string str = "MousePosition X:"; str = str + tostr(e->getCursorX()) + " Y:" + tostr(e->getCursorY()); - _labelPosition->setString(str.c_str()); + _labelPosition->setString(str); } void MouseEventTest::onMouseScroll(Event *event) @@ -97,7 +98,7 @@ void MouseEventTest::onMouseScroll(Event *event) EventMouse* e = (EventMouse*)event; std::string str = "Mouse Scroll detected, X: "; str = str + tostr(e->getScrollX()) + " Y: " + tostr(e->getScrollY()); - _labelAction->setString(str.c_str()); + _labelAction->setString(str); } std::string MouseEventTest::title() const @@ -146,3 +147,46 @@ std::string HideMouseTest::subtitle() const return "Click to hide mouse"; } +//------------------------------------------------------------------ +// +// CursorTest +// +//------------------------------------------------------------------ + +CursorTest::CursorTest() +{ + _cursor = 0; + _lis = EventListenerMouse::create(); + _lis->onMouseDown = [this](Event* e){ + _cursor = (_cursor + 1) % 3; + switch (_cursor) { + case 1: + Director::getInstance()->getOpenGLView()->setCursor("InputTest/cursor1.png"); + break; + case 2: + Director::getInstance()->getOpenGLView()->setCursor("InputTest/cursor2.png", Point::ANCHOR_MIDDLE); + break; + default: + Director::getInstance()->getOpenGLView()->setDefaultCursor(); + break; + } + }; + + _eventDispatcher->addEventListenerWithSceneGraphPriority(_lis, this); +} + +CursorTest::~CursorTest() +{ + _eventDispatcher->removeEventListener(_lis); +} + +std::string CursorTest::title() const +{ + return "Custom Mouse Cursor"; +} + +std::string CursorTest::subtitle() const +{ + return "Click to change cursor"; +} + diff --git a/tests/cpp-tests/Classes/InputTest/MouseTest.h b/tests/cpp-tests/Classes/InputTest/MouseTest.h index cc2162dad881..73e191f94539 100644 --- a/tests/cpp-tests/Classes/InputTest/MouseTest.h +++ b/tests/cpp-tests/Classes/InputTest/MouseTest.h @@ -71,4 +71,19 @@ class HideMouseTest : public BaseMouseTest cocos2d::EventListenerMouse* _lis; }; +class CursorTest : public BaseMouseTest +{ +public: + CREATE_FUNC(CursorTest); + CursorTest(); + ~CursorTest(); + + virtual std::string title() const override; + virtual std::string subtitle() const override; + +private: + int _cursor; + cocos2d::EventListenerMouse* _lis; +}; + #endif diff --git a/tests/cpp-tests/Classes/LabelTest/LabelTest.cpp b/tests/cpp-tests/Classes/LabelTest/LabelTest.cpp index e012f3750605..b8fc8e738f4f 100644 --- a/tests/cpp-tests/Classes/LabelTest/LabelTest.cpp +++ b/tests/cpp-tests/Classes/LabelTest/LabelTest.cpp @@ -23,6 +23,7 @@ ****************************************************************************/ #include "LabelTest.h" +#include #include "../testResource.h" #include "cocos2d.h" @@ -1234,7 +1235,7 @@ void BitmapFontMultiLineAlignment::onTouchesMoved(const std::vector& tou this->_arrowsShouldRetain->setPosition(Vec2(MAX(MIN(location.x, ArrowsMax*winSize.width), ArrowsMin*winSize.width), this->_arrowsShouldRetain->getPosition().y)); - float labelWidth = fabs(this->_arrowsShouldRetain->getPosition().x - this->_labelShouldRetain->getPosition().x) * 2; + float labelWidth = std::fabs(this->_arrowsShouldRetain->getPosition().x - this->_labelShouldRetain->getPosition().x) * 2; _labelShouldRetain->setWidth(labelWidth); } diff --git a/tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp b/tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp index 9d3bdaa8b8d4..5f9b74c48ee9 100644 --- a/tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp +++ b/tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp @@ -23,6 +23,7 @@ ****************************************************************************/ #include "LabelTestNew.h" +#include #include "../testResource.h" #include "renderer/CCRenderer.h" #include "2d/CCFontAtlasCache.h" @@ -74,6 +75,8 @@ NewLabelTests::NewLabelTests() ADD_TEST_CASE(LabelFNTHundredLabels); ADD_TEST_CASE(LabelFNTPadding); ADD_TEST_CASE(LabelFNTOffset); + ADD_TEST_CASE(LabelFNTMultiFontAtlasNoRotation); + ADD_TEST_CASE(LabelFNTMultiFontAtlasWithRotation); ADD_TEST_CASE(LabelTTFFontsTestNew); ADD_TEST_CASE(LabelTTFLongLineWrapping); @@ -141,7 +144,7 @@ NewLabelTests::NewLabelTests() ADD_TEST_CASE(LabelIssueLineGap); ADD_TEST_CASE(LabelIssue17902); ADD_TEST_CASE(LabelLetterColorsTest); -}; +} LabelFNTColorAndOpacity::LabelFNTColorAndOpacity() { @@ -605,7 +608,7 @@ bool LabelFNTMultiLineAlignment::init() this->_arrowsBar = Sprite::create("Images/arrowsBar.png"); this->_arrows = Sprite::create("Images/arrows.png"); - MenuItemFont::setFontSize(20); + MenuItemFont::setFontSize(15); auto longSentences = MenuItemFont::create("Long Flowing Sentences", CC_CALLBACK_1(LabelFNTMultiLineAlignment::stringChanged, this)); auto lineBreaks = MenuItemFont::create("Short Sentences With Intentional Line Breaks", CC_CALLBACK_1(LabelFNTMultiLineAlignment::stringChanged, this)); auto mixed = MenuItemFont::create("Long Sentences Mixed With Intentional Line Breaks", CC_CALLBACK_1(LabelFNTMultiLineAlignment::stringChanged, this)); @@ -620,7 +623,7 @@ bool LabelFNTMultiLineAlignment::init() _menuItems.push_back(lineBreaks); _menuItems.push_back(mixed); - MenuItemFont::setFontSize(30); + MenuItemFont::setFontSize(20); auto left = MenuItemFont::create("Left", CC_CALLBACK_1(LabelFNTMultiLineAlignment::alignmentChanged, this)); auto center = MenuItemFont::create("Center", CC_CALLBACK_1(LabelFNTMultiLineAlignment::alignmentChanged, this)); @@ -642,8 +645,8 @@ bool LabelFNTMultiLineAlignment::init() this->_arrowsBar->setScaleX(arrowsWidth / this->_arrowsBar->getContentSize().width); this->_arrowsBar->setPosition(Vec2(((ArrowsMax + ArrowsMin) / 2) * size.width, this->_label->getPosition().y)); - stringMenu->setPosition(Vec2(size.width/2, size.height - menuItemPaddingCenter)); - alignmentMenu->setPosition(Vec2(size.width/2, menuItemPaddingCenter+15)); + stringMenu->setPosition(VisibleRect::top() + Vec2(0, - menuItemPaddingCenter)); + alignmentMenu->setPosition(VisibleRect::bottom() + Vec2(0, menuItemPaddingCenter + 15)); this->selectSentenceItem(longSentences); this->selectAlignmentItem(center); @@ -785,7 +788,7 @@ void LabelFNTMultiLineAlignment::onTouchesMoved(const std::vector& touch this->_arrows->setPosition(Vec2(MAX(MIN(location.x, ArrowsMax*winSize.width), ArrowsMin*winSize.width), this->_arrows->getPosition().y)); - float labelWidth = fabs(this->_arrows->getPosition().x - this->_label->getPosition().x) * 2; + float labelWidth = std::fabs(this->_arrows->getPosition().x - this->_label->getPosition().x) * 2; this->_label->setMaxLineWidth(labelWidth); } @@ -933,6 +936,57 @@ std::string LabelFNTBounds::subtitle() const return "Testing bounding-box"; } +LabelFNTMultiFontAtlasNoRotation::LabelFNTMultiFontAtlasNoRotation() +{ + auto s = Director::getInstance()->getWinSize(); + + auto label1 = Label::createWithBMFont("fonts/helvetica-32.fnt", "This is Helvetica"); + addChild(label1); + label1->setPosition(Vec2(s.width / 2, s.height / 3 * 2)); + + auto label2 = Label::createWithBMFont("fonts/geneva-32.fnt", "And this is Geneva", TextHAlignment::LEFT, 0, Rect(0, 128, 0, 0), false); + addChild(label2); + label2->setPosition(Vec2(s.width / 2, s.height / 3 * 1)); +} + +std::string LabelFNTMultiFontAtlasNoRotation::title() const +{ + return "New Label + Multi-BM Font Atlas Test1"; +} + +std::string LabelFNTMultiFontAtlasNoRotation::subtitle() const +{ + return "Using 2 .fnt definitions that share the same texture atlas."; +} + +LabelFNTMultiFontAtlasWithRotation::LabelFNTMultiFontAtlasWithRotation() +{ + auto s = Director::getInstance()->getWinSize(); + + auto spriteCache = SpriteFrameCache::getInstance(); + spriteCache->addSpriteFramesWithFile("fonts/bmfont-rotated-test.plist"); + + // Label BMFont + auto label1 = Label::createWithBMFont("fonts/helvetica-regular-32.fnt", "Helvetica with SubTextureKey", TextHAlignment::CENTER, 0, "helvetica-regular-32.png"); + label1->setPosition(Vec2(s.width / 2, s.height / 3 * 2)); + this->addChild(label1); + + const auto frame = spriteCache->getSpriteFrameByName("geneva-regular-32.png"); + auto label2 = Label::createWithBMFont("fonts/geneva-regular-32.fnt", "Geneva with Rect and Rotated", TextHAlignment::CENTER, 0, frame->getRectInPixels(), frame->isRotated()); + label2->setPosition(Vec2(s.width / 2, s.height / 3 * 1)); + this->addChild(label2); +} + +std::string LabelFNTMultiFontAtlasWithRotation::title() const +{ + return "New Label + Multi-BM Font Atlas Test2"; +} + +std::string LabelFNTMultiFontAtlasWithRotation::subtitle() const +{ + return "Using 2 .fnt definitions that share a PLIST texture atlas (rotated)."; +} + LabelTTFLongLineWrapping::LabelTTFLongLineWrapping() { auto size = Director::getInstance()->getWinSize(); @@ -1062,12 +1116,12 @@ LabelTTFCJKWrappingTest::LabelTTFCJKWrappingTest() Vec2(size.width * 0.85, size.height * 0.8), Vec2(size.width * 0.85, 0), 1, Color4F(1, 0, 0, 1)); - TTFConfig ttfConfig("fonts/HKYuanMini.ttf", 25, GlyphCollection::DYNAMIC); + TTFConfig ttfConfig("fonts/HKYuanMini.ttf", 20, GlyphCollection::DYNAMIC); auto label1 = Label::createWithTTF(ttfConfig, "你好,Cocos2d-x v3的New Label.", TextHAlignment::LEFT, size.width * 0.75); if(label1) { label1->setTextColor(Color4B(128, 255, 255, 255)); - label1->setPosition(Vec2(size.width * 0.1, size.height * 0.6)); + label1->setPosition(Vec2(size.width * 0.1, VisibleRect::top().y * 0.7)); label1->setAnchorPoint(Vec2(0, 0.5)); this->addChild(label1); // Demo for unloadFontAtlasTTF function, after it been called, all UI widget @@ -1080,7 +1134,7 @@ LabelTTFCJKWrappingTest::LabelTTFCJKWrappingTest() "早上好,Cocos2d-x v3的New Label.", TextHAlignment::LEFT, size.width * 0.75); if(label2) { label2->setTextColor(Color4B(255, 128, 255, 255)); - label2->setPosition(Vec2(size.width * 0.1, size.height * 0.4)); + label2->setPosition(Vec2(size.width * 0.1, VisibleRect::top().y * 0.5)); label2->setAnchorPoint(Vec2(0, 0.5)); this->addChild(label2); } @@ -1089,7 +1143,7 @@ LabelTTFCJKWrappingTest::LabelTTFCJKWrappingTest() "美好的一天啊美好的一天啊美好的一天啊", TextHAlignment::LEFT, size.width * 0.75); if(label3) { label3->setTextColor(Color4B(255, 255, 128, 255)); - label3->setPosition(Vec2(size.width * 0.1, size.height * 0.2)); + label3->setPosition(Vec2(size.width * 0.1, VisibleRect::top().y * 0.3)); label3->setAnchorPoint(Vec2(0, 0.5)); this->addChild(label3); } diff --git a/tests/cpp-tests/Classes/LabelTest/LabelTestNew.h b/tests/cpp-tests/Classes/LabelTest/LabelTestNew.h index f1bd5621b258..9c416ef1f007 100644 --- a/tests/cpp-tests/Classes/LabelTest/LabelTestNew.h +++ b/tests/cpp-tests/Classes/LabelTest/LabelTestNew.h @@ -223,6 +223,27 @@ class LabelFNTBounds : public AtlasDemoNew virtual std::string subtitle() const override; }; +class LabelFNTMultiFontAtlasNoRotation : public AtlasDemoNew +{ +public: + CREATE_FUNC(LabelFNTMultiFontAtlasNoRotation); + + LabelFNTMultiFontAtlasNoRotation(); + virtual std::string title() const override; + virtual std::string subtitle() const override; +}; + + +class LabelFNTMultiFontAtlasWithRotation : public AtlasDemoNew +{ +public: + CREATE_FUNC(LabelFNTMultiFontAtlasWithRotation); + + LabelFNTMultiFontAtlasWithRotation(); + virtual std::string title() const override; + virtual std::string subtitle() const override; +}; + class LabelTTFLongLineWrapping : public AtlasDemoNew { public: diff --git a/tests/cpp-tests/Classes/LayerTest/LayerTest.cpp b/tests/cpp-tests/Classes/LayerTest/LayerTest.cpp index db489a1c53c2..091406b0cd88 100644 --- a/tests/cpp-tests/Classes/LayerTest/LayerTest.cpp +++ b/tests/cpp-tests/Classes/LayerTest/LayerTest.cpp @@ -23,6 +23,7 @@ ****************************************************************************/ #include "LayerTest.h" +#include #include "../testResource.h" #include "../cocos/ui/UIText.h" @@ -407,7 +408,7 @@ void LayerTest1::updateSize(Vec2 &touchLocation) { auto s = Director::getInstance()->getWinSize(); - auto newSize = Size( fabs(touchLocation.x - s.width/2)*2, fabs(touchLocation.y - s.height/2)*2); + auto newSize = Size( std::fabs(touchLocation.x - s.width/2)*2, std::fabs(touchLocation.y - s.height/2)*2); auto l = (LayerColor*) getChildByTag(kTagLayer); diff --git a/tests/cpp-tests/Classes/MaterialSystemTest/MaterialSystemTest.cpp b/tests/cpp-tests/Classes/MaterialSystemTest/MaterialSystemTest.cpp index 721fcd0a3357..a8f075c8b449 100644 --- a/tests/cpp-tests/Classes/MaterialSystemTest/MaterialSystemTest.cpp +++ b/tests/cpp-tests/Classes/MaterialSystemTest/MaterialSystemTest.cpp @@ -27,7 +27,7 @@ #include "MaterialSystemTest.h" #include -#include +#include "spine/spine-cocos2dx.h" #include "../testResource.h" #include "cocos2d.h" @@ -169,12 +169,12 @@ class EffectAutoBindingResolver : public GLProgramState::AutoBindingResolver bool EffectAutoBindingResolver::resolveAutoBinding(GLProgramState* glProgramState, Node* node, const std::string& uniform, const std::string& autoBinding) { - if (autoBinding.compare("DYNAMIC_RADIUS")==0) + if (autoBinding == "DYNAMIC_RADIUS") { glProgramState->setUniformCallback(uniform, CC_CALLBACK_2(EffectAutoBindingResolver::callbackRadius, this)); return true; } - else if (autoBinding.compare("OUTLINE_COLOR")==0) + else if (autoBinding == "OUTLINE_COLOR") { glProgramState->setUniformCallback(uniform, CC_CALLBACK_2(EffectAutoBindingResolver::callbackColor, this)); return true; diff --git a/tests/cpp-tests/Classes/MotionStreakTest/MotionStreakTest.cpp b/tests/cpp-tests/Classes/MotionStreakTest/MotionStreakTest.cpp index 7c797561b451..d17288ea0fff 100644 --- a/tests/cpp-tests/Classes/MotionStreakTest/MotionStreakTest.cpp +++ b/tests/cpp-tests/Classes/MotionStreakTest/MotionStreakTest.cpp @@ -237,11 +237,11 @@ std::string Issue12226::subtitle() const // //------------------------------------------------------------------ -MotionStreakTest::MotionStreakTest(void) +MotionStreakTest::MotionStreakTest() { } -MotionStreakTest::~MotionStreakTest(void) +MotionStreakTest::~MotionStreakTest() { } diff --git a/tests/cpp-tests/Classes/NavMeshTest/NavMeshTest.cpp b/tests/cpp-tests/Classes/NavMeshTest/NavMeshTest.cpp index bf5e2d72a25b..f799ce5a2392 100644 --- a/tests/cpp-tests/Classes/NavMeshTest/NavMeshTest.cpp +++ b/tests/cpp-tests/Classes/NavMeshTest/NavMeshTest.cpp @@ -46,7 +46,7 @@ NavMeshTests::NavMeshTests() ADD_TEST_CASE(NavMeshBasicTestDemo); ADD_TEST_CASE(NavMeshAdvanceTestDemo); #endif -}; +} #if ( CC_USE_NAVMESH == 0 ) || ( CC_USE_PHYSICS == 0 ) void NavMeshDisabled::onEnter() @@ -63,14 +63,14 @@ void NavMeshDisabled::onEnter() } #else -NavMeshBaseTestDemo::NavMeshBaseTestDemo(void) +NavMeshBaseTestDemo::NavMeshBaseTestDemo() : _camera(nullptr) , _needMoveAgents(false) { } -NavMeshBaseTestDemo::~NavMeshBaseTestDemo(void) +NavMeshBaseTestDemo::~NavMeshBaseTestDemo() { for (auto iter : _agents){ AgentUserData *data = static_cast(iter.first->getUserData()); @@ -115,7 +115,7 @@ void NavMeshBaseTestDemo::onTouchesBegan(const std::vector& tou void NavMeshBaseTestDemo::onTouchesMoved(const std::vector& touches, cocos2d::Event *event) { - if (touches.size() && _camera) + if (!touches.empty() && _camera) { auto touch = touches[0]; auto delta = touch->getDelta(); @@ -198,7 +198,7 @@ void NavMeshBaseTestDemo::createAgent(const Vec3 &pos) animate->setSpeed(0); } - _agents.push_back(std::make_pair(agent, animate)); + _agents.emplace_back(agent, animate); } void NavMeshBaseTestDemo::createObstacle(const Vec3 &pos) @@ -263,12 +263,12 @@ void NavMeshBaseTestDemo::update(float delta) } } -NavMeshBasicTestDemo::NavMeshBasicTestDemo(void) +NavMeshBasicTestDemo::NavMeshBasicTestDemo() { } -NavMeshBasicTestDemo::~NavMeshBasicTestDemo(void) +NavMeshBasicTestDemo::~NavMeshBasicTestDemo() { } @@ -335,12 +335,12 @@ void NavMeshBasicTestDemo::onEnter() createAgent(result.hitPosition); } -NavMeshAdvanceTestDemo::NavMeshAdvanceTestDemo(void) +NavMeshAdvanceTestDemo::NavMeshAdvanceTestDemo() { } -NavMeshAdvanceTestDemo::~NavMeshAdvanceTestDemo(void) +NavMeshAdvanceTestDemo::~NavMeshAdvanceTestDemo() { } diff --git a/tests/cpp-tests/Classes/NewAudioEngineTest/NewAudioEngineTest.cpp b/tests/cpp-tests/Classes/NewAudioEngineTest/NewAudioEngineTest.cpp index 45c2d785acd2..f6fd931e2c0a 100644 --- a/tests/cpp-tests/Classes/NewAudioEngineTest/NewAudioEngineTest.cpp +++ b/tests/cpp-tests/Classes/NewAudioEngineTest/NewAudioEngineTest.cpp @@ -852,7 +852,7 @@ bool AudioSwitchStateTest::init() AudioEngine::play2d("audio/SoundEffectsFX009/FX082.mp3"); AudioEngine::play2d("audio/LuckyDay.mp3"); - }, 0.1f, "AudioSwitchStateTest"); + }, 0.01f, "AudioSwitchStateTest"); return true; } diff --git a/tests/cpp-tests/Classes/NewEventDispatcherTest/NewEventDispatcherTest.cpp b/tests/cpp-tests/Classes/NewEventDispatcherTest/NewEventDispatcherTest.cpp index d2efb8f5111d..0bdd635ab478 100644 --- a/tests/cpp-tests/Classes/NewEventDispatcherTest/NewEventDispatcherTest.cpp +++ b/tests/cpp-tests/Classes/NewEventDispatcherTest/NewEventDispatcherTest.cpp @@ -356,7 +356,7 @@ void RemoveListenerWhenDispatching::onEnter() } }, MenuItemFont::create("Enabled"), MenuItemFont::create("Disabled"), nullptr); - toggleItem->setPosition(origin + Vec2(size.width/2, 80)); + toggleItem->setPosition(origin + Vec2(size.width * 0.8, 80)); auto menu = Menu::create(toggleItem, nullptr); menu->setPosition(Vec2(0, 0)); menu->setAnchorPoint(Vec2(0, 0)); @@ -392,7 +392,7 @@ void CustomEventTest::onEnter() char* buf = static_cast(event->getUserData()); str += buf; str += " times"; - statusLabel->setString(str.c_str()); + statusLabel->setString(str); }); _eventDispatcher->addEventListenerWithFixedPriority(_listener, 1); @@ -418,7 +418,7 @@ void CustomEventTest::onEnter() char* buf = static_cast(event->getUserData()); str += buf; str += " times"; - statusLabel2->setString(str.c_str()); + statusLabel2->setString(str); }); _eventDispatcher->addEventListenerWithFixedPriority(_listener2, 1); @@ -650,7 +650,7 @@ void RemoveListenerAfterAddingTest::onEnter() _eventDispatcher->removeEventListener(listener); }); - item1->setPosition(VisibleRect::center() + Vec2(0, 80)); + item1->setPosition(VisibleRect::leftBottom() + Vec2(0, 80)); auto addNextButton = [this](){ auto next = MenuItemFont::create("Please Click Me To Reset!", [this](Ref* sender){ @@ -677,7 +677,7 @@ void RemoveListenerAfterAddingTest::onEnter() addNextButton(); }); - item2->setPosition(VisibleRect::center() + Vec2(0, 40)); + item2->setPosition(VisibleRect::leftBottom() + Vec2(0, 40)); auto item3 = MenuItemFont::create("Click Me 3", [=](Ref* sender){ auto listener = EventListenerTouchOneByOne::create(); @@ -692,10 +692,10 @@ void RemoveListenerAfterAddingTest::onEnter() addNextButton(); }); - item3->setPosition(VisibleRect::center()); + item3->setPosition(VisibleRect::leftBottom()); auto menu = Menu::create(item1, item2, item3, nullptr); - menu->setPosition(VisibleRect::leftBottom()); + menu->setPosition(VisibleRect::rightBottom() * 0.8 + Vec2(0, 40)); menu->setAnchorPoint(Vec2::ZERO); addChild(menu); diff --git a/tests/cpp-tests/Classes/NewRendererTest/NewRendererTest.cpp b/tests/cpp-tests/Classes/NewRendererTest/NewRendererTest.cpp index 23c46523dd10..4c3a74911066 100644 --- a/tests/cpp-tests/Classes/NewRendererTest/NewRendererTest.cpp +++ b/tests/cpp-tests/Classes/NewRendererTest/NewRendererTest.cpp @@ -27,6 +27,39 @@ USING_NS_CC; + +class DurationRecorder { +public: + void startTick(const std::string &key) { + _durations[key] = - now(); + } + + int endTick(const std::string &key) { + auto n = now(); + auto itr = _durations.find(key); + if(_durations.find(key) == _durations.end()) + { + return -1; + } + else if(itr->second < 0) { + itr->second = n + itr->second; + } + return itr->second; + } + + inline int64_t now() const{ + return std::chrono::duration_cast(std::chrono::steady_clock::now().time_since_epoch()).count(); + } + + void reset() { + _durations.clear(); + } + +private: + std::map _durations; +}; + + NewRendererTests::NewRendererTests() { ADD_TEST_CASE(NewSpriteTest); @@ -41,7 +74,9 @@ NewRendererTests::NewRendererTests() ADD_TEST_CASE(RendererBatchQuadTri); ADD_TEST_CASE(RendererUniformBatch); ADD_TEST_CASE(RendererUniformBatch2); -}; + ADD_TEST_CASE(SpriteCreation); + ADD_TEST_CASE(NonBatchSprites); +} std::string MultiSceneTest::title() const { @@ -779,3 +814,275 @@ std::string RendererUniformBatch2::subtitle() const { return "Mixing different shader states should work ok"; } + + +NonBatchSprites::NonBatchSprites() +{ + Size s = Director::getInstance()->getWinSize(); + _spritesAnchor = Node::create(); + _spritesAnchor->setPosition(0, 0); + addChild(_spritesAnchor); + + + _totalSprites = Label::createWithTTF(TTFConfig("fonts/arial.ttf"), "sprites"); + _totalSprites->setColor(Color3B::YELLOW); + _totalSprites->enableOutline(Color4B::RED, 2); + _totalSprites->setPosition(s.width/2, s.height/2); + + addChild(_totalSprites); + + scheduleUpdate(); +} + +void NonBatchSprites::createSprite() +{ + + Size s = Director::getInstance()->getWinSize(); + Sprite* sprite = nullptr; + if (_spriteIndex % 2 == 0) + { + sprite = Sprite::create("Images/grossini_dance_05.png"); + } + else + { + sprite = Sprite::create("Images/grossini_dance_01.png"); + } + + if (!sprite) return; + auto r = rand_0_1() * 0.6 + 0.2; + sprite->setScale(r, r); + float x = ((float)std::rand()) / RAND_MAX; + float y = ((float)std::rand()) / RAND_MAX; + sprite->runAction(RepeatForever::create(RotateBy::create(1, 45))); + + sprite->setPosition(Vec2(x * s.width, y * s.height)); + _spritesAnchor->addChild(sprite); + + _spriteIndex++; + std::stringstream ss; + ss << _spriteIndex << " sprites"; + _totalSprites->setString(ss.str()); +} + +void NonBatchSprites::update(float dt) +{ + + if( dt <= 1.0f / 28.0f && dt >= 1.0f/ 31.0f) + { + _around30fps.hit(); + } + else + { + _around30fps.cancel(); + } + + _maDt = 0.7f * _maDt + 0.3f * dt; + _rmaDt = 0.5f * _rmaDt + 0.5f * dt; + if(_maDt <= DEST_DT_30FPS) { + _contSlow.cancel(); + _contFast.hit(); + if(_contFast.ok()){ + auto t2 = DEST_DT_30FPS - _rmaDt; + auto delta = (int)(t2 / _rmaDt * _spriteIndex * 0.1); + delta =std::min(20, std::max(1, delta)); + for(int i =0 ;i< delta; i++) { + createSprite(); + } + } + }else{ + _contSlow.hit(); + _contFast.cancel(); + } + + if(_contSlow.ok() || _around30fps.ok()) + { + unscheduleUpdate(); + std::stringstream ss; + ss << _spriteIndex << " sprites, DONE!"; + _totalSprites->setString(ss.str()); + _totalSprites->setScale(1.2); + } +} + +NonBatchSprites::~NonBatchSprites() +{ + +} + +std::string NonBatchSprites::title() const +{ + return "Non Batched Sprites"; +} + +std::string NonBatchSprites::subtitle() const +{ +#if defined(COCOS2D_DEBUG) && COCOS2D_DEBUG == 1 + return "DEBUG: simulate lots of sprites, drop to 30 fps"; +#else + return "RELEASE: simulate lots of sprites, drop to 30 fps"; +#endif +} + + + +SpriteCreation::SpriteCreation() +{ + + Size s = Director::getInstance()->getWinSize(); + Node* parent = Node::create(); + parent->setPosition(s.width / 2,s.height / 2); + addChild(parent); + + +#define KEY_CREATION "11" +#define KEY_DESTROYATION "22" + + labelCreate = Label::createWithTTF(TTFConfig("fonts/arial.ttf"), "Sprite Creation: .."); + labelDestory= Label::createWithTTF(TTFConfig("fonts/arial.ttf"), "Destroy Sprites: .."); + + MenuItemFont::setFontName("fonts/arial.ttf"); + MenuItemFont::setFontSize(65); + auto decrease = MenuItemFont::create(" - ", CC_CALLBACK_1(SpriteCreation::delSpritesCallback, this)); + decrease->setColor(Color3B(0, 200, 20)); + auto increase = MenuItemFont::create(" + ", CC_CALLBACK_1(SpriteCreation::addSpritesCallback, this)); + increase->setColor(Color3B(0, 200, 20)); + + auto menu = Menu::create(decrease, increase, nullptr); + menu->alignItemsHorizontally(); + menu->setPosition(Vec2(s.width / 2, s.height - 105)); + addChild(menu, 1); + + TTFConfig ttfCount("fonts/Marker Felt.ttf", 30); + _labelSpriteNum = Label::createWithTTF(ttfCount, "Label"); + _labelSpriteNum->setColor(Color3B(0, 200, 20)); + _labelSpriteNum->setPosition(Vec2(s.width / 2, s.height - 130)); + addChild(_labelSpriteNum); + + updateSpriteCountLabel(totalSprites); + + labelCreate->setPosition(0, -20); + labelDestory->setPosition(0, -50); + + parent->addChild(labelCreate); + parent->addChild(labelDestory); + + doTest(); +} + +void SpriteCreation::updateSpriteCountLabel(int x) +{ + totalSprites = std::max(1, x); + std::stringstream ss; + ss << totalSprites << " sprites"; + _labelSpriteNum->setString(ss.str()); +} + +void SpriteCreation::doTest() +{ + + DurationRecorder perf; + std::vector predefineTextures = { + "Images/concave.png", + "Images/atlastest.png", + "Images/grossini_dance_atlas-mono.png", + "Images/HelloWorld.png", + "Images/background1.png", + "Images/background2.png", + "Images/stone.png", + "Images/issue_17116.png", + "Images/sprite_polygon_crash.png", + "Images/bitmapFontTest3.png", + "Images/cocos-html5.png", + "Images/Fog.png", + "Images/poly_test_textures.png", + "Images/powered.png", + "Images/bug14017.png", + "Images/test-rgba1.png", + "Images/grossinis_heads.png", + "Images/cocos2dbanner.png" + }; + + + std::vector spriteCache; + spriteCache.reserve(totalSprites); + + perf.startTick(KEY_CREATION); + + for (int i=0; i< totalSprites; ++i) + { + auto* sprite = new Sprite(); + if(sprite == nullptr ) + { + break; + } + if(!sprite->initWithFile(predefineTextures[i % predefineTextures.size()])) + { + delete sprite; + break; + } + spriteCache.push_back(sprite); + } + + auto creationDuration = perf.endTick(KEY_CREATION); + perf.startTick(KEY_DESTROYATION); + + for (int i=0; i< totalSprites; ++i) + { + spriteCache[i]->release(); + } + auto destroyDuration = perf.endTick(KEY_DESTROYATION); + std::stringstream ss; + auto t1_ms = creationDuration * 1.0 / 1000000; + ss << "Create "<< spriteCache.size() << " sprites takes " << t1_ms<< " ms, " << (int64_t)(spriteCache.size() * 1000 / t1_ms) << " sprites per second!"; + labelCreate->setString(ss.str()); + + if(t1_ms < 100) { + suggestDelta =(int) (0.5 * totalSprites); + } else if (t1_ms < 1000) { + suggestDelta =(int) (0.2 * totalSprites); + } else if(t1_ms) { + suggestDelta =(int) (0.1 * totalSprites); + } + + suggestDelta = suggestDelta < 1000 ? 1000 : suggestDelta - suggestDelta % 1000; + + ss.str(""); + auto t2_ms = destroyDuration * 1.0 / 1000000; + ss << "Destroy "<< spriteCache.size() << " sprites takes " << t2_ms<< " ms, " << (int64_t)(spriteCache.size() * 1000 / t2_ms) << " sprites per second!" ; + labelDestory->setString(ss.str()); + + spriteCache.clear(); +} + +void SpriteCreation::addSpritesCallback(cocos2d::Ref *) +{ + updateSpriteCountLabel(totalSprites + suggestDelta); + doTest(); +} + +void SpriteCreation::delSpritesCallback(cocos2d::Ref *) +{ + updateSpriteCountLabel(totalSprites - suggestDelta); + doTest(); +} + +SpriteCreation::~SpriteCreation() +{ + +} + +std::string SpriteCreation::title() const +{ + return "Sprite Creation"; +} + +std::string SpriteCreation::subtitle() const +{ +#if defined(COCOS2D_DEBUG) && COCOS2D_DEBUG == 1 + return "In debug mode"; +#else + return "In release mode"; +#endif +} + + diff --git a/tests/cpp-tests/Classes/NewRendererTest/NewRendererTest.h b/tests/cpp-tests/Classes/NewRendererTest/NewRendererTest.h index 9c251f1a0758..cabfde86e4f4 100644 --- a/tests/cpp-tests/Classes/NewRendererTest/NewRendererTest.h +++ b/tests/cpp-tests/Classes/NewRendererTest/NewRendererTest.h @@ -216,4 +216,63 @@ class RendererUniformBatch2 : public MultiSceneTest cocos2d::GLProgramState* createSepiaGLProgramState(); }; +class SpriteCreation : public MultiSceneTest +{ +public: + CREATE_FUNC(SpriteCreation); + virtual std::string title() const override; + virtual std::string subtitle() const override; + + void addSpritesCallback(Ref *); + void delSpritesCallback(Ref *); + + void updateSpriteCountLabel(int x); + + void doTest(); + +protected: + int totalSprites = 1000; + int suggestDelta = 100; + cocos2d::Label* _labelSpriteNum = nullptr; + cocos2d::Label* labelCreate = nullptr; + cocos2d::Label* labelDestory = nullptr; + SpriteCreation(); + virtual ~SpriteCreation(); +}; + +class NonBatchSprites : public MultiSceneTest +{ +public: + CREATE_FUNC(NonBatchSprites); + virtual std::string title() const override; + virtual std::string subtitle() const override; + + virtual void update(float dt) override; +protected: + NonBatchSprites(); + + void createSprite(); + + virtual ~NonBatchSprites(); + class Ticker { + public: + Ticker(int m):_max(m) {} + void hit() {_cnt += 1;} + void cancel() {_cnt = 0;} + bool ok() {return _cnt >= _max;} + private: + int _cnt = 0; + int _max = 0; + }; + Node *_spritesAnchor = nullptr; + int _spriteIndex = 0; + float _maDt = 1.0f / 60.0f; + float _rmaDt = 1.0f/ 60.0f; + const float DEST_DT_30FPS = 1.0f / 30.0f; + cocos2d::Label * _totalSprites = nullptr; + Ticker _contSlow = Ticker(20); + Ticker _contFast = Ticker(2); + Ticker _around30fps = Ticker(60 * 3); +}; + #endif //__NewRendererTest_H_ diff --git a/tests/cpp-tests/Classes/NodeTest/NodeTest.cpp b/tests/cpp-tests/Classes/NodeTest/NodeTest.cpp index 3e5539cb8962..978a787d755e 100644 --- a/tests/cpp-tests/Classes/NodeTest/NodeTest.cpp +++ b/tests/cpp-tests/Classes/NodeTest/NodeTest.cpp @@ -76,11 +76,11 @@ CocosNodeTests::CocosNodeTests() ADD_TEST_CASE(Issue16735Test); } -TestCocosNodeDemo::TestCocosNodeDemo(void) +TestCocosNodeDemo::TestCocosNodeDemo() { } -TestCocosNodeDemo::~TestCocosNodeDemo(void) +TestCocosNodeDemo::~TestCocosNodeDemo() { } @@ -993,14 +993,10 @@ void MySprite::onDraw(const Mat4 &transform, uint32_t flags) getGLProgram()->use(); getGLProgram()->setUniformsForBuiltins(transform); - cocos2d::utils::setBlending(_blendFunc.src, _blendFunc.dst); + GL::blendFunc( _blendFunc.src, _blendFunc.dst ); - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, _texture->getName()); - - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_TEX_COORD); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_COLOR); + GL::bindTexture2D( _texture->getName() ); + GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POS_COLOR_TEX ); #define kQuadSize sizeof(_quad.bl) size_t offset = (size_t)&_quad; @@ -1388,14 +1384,14 @@ void NodeNameTest::test(float dt) // search from parent // name is xxx/.. i = 0; - parent->enumerateChildren("node/..", [&i](Node* node) -> bool { + parent->getChildByName("node1")->enumerateChildren("node[[:digit:]]+/node/..", [&i](Node* node) -> bool { ++i; return true; }); CCAssert(i == 1, ""); i = 0; - parent->enumerateChildren("node/..", [&i](Node* node) -> bool { + parent->getChildByName("node1")->enumerateChildren("node[[:digit:]]+/node/..", [&i](Node* node) -> bool { ++i; return false; }); @@ -1434,11 +1430,11 @@ void NodeNameTest::test(float dt) CCAssert(i == 1, ""); i = 0; - parent->enumerateChildren("//node[[:digit:]]+/..", [&i](Node* node) -> bool { + parent->getChildByName("node1")->enumerateChildren("//node[[:digit:]]+/..", [&i](Node* node) -> bool { ++i; return false; }); - CCAssert(i == 100, ""); + CCAssert(i == 110, ""); // utils::findChildren() diff --git a/tests/cpp-tests/Classes/Particle3DTest/Particle3DTest.cpp b/tests/cpp-tests/Classes/Particle3DTest/Particle3DTest.cpp index 83f2a1f93e53..f1dff0b1ca3e 100644 --- a/tests/cpp-tests/Classes/Particle3DTest/Particle3DTest.cpp +++ b/tests/cpp-tests/Classes/Particle3DTest/Particle3DTest.cpp @@ -97,7 +97,7 @@ void Particle3DTestDemo::onTouchesBegan(const std::vector& touches, coco void Particle3DTestDemo::onTouchesMoved(const std::vector& touches, cocos2d::Event *event) { - if (touches.size()) + if (!touches.empty()) { auto touch = touches[0]; auto delta = touch->getDelta(); @@ -113,7 +113,7 @@ void Particle3DTestDemo::onTouchesEnded(const std::vector& touches, coco } -Particle3DTestDemo::Particle3DTestDemo( void ) +Particle3DTestDemo::Particle3DTestDemo() : _angle(0.0f) { @@ -138,7 +138,7 @@ void Particle3DTestDemo::update( float delta ) } } -Particle3DTestDemo::~Particle3DTestDemo( void ) +Particle3DTestDemo::~Particle3DTestDemo() { _particleLab->release(); } diff --git a/tests/cpp-tests/Classes/ParticleTest/ParticleTest.cpp b/tests/cpp-tests/Classes/ParticleTest/ParticleTest.cpp index a4cfbec4be87..8ed584550b17 100644 --- a/tests/cpp-tests/Classes/ParticleTest/ParticleTest.cpp +++ b/tests/cpp-tests/Classes/ParticleTest/ParticleTest.cpp @@ -1075,12 +1075,12 @@ ParticleTests::ParticleTests() ADD_TEST_CASE(ParticleSpriteFrame); } -ParticleDemo::~ParticleDemo(void) +ParticleDemo::~ParticleDemo() { CC_SAFE_RELEASE(_emitter); } -void ParticleDemo::onEnter(void) +void ParticleDemo::onEnter() { TestCase::onEnter(); diff --git a/tests/cpp-tests/Classes/Physics3DTest/Physics3DTest.cpp b/tests/cpp-tests/Classes/Physics3DTest/Physics3DTest.cpp index bf02053b62f9..5c48156d328c 100644 --- a/tests/cpp-tests/Classes/Physics3DTest/Physics3DTest.cpp +++ b/tests/cpp-tests/Classes/Physics3DTest/Physics3DTest.cpp @@ -62,7 +62,7 @@ Physics3DTests::Physics3DTests() ADD_TEST_CASE(Physics3DColliderDemo); ADD_TEST_CASE(Physics3DTerrainDemo); #endif -}; +} #if CC_USE_3D_PHYSICS == 0 void Physics3DDemoDisabled::onEnter() @@ -143,7 +143,7 @@ void Physics3DTestDemo::onTouchesBegan(const std::vector& touches, cocos void Physics3DTestDemo::onTouchesMoved(const std::vector& touches, cocos2d::Event *event) { - if (touches.size() && _camera) + if (!touches.empty() && _camera) { auto touch = touches[0]; auto delta = touch->getDelta(); @@ -176,7 +176,7 @@ void Physics3DTestDemo::onTouchesEnded(const std::vector& touches, cocos } } -Physics3DTestDemo::Physics3DTestDemo( void ) +Physics3DTestDemo::Physics3DTestDemo() : _angle(0.0f) , _camera(nullptr) { @@ -188,7 +188,7 @@ void Physics3DTestDemo::update( float /*delta*/ ) } -Physics3DTestDemo::~Physics3DTestDemo( void ) +Physics3DTestDemo::~Physics3DTestDemo() { } @@ -651,18 +651,18 @@ bool Physics3DTerrainDemo::init() Mat4 localTrans; auto bodyshape = Physics3DShape::createBox(Vec3(2.0f, 4.0f, 2.0f)); Mat4::createTranslation(0.0f, 2.0f, 0.0f, &localTrans); - shapeList.push_back(std::make_pair(bodyshape, localTrans)); + shapeList.emplace_back(bodyshape, localTrans); auto headshape = Physics3DShape::createSphere(1.5f); Mat4::createTranslation(0.6f, 5.0f, -1.5f, &localTrans); - shapeList.push_back(std::make_pair(headshape, localTrans)); + shapeList.emplace_back(headshape, localTrans); auto lhandshape = Physics3DShape::createBox(Vec3(1.0f, 3.0f, 1.0f)); Mat4::createRotation(Vec3(1.0f, 0.0f, 0.0f), CC_DEGREES_TO_RADIANS(15.0f), &localTrans); localTrans.m[12] = -1.5f; localTrans.m[13] = 2.5f; localTrans.m[14] = -2.5f; - shapeList.push_back(std::make_pair(lhandshape, localTrans)); + shapeList.emplace_back(lhandshape, localTrans); auto rhandshape = Physics3DShape::createBox(Vec3(1.0f, 3.0f, 1.0f)); Mat4::createRotation(Vec3(1.0f, 0.0f, 0.0f), CC_DEGREES_TO_RADIANS(-15.0f), &localTrans); localTrans.m[12] = 2.0f; localTrans.m[13] = 2.5f; localTrans.m[14] = 1.f; - shapeList.push_back(std::make_pair(rhandshape, localTrans)); + shapeList.emplace_back(rhandshape, localTrans); rbDes.mass = 10.0f; rbDes.shape = Physics3DShape::createCompoundShape(shapeList); diff --git a/tests/cpp-tests/Classes/PhysicsTest/PhysicsTest.cpp b/tests/cpp-tests/Classes/PhysicsTest/PhysicsTest.cpp index 2c4bf2d54d37..2ecab7e5479a 100644 --- a/tests/cpp-tests/Classes/PhysicsTest/PhysicsTest.cpp +++ b/tests/cpp-tests/Classes/PhysicsTest/PhysicsTest.cpp @@ -180,7 +180,7 @@ namespace return (LOGO_IMAGE[(x >> 3) + y * LOGO_RAW_LENGTH] >> (~x & 0x7)) & 1; } - float frand(void) + float frand() { return rand() / RAND_MAX; } @@ -1593,8 +1593,6 @@ void PhysicsPositionRotationTest::onEnter() body->setRotationOffset(45); body->setTag(DRAG_BODYS_TAG); addChild(offsetPosNode); - - return; } std::string PhysicsPositionRotationTest::title() const diff --git a/tests/cpp-tests/Classes/ReleasePoolTest/ReleasePoolTest.cpp b/tests/cpp-tests/Classes/ReleasePoolTest/ReleasePoolTest.cpp index 421ce0839b1e..cbc6469df371 100644 --- a/tests/cpp-tests/Classes/ReleasePoolTest/ReleasePoolTest.cpp +++ b/tests/cpp-tests/Classes/ReleasePoolTest/ReleasePoolTest.cpp @@ -36,14 +36,14 @@ class TestObject : public Ref public: TestObject() : _name(""){} - TestObject(std::string name) : _name(name) + TestObject(std::string name) : _name(std::move(name)) { CCLOG("TestObject:%s is created", _name.c_str()); } ~TestObject() { - if (_name.size() > 0) + if (!_name.empty()) CCLOG("TestObject:%s is destroyed", _name.c_str()); } diff --git a/tests/cpp-tests/Classes/RenderTextureTest/RenderTextureTest.cpp b/tests/cpp-tests/Classes/RenderTextureTest/RenderTextureTest.cpp index ea68f59dfcd5..d2775645c2e4 100644 --- a/tests/cpp-tests/Classes/RenderTextureTest/RenderTextureTest.cpp +++ b/tests/cpp-tests/Classes/RenderTextureTest/RenderTextureTest.cpp @@ -38,7 +38,7 @@ RenderTextureTests::RenderTextureTests() ADD_TEST_CASE(RenderTexturePartTest); ADD_TEST_CASE(Issue16113Test); ADD_TEST_CASE(RenderTextureWithSprite3DIssue16894); -}; +} /** * Implementation of RenderTextureSave @@ -62,12 +62,15 @@ RenderTextureSave::RenderTextureSave() // Save Image menu MenuItemFont::setFontSize(16); - auto item1 = MenuItemFont::create("Save Image", CC_CALLBACK_1(RenderTextureSave::saveImage, this)); - auto item2 = MenuItemFont::create("Clear", CC_CALLBACK_1(RenderTextureSave::clearImage, this)); - auto menu = Menu::create(item1, item2, nullptr); + auto item1 = MenuItemFont::create("Save Image PMA", CC_CALLBACK_1(RenderTextureSave::saveImageWithPremultipliedAlpha, this)); + auto item2 = MenuItemFont::create("Save Image Non-PMA", CC_CALLBACK_1(RenderTextureSave::saveImageWithNonPremultipliedAlpha, this)); + auto item3 = MenuItemFont::create("Add Image", CC_CALLBACK_1(RenderTextureSave::addImage, this)); + auto item4 = MenuItemFont::create("Clear to Random", CC_CALLBACK_1(RenderTextureSave::clearImage, this)); + auto item5 = MenuItemFont::create("Clear to Transparent", CC_CALLBACK_1(RenderTextureSave::clearImageTransparent, this)); + auto menu = Menu::create(item1, item2, item3, item4, item5, nullptr); this->addChild(menu); menu->alignItemsVertically(); - menu->setPosition(Vec2(VisibleRect::rightTop().x - 80, VisibleRect::rightTop().y - 30)); + menu->setPosition(Vec2(VisibleRect::rightTop().x - 80, VisibleRect::rightTop().y - 100)); } std::string RenderTextureSave::title() const @@ -80,17 +83,46 @@ std::string RenderTextureSave::subtitle() const return "Press 'Save Image' to create an snapshot of the render texture"; } -void RenderTextureSave::clearImage(cocos2d::Ref *sender) +void RenderTextureSave::clearImage(cocos2d::Ref* sender) { _target->clear(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1()); } -void RenderTextureSave::saveImage(cocos2d::Ref *sender) +void RenderTextureSave::clearImageTransparent(cocos2d::Ref* sender) +{ + _target->clear(0, 0, 0, 0); +} + +void RenderTextureSave::saveImageWithPremultipliedAlpha(cocos2d::Ref* sender) { static int counter = 0; char png[20]; - sprintf(png, "image-%d.png", counter); + sprintf(png, "image-pma-%d.png", counter); + + auto callback = [&](RenderTexture* rt, const std::string& path) + { + auto sprite = Sprite::create(path); + addChild(sprite); + sprite->setScale(0.3f); + sprite->setPosition(Vec2(40, 40)); + sprite->setRotation(counter * 3); + }; + + _target->saveToFile(png, Image::Format::PNG, true, callback); + //Add this function to avoid crash if we switch to a new scene. + Director::getInstance()->getRenderer()->render(); + CCLOG("Image saved %s", png); + + counter++; +} + +void RenderTextureSave::saveImageWithNonPremultipliedAlpha(cocos2d::Ref *sender) +{ + static int counter = 0; + + char png[20]; + sprintf(png, "image-no-pma-%d.png", counter); auto callback = [&](RenderTexture* rt, const std::string& path) { @@ -101,7 +133,7 @@ void RenderTextureSave::saveImage(cocos2d::Ref *sender) sprite->setRotation(counter * 3); }; - _target->saveToFile(png, Image::Format::PNG, true, callback); + _target->saveToFileAsNonPMA(png, Image::Format::PNG, true, callback); //Add this function to avoid crash if we switch to a new scene. Director::getInstance()->getRenderer()->render(); CCLOG("Image saved %s", png); @@ -109,6 +141,21 @@ void RenderTextureSave::saveImage(cocos2d::Ref *sender) counter++; } +void RenderTextureSave::addImage(cocos2d::Ref* sender) +{ + auto s = Director::getInstance()->getWinSize(); + + // begin drawing to the render texture + _target->begin(); + + Sprite* sprite = Sprite::create("Images/test-rgba1.png"); + sprite->setPosition(sprite->getContentSize().width + CCRANDOM_0_1() * (s.width - sprite->getContentSize().width), sprite->getContentSize().height + CCRANDOM_0_1() * (s.height - sprite->getContentSize().height)); + sprite->visit(); + + // finish drawing and return context back to the screen + _target->end(); +} + RenderTextureSave::~RenderTextureSave() { _target->release(); @@ -849,4 +896,4 @@ std::string RenderTextureWithSprite3DIssue16894::title() const std::string RenderTextureWithSprite3DIssue16894::subtitle() const { return "3 ships, 1st & 3rd are the same"; -} +} \ No newline at end of file diff --git a/tests/cpp-tests/Classes/RenderTextureTest/RenderTextureTest.h b/tests/cpp-tests/Classes/RenderTextureTest/RenderTextureTest.h index 8d0940037b76..591e5ff8ff9c 100644 --- a/tests/cpp-tests/Classes/RenderTextureTest/RenderTextureTest.h +++ b/tests/cpp-tests/Classes/RenderTextureTest/RenderTextureTest.h @@ -44,7 +44,11 @@ class RenderTextureSave : public RenderTextureTest virtual std::string subtitle() const override; void onTouchesMoved(const std::vector& touches, cocos2d::Event* event); void clearImage(cocos2d::Ref* pSender); - void saveImage(cocos2d::Ref* pSender); + void clearImageTransparent(cocos2d::Ref* sender); + void saveImageWithPremultipliedAlpha(cocos2d::Ref* pSender); + void saveImageWithNonPremultipliedAlpha(cocos2d::Ref* pSender); + + void addImage(cocos2d::Ref* sender); private: cocos2d::RenderTexture* _target; diff --git a/tests/cpp-tests/Classes/Scene3DTest/Scene3DTest.cpp b/tests/cpp-tests/Classes/Scene3DTest/Scene3DTest.cpp index f34b76beb59e..aff6b554908d 100644 --- a/tests/cpp-tests/Classes/Scene3DTest/Scene3DTest.cpp +++ b/tests/cpp-tests/Classes/Scene3DTest/Scene3DTest.cpp @@ -23,10 +23,10 @@ ****************************************************************************/ #include "Scene3DTest.h" - +#include #include "ui/CocosGUI.h" #include "renderer/CCRenderState.h" -#include +#include "spine/spine-cocos2dx.h" #include "../testResource.h" #include "../TerrainTest/TerrainTest.h" @@ -807,32 +807,32 @@ void Scene3DTestScene::createDescDlg() } auto& body = _skins[(int)SkinType::UPPER_BODY]; - body.push_back("Girl_UpperBody01"); - body.push_back("Girl_UpperBody02"); + body.emplace_back("Girl_UpperBody01"); + body.emplace_back("Girl_UpperBody02"); auto& pants = _skins[(int)SkinType::PANTS]; - pants.push_back("Girl_LowerBody01"); - pants.push_back("Girl_LowerBody02"); + pants.emplace_back("Girl_LowerBody01"); + pants.emplace_back("Girl_LowerBody02"); auto& shoes = _skins[(int)SkinType::SHOES]; - shoes.push_back("Girl_Shoes01"); - shoes.push_back("Girl_Shoes02"); + shoes.emplace_back("Girl_Shoes01"); + shoes.emplace_back("Girl_Shoes02"); auto& hair = _skins[(int)SkinType::HAIR]; - hair.push_back("Girl_Hair01"); - hair.push_back("Girl_Hair02"); + hair.emplace_back("Girl_Hair01"); + hair.emplace_back("Girl_Hair02"); auto& face = _skins[(int)SkinType::FACE]; - face.push_back("Girl_Face01"); - face.push_back("Girl_Face02"); + face.emplace_back("Girl_Face01"); + face.emplace_back("Girl_Face02"); auto& hand = _skins[(int)SkinType::HAND]; - hand.push_back("Girl_Hand01"); - hand.push_back("Girl_Hand02"); + hand.emplace_back("Girl_Hand01"); + hand.emplace_back("Girl_Hand02"); auto& glasses = _skins[(int)SkinType::GLASSES]; - glasses.push_back(""); - glasses.push_back("Girl_Glasses01"); + glasses.emplace_back(""); + glasses.emplace_back("Girl_Glasses01"); memset(_curSkin, 0, (int)SkinType::MAX_TYPE * sizeof(int)); @@ -917,7 +917,7 @@ void Scene3DTestScene::onTouchEnd(Touch* touch, Event* event) dir = collisionPoint - _player->getPosition3D(); dir.y = 0; dir.normalize(); - _player->_headingAngle = -1*acos(dir.dot(Vec3(0,0,-1))); + _player->_headingAngle = -1*std::acos(dir.dot(Vec3(0,0,-1))); dir.cross(dir,Vec3(0,0,-1),&_player->_headingAxis); _player->_targetPos=collisionPoint; _player->forward(); diff --git a/tests/cpp-tests/Classes/SchedulerTest/SchedulerTest.cpp b/tests/cpp-tests/Classes/SchedulerTest/SchedulerTest.cpp index 9831f4ffa1ca..eb5663570deb 100644 --- a/tests/cpp-tests/Classes/SchedulerTest/SchedulerTest.cpp +++ b/tests/cpp-tests/Classes/SchedulerTest/SchedulerTest.cpp @@ -61,7 +61,7 @@ SchedulerTests::SchedulerTests() ADD_TEST_CASE(SchedulerIssue17149); ADD_TEST_CASE(SchedulerRemoveEntryWhileUpdate); ADD_TEST_CASE(SchedulerRemoveSelectorDuringCall); -}; +} //------------------------------------------------------------------ // diff --git a/tests/cpp-tests/Classes/ShaderTest/ShaderTest2.cpp b/tests/cpp-tests/Classes/ShaderTest/ShaderTest2.cpp index 89e3f6ca1b91..0c2a900202be 100644 --- a/tests/cpp-tests/Classes/ShaderTest/ShaderTest2.cpp +++ b/tests/cpp-tests/Classes/ShaderTest/ShaderTest2.cpp @@ -74,7 +74,7 @@ class EffectSprite : public Sprite effect->retain(); effect->setTarget(this); - _effects.push_back(std::make_tuple(order,effect,QuadCommand())); + _effects.emplace_back(order,effect,QuadCommand()); std::sort(std::begin(_effects), std::end(_effects), tuple_sort); } diff --git a/tests/cpp-tests/Classes/SpineTest/SpineTest.h b/tests/cpp-tests/Classes/SpineTest/SpineTest.h index d9c9b049e676..b3a2b77f7264 100644 --- a/tests/cpp-tests/Classes/SpineTest/SpineTest.h +++ b/tests/cpp-tests/Classes/SpineTest/SpineTest.h @@ -28,7 +28,7 @@ #include "cocos2d.h" #include "../BaseTest.h" -#include +#include "spine/spine-cocos2dx.h" DEFINE_TEST_SUITE(SpineTests); diff --git a/tests/cpp-tests/Classes/Sprite3DTest/DrawNode3D.cpp b/tests/cpp-tests/Classes/Sprite3DTest/DrawNode3D.cpp index 161e303aa16f..6d406d45aed1 100644 --- a/tests/cpp-tests/Classes/Sprite3DTest/DrawNode3D.cpp +++ b/tests/cpp-tests/Classes/Sprite3DTest/DrawNode3D.cpp @@ -50,7 +50,7 @@ DrawNode3D::~DrawNode3D() if (Configuration::getInstance()->supportsShareableVAO()) { glDeleteVertexArrays(1, &_vao); - glBindVertexArray(0); + GL::bindVAO(0); _vao = 0; } } @@ -92,7 +92,7 @@ bool DrawNode3D::init() if (Configuration::getInstance()->supportsShareableVAO()) { glGenVertexArrays(1, &_vao); - glBindVertexArray(_vao); + GL::bindVAO(_vao); } glGenBuffers(1, &_vbo); @@ -109,7 +109,7 @@ bool DrawNode3D::init() if (Configuration::getInstance()->supportsShareableVAO()) { - glBindVertexArray(0); + GL::bindVAO(0); } CHECK_GL_ERROR_DEBUG(); @@ -143,7 +143,7 @@ void DrawNode3D::onDraw(const Mat4 &transform, uint32_t flags) glProgram->setUniformsForBuiltins(transform); glEnable(GL_DEPTH_TEST); RenderState::StateBlock::_defaultState->setDepthTest(true); - cocos2d::utils::setBlending(_blendFunc.src, _blendFunc.dst); + GL::blendFunc(_blendFunc.src, _blendFunc.dst); if (_dirty) { @@ -153,12 +153,11 @@ void DrawNode3D::onDraw(const Mat4 &transform, uint32_t flags) } if (Configuration::getInstance()->supportsShareableVAO()) { - glBindVertexArray(_vao); + GL::bindVAO(_vao); } else { - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_COLOR); + GL::enableVertexAttribs(GL::VERTEX_ATTRIB_FLAG_POS_COLOR_TEX); glBindBuffer(GL_ARRAY_BUFFER, _vbo); // vertex diff --git a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp index 298091212bed..2855a5fa035a 100644 --- a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp +++ b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp @@ -31,7 +31,7 @@ #include "3d/CCMotionStreak3D.h" #include "extensions/Particle3D/PU/CCPUParticleSystem3D.h" - +#include #include #include "../testResource.h" @@ -71,7 +71,7 @@ Sprite3DTests::Sprite3DTests() ADD_TEST_CASE(Sprite3DPropertyTest); ADD_TEST_CASE(Sprite3DNormalMappingTest); ADD_TEST_CASE(Issue16155Test); -}; +} //------------------------------------------------------------------ // @@ -826,11 +826,11 @@ void Sprite3DEffectTest::onTouchesEnded(const std::vector& touches, Even AsyncLoadSprite3DTest::AsyncLoadSprite3DTest() { - _paths.push_back("Sprite3DTest/boss.obj"); - _paths.push_back("Sprite3DTest/girl.c3b"); - _paths.push_back("Sprite3DTest/orc.c3b"); - _paths.push_back("Sprite3DTest/ReskinGirl.c3b"); - _paths.push_back("Sprite3DTest/axe.c3b"); + _paths.emplace_back("Sprite3DTest/boss.obj"); + _paths.emplace_back("Sprite3DTest/girl.c3b"); + _paths.emplace_back("Sprite3DTest/orc.c3b"); + _paths.emplace_back("Sprite3DTest/ReskinGirl.c3b"); + _paths.emplace_back("Sprite3DTest/axe.c3b"); TTFConfig ttfConfig("fonts/arial.ttf", 15); auto label1 = Label::createWithTTF(ttfConfig,"AsyncLoad Sprite3D"); @@ -1346,32 +1346,32 @@ void Sprite3DReskinTest::addNewSpriteWithCoords(Vec2 p) _sprite = sprite; auto& body = _skins[(int)SkinType::UPPER_BODY]; - body.push_back("Girl_UpperBody01"); - body.push_back("Girl_UpperBody02"); + body.emplace_back("Girl_UpperBody01"); + body.emplace_back("Girl_UpperBody02"); auto& pants = _skins[(int)SkinType::PANTS]; - pants.push_back("Girl_LowerBody01"); - pants.push_back("Girl_LowerBody02"); + pants.emplace_back("Girl_LowerBody01"); + pants.emplace_back("Girl_LowerBody02"); auto& shoes = _skins[(int)SkinType::SHOES]; - shoes.push_back("Girl_Shoes01"); - shoes.push_back("Girl_Shoes02"); + shoes.emplace_back("Girl_Shoes01"); + shoes.emplace_back("Girl_Shoes02"); auto& hair = _skins[(int)SkinType::HAIR]; - hair.push_back("Girl_Hair01"); - hair.push_back("Girl_Hair02"); + hair.emplace_back("Girl_Hair01"); + hair.emplace_back("Girl_Hair02"); auto& face = _skins[(int)SkinType::FACE]; - face.push_back("Girl_Face01"); - face.push_back("Girl_Face02"); + face.emplace_back("Girl_Face01"); + face.emplace_back("Girl_Face02"); auto& hand = _skins[(int)SkinType::HAND]; - hand.push_back("Girl_Hand01"); - hand.push_back("Girl_Hand02"); + hand.emplace_back("Girl_Hand01"); + hand.emplace_back("Girl_Hand02"); auto& glasses = _skins[(int)SkinType::GLASSES]; - glasses.push_back(""); - glasses.push_back("Girl_Glasses01"); + glasses.emplace_back(""); + glasses.emplace_back("Girl_Glasses01"); memset(_curSkin, 0, (int)SkinType::MAX_TYPE * sizeof(int)); @@ -1509,7 +1509,7 @@ void Sprite3DWithOBBPerformanceTest::update(float dt) _obbt.getCorners(corners); _drawDebug->drawCube(corners, Color4F(0,0,1,1)); } - if(_obb.size() > 0) + if(!_obb.empty()) { _drawOBB->clear(); auto obbSize = _obb.size(); @@ -1634,7 +1634,7 @@ void Sprite3DWithOBBPerformanceTest::calculateRayByLocationInView(Ray* ray, cons { auto dir = Director::getInstance(); auto view = dir->getWinSize(); - auto mat = dir->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION); + const auto& mat = dir->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION); Vec3 src = Vec3(location.x, location.y, -1); Vec3 nearPoint; @@ -2159,7 +2159,7 @@ void Sprite3DCubeMapTest::addNewSpriteWithCoords(Vec2 p) void Sprite3DCubeMapTest::onTouchesMoved(const std::vector& touches, cocos2d::Event *event) { - if (touches.size()) + if (!touches.empty()) { auto touch = touches[0]; auto delta = touch->getDelta(); @@ -2295,8 +2295,7 @@ Animate3DCallbackTest::Animate3DCallbackTest() ValueMap valuemap0; animate->setKeyFrameUserInfo(275, valuemap0); - - auto listener = EventListenerCustom::create(Animate3DDisplayedNotification, [&](EventCustom* event) + _customEventListener = EventListenerCustom::create(Animate3DDisplayedNotification, [&](EventCustom* event) { auto info = (Animate3D::Animate3DDisplayedEventInfo*)event->getUserData(); auto node = getChildByTag(100); @@ -2310,12 +2309,19 @@ Animate3DCallbackTest::Animate3DCallbackTest() cocos2d::log("frame %d", info->frame); }); - Director::getInstance()->getEventDispatcher()->addEventListenerWithFixedPriority(listener, -1); + Director::getInstance()->getEventDispatcher()->addEventListenerWithFixedPriority(_customEventListener, -1); } } Animate3DCallbackTest::~Animate3DCallbackTest() { + cocos2d::log("Animate3DCallbackTest destroied!"); + if(_customEventListener) + { + Director::getInstance()->getEventDispatcher()->removeEventListener(_customEventListener); + _customEventListener = nullptr; + } + } std::string Animate3DCallbackTest::title() const @@ -2441,7 +2447,8 @@ CameraBackgroundClearTest::CameraBackgroundClearTest() void CameraBackgroundClearTest::switch_CameraClearMode(cocos2d::Ref* sender) { - auto type = _camera->getBackgroundBrush()->getBrushType(); + auto brush = _camera->getBackgroundBrush(); + auto type = brush ? brush->getBrushType() : CameraBackgroundBrush::BrushType::NONE; if (type == CameraBackgroundBrush::BrushType::NONE) { _camera->setBackgroundBrush(CameraBackgroundBrush::createDepthBrush(1.f)); @@ -2569,7 +2576,7 @@ void Sprite3DNormalMappingTest::update(float dt) static float radius = 100.0f; auto light = static_cast(getChildByTag(100)); - light->setPosition3D(Vec3(radius * cos(angle), 0.0f, radius * sin(angle))); + light->setPosition3D(Vec3(radius * std::cos(angle), 0.0f, radius * std::sin(angle))); if (reverseDir){ angle -= 0.01f; if (angle < 0.0) diff --git a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.h b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.h index ef7fd284b5dc..eba8acc285ac 100644 --- a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.h +++ b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.h @@ -527,6 +527,7 @@ class Animate3DCallbackTest : public Sprite3DTestDemo protected: cocos2d::Sprite3D* _sprite3d; + cocos2d::EventListenerCustom *_customEventListener = nullptr; }; class Sprite3DTestMeshLight : public Sprite3DTestDemo diff --git a/tests/cpp-tests/Classes/SpriteFrameCacheTest/SpriteFrameCacheTest.cpp b/tests/cpp-tests/Classes/SpriteFrameCacheTest/SpriteFrameCacheTest.cpp index bf17d4f83c44..5e1fe346633f 100644 --- a/tests/cpp-tests/Classes/SpriteFrameCacheTest/SpriteFrameCacheTest.cpp +++ b/tests/cpp-tests/Classes/SpriteFrameCacheTest/SpriteFrameCacheTest.cpp @@ -26,6 +26,8 @@ #include "SpriteFrameCacheTest.h" +#include + // enable log #define COCOS2D_DEBUG 1 @@ -34,6 +36,8 @@ USING_NS_CC; SpriteFrameCacheTests::SpriteFrameCacheTests() { ADD_TEST_CASE(SpriteFrameCachePixelFormatTest); + ADD_TEST_CASE(SpriteFrameCacheLoadMultipleTimes); + ADD_TEST_CASE(SpriteFrameCacheFullCheck); } SpriteFrameCachePixelFormatTest::SpriteFrameCachePixelFormatTest() @@ -84,4 +88,55 @@ void SpriteFrameCachePixelFormatTest::loadSpriteFrames(const std::string &file, SpriteFrameCache::getInstance()->removeSpriteFramesFromFile(file); Director::getInstance()->getTextureCache()->removeTexture(texture); -} \ No newline at end of file +} + + +SpriteFrameCacheLoadMultipleTimes::SpriteFrameCacheLoadMultipleTimes() +{ + const Size screenSize = Director::getInstance()->getWinSize(); + + // load atlas definition with specified PixelFormat and check that it matches to expected format + loadSpriteFrames("Images/sprite_frames_test/test_RGBA8888.plist", Texture2D::PixelFormat::RGBA8888); + loadSpriteFrames("Images/sprite_frames_test/test_RGBA8888.plist", Texture2D::PixelFormat::RGBA8888); + loadSpriteFrames("Images/sprite_frames_test/test_RGBA8888.plist", Texture2D::PixelFormat::RGBA8888); + loadSpriteFrames("Images/sprite_frames_test/test_RGBA8888.plist", Texture2D::PixelFormat::RGBA8888); + +} + +void SpriteFrameCacheLoadMultipleTimes::loadSpriteFrames(const std::string &file, cocos2d::Texture2D::PixelFormat expectedFormat) +{ + SpriteFrameCache::getInstance()->addSpriteFramesWithFile(file); + SpriteFrame *spriteFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName("grossini.png"); + Texture2D *texture = spriteFrame->getTexture(); + CC_ASSERT(texture->getPixelFormat() == expectedFormat); + + SpriteFrameCache::getInstance()->removeSpriteFrameByName("grossini.png"); + Director::getInstance()->getTextureCache()->removeTexture(texture); +} + + +SpriteFrameCacheFullCheck::SpriteFrameCacheFullCheck() +{ + const Size screenSize = Director::getInstance()->getWinSize(); + // load atlas definition with specified PixelFormat and check that it matches to expected format + loadSpriteFrames("Images/test_polygon.plist", Texture2D::PixelFormat::RGBA8888); +} + +void SpriteFrameCacheFullCheck::loadSpriteFrames(const std::string &file, cocos2d::Texture2D::PixelFormat expectedFormat) +{ + auto cache = SpriteFrameCache::getInstance(); + + CCASSERT(cache->isSpriteFramesWithFileLoaded("plist which not exists") == false, "Plist not exists"); + + cache->addSpriteFramesWithFile(file); + CCASSERT(cache->isSpriteFramesWithFileLoaded(file) == true, "Plist should be full after loaded"); + + cache->removeSpriteFrameByName("not_exists_grossinis_sister.png"); + CCASSERT(cache->isSpriteFramesWithFileLoaded(file) == true, "Plist should not be still full"); + + cache->removeSpriteFrameByName("grossinis_sister1.png"); + CCASSERT(cache->isSpriteFramesWithFileLoaded(file) == false, "Plist should not be full after remove any sprite"); + + cache->addSpriteFramesWithFile(file); + CCASSERT(cache->isSpriteFramesWithFileLoaded(file) == true, "Plist should be full after reloaded"); +} diff --git a/tests/cpp-tests/Classes/SpriteFrameCacheTest/SpriteFrameCacheTest.h b/tests/cpp-tests/Classes/SpriteFrameCacheTest/SpriteFrameCacheTest.h index 5a55ff1f5388..99377028182c 100644 --- a/tests/cpp-tests/Classes/SpriteFrameCacheTest/SpriteFrameCacheTest.h +++ b/tests/cpp-tests/Classes/SpriteFrameCacheTest/SpriteFrameCacheTest.h @@ -45,4 +45,35 @@ class SpriteFrameCachePixelFormatTest : public TestCase private: cocos2d::Label *infoLabel; +}; + +class SpriteFrameCacheLoadMultipleTimes : public TestCase +{ +public: + CREATE_FUNC(SpriteFrameCacheLoadMultipleTimes); + + virtual std::string title() const override { return "Load same plist multiple times"; } + virtual std::string subtitle() const override { return "It shouldn't crash"; } + + SpriteFrameCacheLoadMultipleTimes(); + +private: + void loadSpriteFrames(const std::string &file, cocos2d::Texture2D::PixelFormat expectedFormat); + +}; + + +class SpriteFrameCacheFullCheck: public TestCase +{ +public: + CREATE_FUNC(SpriteFrameCacheFullCheck); + + virtual std::string title() const override { return "Test isSpriteFramesWithFileLoaded"; } + virtual std::string subtitle() const override { return "It shouldn't crash"; } + + SpriteFrameCacheFullCheck(); + +private: + void loadSpriteFrames(const std::string &file, cocos2d::Texture2D::PixelFormat expectedFormat); + }; \ No newline at end of file diff --git a/tests/cpp-tests/Classes/SpritePolygonTest/SpritePolygonTest.cpp b/tests/cpp-tests/Classes/SpritePolygonTest/SpritePolygonTest.cpp index 6d8cfd97421b..0be8bbdc8e2b 100644 --- a/tests/cpp-tests/Classes/SpritePolygonTest/SpritePolygonTest.cpp +++ b/tests/cpp-tests/Classes/SpritePolygonTest/SpritePolygonTest.cpp @@ -110,7 +110,7 @@ bool SpritePolygonTestCase::init() void SpritePolygonTestCase::updateDrawNode() { - if (_isDebugDraw && _drawNodes.size() > 0) { + if (_isDebugDraw && !_drawNodes.empty()) { for (int i = 0; i < _drawNodes.size(); i++) { auto drawnode = _drawNodes.at(i); @@ -297,15 +297,16 @@ void SpritePolygonTestSlider::initSliders() slider->loadSlidBallTextures("cocosui/sliderThumb.png", "cocosui/sliderThumb.png", ""); slider->loadProgressBarTexture("cocosui/sliderProgress.png"); slider->setPosition(Vec2(vsize.width/2, vsize.height/4)); - - slider->addEventListener(CC_CALLBACK_2(SpritePolygonTestSlider::changeEpsilon, this)); - slider->setPercent((int)(sqrtf(1.0f/19.0f)*100)); - + auto ttfConfig = TTFConfig("fonts/arial.ttf", 8); _epsilonLabel = Label::createWithTTF(ttfConfig, "Epsilon: 2.0"); addChild(_epsilonLabel); _epsilonLabel->setPosition(Vec2(vsize.width/2, vsize.height/4 + 15)); addChild(slider); + + slider->addEventListener(CC_CALLBACK_2(SpritePolygonTestSlider::changeEpsilon, this)); + slider->setPercent((int)(sqrtf(1.0f/19.0f)*100)); + } void SpritePolygonTestSlider::makeSprites(const std::string* list, const int count, const float y) @@ -327,7 +328,7 @@ void SpritePolygonTestSlider::changeEpsilon(cocos2d::Ref *pSender, cocos2d::ui:: float epsilon = powf(slider->getPercent()/100.0,2)*19.0f + 1.0f; for(auto child : _children) { - if(child->getName().size()) + if(!child->getName().empty()) { Sprite *sp = (Sprite*)child; auto file = sp->getName(); @@ -344,7 +345,7 @@ void SpritePolygonTestSlider::changeEpsilon(cocos2d::Ref *pSender, cocos2d::ui:: void SpritePolygonTestSlider::updateLabel(const cocos2d::Sprite *sp, const PolygonInfo &pinfo) { Label *label = (Label*)(sp->getChildByName(sp->getName())); - auto filename = sp->getName(); + const auto& filename = sp->getName(); auto size = pinfo.getRect().size/Director::getInstance()->getContentScaleFactor(); label->setString(filename+"\nVerts: "+Value((int)pinfo.getVertCount()).asString()+ "\nPixels: "+Value((int)(pinfo.getArea()/(size.width*size.height)*100)).asString()+"%"); } diff --git a/tests/cpp-tests/Classes/SpriteTest/SpriteTest.cpp b/tests/cpp-tests/Classes/SpriteTest/SpriteTest.cpp index 51c319c0e283..423b67d70d65 100644 --- a/tests/cpp-tests/Classes/SpriteTest/SpriteTest.cpp +++ b/tests/cpp-tests/Classes/SpriteTest/SpriteTest.cpp @@ -137,7 +137,7 @@ SpriteTests::SpriteTests() ADD_TEST_CASE(SpriteSlice9Test9); ADD_TEST_CASE(SpriteSlice9Test10); ADD_TEST_CASE(Issue17119); -}; +} //------------------------------------------------------------------ // @@ -5420,9 +5420,9 @@ void SpriteSlice9Test5::update(float dt) float angle = _elapsed; // cap the value between 0 and 0.8 - float x = ((cos(angle) + sin(angle*3)) + 2) / 5.0f; - float y1 = (sin(angle) + 1) / 2.5; - float y2 = (sin(angle+M_PI_2) + 1) / 2.5; + float x = ((std::cos(angle) + std::sin(angle*3)) + 2) / 5.0f; + float y1 = (std::sin(angle) + 1) / 2.5; + float y2 = (std::sin(angle+M_PI_2) + 1) / 2.5; float y = y1; for (int i=0; i<3; ++i) { if (i==1) { @@ -5493,9 +5493,9 @@ void SpriteSlice9Test6::update(float dt) float angle = _elapsed; // cap the value between 0 and 1 - float x = ((cos(angle*2) - sin(angle/2)) + 2) / 4; - float y1 = (sin(angle) + 1) / 2; - float y2 = (sin(angle+M_PI_2) + 1) / 2; + float x = ((std::cos(angle*2) - std::sin(angle/2)) + 2) / 4; + float y1 = (std::sin(angle) + 1) / 2; + float y2 = (std::sin(angle+M_PI_2) + 1) / 2; float y = y1; for (int i=0; i<3; ++i) { if (i==1) { diff --git a/tests/cpp-tests/Classes/TerrainTest/TerrainTest.cpp b/tests/cpp-tests/Classes/TerrainTest/TerrainTest.cpp index 8aedddc6f3ea..b3fa631ff777 100644 --- a/tests/cpp-tests/Classes/TerrainTest/TerrainTest.cpp +++ b/tests/cpp-tests/Classes/TerrainTest/TerrainTest.cpp @@ -23,6 +23,7 @@ ****************************************************************************/ #include "TerrainTest.h" +#include USING_NS_CC; @@ -196,7 +197,7 @@ void TerrainWalkThru::onTouchesEnd(const std::vector& touches, dir = collisionPoint - _player->getPosition3D(); dir.y = 0; dir.normalize(); - _player->_headingAngle = -1*acos(dir.dot(Vec3(0,0,-1))); + _player->_headingAngle = -1*std::acos(dir.dot(Vec3(0,0,-1))); dir.cross(dir,Vec3(0,0,-1),&_player->_headingAxis); _player->_targetPos=collisionPoint; _player->forward(); diff --git a/tests/cpp-tests/Classes/TextInputTest/TextInputTest.cpp b/tests/cpp-tests/Classes/TextInputTest/TextInputTest.cpp index f5a6c5c6380b..a2becf370e40 100644 --- a/tests/cpp-tests/Classes/TextInputTest/TextInputTest.cpp +++ b/tests/cpp-tests/Classes/TextInputTest/TextInputTest.cpp @@ -63,6 +63,7 @@ KeyboardNotificationLayer::KeyboardNotificationLayer() auto listener = EventListenerTouchOneByOne::create(); listener->onTouchBegan = CC_CALLBACK_2(KeyboardNotificationLayer::onTouchBegan, this); listener->onTouchEnded = CC_CALLBACK_2(KeyboardNotificationLayer::onTouchEnded, this); + listener->onTouchCancelled = CC_CALLBACK_2(KeyboardNotificationLayer::onTouchCancelled, this); _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this); } @@ -139,6 +140,11 @@ void KeyboardNotificationLayer::onTouchEnded(Touch *touch, Event *event) CCLOG("----------------------------------"); } +void KeyboardNotificationLayer::onTouchCancelled(cocos2d::Touch* touch, cocos2d::Event* event) +{ + onTouchEnded(touch, event); +} + ////////////////////////////////////////////////////////////////////////// // implement TextFieldTTFDefaultTest ////////////////////////////////////////////////////////////////////////// @@ -451,4 +457,4 @@ void TextFieldTTSetCursorFromPoint::onEnter() #endif _trackNode = pTextField; -} \ No newline at end of file +} diff --git a/tests/cpp-tests/Classes/TextInputTest/TextInputTest.h b/tests/cpp-tests/Classes/TextInputTest/TextInputTest.h index 050cd75ac40c..f818a600e73e 100644 --- a/tests/cpp-tests/Classes/TextInputTest/TextInputTest.h +++ b/tests/cpp-tests/Classes/TextInputTest/TextInputTest.h @@ -46,6 +46,7 @@ class KeyboardNotificationLayer : public TestCase, public cocos2d::IMEDelegate bool onTouchBegan(cocos2d::Touch* touch, cocos2d::Event* event); void onTouchEnded(cocos2d::Touch* touch, cocos2d::Event* event); + void onTouchCancelled(cocos2d::Touch* touch, cocos2d::Event* event); protected: cocos2d::Node* _trackNode; diff --git a/tests/cpp-tests/Classes/Texture2dTest/Texture2dTest.cpp b/tests/cpp-tests/Classes/Texture2dTest/Texture2dTest.cpp index 6baa2ce88341..5758d5f29310 100644 --- a/tests/cpp-tests/Classes/Texture2dTest/Texture2dTest.cpp +++ b/tests/cpp-tests/Classes/Texture2dTest/Texture2dTest.cpp @@ -109,7 +109,7 @@ Texture2DTests::Texture2DTests() ADD_TEST_CASE(TextureConvertRGBA8888); ADD_TEST_CASE(TextureConvertI8); ADD_TEST_CASE(TextureConvertAI88); -}; +} //------------------------------------------------------------------ // @@ -1943,7 +1943,7 @@ void TextureMemoryAlloc::updateImage(cocos2d::Ref *sender) break; } - _background = Sprite::create(file.c_str()); + _background = Sprite::create(file); addChild(_background, -10); _background->setVisible(false); diff --git a/tests/cpp-tests/Classes/TileMapTest/TileMapTest.cpp b/tests/cpp-tests/Classes/TileMapTest/TileMapTest.cpp index 94b01cd25419..5722fc74a7d1 100644 --- a/tests/cpp-tests/Classes/TileMapTest/TileMapTest.cpp +++ b/tests/cpp-tests/Classes/TileMapTest/TileMapTest.cpp @@ -80,6 +80,7 @@ TileMapTests::TileMapTests() ADD_TEST_CASE(TMXHexAxisXTest); ADD_TEST_CASE(Issue16105Test); ADD_TEST_CASE(Issue16512Test); + ADD_TEST_CASE(TileAnimTest); } TileDemo::TileDemo() @@ -94,7 +95,7 @@ TileDemo::TileDemo() _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this); } -TileDemo::~TileDemo(void) +TileDemo::~TileDemo() { } @@ -1362,10 +1363,10 @@ TMXOrthoFromXMLTest::TMXOrthoFromXMLTest() std::string resources = "TileMaps"; // partial paths are OK as resource paths. std::string file = resources + "/orthogonal-test1.tmx"; - auto str = __String::createWithContentsOfFile(FileUtils::getInstance()->fullPathForFilename(file.c_str()).c_str()); + auto str = __String::createWithContentsOfFile(FileUtils::getInstance()->fullPathForFilename(file)); CCASSERT(str != nullptr, "Unable to open file"); - auto map = TMXTiledMap::createWithXML(str->getCString() ,resources.c_str()); + auto map = TMXTiledMap::createWithXML(str->getCString() ,resources); addChild(map, 0, kTagTileMap); auto s = map->getContentSize(); @@ -1722,3 +1723,35 @@ std::string Issue16512Test::title() const { return "Github Issue #16512. Should not crash"; } + +//------------------------------------------------------------------ +// +// TileAnimationTest +// +//------------------------------------------------------------------ +TileAnimTest::TileAnimTest() +{ + + map = TMXTiledMap::create("TileMaps/tile_animation_test.tmx"); + addChild(map, 0, kTagTileMap); + + auto listener = EventListenerTouchAllAtOnce::create(); + listener->onTouchesBegan= CC_CALLBACK_2(TileAnimTest::onTouchBegan, this); + _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this); + + Size CC_UNUSED s = map->getContentSize(); + CCLOG("ContentSize: %f, %f", s.width,s.height); + + map->setTileAnimEnabled(_animStarted); +} + +std::string TileAnimTest::title() const +{ + return "Tile animation test. Click to toggle the animation"; +} + +void TileAnimTest::onTouchBegan(const std::vector& touches, cocos2d::Event* event) +{ + _animStarted = !_animStarted; + map->setTileAnimEnabled(_animStarted); +} diff --git a/tests/cpp-tests/Classes/TileMapTest/TileMapTest.h b/tests/cpp-tests/Classes/TileMapTest/TileMapTest.h index 252ba7aa2a38..7c0434566860 100644 --- a/tests/cpp-tests/Classes/TileMapTest/TileMapTest.h +++ b/tests/cpp-tests/Classes/TileMapTest/TileMapTest.h @@ -412,4 +412,16 @@ class Issue16512Test : public TileDemo }; +class TileAnimTest : public TileDemo +{ +public: + CREATE_FUNC(TileAnimTest); + TileAnimTest(); + virtual std::string title() const override; + + cocos2d::TMXTiledMap* map; + bool _animStarted = true; + void onTouchBegan(const std::vector& touches, cocos2d::Event* event); +}; + #endif diff --git a/tests/cpp-tests/Classes/TileMapTest/TileMapTest2.cpp b/tests/cpp-tests/Classes/TileMapTest/TileMapTest2.cpp index 9411053f96b2..e4d1849ef261 100644 --- a/tests/cpp-tests/Classes/TileMapTest/TileMapTest2.cpp +++ b/tests/cpp-tests/Classes/TileMapTest/TileMapTest2.cpp @@ -1235,10 +1235,10 @@ TMXOrthoFromXMLTestNew::TMXOrthoFromXMLTestNew() std::string resources = "TileMaps"; // partial paths are OK as resource paths. std::string file = resources + "/orthogonal-test1.tmx"; - auto str = __String::createWithContentsOfFile(FileUtils::getInstance()->fullPathForFilename(file.c_str()).c_str()); + auto str = __String::createWithContentsOfFile(FileUtils::getInstance()->fullPathForFilename(file)); CCASSERT(str != nullptr, "Unable to open file"); - auto map = cocos2d::experimental::TMXTiledMap::createWithXML(str->getCString() ,resources.c_str()); + auto map = cocos2d::experimental::TMXTiledMap::createWithXML(str->getCString() ,resources); addChild(map, 0, kTagTileMap); auto s = map->getContentSize(); diff --git a/tests/cpp-tests/Classes/TouchesTest/Ball.cpp b/tests/cpp-tests/Classes/TouchesTest/Ball.cpp index c6107134b995..44986168062c 100644 --- a/tests/cpp-tests/Classes/TouchesTest/Ball.cpp +++ b/tests/cpp-tests/Classes/TouchesTest/Ball.cpp @@ -28,11 +28,11 @@ USING_NS_CC; -Ball::Ball(void) +Ball::Ball() { } -Ball::~Ball(void) +Ball::~Ball() { } diff --git a/tests/cpp-tests/Classes/TouchesTest/Paddle.cpp b/tests/cpp-tests/Classes/TouchesTest/Paddle.cpp index e5c919aa525a..792c6654e44e 100644 --- a/tests/cpp-tests/Classes/TouchesTest/Paddle.cpp +++ b/tests/cpp-tests/Classes/TouchesTest/Paddle.cpp @@ -26,11 +26,11 @@ USING_NS_CC; -Paddle::Paddle(void) +Paddle::Paddle() { } -Paddle::~Paddle(void) +Paddle::~Paddle() { } diff --git a/tests/cpp-tests/Classes/TouchesTest/TouchesTest.cpp b/tests/cpp-tests/Classes/TouchesTest/TouchesTest.cpp index cf279f607508..a01fe2eb0899 100644 --- a/tests/cpp-tests/Classes/TouchesTest/TouchesTest.cpp +++ b/tests/cpp-tests/Classes/TouchesTest/TouchesTest.cpp @@ -166,7 +166,7 @@ std::string ForceTouchTest::title() const std::string ForceTouchTest::subtitle() const { - return std::string("Touch with force to see info label changes\nOnly work on iPhone6s / iPhone6s Plus"); + return std::string("Touch with force to see info label changes\n work on iPhone6s+"); } void ForceTouchTest::onTouchesBegan(const std::vector& touches, cocos2d::Event* event) diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIFocusTest/UIFocusTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIFocusTest/UIFocusTest.cpp index fbfe0aa1cc0d..7c2a5a0b424c 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIFocusTest/UIFocusTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIFocusTest/UIFocusTest.cpp @@ -64,22 +64,21 @@ bool UIFocusTestBase::init() _dpadMenu = Menu::create(); - auto winSize = Director::getInstance()->getVisibleSize(); auto leftItem = MenuItemFont::create("Left", CC_CALLBACK_0(UIFocusTestBase::onLeftKeyPressed, this)); - leftItem->setPosition(Vec2(winSize.width - 100, winSize.height/2)); + leftItem->setPosition(VisibleRect::right() + Vec2(-100, 0)); _dpadMenu->addChild(leftItem); auto rightItem = MenuItemFont::create("Right", CC_CALLBACK_0(UIFocusTestBase::onRightKeyPressed, this)); - rightItem->setPosition(Vec2(winSize.width - 30, winSize.height/2)); + rightItem->setPosition(VisibleRect::right() + Vec2(-30, 0)); _dpadMenu->addChild(rightItem); auto upItem = MenuItemFont::create("Up", CC_CALLBACK_0(UIFocusTestBase::onUpKeyPressed, this)); - upItem->setPosition(Vec2(winSize.width - 60, winSize.height/2 + 50)); + upItem->setPosition(VisibleRect::right() + Vec2(-60, 50)); _dpadMenu->addChild(upItem); auto downItem = MenuItemFont::create("Down", CC_CALLBACK_0(UIFocusTestBase::onDownKeyPressed, this)); - downItem->setPosition(Vec2(winSize.width - 60, winSize.height/2 - 50)); + downItem->setPosition(VisibleRect::right() + Vec2(-60, -50)); _dpadMenu->addChild(downItem); _dpadMenu->setPosition(Vec2::ZERO); @@ -95,7 +94,7 @@ bool UIFocusTestBase::init() _toggleButton = Button::create("cocosui/switch-mask.png"); _toggleButton->setTitleText("Toggle Loop"); - _toggleButton->setPosition(Vec2(60, winSize.height - 50)); + _toggleButton->setPosition(VisibleRect::leftTop() + Vec2(60, -50)); _toggleButton->setTitleColor(Color3B::RED); _toggleButton->setFocusEnabled(false); this->addChild(_toggleButton); @@ -181,10 +180,8 @@ bool UIFocusTestHorizontal::init() { if (UIFocusTestBase::init()) { - Size winSize = Director::getInstance()->getVisibleSize(); - _horizontalLayout = HBox::create(); - _horizontalLayout->setPosition(Vec2(20, winSize.height/2 + 40)); + _horizontalLayout->setPosition(VisibleRect::left() + Vec2(20, 40)); _uiLayer->addChild(_horizontalLayout); _horizontalLayout->setFocused(true); @@ -202,7 +199,7 @@ bool UIFocusTestHorizontal::init() } _loopText = Text::create("loop enabled", "Arial", 20); - _loopText->setPosition(Vec2(winSize.width/2, winSize.height - 50)); + _loopText->setPosition(VisibleRect::top() + Vec2(0, -50)); _loopText->setColor(Color3B::GREEN); this->addChild(_loopText); @@ -244,10 +241,8 @@ bool UIFocusTestVertical::init() { if (UIFocusTestBase::init()) { - Size winSize = Director::getInstance()->getVisibleSize(); - _verticalLayout = VBox::create(); - _verticalLayout->setPosition(Vec2(winSize.width/2 - 100, winSize.height - 70)); + _verticalLayout->setPosition(VisibleRect::top() + Vec2(-100, -70)); _uiLayer->addChild(_verticalLayout); _verticalLayout->setTag(100); _verticalLayout->setScale(0.5); @@ -266,7 +261,7 @@ bool UIFocusTestVertical::init() } _loopText = Text::create("loop enabled", "Arial", 20); - _loopText->setPosition(Vec2(winSize.width/2, winSize.height - 50)); + _loopText->setPosition(VisibleRect::top() + Vec2(0, -50)); _loopText->setColor(Color3B::GREEN); this->addChild(_loopText); @@ -305,10 +300,8 @@ bool UIFocusTestNestedLayout1::init() { if (UIFocusTestBase::init()) { - Size winSize = Director::getInstance()->getVisibleSize(); - _verticalLayout = VBox::create(); - _verticalLayout->setPosition(Vec2(winSize.width/2 - 80, winSize.height - 70)); + _verticalLayout->setPosition(VisibleRect::top() + Vec2(-80, -70)); _uiLayer->addChild(_verticalLayout); _verticalLayout->setScale(0.5); @@ -362,7 +355,7 @@ bool UIFocusTestNestedLayout1::init() } _loopText = Text::create("loop enabled", "Arial", 20); - _loopText->setPosition(Vec2(winSize.width/2, winSize.height - 50)); + _loopText->setPosition(VisibleRect::top() + Vec2(0, -50)); _loopText->setColor(Color3B::GREEN); this->addChild(_loopText); @@ -401,10 +394,8 @@ bool UIFocusTestNestedLayout2::init() { if (UIFocusTestBase::init()) { - Size winSize = Director::getInstance()->getVisibleSize(); - _horizontalLayout = HBox::create(); - _horizontalLayout->setPosition(Vec2(winSize.width/2 - 200, winSize.height - 70)); + _horizontalLayout->setPosition(VisibleRect::top() + Vec2(-200, -70)); _uiLayer->addChild(_horizontalLayout); _horizontalLayout->setScale(0.6f); @@ -458,7 +449,7 @@ bool UIFocusTestNestedLayout2::init() } _loopText = Text::create("loop enabled", "Arial", 20); - _loopText->setPosition(Vec2(winSize.width/2, winSize.height - 50)); + _loopText->setPosition(VisibleRect::top() + Vec2(0, -50)); _loopText->setColor(Color3B::GREEN); this->addChild(_loopText); @@ -497,10 +488,9 @@ bool UIFocusTestNestedLayout3::init() { if (UIFocusTestBase::init()) { - Size winSize = Director::getInstance()->getVisibleSize(); - _verticalLayout = VBox::create(); - _verticalLayout->setPosition(Vec2(40, winSize.height - 70)); + _verticalLayout->setPosition(VisibleRect::leftTop() + Vec2(40, -70)); + _uiLayer->addChild(_verticalLayout); _verticalLayout->setScale(0.8f); @@ -562,7 +552,7 @@ bool UIFocusTestNestedLayout3::init() _loopText = Text::create("loop enabled", "Arial", 20); - _loopText->setPosition(Vec2(winSize.width/2, winSize.height - 50)); + _loopText->setPosition(VisibleRect::top() + Vec2(0, -50)); _loopText->setColor(Color3B::GREEN); this->addChild(_loopText); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILayoutTest/UILayoutTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILayoutTest/UILayoutTest.cpp index 687e570c9505..6d91f6b3d68d 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILayoutTest/UILayoutTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILayoutTest/UILayoutTest.cpp @@ -42,6 +42,7 @@ UILayoutTests::UILayoutTests() ADD_TEST_CASE(UILayoutComponentTest); ADD_TEST_CASE(UILayoutComponent_Berth_Test); ADD_TEST_CASE(UILayoutComponent_Berth_Stretch_Test); + ADD_TEST_CASE(UILayoutTest_Issue19890); } // UILayoutTest @@ -956,3 +957,62 @@ bool UILayoutComponent_Berth_Stretch_Test::init() } return false; } + +bool UILayoutTest_Issue19890::init() +{ + if (!UIScene::init()) + { + return false; + } + + const Size widgetSize = _widget->getContentSize(); + + auto label = Text::create("Issue 19890", "fonts/Marker Felt.ttf", 32); + label->setAnchorPoint(Vec2(0.5f, -1.0f)); + label->setPosition(Vec2(widgetSize.width / 2.0f, + widgetSize.height / 2.0f + label->getContentSize().height * 1.5f)); + _uiLayer->addChild(label); + + Text* alert = Text::create("3 panels should be completely visible", "fonts/Marker Felt.ttf", 20); + alert->setColor(Color3B(159, 168, 176)); + alert->setPosition(Vec2(widgetSize.width / 2.0f, + widgetSize.height / 2.0f - alert->getContentSize().height * 3.075f)); + _uiLayer->addChild(alert); + + Layout* root = static_cast(_uiLayer->getChildByTag(81)); + + Layout* background = dynamic_cast(root->getChildByName("background_Panel")); + const Size backgroundSize = background->getContentSize(); + + auto panel = ui::Layout::create(); + panel->setBackGroundColor(Color3B::RED); + panel->setBackGroundColorType(ui::Layout::BackGroundColorType::SOLID); + panel->setClippingType(ui::Layout::ClippingType::SCISSOR); + panel->setPosition(backgroundSize / 2); + panel->setAnchorPoint(Vec2::ANCHOR_MIDDLE); + panel->setClippingEnabled(true); + panel->setContentSize(backgroundSize); // from the left to the screen end + background->addChild(panel); + + auto panel2 = ui::Layout::create(); + panel2->setBackGroundColor(Color3B::BLUE); + panel2->setBackGroundColorType(ui::Layout::BackGroundColorType::SOLID); + panel2->setClippingType(ui::Layout::ClippingType::SCISSOR); + panel2->setPosition(panel->getContentSize() / 2); + panel2->setAnchorPoint(Vec2::ANCHOR_MIDDLE); + panel2->setClippingEnabled(true); + panel2->setContentSize(panel->getContentSize() / 2); // from the left to the screen end + panel->addChild(panel2); + + auto panel3 = ui::Layout::create(); + panel3->setBackGroundColor(Color3B::GREEN); + panel3->setBackGroundColorType(ui::Layout::BackGroundColorType::SOLID); + panel3->setClippingType(ui::Layout::ClippingType::SCISSOR); + panel3->setPosition(panel2->getContentSize() / 2); + panel3->setAnchorPoint(Vec2::ANCHOR_MIDDLE); + panel3->setClippingEnabled(true); + panel3->setContentSize(panel2->getContentSize() / 2); // from the left to the screen end + panel2->addChild(panel3); + + return true; +} \ No newline at end of file diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILayoutTest/UILayoutTest.h b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILayoutTest/UILayoutTest.h index 1f15ff5338db..18c01b2fa508 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILayoutTest/UILayoutTest.h +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILayoutTest/UILayoutTest.h @@ -162,4 +162,12 @@ class UILayoutComponent_Berth_Stretch_Test : public UILayoutComponentTest CREATE_FUNC(UILayoutComponent_Berth_Stretch_Test); }; +class UILayoutTest_Issue19890 : public UIScene +{ +public: + virtual bool init() override; + + CREATE_FUNC(UILayoutTest_Issue19890); +}; + #endif /* defined(__TestCpp__UILayoutTest__) */ diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIListViewTest/UIListViewTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIListViewTest/UIListViewTest.cpp index 9011512ef84c..485d30f1123c 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIListViewTest/UIListViewTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIListViewTest/UIListViewTest.cpp @@ -84,7 +84,7 @@ bool UIListViewTest_Vertical::init() Layout* root = static_cast(_uiLayer->getChildByTag(81)); Layout* background = dynamic_cast(root->getChildByName("background_Panel")); - Size backgroundSize = background->getContentSize(); + const Size& backgroundSize = background->getContentSize(); // create list view ex data diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.cpp index ffc0d819372e..8ce156c49edc 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.cpp @@ -81,7 +81,7 @@ bool UIPageViewTest::init() PageView* pageView = PageView::create(); pageView->setDirection(PageView::Direction::HORIZONTAL); pageView->setContentSize(size); - Size backgroundSize = background->getContentSize(); + const Size& backgroundSize = background->getContentSize(); pageView->setPosition((widgetSize - pageView->getContentSize()) / 2.0f); pageView->removeAllItems(); pageView->setIndicatorEnabled(true); @@ -290,7 +290,7 @@ bool UIPageViewTouchPropagationTest::init() PageView* pageView = PageView::create(); pageView->setContentSize(Size(240.0f, 130.0f)); pageView->setAnchorPoint(Vec2(0.5,0.5)); - Size backgroundSize = background->getContentSize(); + const Size& backgroundSize = background->getContentSize(); pageView->setPosition(Vec2(widgetSize.width / 2.0f ,widgetSize.height / 2.0f)); pageView->setBackGroundColor(Color3B::GREEN); pageView->setBackGroundColorType(Layout::BackGroundColorType::SOLID); @@ -487,7 +487,7 @@ bool UIPageViewDynamicAddAndRemoveTest::init() pageView->setDirection(ui::PageView::Direction::VERTICAL); pageView->setContentSize(Size(240.0f, 130.0f)); pageView->setAnchorPoint(Vec2(0.5,0.5)); - Size backgroundSize = background->getContentSize(); + const Size& backgroundSize = background->getContentSize(); pageView->setPosition(Vec2(widgetSize.width / 2.0f ,widgetSize.height / 2.0f)); pageView->setBackGroundColor(Color3B::GREEN); pageView->setBackGroundColorType(Layout::BackGroundColorType::SOLID); @@ -571,7 +571,7 @@ bool UIPageViewDynamicAddAndRemoveTest::init() button2->setTitleColor(Color3B::RED); button2->addClickEventListener([=](Ref* sender) { - if (pageView->getItems().size() > 0) + if (!pageView->getItems().empty()) { pageView->removeItem(pageView->getItems().size()-1); } @@ -784,7 +784,7 @@ bool UIPageViewVerticalTest::init() pageView->setIndicatorEnabled(true); pageView->setDirection(ui::PageView::Direction::VERTICAL); pageView->setContentSize(Size(240.0f, 130.0f)); - Size backgroundSize = background->getContentSize(); + const Size& backgroundSize = background->getContentSize(); pageView->setPosition((widgetSize - pageView->getContentSize()) / 2.0f); pageView->removeAllItems(); @@ -948,7 +948,7 @@ bool UIPageViewChildSizeTest::init() PageView* pageView = PageView::create(); pageView->setDirection(PageView::Direction::HORIZONTAL); pageView->setContentSize(size); - Size backgroundSize = background->getContentSize(); + const Size& backgroundSize = background->getContentSize(); pageView->setPosition((widgetSize - pageView->getContentSize()) / 2.0f); pageView->removeAllItems(); pageView->setIndicatorEnabled(true); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIRadioButtonTest/UIRadioButtonTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIRadioButtonTest/UIRadioButtonTest.cpp index 6094f5ae5555..34a9b0769c7f 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIRadioButtonTest/UIRadioButtonTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIRadioButtonTest/UIRadioButtonTest.cpp @@ -304,7 +304,7 @@ void UIRadioButtonTwoGroupsTest::addLog(const std::string& log) if(_numberOfLogLines > 10) { - size_t pos = existingLog.find("\n") + 1; + size_t pos = existingLog.find('\n') + 1; std::string newLog = existingLog.substr(pos); existingLog = newLog; --_numberOfLogLines; diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.cpp index 450e752c13d1..480d74b78986 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.cpp @@ -160,7 +160,7 @@ bool UIScrollViewTest_Horizontal::init() scrollView->setInnerContainerSize(scrollView->getContentSize()); scrollView->setScrollBarPositionFromCorner(Vec2(4, 4)); scrollView->setScrollBarColor(Color3B::YELLOW); - Size backgroundSize = background->getContentSize(); + const Size& backgroundSize = background->getContentSize(); scrollView->setPosition((widgetSize - scrollView->getContentSize()) / 2.0f); _uiLayer->addChild(scrollView); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIVideoPlayerTest/UIVideoPlayerTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIVideoPlayerTest/UIVideoPlayerTest.cpp index a371982cc4ef..d2d9f9d487b8 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIVideoPlayerTest/UIVideoPlayerTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIVideoPlayerTest/UIVideoPlayerTest.cpp @@ -31,6 +31,7 @@ using namespace cocos2d::experimental::ui; VideoPlayerTests::VideoPlayerTests() { ADD_TEST_CASE(VideoPlayerTest); + ADD_TEST_CASE(SimpleVideoPlayerTest); } bool VideoPlayerTest::init() @@ -42,6 +43,10 @@ bool VideoPlayerTest::init() _visibleRect = Director::getInstance()->getOpenGLView()->getVisibleRect(); + // Should create video first to make sure video is destryed first. If not, then may crash. + // Because when destroying video, it will stop video which may trigger stopped event listener. + createVideo(); + MenuItemFont::setFontSize(16); auto fullSwitch = MenuItemFont::create("FullScreenSwitch", CC_CALLBACK_1(VideoPlayerTest::menuFullScreenCallback, this)); @@ -76,8 +81,12 @@ bool VideoPlayerTest::init() auto ratioSwitch = MenuItemFont::create("KeepRatioSwitch", CC_CALLBACK_1(VideoPlayerTest::menuRatioCallback, this)); ratioSwitch->setAnchorPoint(Vec2::ANCHOR_MIDDLE_RIGHT); ratioSwitch->setPosition(Vec2(_visibleRect.origin.x + _visibleRect.size.width - 10,_visibleRect.origin.y + 150)); + + auto loopToggle = MenuItemFont::create("LoopToogle", CC_CALLBACK_1(VideoPlayerTest::menuLoopCallback, this)); + loopToggle->setAnchorPoint(Vec2::ANCHOR_MIDDLE_RIGHT); + loopToggle->setPosition(Vec2(_visibleRect.origin.x + _visibleRect.size.width - 10,_visibleRect.origin.y + 170)); - auto menu = Menu::create(resourceVideo,onlineVideo,ratioSwitch,fullSwitch,pauseItem,resumeItem,stopItem,hintItem,nullptr); + auto menu = Menu::create(resourceVideo,onlineVideo,ratioSwitch,loopToggle,fullSwitch,pauseItem,resumeItem,stopItem,hintItem,nullptr); menu->setPosition(Vec2::ZERO); _uiLayer->addChild(menu); @@ -85,7 +94,11 @@ bool VideoPlayerTest::init() _videoStateLabel->setAnchorPoint(Vec2::ANCHOR_MIDDLE_RIGHT); _videoStateLabel->setPosition(Vec2(_visibleRect.origin.x + _visibleRect.size.width - 10,_visibleRect.origin.y + 200)); _uiLayer->addChild(_videoStateLabel); - createVideo(); + + _loopStatusLabel = Label::createWithSystemFont("(1)","Arial",10); + _loopStatusLabel->setAnchorPoint(Vec2::ANCHOR_MIDDLE_RIGHT); + _loopStatusLabel->setPosition(Vec2(_visibleRect.origin.x + _visibleRect.size.width - 10,_visibleRect.origin.y + 185)); + _uiLayer->addChild(_loopStatusLabel); return true; } @@ -93,10 +106,6 @@ bool VideoPlayerTest::init() void VideoPlayerTest::menuCloseCallback(Ref* sender) { Director::getInstance()->end(); - -#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) - exit(0); -#endif } void VideoPlayerTest::menuFullScreenCallback(Ref* sender) @@ -115,6 +124,16 @@ void VideoPlayerTest::menuRatioCallback(Ref* sender) } } +void VideoPlayerTest::menuLoopCallback(Ref* sender) +{ + if (_videoPlayer) + { + _videoPlayer->setLooping(! _videoPlayer->isLooping()); + _loopStatusLabel->setString(_videoPlayer->isLooping() ? "(OO)" : "(1)"); + } +} + + void VideoPlayerTest::menuResourceVideoCallback(Ref* sender) { if (_videoPlayer) @@ -239,3 +258,149 @@ void VideoPlayerTest::videoEventCallback(Ref* sender, VideoPlayer::EventType eve break; } } + + +// Simple Video Test + +SimpleVideoPlayerTest::SimpleVideoPlayerTest() +{ + _videoPlayer = nullptr; + _style = cocos2d::experimental::ui::VideoPlayer::StyleType::NONE; + _userInputEnabled = true; + + _switchUserInputEnabled = nullptr; + _switchStyle = nullptr; +} + +void SimpleVideoPlayerTest::updateButtonsTexts() +{ + if (_switchUserInputEnabled) + { + std::string str = _userInputEnabled ? "< User Input Enabled >" : "< User Input Disabled >"; + _switchUserInputEnabled->setString(str); + } + + if (_switchStyle) + { + std::string str = " - "; + switch(_style) + { + case cocos2d::experimental::ui::VideoPlayer::StyleType::NONE: + _switchUserInputEnabled->setVisible(false); + str = "< NO Sytle >"; + break; + + case cocos2d::experimental::ui::VideoPlayer::StyleType::DEFAULT: + str = "< Default Style >"; + _switchUserInputEnabled->setVisible(true); + break; + + default: + break; + } + + _switchStyle->setString(str); + } +} + +bool SimpleVideoPlayerTest::init() +{ + if ( !UIScene::init() ) + { + return false; + } + + _visibleRect = Director::getInstance()->getOpenGLView()->getVisibleRect(); + + MenuItemFont::setFontSize(16); + + _switchStyle = MenuItemFont::create("Switch Style", CC_CALLBACK_1(SimpleVideoPlayerTest::switchStyleCallback, this)); + _switchStyle->setAnchorPoint(Vec2::ANCHOR_BOTTOM_LEFT); + _switchStyle->setPosition(Vec2(_visibleRect.origin.x + 10,_visibleRect.origin.y + 50)); + + _switchUserInputEnabled = MenuItemFont::create("Enable User Input", CC_CALLBACK_1(SimpleVideoPlayerTest::switchUserInputCallback, this)); + _switchUserInputEnabled->setAnchorPoint(Vec2::ANCHOR_BOTTOM_LEFT); + _switchUserInputEnabled->setPosition(Vec2(_visibleRect.origin.x + 10,_visibleRect.origin.y + 100)); + + auto menu = Menu::create(_switchUserInputEnabled,_switchStyle,nullptr); + menu->setPosition(Vec2::ZERO); + _uiLayer->addChild(menu); + + createVideo(); + updateButtonsTexts(); + + return true; +} + +void SimpleVideoPlayerTest::menuCloseCallback(Ref* sender) +{ + Director::getInstance()->end(); + +#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) + exit(0); +#endif +} + + +void SimpleVideoPlayerTest::switchStyleCallback(Ref* sender) +{ + switch (_style) { + case cocos2d::experimental::ui::VideoPlayer::StyleType::NONE: + _style = cocos2d::experimental::ui::VideoPlayer::StyleType::DEFAULT; + break; + + case cocos2d::experimental::ui::VideoPlayer::StyleType::DEFAULT: + _style = cocos2d::experimental::ui::VideoPlayer::StyleType::NONE; + break; + + default: + break; + } + + if (_videoPlayer) + { + _videoPlayer->setStyle(_style); + } + + //createVideo(); + updateButtonsTexts(); +} + +void SimpleVideoPlayerTest::switchUserInputCallback(Ref* sender) +{ + _userInputEnabled = !_userInputEnabled; + if (_videoPlayer) + { + _videoPlayer->setUserInputEnabled(_userInputEnabled); + } + + //createVideo(); + updateButtonsTexts(); +} + + +void SimpleVideoPlayerTest::createVideo() +{ + if (_videoPlayer) + { + _uiLayer->removeChild(_videoPlayer); + } + auto centerPos = Vec2(_visibleRect.origin.x + _visibleRect.size.width / 2,_visibleRect.origin.y + _visibleRect.size.height /2); + + auto widgetSize = _widget->getContentSize(); + + _videoPlayer = VideoPlayer::create(); + _videoPlayer->setPosition(centerPos); + _videoPlayer->setAnchorPoint(Vec2::ANCHOR_MIDDLE); + _videoPlayer->setContentSize(Size(widgetSize.width * 0.4f,widgetSize.height * 0.4f)); + _videoPlayer->setLooping(true); + _videoPlayer->setStyle(_style); + _videoPlayer->setUserInputEnabled(_userInputEnabled); + + _uiLayer->addChild(_videoPlayer); + + // _videoPlayer->addEventListener(CC_CALLBACK_2(SimpleVideoPlayerTest::videoEventCallback, this)); + + _videoPlayer->setFileName("cocosvideo.mp4"); + _videoPlayer->play(); +} diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIVideoPlayerTest/UIVideoPlayerTest.h b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIVideoPlayerTest/UIVideoPlayerTest.h index 2e0de2609568..375a54ed25de 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIVideoPlayerTest/UIVideoPlayerTest.h +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIVideoPlayerTest/UIVideoPlayerTest.h @@ -47,6 +47,7 @@ class VideoPlayerTest : public UIScene void menuResumeCallback(cocos2d::Ref* sender); void menuStopCallback(cocos2d::Ref* sender); void menuHintCallback(cocos2d::Ref* sender); + void menuLoopCallback(cocos2d::Ref* sender); void sliderCallback(cocos2d::Ref* sender, cocos2d::ui::Slider::EventType eventType); @@ -59,10 +60,42 @@ class VideoPlayerTest : public UIScene cocos2d::MenuItemFont* _hintItem; cocos2d::experimental::ui::VideoPlayer* _videoPlayer; cocos2d::Label* _videoStateLabel; + cocos2d::Label* _loopStatusLabel; cocos2d::Rect _visibleRect; cocos2d::Layer* _rootLayer; }; + +class SimpleVideoPlayerTest : public UIScene +{ +public: + CREATE_FUNC(SimpleVideoPlayerTest); + + SimpleVideoPlayerTest(); + + virtual bool init() override; + + void menuCloseCallback(cocos2d::Ref* sender); + void switchStyleCallback(cocos2d::Ref* sender); + void switchUserInputCallback(cocos2d::Ref* sender); + +private: + void createVideo(); + + cocos2d::Rect _visibleRect; + cocos2d::experimental::ui::VideoPlayer* _videoPlayer; + + cocos2d::MenuItemFont* _switchUserInputEnabled; + cocos2d::MenuItemFont* _switchStyle; + + + bool _userInputEnabled; + cocos2d::experimental::ui::VideoPlayer::StyleType _style; + + void updateButtonsTexts(); +}; + + #endif // __tests__VideoPlayerTest__ diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIWebViewTest/UIWebViewTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIWebViewTest/UIWebViewTest.cpp index b2bf692538be..582e66b8646b 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIWebViewTest/UIWebViewTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIWebViewTest/UIWebViewTest.cpp @@ -36,12 +36,11 @@ WebViewTests::WebViewTests() bool WebViewTest::init() { if (UIScene::init()) { - Size winSize = Director::getInstance()->getVisibleSize(); + Size visableSize = Director::getInstance()->getVisibleSize(); - _webView = cocos2d::experimental::ui::WebView::create(); - _webView->setPosition(winSize/2); - _webView->setContentSize(winSize * 0.5); + _webView->setPosition(VisibleRect::center()); + _webView->setContentSize(visableSize * 0.5); _webView->loadURL("https://www.baidu.com"); _webView->setScalesPageToFit(true); @@ -52,13 +51,14 @@ bool WebViewTest::init() this->addChild(_webView); auto spriteHello = Sprite::create("Hello.png"); - spriteHello->setPosition(winSize/2); + spriteHello->setContentSize(visableSize * 0.5); + spriteHello->setPosition(VisibleRect::center()); this->addChild(spriteHello); TextField *urlTextField = TextField::create("Input a URL here", "Arial", 20); urlTextField->setPlaceHolderColor(Color3B::RED); - urlTextField->setPosition(Vec2(winSize/2) + Vec2(-80, _webView->getContentSize().height/2 + - urlTextField->getContentSize().height/2 + 10)); + urlTextField->setPosition(VisibleRect::center() + Vec2(-80, _webView->getContentSize().height/2 + + urlTextField->getContentSize().height/2 + 10)); this->addChild(urlTextField); Text *httpLabel = Text::create("https:// ", "Arial", 20); @@ -71,8 +71,8 @@ bool WebViewTest::init() Button *resetBtn = Button::create("cocosui/animationbuttonnormal.png", "cocosui/animationbuttonpressed.png"); resetBtn->setTitleText("Visit URL"); - resetBtn->setPosition(Vec2(winSize/2) + Vec2(50, _webView->getContentSize().height/2 + - resetBtn->getContentSize().height/2 + 10)); + resetBtn->setPosition(VisibleRect::center() + Vec2(50, _webView->getContentSize().height/2 + + resetBtn->getContentSize().height/2 + 10)); resetBtn->addClickEventListener([=](Ref*){ if (urlTextField->getString().size() != 0) { @@ -85,7 +85,7 @@ bool WebViewTest::init() Button *reloadBtn = Button::create("cocosui/animationbuttonnormal.png", "cocosui/animationbuttonpressed.png"); reloadBtn->setTitleText("Reload"); - reloadBtn->setPosition(Vec2(winSize/2) + Vec2( _webView->getContentSize().width/2 + + reloadBtn->setPosition(VisibleRect::center() + Vec2( _webView->getContentSize().width/2 + reloadBtn->getContentSize().width/2 + 10,50 )); reloadBtn->addClickEventListener([=](Ref*){ _webView->reload(); @@ -95,7 +95,7 @@ bool WebViewTest::init() Button *forwardBtn = Button::create("cocosui/animationbuttonnormal.png", "cocosui/animationbuttonpressed.png"); forwardBtn->setTitleText("Forward"); - forwardBtn->setPosition(Vec2(winSize/2) + Vec2( _webView->getContentSize().width/2 + + forwardBtn->setPosition(VisibleRect::center() + Vec2( _webView->getContentSize().width/2 + forwardBtn->getContentSize().width/2 + 10,0 )); forwardBtn->addClickEventListener([=](Ref*){ _webView->goForward(); @@ -107,7 +107,7 @@ bool WebViewTest::init() Button *backBtn = Button::create("cocosui/animationbuttonnormal.png", "cocosui/animationbuttonpressed.png"); backBtn->setTitleText("Back"); - backBtn->setPosition(Vec2(winSize/2) + Vec2( _webView->getContentSize().width/2 + + backBtn->setPosition(VisibleRect::center() + Vec2( _webView->getContentSize().width/2 + backBtn->getContentSize().width/2 + 10,-50 )); backBtn->addClickEventListener([=](Ref*){ _webView->goBack(); @@ -118,7 +118,7 @@ bool WebViewTest::init() Button *loadFileBtn = Button::create("cocosui/animationbuttonnormal.png", "cocosui/animationbuttonpressed.png"); loadFileBtn->setTitleText("Load FILE"); - loadFileBtn->setPosition(Vec2(winSize/2) - Vec2( _webView->getContentSize().width/2 + + loadFileBtn->setPosition(VisibleRect::center() - Vec2( _webView->getContentSize().width/2 + loadFileBtn->getContentSize().width/2 + 10,50 )); loadFileBtn->addClickEventListener([=](Ref*){ _webView->loadFile("Test.html"); @@ -128,7 +128,7 @@ bool WebViewTest::init() Button *loadHTMLBtn = Button::create("cocosui/animationbuttonnormal.png", "cocosui/animationbuttonpressed.png"); loadHTMLBtn->setTitleText("Load Data"); - loadHTMLBtn->setPosition(Vec2(winSize/2) - Vec2( _webView->getContentSize().width/2 + + loadHTMLBtn->setPosition(VisibleRect::center() - Vec2( _webView->getContentSize().width/2 + loadHTMLBtn->getContentSize().width/2 + 10,0 )); loadHTMLBtn->addClickEventListener([=](Ref*){ _webView->loadHTMLString("Hello World ","Images/"); @@ -141,10 +141,10 @@ bool WebViewTest::init() Button *evalJsBtn = Button::create("cocosui/animationbuttonnormal.png", "cocosui/animationbuttonpressed.png"); evalJsBtn->setTitleText("Evaluate JS"); - evalJsBtn->setPosition(Vec2(winSize/2) - Vec2( _webView->getContentSize().width/2 + + evalJsBtn->setPosition(VisibleRect::center() - Vec2( _webView->getContentSize().width/2 + evalJsBtn->getContentSize().width/2 + 10,-50 )); evalJsBtn->addClickEventListener([=](Ref*){ - _webView->evaluateJS("alert(\"hello\")"); + _webView->evaluateJS("setTimeout(function(){alert(\"hello\");}, 0)"); }); evalJsBtn->setName("evalJs"); this->addChild(evalJsBtn); @@ -152,7 +152,7 @@ bool WebViewTest::init() Button *opacityBtn = Button::create("cocosui/animationbuttonnormal.png", "cocosui/animationbuttonpressed.png"); opacityBtn->setTitleText("Opacity 1.f"); - opacityBtn->setPosition(Vec2(winSize/2) - Vec2( _webView->getContentSize().width/2 + + opacityBtn->setPosition(VisibleRect::center() - Vec2( _webView->getContentSize().width/2 + opacityBtn->getContentSize().width/2 + 10, 100 )); opacityBtn->addClickEventListener([=](Ref*){ auto currentOpacity = _webView->getOpacityWebView(); @@ -175,7 +175,7 @@ bool WebViewTest::init() Button *transparentBgBtn = Button::create("cocosui/animationbuttonnormal.png", "cocosui/animationbuttonpressed.png"); transparentBgBtn->setTitleText("Transparent BG"); - transparentBgBtn->setPosition(Vec2(winSize/2) + Vec2( _webView->getContentSize().width/2 + + transparentBgBtn->setPosition(VisibleRect::center() + Vec2( _webView->getContentSize().width/2 + transparentBgBtn->getContentSize().width/2 + 10,-100 )); transparentBgBtn->addClickEventListener([=](Ref*){ _webView->setBackgroundTransparent(); diff --git a/tests/cpp-tests/Classes/UnitTest/RefPtrTest.cpp b/tests/cpp-tests/Classes/UnitTest/RefPtrTest.cpp index 2422f986a3e3..82a1244b69d5 100644 --- a/tests/cpp-tests/Classes/UnitTest/RefPtrTest.cpp +++ b/tests/cpp-tests/Classes/UnitTest/RefPtrTest.cpp @@ -47,13 +47,13 @@ void RefPtrTest::onEnter() CC_ASSERT((__String*) nullptr == ref3.get()); // Copy constructor - RefPtr<__String> ref4(ref2); + RefPtr<__String> ref4(ref2); // NOLINT(performance-unnecessary-copy-initialization) CC_ASSERT(strcmp("Hello", ref4->getCString()) == 0); CC_ASSERT(3 == ref2->getReferenceCount()); CC_ASSERT(3 == ref4->getReferenceCount()); // Copy constructor with nullptr reference - RefPtr ref5(ref1); + RefPtr ref5(ref1); // NOLINT(performance-unnecessary-copy-initialization) CC_ASSERT((Ref*) nullptr == ref5.get()); } diff --git a/tests/cpp-tests/Classes/UnitTest/UnitTest.cpp b/tests/cpp-tests/Classes/UnitTest/UnitTest.cpp index de7159d5914e..cccef86e2949 100644 --- a/tests/cpp-tests/Classes/UnitTest/UnitTest.cpp +++ b/tests/cpp-tests/Classes/UnitTest/UnitTest.cpp @@ -23,9 +23,11 @@ ****************************************************************************/ #include "UnitTest.h" +#include #include "RefPtrTest.h" #include "ui/UIHelper.h" #include "network/Uri.h" +#include "base/ccUtils.h" USING_NS_CC; using namespace cocos2d::network; @@ -75,12 +77,13 @@ UnitTests::UnitTests() ADD_TEST_CASE(RefPtrTest); ADD_TEST_CASE(UTFConversionTest); ADD_TEST_CASE(UIHelperSubStringTest); + ADD_TEST_CASE(ParseIntegerListTest); ADD_TEST_CASE(ParseUriTest); ADD_TEST_CASE(ResizableBufferAdapterTest); #ifdef UNIT_TEST_FOR_OPTIMIZED_MATH_UTIL ADD_TEST_CASE(MathUtilTest); #endif -}; +} std::string UnitTestDemo::title() const { @@ -96,7 +99,7 @@ void TemplateVectorTest::onEnter() Vector vec; CCASSERT(vec.empty(), "vec should be empty."); CCASSERT(vec.capacity() == 0, "vec.capacity should be 0."); - CCASSERT(vec.size() == 0, "vec.size should be 0."); + CCASSERT(vec.empty(), "vec.size should be 0."); CCASSERT(vec.max_size() > 0, "vec.max_size should > 0."); auto node1 = Node::create(); @@ -172,7 +175,7 @@ void TemplateVectorTest::onEnter() vec5.reserve(20); CCASSERT(vec5.capacity() == 20, "vec5's capacity should be 20."); - CCASSERT(vec5.size() == 0, "vec5's size should be 0."); + CCASSERT(vec5.empty(), "vec5's size should be 0."); CCASSERT(vec5.empty(), "vec5 is empty now."); auto toRemovedNode = Node::create(); @@ -382,7 +385,7 @@ void TemplateMapTest::onEnter() // Default constructor Map map1; CCASSERT(map1.empty(), "map1 is empty."); - CCASSERT(map1.size() == 0, "map1's size is 0."); + CCASSERT(map1.empty(), "map1's size is 0."); CCASSERT(map1.keys().empty(), "map1's keys are empty."); CCASSERT(map1.keys(Node::create()).empty(), "map1's keys don't contain a empty Node."); @@ -499,9 +502,9 @@ void TemplateMapTest::onEnter() CCASSERT(mapForErase.size() == 18, "mapForErase's size is 18."); std::vector itemsToRemove; - itemsToRemove.push_back("2"); - itemsToRemove.push_back("3"); - itemsToRemove.push_back("4"); + itemsToRemove.emplace_back("2"); + itemsToRemove.emplace_back("3"); + itemsToRemove.emplace_back("4"); mapForErase.erase(itemsToRemove); CCASSERT(mapForErase.size() == 15, "mapForErase's size is 15."); @@ -817,45 +820,45 @@ void UIHelperSubStringTest::onEnter() std::string source = ""; // OK - CC_ASSERT(Helper::getSubStringOfUTF8String(source, 0, 0) == ""); - CC_ASSERT(Helper::getSubStringOfUTF8String(source, 0, 1) == ""); + CC_ASSERT(Helper::getSubStringOfUTF8String(source, 0, 0).empty()); + CC_ASSERT(Helper::getSubStringOfUTF8String(source, 0, 1).empty()); // Error: These cases cause "out of range" error - CC_ASSERT(Helper::getSubStringOfUTF8String(source, 1, 0) == ""); - CC_ASSERT(Helper::getSubStringOfUTF8String(source, 1, 1) == ""); + CC_ASSERT(Helper::getSubStringOfUTF8String(source, 1, 0).empty()); + CC_ASSERT(Helper::getSubStringOfUTF8String(source, 1, 1).empty()); } { // Ascii std::string source = "abc"; // OK - CC_ASSERT(Helper::getSubStringOfUTF8String(source, 0, 0) == ""); - CC_ASSERT(Helper::getSubStringOfUTF8String(source, 1, 0) == ""); - CC_ASSERT(Helper::getSubStringOfUTF8String(source, 2, 0) == ""); - CC_ASSERT(Helper::getSubStringOfUTF8String(source, 3, 0) == ""); + CC_ASSERT(Helper::getSubStringOfUTF8String(source, 0, 0).empty()); + CC_ASSERT(Helper::getSubStringOfUTF8String(source, 1, 0).empty()); + CC_ASSERT(Helper::getSubStringOfUTF8String(source, 2, 0).empty()); + CC_ASSERT(Helper::getSubStringOfUTF8String(source, 3, 0).empty()); CC_ASSERT(Helper::getSubStringOfUTF8String(source, 0, 3) == "abc"); CC_ASSERT(Helper::getSubStringOfUTF8String(source, 0, 4) == "abc"); CC_ASSERT(Helper::getSubStringOfUTF8String(source, 1, 2) == "bc"); CC_ASSERT(Helper::getSubStringOfUTF8String(source, 1, 3) == "bc"); CC_ASSERT(Helper::getSubStringOfUTF8String(source, 2, 1) == "c"); CC_ASSERT(Helper::getSubStringOfUTF8String(source, 2, 2) == "c"); - CC_ASSERT(Helper::getSubStringOfUTF8String(source, 3, 1) == ""); - CC_ASSERT(Helper::getSubStringOfUTF8String(source, 3, 2) == ""); + CC_ASSERT(Helper::getSubStringOfUTF8String(source, 3, 1).empty()); + CC_ASSERT(Helper::getSubStringOfUTF8String(source, 3, 2).empty()); // Error: These cases cause "out of range" error - CC_ASSERT(Helper::getSubStringOfUTF8String(source, 4, 0) == ""); - CC_ASSERT(Helper::getSubStringOfUTF8String(source, 4, 1) == ""); + CC_ASSERT(Helper::getSubStringOfUTF8String(source, 4, 0).empty()); + CC_ASSERT(Helper::getSubStringOfUTF8String(source, 4, 1).empty()); } { // CJK characters std::string source = "这里是中文测试例"; // OK - CC_ASSERT(Helper::getSubStringOfUTF8String(source, 0, 0) == ""); - CC_ASSERT(Helper::getSubStringOfUTF8String(source, 1, 0) == ""); - CC_ASSERT(Helper::getSubStringOfUTF8String(source, 7, 0) == ""); - CC_ASSERT(Helper::getSubStringOfUTF8String(source, 8, 0) == ""); - CC_ASSERT(Helper::getSubStringOfUTF8String(source, 8, 1) == ""); + CC_ASSERT(Helper::getSubStringOfUTF8String(source, 0, 0).empty()); + CC_ASSERT(Helper::getSubStringOfUTF8String(source, 1, 0).empty()); + CC_ASSERT(Helper::getSubStringOfUTF8String(source, 7, 0).empty()); + CC_ASSERT(Helper::getSubStringOfUTF8String(source, 8, 0).empty()); + CC_ASSERT(Helper::getSubStringOfUTF8String(source, 8, 1).empty()); CC_ASSERT(Helper::getSubStringOfUTF8String(source, 0, 1) == "\xe8\xbf\x99"); CC_ASSERT(Helper::getSubStringOfUTF8String(source, 0, 4) == "\xe8\xbf\x99\xe9\x87\x8c\xe6\x98\xaf\xe4\xb8\xad"); CC_ASSERT(Helper::getSubStringOfUTF8String(source, 0, 8) == "\xe8\xbf\x99\xe9\x87\x8c\xe6\x98\xaf\xe4\xb8\xad\xe6\x96\x87\xe6\xb5\x8b\xe8\xaf\x95\xe4\xbe\x8b"); @@ -865,41 +868,41 @@ void UIHelperSubStringTest::onEnter() CC_ASSERT(Helper::getSubStringOfUTF8String(source, 6, 100) == "\xe8\xaf\x95\xe4\xbe\x8b"); // Error: These cases cause "out of range" error - CC_ASSERT(Helper::getSubStringOfUTF8String(source, 9, 0) == ""); - CC_ASSERT(Helper::getSubStringOfUTF8String(source, 9, 1) == ""); + CC_ASSERT(Helper::getSubStringOfUTF8String(source, 9, 0).empty()); + CC_ASSERT(Helper::getSubStringOfUTF8String(source, 9, 1).empty()); } { // Redundant UTF-8 sequence for Directory traversal attack (1) std::string source = "\xC0\xAF"; // Error: Can't convert string to correct encoding such as UTF-32 - CC_ASSERT(Helper::getSubStringOfUTF8String(source, 0, 0) == ""); - CC_ASSERT(Helper::getSubStringOfUTF8String(source, 0, 1) == ""); - CC_ASSERT(Helper::getSubStringOfUTF8String(source, 1, 0) == ""); - CC_ASSERT(Helper::getSubStringOfUTF8String(source, 1, 1) == ""); - CC_ASSERT(Helper::getSubStringOfUTF8String(source, 0, 2) == ""); + CC_ASSERT(Helper::getSubStringOfUTF8String(source, 0, 0).empty()); + CC_ASSERT(Helper::getSubStringOfUTF8String(source, 0, 1).empty()); + CC_ASSERT(Helper::getSubStringOfUTF8String(source, 1, 0).empty()); + CC_ASSERT(Helper::getSubStringOfUTF8String(source, 1, 1).empty()); + CC_ASSERT(Helper::getSubStringOfUTF8String(source, 0, 2).empty()); } { // Redundant UTF-8 sequence for Directory traversal attack (2) std::string source = "\xE0\x80\xAF"; // Error: Can't convert string to correct encoding such as UTF-32 - CC_ASSERT(Helper::getSubStringOfUTF8String(source, 0, 0) == ""); - CC_ASSERT(Helper::getSubStringOfUTF8String(source, 0, 1) == ""); - CC_ASSERT(Helper::getSubStringOfUTF8String(source, 1, 0) == ""); - CC_ASSERT(Helper::getSubStringOfUTF8String(source, 1, 1) == ""); - CC_ASSERT(Helper::getSubStringOfUTF8String(source, 0, 3) == ""); + CC_ASSERT(Helper::getSubStringOfUTF8String(source, 0, 0).empty()); + CC_ASSERT(Helper::getSubStringOfUTF8String(source, 0, 1).empty()); + CC_ASSERT(Helper::getSubStringOfUTF8String(source, 1, 0).empty()); + CC_ASSERT(Helper::getSubStringOfUTF8String(source, 1, 1).empty()); + CC_ASSERT(Helper::getSubStringOfUTF8String(source, 0, 3).empty()); } { // Redundant UTF-8 sequence for Directory traversal attack (3) std::string source = "\xF0\x80\x80\xAF"; // Error: Can't convert string to correct encoding such as UTF-32 - CC_ASSERT(Helper::getSubStringOfUTF8String(source, 0, 0) == ""); - CC_ASSERT(Helper::getSubStringOfUTF8String(source, 0, 1) == ""); - CC_ASSERT(Helper::getSubStringOfUTF8String(source, 1, 0) == ""); - CC_ASSERT(Helper::getSubStringOfUTF8String(source, 1, 1) == ""); - CC_ASSERT(Helper::getSubStringOfUTF8String(source, 0, 4) == ""); + CC_ASSERT(Helper::getSubStringOfUTF8String(source, 0, 0).empty()); + CC_ASSERT(Helper::getSubStringOfUTF8String(source, 0, 1).empty()); + CC_ASSERT(Helper::getSubStringOfUTF8String(source, 1, 0).empty()); + CC_ASSERT(Helper::getSubStringOfUTF8String(source, 1, 1).empty()); + CC_ASSERT(Helper::getSubStringOfUTF8String(source, 0, 4).empty()); } } @@ -908,6 +911,35 @@ std::string UIHelperSubStringTest::subtitle() const return "ui::Helper::getSubStringOfUTF8String Test"; } +// ParseIntegerListTest +void ParseIntegerListTest::onEnter() { + UnitTestDemo::onEnter(); + + { + using cocos2d::utils::parseIntegerList; + + std::vector res1{}; + EXPECT_EQ(res1, parseIntegerList("")); + + std::vector res2{1}; + EXPECT_EQ(res2, parseIntegerList("1")); + + std::vector res3{1, 2}; + EXPECT_EQ(res3, parseIntegerList("1 2")); + + std::vector res4{2, 4, 3, 1, 4, 2, 0, 4, 1, 0, 4, 5}; + EXPECT_EQ(res4, parseIntegerList("2 4 3 1 4 2 0 4 1 0 4 5")); + + std::vector res5{73, 48, 57, 117, 27, 117, 29, 77, 14, 62, 26, 7, 55, 2}; + EXPECT_EQ(res5, parseIntegerList("73 48 57 117 27 117 29 77 14 62 26 7 55 2")); + } +} + +std::string ParseIntegerListTest::subtitle() const +{ + return "utils::parseIntegerList Test"; +} + // ParseUriTest void ParseUriTest::onEnter() { @@ -917,8 +949,8 @@ void ParseUriTest::onEnter() std::string s("http://www.facebook.com/hello/world?query#fragment"); Uri u = Uri::parse(s); EXPECT_EQ("http", u.getScheme()); - EXPECT_EQ("", u.getUserName()); - EXPECT_EQ("", u.getPassword()); + EXPECT_TRUE(u.getUserName().empty()); + EXPECT_TRUE(u.getPassword().empty()); EXPECT_EQ("www.facebook.com", u.getHost()); EXPECT_EQ(0, u.getPort()); EXPECT_EQ("www.facebook.com", u.getAuthority()); @@ -932,8 +964,8 @@ void ParseUriTest::onEnter() std::string s("http://www.facebook.com:8080/hello/world?query#fragment"); Uri u = Uri::parse(s); EXPECT_EQ("http", u.getScheme()); - EXPECT_EQ("", u.getUserName()); - EXPECT_EQ("", u.getPassword()); + EXPECT_TRUE(u.getUserName().empty()); + EXPECT_TRUE(u.getPassword().empty()); EXPECT_EQ("www.facebook.com", u.getHost()); EXPECT_EQ(8080, u.getPort()); EXPECT_EQ("www.facebook.com:8080", u.getAuthority()); @@ -947,8 +979,8 @@ void ParseUriTest::onEnter() std::string s("http://127.0.0.1:8080/hello/world?query#fragment"); Uri u = Uri::parse(s); EXPECT_EQ("http", u.getScheme()); - EXPECT_EQ("", u.getUserName()); - EXPECT_EQ("", u.getPassword()); + EXPECT_TRUE(u.getUserName().empty()); + EXPECT_TRUE(u.getPassword().empty()); EXPECT_EQ("127.0.0.1", u.getHost()); EXPECT_EQ(8080, u.getPort()); EXPECT_EQ("127.0.0.1:8080", u.getAuthority()); @@ -962,8 +994,8 @@ void ParseUriTest::onEnter() std::string s("http://[::1]:8080/hello/world?query#fragment"); Uri u = Uri::parse(s); EXPECT_EQ("http", u.getScheme()); - EXPECT_EQ("", u.getUserName()); - EXPECT_EQ("", u.getPassword()); + EXPECT_TRUE(u.getUserName().empty()); + EXPECT_TRUE(u.getPassword().empty()); EXPECT_EQ("[::1]", u.getHost()); EXPECT_EQ("::1", u.getHostName()); EXPECT_EQ(8080, u.getPort()); @@ -978,15 +1010,15 @@ void ParseUriTest::onEnter() std::string s("http://[2401:db00:20:7004:face:0:29:0]:8080/hello/world?query"); Uri u = Uri::parse(s); EXPECT_EQ("http", u.getScheme()); - EXPECT_EQ("", u.getUserName()); - EXPECT_EQ("", u.getPassword()); + EXPECT_TRUE(u.getUserName().empty()); + EXPECT_TRUE(u.getPassword().empty()); EXPECT_EQ("[2401:db00:20:7004:face:0:29:0]", u.getHost()); EXPECT_EQ("2401:db00:20:7004:face:0:29:0", u.getHostName()); EXPECT_EQ(8080, u.getPort()); EXPECT_EQ("[2401:db00:20:7004:face:0:29:0]:8080", u.getAuthority()); EXPECT_EQ("/hello/world", u.getPath()); EXPECT_EQ("query", u.getQuery()); - EXPECT_EQ("", u.getFragment()); + EXPECT_TRUE(u.getFragment().empty()); EXPECT_EQ(s, u.toString()); // canonical } @@ -994,15 +1026,15 @@ void ParseUriTest::onEnter() std::string s("http://[2401:db00:20:7004:face:0:29:0]/hello/world?query"); Uri u = Uri::parse(s); EXPECT_EQ("http", u.getScheme()); - EXPECT_EQ("", u.getUserName()); - EXPECT_EQ("", u.getPassword()); + EXPECT_TRUE(u.getUserName().empty()); + EXPECT_TRUE(u.getPassword().empty()); EXPECT_EQ("[2401:db00:20:7004:face:0:29:0]", u.getHost()); EXPECT_EQ("2401:db00:20:7004:face:0:29:0", u.getHostName()); EXPECT_EQ(0, u.getPort()); EXPECT_EQ("[2401:db00:20:7004:face:0:29:0]", u.getAuthority()); EXPECT_EQ("/hello/world", u.getPath()); EXPECT_EQ("query", u.getQuery()); - EXPECT_EQ("", u.getFragment()); + EXPECT_TRUE(u.getFragment().empty()); EXPECT_EQ(s, u.toString()); // canonical } @@ -1016,8 +1048,8 @@ void ParseUriTest::onEnter() EXPECT_EQ(0, u.getPort()); EXPECT_EQ("user:pass@host.com", u.getAuthority()); EXPECT_EQ("/", u.getPath()); - EXPECT_EQ("", u.getQuery()); - EXPECT_EQ("", u.getFragment()); + EXPECT_TRUE(u.getQuery().empty()); + EXPECT_TRUE(u.getFragment().empty()); EXPECT_EQ(s, u.toString()); } @@ -1026,13 +1058,13 @@ void ParseUriTest::onEnter() Uri u = Uri::parse(s); EXPECT_EQ("http", u.getScheme()); EXPECT_EQ("user", u.getUserName()); - EXPECT_EQ("", u.getPassword()); + EXPECT_TRUE(u.getPassword().empty()); EXPECT_EQ("host.com", u.getHost()); EXPECT_EQ(0, u.getPort()); EXPECT_EQ("user@host.com", u.getAuthority()); EXPECT_EQ("/", u.getPath()); - EXPECT_EQ("", u.getQuery()); - EXPECT_EQ("", u.getFragment()); + EXPECT_TRUE(u.getQuery().empty()); + EXPECT_TRUE(u.getFragment().empty()); EXPECT_EQ(s, u.toString()); } @@ -1041,13 +1073,13 @@ void ParseUriTest::onEnter() Uri u = Uri::parse(s); EXPECT_EQ("http", u.getScheme()); EXPECT_EQ("user", u.getUserName()); - EXPECT_EQ("", u.getPassword()); + EXPECT_TRUE(u.getPassword().empty()); EXPECT_EQ("host.com", u.getHost()); EXPECT_EQ(0, u.getPort()); EXPECT_EQ("user@host.com", u.getAuthority()); EXPECT_EQ("/", u.getPath()); - EXPECT_EQ("", u.getQuery()); - EXPECT_EQ("", u.getFragment()); + EXPECT_TRUE(u.getQuery().empty()); + EXPECT_TRUE(u.getFragment().empty()); EXPECT_EQ("http://user@host.com/", u.toString()); } @@ -1055,14 +1087,14 @@ void ParseUriTest::onEnter() std::string s("http://:pass@host.com/"); Uri u = Uri::parse(s); EXPECT_EQ("http", u.getScheme()); - EXPECT_EQ("", u.getUserName()); + EXPECT_TRUE(u.getUserName().empty()); EXPECT_EQ("pass", u.getPassword()); EXPECT_EQ("host.com", u.getHost()); EXPECT_EQ(0, u.getPort()); EXPECT_EQ(":pass@host.com", u.getAuthority()); EXPECT_EQ("/", u.getPath()); - EXPECT_EQ("", u.getQuery()); - EXPECT_EQ("", u.getFragment()); + EXPECT_TRUE(u.getQuery().empty()); + EXPECT_TRUE(u.getFragment().empty()); EXPECT_EQ(s, u.toString()); } @@ -1070,14 +1102,14 @@ void ParseUriTest::onEnter() std::string s("http://@host.com/"); Uri u = Uri::parse(s); EXPECT_EQ("http", u.getScheme()); - EXPECT_EQ("", u.getUserName()); - EXPECT_EQ("", u.getPassword()); + EXPECT_TRUE(u.getUserName().empty()); + EXPECT_TRUE(u.getPassword().empty()); EXPECT_EQ("host.com", u.getHost()); EXPECT_EQ(0, u.getPort()); EXPECT_EQ("host.com", u.getAuthority()); EXPECT_EQ("/", u.getPath()); - EXPECT_EQ("", u.getQuery()); - EXPECT_EQ("", u.getFragment()); + EXPECT_TRUE(u.getQuery().empty()); + EXPECT_TRUE(u.getFragment().empty()); EXPECT_EQ("http://host.com/", u.toString()); } @@ -1085,14 +1117,14 @@ void ParseUriTest::onEnter() std::string s("http://:@host.com/"); Uri u = Uri::parse(s); EXPECT_EQ("http", u.getScheme()); - EXPECT_EQ("", u.getUserName()); - EXPECT_EQ("", u.getPassword()); + EXPECT_TRUE(u.getUserName().empty()); + EXPECT_TRUE(u.getPassword().empty()); EXPECT_EQ("host.com", u.getHost()); EXPECT_EQ(0, u.getPort()); EXPECT_EQ("host.com", u.getAuthority()); EXPECT_EQ("/", u.getPath()); - EXPECT_EQ("", u.getQuery()); - EXPECT_EQ("", u.getFragment()); + EXPECT_TRUE(u.getQuery().empty()); + EXPECT_TRUE(u.getFragment().empty()); EXPECT_EQ("http://host.com/", u.toString()); } @@ -1100,14 +1132,14 @@ void ParseUriTest::onEnter() std::string s("file:///etc/motd"); Uri u = Uri::parse(s); EXPECT_EQ("file", u.getScheme()); - EXPECT_EQ("", u.getUserName()); - EXPECT_EQ("", u.getPassword()); - EXPECT_EQ("", u.getHost()); + EXPECT_TRUE(u.getUserName().empty()); + EXPECT_TRUE(u.getPassword().empty()); + EXPECT_TRUE(u.getHost().empty()); EXPECT_EQ(0, u.getPort()); - EXPECT_EQ("", u.getAuthority()); + EXPECT_TRUE(u.getAuthority().empty()); EXPECT_EQ("/etc/motd", u.getPath()); - EXPECT_EQ("", u.getQuery()); - EXPECT_EQ("", u.getFragment()); + EXPECT_TRUE(u.getQuery().empty()); + EXPECT_TRUE(u.getFragment().empty()); EXPECT_EQ(s, u.toString()); } @@ -1115,14 +1147,14 @@ void ParseUriTest::onEnter() std::string s("file://etc/motd"); Uri u = Uri::parse(s); EXPECT_EQ("file", u.getScheme()); - EXPECT_EQ("", u.getUserName()); - EXPECT_EQ("", u.getPassword()); + EXPECT_TRUE(u.getUserName().empty()); + EXPECT_TRUE(u.getPassword().empty()); EXPECT_EQ("etc", u.getHost()); EXPECT_EQ(0, u.getPort()); EXPECT_EQ("etc", u.getAuthority()); EXPECT_EQ("/motd", u.getPath()); - EXPECT_EQ("", u.getQuery()); - EXPECT_EQ("", u.getFragment()); + EXPECT_TRUE(u.getQuery().empty()); + EXPECT_TRUE(u.getFragment().empty()); EXPECT_EQ(s, u.toString()); } @@ -1138,9 +1170,9 @@ void ParseUriTest::onEnter() EXPECT_EQ(3, params.size()); EXPECT_EQ("foo", params["key1"]); EXPECT_NE(params.end(), params.find("key2")); - EXPECT_EQ("", params["key2"]); + EXPECT_TRUE(params["key2"].empty()); EXPECT_NE(params.end(), params.find("key3")); - EXPECT_EQ("", params["key3"]); + EXPECT_TRUE(params["key3"].empty()); } { @@ -1162,7 +1194,7 @@ void ParseUriTest::onEnter() } EXPECT_EQ(2, params.size()); EXPECT_NE(params.end(), params.find("key2")); - EXPECT_EQ("", params["key2"]); + EXPECT_TRUE(params["key2"].empty()); EXPECT_EQ("foo", params["key3"]); } @@ -1177,7 +1209,7 @@ void ParseUriTest::onEnter() } EXPECT_EQ(1, params.size()); EXPECT_NE(params.end(), params.find("key3")); - EXPECT_EQ("", params["key3"]); + EXPECT_TRUE(params["key3"].empty()); } { @@ -1200,9 +1232,9 @@ void ParseUriTest::onEnter() EXPECT_EQ("ws", v.getScheme()); EXPECT_EQ("localhost", v.getHost()); EXPECT_EQ("localhost", v.getHostName()); - EXPECT_EQ("", v.getPath()); + EXPECT_TRUE(v.getPath().empty()); EXPECT_EQ(90, v.getPort()); - EXPECT_EQ("", v.getFragment()); + EXPECT_TRUE(v.getFragment().empty()); EXPECT_EQ("key1=foo=bar&key2=foobar&", v.getQuery()); EXPECT_EQ(u, v); } @@ -1215,9 +1247,9 @@ void ParseUriTest::onEnter() EXPECT_EQ("ws", v.getScheme()); EXPECT_EQ("localhost", v.getHost()); EXPECT_EQ("localhost", v.getHostName()); - EXPECT_EQ("", v.getPath()); + EXPECT_TRUE(v.getPath().empty()); EXPECT_EQ(90, v.getPort()); - EXPECT_EQ("", v.getFragment()); + EXPECT_TRUE(v.getFragment().empty()); EXPECT_EQ("key1=foo=bar&key2=foobar&", v.getQuery()); EXPECT_EQ(u, v); } @@ -1242,9 +1274,9 @@ void ParseUriTest::onEnter() EXPECT_EQ("ws", v.getScheme()); EXPECT_EQ("localhost", v.getHost()); EXPECT_EQ("localhost", v.getHostName()); - EXPECT_EQ("", v.getPath()); + EXPECT_TRUE(v.getPath().empty()); EXPECT_EQ(90, v.getPort()); - EXPECT_EQ("", v.getFragment()); + EXPECT_TRUE(v.getFragment().empty()); EXPECT_EQ("key1=foo=bar&key2=foobar&", v.getQuery()); u = std::move(v); } @@ -1258,9 +1290,9 @@ void ParseUriTest::onEnter() EXPECT_EQ("ws", v.getScheme()); EXPECT_EQ("localhost", v.getHost()); EXPECT_EQ("localhost", v.getHostName()); - EXPECT_EQ("", v.getPath()); + EXPECT_TRUE(v.getPath().empty()); EXPECT_EQ(90, v.getPort()); - EXPECT_EQ("", v.getFragment()); + EXPECT_TRUE(v.getFragment().empty()); EXPECT_EQ("key1=foo=bar&key2=foobar&", v.getQuery()); u = v; } @@ -1374,28 +1406,28 @@ void ParseUriTest::onEnter() EXPECT_EQ(u2.getPort(), 0); EXPECT_EQ(u2.getPath(), "/foo"); - EXPECT_EQ(u3.getScheme(), ""); + EXPECT_TRUE(u3.getScheme().empty()); EXPECT_EQ(u3.getHost(), "localhost"); EXPECT_EQ(u3.getPort(), 0); EXPECT_EQ(u3.getPath(), "/foo"); - EXPECT_EQ(u4.getScheme(), ""); + EXPECT_TRUE(u4.getScheme().empty()); EXPECT_EQ(u4.getHost(), "localhost"); EXPECT_EQ(u4.getPort(), 8080); - EXPECT_EQ(u4.getPath(), ""); - EXPECT_EQ(u4.getPathEtc(), ""); + EXPECT_TRUE(u4.getPath().empty()); + EXPECT_TRUE(u4.getPathEtc().empty()); EXPECT_EQ(u5.getScheme(), "bb"); EXPECT_EQ(u5.getHost(), "localhost"); EXPECT_EQ(u5.getPort(), 0); - EXPECT_EQ(u5.getPath(), ""); + EXPECT_TRUE(u5.getPath().empty()); EXPECT_EQ(u5.getPathEtc(), "?&foo=12:4&ccc=13"); EXPECT_EQ(u5.getQuery(), "&foo=12:4&ccc=13"); EXPECT_EQ(u6.getScheme(), "cc"); EXPECT_EQ(u6.getHost(), "localhost"); EXPECT_EQ(u6.getPort(), 91); - EXPECT_EQ(u6.getPath(), ""); + EXPECT_TRUE(u6.getPath().empty()); EXPECT_EQ(u6.getPathEtc(), "?&foo=321&bbb=1"); EXPECT_EQ(u6.getQuery(), "&foo=321&bbb=1"); } @@ -1436,7 +1468,7 @@ static void __checkMathUtilResult(const char* description, const float* a1, cons // Check whether the result of the optimized instruction is the same as which is implemented in C for (int i = 0; i < size; ++i) { - bool r = fabs(a1[i] - a2[i]) < 0.00001f;//FLT_EPSILON; + bool r = std::fabs(a1[i] - a2[i]) < 0.00001f;//FLT_EPSILON; if (r) { log("Correct: a1[%d]=%f, a2[%d]=%f", i, a1[i], i, a2[i]); diff --git a/tests/cpp-tests/Classes/UnitTest/UnitTest.h b/tests/cpp-tests/Classes/UnitTest/UnitTest.h index dfa5af74308d..23ce9ad675ab 100644 --- a/tests/cpp-tests/Classes/UnitTest/UnitTest.h +++ b/tests/cpp-tests/Classes/UnitTest/UnitTest.h @@ -79,6 +79,15 @@ class UIHelperSubStringTest : public UnitTestDemo virtual void onEnter() override; virtual std::string subtitle() const override; }; + +class ParseIntegerListTest : public UnitTestDemo +{ +public: + CREATE_FUNC(ParseIntegerListTest); + virtual void onEnter() override; + virtual std::string subtitle() const override; +}; + class ParseUriTest : public UnitTestDemo { public: diff --git a/tests/cpp-tests/Resources/ActionTimeline/Default/Button_Disable.png b/tests/cpp-tests/Resources/ActionTimeline/Default/Button_Disable.png old mode 100644 new mode 100755 index 2266bd09055d..62ee840c40d3 Binary files a/tests/cpp-tests/Resources/ActionTimeline/Default/Button_Disable.png and b/tests/cpp-tests/Resources/ActionTimeline/Default/Button_Disable.png differ diff --git a/tests/cpp-tests/Resources/ActionTimeline/Default/Sprite.png b/tests/cpp-tests/Resources/ActionTimeline/Default/Sprite.png old mode 100644 new mode 100755 index 7199a6ef4d92..115fa75667e5 Binary files a/tests/cpp-tests/Resources/ActionTimeline/Default/Sprite.png and b/tests/cpp-tests/Resources/ActionTimeline/Default/Sprite.png differ diff --git a/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/01.png b/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/01.png index 5377db476618..9dd0f7a3f7de 100644 Binary files a/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/01.png and b/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/01.png differ diff --git a/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/1.png b/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/1.png old mode 100644 new mode 100755 index 039478865420..065f83ff2ebf Binary files a/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/1.png and b/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/1.png differ diff --git a/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/2.png b/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/2.png old mode 100644 new mode 100755 index 9f0903246a43..d5a5be287dc3 Binary files a/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/2.png and b/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/2.png differ diff --git a/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/3.png b/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/3.png old mode 100644 new mode 100755 index febc41ab1cd5..ad9bfdb60e82 Binary files a/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/3.png and b/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/3.png differ diff --git a/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/4.png b/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/4.png old mode 100644 new mode 100755 index 14020d856541..0ea0ff8179dd Binary files a/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/4.png and b/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/4.png differ diff --git a/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/5.png b/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/5.png old mode 100644 new mode 100755 index 6443b87deb63..12ecbb639adf Binary files a/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/5.png and b/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/5.png differ diff --git a/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/6.png b/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/6.png old mode 100644 new mode 100755 index ab5c8bdfecb9..e37584767d97 Binary files a/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/6.png and b/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/6.png differ diff --git a/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/7.png b/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/7.png old mode 100644 new mode 100755 index 83d7e7bc6d43..d1dc8179c9a1 Binary files a/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/7.png and b/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/7.png differ diff --git a/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/8.png b/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/8.png old mode 100644 new mode 100755 index 1a6f31edc02c..cf56899d0262 Binary files a/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/8.png and b/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/8.png differ diff --git a/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/girl_arms.png b/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/girl_arms.png index 34928c0ee5cd..b4e473296826 100644 Binary files a/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/girl_arms.png and b/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/girl_arms.png differ diff --git a/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/hat.png b/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/hat.png old mode 100644 new mode 100755 index ae84f0869750..5d1f77b357d4 Binary files a/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/hat.png and b/tests/cpp-tests/Resources/ActionTimeline/testAnimationResource/hat.png differ diff --git a/tests/cpp-tests/Resources/Hello.png b/tests/cpp-tests/Resources/Hello.png old mode 100644 new mode 100755 index ef470529d8ea..5fe89fb5bd58 Binary files a/tests/cpp-tests/Resources/Hello.png and b/tests/cpp-tests/Resources/Hello.png differ diff --git a/tests/cpp-tests/Resources/Images/Comet.png b/tests/cpp-tests/Resources/Images/Comet.png old mode 100644 new mode 100755 index e864edcc07e3..2d127a381684 Binary files a/tests/cpp-tests/Resources/Images/Comet.png and b/tests/cpp-tests/Resources/Images/Comet.png differ diff --git a/tests/cpp-tests/Resources/Images/CyanSquare.png b/tests/cpp-tests/Resources/Images/CyanSquare.png old mode 100644 new mode 100755 index c30e34de9547..a09e345c3a36 Binary files a/tests/cpp-tests/Resources/Images/CyanSquare.png and b/tests/cpp-tests/Resources/Images/CyanSquare.png differ diff --git a/tests/cpp-tests/Resources/Images/CyanTriangle.png b/tests/cpp-tests/Resources/Images/CyanTriangle.png old mode 100644 new mode 100755 index 84a0eba03d34..d98aff8dcbf0 Binary files a/tests/cpp-tests/Resources/Images/CyanTriangle.png and b/tests/cpp-tests/Resources/Images/CyanTriangle.png differ diff --git a/tests/cpp-tests/Resources/Images/Fog.png b/tests/cpp-tests/Resources/Images/Fog.png old mode 100644 new mode 100755 index 709886a9021b..16340434805a Binary files a/tests/cpp-tests/Resources/Images/Fog.png and b/tests/cpp-tests/Resources/Images/Fog.png differ diff --git a/tests/cpp-tests/Resources/Images/HelloWorld.png b/tests/cpp-tests/Resources/Images/HelloWorld.png old mode 100644 new mode 100755 index ef50e7c96fa0..b92aeeb7f6d2 Binary files a/tests/cpp-tests/Resources/Images/HelloWorld.png and b/tests/cpp-tests/Resources/Images/HelloWorld.png differ diff --git a/tests/cpp-tests/Resources/Images/Icon.png b/tests/cpp-tests/Resources/Images/Icon.png old mode 100644 new mode 100755 index 0b03366d3c7d..378483a33d31 Binary files a/tests/cpp-tests/Resources/Images/Icon.png and b/tests/cpp-tests/Resources/Images/Icon.png differ diff --git a/tests/cpp-tests/Resources/Images/MagentaSquare.png b/tests/cpp-tests/Resources/Images/MagentaSquare.png old mode 100644 new mode 100755 index ec173d1b303b..e27f4ffbe9d4 Binary files a/tests/cpp-tests/Resources/Images/MagentaSquare.png and b/tests/cpp-tests/Resources/Images/MagentaSquare.png differ diff --git a/tests/cpp-tests/Resources/Images/Pea.png b/tests/cpp-tests/Resources/Images/Pea.png old mode 100644 new mode 100755 index ba3c116b41f2..8575e8465120 Binary files a/tests/cpp-tests/Resources/Images/Pea.png and b/tests/cpp-tests/Resources/Images/Pea.png differ diff --git a/tests/cpp-tests/Resources/Images/SendScoreButton.png b/tests/cpp-tests/Resources/Images/SendScoreButton.png old mode 100644 new mode 100755 index ba5322bdcf38..974b5193dde6 Binary files a/tests/cpp-tests/Resources/Images/SendScoreButton.png and b/tests/cpp-tests/Resources/Images/SendScoreButton.png differ diff --git a/tests/cpp-tests/Resources/Images/SendScoreButtonPressed.png b/tests/cpp-tests/Resources/Images/SendScoreButtonPressed.png old mode 100644 new mode 100755 index f0d41121c883..e650bc4d3649 Binary files a/tests/cpp-tests/Resources/Images/SendScoreButtonPressed.png and b/tests/cpp-tests/Resources/Images/SendScoreButtonPressed.png differ diff --git a/tests/cpp-tests/Resources/Images/SpinningPeas.png b/tests/cpp-tests/Resources/Images/SpinningPeas.png old mode 100644 new mode 100755 index 5d7cad620bcd..24cf345bbf45 Binary files a/tests/cpp-tests/Resources/Images/SpinningPeas.png and b/tests/cpp-tests/Resources/Images/SpinningPeas.png differ diff --git a/tests/cpp-tests/Resources/Images/SpookyPeas.png b/tests/cpp-tests/Resources/Images/SpookyPeas.png old mode 100644 new mode 100755 index 5d7cad620bcd..24cf345bbf45 Binary files a/tests/cpp-tests/Resources/Images/SpookyPeas.png and b/tests/cpp-tests/Resources/Images/SpookyPeas.png differ diff --git a/tests/cpp-tests/Resources/Images/YellowSquare.png b/tests/cpp-tests/Resources/Images/YellowSquare.png old mode 100644 new mode 100755 index b70d2ac95f6d..e3956432e6bd Binary files a/tests/cpp-tests/Resources/Images/YellowSquare.png and b/tests/cpp-tests/Resources/Images/YellowSquare.png differ diff --git a/tests/cpp-tests/Resources/Images/YellowTriangle.png b/tests/cpp-tests/Resources/Images/YellowTriangle.png old mode 100644 new mode 100755 index 22baeb3c957e..bbad41e2719c Binary files a/tests/cpp-tests/Resources/Images/YellowTriangle.png and b/tests/cpp-tests/Resources/Images/YellowTriangle.png differ diff --git a/tests/cpp-tests/Resources/Images/arrows-hd.png b/tests/cpp-tests/Resources/Images/arrows-hd.png index ca8b20507ad3..1a24e6fdeccc 100644 Binary files a/tests/cpp-tests/Resources/Images/arrows-hd.png and b/tests/cpp-tests/Resources/Images/arrows-hd.png differ diff --git a/tests/cpp-tests/Resources/Images/arrows.png b/tests/cpp-tests/Resources/Images/arrows.png old mode 100644 new mode 100755 index bc8751a90cc9..77ead2d11295 Binary files a/tests/cpp-tests/Resources/Images/arrows.png and b/tests/cpp-tests/Resources/Images/arrows.png differ diff --git a/tests/cpp-tests/Resources/Images/arrowsBar-hd.png b/tests/cpp-tests/Resources/Images/arrowsBar-hd.png index d8fc67bcd5ed..694b4d97687e 100644 Binary files a/tests/cpp-tests/Resources/Images/arrowsBar-hd.png and b/tests/cpp-tests/Resources/Images/arrowsBar-hd.png differ diff --git a/tests/cpp-tests/Resources/Images/arrowsBar.png b/tests/cpp-tests/Resources/Images/arrowsBar.png old mode 100644 new mode 100755 index 884833fc8c57..bd5cd73a2cb4 Binary files a/tests/cpp-tests/Resources/Images/arrowsBar.png and b/tests/cpp-tests/Resources/Images/arrowsBar.png differ diff --git a/tests/cpp-tests/Resources/Images/assetMgrBackground2.png b/tests/cpp-tests/Resources/Images/assetMgrBackground2.png old mode 100644 new mode 100755 index 2a3132e0fee8..3ef262edd577 Binary files a/tests/cpp-tests/Resources/Images/assetMgrBackground2.png and b/tests/cpp-tests/Resources/Images/assetMgrBackground2.png differ diff --git a/tests/cpp-tests/Resources/Images/assetMgrBackground3.png b/tests/cpp-tests/Resources/Images/assetMgrBackground3.png old mode 100644 new mode 100755 index eab2722e77d0..4baa0c5bc829 Binary files a/tests/cpp-tests/Resources/Images/assetMgrBackground3.png and b/tests/cpp-tests/Resources/Images/assetMgrBackground3.png differ diff --git a/tests/cpp-tests/Resources/Images/atlastest.png b/tests/cpp-tests/Resources/Images/atlastest.png old mode 100644 new mode 100755 index 284918128c4e..51db470a8ac0 Binary files a/tests/cpp-tests/Resources/Images/atlastest.png and b/tests/cpp-tests/Resources/Images/atlastest.png differ diff --git a/tests/cpp-tests/Resources/Images/b1.png b/tests/cpp-tests/Resources/Images/b1.png old mode 100644 new mode 100755 index 5a9044874467..93ee8252f088 Binary files a/tests/cpp-tests/Resources/Images/b1.png and b/tests/cpp-tests/Resources/Images/b1.png differ diff --git a/tests/cpp-tests/Resources/Images/b2.png b/tests/cpp-tests/Resources/Images/b2.png old mode 100644 new mode 100755 index 100d91b53829..8cc30415fbd8 Binary files a/tests/cpp-tests/Resources/Images/b2.png and b/tests/cpp-tests/Resources/Images/b2.png differ diff --git a/tests/cpp-tests/Resources/Images/background.png b/tests/cpp-tests/Resources/Images/background.png old mode 100644 new mode 100755 index 2a3132e0fee8..3ef262edd577 Binary files a/tests/cpp-tests/Resources/Images/background.png and b/tests/cpp-tests/Resources/Images/background.png differ diff --git a/tests/cpp-tests/Resources/Images/background1.png b/tests/cpp-tests/Resources/Images/background1.png old mode 100644 new mode 100755 index d85dae3b3f46..55458ff57bca Binary files a/tests/cpp-tests/Resources/Images/background1.png and b/tests/cpp-tests/Resources/Images/background1.png differ diff --git a/tests/cpp-tests/Resources/Images/background2.png b/tests/cpp-tests/Resources/Images/background2.png old mode 100644 new mode 100755 index 9b98ca442400..2c5bc0b8d6bc Binary files a/tests/cpp-tests/Resources/Images/background2.png and b/tests/cpp-tests/Resources/Images/background2.png differ diff --git a/tests/cpp-tests/Resources/Images/background3.png b/tests/cpp-tests/Resources/Images/background3.png old mode 100644 new mode 100755 index eab2722e77d0..4baa0c5bc829 Binary files a/tests/cpp-tests/Resources/Images/background3.png and b/tests/cpp-tests/Resources/Images/background3.png differ diff --git a/tests/cpp-tests/Resources/Images/ball.png b/tests/cpp-tests/Resources/Images/ball.png old mode 100644 new mode 100755 index 781f2b073a33..2379f371fa78 Binary files a/tests/cpp-tests/Resources/Images/ball.png and b/tests/cpp-tests/Resources/Images/ball.png differ diff --git a/tests/cpp-tests/Resources/Images/bitmapFontTest3.png b/tests/cpp-tests/Resources/Images/bitmapFontTest3.png old mode 100644 new mode 100755 index 2c1ad5d03f80..501e3d315afc Binary files a/tests/cpp-tests/Resources/Images/bitmapFontTest3.png and b/tests/cpp-tests/Resources/Images/bitmapFontTest3.png differ diff --git a/tests/cpp-tests/Resources/Images/blocks.png b/tests/cpp-tests/Resources/Images/blocks.png old mode 100644 new mode 100755 index 3f820111fadb..dd38d8b44835 Binary files a/tests/cpp-tests/Resources/Images/blocks.png and b/tests/cpp-tests/Resources/Images/blocks.png differ diff --git a/tests/cpp-tests/Resources/Images/blocks9.png b/tests/cpp-tests/Resources/Images/blocks9.png old mode 100644 new mode 100755 index 4c6d29f9d7b3..1013f6ad0c1a Binary files a/tests/cpp-tests/Resources/Images/blocks9.png and b/tests/cpp-tests/Resources/Images/blocks9.png differ diff --git a/tests/cpp-tests/Resources/Images/blocks9c.png b/tests/cpp-tests/Resources/Images/blocks9c.png index 79d069ad3eea..39674a445c4d 100644 Binary files a/tests/cpp-tests/Resources/Images/blocks9c.png and b/tests/cpp-tests/Resources/Images/blocks9c.png differ diff --git a/tests/cpp-tests/Resources/Images/blocks9cr.png b/tests/cpp-tests/Resources/Images/blocks9cr.png index 851918a3c6b4..beea86d7f8b0 100644 Binary files a/tests/cpp-tests/Resources/Images/blocks9cr.png and b/tests/cpp-tests/Resources/Images/blocks9cr.png differ diff --git a/tests/cpp-tests/Resources/Images/blocks9r.png b/tests/cpp-tests/Resources/Images/blocks9r.png old mode 100644 new mode 100755 index 095e695c8423..582d21752baf Binary files a/tests/cpp-tests/Resources/Images/blocks9r.png and b/tests/cpp-tests/Resources/Images/blocks9r.png differ diff --git a/tests/cpp-tests/Resources/Images/blocks9ss.png b/tests/cpp-tests/Resources/Images/blocks9ss.png old mode 100644 new mode 100755 index 5b484d960c29..0956f1d08459 Binary files a/tests/cpp-tests/Resources/Images/blocks9ss.png and b/tests/cpp-tests/Resources/Images/blocks9ss.png differ diff --git a/tests/cpp-tests/Resources/Images/btn-about-normal-vertical.png b/tests/cpp-tests/Resources/Images/btn-about-normal-vertical.png old mode 100644 new mode 100755 index 22d83c9d3832..08a1ce61b45d Binary files a/tests/cpp-tests/Resources/Images/btn-about-normal-vertical.png and b/tests/cpp-tests/Resources/Images/btn-about-normal-vertical.png differ diff --git a/tests/cpp-tests/Resources/Images/btn-about-normal.png b/tests/cpp-tests/Resources/Images/btn-about-normal.png old mode 100644 new mode 100755 index 8890e5aa3d3e..455ca632c0ea Binary files a/tests/cpp-tests/Resources/Images/btn-about-normal.png and b/tests/cpp-tests/Resources/Images/btn-about-normal.png differ diff --git a/tests/cpp-tests/Resources/Images/btn-about-selected.png b/tests/cpp-tests/Resources/Images/btn-about-selected.png old mode 100644 new mode 100755 index 6b12058adb4d..20f12ecb3710 Binary files a/tests/cpp-tests/Resources/Images/btn-about-selected.png and b/tests/cpp-tests/Resources/Images/btn-about-selected.png differ diff --git a/tests/cpp-tests/Resources/Images/btn-highscores-normal.png b/tests/cpp-tests/Resources/Images/btn-highscores-normal.png old mode 100644 new mode 100755 index 8681d07a85b0..c5c86c2de3d5 Binary files a/tests/cpp-tests/Resources/Images/btn-highscores-normal.png and b/tests/cpp-tests/Resources/Images/btn-highscores-normal.png differ diff --git a/tests/cpp-tests/Resources/Images/btn-highscores-selected.png b/tests/cpp-tests/Resources/Images/btn-highscores-selected.png old mode 100644 new mode 100755 index 430c6d9cd4ce..ae5d9481d49f Binary files a/tests/cpp-tests/Resources/Images/btn-highscores-selected.png and b/tests/cpp-tests/Resources/Images/btn-highscores-selected.png differ diff --git a/tests/cpp-tests/Resources/Images/btn-play-normal.png b/tests/cpp-tests/Resources/Images/btn-play-normal.png old mode 100644 new mode 100755 index 8a080cbbdcd5..976f700de0da Binary files a/tests/cpp-tests/Resources/Images/btn-play-normal.png and b/tests/cpp-tests/Resources/Images/btn-play-normal.png differ diff --git a/tests/cpp-tests/Resources/Images/btn-play-selected.png b/tests/cpp-tests/Resources/Images/btn-play-selected.png old mode 100644 new mode 100755 index 850e9fae0664..d8e8aba243b0 Binary files a/tests/cpp-tests/Resources/Images/btn-play-selected.png and b/tests/cpp-tests/Resources/Images/btn-play-selected.png differ diff --git a/tests/cpp-tests/Resources/Images/bug12847_sprite.png b/tests/cpp-tests/Resources/Images/bug12847_sprite.png index a87a6192ee12..6f13b95c676f 100644 Binary files a/tests/cpp-tests/Resources/Images/bug12847_sprite.png and b/tests/cpp-tests/Resources/Images/bug12847_sprite.png differ diff --git a/tests/cpp-tests/Resources/Images/bug12847_spriteframe.png b/tests/cpp-tests/Resources/Images/bug12847_spriteframe.png index afbe0b83959e..b63a0cc1b5c7 100644 Binary files a/tests/cpp-tests/Resources/Images/bug12847_spriteframe.png and b/tests/cpp-tests/Resources/Images/bug12847_spriteframe.png differ diff --git a/tests/cpp-tests/Resources/Images/bug14017.png b/tests/cpp-tests/Resources/Images/bug14017.png index 14aab485f0e5..824be98da729 100644 Binary files a/tests/cpp-tests/Resources/Images/bug14017.png and b/tests/cpp-tests/Resources/Images/bug14017.png differ diff --git a/tests/cpp-tests/Resources/Images/bugs/bug886.png b/tests/cpp-tests/Resources/Images/bugs/bug886.png old mode 100644 new mode 100755 index 5349301ffa8b..99fcdbbafffe Binary files a/tests/cpp-tests/Resources/Images/bugs/bug886.png and b/tests/cpp-tests/Resources/Images/bugs/bug886.png differ diff --git a/tests/cpp-tests/Resources/Images/bugs/circle.png b/tests/cpp-tests/Resources/Images/bugs/circle.png old mode 100644 new mode 100755 index 268f21062534..04722e626e86 Binary files a/tests/cpp-tests/Resources/Images/bugs/circle.png and b/tests/cpp-tests/Resources/Images/bugs/circle.png differ diff --git a/tests/cpp-tests/Resources/Images/bugs/corner.png b/tests/cpp-tests/Resources/Images/bugs/corner.png old mode 100644 new mode 100755 index 46054617f0a7..8bd0bab1b0cc Binary files a/tests/cpp-tests/Resources/Images/bugs/corner.png and b/tests/cpp-tests/Resources/Images/bugs/corner.png differ diff --git a/tests/cpp-tests/Resources/Images/bugs/edge.png b/tests/cpp-tests/Resources/Images/bugs/edge.png old mode 100644 new mode 100755 index 1f01e49ba34c..e8bc0ee3084e Binary files a/tests/cpp-tests/Resources/Images/bugs/edge.png and b/tests/cpp-tests/Resources/Images/bugs/edge.png differ diff --git a/tests/cpp-tests/Resources/Images/bugs/fill.png b/tests/cpp-tests/Resources/Images/bugs/fill.png old mode 100644 new mode 100755 index dbeaf53478ac..dfebed80c569 Binary files a/tests/cpp-tests/Resources/Images/bugs/fill.png and b/tests/cpp-tests/Resources/Images/bugs/fill.png differ diff --git a/tests/cpp-tests/Resources/Images/bugs/picture.png b/tests/cpp-tests/Resources/Images/bugs/picture.png old mode 100644 new mode 100755 index dfa44f4dbfaa..64fc17070c4f Binary files a/tests/cpp-tests/Resources/Images/bugs/picture.png and b/tests/cpp-tests/Resources/Images/bugs/picture.png differ diff --git a/tests/cpp-tests/Resources/Images/close.png b/tests/cpp-tests/Resources/Images/close.png old mode 100644 new mode 100755 index 1366a65e5d66..ef3b1d12ae6b Binary files a/tests/cpp-tests/Resources/Images/close.png and b/tests/cpp-tests/Resources/Images/close.png differ diff --git a/tests/cpp-tests/Resources/Images/cocos-html5.png b/tests/cpp-tests/Resources/Images/cocos-html5.png index 7472b2ffd832..ab7c7118e32a 100644 Binary files a/tests/cpp-tests/Resources/Images/cocos-html5.png and b/tests/cpp-tests/Resources/Images/cocos-html5.png differ diff --git a/tests/cpp-tests/Resources/Images/cocos2dbanner.png b/tests/cpp-tests/Resources/Images/cocos2dbanner.png index 2183674e545d..f60ca47c5733 100644 Binary files a/tests/cpp-tests/Resources/Images/cocos2dbanner.png and b/tests/cpp-tests/Resources/Images/cocos2dbanner.png differ diff --git a/tests/cpp-tests/Resources/Images/concave.png b/tests/cpp-tests/Resources/Images/concave.png index a985c06822e8..c39f0e9ce503 100644 Binary files a/tests/cpp-tests/Resources/Images/concave.png and b/tests/cpp-tests/Resources/Images/concave.png differ diff --git a/tests/cpp-tests/Resources/Images/dot.png b/tests/cpp-tests/Resources/Images/dot.png index b26e65f92187..eb89425ece66 100644 Binary files a/tests/cpp-tests/Resources/Images/dot.png and b/tests/cpp-tests/Resources/Images/dot.png differ diff --git a/tests/cpp-tests/Resources/Images/elephant1_Diffuse.png b/tests/cpp-tests/Resources/Images/elephant1_Diffuse.png old mode 100644 new mode 100755 index c5e2ad80860d..e73b2baa8270 Binary files a/tests/cpp-tests/Resources/Images/elephant1_Diffuse.png and b/tests/cpp-tests/Resources/Images/elephant1_Diffuse.png differ diff --git a/tests/cpp-tests/Resources/Images/elephant1_Normal.png b/tests/cpp-tests/Resources/Images/elephant1_Normal.png old mode 100644 new mode 100755 index bd52a878f187..6da6f09e0617 Binary files a/tests/cpp-tests/Resources/Images/elephant1_Normal.png and b/tests/cpp-tests/Resources/Images/elephant1_Normal.png differ diff --git a/tests/cpp-tests/Resources/Images/f1.png b/tests/cpp-tests/Resources/Images/f1.png old mode 100644 new mode 100755 index adea9fe7ddf1..385e22707b61 Binary files a/tests/cpp-tests/Resources/Images/f1.png and b/tests/cpp-tests/Resources/Images/f1.png differ diff --git a/tests/cpp-tests/Resources/Images/f2.png b/tests/cpp-tests/Resources/Images/f2.png old mode 100644 new mode 100755 index 2613cb7c6658..388a7399c5a3 Binary files a/tests/cpp-tests/Resources/Images/f2.png and b/tests/cpp-tests/Resources/Images/f2.png differ diff --git a/tests/cpp-tests/Resources/Images/fire-grayscale.png b/tests/cpp-tests/Resources/Images/fire-grayscale.png old mode 100644 new mode 100755 index aa8caf493ae0..5f48174f592e Binary files a/tests/cpp-tests/Resources/Images/fire-grayscale.png and b/tests/cpp-tests/Resources/Images/fire-grayscale.png differ diff --git a/tests/cpp-tests/Resources/Images/fire.png b/tests/cpp-tests/Resources/Images/fire.png old mode 100644 new mode 100755 index 18c5ca25df64..dd2be34cff9a Binary files a/tests/cpp-tests/Resources/Images/fire.png and b/tests/cpp-tests/Resources/Images/fire.png differ diff --git a/tests/cpp-tests/Resources/Images/fps_images.png b/tests/cpp-tests/Resources/Images/fps_images.png index 74c0f6b0767f..e91d0af540bf 100644 Binary files a/tests/cpp-tests/Resources/Images/fps_images.png and b/tests/cpp-tests/Resources/Images/fps_images.png differ diff --git a/tests/cpp-tests/Resources/Images/grossini.png b/tests/cpp-tests/Resources/Images/grossini.png old mode 100644 new mode 100755 index bb2fb1c8aaeb..fad80b8e9af8 Binary files a/tests/cpp-tests/Resources/Images/grossini.png and b/tests/cpp-tests/Resources/Images/grossini.png differ diff --git a/tests/cpp-tests/Resources/Images/grossini_dance_01.png b/tests/cpp-tests/Resources/Images/grossini_dance_01.png old mode 100644 new mode 100755 index f2a9e5b3b9cd..93aa6e983ac3 Binary files a/tests/cpp-tests/Resources/Images/grossini_dance_01.png and b/tests/cpp-tests/Resources/Images/grossini_dance_01.png differ diff --git a/tests/cpp-tests/Resources/Images/grossini_dance_02.png b/tests/cpp-tests/Resources/Images/grossini_dance_02.png old mode 100644 new mode 100755 index 5dddcbe0df63..bf03d3312c36 Binary files a/tests/cpp-tests/Resources/Images/grossini_dance_02.png and b/tests/cpp-tests/Resources/Images/grossini_dance_02.png differ diff --git a/tests/cpp-tests/Resources/Images/grossini_dance_03.png b/tests/cpp-tests/Resources/Images/grossini_dance_03.png old mode 100644 new mode 100755 index 80ef2db7b272..e01c593b40e5 Binary files a/tests/cpp-tests/Resources/Images/grossini_dance_03.png and b/tests/cpp-tests/Resources/Images/grossini_dance_03.png differ diff --git a/tests/cpp-tests/Resources/Images/grossini_dance_04.png b/tests/cpp-tests/Resources/Images/grossini_dance_04.png old mode 100644 new mode 100755 index 1f5ea3bc4edc..c9b0ae252940 Binary files a/tests/cpp-tests/Resources/Images/grossini_dance_04.png and b/tests/cpp-tests/Resources/Images/grossini_dance_04.png differ diff --git a/tests/cpp-tests/Resources/Images/grossini_dance_05.png b/tests/cpp-tests/Resources/Images/grossini_dance_05.png old mode 100644 new mode 100755 index fe9543994b7f..e65e6b2febb3 Binary files a/tests/cpp-tests/Resources/Images/grossini_dance_05.png and b/tests/cpp-tests/Resources/Images/grossini_dance_05.png differ diff --git a/tests/cpp-tests/Resources/Images/grossini_dance_06.png b/tests/cpp-tests/Resources/Images/grossini_dance_06.png old mode 100644 new mode 100755 index 279c98458456..4c3be2334f25 Binary files a/tests/cpp-tests/Resources/Images/grossini_dance_06.png and b/tests/cpp-tests/Resources/Images/grossini_dance_06.png differ diff --git a/tests/cpp-tests/Resources/Images/grossini_dance_07.png b/tests/cpp-tests/Resources/Images/grossini_dance_07.png old mode 100644 new mode 100755 index 4b0eb62253a1..4c38de3a789d Binary files a/tests/cpp-tests/Resources/Images/grossini_dance_07.png and b/tests/cpp-tests/Resources/Images/grossini_dance_07.png differ diff --git a/tests/cpp-tests/Resources/Images/grossini_dance_08.png b/tests/cpp-tests/Resources/Images/grossini_dance_08.png old mode 100644 new mode 100755 index bb2fb1c8aaeb..fad80b8e9af8 Binary files a/tests/cpp-tests/Resources/Images/grossini_dance_08.png and b/tests/cpp-tests/Resources/Images/grossini_dance_08.png differ diff --git a/tests/cpp-tests/Resources/Images/grossini_dance_09.png b/tests/cpp-tests/Resources/Images/grossini_dance_09.png old mode 100644 new mode 100755 index ace80c5a611e..b0fa9aded3a3 Binary files a/tests/cpp-tests/Resources/Images/grossini_dance_09.png and b/tests/cpp-tests/Resources/Images/grossini_dance_09.png differ diff --git a/tests/cpp-tests/Resources/Images/grossini_dance_10.png b/tests/cpp-tests/Resources/Images/grossini_dance_10.png old mode 100644 new mode 100755 index 47fbcd3061d5..0abb6eab9397 Binary files a/tests/cpp-tests/Resources/Images/grossini_dance_10.png and b/tests/cpp-tests/Resources/Images/grossini_dance_10.png differ diff --git a/tests/cpp-tests/Resources/Images/grossini_dance_11.png b/tests/cpp-tests/Resources/Images/grossini_dance_11.png old mode 100644 new mode 100755 index 5d32b097ee61..7285fd6c76de Binary files a/tests/cpp-tests/Resources/Images/grossini_dance_11.png and b/tests/cpp-tests/Resources/Images/grossini_dance_11.png differ diff --git a/tests/cpp-tests/Resources/Images/grossini_dance_12.png b/tests/cpp-tests/Resources/Images/grossini_dance_12.png old mode 100644 new mode 100755 index 26d848203a6d..ce7d672004da Binary files a/tests/cpp-tests/Resources/Images/grossini_dance_12.png and b/tests/cpp-tests/Resources/Images/grossini_dance_12.png differ diff --git a/tests/cpp-tests/Resources/Images/grossini_dance_13.png b/tests/cpp-tests/Resources/Images/grossini_dance_13.png old mode 100644 new mode 100755 index fe29977f2bd7..92cbbd4da184 Binary files a/tests/cpp-tests/Resources/Images/grossini_dance_13.png and b/tests/cpp-tests/Resources/Images/grossini_dance_13.png differ diff --git a/tests/cpp-tests/Resources/Images/grossini_dance_14.png b/tests/cpp-tests/Resources/Images/grossini_dance_14.png old mode 100644 new mode 100755 index 9bc05feed818..ee7d1bba0aea Binary files a/tests/cpp-tests/Resources/Images/grossini_dance_14.png and b/tests/cpp-tests/Resources/Images/grossini_dance_14.png differ diff --git a/tests/cpp-tests/Resources/Images/grossini_dance_atlas-mono.png b/tests/cpp-tests/Resources/Images/grossini_dance_atlas-mono.png old mode 100644 new mode 100755 index c01129672137..932ba39c5919 Binary files a/tests/cpp-tests/Resources/Images/grossini_dance_atlas-mono.png and b/tests/cpp-tests/Resources/Images/grossini_dance_atlas-mono.png differ diff --git a/tests/cpp-tests/Resources/Images/grossini_dance_atlas.png b/tests/cpp-tests/Resources/Images/grossini_dance_atlas.png old mode 100644 new mode 100755 index 28607fdc7758..12bca1310fd7 Binary files a/tests/cpp-tests/Resources/Images/grossini_dance_atlas.png and b/tests/cpp-tests/Resources/Images/grossini_dance_atlas.png differ diff --git a/tests/cpp-tests/Resources/Images/grossini_dance_atlas_nomipmap.png b/tests/cpp-tests/Resources/Images/grossini_dance_atlas_nomipmap.png old mode 100644 new mode 100755 index 28607fdc7758..12bca1310fd7 Binary files a/tests/cpp-tests/Resources/Images/grossini_dance_atlas_nomipmap.png and b/tests/cpp-tests/Resources/Images/grossini_dance_atlas_nomipmap.png differ diff --git a/tests/cpp-tests/Resources/Images/grossinis_heads.png b/tests/cpp-tests/Resources/Images/grossinis_heads.png index 1b76039fae6f..47dddc50e86f 100644 Binary files a/tests/cpp-tests/Resources/Images/grossinis_heads.png and b/tests/cpp-tests/Resources/Images/grossinis_heads.png differ diff --git a/tests/cpp-tests/Resources/Images/grossinis_sister1-testalpha.png b/tests/cpp-tests/Resources/Images/grossinis_sister1-testalpha.png old mode 100644 new mode 100755 index cbf7e29c4d46..1715123a8bd6 Binary files a/tests/cpp-tests/Resources/Images/grossinis_sister1-testalpha.png and b/tests/cpp-tests/Resources/Images/grossinis_sister1-testalpha.png differ diff --git a/tests/cpp-tests/Resources/Images/grossinis_sister1.png b/tests/cpp-tests/Resources/Images/grossinis_sister1.png old mode 100644 new mode 100755 index ffbcd59b87ff..5be7918a604c Binary files a/tests/cpp-tests/Resources/Images/grossinis_sister1.png and b/tests/cpp-tests/Resources/Images/grossinis_sister1.png differ diff --git a/tests/cpp-tests/Resources/Images/grossinis_sister2.png b/tests/cpp-tests/Resources/Images/grossinis_sister2.png old mode 100644 new mode 100755 index 39c9556c28a3..b25d759a8fbe Binary files a/tests/cpp-tests/Resources/Images/grossinis_sister2.png and b/tests/cpp-tests/Resources/Images/grossinis_sister2.png differ diff --git a/tests/cpp-tests/Resources/Images/hole_effect.png b/tests/cpp-tests/Resources/Images/hole_effect.png old mode 100644 new mode 100755 index 29b98d78b1f2..da1f7e215b22 Binary files a/tests/cpp-tests/Resources/Images/hole_effect.png and b/tests/cpp-tests/Resources/Images/hole_effect.png differ diff --git a/tests/cpp-tests/Resources/Images/hole_stencil.png b/tests/cpp-tests/Resources/Images/hole_stencil.png old mode 100644 new mode 100755 index 36054c48ec47..9f69c3e0cb98 Binary files a/tests/cpp-tests/Resources/Images/hole_stencil.png and b/tests/cpp-tests/Resources/Images/hole_stencil.png differ diff --git a/tests/cpp-tests/Resources/Images/island_polygon.png b/tests/cpp-tests/Resources/Images/island_polygon.png index 3302f98ef4e8..d56140752905 100644 Binary files a/tests/cpp-tests/Resources/Images/island_polygon.png and b/tests/cpp-tests/Resources/Images/island_polygon.png differ diff --git a/tests/cpp-tests/Resources/Images/issue_17116.png b/tests/cpp-tests/Resources/Images/issue_17116.png index 6e3c2b27d1dc..5433f5d08c8a 100644 Binary files a/tests/cpp-tests/Resources/Images/issue_17116.png and b/tests/cpp-tests/Resources/Images/issue_17116.png differ diff --git a/tests/cpp-tests/Resources/Images/issue_17119.png b/tests/cpp-tests/Resources/Images/issue_17119.png index dc0901d40d83..c368260304b4 100644 Binary files a/tests/cpp-tests/Resources/Images/issue_17119.png and b/tests/cpp-tests/Resources/Images/issue_17119.png differ diff --git a/tests/cpp-tests/Resources/Images/labelatlas.png b/tests/cpp-tests/Resources/Images/labelatlas.png old mode 100644 new mode 100755 index a6c5440b8f99..41486794cd0b Binary files a/tests/cpp-tests/Resources/Images/labelatlas.png and b/tests/cpp-tests/Resources/Images/labelatlas.png differ diff --git a/tests/cpp-tests/Resources/Images/menuitemsprite.png b/tests/cpp-tests/Resources/Images/menuitemsprite.png old mode 100644 new mode 100755 index fed3a4bdc110..ae97b916b21d Binary files a/tests/cpp-tests/Resources/Images/menuitemsprite.png and b/tests/cpp-tests/Resources/Images/menuitemsprite.png differ diff --git a/tests/cpp-tests/Resources/Images/movement.png b/tests/cpp-tests/Resources/Images/movement.png index ee09a90380a3..5dd324c37cab 100644 Binary files a/tests/cpp-tests/Resources/Images/movement.png and b/tests/cpp-tests/Resources/Images/movement.png differ diff --git a/tests/cpp-tests/Resources/Images/noise.png b/tests/cpp-tests/Resources/Images/noise.png old mode 100644 new mode 100755 index 35adb41b6ba7..22be01654ca3 Binary files a/tests/cpp-tests/Resources/Images/noise.png and b/tests/cpp-tests/Resources/Images/noise.png differ diff --git a/tests/cpp-tests/Resources/Images/paddle.png b/tests/cpp-tests/Resources/Images/paddle.png old mode 100644 new mode 100755 index bd4c6f9457fb..eefd7e75355f Binary files a/tests/cpp-tests/Resources/Images/paddle.png and b/tests/cpp-tests/Resources/Images/paddle.png differ diff --git a/tests/cpp-tests/Resources/Images/particles-hd.png b/tests/cpp-tests/Resources/Images/particles-hd.png index 4fd96747f1bb..664a48e6d37c 100644 Binary files a/tests/cpp-tests/Resources/Images/particles-hd.png and b/tests/cpp-tests/Resources/Images/particles-hd.png differ diff --git a/tests/cpp-tests/Resources/Images/particles.png b/tests/cpp-tests/Resources/Images/particles.png old mode 100644 new mode 100755 index af8e5f7d5e7b..236e5a07a75c Binary files a/tests/cpp-tests/Resources/Images/particles.png and b/tests/cpp-tests/Resources/Images/particles.png differ diff --git a/tests/cpp-tests/Resources/Images/pattern1.png b/tests/cpp-tests/Resources/Images/pattern1.png old mode 100644 new mode 100755 index 3c9c57ee673d..a55490726db9 Binary files a/tests/cpp-tests/Resources/Images/pattern1.png and b/tests/cpp-tests/Resources/Images/pattern1.png differ diff --git a/tests/cpp-tests/Resources/Images/piece.png b/tests/cpp-tests/Resources/Images/piece.png old mode 100644 new mode 100755 index 5c496f961bfa..41367e45748f Binary files a/tests/cpp-tests/Resources/Images/piece.png and b/tests/cpp-tests/Resources/Images/piece.png differ diff --git a/tests/cpp-tests/Resources/Images/poly_test_textures.png b/tests/cpp-tests/Resources/Images/poly_test_textures.png index cbddd2ecd93a..484cc56942da 100644 Binary files a/tests/cpp-tests/Resources/Images/poly_test_textures.png and b/tests/cpp-tests/Resources/Images/poly_test_textures.png differ diff --git a/tests/cpp-tests/Resources/Images/powered.png b/tests/cpp-tests/Resources/Images/powered.png old mode 100644 new mode 100755 index 43116b8b6eb4..0ef51fd3a8a7 Binary files a/tests/cpp-tests/Resources/Images/powered.png and b/tests/cpp-tests/Resources/Images/powered.png differ diff --git a/tests/cpp-tests/Resources/Images/r1.png b/tests/cpp-tests/Resources/Images/r1.png old mode 100644 new mode 100755 index b145f5dc0630..96c070883199 Binary files a/tests/cpp-tests/Resources/Images/r1.png and b/tests/cpp-tests/Resources/Images/r1.png differ diff --git a/tests/cpp-tests/Resources/Images/r2.png b/tests/cpp-tests/Resources/Images/r2.png old mode 100644 new mode 100755 index 40b7cd5dbdff..1caf31f4bd82 Binary files a/tests/cpp-tests/Resources/Images/r2.png and b/tests/cpp-tests/Resources/Images/r2.png differ diff --git a/tests/cpp-tests/Resources/Images/shapemode.png b/tests/cpp-tests/Resources/Images/shapemode.png index 6c68b481c7a6..ebba704154b1 100644 Binary files a/tests/cpp-tests/Resources/Images/shapemode.png and b/tests/cpp-tests/Resources/Images/shapemode.png differ diff --git a/tests/cpp-tests/Resources/Images/snow.png b/tests/cpp-tests/Resources/Images/snow.png old mode 100644 new mode 100755 index a9de1a2d25fa..860b58107624 Binary files a/tests/cpp-tests/Resources/Images/snow.png and b/tests/cpp-tests/Resources/Images/snow.png differ diff --git a/tests/cpp-tests/Resources/Images/sprite_frames_test/test_A8.png b/tests/cpp-tests/Resources/Images/sprite_frames_test/test_A8.png index 397d384839a4..2f4630804f40 100644 Binary files a/tests/cpp-tests/Resources/Images/sprite_frames_test/test_A8.png and b/tests/cpp-tests/Resources/Images/sprite_frames_test/test_A8.png differ diff --git a/tests/cpp-tests/Resources/Images/sprite_frames_test/test_AI88.png b/tests/cpp-tests/Resources/Images/sprite_frames_test/test_AI88.png index 7cdc9a99cad2..105fa481e785 100644 Binary files a/tests/cpp-tests/Resources/Images/sprite_frames_test/test_AI88.png and b/tests/cpp-tests/Resources/Images/sprite_frames_test/test_AI88.png differ diff --git a/tests/cpp-tests/Resources/Images/sprite_frames_test/test_RGBA8888.png b/tests/cpp-tests/Resources/Images/sprite_frames_test/test_RGBA8888.png index 2a165394a0ea..ab9888d9667f 100644 Binary files a/tests/cpp-tests/Resources/Images/sprite_frames_test/test_RGBA8888.png and b/tests/cpp-tests/Resources/Images/sprite_frames_test/test_RGBA8888.png differ diff --git a/tests/cpp-tests/Resources/Images/sprite_polygon_crash.png b/tests/cpp-tests/Resources/Images/sprite_polygon_crash.png index d421a0514790..ec8d2fe590ee 100644 Binary files a/tests/cpp-tests/Resources/Images/sprite_polygon_crash.png and b/tests/cpp-tests/Resources/Images/sprite_polygon_crash.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-0-0.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-0-0.png old mode 100644 new mode 100755 index fe8d85a588e3..8256a5299290 Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-0-0.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-0-0.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-0-1.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-0-1.png old mode 100644 new mode 100755 index 0e9c6ee27357..ea7d815696ba Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-0-1.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-0-1.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-0-2.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-0-2.png old mode 100644 new mode 100755 index 02b6fefe81f2..fb444b334845 Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-0-2.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-0-2.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-0-3.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-0-3.png old mode 100644 new mode 100755 index 771b378a5fb8..81f6c287b9ff Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-0-3.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-0-3.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-0-4.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-0-4.png old mode 100644 new mode 100755 index 2438a3642274..a0d5ba8621f1 Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-0-4.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-0-4.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-0-5.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-0-5.png old mode 100644 new mode 100755 index d5cf70d64135..307968b441f8 Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-0-5.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-0-5.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-0-6.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-0-6.png old mode 100644 new mode 100755 index c88b760fd100..e98bbcd94e25 Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-0-6.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-0-6.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-0-7.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-0-7.png old mode 100644 new mode 100755 index a757cb9c5ef8..5c13bee7b5fe Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-0-7.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-0-7.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-1-0.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-1-0.png old mode 100644 new mode 100755 index c7e96a30c33b..55836459810f Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-1-0.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-1-0.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-1-1.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-1-1.png old mode 100644 new mode 100755 index 9416bb457a21..665bb8b606fc Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-1-1.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-1-1.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-1-2.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-1-2.png old mode 100644 new mode 100755 index 58163427b00c..f73989bc7170 Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-1-2.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-1-2.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-1-3.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-1-3.png old mode 100644 new mode 100755 index 178f9805e1c9..92cdc270d936 Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-1-3.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-1-3.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-1-4.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-1-4.png old mode 100644 new mode 100755 index 1c7c1c5be906..d4c4ff36b10b Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-1-4.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-1-4.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-1-5.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-1-5.png old mode 100644 new mode 100755 index a0fa121e52e2..95fb8ba7e958 Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-1-5.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-1-5.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-1-6.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-1-6.png old mode 100644 new mode 100755 index 5aa716bfa0aa..b576d2e3e65d Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-1-6.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-1-6.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-1-7.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-1-7.png old mode 100644 new mode 100755 index d6685102dc18..f0367c971d56 Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-1-7.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-1-7.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-2-0.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-2-0.png old mode 100644 new mode 100755 index bf282a0a5c31..71044a10b13a Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-2-0.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-2-0.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-2-1.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-2-1.png old mode 100644 new mode 100755 index ccc921bdf5d8..3feb9e940f3c Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-2-1.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-2-1.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-2-2.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-2-2.png old mode 100644 new mode 100755 index 22c8b6da6f9e..e7e874043938 Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-2-2.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-2-2.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-2-3.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-2-3.png old mode 100644 new mode 100755 index 11e8b340f134..6ef5cc5e788b Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-2-3.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-2-3.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-2-4.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-2-4.png old mode 100644 new mode 100755 index cf9455689ae1..c6ac17cac89e Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-2-4.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-2-4.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-2-5.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-2-5.png old mode 100644 new mode 100755 index aad456f23c54..d496e3d02795 Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-2-5.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-2-5.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-2-6.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-2-6.png old mode 100644 new mode 100755 index b29c19255513..066b38a5cf68 Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-2-6.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-2-6.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-2-7.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-2-7.png old mode 100644 new mode 100755 index daebd72c50f5..78c89fc74848 Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-2-7.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-2-7.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-3-0.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-3-0.png old mode 100644 new mode 100755 index 5de148f278f0..230107e65be5 Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-3-0.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-3-0.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-3-1.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-3-1.png old mode 100644 new mode 100755 index b550aae37ae2..ec5990d45159 Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-3-1.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-3-1.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-3-2.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-3-2.png old mode 100644 new mode 100755 index 7f12816e1e77..70b510b38c45 Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-3-2.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-3-2.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-3-3.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-3-3.png old mode 100644 new mode 100755 index 0391552b1ac3..3b7d911e222f Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-3-3.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-3-3.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-3-4.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-3-4.png old mode 100644 new mode 100755 index 9c70c0a54187..8455784e3afe Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-3-4.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-3-4.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-3-5.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-3-5.png old mode 100644 new mode 100755 index ebb09b9012ca..2d28698df5e9 Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-3-5.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-3-5.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-3-6.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-3-6.png old mode 100644 new mode 100755 index f31ebf6a7dd9..fdc30ee923ff Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-3-6.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-3-6.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-3-7.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-3-7.png old mode 100644 new mode 100755 index d13deb9bbd50..7dfd55fda38b Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-3-7.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-3-7.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-4-0.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-4-0.png old mode 100644 new mode 100755 index f1d6d6b2103f..6bfc144c7e51 Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-4-0.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-4-0.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-4-1.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-4-1.png old mode 100644 new mode 100755 index 3379df52aa15..15d6eb1543d4 Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-4-1.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-4-1.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-4-2.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-4-2.png old mode 100644 new mode 100755 index cf80a18d3081..32190cb70dca Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-4-2.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-4-2.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-4-3.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-4-3.png old mode 100644 new mode 100755 index e6a541173afa..2e0320578ad3 Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-4-3.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-4-3.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-4-4.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-4-4.png old mode 100644 new mode 100755 index ed44270955bb..f0708bb42127 Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-4-4.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-4-4.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-4-5.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-4-5.png old mode 100644 new mode 100755 index 16d079ea2bcc..6c9ec9f39f0c Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-4-5.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-4-5.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-4-6.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-4-6.png old mode 100644 new mode 100755 index 252c543e295b..d93f278fd71e Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-4-6.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-4-6.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-4-7.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-4-7.png old mode 100644 new mode 100755 index b7c32e31ed94..5dce60c7119f Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-4-7.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-4-7.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-5-0.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-5-0.png old mode 100644 new mode 100755 index 40a663dbe989..1adff7adeed4 Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-5-0.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-5-0.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-5-1.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-5-1.png old mode 100644 new mode 100755 index 87e3ded7959a..c3e56fe1662c Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-5-1.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-5-1.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-5-2.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-5-2.png old mode 100644 new mode 100755 index 83a8a027969f..3659a67fe5a8 Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-5-2.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-5-2.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-5-3.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-5-3.png old mode 100644 new mode 100755 index 41a3eb0a24e9..5e771251db39 Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-5-3.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-5-3.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-5-4.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-5-4.png old mode 100644 new mode 100755 index 5fb456e2e6ca..907c3696c280 Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-5-4.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-5-4.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-5-5.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-5-5.png old mode 100644 new mode 100755 index c979be13695b..a9175a5d0bf8 Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-5-5.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-5-5.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-5-6.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-5-6.png old mode 100644 new mode 100755 index 54765e3dbe31..14bf384a9c1f Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-5-6.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-5-6.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-5-7.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-5-7.png old mode 100644 new mode 100755 index 7886066c5ba0..6d3017014732 Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-5-7.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-5-7.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-6-0.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-6-0.png old mode 100644 new mode 100755 index 456366f0abc1..11be173003cc Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-6-0.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-6-0.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-6-1.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-6-1.png old mode 100644 new mode 100755 index e15e60ea2f85..259b7aed5330 Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-6-1.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-6-1.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-6-2.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-6-2.png old mode 100644 new mode 100755 index d9c116855c64..b9bae9d70331 Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-6-2.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-6-2.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-6-3.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-6-3.png old mode 100644 new mode 100755 index ea50e0e784f0..a84b7b5d0961 Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-6-3.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-6-3.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-6-4.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-6-4.png old mode 100644 new mode 100755 index df33aba630ef..5ec22013c41c Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-6-4.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-6-4.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-6-5.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-6-5.png old mode 100644 new mode 100755 index b51baf671516..3c07dc5190bc Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-6-5.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-6-5.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-6-6.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-6-6.png old mode 100644 new mode 100755 index 0eb505f80a8a..de9e1e6b4aad Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-6-6.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-6-6.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-6-7.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-6-7.png old mode 100644 new mode 100755 index da4b15ba9e2c..0cf0e8fc17bc Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-6-7.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-6-7.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-7-0.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-7-0.png old mode 100644 new mode 100755 index 9417639710df..58964c3fd83b Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-7-0.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-7-0.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-7-1.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-7-1.png old mode 100644 new mode 100755 index c997eca675cd..b733b95b4f94 Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-7-1.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-7-1.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-7-2.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-7-2.png old mode 100644 new mode 100755 index 8f98bf07394e..14404fa36b6c Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-7-2.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-7-2.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-7-3.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-7-3.png old mode 100644 new mode 100755 index 498056031765..1770b6982fb4 Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-7-3.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-7-3.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-7-4.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-7-4.png old mode 100644 new mode 100755 index 1a07cfc99d77..3be136596ed4 Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-7-4.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-7-4.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-7-5.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-7-5.png old mode 100644 new mode 100755 index fdaa96907a51..594a7a8a732a Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-7-5.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-7-5.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-7-6.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-7-6.png old mode 100644 new mode 100755 index 11a33e4ab6e1..72a7ff18705a Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-7-6.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-7-6.png differ diff --git a/tests/cpp-tests/Resources/Images/sprites_test/sprite-7-7.png b/tests/cpp-tests/Resources/Images/sprites_test/sprite-7-7.png old mode 100644 new mode 100755 index 7108fb7f3faf..0287bd77116c Binary files a/tests/cpp-tests/Resources/Images/sprites_test/sprite-7-7.png and b/tests/cpp-tests/Resources/Images/sprites_test/sprite-7-7.png differ diff --git a/tests/cpp-tests/Resources/Images/stars-grayscale.png b/tests/cpp-tests/Resources/Images/stars-grayscale.png old mode 100644 new mode 100755 index 585e45faec6c..fe47acd4fc04 Binary files a/tests/cpp-tests/Resources/Images/stars-grayscale.png and b/tests/cpp-tests/Resources/Images/stars-grayscale.png differ diff --git a/tests/cpp-tests/Resources/Images/stars.png b/tests/cpp-tests/Resources/Images/stars.png old mode 100644 new mode 100755 index 585e45faec6c..fe47acd4fc04 Binary files a/tests/cpp-tests/Resources/Images/stars.png and b/tests/cpp-tests/Resources/Images/stars.png differ diff --git a/tests/cpp-tests/Resources/Images/stars2-grayscale.png b/tests/cpp-tests/Resources/Images/stars2-grayscale.png old mode 100644 new mode 100755 index 2db010fb5fe4..ef841f9df569 Binary files a/tests/cpp-tests/Resources/Images/stars2-grayscale.png and b/tests/cpp-tests/Resources/Images/stars2-grayscale.png differ diff --git a/tests/cpp-tests/Resources/Images/stars2.png b/tests/cpp-tests/Resources/Images/stars2.png old mode 100644 new mode 100755 index cc0d7e1d09f7..ef841f9df569 Binary files a/tests/cpp-tests/Resources/Images/stars2.png and b/tests/cpp-tests/Resources/Images/stars2.png differ diff --git a/tests/cpp-tests/Resources/Images/stone.png b/tests/cpp-tests/Resources/Images/stone.png old mode 100644 new mode 100755 index 6ae4717a39cc..069608062110 Binary files a/tests/cpp-tests/Resources/Images/stone.png and b/tests/cpp-tests/Resources/Images/stone.png differ diff --git a/tests/cpp-tests/Resources/Images/streak.png b/tests/cpp-tests/Resources/Images/streak.png old mode 100644 new mode 100755 index 39255df13bc9..c602c98fc19b Binary files a/tests/cpp-tests/Resources/Images/streak.png and b/tests/cpp-tests/Resources/Images/streak.png differ diff --git a/tests/cpp-tests/Resources/Images/test-rgba1.png b/tests/cpp-tests/Resources/Images/test-rgba1.png old mode 100644 new mode 100755 index 5ec33bc1c244..302c63a08a36 Binary files a/tests/cpp-tests/Resources/Images/test-rgba1.png and b/tests/cpp-tests/Resources/Images/test-rgba1.png differ diff --git a/tests/cpp-tests/Resources/Images/test_blend.png b/tests/cpp-tests/Resources/Images/test_blend.png old mode 100644 new mode 100755 index 9ea7afaebe9f..de4cd69292b3 Binary files a/tests/cpp-tests/Resources/Images/test_blend.png and b/tests/cpp-tests/Resources/Images/test_blend.png differ diff --git a/tests/cpp-tests/Resources/Images/test_image.png b/tests/cpp-tests/Resources/Images/test_image.png old mode 100644 new mode 100755 index a094b8ff9484..eaf947476415 Binary files a/tests/cpp-tests/Resources/Images/test_image.png and b/tests/cpp-tests/Resources/Images/test_image.png differ diff --git a/tests/cpp-tests/Resources/Images/test_image_ai88.png b/tests/cpp-tests/Resources/Images/test_image_ai88.png old mode 100644 new mode 100755 index 5280de245b9d..7d0aa3110735 Binary files a/tests/cpp-tests/Resources/Images/test_image_ai88.png and b/tests/cpp-tests/Resources/Images/test_image_ai88.png differ diff --git a/tests/cpp-tests/Resources/Images/test_image_i8.png b/tests/cpp-tests/Resources/Images/test_image_i8.png old mode 100644 new mode 100755 index 707dadd03b8d..d35273890494 Binary files a/tests/cpp-tests/Resources/Images/test_image_i8.png and b/tests/cpp-tests/Resources/Images/test_image_i8.png differ diff --git a/tests/cpp-tests/Resources/Images/test_image_rgb888.png b/tests/cpp-tests/Resources/Images/test_image_rgb888.png old mode 100644 new mode 100755 index 6eadd9b9b089..173b63093f07 Binary files a/tests/cpp-tests/Resources/Images/test_image_rgb888.png and b/tests/cpp-tests/Resources/Images/test_image_rgb888.png differ diff --git a/tests/cpp-tests/Resources/Images/test_image_rgba8888.png b/tests/cpp-tests/Resources/Images/test_image_rgba8888.png old mode 100644 new mode 100755 index eef590c9f090..c6b6395312e7 Binary files a/tests/cpp-tests/Resources/Images/test_image_rgba8888.png and b/tests/cpp-tests/Resources/Images/test_image_rgba8888.png differ diff --git a/tests/cpp-tests/Resources/Images/test_polygon.png b/tests/cpp-tests/Resources/Images/test_polygon.png index 639a2b9fb001..c54a8480bb98 100644 Binary files a/tests/cpp-tests/Resources/Images/test_polygon.png and b/tests/cpp-tests/Resources/Images/test_polygon.png differ diff --git a/tests/cpp-tests/Resources/Images/texture1024x1024.png b/tests/cpp-tests/Resources/Images/texture1024x1024.png old mode 100644 new mode 100755 index 7f99d8d7b432..12a15fae99ec Binary files a/tests/cpp-tests/Resources/Images/texture1024x1024.png and b/tests/cpp-tests/Resources/Images/texture1024x1024.png differ diff --git a/tests/cpp-tests/Resources/Images/texture2048x2048.png b/tests/cpp-tests/Resources/Images/texture2048x2048.png old mode 100644 new mode 100755 index b9482e0d637f..3db29c49dc16 Binary files a/tests/cpp-tests/Resources/Images/texture2048x2048.png and b/tests/cpp-tests/Resources/Images/texture2048x2048.png differ diff --git a/tests/cpp-tests/Resources/Images/texture512x512.png b/tests/cpp-tests/Resources/Images/texture512x512.png old mode 100644 new mode 100755 index ad432559b7be..170c02fd828c Binary files a/tests/cpp-tests/Resources/Images/texture512x512.png and b/tests/cpp-tests/Resources/Images/texture512x512.png differ diff --git a/tests/cpp-tests/Resources/Images/texturemode.png b/tests/cpp-tests/Resources/Images/texturemode.png index 6310483bb0e8..0202080e9fc7 100644 Binary files a/tests/cpp-tests/Resources/Images/texturemode.png and b/tests/cpp-tests/Resources/Images/texturemode.png differ diff --git a/tests/cpp-tests/Resources/Images/ui.png b/tests/cpp-tests/Resources/Images/ui.png old mode 100644 new mode 100755 index 725ba8bd2db9..9a702b025f3b Binary files a/tests/cpp-tests/Resources/Images/ui.png and b/tests/cpp-tests/Resources/Images/ui.png differ diff --git a/tests/cpp-tests/Resources/Images/white-512x512.png b/tests/cpp-tests/Resources/Images/white-512x512.png old mode 100644 new mode 100755 index ad432559b7be..170c02fd828c Binary files a/tests/cpp-tests/Resources/Images/white-512x512.png and b/tests/cpp-tests/Resources/Images/white-512x512.png differ diff --git a/tests/cpp-tests/Resources/InputTest/cursor1.png b/tests/cpp-tests/Resources/InputTest/cursor1.png new file mode 100644 index 000000000000..973d3eafe0e7 Binary files /dev/null and b/tests/cpp-tests/Resources/InputTest/cursor1.png differ diff --git a/tests/cpp-tests/Resources/InputTest/cursor2.png b/tests/cpp-tests/Resources/InputTest/cursor2.png new file mode 100644 index 000000000000..d0d625191c02 Binary files /dev/null and b/tests/cpp-tests/Resources/InputTest/cursor2.png differ diff --git a/tests/cpp-tests/Resources/NavMesh/maps/scenetex.png b/tests/cpp-tests/Resources/NavMesh/maps/scenetex.png index f05f915f26a0..ce473f8dac5b 100644 Binary files a/tests/cpp-tests/Resources/NavMesh/maps/scenetex.png and b/tests/cpp-tests/Resources/NavMesh/maps/scenetex.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/crate6.png b/tests/cpp-tests/Resources/Particle3D/textures/crate6.png index 60181f8ee7f2..a7b0b0ecb3fe 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/crate6.png and b/tests/cpp-tests/Resources/Particle3D/textures/crate6.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/interpolate.png b/tests/cpp-tests/Resources/Particle3D/textures/interpolate.png index f1c83bbac5a9..29620cdca515 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/interpolate.png and b/tests/cpp-tests/Resources/Particle3D/textures/interpolate.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/mp_fire_02_2x2.png b/tests/cpp-tests/Resources/Particle3D/textures/mp_fire_02_2x2.png index 2e1e0dd13b17..18d6946ca4a3 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/mp_fire_02_2x2.png and b/tests/cpp-tests/Resources/Particle3D/textures/mp_fire_02_2x2.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pu_barrel_01.png b/tests/cpp-tests/Resources/Particle3D/textures/pu_barrel_01.png index 5605bad63369..402d821b1404 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pu_barrel_01.png and b/tests/cpp-tests/Resources/Particle3D/textures/pu_barrel_01.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pu_barrel_02.png b/tests/cpp-tests/Resources/Particle3D/textures/pu_barrel_02.png index b4ca8f9f55bd..b5ee14b6cd6e 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pu_barrel_02.png and b/tests/cpp-tests/Resources/Particle3D/textures/pu_barrel_02.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pu_bbal.png b/tests/cpp-tests/Resources/Particle3D/textures/pu_bbal.png index af4380cfcadb..7b76a89eb2f4 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pu_bbal.png and b/tests/cpp-tests/Resources/Particle3D/textures/pu_bbal.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pu_beam_01.png b/tests/cpp-tests/Resources/Particle3D/textures/pu_beam_01.png index 7e768ecce2d7..b11f8435def4 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pu_beam_01.png and b/tests/cpp-tests/Resources/Particle3D/textures/pu_beam_01.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pu_beam_02.png b/tests/cpp-tests/Resources/Particle3D/textures/pu_beam_02.png index 3c66c8e80d8b..144fb2b9b28e 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pu_beam_02.png and b/tests/cpp-tests/Resources/Particle3D/textures/pu_beam_02.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pu_circle.png b/tests/cpp-tests/Resources/Particle3D/textures/pu_circle.png index 69e0858cbd58..250f42b99cdc 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pu_circle.png and b/tests/cpp-tests/Resources/Particle3D/textures/pu_circle.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pu_dirt_256x512.png b/tests/cpp-tests/Resources/Particle3D/textures/pu_dirt_256x512.png index 021ef560f9f0..7e95b872cb92 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pu_dirt_256x512.png and b/tests/cpp-tests/Resources/Particle3D/textures/pu_dirt_256x512.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pu_dot_03_64x64.png b/tests/cpp-tests/Resources/Particle3D/textures/pu_dot_03_64x64.png index e462d80d5ae9..0d85ab4e2c53 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pu_dot_03_64x64.png and b/tests/cpp-tests/Resources/Particle3D/textures/pu_dot_03_64x64.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pu_fire_01_64x64.png b/tests/cpp-tests/Resources/Particle3D/textures/pu_fire_01_64x64.png index d04468b7b537..f54578862def 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pu_fire_01_64x64.png and b/tests/cpp-tests/Resources/Particle3D/textures/pu_fire_01_64x64.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pu_flame.png b/tests/cpp-tests/Resources/Particle3D/textures/pu_flame.png index 0850609893d1..5b92b5e66f33 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pu_flame.png and b/tests/cpp-tests/Resources/Particle3D/textures/pu_flame.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pu_flare.png b/tests/cpp-tests/Resources/Particle3D/textures/pu_flare.png index 71a6811d69cf..4909d7fbf13b 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pu_flare.png and b/tests/cpp-tests/Resources/Particle3D/textures/pu_flare.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pu_flare_12_256x256.png b/tests/cpp-tests/Resources/Particle3D/textures/pu_flare_12_256x256.png index 647eee58a0df..f2c40269cef9 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pu_flare_12_256x256.png and b/tests/cpp-tests/Resources/Particle3D/textures/pu_flare_12_256x256.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pu_green_ball.png b/tests/cpp-tests/Resources/Particle3D/textures/pu_green_ball.png index 5cab70eadd78..bbb484f3f561 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pu_green_ball.png and b/tests/cpp-tests/Resources/Particle3D/textures/pu_green_ball.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pu_hart.png b/tests/cpp-tests/Resources/Particle3D/textures/pu_hart.png index 5caf72594f68..54a02515dcf9 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pu_hart.png and b/tests/cpp-tests/Resources/Particle3D/textures/pu_hart.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pu_lightning_20x64.png b/tests/cpp-tests/Resources/Particle3D/textures/pu_lightning_20x64.png index b232b824d177..a55a98c146d5 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pu_lightning_20x64.png and b/tests/cpp-tests/Resources/Particle3D/textures/pu_lightning_20x64.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pu_nucleus.png b/tests/cpp-tests/Resources/Particle3D/textures/pu_nucleus.png index 5c9c9e1cfc81..0c7bf955e454 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pu_nucleus.png and b/tests/cpp-tests/Resources/Particle3D/textures/pu_nucleus.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pu_rain.png b/tests/cpp-tests/Resources/Particle3D/textures/pu_rain.png index da23752a4f0f..92d77d2bebba 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pu_rain.png and b/tests/cpp-tests/Resources/Particle3D/textures/pu_rain.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pu_rain_01.png b/tests/cpp-tests/Resources/Particle3D/textures/pu_rain_01.png index a2c51e9ee047..fc316b7df4ad 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pu_rain_01.png and b/tests/cpp-tests/Resources/Particle3D/textures/pu_rain_01.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pu_ribbontrail.png b/tests/cpp-tests/Resources/Particle3D/textures/pu_ribbontrail.png index 27921b993ab6..e6966640c0b6 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pu_ribbontrail.png and b/tests/cpp-tests/Resources/Particle3D/textures/pu_ribbontrail.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pu_sand_336x330.png b/tests/cpp-tests/Resources/Particle3D/textures/pu_sand_336x330.png index 538aee32f83e..ae895594aeb1 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pu_sand_336x330.png and b/tests/cpp-tests/Resources/Particle3D/textures/pu_sand_336x330.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pu_smoke_02_128x128.png b/tests/cpp-tests/Resources/Particle3D/textures/pu_smoke_02_128x128.png index 63e81beb1cdc..d33371658655 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pu_smoke_02_128x128.png and b/tests/cpp-tests/Resources/Particle3D/textures/pu_smoke_02_128x128.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pu_smoke_brown_336x330.png b/tests/cpp-tests/Resources/Particle3D/textures/pu_smoke_brown_336x330.png index 884f43a0e028..9d13cb3c9abe 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pu_smoke_brown_336x330.png and b/tests/cpp-tests/Resources/Particle3D/textures/pu_smoke_brown_336x330.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_atlas_smoke.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_atlas_smoke.png index c43f4ec8294e..f946f98f9bdd 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_atlas_smoke.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_atlas_smoke.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_biohazzard.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_biohazzard.png index e11b4b29aa54..091be2f87a79 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_biohazzard.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_biohazzard.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_bubble.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_bubble.png index f105f5abf58b..1eec4a3c0667 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_bubble.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_bubble.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_bubble_blurred.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_bubble_blurred.png index e684bfcf8e1d..a8411139e2ea 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_bubble_blurred.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_bubble_blurred.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_celticknot.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_celticknot.png index 601073e71faf..22c9cd8bbbab 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_celticknot.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_celticknot.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_dirt_01.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_dirt_01.png index e4f130c9d7a2..c259757bb071 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_dirt_01.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_dirt_01.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_dirt_02.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_dirt_02.png index b622b957295d..9a026c93c108 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_dirt_02.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_dirt_02.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_flame_01.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_flame_01.png index 2753d30da608..ed9dc42e1e90 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_flame_01.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_flame_01.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_flame_02.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_flame_02.png index f01916dfeb25..c407c30cbc46 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_flame_02.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_flame_02.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_flame_03.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_flame_03.png index e042fcf5feeb..e77d9983d323 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_flame_03.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_flame_03.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_flame_04.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_flame_04.png index 30261a8702d4..592946aa63ea 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_flame_04.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_flame_04.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_flare_01.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_flare_01.png index 524b28c88085..a90214bbda43 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_flare_01.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_flare_01.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_flare_02.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_flare_02.png index 92a8be4384b7..8ead0155b234 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_flare_02.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_flare_02.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_flare_03.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_flare_03.png index c66f7879978f..1dc469c8e7f3 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_flare_03.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_flare_03.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_flare_04.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_flare_04.png index 8cce2882d2f8..868431ec1c77 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_flare_04.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_flare_04.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_flare_05.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_flare_05.png index e8fe09b736c2..469acc2de7a1 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_flare_05.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_flare_05.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_flare_06.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_flare_06.png index bf1e65a99e5a..60dadf22be82 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_flare_06.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_flare_06.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_genesis_01.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_genesis_01.png index 2cabcb94b56f..5edcb8eebffc 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_genesis_01.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_genesis_01.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_genesis_02.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_genesis_02.png index 04b2c121df42..5473d523a5ef 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_genesis_02.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_genesis_02.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_hourglass.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_hourglass.png index 2ec45ed8801a..b322dc56cdca 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_hourglass.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_hourglass.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_leave.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_leave.png index 45dd306cd80a..1cda97a7dba4 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_leave.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_leave.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_lightning_01.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_lightning_01.png index 7a0cb2cd2ebb..a48297ddae0d 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_lightning_01.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_lightning_01.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_lightning_02.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_lightning_02.png index 4c1f7be42587..a9dd25c2f77a 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_lightning_02.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_lightning_02.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_lightning_03.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_lightning_03.png index 6281e5cab27e..095c1194a589 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_lightning_03.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_lightning_03.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_lightning_04.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_lightning_04.png index bfbebc09922f..01f9f07bbbd0 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_lightning_04.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_lightning_04.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_mcdxiiiv.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_mcdxiiiv.png index a14efd19f64f..81010780e47c 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_mcdxiiiv.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_mcdxiiiv.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_metal_01.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_metal_01.png index daf6ed73910a..d77658644435 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_metal_01.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_metal_01.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_metal_02.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_metal_02.png index 55d80f3ebda2..e98fcad67394 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_metal_02.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_metal_02.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_mmviii.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_mmviii.png index e672541541da..5cf2fa9153cc 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_mmviii.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_mmviii.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_pentagram_01.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_pentagram_01.png index 016c66a43673..836830d7c75c 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_pentagram_01.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_pentagram_01.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_pentagram_02.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_pentagram_02.png index 6c52a74afcef..49ddcbc954d3 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_pentagram_02.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_pentagram_02.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_ring_01.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_ring_01.png index 918535e48d22..e52ae2032c41 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_ring_01.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_ring_01.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_ring_02.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_ring_02.png index cd97c20386da..c3c54817eb9c 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_ring_02.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_ring_02.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_ring_03.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_ring_03.png index f8b0e9cf61f3..812453c62519 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_ring_03.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_ring_03.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_ring_04.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_ring_04.png index 64b93dd8ffc6..871a3191ff1a 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_ring_04.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_ring_04.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_ring_05.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_ring_05.png index 09ca42eff830..f0deb8434e76 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_ring_05.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_ring_05.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_smoke_01.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_smoke_01.png index 9374bd92863f..3e2735a056a3 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_smoke_01.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_smoke_01.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_smoke_02.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_smoke_02.png index fd3e2dcc857a..0313fadf602e 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_smoke_02.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_smoke_02.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_smoke_03.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_smoke_03.png index 2844d53c2f9e..cd0d92f68b5f 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_smoke_03.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_smoke_03.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_smoke_04.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_smoke_04.png index f8ae47690363..41bc91bf0888 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_smoke_04.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_smoke_04.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_smoke_05.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_smoke_05.png index 2a93e4d42968..b70942aebb6f 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_smoke_05.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_smoke_05.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_smoke_06.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_smoke_06.png index 58a855950e46..6a23466c31c8 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_smoke_06.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_smoke_06.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_smoke_07.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_smoke_07.png index 67504aee43c6..6a05665f746e 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_smoke_07.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_smoke_07.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_snow_01.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_snow_01.png index 46dd462a10b2..95c414e01820 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_snow_01.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_snow_01.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_spark_01.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_spark_01.png index c49dde08cc1f..2e826d60f43a 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_spark_01.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_spark_01.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_star_01.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_star_01.png index ab92bc7091d4..20b4a915f537 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_star_01.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_star_01.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_star_02.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_star_02.png index f122c96902c2..2ab43259b700 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_star_02.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_star_02.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_star_03.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_star_03.png index 49da4feb6422..21a5d4eb6918 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_star_03.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_star_03.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_star_04.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_star_04.png index c49d679ad6da..8864c5b5e173 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_star_04.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_star_04.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_star_05.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_star_05.png index 45e72084b796..34dbd49c40b0 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_star_05.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_star_05.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_streak_01.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_streak_01.png index f53993072995..5b2ce2ef20eb 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_streak_01.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_streak_01.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_streak_02.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_streak_02.png index 9b1d397d31a7..893c42189015 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_streak_02.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_streak_02.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_streak_03.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_streak_03.png index bf7ad7fc70f6..a9cd103b402e 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_streak_03.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_streak_03.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_streak_04.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_streak_04.png index f20606b1409c..cf0d7c79fedb 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_streak_04.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_streak_04.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_swirl_01.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_swirl_01.png index a88aee273934..418137432e43 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_swirl_01.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_swirl_01.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_swirl_02.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_swirl_02.png index b606974a9344..1825ba5dcc41 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_swirl_02.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_swirl_02.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_swirl_03.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_swirl_03.png index 30926d45f278..35b8463fcf43 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_swirl_03.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_swirl_03.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/pump_watch.png b/tests/cpp-tests/Resources/Particle3D/textures/pump_watch.png index fb21667e469b..038fc737d4f3 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/pump_watch.png and b/tests/cpp-tests/Resources/Particle3D/textures/pump_watch.png differ diff --git a/tests/cpp-tests/Resources/Particle3D/textures/weaponTrail.png b/tests/cpp-tests/Resources/Particle3D/textures/weaponTrail.png index e34dff9f0bb9..4fadb7e89f1a 100644 Binary files a/tests/cpp-tests/Resources/Particle3D/textures/weaponTrail.png and b/tests/cpp-tests/Resources/Particle3D/textures/weaponTrail.png differ diff --git a/tests/cpp-tests/Resources/Particles/SpriteFrame.png b/tests/cpp-tests/Resources/Particles/SpriteFrame.png index 5d34d1ddfb63..efef9f9a2e8d 100644 Binary files a/tests/cpp-tests/Resources/Particles/SpriteFrame.png and b/tests/cpp-tests/Resources/Particles/SpriteFrame.png differ diff --git a/tests/cpp-tests/Resources/Presentation/chipmunk_status.png b/tests/cpp-tests/Resources/Presentation/chipmunk_status.png index c1dcf1b9619f..ce772e536c8a 100644 Binary files a/tests/cpp-tests/Resources/Presentation/chipmunk_status.png and b/tests/cpp-tests/Resources/Presentation/chipmunk_status.png differ diff --git a/tests/cpp-tests/Resources/Presentation/cocos2d_status.png b/tests/cpp-tests/Resources/Presentation/cocos2d_status.png index 7977da956024..f2eb13d49808 100644 Binary files a/tests/cpp-tests/Resources/Presentation/cocos2d_status.png and b/tests/cpp-tests/Resources/Presentation/cocos2d_status.png differ diff --git a/tests/cpp-tests/Resources/Presentation/cocosbuilder_status.png b/tests/cpp-tests/Resources/Presentation/cocosbuilder_status.png index 00f097868d61..8589cd257544 100644 Binary files a/tests/cpp-tests/Resources/Presentation/cocosbuilder_status.png and b/tests/cpp-tests/Resources/Presentation/cocosbuilder_status.png differ diff --git a/tests/cpp-tests/Resources/Presentation/comparison.png b/tests/cpp-tests/Resources/Presentation/comparison.png index e5b12b5934ca..6f94a831b7ce 100644 Binary files a/tests/cpp-tests/Resources/Presentation/comparison.png and b/tests/cpp-tests/Resources/Presentation/comparison.png differ diff --git a/tests/cpp-tests/Resources/Presentation/gdkaccelerator.png b/tests/cpp-tests/Resources/Presentation/gdkaccelerator.png index 95f0ed07c84c..2033340424fc 100644 Binary files a/tests/cpp-tests/Resources/Presentation/gdkaccelerator.png and b/tests/cpp-tests/Resources/Presentation/gdkaccelerator.png differ diff --git a/tests/cpp-tests/Resources/Presentation/html5accelerator.png b/tests/cpp-tests/Resources/Presentation/html5accelerator.png index bdb3f1cef487..78b2934d1caf 100644 Binary files a/tests/cpp-tests/Resources/Presentation/html5accelerator.png and b/tests/cpp-tests/Resources/Presentation/html5accelerator.png differ diff --git a/tests/cpp-tests/Resources/Presentation/proxy_model.png b/tests/cpp-tests/Resources/Presentation/proxy_model.png index 109acb4c8d28..2e32fd0f5e4b 100644 Binary files a/tests/cpp-tests/Resources/Presentation/proxy_model.png and b/tests/cpp-tests/Resources/Presentation/proxy_model.png differ diff --git a/tests/cpp-tests/Resources/Sprite3DTest/Floor.png b/tests/cpp-tests/Resources/Sprite3DTest/Floor.png index 2a3b8e9ff324..4ebde104e762 100644 Binary files a/tests/cpp-tests/Resources/Sprite3DTest/Floor.png and b/tests/cpp-tests/Resources/Sprite3DTest/Floor.png differ diff --git a/tests/cpp-tests/Resources/Sprite3DTest/Girl_Face.png b/tests/cpp-tests/Resources/Sprite3DTest/Girl_Face.png index 832f61c04c51..9dc0b7634d59 100644 Binary files a/tests/cpp-tests/Resources/Sprite3DTest/Girl_Face.png and b/tests/cpp-tests/Resources/Sprite3DTest/Girl_Face.png differ diff --git a/tests/cpp-tests/Resources/Sprite3DTest/Girl_Glasses01.png b/tests/cpp-tests/Resources/Sprite3DTest/Girl_Glasses01.png index 1975a17bb2dd..0754928550e7 100644 Binary files a/tests/cpp-tests/Resources/Sprite3DTest/Girl_Glasses01.png and b/tests/cpp-tests/Resources/Sprite3DTest/Girl_Glasses01.png differ diff --git a/tests/cpp-tests/Resources/Sprite3DTest/Girl_Hair01.png b/tests/cpp-tests/Resources/Sprite3DTest/Girl_Hair01.png index c5244fcbcce0..05d3f1b060df 100644 Binary files a/tests/cpp-tests/Resources/Sprite3DTest/Girl_Hair01.png and b/tests/cpp-tests/Resources/Sprite3DTest/Girl_Hair01.png differ diff --git a/tests/cpp-tests/Resources/Sprite3DTest/Girl_Hair02.png b/tests/cpp-tests/Resources/Sprite3DTest/Girl_Hair02.png index c5079f98b020..c86e87ba274e 100644 Binary files a/tests/cpp-tests/Resources/Sprite3DTest/Girl_Hair02.png and b/tests/cpp-tests/Resources/Sprite3DTest/Girl_Hair02.png differ diff --git a/tests/cpp-tests/Resources/Sprite3DTest/Girl_Hand.png b/tests/cpp-tests/Resources/Sprite3DTest/Girl_Hand.png index 2ec9af346b38..f95fecae54f5 100644 Binary files a/tests/cpp-tests/Resources/Sprite3DTest/Girl_Hand.png and b/tests/cpp-tests/Resources/Sprite3DTest/Girl_Hand.png differ diff --git a/tests/cpp-tests/Resources/Sprite3DTest/Girl_LowerBody01.png b/tests/cpp-tests/Resources/Sprite3DTest/Girl_LowerBody01.png index 2a3942de8667..3b8ee9c27d94 100644 Binary files a/tests/cpp-tests/Resources/Sprite3DTest/Girl_LowerBody01.png and b/tests/cpp-tests/Resources/Sprite3DTest/Girl_LowerBody01.png differ diff --git a/tests/cpp-tests/Resources/Sprite3DTest/Girl_LowerBody02.png b/tests/cpp-tests/Resources/Sprite3DTest/Girl_LowerBody02.png index 76447b763768..88150778673c 100644 Binary files a/tests/cpp-tests/Resources/Sprite3DTest/Girl_LowerBody02.png and b/tests/cpp-tests/Resources/Sprite3DTest/Girl_LowerBody02.png differ diff --git a/tests/cpp-tests/Resources/Sprite3DTest/Girl_Shoes01.png b/tests/cpp-tests/Resources/Sprite3DTest/Girl_Shoes01.png index 48f2984f4fdf..42d35215c248 100644 Binary files a/tests/cpp-tests/Resources/Sprite3DTest/Girl_Shoes01.png and b/tests/cpp-tests/Resources/Sprite3DTest/Girl_Shoes01.png differ diff --git a/tests/cpp-tests/Resources/Sprite3DTest/Girl_Shoes02.png b/tests/cpp-tests/Resources/Sprite3DTest/Girl_Shoes02.png index f28685c9c39d..9e9f9d2899ad 100644 Binary files a/tests/cpp-tests/Resources/Sprite3DTest/Girl_Shoes02.png and b/tests/cpp-tests/Resources/Sprite3DTest/Girl_Shoes02.png differ diff --git a/tests/cpp-tests/Resources/Sprite3DTest/Girl_UpperBody01.png b/tests/cpp-tests/Resources/Sprite3DTest/Girl_UpperBody01.png index e8c27102eed4..3b8233a4b732 100644 Binary files a/tests/cpp-tests/Resources/Sprite3DTest/Girl_UpperBody01.png and b/tests/cpp-tests/Resources/Sprite3DTest/Girl_UpperBody01.png differ diff --git a/tests/cpp-tests/Resources/Sprite3DTest/Girl_UpperBody02.png b/tests/cpp-tests/Resources/Sprite3DTest/Girl_UpperBody02.png index 9d6ab942ac62..ec01cd680689 100644 Binary files a/tests/cpp-tests/Resources/Sprite3DTest/Girl_UpperBody02.png and b/tests/cpp-tests/Resources/Sprite3DTest/Girl_UpperBody02.png differ diff --git a/tests/cpp-tests/Resources/Sprite3DTest/Xie_01.png b/tests/cpp-tests/Resources/Sprite3DTest/Xie_01.png index 48f2984f4fdf..42d35215c248 100644 Binary files a/tests/cpp-tests/Resources/Sprite3DTest/Xie_01.png and b/tests/cpp-tests/Resources/Sprite3DTest/Xie_01.png differ diff --git a/tests/cpp-tests/Resources/Sprite3DTest/arx.png b/tests/cpp-tests/Resources/Sprite3DTest/arx.png old mode 100644 new mode 100755 index 1247bf8c9844..26c82f9d8084 Binary files a/tests/cpp-tests/Resources/Sprite3DTest/arx.png and b/tests/cpp-tests/Resources/Sprite3DTest/arx.png differ diff --git a/tests/cpp-tests/Resources/Sprite3DTest/body.png b/tests/cpp-tests/Resources/Sprite3DTest/body.png index 45c297ab7579..f2c09089e403 100644 Binary files a/tests/cpp-tests/Resources/Sprite3DTest/body.png and b/tests/cpp-tests/Resources/Sprite3DTest/body.png differ diff --git a/tests/cpp-tests/Resources/Sprite3DTest/boss.png b/tests/cpp-tests/Resources/Sprite3DTest/boss.png index 5d85c3f1bed7..7073a9678cf9 100644 Binary files a/tests/cpp-tests/Resources/Sprite3DTest/boss.png and b/tests/cpp-tests/Resources/Sprite3DTest/boss.png differ diff --git a/tests/cpp-tests/Resources/Sprite3DTest/caustics.png b/tests/cpp-tests/Resources/Sprite3DTest/caustics.png index 84a086c19cbd..179f30dbc774 100644 Binary files a/tests/cpp-tests/Resources/Sprite3DTest/caustics.png and b/tests/cpp-tests/Resources/Sprite3DTest/caustics.png differ diff --git a/tests/cpp-tests/Resources/Sprite3DTest/circle.png b/tests/cpp-tests/Resources/Sprite3DTest/circle.png index e7d8f0928123..fb1e8d592ae4 100644 Binary files a/tests/cpp-tests/Resources/Sprite3DTest/circle.png and b/tests/cpp-tests/Resources/Sprite3DTest/circle.png differ diff --git a/tests/cpp-tests/Resources/Sprite3DTest/dragon.png b/tests/cpp-tests/Resources/Sprite3DTest/dragon.png index ee6a6e943ecf..0542b67ac383 100644 Binary files a/tests/cpp-tests/Resources/Sprite3DTest/dragon.png and b/tests/cpp-tests/Resources/Sprite3DTest/dragon.png differ diff --git a/tests/cpp-tests/Resources/Sprite3DTest/plane.png b/tests/cpp-tests/Resources/Sprite3DTest/plane.png index 37917bf93556..ac7c566c429e 100644 Binary files a/tests/cpp-tests/Resources/Sprite3DTest/plane.png and b/tests/cpp-tests/Resources/Sprite3DTest/plane.png differ diff --git a/tests/cpp-tests/Resources/Sprite3DTest/shadowCircle.png b/tests/cpp-tests/Resources/Sprite3DTest/shadowCircle.png index 77d1b5655f55..6442db45734c 100644 Binary files a/tests/cpp-tests/Resources/Sprite3DTest/shadowCircle.png and b/tests/cpp-tests/Resources/Sprite3DTest/shadowCircle.png differ diff --git a/tests/cpp-tests/Resources/Sprite3DTest/spheretex.png b/tests/cpp-tests/Resources/Sprite3DTest/spheretex.png index e5161cb6f1c3..94eed4b1dda4 100644 Binary files a/tests/cpp-tests/Resources/Sprite3DTest/spheretex.png and b/tests/cpp-tests/Resources/Sprite3DTest/spheretex.png differ diff --git a/tests/cpp-tests/Resources/Sprite3DTest/teapot.png b/tests/cpp-tests/Resources/Sprite3DTest/teapot.png index af66cad51f23..65c3aae6b836 100644 Binary files a/tests/cpp-tests/Resources/Sprite3DTest/teapot.png and b/tests/cpp-tests/Resources/Sprite3DTest/teapot.png differ diff --git a/tests/cpp-tests/Resources/Sprite3DTest/texture.png b/tests/cpp-tests/Resources/Sprite3DTest/texture.png index 7427be020707..c4ceacc87b90 100644 Binary files a/tests/cpp-tests/Resources/Sprite3DTest/texture.png and b/tests/cpp-tests/Resources/Sprite3DTest/texture.png differ diff --git a/tests/cpp-tests/Resources/Sprite3DTest/tortoise.png b/tests/cpp-tests/Resources/Sprite3DTest/tortoise.png index 1c6886f6cb64..7c12336ae2ca 100644 Binary files a/tests/cpp-tests/Resources/Sprite3DTest/tortoise.png and b/tests/cpp-tests/Resources/Sprite3DTest/tortoise.png differ diff --git a/tests/cpp-tests/Resources/TerrainTest/Lightmap.png b/tests/cpp-tests/Resources/TerrainTest/Lightmap.png old mode 100644 new mode 100755 index 9f953c661992..673b6f88c1c9 Binary files a/tests/cpp-tests/Resources/TerrainTest/Lightmap.png and b/tests/cpp-tests/Resources/TerrainTest/Lightmap.png differ diff --git a/tests/cpp-tests/Resources/TerrainTest/alphamap.png b/tests/cpp-tests/Resources/TerrainTest/alphamap.png index a4fbed064719..70c9dab4f54a 100644 Binary files a/tests/cpp-tests/Resources/TerrainTest/alphamap.png and b/tests/cpp-tests/Resources/TerrainTest/alphamap.png differ diff --git a/tests/cpp-tests/Resources/TerrainTest/road.png b/tests/cpp-tests/Resources/TerrainTest/road.png index 72c07d4aac60..be03098b4358 100644 Binary files a/tests/cpp-tests/Resources/TerrainTest/road.png and b/tests/cpp-tests/Resources/TerrainTest/road.png differ diff --git a/tests/cpp-tests/Resources/TileMaps/fixed-ortho-test2.png b/tests/cpp-tests/Resources/TileMaps/fixed-ortho-test2.png index 0fb810de8e9a..99668bad5eac 100644 Binary files a/tests/cpp-tests/Resources/TileMaps/fixed-ortho-test2.png and b/tests/cpp-tests/Resources/TileMaps/fixed-ortho-test2.png differ diff --git a/tests/cpp-tests/Resources/TileMaps/grass.png b/tests/cpp-tests/Resources/TileMaps/grass.png index 37590f203eb8..adb1ffbc1bb7 100644 Binary files a/tests/cpp-tests/Resources/TileMaps/grass.png and b/tests/cpp-tests/Resources/TileMaps/grass.png differ diff --git a/tests/cpp-tests/Resources/TileMaps/grass01.png b/tests/cpp-tests/Resources/TileMaps/grass01.png index 5fffef7582aa..748e3c9540e3 100644 Binary files a/tests/cpp-tests/Resources/TileMaps/grass01.png and b/tests/cpp-tests/Resources/TileMaps/grass01.png differ diff --git a/tests/cpp-tests/Resources/TileMaps/hexa-axis-x.png b/tests/cpp-tests/Resources/TileMaps/hexa-axis-x.png index 848efde22788..63c52593cff5 100644 Binary files a/tests/cpp-tests/Resources/TileMaps/hexa-axis-x.png and b/tests/cpp-tests/Resources/TileMaps/hexa-axis-x.png differ diff --git a/tests/cpp-tests/Resources/TileMaps/hexa-tiles.png b/tests/cpp-tests/Resources/TileMaps/hexa-tiles.png index 440ac6dcb42c..67b1f4a471f5 100644 Binary files a/tests/cpp-tests/Resources/TileMaps/hexa-tiles.png and b/tests/cpp-tests/Resources/TileMaps/hexa-tiles.png differ diff --git a/tests/cpp-tests/Resources/TileMaps/hexmini.png b/tests/cpp-tests/Resources/TileMaps/hexmini.png index f8f7613aaf5a..12d17bf0729f 100644 Binary files a/tests/cpp-tests/Resources/TileMaps/hexmini.png and b/tests/cpp-tests/Resources/TileMaps/hexmini.png differ diff --git a/tests/cpp-tests/Resources/TileMaps/iso-test.png b/tests/cpp-tests/Resources/TileMaps/iso-test.png index a624e4e2575e..00e694810e99 100644 Binary files a/tests/cpp-tests/Resources/TileMaps/iso-test.png and b/tests/cpp-tests/Resources/TileMaps/iso-test.png differ diff --git a/tests/cpp-tests/Resources/TileMaps/iso-test2.png b/tests/cpp-tests/Resources/TileMaps/iso-test2.png index d13bb5f44bb4..8668e0fe20c1 100644 Binary files a/tests/cpp-tests/Resources/TileMaps/iso-test2.png and b/tests/cpp-tests/Resources/TileMaps/iso-test2.png differ diff --git a/tests/cpp-tests/Resources/TileMaps/iso.png b/tests/cpp-tests/Resources/TileMaps/iso.png index 65e5fa7f1453..7658946a4517 100644 Binary files a/tests/cpp-tests/Resources/TileMaps/iso.png and b/tests/cpp-tests/Resources/TileMaps/iso.png differ diff --git a/tests/cpp-tests/Resources/TileMaps/issue_16512.png b/tests/cpp-tests/Resources/TileMaps/issue_16512.png index c912b90c468e..32e82ae46dfe 100644 Binary files a/tests/cpp-tests/Resources/TileMaps/issue_16512.png and b/tests/cpp-tests/Resources/TileMaps/issue_16512.png differ diff --git a/tests/cpp-tests/Resources/TileMaps/ortho-test1.png b/tests/cpp-tests/Resources/TileMaps/ortho-test1.png index b3a6394efa69..cc8dd1d0d875 100644 Binary files a/tests/cpp-tests/Resources/TileMaps/ortho-test1.png and b/tests/cpp-tests/Resources/TileMaps/ortho-test1.png differ diff --git a/tests/cpp-tests/Resources/TileMaps/ortho-test1_bw.png b/tests/cpp-tests/Resources/TileMaps/ortho-test1_bw.png index da5f258a83c2..a648cdbe1a06 100644 Binary files a/tests/cpp-tests/Resources/TileMaps/ortho-test1_bw.png and b/tests/cpp-tests/Resources/TileMaps/ortho-test1_bw.png differ diff --git a/tests/cpp-tests/Resources/TileMaps/ortho-test2.png b/tests/cpp-tests/Resources/TileMaps/ortho-test2.png index c24000ed717c..2fb43c6e1cd1 100644 Binary files a/tests/cpp-tests/Resources/TileMaps/ortho-test2.png and b/tests/cpp-tests/Resources/TileMaps/ortho-test2.png differ diff --git a/tests/cpp-tests/Resources/TileMaps/tile_animation_test.tmx b/tests/cpp-tests/Resources/TileMaps/tile_animation_test.tmx new file mode 100644 index 000000000000..195f74a5437f --- /dev/null +++ b/tests/cpp-tests/Resources/TileMaps/tile_animation_test.tmx @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + eJyTY2BgkBvFgwYDAEFHC7k= + + + + + eJxjYCAeMBLAtFI3kgAAHeAAGQ== + + + + + eJxjYBg+gIkAppU6agIAHDAAMQ== + + + diff --git a/tests/cpp-tests/Resources/TileMaps/tile_iso_offset.png b/tests/cpp-tests/Resources/TileMaps/tile_iso_offset.png index 471aa0a59932..537ec4c9faf5 100644 Binary files a/tests/cpp-tests/Resources/TileMaps/tile_iso_offset.png and b/tests/cpp-tests/Resources/TileMaps/tile_iso_offset.png differ diff --git a/tests/cpp-tests/Resources/TileMaps/tiles-hd.png b/tests/cpp-tests/Resources/TileMaps/tiles-hd.png index ca84a261c8bc..08cdb0f1e486 100644 Binary files a/tests/cpp-tests/Resources/TileMaps/tiles-hd.png and b/tests/cpp-tests/Resources/TileMaps/tiles-hd.png differ diff --git a/tests/cpp-tests/Resources/TileMaps/tiles.png b/tests/cpp-tests/Resources/TileMaps/tiles.png index eee01c52652e..2929ba43025e 100644 Binary files a/tests/cpp-tests/Resources/TileMaps/tiles.png and b/tests/cpp-tests/Resources/TileMaps/tiles.png differ diff --git a/tests/cpp-tests/Resources/TileMaps/tmw_desert_spacing-hd.png b/tests/cpp-tests/Resources/TileMaps/tmw_desert_spacing-hd.png index 16d08a8888d9..ab9f840faed9 100644 Binary files a/tests/cpp-tests/Resources/TileMaps/tmw_desert_spacing-hd.png and b/tests/cpp-tests/Resources/TileMaps/tmw_desert_spacing-hd.png differ diff --git a/tests/cpp-tests/Resources/TileMaps/tmw_desert_spacing.png b/tests/cpp-tests/Resources/TileMaps/tmw_desert_spacing.png index 4c4ff412d9db..8e23c6d345cd 100644 Binary files a/tests/cpp-tests/Resources/TileMaps/tmw_desert_spacing.png and b/tests/cpp-tests/Resources/TileMaps/tmw_desert_spacing.png differ diff --git a/tests/cpp-tests/Resources/animations/crystals.png b/tests/cpp-tests/Resources/animations/crystals.png index 77658a491426..2c0a41da0118 100644 Binary files a/tests/cpp-tests/Resources/animations/crystals.png and b/tests/cpp-tests/Resources/animations/crystals.png differ diff --git a/tests/cpp-tests/Resources/animations/dragon_animation-hd.png b/tests/cpp-tests/Resources/animations/dragon_animation-hd.png index 67915c1273b4..8fbe949c1f00 100644 Binary files a/tests/cpp-tests/Resources/animations/dragon_animation-hd.png and b/tests/cpp-tests/Resources/animations/dragon_animation-hd.png differ diff --git a/tests/cpp-tests/Resources/animations/dragon_animation.png b/tests/cpp-tests/Resources/animations/dragon_animation.png old mode 100644 new mode 100755 index 1907dba95b60..4d2a65cdc966 Binary files a/tests/cpp-tests/Resources/animations/dragon_animation.png and b/tests/cpp-tests/Resources/animations/dragon_animation.png differ diff --git a/tests/cpp-tests/Resources/animations/ghosts.png b/tests/cpp-tests/Resources/animations/ghosts.png old mode 100644 new mode 100755 index 3f515f65f71e..ad067dd1e082 Binary files a/tests/cpp-tests/Resources/animations/ghosts.png and b/tests/cpp-tests/Resources/animations/ghosts.png differ diff --git a/tests/cpp-tests/Resources/animations/grossini-aliases.png b/tests/cpp-tests/Resources/animations/grossini-aliases.png old mode 100644 new mode 100755 index 00596acb796b..5672efb11950 Binary files a/tests/cpp-tests/Resources/animations/grossini-aliases.png and b/tests/cpp-tests/Resources/animations/grossini-aliases.png differ diff --git a/tests/cpp-tests/Resources/animations/grossini.png b/tests/cpp-tests/Resources/animations/grossini.png old mode 100644 new mode 100755 index 4fbd9d9cca86..609e7804f6f2 Binary files a/tests/cpp-tests/Resources/animations/grossini.png and b/tests/cpp-tests/Resources/animations/grossini.png differ diff --git a/tests/cpp-tests/Resources/animations/grossini_anchors.png b/tests/cpp-tests/Resources/animations/grossini_anchors.png index 71d6c30bfd14..73c58de05ff8 100644 Binary files a/tests/cpp-tests/Resources/animations/grossini_anchors.png and b/tests/cpp-tests/Resources/animations/grossini_anchors.png differ diff --git a/tests/cpp-tests/Resources/animations/grossini_blue.png b/tests/cpp-tests/Resources/animations/grossini_blue.png old mode 100644 new mode 100755 index e480ca7b80ca..a29fc6441d76 Binary files a/tests/cpp-tests/Resources/animations/grossini_blue.png and b/tests/cpp-tests/Resources/animations/grossini_blue.png differ diff --git a/tests/cpp-tests/Resources/animations/grossini_dance_poly.png b/tests/cpp-tests/Resources/animations/grossini_dance_poly.png index 3ed6ae690d35..3d699ae3e83b 100644 Binary files a/tests/cpp-tests/Resources/animations/grossini_dance_poly.png and b/tests/cpp-tests/Resources/animations/grossini_dance_poly.png differ diff --git a/tests/cpp-tests/Resources/animations/grossini_family.png b/tests/cpp-tests/Resources/animations/grossini_family.png old mode 100644 new mode 100755 index b979302c1a45..acc73dc2c8b7 Binary files a/tests/cpp-tests/Resources/animations/grossini_family.png and b/tests/cpp-tests/Resources/animations/grossini_family.png differ diff --git a/tests/cpp-tests/Resources/animations/grossini_gray.png b/tests/cpp-tests/Resources/animations/grossini_gray.png old mode 100644 new mode 100755 index 3216e7f1c831..1a9ff597ed9d Binary files a/tests/cpp-tests/Resources/animations/grossini_gray.png and b/tests/cpp-tests/Resources/animations/grossini_gray.png differ diff --git a/tests/cpp-tests/Resources/animations/grossini_polygon.png b/tests/cpp-tests/Resources/animations/grossini_polygon.png index aeaf1ebd8a95..d8225431c0b6 100644 Binary files a/tests/cpp-tests/Resources/animations/grossini_polygon.png and b/tests/cpp-tests/Resources/animations/grossini_polygon.png differ diff --git a/tests/cpp-tests/Resources/animations/tcc_issue_1.png b/tests/cpp-tests/Resources/animations/tcc_issue_1.png index 467a64bf5c7c..1e5c2a9998c5 100644 Binary files a/tests/cpp-tests/Resources/animations/tcc_issue_1.png and b/tests/cpp-tests/Resources/animations/tcc_issue_1.png differ diff --git a/tests/cpp-tests/Resources/animations/tcc_issue_2.png b/tests/cpp-tests/Resources/animations/tcc_issue_2.png index af560501f86c..efbe1e09e2a4 100644 Binary files a/tests/cpp-tests/Resources/animations/tcc_issue_2.png and b/tests/cpp-tests/Resources/animations/tcc_issue_2.png differ diff --git a/tests/cpp-tests/Resources/ccb/animated-grossini.png b/tests/cpp-tests/Resources/ccb/animated-grossini.png old mode 100644 new mode 100755 index 7cda495513e4..89736acdaba8 Binary files a/tests/cpp-tests/Resources/ccb/animated-grossini.png and b/tests/cpp-tests/Resources/ccb/animated-grossini.png differ diff --git a/tests/cpp-tests/Resources/ccb/btn-a-0.png b/tests/cpp-tests/Resources/ccb/btn-a-0.png old mode 100644 new mode 100755 index ff15dce92c31..66a5d3df7185 Binary files a/tests/cpp-tests/Resources/ccb/btn-a-0.png and b/tests/cpp-tests/Resources/ccb/btn-a-0.png differ diff --git a/tests/cpp-tests/Resources/ccb/btn-a-1.png b/tests/cpp-tests/Resources/ccb/btn-a-1.png old mode 100644 new mode 100755 index 2ed866b6dce1..33f8a0c3f041 Binary files a/tests/cpp-tests/Resources/ccb/btn-a-1.png and b/tests/cpp-tests/Resources/ccb/btn-a-1.png differ diff --git a/tests/cpp-tests/Resources/ccb/btn-a-2.png b/tests/cpp-tests/Resources/ccb/btn-a-2.png old mode 100644 new mode 100755 index de762f2af9bf..c8532b3e23ae Binary files a/tests/cpp-tests/Resources/ccb/btn-a-2.png and b/tests/cpp-tests/Resources/ccb/btn-a-2.png differ diff --git a/tests/cpp-tests/Resources/ccb/btn-b-0.png b/tests/cpp-tests/Resources/ccb/btn-b-0.png old mode 100644 new mode 100755 index a9442a70466d..abd7d9a00b03 Binary files a/tests/cpp-tests/Resources/ccb/btn-b-0.png and b/tests/cpp-tests/Resources/ccb/btn-b-0.png differ diff --git a/tests/cpp-tests/Resources/ccb/btn-b-1.png b/tests/cpp-tests/Resources/ccb/btn-b-1.png old mode 100644 new mode 100755 index 0e850dbc499b..b55f91e77c04 Binary files a/tests/cpp-tests/Resources/ccb/btn-b-1.png and b/tests/cpp-tests/Resources/ccb/btn-b-1.png differ diff --git a/tests/cpp-tests/Resources/ccb/btn-b-2.png b/tests/cpp-tests/Resources/ccb/btn-b-2.png old mode 100644 new mode 100755 index a9fa96708d10..d47c7b6283e6 Binary files a/tests/cpp-tests/Resources/ccb/btn-b-2.png and b/tests/cpp-tests/Resources/ccb/btn-b-2.png differ diff --git a/tests/cpp-tests/Resources/ccb/btn-back-0.png b/tests/cpp-tests/Resources/ccb/btn-back-0.png old mode 100644 new mode 100755 index 2101c3153134..9caae52746ff Binary files a/tests/cpp-tests/Resources/ccb/btn-back-0.png and b/tests/cpp-tests/Resources/ccb/btn-back-0.png differ diff --git a/tests/cpp-tests/Resources/ccb/btn-back-1.png b/tests/cpp-tests/Resources/ccb/btn-back-1.png old mode 100644 new mode 100755 index 2c1464b0de07..6c7cf5f97a9e Binary files a/tests/cpp-tests/Resources/ccb/btn-back-1.png and b/tests/cpp-tests/Resources/ccb/btn-back-1.png differ diff --git a/tests/cpp-tests/Resources/ccb/btn-test-0.png b/tests/cpp-tests/Resources/ccb/btn-test-0.png old mode 100644 new mode 100755 index 2b916c06c1fe..2777fd1d5ecc Binary files a/tests/cpp-tests/Resources/ccb/btn-test-0.png and b/tests/cpp-tests/Resources/ccb/btn-test-0.png differ diff --git a/tests/cpp-tests/Resources/ccb/btn-test-1.png b/tests/cpp-tests/Resources/ccb/btn-test-1.png old mode 100644 new mode 100755 index ebf3ce40f829..b3be2a861637 Binary files a/tests/cpp-tests/Resources/ccb/btn-test-1.png and b/tests/cpp-tests/Resources/ccb/btn-test-1.png differ diff --git a/tests/cpp-tests/Resources/ccb/btn-test-2.png b/tests/cpp-tests/Resources/ccb/btn-test-2.png old mode 100644 new mode 100755 index bd606267168c..eab72947de72 Binary files a/tests/cpp-tests/Resources/ccb/btn-test-2.png and b/tests/cpp-tests/Resources/ccb/btn-test-2.png differ diff --git a/tests/cpp-tests/Resources/ccb/burst.png b/tests/cpp-tests/Resources/ccb/burst.png old mode 100644 new mode 100755 index 448f5f46c7c3..8681474538f4 Binary files a/tests/cpp-tests/Resources/ccb/burst.png and b/tests/cpp-tests/Resources/ccb/burst.png differ diff --git a/tests/cpp-tests/Resources/ccb/ccbParticleStars.png b/tests/cpp-tests/Resources/ccb/ccbParticleStars.png old mode 100644 new mode 100755 index df7e1145cd47..f493dcc33470 Binary files a/tests/cpp-tests/Resources/ccb/ccbParticleStars.png and b/tests/cpp-tests/Resources/ccb/ccbParticleStars.png differ diff --git a/tests/cpp-tests/Resources/ccb/grossini-generic.png b/tests/cpp-tests/Resources/ccb/grossini-generic.png old mode 100644 new mode 100755 index 65c5287371f5..5c0bbc67c854 Binary files a/tests/cpp-tests/Resources/ccb/grossini-generic.png and b/tests/cpp-tests/Resources/ccb/grossini-generic.png differ diff --git a/tests/cpp-tests/Resources/ccb/jungle-left.png b/tests/cpp-tests/Resources/ccb/jungle-left.png old mode 100644 new mode 100755 index 68dbe20a2e63..79bbf2033432 Binary files a/tests/cpp-tests/Resources/ccb/jungle-left.png and b/tests/cpp-tests/Resources/ccb/jungle-left.png differ diff --git a/tests/cpp-tests/Resources/ccb/jungle-right.png b/tests/cpp-tests/Resources/ccb/jungle-right.png old mode 100644 new mode 100755 index b73d837214cd..8da61b9f5861 Binary files a/tests/cpp-tests/Resources/ccb/jungle-right.png and b/tests/cpp-tests/Resources/ccb/jungle-right.png differ diff --git a/tests/cpp-tests/Resources/ccb/jungle.png b/tests/cpp-tests/Resources/ccb/jungle.png old mode 100644 new mode 100755 index 781ee4149d76..b3ddd92d2b09 Binary files a/tests/cpp-tests/Resources/ccb/jungle.png and b/tests/cpp-tests/Resources/ccb/jungle.png differ diff --git a/tests/cpp-tests/Resources/ccb/logo-icon.png b/tests/cpp-tests/Resources/ccb/logo-icon.png old mode 100644 new mode 100755 index a3b64cdac9bb..c668736dc74d Binary files a/tests/cpp-tests/Resources/ccb/logo-icon.png and b/tests/cpp-tests/Resources/ccb/logo-icon.png differ diff --git a/tests/cpp-tests/Resources/ccb/logo.png b/tests/cpp-tests/Resources/ccb/logo.png old mode 100644 new mode 100755 index b18bc2d72640..a4cd20c20e8f Binary files a/tests/cpp-tests/Resources/ccb/logo.png and b/tests/cpp-tests/Resources/ccb/logo.png differ diff --git a/tests/cpp-tests/Resources/ccb/markerfelt24shadow.png b/tests/cpp-tests/Resources/ccb/markerfelt24shadow.png old mode 100644 new mode 100755 index 9a617ba349db..5bab02849644 Binary files a/tests/cpp-tests/Resources/ccb/markerfelt24shadow.png and b/tests/cpp-tests/Resources/ccb/markerfelt24shadow.png differ diff --git a/tests/cpp-tests/Resources/ccb/particle-fire.png b/tests/cpp-tests/Resources/ccb/particle-fire.png old mode 100644 new mode 100755 index 84a1660c47f7..81c6d2410bb2 Binary files a/tests/cpp-tests/Resources/ccb/particle-fire.png and b/tests/cpp-tests/Resources/ccb/particle-fire.png differ diff --git a/tests/cpp-tests/Resources/ccb/particle-smoke.png b/tests/cpp-tests/Resources/ccb/particle-smoke.png old mode 100644 new mode 100755 index 2e68ea2f391c..a289b1371e29 Binary files a/tests/cpp-tests/Resources/ccb/particle-smoke.png and b/tests/cpp-tests/Resources/ccb/particle-smoke.png differ diff --git a/tests/cpp-tests/Resources/ccb/particle-snow.png b/tests/cpp-tests/Resources/ccb/particle-snow.png old mode 100644 new mode 100755 index 0c7ffb3034fc..9e12963498d7 Binary files a/tests/cpp-tests/Resources/ccb/particle-snow.png and b/tests/cpp-tests/Resources/ccb/particle-snow.png differ diff --git a/tests/cpp-tests/Resources/ccb/particle-stars.png b/tests/cpp-tests/Resources/ccb/particle-stars.png old mode 100644 new mode 100755 index df7e1145cd47..f493dcc33470 Binary files a/tests/cpp-tests/Resources/ccb/particle-stars.png and b/tests/cpp-tests/Resources/ccb/particle-stars.png differ diff --git a/tests/cpp-tests/Resources/ccb/scale-9-demo.png b/tests/cpp-tests/Resources/ccb/scale-9-demo.png old mode 100644 new mode 100755 index 8b90e1ab3935..ee4537207f1b Binary files a/tests/cpp-tests/Resources/ccb/scale-9-demo.png and b/tests/cpp-tests/Resources/ccb/scale-9-demo.png differ diff --git a/tests/cpp-tests/Resources/components/Player.png b/tests/cpp-tests/Resources/components/Player.png old mode 100644 new mode 100755 index 974f1a6887b3..77d4470de05b Binary files a/tests/cpp-tests/Resources/components/Player.png and b/tests/cpp-tests/Resources/components/Player.png differ diff --git a/tests/cpp-tests/Resources/components/Projectile.png b/tests/cpp-tests/Resources/components/Projectile.png old mode 100644 new mode 100755 index 243cd6a350cb..548fe432933f Binary files a/tests/cpp-tests/Resources/components/Projectile.png and b/tests/cpp-tests/Resources/components/Projectile.png differ diff --git a/tests/cpp-tests/Resources/components/Target.png b/tests/cpp-tests/Resources/components/Target.png old mode 100644 new mode 100755 index 0f39cf9c477d..22906f3c02e8 Binary files a/tests/cpp-tests/Resources/components/Target.png and b/tests/cpp-tests/Resources/components/Target.png differ diff --git a/tests/cpp-tests/Resources/extensions/CCControlColourPickerSpriteSheet.png b/tests/cpp-tests/Resources/extensions/CCControlColourPickerSpriteSheet.png old mode 100644 new mode 100755 index a73e8692c6b1..c49479ffaa00 Binary files a/tests/cpp-tests/Resources/extensions/CCControlColourPickerSpriteSheet.png and b/tests/cpp-tests/Resources/extensions/CCControlColourPickerSpriteSheet.png differ diff --git a/tests/cpp-tests/Resources/extensions/background.png b/tests/cpp-tests/Resources/extensions/background.png old mode 100644 new mode 100755 index b55ef8539230..500d95937f3f Binary files a/tests/cpp-tests/Resources/extensions/background.png and b/tests/cpp-tests/Resources/extensions/background.png differ diff --git a/tests/cpp-tests/Resources/extensions/button.png b/tests/cpp-tests/Resources/extensions/button.png old mode 100644 new mode 100755 index 2b2e9f905c33..816cf6e36ca9 Binary files a/tests/cpp-tests/Resources/extensions/button.png and b/tests/cpp-tests/Resources/extensions/button.png differ diff --git a/tests/cpp-tests/Resources/extensions/buttonBackground.png b/tests/cpp-tests/Resources/extensions/buttonBackground.png old mode 100644 new mode 100755 index 7116ce0ab5a7..a46706102bf8 Binary files a/tests/cpp-tests/Resources/extensions/buttonBackground.png and b/tests/cpp-tests/Resources/extensions/buttonBackground.png differ diff --git a/tests/cpp-tests/Resources/extensions/buttonHighlighted.png b/tests/cpp-tests/Resources/extensions/buttonHighlighted.png old mode 100644 new mode 100755 index 2d47d226ad96..f2073e86d262 Binary files a/tests/cpp-tests/Resources/extensions/buttonHighlighted.png and b/tests/cpp-tests/Resources/extensions/buttonHighlighted.png differ diff --git a/tests/cpp-tests/Resources/extensions/green_edit.png b/tests/cpp-tests/Resources/extensions/green_edit.png old mode 100644 new mode 100755 index e5a83e5bcda2..f3b22a4adc69 Binary files a/tests/cpp-tests/Resources/extensions/green_edit.png and b/tests/cpp-tests/Resources/extensions/green_edit.png differ diff --git a/tests/cpp-tests/Resources/extensions/orange_edit.png b/tests/cpp-tests/Resources/extensions/orange_edit.png old mode 100644 new mode 100755 index 7c7ab85c5b53..e1f7c30f7457 Binary files a/tests/cpp-tests/Resources/extensions/orange_edit.png and b/tests/cpp-tests/Resources/extensions/orange_edit.png differ diff --git a/tests/cpp-tests/Resources/extensions/potentiometerButton.png b/tests/cpp-tests/Resources/extensions/potentiometerButton.png old mode 100644 new mode 100755 index 3826b5a437f8..fb76d094d594 Binary files a/tests/cpp-tests/Resources/extensions/potentiometerButton.png and b/tests/cpp-tests/Resources/extensions/potentiometerButton.png differ diff --git a/tests/cpp-tests/Resources/extensions/potentiometerProgress.png b/tests/cpp-tests/Resources/extensions/potentiometerProgress.png old mode 100644 new mode 100755 index ef2c21a4a90e..6bd8b32636f8 Binary files a/tests/cpp-tests/Resources/extensions/potentiometerProgress.png and b/tests/cpp-tests/Resources/extensions/potentiometerProgress.png differ diff --git a/tests/cpp-tests/Resources/extensions/potentiometerTrack.png b/tests/cpp-tests/Resources/extensions/potentiometerTrack.png old mode 100644 new mode 100755 index ffd450027766..445c3ba65799 Binary files a/tests/cpp-tests/Resources/extensions/potentiometerTrack.png and b/tests/cpp-tests/Resources/extensions/potentiometerTrack.png differ diff --git a/tests/cpp-tests/Resources/extensions/ribbon.png b/tests/cpp-tests/Resources/extensions/ribbon.png old mode 100644 new mode 100755 index ed8ee0adcd00..b80fb9444419 Binary files a/tests/cpp-tests/Resources/extensions/ribbon.png and b/tests/cpp-tests/Resources/extensions/ribbon.png differ diff --git a/tests/cpp-tests/Resources/extensions/sliderProgress.png b/tests/cpp-tests/Resources/extensions/sliderProgress.png old mode 100644 new mode 100755 index f7ebe721a1c9..81d517307d7e Binary files a/tests/cpp-tests/Resources/extensions/sliderProgress.png and b/tests/cpp-tests/Resources/extensions/sliderProgress.png differ diff --git a/tests/cpp-tests/Resources/extensions/sliderProgress2.png b/tests/cpp-tests/Resources/extensions/sliderProgress2.png old mode 100644 new mode 100755 index 84170a12e191..3b8794e38c0f Binary files a/tests/cpp-tests/Resources/extensions/sliderProgress2.png and b/tests/cpp-tests/Resources/extensions/sliderProgress2.png differ diff --git a/tests/cpp-tests/Resources/extensions/sliderThumb.png b/tests/cpp-tests/Resources/extensions/sliderThumb.png old mode 100644 new mode 100755 index c30b3baa071f..901803d70fb6 Binary files a/tests/cpp-tests/Resources/extensions/sliderThumb.png and b/tests/cpp-tests/Resources/extensions/sliderThumb.png differ diff --git a/tests/cpp-tests/Resources/extensions/sliderTrack.png b/tests/cpp-tests/Resources/extensions/sliderTrack.png old mode 100644 new mode 100755 index aa28072e2616..59b8dc91b11c Binary files a/tests/cpp-tests/Resources/extensions/sliderTrack.png and b/tests/cpp-tests/Resources/extensions/sliderTrack.png differ diff --git a/tests/cpp-tests/Resources/extensions/sliderTrack2.png b/tests/cpp-tests/Resources/extensions/sliderTrack2.png old mode 100644 new mode 100755 index 505e7b111390..dbc3173b872b Binary files a/tests/cpp-tests/Resources/extensions/sliderTrack2.png and b/tests/cpp-tests/Resources/extensions/sliderTrack2.png differ diff --git a/tests/cpp-tests/Resources/extensions/stepper-minus.png b/tests/cpp-tests/Resources/extensions/stepper-minus.png old mode 100644 new mode 100755 index 2c5d5d085813..bae9cb4725f4 Binary files a/tests/cpp-tests/Resources/extensions/stepper-minus.png and b/tests/cpp-tests/Resources/extensions/stepper-minus.png differ diff --git a/tests/cpp-tests/Resources/extensions/stepper-plus.png b/tests/cpp-tests/Resources/extensions/stepper-plus.png old mode 100644 new mode 100755 index 55de127ee52a..82b0673077e9 Binary files a/tests/cpp-tests/Resources/extensions/stepper-plus.png and b/tests/cpp-tests/Resources/extensions/stepper-plus.png differ diff --git a/tests/cpp-tests/Resources/extensions/switch-mask.png b/tests/cpp-tests/Resources/extensions/switch-mask.png old mode 100644 new mode 100755 index 03b241419684..fc49f947d734 Binary files a/tests/cpp-tests/Resources/extensions/switch-mask.png and b/tests/cpp-tests/Resources/extensions/switch-mask.png differ diff --git a/tests/cpp-tests/Resources/extensions/switch-off.png b/tests/cpp-tests/Resources/extensions/switch-off.png old mode 100644 new mode 100755 index 6b88e5fb4dad..ec2992a4247a Binary files a/tests/cpp-tests/Resources/extensions/switch-off.png and b/tests/cpp-tests/Resources/extensions/switch-off.png differ diff --git a/tests/cpp-tests/Resources/extensions/switch-on.png b/tests/cpp-tests/Resources/extensions/switch-on.png old mode 100644 new mode 100755 index ce0f22b99224..2d8acc00e31e Binary files a/tests/cpp-tests/Resources/extensions/switch-on.png and b/tests/cpp-tests/Resources/extensions/switch-on.png differ diff --git a/tests/cpp-tests/Resources/extensions/switch-thumb.png b/tests/cpp-tests/Resources/extensions/switch-thumb.png old mode 100644 new mode 100755 index 29abab0dccd0..a7363e5ac36b Binary files a/tests/cpp-tests/Resources/extensions/switch-thumb.png and b/tests/cpp-tests/Resources/extensions/switch-thumb.png differ diff --git a/tests/cpp-tests/Resources/extensions/yellow_edit.png b/tests/cpp-tests/Resources/extensions/yellow_edit.png old mode 100644 new mode 100755 index bb8f3120271e..f9dc6b114d71 Binary files a/tests/cpp-tests/Resources/extensions/yellow_edit.png and b/tests/cpp-tests/Resources/extensions/yellow_edit.png differ diff --git a/tests/cpp-tests/Resources/fonts/Roboto.bmf_0.png b/tests/cpp-tests/Resources/fonts/Roboto.bmf_0.png old mode 100644 new mode 100755 index 6d19a9d06992..ddf50bdd13db Binary files a/tests/cpp-tests/Resources/fonts/Roboto.bmf_0.png and b/tests/cpp-tests/Resources/fonts/Roboto.bmf_0.png differ diff --git a/tests/cpp-tests/Resources/fonts/arial-26-en-ru_0.png b/tests/cpp-tests/Resources/fonts/arial-26-en-ru_0.png old mode 100644 new mode 100755 index af41f14059ce..6bba537945f3 Binary files a/tests/cpp-tests/Resources/fonts/arial-26-en-ru_0.png and b/tests/cpp-tests/Resources/fonts/arial-26-en-ru_0.png differ diff --git a/tests/cpp-tests/Resources/fonts/arial-unicode-26.png b/tests/cpp-tests/Resources/fonts/arial-unicode-26.png old mode 100644 new mode 100755 index b4b433ec07a4..c2eabd7cd8b6 Binary files a/tests/cpp-tests/Resources/fonts/arial-unicode-26.png and b/tests/cpp-tests/Resources/fonts/arial-unicode-26.png differ diff --git a/tests/cpp-tests/Resources/fonts/arial16.png b/tests/cpp-tests/Resources/fonts/arial16.png old mode 100644 new mode 100755 index c6d00cc953ed..9bba8ea89177 Binary files a/tests/cpp-tests/Resources/fonts/arial16.png and b/tests/cpp-tests/Resources/fonts/arial16.png differ diff --git a/tests/cpp-tests/Resources/fonts/bitmapFontChinese.png b/tests/cpp-tests/Resources/fonts/bitmapFontChinese.png old mode 100644 new mode 100755 index 3829b16da8cc..9d2adf428a20 Binary files a/tests/cpp-tests/Resources/fonts/bitmapFontChinese.png and b/tests/cpp-tests/Resources/fonts/bitmapFontChinese.png differ diff --git a/tests/cpp-tests/Resources/fonts/bitmapFontTest.png b/tests/cpp-tests/Resources/fonts/bitmapFontTest.png old mode 100644 new mode 100755 index 9eb412b87242..112328fdb03b Binary files a/tests/cpp-tests/Resources/fonts/bitmapFontTest.png and b/tests/cpp-tests/Resources/fonts/bitmapFontTest.png differ diff --git a/tests/cpp-tests/Resources/fonts/bitmapFontTest2.png b/tests/cpp-tests/Resources/fonts/bitmapFontTest2.png old mode 100644 new mode 100755 index a37503a8416a..9975e4961272 Binary files a/tests/cpp-tests/Resources/fonts/bitmapFontTest2.png and b/tests/cpp-tests/Resources/fonts/bitmapFontTest2.png differ diff --git a/tests/cpp-tests/Resources/fonts/bitmapFontTest3.png b/tests/cpp-tests/Resources/fonts/bitmapFontTest3.png old mode 100644 new mode 100755 index a49e9117af77..d19379f5e776 Binary files a/tests/cpp-tests/Resources/fonts/bitmapFontTest3.png and b/tests/cpp-tests/Resources/fonts/bitmapFontTest3.png differ diff --git a/tests/cpp-tests/Resources/fonts/bitmapFontTest4.png b/tests/cpp-tests/Resources/fonts/bitmapFontTest4.png old mode 100644 new mode 100755 index 3b181fb2bcf1..93dacc080684 Binary files a/tests/cpp-tests/Resources/fonts/bitmapFontTest4.png and b/tests/cpp-tests/Resources/fonts/bitmapFontTest4.png differ diff --git a/tests/cpp-tests/Resources/fonts/bitmapFontTest5.png b/tests/cpp-tests/Resources/fonts/bitmapFontTest5.png old mode 100644 new mode 100755 index 219c53bbb3b2..4777c7616296 Binary files a/tests/cpp-tests/Resources/fonts/bitmapFontTest5.png and b/tests/cpp-tests/Resources/fonts/bitmapFontTest5.png differ diff --git a/tests/cpp-tests/Resources/fonts/bmfont-rotated-test.plist b/tests/cpp-tests/Resources/fonts/bmfont-rotated-test.plist new file mode 100644 index 000000000000..f38a0d3279c3 --- /dev/null +++ b/tests/cpp-tests/Resources/fonts/bmfont-rotated-test.plist @@ -0,0 +1,56 @@ + + + + + frames + + geneva-regular-32.png + + aliases + + spriteOffset + {-2,3} + spriteSize + {508,122} + spriteSourceSize + {512,128} + textureRect + {{2,2},{508,122}} + textureRotated + + + helvetica-regular-32.png + + aliases + + spriteOffset + {-7,4} + spriteSize + {498,120} + spriteSourceSize + {512,128} + textureRect + {{128,2},{498,120}} + textureRotated + + + + metadata + + format + 3 + pixelFormat + RGBA4444 + premultiplyAlpha + + realTextureFileName + bmfont-rotated-test.png + size + {250,512} + smartupdate + $TexturePacker:SmartUpdate:404120629fe631b449a08b9b19e69a2c:65dfae55236043f04822a4b3d14d288d:b41d4ffccc5285d084f64abded57400d$ + textureFileName + bmfont-rotated-test.png + + + diff --git a/tests/cpp-tests/Resources/fonts/bmfont-rotated-test.png b/tests/cpp-tests/Resources/fonts/bmfont-rotated-test.png new file mode 100644 index 000000000000..874f1d6cd25d Binary files /dev/null and b/tests/cpp-tests/Resources/fonts/bmfont-rotated-test.png differ diff --git a/tests/cpp-tests/Resources/fonts/boundsTestFont.png b/tests/cpp-tests/Resources/fonts/boundsTestFont.png old mode 100644 new mode 100755 index 96a0fced31ff..da5da270feaa Binary files a/tests/cpp-tests/Resources/fonts/boundsTestFont.png and b/tests/cpp-tests/Resources/fonts/boundsTestFont.png differ diff --git a/tests/cpp-tests/Resources/fonts/enligsh-chinese.png b/tests/cpp-tests/Resources/fonts/enligsh-chinese.png index 30cf1c59a3f4..a3bc36f97502 100644 Binary files a/tests/cpp-tests/Resources/fonts/enligsh-chinese.png and b/tests/cpp-tests/Resources/fonts/enligsh-chinese.png differ diff --git a/tests/cpp-tests/Resources/fonts/font-issue1343-hd.png b/tests/cpp-tests/Resources/fonts/font-issue1343-hd.png old mode 100644 new mode 100755 index 8b25950089ba..a6ca8414e453 Binary files a/tests/cpp-tests/Resources/fonts/font-issue1343-hd.png and b/tests/cpp-tests/Resources/fonts/font-issue1343-hd.png differ diff --git a/tests/cpp-tests/Resources/fonts/font-issue1343.png b/tests/cpp-tests/Resources/fonts/font-issue1343.png old mode 100644 new mode 100755 index 403c40388b81..68a96b06c711 Binary files a/tests/cpp-tests/Resources/fonts/font-issue1343.png and b/tests/cpp-tests/Resources/fonts/font-issue1343.png differ diff --git a/tests/cpp-tests/Resources/fonts/futura-48.png b/tests/cpp-tests/Resources/fonts/futura-48.png old mode 100644 new mode 100755 index fb034990ce54..796a33e41fb8 Binary files a/tests/cpp-tests/Resources/fonts/futura-48.png and b/tests/cpp-tests/Resources/fonts/futura-48.png differ diff --git a/tests/cpp-tests/Resources/fonts/geneva-regular-32.fnt b/tests/cpp-tests/Resources/fonts/geneva-regular-32.fnt new file mode 100644 index 000000000000..882616e5fadd --- /dev/null +++ b/tests/cpp-tests/Resources/fonts/geneva-regular-32.fnt @@ -0,0 +1,99 @@ +info face="Geneva" size=32 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=1,1 +common lineHeight=42 base=32 scaleW=512 scaleH=128 pages=1 packed=0 +page id=0 file="bmfont-rotated-test.png" +chars count=95 +char id=40 x=1 y=1 width=15 height=36 xoffset=1 yoffset=5 xadvance=14 page=0 chnl=0 letter="(" +char id=41 x=17 y=1 width=14 height=36 xoffset=1 yoffset=5 xadvance=14 page=0 chnl=0 letter=")" +char id=106 x=32 y=1 width=13 height=36 xoffset=-3 yoffset=6 xadvance=8 page=0 chnl=0 letter="j" +char id=125 x=46 y=1 width=13 height=36 xoffset=2 yoffset=5 xadvance=14 page=0 chnl=0 letter="}" +char id=91 x=60 y=1 width=13 height=36 xoffset=2 yoffset=5 xadvance=14 page=0 chnl=0 letter="[" +char id=93 x=74 y=1 width=13 height=36 xoffset=1 yoffset=5 xadvance=14 page=0 chnl=0 letter="]" +char id=123 x=88 y=1 width=12 height=36 xoffset=2 yoffset=5 xadvance=14 page=0 chnl=0 letter="{" +char id=81 x=101 y=1 width=28 height=35 xoffset=0 yoffset=6 xadvance=23 page=0 chnl=0 letter="Q" +char id=36 x=130 y=1 width=21 height=34 xoffset=1 yoffset=4 xadvance=21 page=0 chnl=0 letter="$" +char id=100 x=152 y=1 width=21 height=31 xoffset=0 yoffset=5 xadvance=19 page=0 chnl=0 letter="d" +char id=98 x=174 y=1 width=21 height=31 xoffset=1 yoffset=5 xadvance=19 page=0 chnl=0 letter="b" +char id=64 x=196 y=1 width=29 height=30 xoffset=0 yoffset=6 xadvance=27 page=0 chnl=0 letter="@" +char id=79 x=226 y=1 width=26 height=30 xoffset=0 yoffset=6 xadvance=23 page=0 chnl=0 letter="O" +char id=38 x=253 y=1 width=25 height=30 xoffset=0 yoffset=6 xadvance=23 page=0 chnl=0 letter="&" +char id=71 x=279 y=1 width=23 height=30 xoffset=0 yoffset=6 xadvance=21 page=0 chnl=0 letter="G" +char id=67 x=303 y=1 width=23 height=30 xoffset=0 yoffset=6 xadvance=20 page=0 chnl=0 letter="C" +char id=85 x=327 y=1 width=23 height=30 xoffset=0 yoffset=6 xadvance=21 page=0 chnl=0 letter="U" +char id=48 x=351 y=1 width=23 height=30 xoffset=0 yoffset=6 xadvance=21 page=0 chnl=0 letter="0" +char id=83 x=375 y=1 width=22 height=30 xoffset=0 yoffset=6 xadvance=19 page=0 chnl=0 letter="S" +char id=92 x=398 y=1 width=21 height=30 xoffset=-1 yoffset=6 xadvance=17 page=0 chnl=0 letter="\" +char id=47 x=420 y=1 width=21 height=30 xoffset=-1 yoffset=6 xadvance=17 page=0 chnl=0 letter="/" +char id=56 x=442 y=1 width=21 height=30 xoffset=1 yoffset=6 xadvance=21 page=0 chnl=0 letter="8" +char id=57 x=464 y=1 width=21 height=30 xoffset=1 yoffset=6 xadvance=21 page=0 chnl=0 letter="9" +char id=54 x=486 y=1 width=21 height=30 xoffset=1 yoffset=6 xadvance=21 page=0 chnl=0 letter="6" +char id=103 x=1 y=38 width=21 height=30 xoffset=0 yoffset=13 xadvance=19 page=0 chnl=0 letter="g" +char id=51 x=23 y=38 width=20 height=30 xoffset=1 yoffset=6 xadvance=21 page=0 chnl=0 letter="3" +char id=53 x=44 y=38 width=20 height=30 xoffset=2 yoffset=6 xadvance=21 page=0 chnl=0 letter="5" +char id=107 x=65 y=38 width=19 height=30 xoffset=1 yoffset=5 xadvance=17 page=0 chnl=0 letter="k" +char id=104 x=85 y=38 width=19 height=30 xoffset=1 yoffset=5 xadvance=18 page=0 chnl=0 letter="h" +char id=74 x=105 y=38 width=18 height=30 xoffset=-1 yoffset=6 xadvance=15 page=0 chnl=0 letter="J" +char id=102 x=124 y=38 width=16 height=30 xoffset=0 yoffset=5 xadvance=12 page=0 chnl=0 letter="f" +char id=124 x=141 y=38 width=8 height=30 xoffset=1 yoffset=6 xadvance=7 page=0 chnl=0 letter="|" +char id=108 x=150 y=38 width=8 height=30 xoffset=1 yoffset=5 xadvance=7 page=0 chnl=0 letter="l" +char id=87 x=159 y=38 width=32 height=29 xoffset=0 yoffset=6 xadvance=30 page=0 chnl=0 letter="W" +char id=37 x=192 y=38 width=31 height=29 xoffset=0 yoffset=6 xadvance=28 page=0 chnl=0 letter="%" +char id=86 x=224 y=38 width=27 height=29 xoffset=-1 yoffset=6 xadvance=23 page=0 chnl=0 letter="V" +char id=65 x=252 y=38 width=27 height=29 xoffset=-1 yoffset=6 xadvance=23 page=0 chnl=0 letter="A" +char id=77 x=280 y=38 width=25 height=29 xoffset=1 yoffset=6 xadvance=25 page=0 chnl=0 letter="M" +char id=35 x=306 y=38 width=25 height=29 xoffset=-1 yoffset=6 xadvance=21 page=0 chnl=0 letter="#" +char id=84 x=332 y=38 width=24 height=29 xoffset=-1 yoffset=6 xadvance=20 page=0 chnl=0 letter="T" +char id=78 x=357 y=38 width=23 height=29 xoffset=1 yoffset=6 xadvance=22 page=0 chnl=0 letter="N" +char id=89 x=381 y=38 width=23 height=29 xoffset=-1 yoffset=6 xadvance=19 page=0 chnl=0 letter="Y" +char id=88 x=405 y=38 width=23 height=29 xoffset=-1 yoffset=6 xadvance=19 page=0 chnl=0 letter="X" +char id=68 x=429 y=38 width=23 height=29 xoffset=1 yoffset=6 xadvance=22 page=0 chnl=0 letter="D" +char id=75 x=453 y=38 width=23 height=29 xoffset=1 yoffset=6 xadvance=21 page=0 chnl=0 letter="K" +char id=52 x=477 y=38 width=23 height=29 xoffset=0 yoffset=6 xadvance=21 page=0 chnl=0 letter="4" +char id=72 x=1 y=69 width=22 height=29 xoffset=1 yoffset=6 xadvance=22 page=0 chnl=0 letter="H" +char id=121 x=24 y=69 width=22 height=29 xoffset=-1 yoffset=13 xadvance=18 page=0 chnl=0 letter="y" +char id=50 x=47 y=69 width=21 height=29 xoffset=1 yoffset=6 xadvance=21 page=0 chnl=0 letter="2" +char id=82 x=69 y=69 width=21 height=29 xoffset=1 yoffset=6 xadvance=19 page=0 chnl=0 letter="R" +char id=66 x=91 y=69 width=21 height=29 xoffset=1 yoffset=6 xadvance=20 page=0 chnl=0 letter="B" +char id=76 x=113 y=69 width=21 height=29 xoffset=1 yoffset=6 xadvance=18 page=0 chnl=0 letter="L" +char id=55 x=135 y=69 width=21 height=29 xoffset=1 yoffset=6 xadvance=21 page=0 chnl=0 letter="7" +char id=113 x=157 y=69 width=21 height=29 xoffset=0 yoffset=13 xadvance=19 page=0 chnl=0 letter="q" +char id=90 x=179 y=69 width=20 height=29 xoffset=0 yoffset=6 xadvance=18 page=0 chnl=0 letter="Z" +char id=80 x=200 y=69 width=20 height=29 xoffset=1 yoffset=6 xadvance=18 page=0 chnl=0 letter="P" +char id=112 x=221 y=69 width=20 height=29 xoffset=1 yoffset=13 xadvance=19 page=0 chnl=0 letter="p" +char id=63 x=242 y=69 width=19 height=29 xoffset=0 yoffset=6 xadvance=18 page=0 chnl=0 letter="?" +char id=69 x=262 y=69 width=19 height=29 xoffset=1 yoffset=6 xadvance=18 page=0 chnl=0 letter="E" +char id=70 x=282 y=69 width=18 height=29 xoffset=1 yoffset=6 xadvance=17 page=0 chnl=0 letter="F" +char id=49 x=301 y=69 width=13 height=29 xoffset=3 yoffset=6 xadvance=21 page=0 chnl=0 letter="1" +char id=33 x=315 y=69 width=9 height=29 xoffset=1 yoffset=6 xadvance=9 page=0 chnl=0 letter="!" +char id=105 x=325 y=69 width=8 height=29 xoffset=1 yoffset=6 xadvance=7 page=0 chnl=0 letter="i" +char id=73 x=334 y=69 width=8 height=29 xoffset=1 yoffset=6 xadvance=7 page=0 chnl=0 letter="I" +char id=59 x=343 y=69 width=9 height=28 xoffset=1 yoffset=13 xadvance=9 page=0 chnl=0 letter=";" +char id=116 x=353 y=69 width=16 height=27 xoffset=0 yoffset=9 xadvance=14 page=0 chnl=0 letter="t" +char id=111 x=370 y=69 width=21 height=23 xoffset=0 yoffset=13 xadvance=19 page=0 chnl=0 letter="o" +char id=101 x=392 y=69 width=20 height=23 xoffset=0 yoffset=13 xadvance=18 page=0 chnl=0 letter="e" +char id=99 x=413 y=69 width=20 height=23 xoffset=0 yoffset=13 xadvance=17 page=0 chnl=0 letter="c" +char id=97 x=434 y=69 width=20 height=23 xoffset=0 yoffset=13 xadvance=17 page=0 chnl=0 letter="a" +char id=117 x=455 y=69 width=19 height=23 xoffset=1 yoffset=13 xadvance=18 page=0 chnl=0 letter="u" +char id=115 x=475 y=69 width=18 height=23 xoffset=0 yoffset=13 xadvance=16 page=0 chnl=0 letter="s" +char id=109 x=1 y=99 width=29 height=22 xoffset=1 yoffset=13 xadvance=28 page=0 chnl=0 letter="m" +char id=119 x=31 y=99 width=29 height=22 xoffset=-1 yoffset=13 xadvance=24 page=0 chnl=0 letter="w" +char id=62 x=61 y=99 width=23 height=22 xoffset=0 yoffset=13 xadvance=21 page=0 chnl=0 letter=">" +char id=43 x=85 y=99 width=23 height=22 xoffset=0 yoffset=13 xadvance=21 page=0 chnl=0 letter="+" +char id=118 x=109 y=99 width=22 height=22 xoffset=-1 yoffset=13 xadvance=18 page=0 chnl=0 letter="v" +char id=60 x=132 y=99 width=22 height=22 xoffset=1 yoffset=13 xadvance=21 page=0 chnl=0 letter="<" +char id=94 x=155 y=99 width=22 height=22 xoffset=1 yoffset=7 xadvance=21 page=0 chnl=0 letter="^" +char id=110 x=178 y=99 width=19 height=22 xoffset=1 yoffset=13 xadvance=18 page=0 chnl=0 letter="n" +char id=120 x=198 y=99 width=19 height=22 xoffset=0 yoffset=13 xadvance=16 page=0 chnl=0 letter="x" +char id=122 x=218 y=99 width=19 height=22 xoffset=0 yoffset=13 xadvance=17 page=0 chnl=0 letter="z" +char id=114 x=238 y=99 width=15 height=22 xoffset=1 yoffset=13 xadvance=12 page=0 chnl=0 letter="r" +char id=58 x=254 y=99 width=9 height=22 xoffset=1 yoffset=13 xadvance=9 page=0 chnl=0 letter=":" +char id=42 x=264 y=99 width=18 height=18 xoffset=0 yoffset=6 xadvance=16 page=0 chnl=0 letter="*" +char id=34 x=283 y=99 width=16 height=15 xoffset=1 yoffset=5 xadvance=16 page=0 chnl=0 letter=""" +char id=39 x=300 y=99 width=9 height=15 xoffset=1 yoffset=5 xadvance=9 page=0 chnl=0 letter="'" +char id=44 x=310 y=99 width=9 height=15 xoffset=1 yoffset=26 xadvance=9 page=0 chnl=0 letter="," +char id=61 x=320 y=99 width=23 height=13 xoffset=0 yoffset=18 xadvance=21 page=0 chnl=0 letter="=" +char id=126 x=344 y=99 width=23 height=11 xoffset=0 yoffset=19 xadvance=21 page=0 chnl=0 letter="~" +char id=96 x=368 y=99 width=12 height=10 xoffset=4 yoffset=5 xadvance=18 page=0 chnl=0 letter="`" +char id=46 x=381 y=99 width=9 height=9 xoffset=1 yoffset=26 xadvance=9 page=0 chnl=0 letter="." +char id=45 x=391 y=99 width=14 height=8 xoffset=0 yoffset=19 xadvance=12 page=0 chnl=0 letter="-" +char id=95 x=406 y=99 width=25 height=7 xoffset=-1 yoffset=31 xadvance=21 page=0 chnl=0 letter="_" +char id=32 x=432 y=99 width=0 height=0 xoffset=-110 yoffset=152 xadvance=10 page=0 chnl=0 letter="space" diff --git a/tests/cpp-tests/Resources/fonts/helvetica-geneva-32.png b/tests/cpp-tests/Resources/fonts/helvetica-geneva-32.png old mode 100644 new mode 100755 index 720292cef13b..8d997c0f9ffd Binary files a/tests/cpp-tests/Resources/fonts/helvetica-geneva-32.png and b/tests/cpp-tests/Resources/fonts/helvetica-geneva-32.png differ diff --git a/tests/cpp-tests/Resources/fonts/helvetica-regular-32.fnt b/tests/cpp-tests/Resources/fonts/helvetica-regular-32.fnt new file mode 100644 index 000000000000..97d1fd77bc95 --- /dev/null +++ b/tests/cpp-tests/Resources/fonts/helvetica-regular-32.fnt @@ -0,0 +1,99 @@ +info face="Helvetica-Bold" size=32 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=1,1 +common lineHeight=32 base=25 scaleW=512 scaleH=128 pages=1 packed=0 +page id=0 file="bmfont-rotated-test.png" +chars count=95 +char id=125 x=1 y=1 width=15 height=35 xoffset=-1 yoffset=-0 xadvance=12 page=0 chnl=0 letter="}" +char id=41 x=17 y=1 width=14 height=35 xoffset=-1 yoffset=-0 xadvance=10 page=0 chnl=0 letter=")" +char id=123 x=32 y=1 width=14 height=35 xoffset=-1 yoffset=-0 xadvance=12 page=0 chnl=0 letter="{" +char id=93 x=47 y=1 width=13 height=35 xoffset=-1 yoffset=-0 xadvance=10 page=0 chnl=0 letter="]" +char id=40 x=61 y=1 width=13 height=35 xoffset=0 yoffset=-0 xadvance=10 page=0 chnl=0 letter="(" +char id=91 x=75 y=1 width=12 height=35 xoffset=1 yoffset=-0 xadvance=10 page=0 chnl=0 letter="[" +char id=106 x=88 y=1 width=11 height=35 xoffset=-1 yoffset=-0 xadvance=8 page=0 chnl=0 letter="j" +char id=36 x=100 y=1 width=21 height=33 xoffset=-1 yoffset=-1 xadvance=17 page=0 chnl=0 letter="$" +char id=81 x=122 y=1 width=27 height=30 xoffset=0 yoffset=-0 xadvance=24 page=0 chnl=0 letter="Q" +char id=64 x=150 y=1 width=30 height=29 xoffset=2 yoffset=-0 xadvance=31 page=0 chnl=0 letter="@" +char id=79 x=181 y=1 width=27 height=29 xoffset=0 yoffset=-0 xadvance=24 page=0 chnl=0 letter="O" +char id=71 x=209 y=1 width=26 height=29 xoffset=0 yoffset=-0 xadvance=24 page=0 chnl=0 letter="G" +char id=67 x=236 y=1 width=25 height=29 xoffset=0 yoffset=-0 xadvance=23 page=0 chnl=0 letter="C" +char id=83 x=262 y=1 width=24 height=29 xoffset=0 yoffset=-0 xadvance=21 page=0 chnl=0 letter="S" +char id=85 x=287 y=1 width=23 height=29 xoffset=1 yoffset=-0 xadvance=23 page=0 chnl=0 letter="U" +char id=113 x=311 y=1 width=22 height=29 xoffset=-1 yoffset=6 xadvance=19 page=0 chnl=0 letter="q" +char id=112 x=334 y=1 width=22 height=29 xoffset=0 yoffset=6 xadvance=19 page=0 chnl=0 letter="p" +char id=121 x=357 y=1 width=22 height=29 xoffset=-1 yoffset=6 xadvance=17 page=0 chnl=0 letter="y" +char id=103 x=380 y=1 width=21 height=29 xoffset=0 yoffset=6 xadvance=19 page=0 chnl=0 letter="g" +char id=74 x=402 y=1 width=20 height=29 xoffset=-1 yoffset=-0 xadvance=17 page=0 chnl=0 letter="J" +char id=87 x=423 y=1 width=34 height=28 xoffset=-1 yoffset=-0 xadvance=30 page=0 chnl=0 letter="W" +char id=37 x=458 y=1 width=32 height=28 xoffset=-1 yoffset=1 xadvance=28 page=0 chnl=0 letter="%" +char id=77 x=1 y=37 width=27 height=28 xoffset=1 yoffset=-0 xadvance=26 page=0 chnl=0 letter="M" +char id=65 x=29 y=37 width=27 height=28 xoffset=-1 yoffset=-0 xadvance=23 page=0 chnl=0 letter="A" +char id=38 x=57 y=37 width=26 height=28 xoffset=0 yoffset=1 xadvance=23 page=0 chnl=0 letter="&" +char id=88 x=84 y=37 width=25 height=28 xoffset=-1 yoffset=-0 xadvance=21 page=0 chnl=0 letter="X" +char id=75 x=110 y=37 width=25 height=28 xoffset=1 yoffset=-0 xadvance=23 page=0 chnl=0 letter="K" +char id=86 x=136 y=37 width=25 height=28 xoffset=-1 yoffset=-0 xadvance=21 page=0 chnl=0 letter="V" +char id=89 x=162 y=37 width=25 height=28 xoffset=-1 yoffset=-0 xadvance=21 page=0 chnl=0 letter="Y" +char id=68 x=188 y=37 width=24 height=28 xoffset=1 yoffset=-0 xadvance=23 page=0 chnl=0 letter="D" +char id=78 x=213 y=37 width=24 height=28 xoffset=1 yoffset=-0 xadvance=23 page=0 chnl=0 letter="N" +char id=66 x=238 y=37 width=24 height=28 xoffset=1 yoffset=-0 xadvance=23 page=0 chnl=0 letter="B" +char id=82 x=263 y=37 width=24 height=28 xoffset=1 yoffset=-0 xadvance=23 page=0 chnl=0 letter="R" +char id=84 x=288 y=37 width=24 height=28 xoffset=-1 yoffset=-0 xadvance=19 page=0 chnl=0 letter="T" +char id=72 x=313 y=37 width=23 height=28 xoffset=1 yoffset=-0 xadvance=23 page=0 chnl=0 letter="H" +char id=80 x=337 y=37 width=23 height=28 xoffset=1 yoffset=-0 xadvance=21 page=0 chnl=0 letter="P" +char id=90 x=361 y=37 width=23 height=28 xoffset=-1 yoffset=-0 xadvance=19 page=0 chnl=0 letter="Z" +char id=69 x=385 y=37 width=23 height=28 xoffset=1 yoffset=-0 xadvance=21 page=0 chnl=0 letter="E" +char id=98 x=409 y=37 width=22 height=28 xoffset=0 yoffset=1 xadvance=19 page=0 chnl=0 letter="b" +char id=51 x=432 y=37 width=21 height=28 xoffset=-1 yoffset=1 xadvance=17 page=0 chnl=0 letter="3" +char id=56 x=454 y=37 width=21 height=28 xoffset=-1 yoffset=1 xadvance=17 page=0 chnl=0 letter="8" +char id=53 x=476 y=37 width=21 height=28 xoffset=-1 yoffset=1 xadvance=17 page=0 chnl=0 letter="5" +char id=100 x=1 y=66 width=21 height=28 xoffset=0 yoffset=1 xadvance=19 page=0 chnl=0 letter="d" +char id=76 x=23 y=66 width=21 height=28 xoffset=1 yoffset=-0 xadvance=19 page=0 chnl=0 letter="L" +char id=48 x=45 y=66 width=20 height=28 xoffset=0 yoffset=1 xadvance=17 page=0 chnl=0 letter="0" +char id=57 x=66 y=66 width=20 height=28 xoffset=0 yoffset=1 xadvance=17 page=0 chnl=0 letter="9" +char id=54 x=87 y=66 width=20 height=28 xoffset=0 yoffset=1 xadvance=17 page=0 chnl=0 letter="6" +char id=63 x=108 y=66 width=20 height=28 xoffset=1 yoffset=-0 xadvance=19 page=0 chnl=0 letter="?" +char id=92 x=129 y=66 width=17 height=28 xoffset=-3 yoffset=-0 xadvance=8 page=0 chnl=0 letter="\" +char id=47 x=147 y=66 width=17 height=28 xoffset=-3 yoffset=-0 xadvance=8 page=0 chnl=0 letter="/" +char id=102 x=165 y=66 width=15 height=28 xoffset=-1 yoffset=-0 xadvance=10 page=0 chnl=0 letter="f" +char id=124 x=181 y=66 width=9 height=28 xoffset=0 yoffset=-0 xadvance=8 page=0 chnl=0 letter="|" +char id=105 x=191 y=66 width=9 height=28 xoffset=1 yoffset=-0 xadvance=8 page=0 chnl=0 letter="i" +char id=73 x=201 y=66 width=9 height=28 xoffset=1 yoffset=-0 xadvance=8 page=0 chnl=0 letter="I" +char id=108 x=211 y=66 width=9 height=28 xoffset=1 yoffset=-0 xadvance=8 page=0 chnl=0 letter="l" +char id=35 x=221 y=66 width=22 height=27 xoffset=-1 yoffset=1 xadvance=17 page=0 chnl=0 letter="#" +char id=52 x=244 y=66 width=21 height=27 xoffset=-1 yoffset=1 xadvance=17 page=0 chnl=0 letter="4" +char id=55 x=266 y=66 width=21 height=27 xoffset=-1 yoffset=1 xadvance=17 page=0 chnl=0 letter="7" +char id=70 x=288 y=66 width=21 height=27 xoffset=1 yoffset=1 xadvance=19 page=0 chnl=0 letter="F" +char id=104 x=310 y=66 width=20 height=27 xoffset=1 yoffset=1 xadvance=19 page=0 chnl=0 letter="h" +char id=50 x=331 y=66 width=20 height=27 xoffset=0 yoffset=1 xadvance=17 page=0 chnl=0 letter="2" +char id=107 x=352 y=66 width=20 height=27 xoffset=1 yoffset=1 xadvance=17 page=0 chnl=0 letter="k" +char id=49 x=373 y=66 width=15 height=27 xoffset=1 yoffset=1 xadvance=17 page=0 chnl=0 letter="1" +char id=116 x=389 y=66 width=14 height=27 xoffset=-1 yoffset=2 xadvance=10 page=0 chnl=0 letter="t" +char id=33 x=404 y=66 width=10 height=27 xoffset=2 yoffset=1 xadvance=10 page=0 chnl=0 letter="!" +char id=59 x=415 y=66 width=10 height=27 xoffset=2 yoffset=7 xadvance=10 page=0 chnl=0 letter=";" +char id=60 x=426 y=66 width=23 height=23 xoffset=-1 yoffset=6 xadvance=18 page=0 chnl=0 letter="<" +char id=62 x=450 y=66 width=23 height=23 xoffset=-1 yoffset=6 xadvance=18 page=0 chnl=0 letter=">" +char id=111 x=474 y=66 width=22 height=23 xoffset=0 yoffset=6 xadvance=19 page=0 chnl=0 letter="o" +char id=97 x=1 y=95 width=21 height=23 xoffset=-1 yoffset=6 xadvance=17 page=0 chnl=0 letter="a" +char id=101 x=23 y=95 width=21 height=23 xoffset=-1 yoffset=6 xadvance=17 page=0 chnl=0 letter="e" +char id=117 x=45 y=95 width=21 height=23 xoffset=0 yoffset=6 xadvance=19 page=0 chnl=0 letter="u" +char id=115 x=67 y=95 width=20 height=23 xoffset=0 yoffset=6 xadvance=17 page=0 chnl=0 letter="s" +char id=99 x=88 y=95 width=20 height=23 xoffset=0 yoffset=6 xadvance=17 page=0 chnl=0 letter="c" +char id=119 x=109 y=95 width=29 height=22 xoffset=-1 yoffset=6 xadvance=24 page=0 chnl=0 letter="w" +char id=109 x=139 y=95 width=29 height=22 xoffset=1 yoffset=6 xadvance=28 page=0 chnl=0 letter="m" +char id=118 x=169 y=95 width=22 height=22 xoffset=-1 yoffset=6 xadvance=17 page=0 chnl=0 letter="v" +char id=110 x=192 y=95 width=20 height=22 xoffset=1 yoffset=6 xadvance=19 page=0 chnl=0 letter="n" +char id=122 x=213 y=95 width=20 height=22 xoffset=-1 yoffset=6 xadvance=16 page=0 chnl=0 letter="z" +char id=114 x=234 y=95 width=14 height=22 xoffset=1 yoffset=6 xadvance=12 page=0 chnl=0 letter="r" +char id=120 x=249 y=95 width=22 height=21 xoffset=-1 yoffset=7 xadvance=17 page=0 chnl=0 letter="x" +char id=43 x=272 y=95 width=22 height=21 xoffset=0 yoffset=7 xadvance=18 page=0 chnl=0 letter="+" +char id=58 x=295 y=95 width=10 height=21 xoffset=2 yoffset=7 xadvance=10 page=0 chnl=0 letter=":" +char id=94 x=306 y=95 width=20 height=19 xoffset=1 yoffset=-0 xadvance=18 page=0 chnl=0 letter="^" +char id=61 x=327 y=95 width=22 height=17 xoffset=0 yoffset=9 xadvance=18 page=0 chnl=0 letter="=" +char id=42 x=350 y=95 width=16 height=16 xoffset=-1 yoffset=-0 xadvance=12 page=0 chnl=0 letter="*" +char id=34 x=367 y=95 width=15 height=15 xoffset=-1 yoffset=-0 xadvance=15 page=0 chnl=0 letter=""" +char id=44 x=383 y=95 width=10 height=15 xoffset=0 yoffset=19 xadvance=8 page=0 chnl=0 letter="," +char id=39 x=394 y=95 width=9 height=15 xoffset=0 yoffset=-0 xadvance=7 page=0 chnl=0 letter="'" +char id=126 x=404 y=95 width=23 height=13 xoffset=-1 yoffset=11 xadvance=18 page=0 chnl=0 letter="~" +char id=45 x=428 y=95 width=14 height=10 xoffset=-1 yoffset=12 xadvance=10 page=0 chnl=0 letter="-" +char id=96 x=443 y=95 width=12 height=9 xoffset=-2 yoffset=-0 xadvance=10 page=0 chnl=0 letter="`" +char id=46 x=456 y=95 width=9 height=9 xoffset=1 yoffset=19 xadvance=8 page=0 chnl=0 letter="." +char id=95 x=466 y=95 width=22 height=6 xoffset=-1 yoffset=26 xadvance=17 page=0 chnl=0 letter="_" +char id=32 x=489 y=95 width=0 height=0 xoffset=-112 yoffset=145 xadvance=8 page=0 chnl=0 letter="space" diff --git a/tests/cpp-tests/Resources/fonts/konqa32-hd.png b/tests/cpp-tests/Resources/fonts/konqa32-hd.png index b3f3ca4c6a07..051e8d5bd30f 100644 Binary files a/tests/cpp-tests/Resources/fonts/konqa32-hd.png and b/tests/cpp-tests/Resources/fonts/konqa32-hd.png differ diff --git a/tests/cpp-tests/Resources/fonts/konqa32.png b/tests/cpp-tests/Resources/fonts/konqa32.png old mode 100644 new mode 100755 index f739d8cb5375..7ed3ceefcd2d Binary files a/tests/cpp-tests/Resources/fonts/konqa32.png and b/tests/cpp-tests/Resources/fonts/konqa32.png differ diff --git a/tests/cpp-tests/Resources/fonts/labelatlas.png b/tests/cpp-tests/Resources/fonts/labelatlas.png old mode 100644 new mode 100755 index 30f465d97605..e91d0af540bf Binary files a/tests/cpp-tests/Resources/fonts/labelatlas.png and b/tests/cpp-tests/Resources/fonts/labelatlas.png differ diff --git a/tests/cpp-tests/Resources/fonts/larabie-16-hd.png b/tests/cpp-tests/Resources/fonts/larabie-16-hd.png index 06d685abb09f..7aac30647d07 100644 Binary files a/tests/cpp-tests/Resources/fonts/larabie-16-hd.png and b/tests/cpp-tests/Resources/fonts/larabie-16-hd.png differ diff --git a/tests/cpp-tests/Resources/fonts/larabie-16.png b/tests/cpp-tests/Resources/fonts/larabie-16.png old mode 100644 new mode 100755 index 1c3496d00859..304240c7c182 Binary files a/tests/cpp-tests/Resources/fonts/larabie-16.png and b/tests/cpp-tests/Resources/fonts/larabie-16.png differ diff --git a/tests/cpp-tests/Resources/fonts/markerFelt-hd.png b/tests/cpp-tests/Resources/fonts/markerFelt-hd.png index 8abbe410550a..3988cfdf6548 100644 Binary files a/tests/cpp-tests/Resources/fonts/markerFelt-hd.png and b/tests/cpp-tests/Resources/fonts/markerFelt-hd.png differ diff --git a/tests/cpp-tests/Resources/fonts/markerFelt.png b/tests/cpp-tests/Resources/fonts/markerFelt.png old mode 100644 new mode 100755 index d730bca8419e..8651e05e3283 Binary files a/tests/cpp-tests/Resources/fonts/markerFelt.png and b/tests/cpp-tests/Resources/fonts/markerFelt.png differ diff --git a/tests/cpp-tests/Resources/fonts/tuffy_bold_italic-charmap-hd.png b/tests/cpp-tests/Resources/fonts/tuffy_bold_italic-charmap-hd.png index 2276fa2367bd..8167faf6c40f 100644 Binary files a/tests/cpp-tests/Resources/fonts/tuffy_bold_italic-charmap-hd.png and b/tests/cpp-tests/Resources/fonts/tuffy_bold_italic-charmap-hd.png differ diff --git a/tests/cpp-tests/Resources/fonts/tuffy_bold_italic-charmap.png b/tests/cpp-tests/Resources/fonts/tuffy_bold_italic-charmap.png old mode 100644 new mode 100755 index 62cf0d587cb5..c39d1a9a4bf3 Binary files a/tests/cpp-tests/Resources/fonts/tuffy_bold_italic-charmap.png and b/tests/cpp-tests/Resources/fonts/tuffy_bold_italic-charmap.png differ diff --git a/tests/cpp-tests/Resources/fonts/west_england-64.png b/tests/cpp-tests/Resources/fonts/west_england-64.png old mode 100644 new mode 100755 index 33f0381d58ef..cadb3fd2d651 Binary files a/tests/cpp-tests/Resources/fonts/west_england-64.png and b/tests/cpp-tests/Resources/fonts/west_england-64.png differ diff --git a/tests/cpp-tests/Resources/fps_images.png b/tests/cpp-tests/Resources/fps_images.png index e48259b153c1..c7449025bf10 100644 Binary files a/tests/cpp-tests/Resources/fps_images.png and b/tests/cpp-tests/Resources/fps_images.png differ diff --git a/tests/cpp-tests/Resources/hd/ActionTimeline/Default/Button_Disable.png b/tests/cpp-tests/Resources/hd/ActionTimeline/Default/Button_Disable.png old mode 100644 new mode 100755 index c31793290355..62ee840c40d3 Binary files a/tests/cpp-tests/Resources/hd/ActionTimeline/Default/Button_Disable.png and b/tests/cpp-tests/Resources/hd/ActionTimeline/Default/Button_Disable.png differ diff --git a/tests/cpp-tests/Resources/hd/ActionTimeline/Default/Sprite.png b/tests/cpp-tests/Resources/hd/ActionTimeline/Default/Sprite.png old mode 100644 new mode 100755 index c7fae283de68..115fa75667e5 Binary files a/tests/cpp-tests/Resources/hd/ActionTimeline/Default/Sprite.png and b/tests/cpp-tests/Resources/hd/ActionTimeline/Default/Sprite.png differ diff --git a/tests/cpp-tests/Resources/hd/ActionTimeline/testAnimationResource/01.png b/tests/cpp-tests/Resources/hd/ActionTimeline/testAnimationResource/01.png index 2f4a20b64091..9dd0f7a3f7de 100644 Binary files a/tests/cpp-tests/Resources/hd/ActionTimeline/testAnimationResource/01.png and b/tests/cpp-tests/Resources/hd/ActionTimeline/testAnimationResource/01.png differ diff --git a/tests/cpp-tests/Resources/hd/ActionTimeline/testAnimationResource/1.png b/tests/cpp-tests/Resources/hd/ActionTimeline/testAnimationResource/1.png old mode 100644 new mode 100755 index 4445a3345048..0ec85b0da611 Binary files a/tests/cpp-tests/Resources/hd/ActionTimeline/testAnimationResource/1.png and b/tests/cpp-tests/Resources/hd/ActionTimeline/testAnimationResource/1.png differ diff --git a/tests/cpp-tests/Resources/hd/ActionTimeline/testAnimationResource/2.png b/tests/cpp-tests/Resources/hd/ActionTimeline/testAnimationResource/2.png old mode 100644 new mode 100755 index 209e914ac4b2..d8c6e5ee0824 Binary files a/tests/cpp-tests/Resources/hd/ActionTimeline/testAnimationResource/2.png and b/tests/cpp-tests/Resources/hd/ActionTimeline/testAnimationResource/2.png differ diff --git a/tests/cpp-tests/Resources/hd/ActionTimeline/testAnimationResource/3.png b/tests/cpp-tests/Resources/hd/ActionTimeline/testAnimationResource/3.png old mode 100644 new mode 100755 index e20039969660..99108df77d27 Binary files a/tests/cpp-tests/Resources/hd/ActionTimeline/testAnimationResource/3.png and b/tests/cpp-tests/Resources/hd/ActionTimeline/testAnimationResource/3.png differ diff --git a/tests/cpp-tests/Resources/hd/ActionTimeline/testAnimationResource/4.png b/tests/cpp-tests/Resources/hd/ActionTimeline/testAnimationResource/4.png old mode 100644 new mode 100755 index af6e9c448c36..9feffd9d28db Binary files a/tests/cpp-tests/Resources/hd/ActionTimeline/testAnimationResource/4.png and b/tests/cpp-tests/Resources/hd/ActionTimeline/testAnimationResource/4.png differ diff --git a/tests/cpp-tests/Resources/hd/ActionTimeline/testAnimationResource/5.png b/tests/cpp-tests/Resources/hd/ActionTimeline/testAnimationResource/5.png old mode 100644 new mode 100755 index caa125f36605..dae73f97a39a Binary files a/tests/cpp-tests/Resources/hd/ActionTimeline/testAnimationResource/5.png and b/tests/cpp-tests/Resources/hd/ActionTimeline/testAnimationResource/5.png differ diff --git a/tests/cpp-tests/Resources/hd/ActionTimeline/testAnimationResource/6.png b/tests/cpp-tests/Resources/hd/ActionTimeline/testAnimationResource/6.png old mode 100644 new mode 100755 index 2a01180b250e..4278626d74f7 Binary files a/tests/cpp-tests/Resources/hd/ActionTimeline/testAnimationResource/6.png and b/tests/cpp-tests/Resources/hd/ActionTimeline/testAnimationResource/6.png differ diff --git a/tests/cpp-tests/Resources/hd/ActionTimeline/testAnimationResource/7.png b/tests/cpp-tests/Resources/hd/ActionTimeline/testAnimationResource/7.png old mode 100644 new mode 100755 index d0d79054c38a..2eb4e1a90357 Binary files a/tests/cpp-tests/Resources/hd/ActionTimeline/testAnimationResource/7.png and b/tests/cpp-tests/Resources/hd/ActionTimeline/testAnimationResource/7.png differ diff --git a/tests/cpp-tests/Resources/hd/ActionTimeline/testAnimationResource/8.png b/tests/cpp-tests/Resources/hd/ActionTimeline/testAnimationResource/8.png old mode 100644 new mode 100755 index 48ed9d24542c..2fe061f5f3e4 Binary files a/tests/cpp-tests/Resources/hd/ActionTimeline/testAnimationResource/8.png and b/tests/cpp-tests/Resources/hd/ActionTimeline/testAnimationResource/8.png differ diff --git a/tests/cpp-tests/Resources/hd/ActionTimeline/testAnimationResource/hat.png b/tests/cpp-tests/Resources/hd/ActionTimeline/testAnimationResource/hat.png old mode 100644 new mode 100755 index fe31d709e470..f46f7b95fd4b Binary files a/tests/cpp-tests/Resources/hd/ActionTimeline/testAnimationResource/hat.png and b/tests/cpp-tests/Resources/hd/ActionTimeline/testAnimationResource/hat.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/CyanSquare.png b/tests/cpp-tests/Resources/hd/Images/CyanSquare.png old mode 100644 new mode 100755 index 3fd1055156d9..f552f44956d4 Binary files a/tests/cpp-tests/Resources/hd/Images/CyanSquare.png and b/tests/cpp-tests/Resources/hd/Images/CyanSquare.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/Icon.png b/tests/cpp-tests/Resources/hd/Images/Icon.png old mode 100644 new mode 100755 index 0b3da9cfd46b..eea077ca2d4b Binary files a/tests/cpp-tests/Resources/hd/Images/Icon.png and b/tests/cpp-tests/Resources/hd/Images/Icon.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/MagentaSquare.png b/tests/cpp-tests/Resources/hd/Images/MagentaSquare.png old mode 100644 new mode 100755 index d58b52414cc2..c81a4387fcf2 Binary files a/tests/cpp-tests/Resources/hd/Images/MagentaSquare.png and b/tests/cpp-tests/Resources/hd/Images/MagentaSquare.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/YellowSquare.png b/tests/cpp-tests/Resources/hd/Images/YellowSquare.png old mode 100644 new mode 100755 index 370d45155ac2..85ee45ad4315 Binary files a/tests/cpp-tests/Resources/hd/Images/YellowSquare.png and b/tests/cpp-tests/Resources/hd/Images/YellowSquare.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/arrows.png b/tests/cpp-tests/Resources/hd/Images/arrows.png old mode 100644 new mode 100755 index 7c37dc0e9bf9..2bb760a397f3 Binary files a/tests/cpp-tests/Resources/hd/Images/arrows.png and b/tests/cpp-tests/Resources/hd/Images/arrows.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/arrowsBar.png b/tests/cpp-tests/Resources/hd/Images/arrowsBar.png old mode 100644 new mode 100755 index 7e4d9fab007a..41b0735179b0 Binary files a/tests/cpp-tests/Resources/hd/Images/arrowsBar.png and b/tests/cpp-tests/Resources/hd/Images/arrowsBar.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/b1.png b/tests/cpp-tests/Resources/hd/Images/b1.png old mode 100644 new mode 100755 index f75fcfc0ab45..8e799db7afe2 Binary files a/tests/cpp-tests/Resources/hd/Images/b1.png and b/tests/cpp-tests/Resources/hd/Images/b1.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/b2.png b/tests/cpp-tests/Resources/hd/Images/b2.png old mode 100644 new mode 100755 index a25b33839d89..3ceb3e6ccf2c Binary files a/tests/cpp-tests/Resources/hd/Images/b2.png and b/tests/cpp-tests/Resources/hd/Images/b2.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/background1.png b/tests/cpp-tests/Resources/hd/Images/background1.png old mode 100644 new mode 100755 index fe13e1342b0b..f3e0bb43f458 Binary files a/tests/cpp-tests/Resources/hd/Images/background1.png and b/tests/cpp-tests/Resources/hd/Images/background1.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/background2.png b/tests/cpp-tests/Resources/hd/Images/background2.png old mode 100644 new mode 100755 index 93a959603e38..4075ef39c08e Binary files a/tests/cpp-tests/Resources/hd/Images/background2.png and b/tests/cpp-tests/Resources/hd/Images/background2.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/background3.png b/tests/cpp-tests/Resources/hd/Images/background3.png old mode 100644 new mode 100755 index cac2d5b37850..deef861517ea Binary files a/tests/cpp-tests/Resources/hd/Images/background3.png and b/tests/cpp-tests/Resources/hd/Images/background3.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/ball.png b/tests/cpp-tests/Resources/hd/Images/ball.png old mode 100644 new mode 100755 index f9ee6a8cf305..a9b5b569b813 Binary files a/tests/cpp-tests/Resources/hd/Images/ball.png and b/tests/cpp-tests/Resources/hd/Images/ball.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/blocks.png b/tests/cpp-tests/Resources/hd/Images/blocks.png old mode 100644 new mode 100755 index 8732203541ad..64ed615e86bf Binary files a/tests/cpp-tests/Resources/hd/Images/blocks.png and b/tests/cpp-tests/Resources/hd/Images/blocks.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/blocks9.png b/tests/cpp-tests/Resources/hd/Images/blocks9.png old mode 100644 new mode 100755 index e02b39b59641..e41ca2c49289 Binary files a/tests/cpp-tests/Resources/hd/Images/blocks9.png and b/tests/cpp-tests/Resources/hd/Images/blocks9.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/blocks9c.png b/tests/cpp-tests/Resources/hd/Images/blocks9c.png index 058c413592f8..2dca8583566c 100644 Binary files a/tests/cpp-tests/Resources/hd/Images/blocks9c.png and b/tests/cpp-tests/Resources/hd/Images/blocks9c.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/blocks9cr.png b/tests/cpp-tests/Resources/hd/Images/blocks9cr.png index e2fd52de143d..74fc6c8b01e2 100644 Binary files a/tests/cpp-tests/Resources/hd/Images/blocks9cr.png and b/tests/cpp-tests/Resources/hd/Images/blocks9cr.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/blocks9r.png b/tests/cpp-tests/Resources/hd/Images/blocks9r.png index ca6ec1a5e3ea..79c0c94604b8 100644 Binary files a/tests/cpp-tests/Resources/hd/Images/blocks9r.png and b/tests/cpp-tests/Resources/hd/Images/blocks9r.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/blocks9ss.png b/tests/cpp-tests/Resources/hd/Images/blocks9ss.png old mode 100644 new mode 100755 index 135d018d21e6..5fc40c4f417c Binary files a/tests/cpp-tests/Resources/hd/Images/blocks9ss.png and b/tests/cpp-tests/Resources/hd/Images/blocks9ss.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/bugs/circle.png b/tests/cpp-tests/Resources/hd/Images/bugs/circle.png old mode 100644 new mode 100755 index 117b5b4f49a5..6afff53d2948 Binary files a/tests/cpp-tests/Resources/hd/Images/bugs/circle.png and b/tests/cpp-tests/Resources/hd/Images/bugs/circle.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/bugs/picture.png b/tests/cpp-tests/Resources/hd/Images/bugs/picture.png old mode 100644 new mode 100755 index 8cfe2d06ee1e..0c3c568d5ceb Binary files a/tests/cpp-tests/Resources/hd/Images/bugs/picture.png and b/tests/cpp-tests/Resources/hd/Images/bugs/picture.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/bugs/test_issue_1179.png b/tests/cpp-tests/Resources/hd/Images/bugs/test_issue_1179.png old mode 100644 new mode 100755 index 5d82829999bb..04722e626e86 Binary files a/tests/cpp-tests/Resources/hd/Images/bugs/test_issue_1179.png and b/tests/cpp-tests/Resources/hd/Images/bugs/test_issue_1179.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/close.png b/tests/cpp-tests/Resources/hd/Images/close.png old mode 100644 new mode 100755 index 5edfc3733007..4b4d817e44b3 Binary files a/tests/cpp-tests/Resources/hd/Images/close.png and b/tests/cpp-tests/Resources/hd/Images/close.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/f1.png b/tests/cpp-tests/Resources/hd/Images/f1.png old mode 100644 new mode 100755 index 8162430b88ff..be28b78e34dc Binary files a/tests/cpp-tests/Resources/hd/Images/f1.png and b/tests/cpp-tests/Resources/hd/Images/f1.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/f2.png b/tests/cpp-tests/Resources/hd/Images/f2.png old mode 100644 new mode 100755 index 3b7f0e54c2ef..f933ad1d1fee Binary files a/tests/cpp-tests/Resources/hd/Images/f2.png and b/tests/cpp-tests/Resources/hd/Images/f2.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/grossini.png b/tests/cpp-tests/Resources/hd/Images/grossini.png old mode 100644 new mode 100755 index 679f03e4bf0b..a0a76f5c2fd2 Binary files a/tests/cpp-tests/Resources/hd/Images/grossini.png and b/tests/cpp-tests/Resources/hd/Images/grossini.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/grossini_dance_01.png b/tests/cpp-tests/Resources/hd/Images/grossini_dance_01.png old mode 100644 new mode 100755 index 7cd70d0883c6..2a8aab20150e Binary files a/tests/cpp-tests/Resources/hd/Images/grossini_dance_01.png and b/tests/cpp-tests/Resources/hd/Images/grossini_dance_01.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/grossini_dance_02.png b/tests/cpp-tests/Resources/hd/Images/grossini_dance_02.png old mode 100644 new mode 100755 index 238bbb92fe8c..b2052cb72749 Binary files a/tests/cpp-tests/Resources/hd/Images/grossini_dance_02.png and b/tests/cpp-tests/Resources/hd/Images/grossini_dance_02.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/grossini_dance_03.png b/tests/cpp-tests/Resources/hd/Images/grossini_dance_03.png old mode 100644 new mode 100755 index 5555d3869c3d..da543a9b9213 Binary files a/tests/cpp-tests/Resources/hd/Images/grossini_dance_03.png and b/tests/cpp-tests/Resources/hd/Images/grossini_dance_03.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/grossini_dance_04.png b/tests/cpp-tests/Resources/hd/Images/grossini_dance_04.png old mode 100644 new mode 100755 index 0c3a8a458321..6653968f8917 Binary files a/tests/cpp-tests/Resources/hd/Images/grossini_dance_04.png and b/tests/cpp-tests/Resources/hd/Images/grossini_dance_04.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/grossini_dance_05.png b/tests/cpp-tests/Resources/hd/Images/grossini_dance_05.png old mode 100644 new mode 100755 index a143cea5caa7..ccb8f72b1bc4 Binary files a/tests/cpp-tests/Resources/hd/Images/grossini_dance_05.png and b/tests/cpp-tests/Resources/hd/Images/grossini_dance_05.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/grossini_dance_06.png b/tests/cpp-tests/Resources/hd/Images/grossini_dance_06.png old mode 100644 new mode 100755 index c77484773b85..d26bd64997fd Binary files a/tests/cpp-tests/Resources/hd/Images/grossini_dance_06.png and b/tests/cpp-tests/Resources/hd/Images/grossini_dance_06.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/grossini_dance_07.png b/tests/cpp-tests/Resources/hd/Images/grossini_dance_07.png old mode 100644 new mode 100755 index e7280a941f8a..b58d9df9f9b5 Binary files a/tests/cpp-tests/Resources/hd/Images/grossini_dance_07.png and b/tests/cpp-tests/Resources/hd/Images/grossini_dance_07.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/grossini_dance_08.png b/tests/cpp-tests/Resources/hd/Images/grossini_dance_08.png old mode 100644 new mode 100755 index 6c62b5cc91d7..4fad28ce487c Binary files a/tests/cpp-tests/Resources/hd/Images/grossini_dance_08.png and b/tests/cpp-tests/Resources/hd/Images/grossini_dance_08.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/grossini_dance_09.png b/tests/cpp-tests/Resources/hd/Images/grossini_dance_09.png old mode 100644 new mode 100755 index 63fa988aa2ee..eaf6644b8a7f Binary files a/tests/cpp-tests/Resources/hd/Images/grossini_dance_09.png and b/tests/cpp-tests/Resources/hd/Images/grossini_dance_09.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/grossini_dance_10.png b/tests/cpp-tests/Resources/hd/Images/grossini_dance_10.png old mode 100644 new mode 100755 index fae3115da7a0..095ae812dd51 Binary files a/tests/cpp-tests/Resources/hd/Images/grossini_dance_10.png and b/tests/cpp-tests/Resources/hd/Images/grossini_dance_10.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/grossini_dance_11.png b/tests/cpp-tests/Resources/hd/Images/grossini_dance_11.png old mode 100644 new mode 100755 index 065618daccd8..8d6848d4e1f6 Binary files a/tests/cpp-tests/Resources/hd/Images/grossini_dance_11.png and b/tests/cpp-tests/Resources/hd/Images/grossini_dance_11.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/grossini_dance_12.png b/tests/cpp-tests/Resources/hd/Images/grossini_dance_12.png old mode 100644 new mode 100755 index 33a521bccfef..f062bde9f725 Binary files a/tests/cpp-tests/Resources/hd/Images/grossini_dance_12.png and b/tests/cpp-tests/Resources/hd/Images/grossini_dance_12.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/grossini_dance_13.png b/tests/cpp-tests/Resources/hd/Images/grossini_dance_13.png old mode 100644 new mode 100755 index d9c901498293..3df970d98188 Binary files a/tests/cpp-tests/Resources/hd/Images/grossini_dance_13.png and b/tests/cpp-tests/Resources/hd/Images/grossini_dance_13.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/grossini_dance_14.png b/tests/cpp-tests/Resources/hd/Images/grossini_dance_14.png old mode 100644 new mode 100755 index bd1066fc4278..92a4bc904199 Binary files a/tests/cpp-tests/Resources/hd/Images/grossini_dance_14.png and b/tests/cpp-tests/Resources/hd/Images/grossini_dance_14.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/grossini_dance_atlas.png b/tests/cpp-tests/Resources/hd/Images/grossini_dance_atlas.png old mode 100644 new mode 100755 index c19b3a0288d3..9a8bb38c10c6 Binary files a/tests/cpp-tests/Resources/hd/Images/grossini_dance_atlas.png and b/tests/cpp-tests/Resources/hd/Images/grossini_dance_atlas.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/grossinis_sister1.png b/tests/cpp-tests/Resources/hd/Images/grossinis_sister1.png old mode 100644 new mode 100755 index eda158d60768..ec22292e11b9 Binary files a/tests/cpp-tests/Resources/hd/Images/grossinis_sister1.png and b/tests/cpp-tests/Resources/hd/Images/grossinis_sister1.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/grossinis_sister2.png b/tests/cpp-tests/Resources/hd/Images/grossinis_sister2.png old mode 100644 new mode 100755 index 64536ebc6732..c3b392d1e8df Binary files a/tests/cpp-tests/Resources/hd/Images/grossinis_sister2.png and b/tests/cpp-tests/Resources/hd/Images/grossinis_sister2.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/hole_effect.png b/tests/cpp-tests/Resources/hd/Images/hole_effect.png old mode 100644 new mode 100755 index 799434284c2d..50eddb1c12a5 Binary files a/tests/cpp-tests/Resources/hd/Images/hole_effect.png and b/tests/cpp-tests/Resources/hd/Images/hole_effect.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/hole_stencil.png b/tests/cpp-tests/Resources/hd/Images/hole_stencil.png old mode 100644 new mode 100755 index 1fe600d264c2..253d46d5475f Binary files a/tests/cpp-tests/Resources/hd/Images/hole_stencil.png and b/tests/cpp-tests/Resources/hd/Images/hole_stencil.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/paddle.png b/tests/cpp-tests/Resources/hd/Images/paddle.png old mode 100644 new mode 100755 index 2b0d6e711543..43520a61ae1e Binary files a/tests/cpp-tests/Resources/hd/Images/paddle.png and b/tests/cpp-tests/Resources/hd/Images/paddle.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/particles.png b/tests/cpp-tests/Resources/hd/Images/particles.png old mode 100644 new mode 100755 index 2ba77b9e489d..be07eba22202 Binary files a/tests/cpp-tests/Resources/hd/Images/particles.png and b/tests/cpp-tests/Resources/hd/Images/particles.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/r1.png b/tests/cpp-tests/Resources/hd/Images/r1.png old mode 100644 new mode 100755 index 5fe4c448b84a..41cbbb5d6f21 Binary files a/tests/cpp-tests/Resources/hd/Images/r1.png and b/tests/cpp-tests/Resources/hd/Images/r1.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/r2.png b/tests/cpp-tests/Resources/hd/Images/r2.png old mode 100644 new mode 100755 index 5686801927f1..676732f19dcf Binary files a/tests/cpp-tests/Resources/hd/Images/r2.png and b/tests/cpp-tests/Resources/hd/Images/r2.png differ diff --git a/tests/cpp-tests/Resources/hd/Images/ui.png b/tests/cpp-tests/Resources/hd/Images/ui.png old mode 100644 new mode 100755 index 2bcd8796eced..a14a4fbcf158 Binary files a/tests/cpp-tests/Resources/hd/Images/ui.png and b/tests/cpp-tests/Resources/hd/Images/ui.png differ diff --git a/tests/cpp-tests/Resources/hd/TileMaps/tiles.png b/tests/cpp-tests/Resources/hd/TileMaps/tiles.png old mode 100644 new mode 100755 index 51e989d5486d..187cfee7878d Binary files a/tests/cpp-tests/Resources/hd/TileMaps/tiles.png and b/tests/cpp-tests/Resources/hd/TileMaps/tiles.png differ diff --git a/tests/cpp-tests/Resources/hd/TileMaps/tmw_desert_spacing.png b/tests/cpp-tests/Resources/hd/TileMaps/tmw_desert_spacing.png old mode 100644 new mode 100755 index 22f29806e2b7..1c62fbf263a3 Binary files a/tests/cpp-tests/Resources/hd/TileMaps/tmw_desert_spacing.png and b/tests/cpp-tests/Resources/hd/TileMaps/tmw_desert_spacing.png differ diff --git a/tests/cpp-tests/Resources/hd/animations/dragon_animation.png b/tests/cpp-tests/Resources/hd/animations/dragon_animation.png old mode 100644 new mode 100755 index ac05aa637748..8fbe949c1f00 Binary files a/tests/cpp-tests/Resources/hd/animations/dragon_animation.png and b/tests/cpp-tests/Resources/hd/animations/dragon_animation.png differ diff --git a/tests/cpp-tests/Resources/hd/components/Player.png b/tests/cpp-tests/Resources/hd/components/Player.png old mode 100644 new mode 100755 index b1a423980704..312351e40871 Binary files a/tests/cpp-tests/Resources/hd/components/Player.png and b/tests/cpp-tests/Resources/hd/components/Player.png differ diff --git a/tests/cpp-tests/Resources/hd/components/Projectile.png b/tests/cpp-tests/Resources/hd/components/Projectile.png old mode 100644 new mode 100755 index 63c3fe69f8cc..aae84e1ddad9 Binary files a/tests/cpp-tests/Resources/hd/components/Projectile.png and b/tests/cpp-tests/Resources/hd/components/Projectile.png differ diff --git a/tests/cpp-tests/Resources/hd/components/Target.png b/tests/cpp-tests/Resources/hd/components/Target.png old mode 100644 new mode 100755 index 509f0bb695a0..76dc863da22d Binary files a/tests/cpp-tests/Resources/hd/components/Target.png and b/tests/cpp-tests/Resources/hd/components/Target.png differ diff --git a/tests/cpp-tests/Resources/hd/extensions/CCControlColourPickerSpriteSheet.png b/tests/cpp-tests/Resources/hd/extensions/CCControlColourPickerSpriteSheet.png old mode 100644 new mode 100755 index bed750a6350c..b2f6361a8a74 Binary files a/tests/cpp-tests/Resources/hd/extensions/CCControlColourPickerSpriteSheet.png and b/tests/cpp-tests/Resources/hd/extensions/CCControlColourPickerSpriteSheet.png differ diff --git a/tests/cpp-tests/Resources/hd/extensions/background.png b/tests/cpp-tests/Resources/hd/extensions/background.png old mode 100644 new mode 100755 index 18f17c486f46..eff519b0334e Binary files a/tests/cpp-tests/Resources/hd/extensions/background.png and b/tests/cpp-tests/Resources/hd/extensions/background.png differ diff --git a/tests/cpp-tests/Resources/hd/extensions/button.png b/tests/cpp-tests/Resources/hd/extensions/button.png old mode 100644 new mode 100755 index 41a085d4aaa7..03aebc7bac18 Binary files a/tests/cpp-tests/Resources/hd/extensions/button.png and b/tests/cpp-tests/Resources/hd/extensions/button.png differ diff --git a/tests/cpp-tests/Resources/hd/extensions/buttonHighlighted.png b/tests/cpp-tests/Resources/hd/extensions/buttonHighlighted.png old mode 100644 new mode 100755 index a3bbd452724d..8bc814d3f037 Binary files a/tests/cpp-tests/Resources/hd/extensions/buttonHighlighted.png and b/tests/cpp-tests/Resources/hd/extensions/buttonHighlighted.png differ diff --git a/tests/cpp-tests/Resources/hd/extensions/potentiometerButton.png b/tests/cpp-tests/Resources/hd/extensions/potentiometerButton.png old mode 100644 new mode 100755 index b7da8c297a47..b729c31617bd Binary files a/tests/cpp-tests/Resources/hd/extensions/potentiometerButton.png and b/tests/cpp-tests/Resources/hd/extensions/potentiometerButton.png differ diff --git a/tests/cpp-tests/Resources/hd/extensions/potentiometerProgress.png b/tests/cpp-tests/Resources/hd/extensions/potentiometerProgress.png old mode 100644 new mode 100755 index c9ce448d02ca..683041699ff9 Binary files a/tests/cpp-tests/Resources/hd/extensions/potentiometerProgress.png and b/tests/cpp-tests/Resources/hd/extensions/potentiometerProgress.png differ diff --git a/tests/cpp-tests/Resources/hd/extensions/potentiometerTrack.png b/tests/cpp-tests/Resources/hd/extensions/potentiometerTrack.png old mode 100644 new mode 100755 index 1e84864d543e..0cfcc5553bd1 Binary files a/tests/cpp-tests/Resources/hd/extensions/potentiometerTrack.png and b/tests/cpp-tests/Resources/hd/extensions/potentiometerTrack.png differ diff --git a/tests/cpp-tests/Resources/hd/extensions/ribbon.png b/tests/cpp-tests/Resources/hd/extensions/ribbon.png old mode 100644 new mode 100755 index 0088ea0bf3a1..28583f52b5f4 Binary files a/tests/cpp-tests/Resources/hd/extensions/ribbon.png and b/tests/cpp-tests/Resources/hd/extensions/ribbon.png differ diff --git a/tests/cpp-tests/Resources/hd/extensions/sliderProgress.png b/tests/cpp-tests/Resources/hd/extensions/sliderProgress.png old mode 100644 new mode 100755 index 52795beab46f..f78bfc1b0d1a Binary files a/tests/cpp-tests/Resources/hd/extensions/sliderProgress.png and b/tests/cpp-tests/Resources/hd/extensions/sliderProgress.png differ diff --git a/tests/cpp-tests/Resources/hd/extensions/sliderProgress2.png b/tests/cpp-tests/Resources/hd/extensions/sliderProgress2.png old mode 100644 new mode 100755 index a01ad0223d02..81d517307d7e Binary files a/tests/cpp-tests/Resources/hd/extensions/sliderProgress2.png and b/tests/cpp-tests/Resources/hd/extensions/sliderProgress2.png differ diff --git a/tests/cpp-tests/Resources/hd/extensions/sliderThumb.png b/tests/cpp-tests/Resources/hd/extensions/sliderThumb.png old mode 100644 new mode 100755 index 27e4965889a1..d9a0abdf16c6 Binary files a/tests/cpp-tests/Resources/hd/extensions/sliderThumb.png and b/tests/cpp-tests/Resources/hd/extensions/sliderThumb.png differ diff --git a/tests/cpp-tests/Resources/hd/extensions/sliderTrack.png b/tests/cpp-tests/Resources/hd/extensions/sliderTrack.png old mode 100644 new mode 100755 index f0b3de458306..a803eb5c57a6 Binary files a/tests/cpp-tests/Resources/hd/extensions/sliderTrack.png and b/tests/cpp-tests/Resources/hd/extensions/sliderTrack.png differ diff --git a/tests/cpp-tests/Resources/hd/extensions/sliderTrack2.png b/tests/cpp-tests/Resources/hd/extensions/sliderTrack2.png old mode 100644 new mode 100755 index c3b8b28013f4..59b8dc91b11c Binary files a/tests/cpp-tests/Resources/hd/extensions/sliderTrack2.png and b/tests/cpp-tests/Resources/hd/extensions/sliderTrack2.png differ diff --git a/tests/cpp-tests/Resources/hd/extensions/stepper-minus.png b/tests/cpp-tests/Resources/hd/extensions/stepper-minus.png old mode 100644 new mode 100755 index 333363d3d887..8d3e18ed5283 Binary files a/tests/cpp-tests/Resources/hd/extensions/stepper-minus.png and b/tests/cpp-tests/Resources/hd/extensions/stepper-minus.png differ diff --git a/tests/cpp-tests/Resources/hd/extensions/stepper-plus.png b/tests/cpp-tests/Resources/hd/extensions/stepper-plus.png old mode 100644 new mode 100755 index 1731eddcad50..ef6de5e5d026 Binary files a/tests/cpp-tests/Resources/hd/extensions/stepper-plus.png and b/tests/cpp-tests/Resources/hd/extensions/stepper-plus.png differ diff --git a/tests/cpp-tests/Resources/hd/fonts/font-issue1343.png b/tests/cpp-tests/Resources/hd/fonts/font-issue1343.png old mode 100644 new mode 100755 index 36d7d4bf622c..a6ca8414e453 Binary files a/tests/cpp-tests/Resources/hd/fonts/font-issue1343.png and b/tests/cpp-tests/Resources/hd/fonts/font-issue1343.png differ diff --git a/tests/cpp-tests/Resources/hd/fonts/konqa32.png b/tests/cpp-tests/Resources/hd/fonts/konqa32.png old mode 100644 new mode 100755 index dfb34878c17e..051e8d5bd30f Binary files a/tests/cpp-tests/Resources/hd/fonts/konqa32.png and b/tests/cpp-tests/Resources/hd/fonts/konqa32.png differ diff --git a/tests/cpp-tests/Resources/hd/fonts/labelatlas.png b/tests/cpp-tests/Resources/hd/fonts/labelatlas.png old mode 100644 new mode 100755 index e79887debff6..bb8ce11e54c2 Binary files a/tests/cpp-tests/Resources/hd/fonts/labelatlas.png and b/tests/cpp-tests/Resources/hd/fonts/labelatlas.png differ diff --git a/tests/cpp-tests/Resources/hd/fonts/larabie-16.png b/tests/cpp-tests/Resources/hd/fonts/larabie-16.png old mode 100644 new mode 100755 index cc8d988554c8..f860d02fabee Binary files a/tests/cpp-tests/Resources/hd/fonts/larabie-16.png and b/tests/cpp-tests/Resources/hd/fonts/larabie-16.png differ diff --git a/tests/cpp-tests/Resources/hd/fonts/markerFelt.png b/tests/cpp-tests/Resources/hd/fonts/markerFelt.png old mode 100644 new mode 100755 index d3088bec6c9a..3988cfdf6548 Binary files a/tests/cpp-tests/Resources/hd/fonts/markerFelt.png and b/tests/cpp-tests/Resources/hd/fonts/markerFelt.png differ diff --git a/tests/cpp-tests/Resources/hd/fonts/tuffy_bold_italic-charmap.png b/tests/cpp-tests/Resources/hd/fonts/tuffy_bold_italic-charmap.png old mode 100644 new mode 100755 index 370761c10a6b..8167faf6c40f Binary files a/tests/cpp-tests/Resources/hd/fonts/tuffy_bold_italic-charmap.png and b/tests/cpp-tests/Resources/hd/fonts/tuffy_bold_italic-charmap.png differ diff --git a/tests/cpp-tests/Resources/hd/fps_images.png b/tests/cpp-tests/Resources/hd/fps_images.png index 98d2069a19c5..54a299ed9189 100644 Binary files a/tests/cpp-tests/Resources/hd/fps_images.png and b/tests/cpp-tests/Resources/hd/fps_images.png differ diff --git a/tests/cpp-tests/Resources/spine/coin.png b/tests/cpp-tests/Resources/spine/coin.png index d4481accd4a1..7d14a6b6f98c 100644 Binary files a/tests/cpp-tests/Resources/spine/coin.png and b/tests/cpp-tests/Resources/spine/coin.png differ diff --git a/tests/cpp-tests/Resources/spine/goblins.png b/tests/cpp-tests/Resources/spine/goblins.png index cadd1c621aa6..9d1ae572a556 100644 Binary files a/tests/cpp-tests/Resources/spine/goblins.png and b/tests/cpp-tests/Resources/spine/goblins.png differ diff --git a/tests/cpp-tests/Resources/spine/raptor.png b/tests/cpp-tests/Resources/spine/raptor.png index 0df1ac967103..f8d67bd9f6fd 100644 Binary files a/tests/cpp-tests/Resources/spine/raptor.png and b/tests/cpp-tests/Resources/spine/raptor.png differ diff --git a/tests/cpp-tests/Resources/spine/spineboy.png b/tests/cpp-tests/Resources/spine/spineboy.png index 12563a27e186..dc771e870b21 100644 Binary files a/tests/cpp-tests/Resources/spine/spineboy.png and b/tests/cpp-tests/Resources/spine/spineboy.png differ diff --git a/tests/cpp-tests/Resources/spine/sprite.png b/tests/cpp-tests/Resources/spine/sprite.png index b8aff3768a77..91dd46533758 100644 Binary files a/tests/cpp-tests/Resources/spine/sprite.png and b/tests/cpp-tests/Resources/spine/sprite.png differ diff --git a/tests/cpp-tests/Resources/spine/tank.png b/tests/cpp-tests/Resources/spine/tank.png index 6774d7e7db1d..29481daf898e 100644 Binary files a/tests/cpp-tests/Resources/spine/tank.png and b/tests/cpp-tests/Resources/spine/tank.png differ diff --git a/tests/cpp-tests/Resources/zwoptex/grossini-generic.png b/tests/cpp-tests/Resources/zwoptex/grossini-generic.png old mode 100644 new mode 100755 index 15803e5a5973..5c0bbc67c854 Binary files a/tests/cpp-tests/Resources/zwoptex/grossini-generic.png and b/tests/cpp-tests/Resources/zwoptex/grossini-generic.png differ diff --git a/tests/cpp-tests/Resources/zwoptex/grossini.png b/tests/cpp-tests/Resources/zwoptex/grossini.png old mode 100644 new mode 100755 index 15803e5a5973..5c0bbc67c854 Binary files a/tests/cpp-tests/Resources/zwoptex/grossini.png and b/tests/cpp-tests/Resources/zwoptex/grossini.png differ diff --git a/tests/cpp-tests/proj.android/app/AndroidManifest.xml b/tests/cpp-tests/proj.android/app/AndroidManifest.xml index c7d83e557293..82be4ae7c060 100644 --- a/tests/cpp-tests/proj.android/app/AndroidManifest.xml +++ b/tests/cpp-tests/proj.android/app/AndroidManifest.xml @@ -8,6 +8,7 @@ diff --git a/tests/cpp-tests/proj.android/app/build.gradle b/tests/cpp-tests/proj.android/app/build.gradle index 0d76faa4690b..919d60d99ee3 100644 --- a/tests/cpp-tests/proj.android/app/build.gradle +++ b/tests/cpp-tests/proj.android/app/build.gradle @@ -34,9 +34,8 @@ android { else if (PROP_BUILD_TYPE == 'cmake') { cmake { targets 'cpp_tests' - arguments "-DCMAKE_FIND_ROOT_PATH=", "-DANDROID_STL=c++_static", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE", \ - "-DUSE_CHIPMUNK=TRUE", "-DUSE_BULLET=TRUE" - cppFlags "-frtti -fexceptions" + arguments "-DCMAKE_FIND_ROOT_PATH=", "-DANDROID_STL=c++_static", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE" + cppFlags "-frtti -fexceptions -fsigned-char" } } } @@ -51,6 +50,7 @@ android { java.srcDir "src" res.srcDir "res" manifest.srcFile "AndroidManifest.xml" + assets.srcDir "assets" } externalNativeBuild { @@ -111,16 +111,18 @@ android { } android.applicationVariants.all { variant -> - // delete previous files first - delete "${buildDir}/intermediates/assets/${variant.dirName}" - variant.mergeAssets.doLast { + delete "${projectDir}/assets" + def targetName = variant.name.capitalize() + def copyTaskName = "copy${targetName}ResourcesToAssets" + tasks.register(copyTaskName) { copy { - from "${buildDir}/../../../Resources" - into "${buildDir}/intermediates/assets/${variant.dirName}" - exclude "**/*.gz" + from "${projectDir}/../../Resources" + into "${projectDir}/assets" + exclude "**/*.gz" } } + tasks.getByName("pre${targetName}Build").dependsOn copyTaskName } dependencies { diff --git a/tests/cpp-tests/proj.android/app/proguard-rules.pro b/tests/cpp-tests/proj.android/app/proguard-rules.pro index c3d6dcccaedf..dcbc4e39da25 100644 --- a/tests/cpp-tests/proj.android/app/proguard-rules.pro +++ b/tests/cpp-tests/proj.android/app/proguard-rules.pro @@ -23,6 +23,8 @@ -dontwarn com.chukong.** -keep public class com.huawei.android.** { *; } -dontwarn com.huawei.android.** +-keep public class com.oppo.oiface.engine.** { *; } +-dontwarn com.oppo.oiface.engine.** # Proguard Apache HTTP for release -keep class org.apache.http.** { *; } diff --git a/tests/cpp-tests/proj.android/app/res/mipmap-hdpi/ic_launcher.png b/tests/cpp-tests/proj.android/app/res/mipmap-hdpi/ic_launcher.png index 347369290269..45ee51d15f96 100644 Binary files a/tests/cpp-tests/proj.android/app/res/mipmap-hdpi/ic_launcher.png and b/tests/cpp-tests/proj.android/app/res/mipmap-hdpi/ic_launcher.png differ diff --git a/tests/cpp-tests/proj.android/app/res/mipmap-mdpi/ic_launcher.png b/tests/cpp-tests/proj.android/app/res/mipmap-mdpi/ic_launcher.png index b1b7749de25d..0dd2a608998e 100644 Binary files a/tests/cpp-tests/proj.android/app/res/mipmap-mdpi/ic_launcher.png and b/tests/cpp-tests/proj.android/app/res/mipmap-mdpi/ic_launcher.png differ diff --git a/tests/cpp-tests/proj.android/app/res/mipmap-xhdpi/ic_launcher.png b/tests/cpp-tests/proj.android/app/res/mipmap-xhdpi/ic_launcher.png index da139dcd9853..a32f16f930b3 100644 Binary files a/tests/cpp-tests/proj.android/app/res/mipmap-xhdpi/ic_launcher.png and b/tests/cpp-tests/proj.android/app/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/tests/cpp-tests/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png b/tests/cpp-tests/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png index 6726b2fe032d..332f268edc46 100644 Binary files a/tests/cpp-tests/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png and b/tests/cpp-tests/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/tests/cpp-tests/proj.android/build.gradle b/tests/cpp-tests/proj.android/build.gradle index 5dff94de2a97..63697d83ac6c 100644 --- a/tests/cpp-tests/proj.android/build.gradle +++ b/tests/cpp-tests/proj.android/build.gradle @@ -7,7 +7,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.1.0' + classpath 'com.android.tools.build:gradle:3.4.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/tests/cpp-tests/proj.android/gradle/wrapper/gradle-wrapper.properties b/tests/cpp-tests/proj.android/gradle/wrapper/gradle-wrapper.properties index 6d0176c62e52..e743e60d3ae3 100644 --- a/tests/cpp-tests/proj.android/gradle/wrapper/gradle-wrapper.properties +++ b/tests/cpp-tests/proj.android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip diff --git a/tests/cpp-tests/proj.android/settings.gradle b/tests/cpp-tests/proj.android/settings.gradle index 20644fa006fd..72c6f3a475f8 100644 --- a/tests/cpp-tests/proj.android/settings.gradle +++ b/tests/cpp-tests/proj.android/settings.gradle @@ -2,3 +2,4 @@ include ':libcocos2dx' project(':libcocos2dx').projectDir = new File(settingsDir, '../../../cocos/platform/android/libcocos2dx') include ':CppTests' project(':CppTests').projectDir = new File(settingsDir, 'app') +rootProject.name = "cpp-tests" diff --git a/tests/cpp-tests/proj.ios/Classes/RootViewController.mm b/tests/cpp-tests/proj.ios/Classes/RootViewController.mm index 3f484988f3a8..3c3b0cbefe41 100644 --- a/tests/cpp-tests/proj.ios/Classes/RootViewController.mm +++ b/tests/cpp-tests/proj.ios/Classes/RootViewController.mm @@ -25,7 +25,7 @@ of this software and associated documentation files (the "Software"), to deal ****************************************************************************/ #import "RootViewController.h" - +#import "platform/ios/CCDirectorCaller-ios.h" @implementation RootViewController @@ -50,8 +50,15 @@ - (void)loadView { - (void)viewDidLoad { [super viewDidLoad]; } - */ + +//In iOS 12.0+, Screen Time's bug cause UIApplicationDidBecomeActiveNotification and UIApplicationWillResignActiveNotification do not fired +//so we need to active CCDirectorCaller manually +-(void)viewDidAppear:(BOOL)animated{ + [super viewDidAppear:animated]; + [[CCDirectorCaller sharedDirectorCaller] setActive:YES]; +} + // Override to allow orientations other than the default portrait orientation. // This method is deprecated on ios6 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { diff --git a/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-20.png b/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-20.png index 5d49de2c3d34..8ead23e36507 100644 Binary files a/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-20.png and b/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-20.png differ diff --git a/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-20@2x.png b/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-20@2x.png index 5b009b8c3263..775685daca94 100644 Binary files a/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-20@2x.png and b/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-20@2x.png differ diff --git a/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-20@3x.png b/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-20@3x.png index 16b844a741f9..a5b49ccbb199 100644 Binary files a/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-20@3x.png and b/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-20@3x.png differ diff --git a/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-29.png b/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-29.png index 9c1fb7f75048..0500184c869c 100644 Binary files a/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-29.png and b/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-29.png differ diff --git a/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-29@2x.png b/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-29@2x.png index 5903458d985a..f0f8b7fe9833 100644 Binary files a/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-29@2x.png and b/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-29@2x.png differ diff --git a/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-29@3x.png b/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-29@3x.png index a750877b3020..5287e50a7986 100644 Binary files a/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-29@3x.png and b/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-29@3x.png differ diff --git a/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-40.png b/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-40.png index 5b009b8c3263..775685daca94 100644 Binary files a/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-40.png and b/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-40.png differ diff --git a/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-40@2x.png b/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-40@2x.png index 58ce0bb76a1c..d9c7ab446bb7 100644 Binary files a/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-40@2x.png and b/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-40@2x.png differ diff --git a/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-40@3x.png b/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-40@3x.png index 16b844a741f9..a5b49ccbb199 100644 Binary files a/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-40@3x.png and b/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-40@3x.png differ diff --git a/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-50.png b/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-50.png index ade12a5a9d21..ac381bc20e85 100644 Binary files a/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-50.png and b/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-50.png differ diff --git a/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-50@2x.png b/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-50@2x.png index 4a5231a0b79f..ef38d4500a80 100644 Binary files a/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-50@2x.png and b/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-50@2x.png differ diff --git a/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-57.png b/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-57.png index 7de9113e6f6a..4fcc6fddffe1 100644 Binary files a/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-57.png and b/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-57.png differ diff --git a/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-57@2x.png b/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-57@2x.png index bac3cf32f6c6..c3807861ad29 100644 Binary files a/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-57@2x.png and b/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-57@2x.png differ diff --git a/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-60@2x.png b/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-60@2x.png index 16b844a741f9..a5b49ccbb199 100644 Binary files a/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-60@2x.png and b/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-60@2x.png differ diff --git a/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-60@3x.png b/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-60@3x.png index 02690f15a799..d4bc53132ce3 100644 Binary files a/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-60@3x.png and b/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-60@3x.png differ diff --git a/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-72.png b/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-72.png index 9dc7c3f12e35..2c573c8df4c3 100644 Binary files a/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-72.png and b/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-72.png differ diff --git a/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-72@2x.png b/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-72@2x.png index d8b6a74ed7ff..1526615c02d1 100644 Binary files a/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-72@2x.png and b/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-72@2x.png differ diff --git a/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-76.png b/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-76.png index 016bc84ac158..8a1fa1850c03 100644 Binary files a/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-76.png and b/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-76.png differ diff --git a/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-76@2x.png b/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-76@2x.png index df2fbe041858..8aa82506d0d1 100644 Binary files a/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-76@2x.png and b/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-76@2x.png differ diff --git a/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-83.5@2x.png b/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-83.5@2x.png index 85bdb364946c..6bf801d17507 100644 Binary files a/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-83.5@2x.png and b/tests/cpp-tests/proj.ios/Images.xcassets/AppIcon-cpp-tests.appiconset/Icon-83.5@2x.png differ diff --git a/tests/cpp-tests/proj.ios/Info.plist b/tests/cpp-tests/proj.ios/Info.plist index b15773f0abb4..f270e748494c 100644 --- a/tests/cpp-tests/proj.ios/Info.plist +++ b/tests/cpp-tests/proj.ios/Info.plist @@ -19,7 +19,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - + 1.0 CFBundleSignature ???? CFBundleVersion @@ -33,12 +33,28 @@ UIAppFonts - fonts/A Damn Mess.ttf - fonts/Abberancy.ttf + fonts/American Typewriter.ttf fonts/Abduction.ttf + fonts/ThonburiBold.ttf + fonts/Fingerpop.ttf fonts/Paint Boy.ttf - fonts/Schwarzwald.ttf + fonts/A Damn Mess.ttf + fonts/Schwarzwald Regular.ttf + fonts/Courier New.ttf + fonts/Japanese.ttf + fonts/xingkai-incomplete.ttf + fonts/arial.ttf fonts/Scissor Cuts.ttf + fonts/FingerpopGap.ttf + fonts/NotoEmoji-Regular.ttf + fonts/Marker Felt.ttf + fonts/Schwarzwald.ttf + fonts/cyril.ttf + fonts/tahoma.ttf + fonts/HKYuanMini.ttf + fonts/cyrillic.ttf + fonts/Abberancy.ttf + fonts/Thonburi.ttf UILaunchStoryboardName LaunchScreen diff --git a/tests/cpp-tests/proj.ios/LaunchScreenBackground.png b/tests/cpp-tests/proj.ios/LaunchScreenBackground.png index bfbe6c2c7a21..dadccee68624 100644 Binary files a/tests/cpp-tests/proj.ios/LaunchScreenBackground.png and b/tests/cpp-tests/proj.ios/LaunchScreenBackground.png differ diff --git a/tests/cpp-tests/proj.mac/en.lproj/MainMenu.xib b/tests/cpp-tests/proj.mac/en.lproj/MainMenu.xib deleted file mode 100644 index 3dacdedbd0ba..000000000000 --- a/tests/cpp-tests/proj.mac/en.lproj/MainMenu.xib +++ /dev/null @@ -1,812 +0,0 @@ - - - - 1060 - 10K549 - 1938 - 1038.36 - 461.00 - - com.apple.InterfaceBuilder.CocoaPlugin - 1938 - - - YES - NSMenuItem - NSCustomObject - NSMenu - - - YES - com.apple.InterfaceBuilder.CocoaPlugin - - - PluginDependencyRecalculationVersion - - - - YES - - NSApplication - - - FirstResponder - - - NSApplication - - - AMainMenu - - YES - - - TestCpp - - 1048576 - 2147483647 - - NSImage - NSMenuCheckmark - - - NSImage - NSMenuMixedState - - submenuAction: - - TestCpp - - YES - - - About TestCpp - - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Preferences… - , - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Services - - 1048576 - 2147483647 - - - submenuAction: - - Services - - YES - - _NSServicesMenu - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Hide TestCpp - h - 1048576 - 2147483647 - - - - - - Hide Others - h - 1572864 - 2147483647 - - - - - - Show All - - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Quit TestCpp - q - 1048576 - 2147483647 - - - - - _NSAppleMenu - - - - - View - - 1048576 - 2147483647 - - - submenuAction: - - View - - YES - - - Toggle Fullscreen - f - 1048576 - 2147483647 - - - - - - - - - Window - - 1048576 - 2147483647 - - - submenuAction: - - Window - - YES - - - Minimize - m - 1048576 - 2147483647 - - - - - - Zoom - - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Bring All to Front - - 1048576 - 2147483647 - - - - - _NSWindowsMenu - - - - - Help - - 2147483647 - - - submenuAction: - - Help - - YES - - - TestCpp Help - ? - 1048576 - 2147483647 - - - - - _NSHelpMenu - - - - _NSMainMenu - - - AppController - - - NSFontManager - - - - - YES - - - terminate: - - - - 449 - - - - orderFrontStandardAboutPanel: - - - - 142 - - - - delegate - - - - 495 - - - - performMiniaturize: - - - - 37 - - - - arrangeInFront: - - - - 39 - - - - performZoom: - - - - 240 - - - - hide: - - - - 367 - - - - hideOtherApplications: - - - - 368 - - - - unhideAllApplications: - - - - 370 - - - - showHelp: - - - - 493 - - - - toggleFullScreen: - - - - 537 - - - - - YES - - 0 - - YES - - - - - - -2 - - - File's Owner - - - -1 - - - First Responder - - - -3 - - - Application - - - 29 - - - YES - - - - - - - - - 19 - - - YES - - - - - - 56 - - - YES - - - - - - 57 - - - YES - - - - - - - - - - - - - - - - 58 - - - - - 134 - - - - - 150 - - - - - 136 - - - - - 144 - - - - - 129 - - - - - 143 - - - - - 236 - - - - - 131 - - - YES - - - - - - 149 - - - - - 145 - - - - - 130 - - - - - 24 - - - YES - - - - - - - - - 92 - - - - - 5 - - - - - 239 - - - - - 23 - - - - - 295 - - - YES - - - - - - 296 - - - YES - - - - - - 420 - - - - - 490 - - - YES - - - - - - 491 - - - YES - - - - - - 492 - - - - - 494 - - - - - 536 - - - - - - - YES - - YES - -1.IBPluginDependency - -2.IBPluginDependency - -3.IBPluginDependency - 129.IBPluginDependency - 130.IBPluginDependency - 131.IBPluginDependency - 134.IBPluginDependency - 136.IBPluginDependency - 143.IBPluginDependency - 144.IBPluginDependency - 145.IBPluginDependency - 149.IBPluginDependency - 150.IBPluginDependency - 19.IBPluginDependency - 23.IBPluginDependency - 236.IBPluginDependency - 239.IBPluginDependency - 24.IBPluginDependency - 29.IBPluginDependency - 295.IBPluginDependency - 296.IBPluginDependency - 420.IBPluginDependency - 490.IBPluginDependency - 491.IBPluginDependency - 492.IBPluginDependency - 494.IBPluginDependency - 5.IBPluginDependency - 536.IBPluginDependency - 56.IBPluginDependency - 57.IBPluginDependency - 58.IBPluginDependency - 92.IBPluginDependency - - - YES - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - - YES - - - - - - YES - - - - - 541 - - - - YES - - AppController - NSObject - - YES - - YES - exitFullScreen: - toggleFullScreen: - - - YES - id - id - - - - YES - - YES - exitFullScreen: - toggleFullScreen: - - - YES - - exitFullScreen: - id - - - toggleFullScreen: - id - - - - - YES - - YES - glView - window - - - YES - EAGLView - NSWindow - - - - YES - - YES - glView - window - - - YES - - glView - EAGLView - - - window - NSWindow - - - - - IBProjectSource - ./Classes/AppController.h - - - - EAGLView - NSOpenGLView - - IBProjectSource - ./Classes/EAGLView.h - - - - - 0 - IBCocoaFramework - - com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 - - - YES - 3 - - YES - - YES - NSMenuCheckmark - NSMenuMixedState - - - YES - {9, 8} - {7, 2} - - - - diff --git a/tests/cpp-tests/proj.win10/App.xaml b/tests/cpp-tests/proj.win10/App.xaml deleted file mode 100644 index 936aef6db41d..000000000000 --- a/tests/cpp-tests/proj.win10/App.xaml +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - - cpp_tests - - \ No newline at end of file diff --git a/tests/cpp-tests/proj.win10/App.xaml.cpp b/tests/cpp-tests/proj.win10/App.xaml.cpp deleted file mode 100644 index b32b2e6c8aa9..000000000000 --- a/tests/cpp-tests/proj.win10/App.xaml.cpp +++ /dev/null @@ -1,145 +0,0 @@ -/**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - ****************************************************************************/ - -#include "App.xaml.h" -#include "OpenGLESPage.xaml.h" - -using namespace Platform; -using namespace Windows::ApplicationModel; -using namespace Windows::ApplicationModel::Activation; -using namespace Windows::Foundation; -using namespace Windows::Foundation::Collections; -using namespace Windows::UI::Xaml::Media::Animation; -using namespace Windows::UI::Xaml; -using namespace Windows::UI::Xaml::Controls; -using namespace Windows::UI::Xaml::Controls::Primitives; -using namespace Windows::UI::Xaml::Data; -using namespace Windows::UI::Xaml::Input; -using namespace Windows::UI::Xaml::Interop; -using namespace Windows::UI::Xaml::Media; -using namespace Windows::UI::Xaml::Navigation; -using namespace cocos2d; -using namespace CocosAppWinRT; - -App::App() -{ - InitializeComponent(); - Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending); - Resuming += ref new EventHandler(this, &App::OnResuming); -} - -/// -/// Invoked when the application is launched normally by the end user. Other entry points -/// will be used such as when the application is launched to open a specific file. -/// -/// Details about the launch request and process. -void App::OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e) -{ - // if our app is prelaunched do nothing - // see https://msdn.microsoft.com/en-us/windows/uwp/launch-resume/handle-app-prelaunch - if (e->PrelaunchActivated) - { - return; - } - - auto rootFrame = dynamic_cast(Window::Current->Content); - - // Do not repeat app initialization when the Window already has content, - // just ensure that the window is active - if (rootFrame == nullptr) - { - // Create a Frame to act as the navigation context and associate it with - // a SuspensionManager key - rootFrame = ref new Frame(); - - rootFrame->NavigationFailed += ref new Windows::UI::Xaml::Navigation::NavigationFailedEventHandler(this, &App::OnNavigationFailed); - - if (e->PreviousExecutionState == ApplicationExecutionState::Terminated) - { - // TODO: Restore the saved session state only when appropriate, scheduling the - // final launch steps after the restore is complete - - } - - // Place the frame in the current Window - Window::Current->Content = rootFrame; - // Ensure the current window is active - } - - if (rootFrame->Content == nullptr) - { - // When the navigation stack isn't restored navigate to the first page, - // configuring the new page by passing required information as a navigation - // parameter - rootFrame->Content = mPage = ref new OpenGLESPage(&mOpenGLES); - } - // Ensure the current window is active - Window::Current->Activate(); -} - -/// -/// Invoked when application execution is being suspended. Application state is saved -/// without knowing whether the application will be terminated or resumed with the contents -/// of memory still intact. -/// -void App::OnSuspending(Object^ sender, SuspendingEventArgs^ e) -{ - (void)sender; // Unused parameter - (void)e; // Unused parameter - - if (mPage) - { - mPage->SetVisibility(false); - } -} - -/// -/// Invoked when application execution is being resumed. -/// -/// The source of the resume request. -/// Details about the resume request. -void App::OnResuming(Object ^sender, Object ^args) -{ - (void)sender; // Unused parameter - (void)args; // Unused parameter - - if (mPage) - { - mPage->SetVisibility(true); - } -} - -/// -/// Invoked when Navigation to a certain page fails -/// -/// The Frame which failed navigation -/// Details about the navigation failure -void App::OnNavigationFailed(Platform::Object ^sender, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs ^e) -{ - throw ref new FailureException("Failed to load Page " + e->SourcePageType.Name); -} - - - - diff --git a/tests/cpp-tests/proj.win10/App.xaml.h b/tests/cpp-tests/proj.win10/App.xaml.h deleted file mode 100644 index 57c7f8d8c1ab..000000000000 --- a/tests/cpp-tests/proj.win10/App.xaml.h +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - - http://www.cocos2d-x.org - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - ****************************************************************************/ - -#pragma once - -#include "app.g.h" -#include "OpenGLES.h" -#include "OpenGLESPage.xaml.h" - -namespace CocosAppWinRT -{ - ref class App sealed - { - public: - App(); - virtual void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e) override; - - private: - void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ e); - void OnResuming(Platform::Object ^sender, Platform::Object ^args); - void OnNavigationFailed(Platform::Object ^sender, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs ^e); - - OpenGLESPage^ mPage; - OpenGLES mOpenGLES; - }; -} diff --git a/tests/cpp-tests/proj.win10/Assets/LockScreenLogo.scale-200.png b/tests/cpp-tests/proj.win10/Assets/LockScreenLogo.scale-200.png deleted file mode 100644 index ad81b3a1fec9..000000000000 Binary files a/tests/cpp-tests/proj.win10/Assets/LockScreenLogo.scale-200.png and /dev/null differ diff --git a/tests/cpp-tests/proj.win10/Assets/SplashScreen.scale-200.png b/tests/cpp-tests/proj.win10/Assets/SplashScreen.scale-200.png deleted file mode 100644 index 9b441acfb4e7..000000000000 Binary files a/tests/cpp-tests/proj.win10/Assets/SplashScreen.scale-200.png and /dev/null differ diff --git a/tests/cpp-tests/proj.win10/Assets/Square150x150Logo.scale-200.png b/tests/cpp-tests/proj.win10/Assets/Square150x150Logo.scale-200.png deleted file mode 100644 index a4cde35cb458..000000000000 Binary files a/tests/cpp-tests/proj.win10/Assets/Square150x150Logo.scale-200.png and /dev/null differ diff --git a/tests/cpp-tests/proj.win10/Assets/Square44x44Logo.scale-200.png b/tests/cpp-tests/proj.win10/Assets/Square44x44Logo.scale-200.png deleted file mode 100644 index c02f1a915a12..000000000000 Binary files a/tests/cpp-tests/proj.win10/Assets/Square44x44Logo.scale-200.png and /dev/null differ diff --git a/tests/cpp-tests/proj.win10/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/tests/cpp-tests/proj.win10/Assets/Square44x44Logo.targetsize-24_altform-unplated.png deleted file mode 100644 index cdfeac07b1e0..000000000000 Binary files a/tests/cpp-tests/proj.win10/Assets/Square44x44Logo.targetsize-24_altform-unplated.png and /dev/null differ diff --git a/tests/cpp-tests/proj.win10/Assets/StoreLogo.png b/tests/cpp-tests/proj.win10/Assets/StoreLogo.png deleted file mode 100644 index e17ce163d104..000000000000 Binary files a/tests/cpp-tests/proj.win10/Assets/StoreLogo.png and /dev/null differ diff --git a/tests/cpp-tests/proj.win10/Assets/Wide310x150Logo.scale-200.png b/tests/cpp-tests/proj.win10/Assets/Wide310x150Logo.scale-200.png deleted file mode 100644 index 61adac18ca2f..000000000000 Binary files a/tests/cpp-tests/proj.win10/Assets/Wide310x150Logo.scale-200.png and /dev/null differ diff --git a/tests/cpp-tests/proj.win10/Package.appxmanifest b/tests/cpp-tests/proj.win10/Package.appxmanifest deleted file mode 100644 index 39f52406f938..000000000000 --- a/tests/cpp-tests/proj.win10/Package.appxmanifest +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - cpp-tests - Microsoft Open Technologies, Inc. - Assets\StoreLogo.png - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/cpp-tests/proj.win10/cpp-tests.vcxproj b/tests/cpp-tests/proj.win10/cpp-tests.vcxproj deleted file mode 100644 index 590441fd458b..000000000000 --- a/tests/cpp-tests/proj.win10/cpp-tests.vcxproj +++ /dev/null @@ -1,619 +0,0 @@ - - - - {c1307b42-d00a-4b88-bcdd-0a16a81ff4c1} - CocosAppWinRT - en-US - 14.0 - true - Windows Store - 8.2 - 10.0.10240.0 - 10.0.10240.0 - - - - - Debug - ARM - - - Debug - Win32 - - - Debug - x64 - - - Release - ARM - - - Release - Win32 - - - Release - x64 - - - - Application - true - v141 - - - Application - true - v141 - - - Application - true - v141 - - - Application - false - true - v141 - - - Application - false - true - v141 - - - Application - false - true - v141 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - cpp-tests_TemporaryKey.pfx - A047654C44C0BB81CD13E278200A30E4B48AC0F9 - - - false - - - false - - - false - - - false - - - false - - - false - - - - /Zm384 /bigobj %(AdditionalOptions) - 4453;28204;4251;4244;4056;4800; - pch.h - ..\Classes;$(EngineRoot)cocos\platform\win8.1-universal;%(AdditionalIncludeDirectories) - false - ProgramDatabase - CC_ENABLE_CHIPMUNK_INTEGRATION=1;COCOS2D_DEBUG=1;%(PreprocessorDefinitions) - - - MSVCRT;%(IgnoreSpecificDefaultLibraries) - - - - - /Zm384 /bigobj %(AdditionalOptions) - 4453;28204;4251;4244;4056; - pch.h - ..\Classes;$(EngineRoot)cocos\platform\win8.1-universal;%(AdditionalIncludeDirectories) - false - false - ProgramDatabase - CC_ENABLE_CHIPMUNK_INTEGRATION=1;%(PreprocessorDefinitions) - - - - - - - - /Zm384 /bigobj %(AdditionalOptions) - 4453;28204;4251;4244;4056;4800; - pch.h - ..\Classes;$(EngineRoot)cocos\platform\win8.1-universal;%(AdditionalIncludeDirectories) - false - ProgramDatabase - CC_ENABLE_CHIPMUNK_INTEGRATION=1;COCOS2D_DEBUG=1;%(PreprocessorDefinitions) - - - MSVCRT;%(IgnoreSpecificDefaultLibraries) - - - - - /Zm384 /bigobj %(AdditionalOptions) - 4453;28204;4251;4244;4056; - pch.h - ..\Classes;$(EngineRoot)cocos\platform\win8.1-universal;%(AdditionalIncludeDirectories) - false - false - CC_ENABLE_CHIPMUNK_INTEGRATION=1;%(PreprocessorDefinitions) - ProgramDatabase - - - - - - - - /Zm384 /bigobj %(AdditionalOptions) - 4453;28204;4251;4244;4056;4800; - pch.h - ..\Classes;$(EngineRoot)cocos\platform\win8.1-universal;%(AdditionalIncludeDirectories) - false - ProgramDatabase - CC_ENABLE_CHIPMUNK_INTEGRATION=1;COCOS2D_DEBUG=1;%(PreprocessorDefinitions) - - - MSVCRT;%(IgnoreSpecificDefaultLibraries) - - - - - /Zm384 /bigobj %(AdditionalOptions) - 4453;28204;4251;4244;4056; - pch.h - ..\Classes;$(EngineRoot)cocos\platform\win8.1-universal;%(AdditionalIncludeDirectories) - false - false - CC_ENABLE_CHIPMUNK_INTEGRATION=1;%(PreprocessorDefinitions) - ProgramDatabase - - - - - - - - - - ..\..\..\cocos\platform\win8.1-universal\OpenGLESPage.xaml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - App.xaml - - - - - Designer - - - - - Designer - - - - - - - - ..\..\..\cocos\platform\win8.1-universal\OpenGLESPage.xaml - - - Create - Create - Create - Create - Create - Create - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - App.xaml - - - - - {07c2895d-720c-487d-b7b4-12c293ea533f} - - - {4b3ba10a-941f-4e08-8a50-8a7fcb822bb8} - - - {0c32d479-46d5-46c3-9aa9-0a8ff8320516} - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/cpp-tests/proj.win10/cpp-tests.vcxproj.filters b/tests/cpp-tests/proj.win10/cpp-tests.vcxproj.filters deleted file mode 100644 index f51dbab47370..000000000000 --- a/tests/cpp-tests/proj.win10/cpp-tests.vcxproj.filters +++ /dev/null @@ -1,1289 +0,0 @@ - - - - - 97d8d08c-848a-420e-aab1-5061457b491f - bmp;fbx;gif;jpg;jpeg;tga;tiff;tif;png - - - {72a5938d-b456-4ee5-a76a-5e28c0cf30b5} - - - {81d00d76-81ec-4274-8e14-0066561a59f3} - - - {12320dbd-8679-44e8-b002-10cfd1f0ab8d} - - - {ec79851d-4b4e-4cca-a60a-db3bd19e9df0} - - - {c71ed4ef-b44c-4efa-a557-96d792c4082f} - - - {a762d21f-dab4-4e65-9635-8a2d1c3720a5} - - - {ff2c6e21-2e15-47ba-8e8a-d32db4c4bd7d} - - - {bddbff12-4011-4071-86c3-d2d4b01d9f07} - - - {142a60f8-f519-453f-9641-13c42af61fbc} - - - {0a14dee6-42c3-4144-a086-30bcae298e81} - - - {36c8d894-0028-4d9a-b9c1-3d2b121630da} - - - {ef5441af-f919-4af7-b130-f69ad71bf475} - - - {1a800ef0-fbc5-47ad-903d-48cb2e6e884a} - - - {e05a72bb-7eed-46a8-8216-1714220c79bf} - - - {6990fa3c-1895-48ec-9823-c82132260315} - - - {440a9c5a-db16-4c28-99ee-58ff0f719ba2} - - - {d73c786c-4cfe-4e17-9d9a-322375186ec7} - - - {4fdbcbde-1a04-49bc-a560-0b23a61c9850} - - - {583443c6-166b-4693-a2d1-ad846f6813bc} - - - {54e78cdc-cc15-4d83-8d3c-ff77beae1446} - - - {8e16d7fe-b605-4eaf-9474-ec8a1298abdc} - - - {e5b0399b-acae-4f23-9a37-063323e86386} - - - {afcfb524-ce73-49ba-89ce-cb99287eda6c} - - - {8a60f5bf-9873-44fc-aa4d-29056ae1c370} - - - {d8bbe73e-03bd-4262-b49f-402a14f8a13d} - - - {8a4d0c1b-0951-4965-8740-e430dde2fbe8} - - - {0bf42589-4ced-4603-a901-e773767d83f7} - - - {ff1dcf6c-41df-4b5c-aa35-80f52ecc34eb} - - - {7fda7040-9402-4f45-b141-22a74978c3d2} - - - {64eae2a4-f1f2-4d57-af0e-f417669bf6ab} - - - {9f2342f7-9cfa-4897-8610-5aba7d2a8eda} - - - {618404c5-9e20-4c6b-ba9c-11699ba3c45c} - - - {a6a92123-dd2f-4c1e-9780-a8183491b3d2} - - - {ee4418eb-5a74-4ba6-a3d9-361793492383} - - - {50348955-c1df-4e27-ba81-7f1f7a7f7d0b} - - - {a3022a16-5125-46fe-bbbf-88b6327fdf90} - - - {c182d51b-571a-41b9-93c4-2f16a9a6e382} - - - {24c2bc37-1b31-4844-981f-d0b842636df1} - - - {a8c99d83-bb5b-4732-9654-5c4a46833584} - - - {df4917f4-0ed9-483b-9133-71d60ba8a4fd} - - - {0648a349-fa88-45e2-8304-58576ac063b2} - - - {1a5d3f8b-3643-47e1-a6d9-7dad49dcb624} - - - {ae687fa8-7a8d-4b9c-9618-3191c9be1927} - - - {b39e1877-a9c0-4c7c-acc9-a685ad2daf3b} - - - {53ec3574-9cb7-4e7b-af67-e7f7f9e6a0e6} - - - {3a131364-6664-4c15-a66e-2dbdf2b296b9} - - - {8d4ad0bf-81d4-4767-ac71-39b5c75b72ba} - - - {d93b735e-696c-43b7-9a79-993ca680b953} - - - {19e37819-45ae-474d-86d9-46104d51e247} - - - {aa8d908d-05dd-4dd3-9cd7-1a381e167ba8} - - - {6a181335-c139-4928-84f0-40c3373befb8} - - - {6135b950-f660-4f73-8c40-bbc31c6e2863} - - - {43e4143b-0be4-4800-9cd3-9293bb1006ce} - - - {1716fd6e-cd96-4bea-96d0-37d57dd602c5} - - - {718a904b-d90b-4aa0-944f-81a69d287ea5} - - - {1ec92552-3f16-4080-ba2f-a171b3a7f92c} - - - {cf755f22-4dbd-427a-b92a-f7ef14f72990} - - - {8240d810-c3a1-403c-8d60-f83ca945bf34} - - - {f2357ab1-759e-42fa-87f3-1e33a775c912} - - - {c84d9ab4-0f15-4a7e-b214-238249f06204} - - - {e45b72a6-fe38-4c7a-986a-424d303b847f} - - - {7ec771c0-0344-43e9-9ae8-0f8a278791a2} - - - {3bd8ffaa-c24f-455b-bb31-25b038490329} - - - {878bc3fc-cc88-43cb-85b7-f64c31c527b6} - - - {340b2acb-098d-441d-9737-6788ea17541a} - - - {ff68b4b0-3bdf-4813-8552-b79af838c8a3} - - - {a60b411f-fae8-461b-afe7-8e8033d2153c} - - - {ccc87a7c-9e62-4035-a4c5-f7a5880139a8} - - - {8d6fe7eb-ba6c-4cea-93b2-1adaf2c8e2ae} - - - {119e04c5-5d54-4972-aeb8-9bb32f7a33ac} - - - {04b6873a-ec2a-4695-80b5-df70a54a37d5} - - - {3df38e07-ce63-44fa-900b-e20d39848bad} - - - {e5a446a6-fee6-4802-952b-eb18a397f446} - - - {16c5df56-4880-4bf2-a626-fc8974cd9df3} - - - {5e03116b-9f99-4db3-808a-b36aaae5dae0} - - - {baf5dbe8-8801-4333-a8c2-6f96fbe31b5d} - - - {11da21cc-bd40-4f2c-8bf9-5056772f1ba0} - - - {733a8fe7-3fee-43e8-9437-d220158bb48b} - - - {ac191442-d014-4327-84cc-e31d233cb5ed} - - - {684498f9-817b-4058-a932-0cd4d9cde9eb} - - - {8af92cb5-8107-4998-8fa8-f7e959146a06} - - - {62e7ccf1-beeb-4f93-b069-5a81e62776a4} - - - {2d74d632-649d-4d94-bf6a-cfa01315a5b0} - - - {82556440-cf2a-45b7-8a23-718c25ad9007} - - - {842b8441-0677-46fd-ac69-effbe83b0776} - - - {ea7e291b-1de5-4be5-9f59-c92dfcb5dac5} - - - {f10b76ee-8c87-4b9f-b8af-ace7a38bb6f2} - - - {568809dd-eb65-4bb2-90d2-251313e5b67e} - - - {1830aea4-07f5-466e-928c-a67a02083535} - - - {a34bc185-d0fa-4e93-b289-954abaedcaae} - - - {a49e5dee-6eab-4a2a-9769-9f84ff6a5610} - - - {a6b76076-ceeb-43e6-9005-1656c65778b6} - - - {fd63b656-b611-447b-b4a1-f2d11f92ff83} - - - {c6bd28ea-2696-4d05-90b2-2646ed934a49} - - - {848aacea-a328-4797-9119-403b3c94d3d7} - - - - - - - - - Classes - - - Classes - - - Classes - - - Classes - - - Classes\ActionManagerTest - - - Classes\ActionsEaseTest - - - Classes\ActionsProgressTest - - - Classes\ActionsTest - - - Classes\AllocatorTest - - - Classes\BillBoardTest - - - Classes\Box2DTest - - - Classes\Box2DTestBed - - - Classes\Box2DTestBed - - - Classes\Box2DTestBed - - - Classes\Box2DTestBed - - - Classes\BugsTest - - - Classes\BugsTest - - - Classes\BugsTest - - - Classes\BugsTest - - - Classes\BugsTest - - - Classes\BugsTest - - - Classes\BugsTest - - - Classes\BugsTest - - - Classes\BugsTest - - - Classes\BugsTest - - - Classes\BugsTest - - - Classes\BugsTest\Bug-458 - - - Classes\BugsTest\Bug-458 - - - Classes\Camera3DTest - - - Classes\ChipmunkTest - - - Classes\ClickAndMoveTest - - - Classes\ClippingNodeTest - - - Classes\CocosDenshionTest - - - Classes\ConfigurationTest - - - Classes\ConsoleTest - - - Classes\CurrentLanguageTest - - - Classes\DataVisitorTest - - - Classes\DrawPrimitivesTest - - - Classes\EffectsAdvancedTest - - - Classes\EffectsTest - - - Classes\ExtensionsTest - - - Classes\ExtensionsTest\NetworkTest - - - Classes\ExtensionsTest\NetworkTest - - - Classes\ExtensionsTest\NetworkTest - - - Classes\ExtensionsTest\TableViewTest - - - Classes\ExtensionsTest\TableViewTest - - - Classes\FileUtilsTest - - - Classes\InputTest - - - Classes\FontTest - - - Classes\IntervalTest - - - Classes\LabelTest - - - Classes\LabelTest - - - Classes\LayerTest - - - Classes\LightTest - - - Classes\MenuTest - - - Classes\MotionStreakTest - - - Classes\MultiTouchTest - - - Classes\NewEventDispatcherTest - - - Classes\NewRendererTest - - - Classes\NodeTest - - - Classes\OpenURLTest - - - Classes\ParallaxTest - - - Classes\Particle3DTest - - - Classes\ParticleTest - - - Classes\PhysicsTest - - - Classes\ReleasePoolTest - - - Classes\RenderTextureTest - - - Classes\RotateWorldTest - - - Classes\SceneTest - - - Classes\SchedulerTest - - - Classes\ShaderTest - - - Classes\ShaderTest - - - Classes\SpineTest - - - Classes\Sprite3DTest - - - Classes\Sprite3DTest - - - Classes\SpriteTest - - - Classes\TerrainTest - - - Classes\TextInputTest - - - Classes\Texture2dTest - - - Classes\TextureCacheTest - - - Classes\TexturePackerEncryptionTest - - - Classes\TileMapTest - - - Classes\TileMapTest - - - Classes\TouchesTest - - - Classes\TouchesTest - - - Classes\TouchesTest - - - Classes\TransitionsTest - - - Classes\UITest - - - Classes\UITest\CocoStudioGUITest - - - Classes\UITest\CocoStudioGUITest - - - Classes\UITest\CocoStudioGUITest - - - Classes\UITest\CocoStudioGUITest - - - Classes\UITest\CocoStudioGUITest\UIButtonTest - - - Classes\UITest\CocoStudioGUITest\UICheckBoxTest - - - Classes\UITest\CocoStudioGUITest\UIFocusTest - - - Classes\UITest\CocoStudioGUITest\UIImageViewTest - - - Classes\UITest\CocoStudioGUITest\UILayoutTest - - - Classes\UITest\CocoStudioGUITest\UIListViewTest - - - Classes\UITest\CocoStudioGUITest\UILoadingBarTest - - - Classes\UITest\CocoStudioGUITest\UIPageViewTest - - - Classes\UITest\CocoStudioGUITest\UIRichTextTest - - - Classes\UITest\CocoStudioGUITest\UIScrollViewTest - - - Classes\UITest\CocoStudioGUITest\UISliderTest - - - Classes\UITest\CocoStudioGUITest\UITextAtlasTest - - - Classes\UITest\CocoStudioGUITest\UITextBMFontTest - - - Classes\UITest\CocoStudioGUITest\UITextFieldTest - - - Classes\UITest\CocoStudioGUITest\UITextTest - - - Classes\UITest\CocoStudioGUITest\UIWidgetAddNodeTest - - - Classes\UnitTest - - - Classes\UnitTest - - - Classes\UserDefaultTest - - - Classes\VibrateTest - - - Classes\ZwoptexTest - - - - - - - Classes\SpritePolygonTest - - - Classes\Scene3DTest - - - Classes\MaterialSystemTest - - - Classes\NewAudioEngineTest - - - Classes\Physics3DTest - - - Classes\NavMeshTest - - - Classes\BugsTest - - - Classes\BugsTest - - - Classes\BugsTest - - - Classes\CurlTest - - - Classes\ExtensionsTest\AssetsManagerExTest - - - Classes\DownloaderTest - - - Classes\UITest\CocoStudioGUITest\UIRadioButtonTest - - - Classes\UITest\CocoStudioGUITest\UITabContorlTest - - - - Classes\VRTests - - - - - - Classes - - - Classes - - - Classes - - - Classes - - - Classes - - - Classes - - - Classes - - - Classes\ActionManagerTest - - - Classes\ActionsEaseTest - - - Classes\ActionsProgressTest - - - Classes\ActionsTest - - - Classes\AllocatorTest - - - Classes\BillBoardTest - - - Classes\Box2DTest - - - Classes\Box2DTestBed - - - Classes\Box2DTestBed - - - Classes\Box2DTestBed - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\Box2DTestBed\Tests - - - Classes\BugsTest - - - Classes\BugsTest - - - Classes\BugsTest - - - Classes\BugsTest - - - Classes\BugsTest - - - Classes\BugsTest - - - Classes\BugsTest - - - Classes\BugsTest - - - Classes\BugsTest - - - Classes\BugsTest - - - Classes\BugsTest - - - Classes\BugsTest\Bug-458 - - - Classes\BugsTest\Bug-458 - - - Classes\Camera3DTest - - - Classes\ChipmunkTest - - - Classes\ClickAndMoveTest - - - Classes\ClippingNodeTest - - - Classes\CocosDenshionTest - - - Classes\ConfigurationTest - - - Classes\ConsoleTest - - - Classes\CurrentLanguageTest - - - Classes\DataVisitorTest - - - Classes\DrawPrimitivesTest - - - Classes\EffectsAdvancedTest - - - Classes\EffectsTest - - - Classes\ExtensionsTest - - - Classes\ExtensionsTest\NetworkTest - - - Classes\ExtensionsTest\NetworkTest - - - Classes\ExtensionsTest\NetworkTest - - - Classes\ExtensionsTest\TableViewTest - - - Classes\ExtensionsTest\TableViewTest - - - Classes\FileUtilsTest - - - Classes\InputTest - - - Classes\FontTest - - - Classes\IntervalTest - - - Classes\LabelTest - - - Classes\LabelTest - - - Classes\LayerTest - - - Classes\LightTest - - - Classes\MenuTest - - - Classes\MotionStreakTest - - - Classes\MultiTouchTest - - - Classes\NewEventDispatcherTest - - - Classes\NewRendererTest - - - Classes\NodeTest - - - Classes\OpenURLTest - - - Classes\ParallaxTest - - - Classes\Particle3DTest - - - Classes\ParticleTest - - - Classes\PhysicsTest - - - Classes\ReleasePoolTest - - - Classes\RenderTextureTest - - - Classes\RotateWorldTest - - - Classes\SceneTest - - - Classes\SchedulerTest - - - Classes\ShaderTest - - - Classes\ShaderTest - - - Classes\ShaderTest - - - Classes\ShaderTest - - - Classes\SpineTest - - - Classes\Sprite3DTest - - - Classes\Sprite3DTest - - - Classes\SpriteTest - - - Classes\TerrainTest - - - Classes\TextInputTest - - - Classes\Texture2dTest - - - Classes\TextureCacheTest - - - Classes\TexturePackerEncryptionTest - - - Classes\TileMapTest - - - Classes\TileMapTest - - - Classes\TouchesTest - - - Classes\TouchesTest - - - Classes\TouchesTest - - - Classes\TransitionsTest - - - Classes\UITest - - - Classes\UITest\CocoStudioGUITest - - - Classes\UITest\CocoStudioGUITest - - - Classes\UITest\CocoStudioGUITest - - - Classes\UITest\CocoStudioGUITest - - - Classes\UITest\CocoStudioGUITest\UIButtonTest - - - Classes\UITest\CocoStudioGUITest\UICheckBoxTest - - - Classes\UITest\CocoStudioGUITest\UIFocusTest - - - Classes\UITest\CocoStudioGUITest\UIImageViewTest - - - Classes\UITest\CocoStudioGUITest\UILayoutTest - - - Classes\UITest\CocoStudioGUITest\UIListViewTest - - - Classes\UITest\CocoStudioGUITest\UILoadingBarTest - - - Classes\UITest\CocoStudioGUITest\UIPageViewTest - - - Classes\UITest\CocoStudioGUITest\UIRichTextTest - - - Classes\UITest\CocoStudioGUITest\UIScrollViewTest - - - Classes\UITest\CocoStudioGUITest\UISliderTest - - - Classes\UITest\CocoStudioGUITest\UITextAtlasTest - - - Classes\UITest\CocoStudioGUITest\UITextBMFontTest - - - Classes\UITest\CocoStudioGUITest\UITextFieldTest - - - Classes\UITest\CocoStudioGUITest\UITextTest - - - Classes\UITest\CocoStudioGUITest\UIWidgetAddNodeTest - - - Classes\UnitTest - - - Classes\UnitTest - - - Classes\UserDefaultTest - - - Classes\VibrateTest - - - Classes\ZwoptexTest - - - - - - - Classes\SpritePolygonTest - - - Classes\Scene3DTest - - - Classes\MaterialSystemTest - - - Classes\NewAudioEngineTest - - - Classes\Physics3DTest - - - Classes\NavMeshTest - - - Classes\BugsTest - - - Classes\BugsTest - - - Classes\BugsTest - - - Classes\CurlTest - - - Classes\ExtensionsTest\AssetsManagerExTest - - - Classes\DownloaderTest - - - Classes\UITest\CocoStudioGUITest\UIRadioButtonTest - - - Classes\UITest\CocoStudioGUITest\UITabContorlTest - - - - - - - Classes\VRTests - - - - - - - - - - - - - - - - - - - - - - - - - Assets - - - Assets - - - Assets - - - Assets - - - Assets - - - Assets - - - Assets - - - \ No newline at end of file diff --git a/tests/cpp-tests/proj.win10/cpp-tests_TemporaryKey.pfx b/tests/cpp-tests/proj.win10/cpp-tests_TemporaryKey.pfx deleted file mode 100644 index 9d758bf01500..000000000000 Binary files a/tests/cpp-tests/proj.win10/cpp-tests_TemporaryKey.pfx and /dev/null differ diff --git a/tests/cpp-tests/proj.win10/resources.props b/tests/cpp-tests/proj.win10/resources.props deleted file mode 100644 index 27ed6639498e..000000000000 --- a/tests/cpp-tests/proj.win10/resources.props +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - <_CustomResource Include="..\Resources\**\*"> - Assets\Resources\%(RecursiveDir)%(FileName)%(Extension) - true - - - - - - - - - - - diff --git a/tests/cpp-tests/proj.win32/cpp-tests.vcxproj b/tests/cpp-tests/proj.win32/cpp-tests.vcxproj index 062ebe13cfbc..993258f22d77 100644 --- a/tests/cpp-tests/proj.win32/cpp-tests.vcxproj +++ b/tests/cpp-tests/proj.win32/cpp-tests.vcxproj @@ -14,6 +14,7 @@ {76A39BB2-9B84-4C65-98A5-654D86B86F2A} test_win32 Win32Proj + 10.0.17134.0 @@ -104,7 +105,7 @@ - xcopy "$(ProjectDir)..\Resources" "$(OutDir)" /D /E /I /F /Y + xcopy "$(ProjectDir)..\Resources" "$(OutDir)\Resources\" /D /E /I /F /Y xcopy "$(OutDir)..\*.dll" "$(OutDir)" /D /Y @@ -148,7 +149,7 @@ xcopy "$(OutDir)..\*.dll" "$(OutDir)" /D /Y - xcopy "$(ProjectDir)..\Resources" "$(OutDir)" /D /E /I /F /Y + xcopy "$(ProjectDir)..\Resources" "$(OutDir)\Resources\" /D /E /I /F /Y xcopy "$(OutDir)..\*.dll" "$(OutDir)" /D /Y diff --git a/tests/game-controller-test/Classes/GameControllerTest.cpp b/tests/game-controller-test/Classes/GameControllerTest.cpp index 63e6903a519b..07a9095edee6 100644 --- a/tests/game-controller-test/Classes/GameControllerTest.cpp +++ b/tests/game-controller-test/Classes/GameControllerTest.cpp @@ -473,8 +473,4 @@ void GameControllerTest::createControllerSprite(ControllerHolder& holder) void GameControllerTest::menuCloseCallback(Ref* sender) { Director::getInstance()->end(); - -#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) - exit(0); -#endif } \ No newline at end of file diff --git a/tests/game-controller-test/Resources/ipad/A.png b/tests/game-controller-test/Resources/ipad/A.png index cb88f5bf2d84..fa35c7cd0257 100644 Binary files a/tests/game-controller-test/Resources/ipad/A.png and b/tests/game-controller-test/Resources/ipad/A.png differ diff --git a/tests/game-controller-test/Resources/ipad/B.png b/tests/game-controller-test/Resources/ipad/B.png index 0595ae9cf17d..5f14c27bb78e 100644 Binary files a/tests/game-controller-test/Resources/ipad/B.png and b/tests/game-controller-test/Resources/ipad/B.png differ diff --git a/tests/game-controller-test/Resources/ipad/CloseNormal.png b/tests/game-controller-test/Resources/ipad/CloseNormal.png index 97237344c53b..85a44c0d0367 100644 Binary files a/tests/game-controller-test/Resources/ipad/CloseNormal.png and b/tests/game-controller-test/Resources/ipad/CloseNormal.png differ diff --git a/tests/game-controller-test/Resources/ipad/CloseSelected.png b/tests/game-controller-test/Resources/ipad/CloseSelected.png index 3440df6b1517..42c55a30a230 100644 Binary files a/tests/game-controller-test/Resources/ipad/CloseSelected.png and b/tests/game-controller-test/Resources/ipad/CloseSelected.png differ diff --git a/tests/game-controller-test/Resources/ipad/L1.png b/tests/game-controller-test/Resources/ipad/L1.png index db5abd7f259f..a59e0c74d76b 100644 Binary files a/tests/game-controller-test/Resources/ipad/L1.png and b/tests/game-controller-test/Resources/ipad/L1.png differ diff --git a/tests/game-controller-test/Resources/ipad/L2.png b/tests/game-controller-test/Resources/ipad/L2.png index eb7fc523d732..526d7276171f 100644 Binary files a/tests/game-controller-test/Resources/ipad/L2.png and b/tests/game-controller-test/Resources/ipad/L2.png differ diff --git a/tests/game-controller-test/Resources/ipad/R1.png b/tests/game-controller-test/Resources/ipad/R1.png index 291af0fd6bb2..028abf6363ed 100644 Binary files a/tests/game-controller-test/Resources/ipad/R1.png and b/tests/game-controller-test/Resources/ipad/R1.png differ diff --git a/tests/game-controller-test/Resources/ipad/R2.png b/tests/game-controller-test/Resources/ipad/R2.png index c7dabe62c148..10109019b211 100644 Binary files a/tests/game-controller-test/Resources/ipad/R2.png and b/tests/game-controller-test/Resources/ipad/R2.png differ diff --git a/tests/game-controller-test/Resources/ipad/X.png b/tests/game-controller-test/Resources/ipad/X.png index 1fed711bd561..38b3a03ec47e 100644 Binary files a/tests/game-controller-test/Resources/ipad/X.png and b/tests/game-controller-test/Resources/ipad/X.png differ diff --git a/tests/game-controller-test/Resources/ipad/Y.png b/tests/game-controller-test/Resources/ipad/Y.png index 3b2bfeeebf49..180d80a39e79 100644 Binary files a/tests/game-controller-test/Resources/ipad/Y.png and b/tests/game-controller-test/Resources/ipad/Y.png differ diff --git a/tests/game-controller-test/Resources/ipad/controller-1.png b/tests/game-controller-test/Resources/ipad/controller-1.png index 389c2276dd8a..347b8f4f3111 100644 Binary files a/tests/game-controller-test/Resources/ipad/controller-1.png and b/tests/game-controller-test/Resources/ipad/controller-1.png differ diff --git a/tests/game-controller-test/Resources/ipad/controller-2.png b/tests/game-controller-test/Resources/ipad/controller-2.png index 1d92330f938e..5116523c5e57 100644 Binary files a/tests/game-controller-test/Resources/ipad/controller-2.png and b/tests/game-controller-test/Resources/ipad/controller-2.png differ diff --git a/tests/game-controller-test/Resources/ipad/dPad.png b/tests/game-controller-test/Resources/ipad/dPad.png index eb6a5b84a752..79963b856590 100644 Binary files a/tests/game-controller-test/Resources/ipad/dPad.png and b/tests/game-controller-test/Resources/ipad/dPad.png differ diff --git a/tests/game-controller-test/Resources/ipad/dpad-key.png b/tests/game-controller-test/Resources/ipad/dpad-key.png index 1ce511431042..9000a25eedda 100644 Binary files a/tests/game-controller-test/Resources/ipad/dpad-key.png and b/tests/game-controller-test/Resources/ipad/dpad-key.png differ diff --git a/tests/game-controller-test/Resources/ipad/joystick.png b/tests/game-controller-test/Resources/ipad/joystick.png index d9edf57c4425..801f68c2547c 100644 Binary files a/tests/game-controller-test/Resources/ipad/joystick.png and b/tests/game-controller-test/Resources/ipad/joystick.png differ diff --git a/tests/game-controller-test/Resources/ipadhd/A.png b/tests/game-controller-test/Resources/ipadhd/A.png index 2704d750dd64..d5fb7b2928de 100644 Binary files a/tests/game-controller-test/Resources/ipadhd/A.png and b/tests/game-controller-test/Resources/ipadhd/A.png differ diff --git a/tests/game-controller-test/Resources/ipadhd/B.png b/tests/game-controller-test/Resources/ipadhd/B.png index 303af3a48985..ccb1bf07bacd 100644 Binary files a/tests/game-controller-test/Resources/ipadhd/B.png and b/tests/game-controller-test/Resources/ipadhd/B.png differ diff --git a/tests/game-controller-test/Resources/ipadhd/CloseNormal.png b/tests/game-controller-test/Resources/ipadhd/CloseNormal.png index caf94654b3c1..c0cac812713e 100644 Binary files a/tests/game-controller-test/Resources/ipadhd/CloseNormal.png and b/tests/game-controller-test/Resources/ipadhd/CloseNormal.png differ diff --git a/tests/game-controller-test/Resources/ipadhd/CloseSelected.png b/tests/game-controller-test/Resources/ipadhd/CloseSelected.png index b024f2704cf1..8df43e29a476 100644 Binary files a/tests/game-controller-test/Resources/ipadhd/CloseSelected.png and b/tests/game-controller-test/Resources/ipadhd/CloseSelected.png differ diff --git a/tests/game-controller-test/Resources/ipadhd/L1.png b/tests/game-controller-test/Resources/ipadhd/L1.png index 9fb7a51626f2..1280cf85d0b7 100644 Binary files a/tests/game-controller-test/Resources/ipadhd/L1.png and b/tests/game-controller-test/Resources/ipadhd/L1.png differ diff --git a/tests/game-controller-test/Resources/ipadhd/L2.png b/tests/game-controller-test/Resources/ipadhd/L2.png index b4d100746ab5..85d52f2c8ba1 100644 Binary files a/tests/game-controller-test/Resources/ipadhd/L2.png and b/tests/game-controller-test/Resources/ipadhd/L2.png differ diff --git a/tests/game-controller-test/Resources/ipadhd/R1.png b/tests/game-controller-test/Resources/ipadhd/R1.png index 41f7e919182c..59e71ccb644f 100644 Binary files a/tests/game-controller-test/Resources/ipadhd/R1.png and b/tests/game-controller-test/Resources/ipadhd/R1.png differ diff --git a/tests/game-controller-test/Resources/ipadhd/R2.png b/tests/game-controller-test/Resources/ipadhd/R2.png index 8463938c00b8..6d5d31ad7fd0 100644 Binary files a/tests/game-controller-test/Resources/ipadhd/R2.png and b/tests/game-controller-test/Resources/ipadhd/R2.png differ diff --git a/tests/game-controller-test/Resources/ipadhd/X.png b/tests/game-controller-test/Resources/ipadhd/X.png index e34347786994..b78718c237c5 100644 Binary files a/tests/game-controller-test/Resources/ipadhd/X.png and b/tests/game-controller-test/Resources/ipadhd/X.png differ diff --git a/tests/game-controller-test/Resources/ipadhd/Y.png b/tests/game-controller-test/Resources/ipadhd/Y.png index 08eec68c1df2..34e6d6db46a2 100644 Binary files a/tests/game-controller-test/Resources/ipadhd/Y.png and b/tests/game-controller-test/Resources/ipadhd/Y.png differ diff --git a/tests/game-controller-test/Resources/ipadhd/controller-1.png b/tests/game-controller-test/Resources/ipadhd/controller-1.png index 0162f2ec8500..f005ea25a864 100644 Binary files a/tests/game-controller-test/Resources/ipadhd/controller-1.png and b/tests/game-controller-test/Resources/ipadhd/controller-1.png differ diff --git a/tests/game-controller-test/Resources/ipadhd/controller-2.png b/tests/game-controller-test/Resources/ipadhd/controller-2.png index 4197024bfc10..2926750b3c8d 100644 Binary files a/tests/game-controller-test/Resources/ipadhd/controller-2.png and b/tests/game-controller-test/Resources/ipadhd/controller-2.png differ diff --git a/tests/game-controller-test/Resources/ipadhd/dPad.png b/tests/game-controller-test/Resources/ipadhd/dPad.png index bc119978a5c6..26860c3714f8 100644 Binary files a/tests/game-controller-test/Resources/ipadhd/dPad.png and b/tests/game-controller-test/Resources/ipadhd/dPad.png differ diff --git a/tests/game-controller-test/Resources/ipadhd/joystick.png b/tests/game-controller-test/Resources/ipadhd/joystick.png index 94bacde78012..4baec700eeb8 100644 Binary files a/tests/game-controller-test/Resources/ipadhd/joystick.png and b/tests/game-controller-test/Resources/ipadhd/joystick.png differ diff --git a/tests/game-controller-test/Resources/iphone/CloseNormal.png b/tests/game-controller-test/Resources/iphone/CloseNormal.png index e52c5fbb9ef7..8ff9369dc96a 100644 Binary files a/tests/game-controller-test/Resources/iphone/CloseNormal.png and b/tests/game-controller-test/Resources/iphone/CloseNormal.png differ diff --git a/tests/game-controller-test/Resources/iphone/CloseSelected.png b/tests/game-controller-test/Resources/iphone/CloseSelected.png index c0eb2975b17e..f75c4179a57c 100644 Binary files a/tests/game-controller-test/Resources/iphone/CloseSelected.png and b/tests/game-controller-test/Resources/iphone/CloseSelected.png differ diff --git a/tests/game-controller-test/proj.android/app/AndroidManifest.xml b/tests/game-controller-test/proj.android/app/AndroidManifest.xml index c4cc598c0fe3..d0d3b954f7af 100644 --- a/tests/game-controller-test/proj.android/app/AndroidManifest.xml +++ b/tests/game-controller-test/proj.android/app/AndroidManifest.xml @@ -13,6 +13,7 @@ diff --git a/tests/game-controller-test/proj.android/app/build.gradle b/tests/game-controller-test/proj.android/app/build.gradle index 14f6d60717f7..1d362989e2f8 100644 --- a/tests/game-controller-test/proj.android/app/build.gradle +++ b/tests/game-controller-test/proj.android/app/build.gradle @@ -26,6 +26,7 @@ android { java.srcDir "src" res.srcDir "res" manifest.srcFile "AndroidManifest.xml" + assets.srcDir "assets" } externalNativeBuild { @@ -81,16 +82,18 @@ buildTypes { } android.applicationVariants.all { variant -> - // delete previous files first - delete "${buildDir}/intermediates/assets/${variant.dirName}" - variant.mergeAssets.doLast { + delete "${projectDir}/assets" + def targetName = variant.name.capitalize() + def copyTaskName = "copy${targetName}ResourcesToAssets" + tasks.register(copyTaskName) { copy { - from "${buildDir}/../../../Resources" - into "${buildDir}/intermediates/assets/${variant.dirName}" + from "${projectDir}/../../Resources" + into "${projectDir}/assets" exclude "**/*.gz" } } + tasks.getByName("pre${targetName}Build").dependsOn copyTaskName } dependencies { diff --git a/tests/game-controller-test/proj.android/app/proguard-rules.pro b/tests/game-controller-test/proj.android/app/proguard-rules.pro index 2c062c494602..9f6d4ff6bfb0 100644 --- a/tests/game-controller-test/proj.android/app/proguard-rules.pro +++ b/tests/game-controller-test/proj.android/app/proguard-rules.pro @@ -23,6 +23,8 @@ -dontwarn com.chukong.** -keep public class com.huawei.android.** { *; } -dontwarn com.huawei.android.** +-keep public class com.oppo.oiface.engine.** { *; } +-dontwarn com.oppo.oiface.engine.** # Proguard Apache HTTP for release -keep class org.apache.http.** { *; } diff --git a/tests/game-controller-test/proj.android/app/res/mipmap-hdpi/ic_launcher.png b/tests/game-controller-test/proj.android/app/res/mipmap-hdpi/ic_launcher.png index e0731c0ddf96..45ee51d15f96 100644 Binary files a/tests/game-controller-test/proj.android/app/res/mipmap-hdpi/ic_launcher.png and b/tests/game-controller-test/proj.android/app/res/mipmap-hdpi/ic_launcher.png differ diff --git a/tests/game-controller-test/proj.android/app/res/mipmap-mdpi/ic_launcher.png b/tests/game-controller-test/proj.android/app/res/mipmap-mdpi/ic_launcher.png index ef83f645df0b..0dd2a608998e 100644 Binary files a/tests/game-controller-test/proj.android/app/res/mipmap-mdpi/ic_launcher.png and b/tests/game-controller-test/proj.android/app/res/mipmap-mdpi/ic_launcher.png differ diff --git a/tests/game-controller-test/proj.android/app/res/mipmap-xhdpi/ic_launcher.png b/tests/game-controller-test/proj.android/app/res/mipmap-xhdpi/ic_launcher.png index a4c703535fd2..a32f16f930b3 100644 Binary files a/tests/game-controller-test/proj.android/app/res/mipmap-xhdpi/ic_launcher.png and b/tests/game-controller-test/proj.android/app/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/tests/game-controller-test/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png b/tests/game-controller-test/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png index 0869e705e85c..332f268edc46 100644 Binary files a/tests/game-controller-test/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png and b/tests/game-controller-test/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/tests/game-controller-test/proj.android/build.gradle b/tests/game-controller-test/proj.android/build.gradle index 5dff94de2a97..63697d83ac6c 100644 --- a/tests/game-controller-test/proj.android/build.gradle +++ b/tests/game-controller-test/proj.android/build.gradle @@ -7,7 +7,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.1.0' + classpath 'com.android.tools.build:gradle:3.4.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/tests/game-controller-test/proj.android/gradle/wrapper/gradle-wrapper.properties b/tests/game-controller-test/proj.android/gradle/wrapper/gradle-wrapper.properties index 6e3913e700c1..83d7cdd9d652 100644 --- a/tests/game-controller-test/proj.android/gradle/wrapper/gradle-wrapper.properties +++ b/tests/game-controller-test/proj.android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip diff --git a/tests/game-controller-test/proj.android/settings.gradle b/tests/game-controller-test/proj.android/settings.gradle index f8b8e3329d1d..5b83b6c5f177 100644 --- a/tests/game-controller-test/proj.android/settings.gradle +++ b/tests/game-controller-test/proj.android/settings.gradle @@ -2,3 +2,4 @@ include ':libcocos2dx_with_controller' project(':libcocos2dx_with_controller').projectDir = new File(settingsDir, '../../../cocos/platform/android/libcocos2dx-with-controller') include ':GameControllerTest' project(':GameControllerTest').projectDir = new File(settingsDir, 'app') +rootProject.name = "game-controller-test" diff --git a/tests/game-controller-test/proj.ios/AppController.mm b/tests/game-controller-test/proj.ios/AppController.mm index 3a15b4b7feac..e87c4264b79b 100644 --- a/tests/game-controller-test/proj.ios/AppController.mm +++ b/tests/game-controller-test/proj.ios/AppController.mm @@ -76,6 +76,12 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( [[UIApplication sharedApplication] setStatusBarHidden: YES]; #endif + //Launching the app with the arguments -NSAllowsDefaultLineBreakStrategy NO to force back to the old behavior. + if ( [[UIDevice currentDevice].systemVersion floatValue] >= 13.0f) + { + [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"NSAllowsDefaultLineBreakStrategy"]; + } + // IMPORTANT: Setting the GLView should be done after creating the RootViewController cocos2d::GLView *glview = cocos2d::GLViewImpl::createWithEAGLView(eaglView); cocos2d::Director::getInstance()->setOpenGLView(glview); diff --git a/tests/game-controller-test/proj.ios/Default-568h@2x.png b/tests/game-controller-test/proj.ios/Default-568h@2x.png index 1e58dc1fc033..66c6d1cead37 100644 Binary files a/tests/game-controller-test/proj.ios/Default-568h@2x.png and b/tests/game-controller-test/proj.ios/Default-568h@2x.png differ diff --git a/tests/game-controller-test/proj.ios/Default-667h@2x.png b/tests/game-controller-test/proj.ios/Default-667h@2x.png index c9d3b3d4266d..a0f61ec8e639 100644 Binary files a/tests/game-controller-test/proj.ios/Default-667h@2x.png and b/tests/game-controller-test/proj.ios/Default-667h@2x.png differ diff --git a/tests/game-controller-test/proj.ios/Default-736h@3x.png b/tests/game-controller-test/proj.ios/Default-736h@3x.png index b2d16d9568c9..dadccee68624 100644 Binary files a/tests/game-controller-test/proj.ios/Default-736h@3x.png and b/tests/game-controller-test/proj.ios/Default-736h@3x.png differ diff --git a/tests/game-controller-test/proj.ios/Default.png b/tests/game-controller-test/proj.ios/Default.png index 3ff42990fe3a..dcb80725de2a 100644 Binary files a/tests/game-controller-test/proj.ios/Default.png and b/tests/game-controller-test/proj.ios/Default.png differ diff --git a/tests/game-controller-test/proj.ios/Default@2x.png b/tests/game-controller-test/proj.ios/Default@2x.png index 9fcc4115eb79..84689888a14a 100644 Binary files a/tests/game-controller-test/proj.ios/Default@2x.png and b/tests/game-controller-test/proj.ios/Default@2x.png differ diff --git a/tests/game-controller-test/proj.ios/Icon-100.png b/tests/game-controller-test/proj.ios/Icon-100.png index 0791e8db2b23..ef38d4500a80 100644 Binary files a/tests/game-controller-test/proj.ios/Icon-100.png and b/tests/game-controller-test/proj.ios/Icon-100.png differ diff --git a/tests/game-controller-test/proj.ios/Icon-114.png b/tests/game-controller-test/proj.ios/Icon-114.png index 9d822dd646c1..c3807861ad29 100644 Binary files a/tests/game-controller-test/proj.ios/Icon-114.png and b/tests/game-controller-test/proj.ios/Icon-114.png differ diff --git a/tests/game-controller-test/proj.ios/Icon-120.png b/tests/game-controller-test/proj.ios/Icon-120.png index a4cde8ab3ac6..a5b49ccbb199 100644 Binary files a/tests/game-controller-test/proj.ios/Icon-120.png and b/tests/game-controller-test/proj.ios/Icon-120.png differ diff --git a/tests/game-controller-test/proj.ios/Icon-144.png b/tests/game-controller-test/proj.ios/Icon-144.png index c613bec2dcd1..1526615c02d1 100644 Binary files a/tests/game-controller-test/proj.ios/Icon-144.png and b/tests/game-controller-test/proj.ios/Icon-144.png differ diff --git a/tests/game-controller-test/proj.ios/Icon-152.png b/tests/game-controller-test/proj.ios/Icon-152.png index 978f1ba7dc2c..8aa82506d0d1 100644 Binary files a/tests/game-controller-test/proj.ios/Icon-152.png and b/tests/game-controller-test/proj.ios/Icon-152.png differ diff --git a/tests/game-controller-test/proj.ios/Icon-40.png b/tests/game-controller-test/proj.ios/Icon-40.png index 453036453045..775685daca94 100644 Binary files a/tests/game-controller-test/proj.ios/Icon-40.png and b/tests/game-controller-test/proj.ios/Icon-40.png differ diff --git a/tests/game-controller-test/proj.ios/Icon-57.png b/tests/game-controller-test/proj.ios/Icon-57.png index 2c5b1a8d067e..4fcc6fddffe1 100644 Binary files a/tests/game-controller-test/proj.ios/Icon-57.png and b/tests/game-controller-test/proj.ios/Icon-57.png differ diff --git a/tests/game-controller-test/proj.ios/Icon-58.png b/tests/game-controller-test/proj.ios/Icon-58.png index 0d72b8acc88a..f0f8b7fe9833 100644 Binary files a/tests/game-controller-test/proj.ios/Icon-58.png and b/tests/game-controller-test/proj.ios/Icon-58.png differ diff --git a/tests/game-controller-test/proj.ios/Icon-72.png b/tests/game-controller-test/proj.ios/Icon-72.png index 9f28d1f72ebf..2c573c8df4c3 100644 Binary files a/tests/game-controller-test/proj.ios/Icon-72.png and b/tests/game-controller-test/proj.ios/Icon-72.png differ diff --git a/tests/game-controller-test/proj.ios/Icon-76.png b/tests/game-controller-test/proj.ios/Icon-76.png index 9c5fc86d91bd..8a1fa1850c03 100644 Binary files a/tests/game-controller-test/proj.ios/Icon-76.png and b/tests/game-controller-test/proj.ios/Icon-76.png differ diff --git a/tests/game-controller-test/proj.ios/Icon-80.png b/tests/game-controller-test/proj.ios/Icon-80.png index 99c0ebce2c3d..d9c7ab446bb7 100644 Binary files a/tests/game-controller-test/proj.ios/Icon-80.png and b/tests/game-controller-test/proj.ios/Icon-80.png differ diff --git a/tests/game-controller-test/proj.ios/Info.plist b/tests/game-controller-test/proj.ios/Info.plist index 68812d5ae512..40bef2149a79 100644 --- a/tests/game-controller-test/proj.ios/Info.plist +++ b/tests/game-controller-test/proj.ios/Info.plist @@ -72,7 +72,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - + 1.0 CFBundleSignature ???? CFBundleVersion diff --git a/tests/game-controller-test/proj.ios/RootViewController.mm b/tests/game-controller-test/proj.ios/RootViewController.mm index 9032b654371d..7d2df0607488 100644 --- a/tests/game-controller-test/proj.ios/RootViewController.mm +++ b/tests/game-controller-test/proj.ios/RootViewController.mm @@ -25,7 +25,7 @@ of this software and associated documentation files (the "Software"), to deal ****************************************************************************/ #import "RootViewController.h" - +#import "platform/ios/CCDirectorCaller-ios.h" @implementation RootViewController @@ -50,8 +50,15 @@ - (void)loadView { - (void)viewDidLoad { [super viewDidLoad]; } - */ + +//In iOS 12.0+, Screen Time's bug cause UIApplicationDidBecomeActiveNotification and UIApplicationWillResignActiveNotification do not fired +//so we need to active CCDirectorCaller manually +-(void)viewDidAppear:(BOOL)animated{ + [super viewDidAppear:animated]; + [[CCDirectorCaller sharedDirectorCaller] setActive:YES]; +} + // Override to allow orientations other than the default portrait orientation. // This method is deprecated on ios6 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { diff --git a/tests/game-controller-test/proj.mac/en.lproj/MainMenu.xib b/tests/game-controller-test/proj.mac/en.lproj/MainMenu.xib deleted file mode 100644 index 3dacdedbd0ba..000000000000 --- a/tests/game-controller-test/proj.mac/en.lproj/MainMenu.xib +++ /dev/null @@ -1,812 +0,0 @@ - - - - 1060 - 10K549 - 1938 - 1038.36 - 461.00 - - com.apple.InterfaceBuilder.CocoaPlugin - 1938 - - - YES - NSMenuItem - NSCustomObject - NSMenu - - - YES - com.apple.InterfaceBuilder.CocoaPlugin - - - PluginDependencyRecalculationVersion - - - - YES - - NSApplication - - - FirstResponder - - - NSApplication - - - AMainMenu - - YES - - - TestCpp - - 1048576 - 2147483647 - - NSImage - NSMenuCheckmark - - - NSImage - NSMenuMixedState - - submenuAction: - - TestCpp - - YES - - - About TestCpp - - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Preferences… - , - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Services - - 1048576 - 2147483647 - - - submenuAction: - - Services - - YES - - _NSServicesMenu - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Hide TestCpp - h - 1048576 - 2147483647 - - - - - - Hide Others - h - 1572864 - 2147483647 - - - - - - Show All - - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Quit TestCpp - q - 1048576 - 2147483647 - - - - - _NSAppleMenu - - - - - View - - 1048576 - 2147483647 - - - submenuAction: - - View - - YES - - - Toggle Fullscreen - f - 1048576 - 2147483647 - - - - - - - - - Window - - 1048576 - 2147483647 - - - submenuAction: - - Window - - YES - - - Minimize - m - 1048576 - 2147483647 - - - - - - Zoom - - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Bring All to Front - - 1048576 - 2147483647 - - - - - _NSWindowsMenu - - - - - Help - - 2147483647 - - - submenuAction: - - Help - - YES - - - TestCpp Help - ? - 1048576 - 2147483647 - - - - - _NSHelpMenu - - - - _NSMainMenu - - - AppController - - - NSFontManager - - - - - YES - - - terminate: - - - - 449 - - - - orderFrontStandardAboutPanel: - - - - 142 - - - - delegate - - - - 495 - - - - performMiniaturize: - - - - 37 - - - - arrangeInFront: - - - - 39 - - - - performZoom: - - - - 240 - - - - hide: - - - - 367 - - - - hideOtherApplications: - - - - 368 - - - - unhideAllApplications: - - - - 370 - - - - showHelp: - - - - 493 - - - - toggleFullScreen: - - - - 537 - - - - - YES - - 0 - - YES - - - - - - -2 - - - File's Owner - - - -1 - - - First Responder - - - -3 - - - Application - - - 29 - - - YES - - - - - - - - - 19 - - - YES - - - - - - 56 - - - YES - - - - - - 57 - - - YES - - - - - - - - - - - - - - - - 58 - - - - - 134 - - - - - 150 - - - - - 136 - - - - - 144 - - - - - 129 - - - - - 143 - - - - - 236 - - - - - 131 - - - YES - - - - - - 149 - - - - - 145 - - - - - 130 - - - - - 24 - - - YES - - - - - - - - - 92 - - - - - 5 - - - - - 239 - - - - - 23 - - - - - 295 - - - YES - - - - - - 296 - - - YES - - - - - - 420 - - - - - 490 - - - YES - - - - - - 491 - - - YES - - - - - - 492 - - - - - 494 - - - - - 536 - - - - - - - YES - - YES - -1.IBPluginDependency - -2.IBPluginDependency - -3.IBPluginDependency - 129.IBPluginDependency - 130.IBPluginDependency - 131.IBPluginDependency - 134.IBPluginDependency - 136.IBPluginDependency - 143.IBPluginDependency - 144.IBPluginDependency - 145.IBPluginDependency - 149.IBPluginDependency - 150.IBPluginDependency - 19.IBPluginDependency - 23.IBPluginDependency - 236.IBPluginDependency - 239.IBPluginDependency - 24.IBPluginDependency - 29.IBPluginDependency - 295.IBPluginDependency - 296.IBPluginDependency - 420.IBPluginDependency - 490.IBPluginDependency - 491.IBPluginDependency - 492.IBPluginDependency - 494.IBPluginDependency - 5.IBPluginDependency - 536.IBPluginDependency - 56.IBPluginDependency - 57.IBPluginDependency - 58.IBPluginDependency - 92.IBPluginDependency - - - YES - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - - YES - - - - - - YES - - - - - 541 - - - - YES - - AppController - NSObject - - YES - - YES - exitFullScreen: - toggleFullScreen: - - - YES - id - id - - - - YES - - YES - exitFullScreen: - toggleFullScreen: - - - YES - - exitFullScreen: - id - - - toggleFullScreen: - id - - - - - YES - - YES - glView - window - - - YES - EAGLView - NSWindow - - - - YES - - YES - glView - window - - - YES - - glView - EAGLView - - - window - NSWindow - - - - - IBProjectSource - ./Classes/AppController.h - - - - EAGLView - NSOpenGLView - - IBProjectSource - ./Classes/EAGLView.h - - - - - 0 - IBCocoaFramework - - com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 - - - YES - 3 - - YES - - YES - NSMenuCheckmark - NSMenuMixedState - - - YES - {9, 8} - {7, 2} - - - - diff --git a/tests/game-controller-test/proj.win32/game-controller-test.vcxproj b/tests/game-controller-test/proj.win32/game-controller-test.vcxproj index 3ea8c11aad50..1d0d348cb095 100644 --- a/tests/game-controller-test/proj.win32/game-controller-test.vcxproj +++ b/tests/game-controller-test/proj.win32/game-controller-test.vcxproj @@ -14,6 +14,7 @@ {1FA2BD06-2F52-48F6-8468-C0CC33127F5E} test_win32 Win32Proj + 10.0.17134.0 @@ -103,7 +104,7 @@ - xcopy "$(ProjectDir)..\Resources" "$(OutDir)" /D /E /I /F /Y + xcopy "$(ProjectDir)..\Resources" "$(OutDir)\Resources\" /D /E /I /F /Y xcopy "$(OutDir)..\*.dll" "$(OutDir)" /D /Y @@ -144,7 +145,7 @@ xcopy "$(OutDir)..\*.dll" "$(OutDir)" /D /Y - xcopy "$(ProjectDir)..\Resources" "$(OutDir)" /D /E /I /F /Y + xcopy "$(ProjectDir)..\Resources" "$(OutDir)\Resources\" /D /E /I /F /Y xcopy "$(OutDir)..\*.dll" "$(OutDir)" /D /Y diff --git a/tests/js-tests/project/CMakeLists.txt b/tests/js-tests/project/CMakeLists.txt index be5ed780b492..c81b78d60afe 100644 --- a/tests/js-tests/project/CMakeLists.txt +++ b/tests/js-tests/project/CMakeLists.txt @@ -32,10 +32,8 @@ if(NOT DEFINED BUILD_ENGINE_DONE) set(CMAKE_MODULE_PATH ${COCOS2DX_ROOT_PATH}/cmake/Modules/) include(CocosBuildSet) - if(NOT USE_COCOS_PREBUILT) - set(BUILD_JS_LIBS ON) - add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos ${ENGINE_BINARY_PATH}/cocos/core) - endif() + set(BUILD_JS_LIBS ON) + add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos ${ENGINE_BINARY_PATH}/cocos/core) endif() set(res_main_files @@ -110,7 +108,6 @@ elseif(APPLE) proj.mac/Icon.icns proj.mac/Test_Info.plist proj.mac/Test_Prefix.pch - proj.mac/en.lproj/MainMenu.xib proj.mac/en.lproj/InfoPlist.strings ) list(APPEND GAME_SOURCE @@ -158,15 +155,18 @@ if(APPLE) elseif(IOS) cocos_pak_xcode(${APP_NAME} INFO_PLIST "iOSBundleInfo.plist.in") set_xcode_property(${APP_NAME} ASSETCATALOG_COMPILER_APPICON_NAME "AppIcon-${APP_NAME}") + set_xcode_property(${APP_NAME} DEVELOPMENT_TEAM "") + set_xcode_property(${APP_NAME} CODE_SIGN_IDENTITY "iPhone Developer") endif() elseif(WINDOWS) - cocos_copy_target_dll(${APP_NAME} COPY_TO ${APP_RES_DIR}) + cocos_copy_target_dll(${APP_NAME}) endif() if(LINUX OR WINDOWS) - cocos_copy_res(COPY_TO ${APP_RES_DIR} FILES ${res_main_files}) - cocos_copy_res(COPY_TO ${APP_RES_DIR}/res FOLDERS ${res_res_folders}) - cocos_copy_res(COPY_TO ${APP_RES_DIR}/src FOLDERS ${res_src_folders}) - cocos_copy_res(COPY_TO ${APP_RES_DIR}/script FOLDERS ${res_script_folders}) + set(APP_RES_DIR "$/Resources") + cocos_copy_target_res(${APP_NAME} COPY_TO ${APP_RES_DIR} FILES ${res_main_files}) + cocos_copy_target_res(${APP_NAME} COPY_TO ${APP_RES_DIR}/res FOLDERS ${res_res_folders}) + cocos_copy_target_res(${APP_NAME} COPY_TO ${APP_RES_DIR}/src FOLDERS ${res_src_folders}) + cocos_copy_target_res(${APP_NAME} COPY_TO ${APP_RES_DIR}/script FOLDERS ${res_script_folders}) endif() diff --git a/tests/js-tests/project/Classes/AppDelegate.cpp b/tests/js-tests/project/Classes/AppDelegate.cpp index 6f116f2915d4..1b01eab1b6e4 100644 --- a/tests/js-tests/project/Classes/AppDelegate.cpp +++ b/tests/js-tests/project/Classes/AppDelegate.cpp @@ -88,7 +88,6 @@ AppDelegate::AppDelegate() AppDelegate::~AppDelegate() { - ScriptEngineManager::destroyInstance(); } void AppDelegate::initGLContextAttrs() diff --git a/tests/js-tests/project/Classes/js_DrawNode3D_bindings.cpp b/tests/js-tests/project/Classes/js_DrawNode3D_bindings.cpp index 2a299f11d518..3388cdf24b78 100644 --- a/tests/js-tests/project/Classes/js_DrawNode3D_bindings.cpp +++ b/tests/js-tests/project/Classes/js_DrawNode3D_bindings.cpp @@ -132,7 +132,7 @@ DrawNode3D::~DrawNode3D() if (Configuration::getInstance()->supportsShareableVAO()) { glDeleteVertexArrays(1, &_vao); - glBindVertexArray(0); + GL::bindVAO(0); _vao = 0; } } @@ -174,7 +174,7 @@ bool DrawNode3D::init() if (Configuration::getInstance()->supportsShareableVAO()) { glGenVertexArrays(1, &_vao); - glBindVertexArray(_vao); + GL::bindVAO(_vao); } glGenBuffers(1, &_vbo); @@ -191,7 +191,7 @@ bool DrawNode3D::init() if (Configuration::getInstance()->supportsShareableVAO()) { - glBindVertexArray(0); + GL::bindVAO(0); } CHECK_GL_ERROR_DEBUG(); @@ -224,7 +224,7 @@ void DrawNode3D::onDraw(const Mat4 &transform, uint32_t flags) glProgram->use(); glProgram->setUniformsForBuiltins(transform); glEnable(GL_DEPTH_TEST); - glBlendFunc(_blendFunc.src, _blendFunc.dst); + GL::blendFunc(_blendFunc.src, _blendFunc.dst); if (_dirty) { @@ -234,12 +234,11 @@ void DrawNode3D::onDraw(const Mat4 &transform, uint32_t flags) } if (Configuration::getInstance()->supportsShareableVAO()) { - glBindVertexArray(_vao); + GL::bindVAO(_vao); } else { - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_COLOR); + GL::enableVertexAttribs(GL::VERTEX_ATTRIB_FLAG_POS_COLOR_TEX); glBindBuffer(GL_ARRAY_BUFFER, _vbo); // vertex @@ -562,4 +561,4 @@ void register_DrawNode3D_bindings(JSContext *cx, JS::HandleObject global) JS::RootedObject ccobj(cx); get_or_create_js_obj(cx, global, "cc", &ccobj); js_register_cocos2dx_DrawNode3D(cx, ccobj); -} +} \ No newline at end of file diff --git a/tests/js-tests/project/Classes/js_Effect3D_bindings.cpp b/tests/js-tests/project/Classes/js_Effect3D_bindings.cpp index 98845f9d8d8d..ba3510edf135 100644 --- a/tests/js-tests/project/Classes/js_Effect3D_bindings.cpp +++ b/tests/js-tests/project/Classes/js_Effect3D_bindings.cpp @@ -119,7 +119,7 @@ EffectSprite3D* EffectSprite3D::createFromObjFileAndTexture(const std::string &o if (sprite && sprite->initWithFile(objFilePath)) { sprite->autorelease(); - if(textureFilePath.size() > 0) + if(!textureFilePath.empty()) sprite->setTexture(textureFilePath); return sprite; } @@ -176,7 +176,7 @@ void EffectSprite3D::addEffect(Effect3DOutline* effect, ssize_t order) effect->retain(); effect->setTarget(this); - _effects.push_back(std::make_tuple(order,effect,CustomCommand())); + _effects.emplace_back(order,effect,CustomCommand()); std::sort(std::begin(_effects), std::end(_effects), tuple_sort); } diff --git a/tests/js-tests/project/proj.android/app/AndroidManifest.xml b/tests/js-tests/project/proj.android/app/AndroidManifest.xml index 2e52099d32e7..6be2691cf131 100644 --- a/tests/js-tests/project/proj.android/app/AndroidManifest.xml +++ b/tests/js-tests/project/proj.android/app/AndroidManifest.xml @@ -14,6 +14,7 @@ diff --git a/tests/js-tests/project/proj.android/app/build.gradle b/tests/js-tests/project/proj.android/app/build.gradle index 5265372f9277..3d65f1b7c2f5 100644 --- a/tests/js-tests/project/proj.android/app/build.gradle +++ b/tests/js-tests/project/proj.android/app/build.gradle @@ -34,9 +34,8 @@ android { else if (PROP_BUILD_TYPE == 'cmake') { cmake { targets "js_tests" - arguments "-DCMAKE_FIND_ROOT_PATH=", "-DANDROID_STL=c++_static", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE", \ - "-DUSE_CHIPMUNK=TRUE", "-DUSE_BULLET=TRUE", "-DBUILD_JS_LIBS=TRUE" - cppFlags "-frtti -fexceptions" + arguments "-DCMAKE_FIND_ROOT_PATH=", "-DANDROID_STL=c++_static", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE" + cppFlags "-frtti -fexceptions -fsigned-char" } } } @@ -51,6 +50,7 @@ android { java.srcDir "src" res.srcDir "res" manifest.srcFile "AndroidManifest.xml" + assets.srcDir "assets" } externalNativeBuild { @@ -115,11 +115,19 @@ def getCocosCommandPath() { return 'cocos.bat' } else { + + def env_console_path = System.getenv("COCOS_CONSOLE_ROOT") + + if (env_console_path != null && !env_console_path.trim().isEmpty()) { + return new File(env_console_path.trim() + '/cocos').absolutePath + } + // on unix like system, can not get environments variables easily // so run a shell script to get environment variable sets by cocos2d-x setup.py new ByteArrayOutputStream().withStream { os -> def result = exec { - executable = project.file('get_environment.sh') + executable = "/bin/bash" + args = [ "-i", project.file('get_environment.sh')] standardOutput = os } ext.console_path = os.toString().trim() @@ -146,41 +154,43 @@ def compileJS(srcDir, dstDir) { } android.applicationVariants.all { variant -> - // delete previous files first - delete "${buildDir}/intermediates/assets/${variant.dirName}" - - variant.mergeAssets.doLast { + + delete "${projectDir}/assets" + def targetName = variant.name.capitalize() + def copyTaskName = "copy${targetName}ResourcesToAssets" + + tasks.register(copyTaskName) { copy { - from "${buildDir}/../../../../res" - into "${buildDir}/intermediates/assets/${variant.dirName}/res" + from "${projectDir}/../../../res" + into "${projectDir}/assets/res" } copy { - from "${buildDir}/../../../../resjs" - into "${buildDir}/intermediates/assets/${variant.dirName}/res/resjs" + from "${projectDir}/../../../resjs" + into "${projectDir}/assets/res/resjs" } copy { - from "${buildDir}/../../../../src" - into "${buildDir}/intermediates/assets/${variant.dirName}/src" + from "${projectDir}/../../../src" + into "${projectDir}/assets/src" } copy { - from("${buildDir}/../../../../../cpp-tests/Resources") { + from("${projectDir}/../../../../cpp-tests/Resources") { exclude "**/*.gz" } - into "${buildDir}/intermediates/assets/${variant.dirName}/res" + into "${projectDir}/assets/res" } copy { - from "${buildDir}/../../../../../../cocos/scripting/js-bindings/script" - into "${buildDir}/intermediates/assets/${variant.dirName}/script" + from "${projectDir}/../../../../../cocos/scripting/js-bindings/script" + into "${projectDir}/assets/script" } copy { - from "${buildDir}/../../../../main.js" - from "${buildDir}/../../../../project.json" - into "${buildDir}/intermediates/assets/${variant.dirName}" + from "${projectDir}/../../../main.js" + from "${projectDir}/../../../project.json" + into "${projectDir}/assets" } // compile the scripts if necessary @@ -190,10 +200,11 @@ android.applicationVariants.all { variant -> } if (compileScript) { - compileJS("${buildDir}/intermediates/assets/${variant.dirName}", - "${buildDir}/intermediates/assets/${variant.dirName}") + compileJS("${projectDir}/assets", + "${projectDir}/assets") } } + tasks.getByName("pre${targetName}Build").dependsOn copyTaskName } dependencies { diff --git a/tests/js-tests/project/proj.android/app/get_environment.sh b/tests/js-tests/project/proj.android/app/get_environment.sh index 102f7247e70a..61ce03524ccb 100755 --- a/tests/js-tests/project/proj.android/app/get_environment.sh +++ b/tests/js-tests/project/proj.android/app/get_environment.sh @@ -1,4 +1,11 @@ #!/bin/bash -source ~/.bash_profile -echo $COCOS_CONSOLE_ROOT \ No newline at end of file +if [ -f $HOME/.bashrc ]; then + source $HOME/.bashrc +fi + +if [ -f $HOME/.bash_profile ]; then + source $HOME/.bash_profile +fi + +echo $COCOS_CONSOLE_ROOT diff --git a/tests/js-tests/project/proj.android/app/proguard-rules.pro b/tests/js-tests/project/proj.android/app/proguard-rules.pro index 2c062c494602..9f6d4ff6bfb0 100644 --- a/tests/js-tests/project/proj.android/app/proguard-rules.pro +++ b/tests/js-tests/project/proj.android/app/proguard-rules.pro @@ -23,6 +23,8 @@ -dontwarn com.chukong.** -keep public class com.huawei.android.** { *; } -dontwarn com.huawei.android.** +-keep public class com.oppo.oiface.engine.** { *; } +-dontwarn com.oppo.oiface.engine.** # Proguard Apache HTTP for release -keep class org.apache.http.** { *; } diff --git a/tests/js-tests/project/proj.android/app/res/mipmap-hdpi/ic_launcher.png b/tests/js-tests/project/proj.android/app/res/mipmap-hdpi/ic_launcher.png index b0d2b4ac10d3..45ee51d15f96 100644 Binary files a/tests/js-tests/project/proj.android/app/res/mipmap-hdpi/ic_launcher.png and b/tests/js-tests/project/proj.android/app/res/mipmap-hdpi/ic_launcher.png differ diff --git a/tests/js-tests/project/proj.android/app/res/mipmap-mdpi/ic_launcher.png b/tests/js-tests/project/proj.android/app/res/mipmap-mdpi/ic_launcher.png index b80addadac9f..0dd2a608998e 100644 Binary files a/tests/js-tests/project/proj.android/app/res/mipmap-mdpi/ic_launcher.png and b/tests/js-tests/project/proj.android/app/res/mipmap-mdpi/ic_launcher.png differ diff --git a/tests/js-tests/project/proj.android/app/res/mipmap-xhdpi/ic_launcher.png b/tests/js-tests/project/proj.android/app/res/mipmap-xhdpi/ic_launcher.png index 57235c0b712b..a32f16f930b3 100644 Binary files a/tests/js-tests/project/proj.android/app/res/mipmap-xhdpi/ic_launcher.png and b/tests/js-tests/project/proj.android/app/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/tests/js-tests/project/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png b/tests/js-tests/project/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png index 15e20bb99277..332f268edc46 100644 Binary files a/tests/js-tests/project/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png and b/tests/js-tests/project/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/tests/js-tests/project/proj.android/build.gradle b/tests/js-tests/project/proj.android/build.gradle index 5dff94de2a97..63697d83ac6c 100644 --- a/tests/js-tests/project/proj.android/build.gradle +++ b/tests/js-tests/project/proj.android/build.gradle @@ -7,7 +7,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.1.0' + classpath 'com.android.tools.build:gradle:3.4.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/tests/js-tests/project/proj.android/gradle/wrapper/gradle-wrapper.properties b/tests/js-tests/project/proj.android/gradle/wrapper/gradle-wrapper.properties index 6a1ed79c57a0..9d8120ac19cd 100644 --- a/tests/js-tests/project/proj.android/gradle/wrapper/gradle-wrapper.properties +++ b/tests/js-tests/project/proj.android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip diff --git a/tests/js-tests/project/proj.android/settings.gradle b/tests/js-tests/project/proj.android/settings.gradle index 05e6a4191f3e..2fde8c99cf41 100644 --- a/tests/js-tests/project/proj.android/settings.gradle +++ b/tests/js-tests/project/proj.android/settings.gradle @@ -2,3 +2,4 @@ include ':libcocos2dx' project(':libcocos2dx').projectDir = new File(settingsDir, '../../../../cocos/platform/android/libcocos2dx') include ':JSTests' project(':JSTests').projectDir = new File(settingsDir, 'app') +rootProject.name = "js-tests" \ No newline at end of file diff --git a/tests/js-tests/project/proj.ios/AppController.mm b/tests/js-tests/project/proj.ios/AppController.mm index 03f6e8443b86..fc429acffa7d 100644 --- a/tests/js-tests/project/proj.ios/AppController.mm +++ b/tests/js-tests/project/proj.ios/AppController.mm @@ -82,6 +82,11 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( #if !defined(CC_TARGET_OS_TVOS) [[UIApplication sharedApplication] setStatusBarHidden: YES]; #endif + //Launching the app with the arguments -NSAllowsDefaultLineBreakStrategy NO to force back to the old behavior. + if ( [[UIDevice currentDevice].systemVersion floatValue] >= 13.0f) + { + [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"NSAllowsDefaultLineBreakStrategy"]; + } // IMPORTANT: Setting the GLView should be done after creating the RootViewController cocos2d::GLView *glview = cocos2d::GLViewImpl::createWithEAGLView(eaglView); diff --git a/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-20.png b/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-20.png index 9ac82f2c131d..8ead23e36507 100644 Binary files a/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-20.png and b/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-20.png differ diff --git a/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-20@2x.png b/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-20@2x.png index 453036453045..775685daca94 100644 Binary files a/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-20@2x.png and b/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-20@2x.png differ diff --git a/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-20@3x.png b/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-20@3x.png index a4cde8ab3ac6..a5b49ccbb199 100644 Binary files a/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-20@3x.png and b/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-20@3x.png differ diff --git a/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-29.png b/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-29.png index b34735dd028f..0500184c869c 100644 Binary files a/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-29.png and b/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-29.png differ diff --git a/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-29@2x.png b/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-29@2x.png index 0d72b8acc88a..f0f8b7fe9833 100644 Binary files a/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-29@2x.png and b/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-29@2x.png differ diff --git a/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-29@3x.png b/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-29@3x.png index 42e8664e038e..5287e50a7986 100644 Binary files a/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-29@3x.png and b/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-29@3x.png differ diff --git a/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-40.png b/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-40.png index 453036453045..775685daca94 100644 Binary files a/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-40.png and b/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-40.png differ diff --git a/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-40@2x.png b/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-40@2x.png index 99c0ebce2c3d..d9c7ab446bb7 100644 Binary files a/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-40@2x.png and b/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-40@2x.png differ diff --git a/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-40@3x.png b/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-40@3x.png index a4cde8ab3ac6..a5b49ccbb199 100644 Binary files a/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-40@3x.png and b/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-40@3x.png differ diff --git a/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-50.png b/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-50.png index 04a74a69d850..ac381bc20e85 100644 Binary files a/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-50.png and b/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-50.png differ diff --git a/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-50@2x.png b/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-50@2x.png index 0791e8db2b23..ef38d4500a80 100644 Binary files a/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-50@2x.png and b/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-50@2x.png differ diff --git a/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-57.png b/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-57.png index 2c5b1a8d067e..4fcc6fddffe1 100644 Binary files a/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-57.png and b/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-57.png differ diff --git a/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-57@2x.png b/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-57@2x.png index 9d822dd646c1..c3807861ad29 100644 Binary files a/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-57@2x.png and b/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-57@2x.png differ diff --git a/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-60@2x.png b/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-60@2x.png index a4cde8ab3ac6..a5b49ccbb199 100644 Binary files a/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-60@2x.png and b/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-60@2x.png differ diff --git a/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-60@3x.png b/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-60@3x.png index 88a5c70568a1..d4bc53132ce3 100644 Binary files a/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-60@3x.png and b/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-60@3x.png differ diff --git a/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-72.png b/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-72.png index 9f28d1f72ebf..2c573c8df4c3 100644 Binary files a/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-72.png and b/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-72.png differ diff --git a/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-72@2x.png b/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-72@2x.png index c613bec2dcd1..1526615c02d1 100644 Binary files a/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-72@2x.png and b/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-72@2x.png differ diff --git a/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-76.png b/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-76.png index 9c5fc86d91bd..8a1fa1850c03 100644 Binary files a/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-76.png and b/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-76.png differ diff --git a/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-76@2x.png b/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-76@2x.png index 978f1ba7dc2c..8aa82506d0d1 100644 Binary files a/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-76@2x.png and b/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-76@2x.png differ diff --git a/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-83.5@2x.png b/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-83.5@2x.png index 599979fa572f..6bf801d17507 100644 Binary files a/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-83.5@2x.png and b/tests/js-tests/project/proj.ios/Images.xcassets/AppIcon-js-tests.appiconset/Icon-83.5@2x.png differ diff --git a/tests/js-tests/project/proj.ios/Info.plist b/tests/js-tests/project/proj.ios/Info.plist index 0cfc150f0fe3..ca028053a40b 100644 --- a/tests/js-tests/project/proj.ios/Info.plist +++ b/tests/js-tests/project/proj.ios/Info.plist @@ -29,6 +29,8 @@ ${PRODUCT_NAME} CFBundlePackageType APPL + CFBundleShortVersionString + 1.0 CFBundleSignature ???? CFBundleURLTypes @@ -55,18 +57,30 @@ UIAppFonts - res/fonts/A Damn Mess.ttf - res/fonts/Abberancy.ttf - res/fonts/Abduction.ttf + res/ccb/comic andy.ttf res/fonts/American Typewriter.ttf - res/fonts/Courier New.ttf - res/fonts/Marker Felt.ttf + res/fonts/Abduction.ttf + res/fonts/ThonburiBold.ttf + res/fonts/Fingerpop.ttf res/fonts/Paint Boy.ttf + res/fonts/A Damn Mess.ttf res/fonts/Schwarzwald Regular.ttf + res/fonts/Courier New.ttf + res/fonts/Japanese.ttf + res/fonts/xingkai-incomplete.ttf + res/fonts/arial.ttf res/fonts/Scissor Cuts.ttf + res/fonts/FingerpopGap.ttf + res/fonts/NotoEmoji-Regular.ttf + res/fonts/Marker Felt.ttf + res/fonts/Schwarzwald.ttf + res/fonts/cyril.ttf res/fonts/tahoma.ttf + res/fonts/HKYuanMini.ttf + res/fonts/cyrillic.ttf + res/fonts/Abberancy.ttf res/fonts/Thonburi.ttf - res/fonts/ThonburiBold.ttf + res/resjs/ccb/comic andy.ttf UILaunchStoryboardName LaunchScreen diff --git a/tests/js-tests/project/proj.ios/LaunchScreenBackground.png b/tests/js-tests/project/proj.ios/LaunchScreenBackground.png index 48d2b63b0116..dadccee68624 100644 Binary files a/tests/js-tests/project/proj.ios/LaunchScreenBackground.png and b/tests/js-tests/project/proj.ios/LaunchScreenBackground.png differ diff --git a/tests/js-tests/project/proj.ios/RootViewController.mm b/tests/js-tests/project/proj.ios/RootViewController.mm index 0e1952eafdfd..4bcdbde169fc 100644 --- a/tests/js-tests/project/proj.ios/RootViewController.mm +++ b/tests/js-tests/project/proj.ios/RootViewController.mm @@ -7,7 +7,7 @@ // #import "RootViewController.h" - +#import "platform/ios/CCDirectorCaller-ios.h" @implementation RootViewController @@ -32,8 +32,15 @@ - (void)loadView { - (void)viewDidLoad { [super viewDidLoad]; } - */ + +//In iOS 12.0+, Screen Time's bug cause UIApplicationDidBecomeActiveNotification and UIApplicationWillResignActiveNotification do not fired +//so we need to active CCDirectorCaller manually +-(void)viewDidAppear:(BOOL)animated{ + [super viewDidAppear:animated]; + [[CCDirectorCaller sharedDirectorCaller] setActive:YES]; +} + // Override to allow orientations other than the default portrait orientation. // This method is deprecated on ios6 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { diff --git a/tests/js-tests/project/proj.mac/en.lproj/MainMenu.xib b/tests/js-tests/project/proj.mac/en.lproj/MainMenu.xib deleted file mode 100644 index 3dacdedbd0ba..000000000000 --- a/tests/js-tests/project/proj.mac/en.lproj/MainMenu.xib +++ /dev/null @@ -1,812 +0,0 @@ - - - - 1060 - 10K549 - 1938 - 1038.36 - 461.00 - - com.apple.InterfaceBuilder.CocoaPlugin - 1938 - - - YES - NSMenuItem - NSCustomObject - NSMenu - - - YES - com.apple.InterfaceBuilder.CocoaPlugin - - - PluginDependencyRecalculationVersion - - - - YES - - NSApplication - - - FirstResponder - - - NSApplication - - - AMainMenu - - YES - - - TestCpp - - 1048576 - 2147483647 - - NSImage - NSMenuCheckmark - - - NSImage - NSMenuMixedState - - submenuAction: - - TestCpp - - YES - - - About TestCpp - - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Preferences… - , - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Services - - 1048576 - 2147483647 - - - submenuAction: - - Services - - YES - - _NSServicesMenu - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Hide TestCpp - h - 1048576 - 2147483647 - - - - - - Hide Others - h - 1572864 - 2147483647 - - - - - - Show All - - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Quit TestCpp - q - 1048576 - 2147483647 - - - - - _NSAppleMenu - - - - - View - - 1048576 - 2147483647 - - - submenuAction: - - View - - YES - - - Toggle Fullscreen - f - 1048576 - 2147483647 - - - - - - - - - Window - - 1048576 - 2147483647 - - - submenuAction: - - Window - - YES - - - Minimize - m - 1048576 - 2147483647 - - - - - - Zoom - - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Bring All to Front - - 1048576 - 2147483647 - - - - - _NSWindowsMenu - - - - - Help - - 2147483647 - - - submenuAction: - - Help - - YES - - - TestCpp Help - ? - 1048576 - 2147483647 - - - - - _NSHelpMenu - - - - _NSMainMenu - - - AppController - - - NSFontManager - - - - - YES - - - terminate: - - - - 449 - - - - orderFrontStandardAboutPanel: - - - - 142 - - - - delegate - - - - 495 - - - - performMiniaturize: - - - - 37 - - - - arrangeInFront: - - - - 39 - - - - performZoom: - - - - 240 - - - - hide: - - - - 367 - - - - hideOtherApplications: - - - - 368 - - - - unhideAllApplications: - - - - 370 - - - - showHelp: - - - - 493 - - - - toggleFullScreen: - - - - 537 - - - - - YES - - 0 - - YES - - - - - - -2 - - - File's Owner - - - -1 - - - First Responder - - - -3 - - - Application - - - 29 - - - YES - - - - - - - - - 19 - - - YES - - - - - - 56 - - - YES - - - - - - 57 - - - YES - - - - - - - - - - - - - - - - 58 - - - - - 134 - - - - - 150 - - - - - 136 - - - - - 144 - - - - - 129 - - - - - 143 - - - - - 236 - - - - - 131 - - - YES - - - - - - 149 - - - - - 145 - - - - - 130 - - - - - 24 - - - YES - - - - - - - - - 92 - - - - - 5 - - - - - 239 - - - - - 23 - - - - - 295 - - - YES - - - - - - 296 - - - YES - - - - - - 420 - - - - - 490 - - - YES - - - - - - 491 - - - YES - - - - - - 492 - - - - - 494 - - - - - 536 - - - - - - - YES - - YES - -1.IBPluginDependency - -2.IBPluginDependency - -3.IBPluginDependency - 129.IBPluginDependency - 130.IBPluginDependency - 131.IBPluginDependency - 134.IBPluginDependency - 136.IBPluginDependency - 143.IBPluginDependency - 144.IBPluginDependency - 145.IBPluginDependency - 149.IBPluginDependency - 150.IBPluginDependency - 19.IBPluginDependency - 23.IBPluginDependency - 236.IBPluginDependency - 239.IBPluginDependency - 24.IBPluginDependency - 29.IBPluginDependency - 295.IBPluginDependency - 296.IBPluginDependency - 420.IBPluginDependency - 490.IBPluginDependency - 491.IBPluginDependency - 492.IBPluginDependency - 494.IBPluginDependency - 5.IBPluginDependency - 536.IBPluginDependency - 56.IBPluginDependency - 57.IBPluginDependency - 58.IBPluginDependency - 92.IBPluginDependency - - - YES - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - - YES - - - - - - YES - - - - - 541 - - - - YES - - AppController - NSObject - - YES - - YES - exitFullScreen: - toggleFullScreen: - - - YES - id - id - - - - YES - - YES - exitFullScreen: - toggleFullScreen: - - - YES - - exitFullScreen: - id - - - toggleFullScreen: - id - - - - - YES - - YES - glView - window - - - YES - EAGLView - NSWindow - - - - YES - - YES - glView - window - - - YES - - glView - EAGLView - - - window - NSWindow - - - - - IBProjectSource - ./Classes/AppController.h - - - - EAGLView - NSOpenGLView - - IBProjectSource - ./Classes/EAGLView.h - - - - - 0 - IBCocoaFramework - - com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 - - - YES - 3 - - YES - - YES - NSMenuCheckmark - NSMenuMixedState - - - YES - {9, 8} - {7, 2} - - - - diff --git a/tests/js-tests/project/proj.win32/js-tests.vcxproj b/tests/js-tests/project/proj.win32/js-tests.vcxproj index 37c376cb8c90..fae67edd8b48 100644 --- a/tests/js-tests/project/proj.win32/js-tests.vcxproj +++ b/tests/js-tests/project/proj.win32/js-tests.vcxproj @@ -13,6 +13,7 @@ {D0F06A44-A245-4D13-A498-0120C203B539} js-tests + 10.0.17134.0 @@ -102,11 +103,6 @@ 0x0409 $(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\include;$(IntDir);%(AdditionalIncludeDirectories) - - if not exist "$(OutDir)" mkdir "$(OutDir)" -xcopy /Y /Q "$(ProjectDir)..\..\..\..\external\spidermonkey\prebuilt\win32\*.*" "$(OutDir)" -xcopy /Y /Q "$(ProjectDir)..\..\..\..\external\websockets\prebuilt\win32\*.*" "$(OutDir)" - mozjs-33.lib;ws2_32.lib;sqlite3.lib;%(AdditionalDependencies) $(OutDir);$(SolutionDir)$(Configuration).win32;%(AdditionalLibraryDirectories) @@ -114,23 +110,23 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\..\external\websockets\prebuilt\win32\*.*" "$ Windows MachineX86 - + if not exist "$(OutDir)" mkdir "$(OutDir)" -mkdir "$(OutDir)\script" -mkdir "$(OutDir)\src" -mkdir "$(OutDir)\res" +mkdir "$(OutDir)\Resources\script" +mkdir "$(OutDir)\Resources\src" +mkdir "$(OutDir)\Resources\res" xcopy "$(OutDir)..\*.dll" "$(OutDir)" /D /Y -xcopy "$(ProjectDir)..\..\..\..\cocos\scripting\js-bindings\script\*" "$(OutDir)\script" /e /Y -xcopy "$(ProjectDir)..\..\src" "$(OutDir)\src\" /e /Y -xcopy "$(ProjectDir)..\..\..\cpp-tests\Resources" "$(OutDir)\res\" /e /Y -copy "$(ProjectDir)..\..\main.js" "$(OutDir)" -copy "$(ProjectDir)..\..\project.json" "$(OutDir)" -xcopy "$(ProjectDir)..\..\resjs" "$(OutDir)\res\resjs\" /e /Y - - +xcopy "$(ProjectDir)..\..\..\..\cocos\scripting\js-bindings\script\*" "$(OutDir)\Resources\script\" /e /Y +xcopy "$(ProjectDir)..\..\src" "$(OutDir)\Resources\src\" /e /Y +xcopy "$(ProjectDir)..\..\..\cpp-tests\Resources" "$(OutDir)\Resources\res\" /e /Y +copy "$(ProjectDir)..\..\main.js" "$(OutDir)\Resources\" +copy "$(ProjectDir)..\..\project.json" "$(OutDir)\Resources\" +xcopy "$(ProjectDir)..\..\resjs" "$(OutDir)\Resources\res\resjs\" /e /Y + + Copy js and resource files. - + @@ -164,11 +160,6 @@ xcopy "$(ProjectDir)..\..\resjs" "$(OutDir)\res\resjs\" /e /Y 0x0409 $(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\include;$(IntDir);%(AdditionalIncludeDirectories) - - if not exist "$(OutDir)" mkdir "$(OutDir)" -xcopy /Y /Q "$(ProjectDir)..\..\..\..\external\spidermonkey\prebuilt\win32\*.*" "$(OutDir)" -xcopy /Y /Q "$(ProjectDir)..\..\..\..\external\websockets\prebuilt\win32\*.*" "$(OutDir)" - mozjs-33.lib;ws2_32.lib;sqlite3.lib;%(AdditionalDependencies) $(OutDir);$(SolutionDir)$(Configuration).win32;%(AdditionalLibraryDirectories) @@ -176,21 +167,24 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\..\external\websockets\prebuilt\win32\*.*" "$ MachineX86 true - + if not exist "$(OutDir)" mkdir "$(OutDir)" -mkdir "$(OutDir)\script" -mkdir "$(OutDir)\src" -mkdir "$(OutDir)\res" +mkdir "$(OutDir)\Resources\script" +mkdir "$(OutDir)\Resources\src" +mkdir "$(OutDir)\Resources\res" xcopy "$(OutDir)..\*.dll" "$(OutDir)" /D /Y -xcopy "$(ProjectDir)..\..\..\..\cocos\scripting\js-bindings\script\*" "$(OutDir)\script" /e /Y -xcopy "$(ProjectDir)..\..\src" "$(OutDir)\src\" /e /Y -xcopy "$(ProjectDir)..\..\..\cpp-tests\Resources" "$(OutDir)\res\" /e /Y -copy "$(ProjectDir)..\..\main.js" "$(OutDir)" -copy "$(ProjectDir)..\..\project.json" "$(OutDir)" -xcopy "$(ProjectDir)..\..\resjs" "$(OutDir)\res\" /e /Y +xcopy "$(ProjectDir)..\..\..\..\cocos\scripting\js-bindings\script\*" "$(OutDir)\Resources\script" /e /Y +xcopy "$(ProjectDir)..\..\src" "$(OutDir)\Resources\src\" /e /Y +xcopy "$(ProjectDir)..\..\..\cpp-tests\Resources" "$(OutDir)\Resources\res\" /e /Y +copy "$(ProjectDir)..\..\main.js" "$(OutDir)\Resources\" +copy "$(ProjectDir)..\..\project.json" "$(OutDir)\Resources\" +xcopy "$(ProjectDir)..\..\resjs" "$(OutDir)\Resources\res\" /e /Y + Copy js and resource files. + + Copy js and resource files. - + diff --git a/tests/js-tests/resjs/ccb/animated-grossini.png b/tests/js-tests/resjs/ccb/animated-grossini.png index 663d02187850..89736acdaba8 100644 Binary files a/tests/js-tests/resjs/ccb/animated-grossini.png and b/tests/js-tests/resjs/ccb/animated-grossini.png differ diff --git a/tests/js-tests/resjs/ccb/btn-a-0.png b/tests/js-tests/resjs/ccb/btn-a-0.png index 3444aa9ffb82..66a5d3df7185 100644 Binary files a/tests/js-tests/resjs/ccb/btn-a-0.png and b/tests/js-tests/resjs/ccb/btn-a-0.png differ diff --git a/tests/js-tests/resjs/ccb/btn-a-1.png b/tests/js-tests/resjs/ccb/btn-a-1.png index 4b6658f1639d..33f8a0c3f041 100644 Binary files a/tests/js-tests/resjs/ccb/btn-a-1.png and b/tests/js-tests/resjs/ccb/btn-a-1.png differ diff --git a/tests/js-tests/resjs/ccb/btn-a-2.png b/tests/js-tests/resjs/ccb/btn-a-2.png index 616a56d7b07e..c8532b3e23ae 100644 Binary files a/tests/js-tests/resjs/ccb/btn-a-2.png and b/tests/js-tests/resjs/ccb/btn-a-2.png differ diff --git a/tests/js-tests/resjs/ccb/btn-b-0.png b/tests/js-tests/resjs/ccb/btn-b-0.png index ba5c73fa83da..abd7d9a00b03 100644 Binary files a/tests/js-tests/resjs/ccb/btn-b-0.png and b/tests/js-tests/resjs/ccb/btn-b-0.png differ diff --git a/tests/js-tests/resjs/ccb/btn-b-1.png b/tests/js-tests/resjs/ccb/btn-b-1.png index 5551f49721f3..b55f91e77c04 100644 Binary files a/tests/js-tests/resjs/ccb/btn-b-1.png and b/tests/js-tests/resjs/ccb/btn-b-1.png differ diff --git a/tests/js-tests/resjs/ccb/btn-b-2.png b/tests/js-tests/resjs/ccb/btn-b-2.png index 61023e9af3fe..d47c7b6283e6 100644 Binary files a/tests/js-tests/resjs/ccb/btn-b-2.png and b/tests/js-tests/resjs/ccb/btn-b-2.png differ diff --git a/tests/js-tests/resjs/ccb/btn-back-0.png b/tests/js-tests/resjs/ccb/btn-back-0.png index 4d0a671d76af..9caae52746ff 100644 Binary files a/tests/js-tests/resjs/ccb/btn-back-0.png and b/tests/js-tests/resjs/ccb/btn-back-0.png differ diff --git a/tests/js-tests/resjs/ccb/btn-back-1.png b/tests/js-tests/resjs/ccb/btn-back-1.png index 577fa5f84a6d..6c7cf5f97a9e 100644 Binary files a/tests/js-tests/resjs/ccb/btn-back-1.png and b/tests/js-tests/resjs/ccb/btn-back-1.png differ diff --git a/tests/js-tests/resjs/ccb/btn-test-0.png b/tests/js-tests/resjs/ccb/btn-test-0.png index 7ded821ace96..2777fd1d5ecc 100644 Binary files a/tests/js-tests/resjs/ccb/btn-test-0.png and b/tests/js-tests/resjs/ccb/btn-test-0.png differ diff --git a/tests/js-tests/resjs/ccb/btn-test-1.png b/tests/js-tests/resjs/ccb/btn-test-1.png index 34a09c1e5b06..b3be2a861637 100644 Binary files a/tests/js-tests/resjs/ccb/btn-test-1.png and b/tests/js-tests/resjs/ccb/btn-test-1.png differ diff --git a/tests/js-tests/resjs/ccb/btn-test-2.png b/tests/js-tests/resjs/ccb/btn-test-2.png index 744824b1f09a..eab72947de72 100644 Binary files a/tests/js-tests/resjs/ccb/btn-test-2.png and b/tests/js-tests/resjs/ccb/btn-test-2.png differ diff --git a/tests/js-tests/resjs/ccb/burst.png b/tests/js-tests/resjs/ccb/burst.png index 3ede762054e2..8681474538f4 100644 Binary files a/tests/js-tests/resjs/ccb/burst.png and b/tests/js-tests/resjs/ccb/burst.png differ diff --git a/tests/js-tests/resjs/ccb/ccbParticleStars.png b/tests/js-tests/resjs/ccb/ccbParticleStars.png index 2ff41c7dd47f..f493dcc33470 100644 Binary files a/tests/js-tests/resjs/ccb/ccbParticleStars.png and b/tests/js-tests/resjs/ccb/ccbParticleStars.png differ diff --git a/tests/js-tests/resjs/ccb/grossini-generic.png b/tests/js-tests/resjs/ccb/grossini-generic.png index 16e741ff75ed..5c0bbc67c854 100644 Binary files a/tests/js-tests/resjs/ccb/grossini-generic.png and b/tests/js-tests/resjs/ccb/grossini-generic.png differ diff --git a/tests/js-tests/resjs/ccb/jungle-left.png b/tests/js-tests/resjs/ccb/jungle-left.png index 0a79a65786fc..79bbf2033432 100644 Binary files a/tests/js-tests/resjs/ccb/jungle-left.png and b/tests/js-tests/resjs/ccb/jungle-left.png differ diff --git a/tests/js-tests/resjs/ccb/jungle-right.png b/tests/js-tests/resjs/ccb/jungle-right.png index 2ac67b963795..8da61b9f5861 100644 Binary files a/tests/js-tests/resjs/ccb/jungle-right.png and b/tests/js-tests/resjs/ccb/jungle-right.png differ diff --git a/tests/js-tests/resjs/ccb/jungle.png b/tests/js-tests/resjs/ccb/jungle.png index 8532046b55a4..b3ddd92d2b09 100644 Binary files a/tests/js-tests/resjs/ccb/jungle.png and b/tests/js-tests/resjs/ccb/jungle.png differ diff --git a/tests/js-tests/resjs/ccb/logo-icon.png b/tests/js-tests/resjs/ccb/logo-icon.png index dbb9301e552b..c668736dc74d 100644 Binary files a/tests/js-tests/resjs/ccb/logo-icon.png and b/tests/js-tests/resjs/ccb/logo-icon.png differ diff --git a/tests/js-tests/resjs/ccb/logo.png b/tests/js-tests/resjs/ccb/logo.png index 64b68a253274..a4cd20c20e8f 100644 Binary files a/tests/js-tests/resjs/ccb/logo.png and b/tests/js-tests/resjs/ccb/logo.png differ diff --git a/tests/js-tests/resjs/ccb/markerfelt24shadow.png b/tests/js-tests/resjs/ccb/markerfelt24shadow.png index 3f164677b8ce..5bab02849644 100644 Binary files a/tests/js-tests/resjs/ccb/markerfelt24shadow.png and b/tests/js-tests/resjs/ccb/markerfelt24shadow.png differ diff --git a/tests/js-tests/resjs/ccb/particle-fire.png b/tests/js-tests/resjs/ccb/particle-fire.png index 76fff66a4d51..81c6d2410bb2 100644 Binary files a/tests/js-tests/resjs/ccb/particle-fire.png and b/tests/js-tests/resjs/ccb/particle-fire.png differ diff --git a/tests/js-tests/resjs/ccb/particle-smoke.png b/tests/js-tests/resjs/ccb/particle-smoke.png index 2f508149eca6..a289b1371e29 100644 Binary files a/tests/js-tests/resjs/ccb/particle-smoke.png and b/tests/js-tests/resjs/ccb/particle-smoke.png differ diff --git a/tests/js-tests/resjs/ccb/particle-snow.png b/tests/js-tests/resjs/ccb/particle-snow.png index 43b8e39ac74f..9e12963498d7 100644 Binary files a/tests/js-tests/resjs/ccb/particle-snow.png and b/tests/js-tests/resjs/ccb/particle-snow.png differ diff --git a/tests/js-tests/resjs/ccb/particle-stars.png b/tests/js-tests/resjs/ccb/particle-stars.png index 2ff41c7dd47f..f493dcc33470 100644 Binary files a/tests/js-tests/resjs/ccb/particle-stars.png and b/tests/js-tests/resjs/ccb/particle-stars.png differ diff --git a/tests/js-tests/resjs/ccb/scale-9-demo.png b/tests/js-tests/resjs/ccb/scale-9-demo.png index 0b391c333aa1..ee4537207f1b 100644 Binary files a/tests/js-tests/resjs/ccb/scale-9-demo.png and b/tests/js-tests/resjs/ccb/scale-9-demo.png differ diff --git a/tests/js-tests/src/ChipmunkTest/ChipmunkTest.js b/tests/js-tests/src/ChipmunkTest/ChipmunkTest.js index 8a9690a00192..b121cc5d4dad 100644 --- a/tests/js-tests/src/ChipmunkTest/ChipmunkTest.js +++ b/tests/js-tests/src/ChipmunkTest/ChipmunkTest.js @@ -840,7 +840,7 @@ var ChipmunkReleaseTest = ChipmunkBaseLayer.extend({ cc.log("OnExit"); // not calling this on purpose - // this.space.removeCollisionHandler( 10, 11 ); + this.space.removeCollisionHandler( 10, 11 ); this.space = null; // cc.base(this, 'onExit'); diff --git a/tests/js-tests/src/ExtensionsTest/NetworkTest/WebSocketTest.js b/tests/js-tests/src/ExtensionsTest/NetworkTest/WebSocketTest.js index 9d048eed7622..b54124c57c59 100644 --- a/tests/js-tests/src/ExtensionsTest/NetworkTest/WebSocketTest.js +++ b/tests/js-tests/src/ExtensionsTest/NetworkTest/WebSocketTest.js @@ -108,7 +108,7 @@ var WebSocketTestLayer = cc.Layer.extend({ var self = this; - this._wsiSendText = new WebSocket("wss://echo.websocket.org"); + this._wsiSendText = new WebSocket("wss://echo.websocket.org", "", "cacert.pem"); this._wsiSendText.onopen = function(evt) { self._sendTextStatus.setString("Opened, url: " + self._wsiSendText.url + ", protocol: " + self._wsiSendText.protocol); }; diff --git a/tests/js-tests/src/IntervalTest/IntervalTest.js b/tests/js-tests/src/IntervalTest/IntervalTest.js index 5c8293ae3b98..35009a30daef 100644 --- a/tests/js-tests/src/IntervalTest/IntervalTest.js +++ b/tests/js-tests/src/IntervalTest/IntervalTest.js @@ -57,12 +57,12 @@ var IntervalLayer = cc.LayerGradient.extend({ sun.setLife(0.6); this.addChild(sun); - // timers - this.label0 = new cc.LabelTTF("0", "Arial", 24); - this.label1 = new cc.LabelTTF("0", "Arial", 24); - this.label2 = new cc.LabelTTF("0", "Arial", 24); - this.label3 = new cc.LabelTTF("0", "Arial", 24); - this.label4 = new cc.LabelTTF("0", "Arial", 24); + // timers, font "fonts/bitmapFontTest4.fnt" + this.label0 = cc.Label.createWithBMFont("fonts/bitmapFontTest4.fnt", 24); + this.label1 = cc.Label.createWithBMFont("fonts/bitmapFontTest4.fnt", 24); + this.label2 = cc.Label.createWithBMFont("fonts/bitmapFontTest4.fnt", 24); + this.label3 = cc.Label.createWithBMFont("fonts/bitmapFontTest4.fnt", 24); + this.label4 = cc.Label.createWithBMFont("fonts/bitmapFontTest4.fnt", 24); this.scheduleUpdate(); this.schedule(this.step1); diff --git a/tests/js-tests/src/tests-main.js b/tests/js-tests/src/tests-main.js index a212b1b504fb..04d93aa8f93d 100644 --- a/tests/js-tests/src/tests-main.js +++ b/tests/js-tests/src/tests-main.js @@ -45,6 +45,7 @@ var autoTestEnabled = autoTestEnabled || false; var autoTestCurrentTestName = autoTestCurrentTestName || "N/A"; var TestScene = cc.Scene.extend({ + _mainMenu :null, ctor:function (bPortrait) { this._super(); this.init(); @@ -53,6 +54,7 @@ var TestScene = cc.Scene.extend({ var menuItem = new cc.MenuItemLabel(label, this.onMainMenuCallback, this); var menu = new cc.Menu(menuItem); + this._mainMenu = menu; menu.x = 0; menu.y = 0; menuItem.x = winSize.width - 50; @@ -66,6 +68,7 @@ var TestScene = cc.Scene.extend({ if (director.isPaused()) { director.resume(); } + this._mainMenu.enabled = false; var scene = new cc.Scene(); var layer = new TestController(); scene.addChild(layer); @@ -131,7 +134,7 @@ var TestController = cc.LayerGradient.extend({ this._itemMenu = new cc.Menu();//item menu is where all the label goes, and the one gets scrolled for (var i = 0, len = testNames.length; i < len; i++) { - var label = new cc.LabelTTF(testNames[i].title, "Arial", 24); + var label = new cc.LabelTTF((i + 1) +". "+ testNames[i].title, "Arial", 24); var menuItem = new cc.MenuItemLabel(label, this.onMenuCallback, this); this._itemMenu.addChild(menuItem, i + 10000); menuItem.x = winSize.width / 2; diff --git a/tests/lua-empty-test/project/CMakeLists.txt b/tests/lua-empty-test/project/CMakeLists.txt index cf85a2038f69..132384c6d4ba 100644 --- a/tests/lua-empty-test/project/CMakeLists.txt +++ b/tests/lua-empty-test/project/CMakeLists.txt @@ -9,10 +9,8 @@ if(NOT DEFINED BUILD_ENGINE_DONE) set(CMAKE_MODULE_PATH ${COCOS2DX_ROOT_PATH}/cmake/Modules/) include(CocosBuildSet) - if(NOT USE_COCOS_PREBUILT) - set(BUILD_LUA_LIBS ON) - add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos ${ENGINE_BINARY_PATH}/cocos/core) - endif() + set(BUILD_LUA_LIBS ON) + add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos ${ENGINE_BINARY_PATH}/cocos/core) endif() set(res_res_folders @@ -47,7 +45,6 @@ if(ANDROID) elseif(LINUX) list(APPEND GAME_SOURCE proj.linux/main.cpp) elseif(WINDOWS) - add_definitions(-D_USRLUASTATIC) list(APPEND GAME_HEADER proj.win32/main.h) list(APPEND GAME_SOURCE proj.win32/main.cpp ${cc_common_res}) elseif(APPLE) @@ -72,7 +69,6 @@ elseif(APPLE) set(APP_UI_RES proj.mac/Icon.icns proj.mac/Info.plist - proj.mac/en.lproj/MainMenu.xib proj.mac/en.lproj/InfoPlist.strings ) list(APPEND GAME_SOURCE @@ -106,17 +102,21 @@ if(APPLE) if(MACOSX) set_target_properties(${APP_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/proj.mac/Info.plist" + LINK_FLAGS "-pagezero_size 10000 -image_base 100000000" ) elseif(IOS) cocos_pak_xcode(${APP_NAME} INFO_PLIST "iOSBundleInfo.plist.in") set_xcode_property(${APP_NAME} ASSETCATALOG_COMPILER_APPICON_NAME "AppIcon-${APP_NAME}") + set_xcode_property(${APP_NAME} DEVELOPMENT_TEAM "") + set_xcode_property(${APP_NAME} CODE_SIGN_IDENTITY "iPhone Developer") endif() elseif(WINDOWS) - cocos_copy_target_dll(${APP_NAME} COPY_TO ${APP_RES_DIR}) + cocos_copy_target_dll(${APP_NAME}) endif() if(LINUX OR WINDOWS) - cocos_copy_res(COPY_TO ${APP_RES_DIR}/res FOLDERS ${res_res_folders}) - cocos_copy_res(COPY_TO ${APP_RES_DIR}/src FOLDERS ${res_src_folders}) - cocos_copy_res(COPY_TO ${APP_RES_DIR}/src/cocos FOLDERS ${res_script_folders}) + set(APP_RES_DIR "$/Resources") + cocos_copy_target_res(${APP_NAME} COPY_TO ${APP_RES_DIR}/res FOLDERS ${res_res_folders}) + cocos_copy_target_res(${APP_NAME} COPY_TO ${APP_RES_DIR}/src FOLDERS ${res_src_folders}) + cocos_copy_target_res(${APP_NAME} COPY_TO ${APP_RES_DIR}/src/cocos FOLDERS ${res_script_folders}) endif() \ No newline at end of file diff --git a/tests/lua-empty-test/project/Classes/AppDelegate.cpp b/tests/lua-empty-test/project/Classes/AppDelegate.cpp index 49736e07c706..8c846ba600c7 100644 --- a/tests/lua-empty-test/project/Classes/AppDelegate.cpp +++ b/tests/lua-empty-test/project/Classes/AppDelegate.cpp @@ -42,7 +42,6 @@ AppDelegate::~AppDelegate() { // end simple audio engine here, or it may crashed on win32 SimpleAudioEngine::getInstance()->end(); - //CCScriptEngineManager::destroyInstance(); } void AppDelegate::initGLContextAttrs() @@ -62,6 +61,9 @@ bool AppDelegate::applicationDidFinishLaunching() //The call was commented because it will lead to ZeroBrane Studio can't find correct context when debugging //engine->executeScriptFile("src/hello.lua"); + LuaStack* stack = engine->getLuaStack(); + stack->setXXTEAKeyAndSign("2dxLua", strlen("2dxLua"), "XXTEA", strlen("XXTEA")); + #if CC_64BITS FileUtils::getInstance()->addSearchPath("src/64bit"); #endif diff --git a/tests/lua-empty-test/project/proj.android/app/AndroidManifest.xml b/tests/lua-empty-test/project/proj.android/app/AndroidManifest.xml index dd64c3d7bf77..843c7b4124ea 100644 --- a/tests/lua-empty-test/project/proj.android/app/AndroidManifest.xml +++ b/tests/lua-empty-test/project/proj.android/app/AndroidManifest.xml @@ -7,6 +7,7 @@ diff --git a/tests/lua-empty-test/project/proj.android/app/build.gradle b/tests/lua-empty-test/project/proj.android/app/build.gradle index 069731ccfdfc..a98f4131b9fa 100644 --- a/tests/lua-empty-test/project/proj.android/app/build.gradle +++ b/tests/lua-empty-test/project/proj.android/app/build.gradle @@ -34,9 +34,8 @@ android { else if (PROP_BUILD_TYPE == 'cmake') { cmake { targets "lua_empty_test" - arguments "-DCMAKE_FIND_ROOT_PATH=", "-DANDROID_STL=c++_static", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE", \ - "-DUSE_CHIPMUNK=TRUE", "-DUSE_BULLET=TRUE", "-DBUILD_LUA_LIBS=TRUE" - cppFlags "-frtti -fexceptions" + arguments "-DCMAKE_FIND_ROOT_PATH=", "-DANDROID_STL=c++_static", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE" + cppFlags "-frtti -fexceptions -fsigned-char" } } } @@ -51,6 +50,7 @@ android { java.srcDir "src" res.srcDir "res" manifest.srcFile "AndroidManifest.xml" + assets.srcDir "assets" } externalNativeBuild { @@ -115,11 +115,19 @@ def getCocosCommandPath() { return 'cocos.bat' } else { + + def env_console_path = System.getenv("COCOS_CONSOLE_ROOT") + + if (env_console_path != null && !env_console_path.trim().isEmpty()) { + return new File(env_console_path.trim() + '/cocos').absolutePath + } + // on unix like system, can not get environments variables easily // so run a shell script to get environment variable sets by cocos2d-x setup.py new ByteArrayOutputStream().withStream { os -> def result = exec { - executable = project.file('get_environment.sh') + executable = "/bin/bash" + args = [ "-i", project.file('get_environment.sh')] standardOutput = os } ext.console_path = os.toString().trim() @@ -161,23 +169,24 @@ def compileLua(srcDir, dstDir, doCompile, is64bit, doEncrypt) { } android.applicationVariants.all { variant -> - // delete previous files first - delete "${buildDir}/intermediates/assets/${variant.dirName}" - - variant.mergeAssets.doLast { + delete "${projectDir}/assets" + def targetName = variant.name.capitalize() + def copyTaskName = "copy${targetName}ResourcesToAssets" + + tasks.register(copyTaskName) { copy { - from "${buildDir}/../../../../res" - into "${buildDir}/intermediates/assets/${variant.dirName}/res" + from "${projectDir}/../../../res" + into "${projectDir}/assets/res" } copy { - from "${buildDir}/../../../../src" - into "${buildDir}/intermediates/assets/${variant.dirName}/src" + from "${projectDir}/../../../src" + into "${projectDir}/assets/src" } copy { - from "${buildDir}/../../../../../../cocos/scripting/lua-bindings/script" - into "${buildDir}/intermediates/assets/${variant.dirName}/src/cocos" + from "${projectDir}/../../../../../cocos/scripting/lua-bindings/script" + into "${projectDir}/assets/src/cocos" } // compile & encrypt the scripts if necessary @@ -221,37 +230,38 @@ android.applicationVariants.all { variant -> // invoke cocos command to compile & encrypt the lua files switch (buildType) { case -1: - compileLua("${buildDir}/intermediates/assets/${variant.dirName}/src", - "${buildDir}/intermediates/assets/${variant.dirName}/src", + compileLua("${projectDir}/assets/src", + "${projectDir}/assets/src", false, false, encryptLua) break case 0: - compileLua("${buildDir}/intermediates/assets/${variant.dirName}/src", - "${buildDir}/intermediates/assets/${variant.dirName}/src", + compileLua("${projectDir}/assets/src", + "${projectDir}/assets/src", true, false, encryptLua) break case 1: - compileLua("${buildDir}/intermediates/assets/${variant.dirName}/src", - "${buildDir}/intermediates/assets/${variant.dirName}/src/64bit", + compileLua("${projectDir}/assets/src", + "${projectDir}/assets/src/64bit", true, true, encryptLua) // remove the lua files in src dir - delete fileTree("${buildDir}/intermediates/assets/${variant.dirName}/src") { + delete fileTree("${projectDir}/assets/src") { include '**/*.lua' } - delete "${buildDir}/intermediates/assets/${variant.dirName}/src/cocos" + delete "${projectDir}/assets/src/cocos" break case 2: - compileLua("${buildDir}/intermediates/assets/${variant.dirName}/src", - "${buildDir}/intermediates/assets/${variant.dirName}/src/64bit", + compileLua("${projectDir}/assets/src", + "${projectDir}/assets/src/64bit", true, true, encryptLua) - compileLua("${buildDir}/intermediates/assets/${variant.dirName}/src", - "${buildDir}/intermediates/assets/${variant.dirName}/src", + compileLua("${projectDir}/assets/src", + "${projectDir}/assets/src", true, false, encryptLua) break } } } + tasks.getByName("pre${targetName}Build").dependsOn copyTaskName } dependencies { diff --git a/tests/lua-empty-test/project/proj.android/app/get_environment.sh b/tests/lua-empty-test/project/proj.android/app/get_environment.sh index 102f7247e70a..61ce03524ccb 100755 --- a/tests/lua-empty-test/project/proj.android/app/get_environment.sh +++ b/tests/lua-empty-test/project/proj.android/app/get_environment.sh @@ -1,4 +1,11 @@ #!/bin/bash -source ~/.bash_profile -echo $COCOS_CONSOLE_ROOT \ No newline at end of file +if [ -f $HOME/.bashrc ]; then + source $HOME/.bashrc +fi + +if [ -f $HOME/.bash_profile ]; then + source $HOME/.bash_profile +fi + +echo $COCOS_CONSOLE_ROOT diff --git a/tests/lua-empty-test/project/proj.android/app/proguard-rules.pro b/tests/lua-empty-test/project/proj.android/app/proguard-rules.pro index 2c062c494602..9f6d4ff6bfb0 100644 --- a/tests/lua-empty-test/project/proj.android/app/proguard-rules.pro +++ b/tests/lua-empty-test/project/proj.android/app/proguard-rules.pro @@ -23,6 +23,8 @@ -dontwarn com.chukong.** -keep public class com.huawei.android.** { *; } -dontwarn com.huawei.android.** +-keep public class com.oppo.oiface.engine.** { *; } +-dontwarn com.oppo.oiface.engine.** # Proguard Apache HTTP for release -keep class org.apache.http.** { *; } diff --git a/tests/lua-empty-test/project/proj.android/app/res/mipmap-hdpi/ic_launcher.png b/tests/lua-empty-test/project/proj.android/app/res/mipmap-hdpi/ic_launcher.png index b0d2b4ac10d3..45ee51d15f96 100644 Binary files a/tests/lua-empty-test/project/proj.android/app/res/mipmap-hdpi/ic_launcher.png and b/tests/lua-empty-test/project/proj.android/app/res/mipmap-hdpi/ic_launcher.png differ diff --git a/tests/lua-empty-test/project/proj.android/app/res/mipmap-mdpi/ic_launcher.png b/tests/lua-empty-test/project/proj.android/app/res/mipmap-mdpi/ic_launcher.png index b80addadac9f..0dd2a608998e 100644 Binary files a/tests/lua-empty-test/project/proj.android/app/res/mipmap-mdpi/ic_launcher.png and b/tests/lua-empty-test/project/proj.android/app/res/mipmap-mdpi/ic_launcher.png differ diff --git a/tests/lua-empty-test/project/proj.android/app/res/mipmap-xhdpi/ic_launcher.png b/tests/lua-empty-test/project/proj.android/app/res/mipmap-xhdpi/ic_launcher.png index 57235c0b712b..a32f16f930b3 100644 Binary files a/tests/lua-empty-test/project/proj.android/app/res/mipmap-xhdpi/ic_launcher.png and b/tests/lua-empty-test/project/proj.android/app/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/tests/lua-empty-test/project/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png b/tests/lua-empty-test/project/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png index 15e20bb99277..332f268edc46 100644 Binary files a/tests/lua-empty-test/project/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png and b/tests/lua-empty-test/project/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/tests/lua-empty-test/project/proj.android/build.gradle b/tests/lua-empty-test/project/proj.android/build.gradle index 5dff94de2a97..63697d83ac6c 100644 --- a/tests/lua-empty-test/project/proj.android/build.gradle +++ b/tests/lua-empty-test/project/proj.android/build.gradle @@ -7,7 +7,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.1.0' + classpath 'com.android.tools.build:gradle:3.4.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/tests/lua-empty-test/project/proj.android/gradle/wrapper/gradle-wrapper.properties b/tests/lua-empty-test/project/proj.android/gradle/wrapper/gradle-wrapper.properties index ab7338f669d1..2701085c469c 100644 --- a/tests/lua-empty-test/project/proj.android/gradle/wrapper/gradle-wrapper.properties +++ b/tests/lua-empty-test/project/proj.android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Tue Mar 14 17:47:54 CST 2017 +#Fri May 10 15:15:29 CST 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip diff --git a/tests/lua-empty-test/project/proj.android/settings.gradle b/tests/lua-empty-test/project/proj.android/settings.gradle index 11316ebf9c4c..e45551612e07 100644 --- a/tests/lua-empty-test/project/proj.android/settings.gradle +++ b/tests/lua-empty-test/project/proj.android/settings.gradle @@ -2,3 +2,4 @@ include ':libcocos2dx' project(':libcocos2dx').projectDir = new File(settingsDir, '../../../../cocos/platform/android/libcocos2dx') include ':LuaEmptyTest' project(':LuaEmptyTest').projectDir = new File(settingsDir, 'app') +rootProject.name = "lua-empty-test" \ No newline at end of file diff --git a/tests/lua-empty-test/project/proj.ios/AppController.mm b/tests/lua-empty-test/project/proj.ios/AppController.mm index 12172a818a0e..5f463bba4cc6 100644 --- a/tests/lua-empty-test/project/proj.ios/AppController.mm +++ b/tests/lua-empty-test/project/proj.ios/AppController.mm @@ -76,6 +76,12 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( [[UIApplication sharedApplication] setStatusBarHidden: YES]; + //Launching the app with the arguments -NSAllowsDefaultLineBreakStrategy NO to force back to the old behavior. + if ( [[UIDevice currentDevice].systemVersion floatValue] >= 13.0f) + { + [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"NSAllowsDefaultLineBreakStrategy"]; + } + // IMPORTANT: Setting the GLView should be done after creating the RootViewController cocos2d::GLView *glview = cocos2d::GLViewImpl::createWithEAGLView(eaglView); cocos2d::Director::getInstance()->setOpenGLView(glview); diff --git a/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-20.png b/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-20.png index 9ac82f2c131d..8ead23e36507 100644 Binary files a/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-20.png and b/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-20.png differ diff --git a/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-20@2x.png b/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-20@2x.png index 453036453045..775685daca94 100644 Binary files a/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-20@2x.png and b/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-20@2x.png differ diff --git a/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-20@3x.png b/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-20@3x.png index a4cde8ab3ac6..a5b49ccbb199 100644 Binary files a/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-20@3x.png and b/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-20@3x.png differ diff --git a/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-29.png b/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-29.png index b34735dd028f..0500184c869c 100644 Binary files a/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-29.png and b/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-29.png differ diff --git a/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-29@2x.png b/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-29@2x.png index 0d72b8acc88a..f0f8b7fe9833 100644 Binary files a/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-29@2x.png and b/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-29@2x.png differ diff --git a/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-29@3x.png b/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-29@3x.png index 42e8664e038e..5287e50a7986 100644 Binary files a/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-29@3x.png and b/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-29@3x.png differ diff --git a/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-40.png b/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-40.png index 453036453045..775685daca94 100644 Binary files a/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-40.png and b/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-40.png differ diff --git a/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-40@2x.png b/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-40@2x.png index 99c0ebce2c3d..d9c7ab446bb7 100644 Binary files a/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-40@2x.png and b/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-40@2x.png differ diff --git a/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-40@3x.png b/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-40@3x.png index a4cde8ab3ac6..a5b49ccbb199 100644 Binary files a/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-40@3x.png and b/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-40@3x.png differ diff --git a/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-50.png b/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-50.png index 04a74a69d850..ac381bc20e85 100644 Binary files a/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-50.png and b/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-50.png differ diff --git a/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-50@2x.png b/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-50@2x.png index 0791e8db2b23..ef38d4500a80 100644 Binary files a/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-50@2x.png and b/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-50@2x.png differ diff --git a/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-57.png b/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-57.png index 2c5b1a8d067e..4fcc6fddffe1 100644 Binary files a/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-57.png and b/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-57.png differ diff --git a/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-57@2x.png b/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-57@2x.png index 9d822dd646c1..c3807861ad29 100644 Binary files a/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-57@2x.png and b/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-57@2x.png differ diff --git a/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-60@2x.png b/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-60@2x.png index a4cde8ab3ac6..a5b49ccbb199 100644 Binary files a/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-60@2x.png and b/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-60@2x.png differ diff --git a/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-60@3x.png b/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-60@3x.png index 88a5c70568a1..d4bc53132ce3 100644 Binary files a/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-60@3x.png and b/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-60@3x.png differ diff --git a/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-72.png b/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-72.png index 9f28d1f72ebf..2c573c8df4c3 100644 Binary files a/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-72.png and b/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-72.png differ diff --git a/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-72@2x.png b/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-72@2x.png index c613bec2dcd1..1526615c02d1 100644 Binary files a/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-72@2x.png and b/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-72@2x.png differ diff --git a/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-76.png b/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-76.png index 9c5fc86d91bd..8a1fa1850c03 100644 Binary files a/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-76.png and b/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-76.png differ diff --git a/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-76@2x.png b/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-76@2x.png index 978f1ba7dc2c..8aa82506d0d1 100644 Binary files a/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-76@2x.png and b/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-76@2x.png differ diff --git a/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-83.5@2x.png b/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-83.5@2x.png index 599979fa572f..6bf801d17507 100644 Binary files a/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-83.5@2x.png and b/tests/lua-empty-test/project/proj.ios/Images.xcassets/AppIcon-lua-empty-test.appiconset/Icon-83.5@2x.png differ diff --git a/tests/lua-empty-test/project/proj.ios/Info.plist b/tests/lua-empty-test/project/proj.ios/Info.plist index 4670d10df04b..1b0ffcb5661a 100644 --- a/tests/lua-empty-test/project/proj.ios/Info.plist +++ b/tests/lua-empty-test/project/proj.ios/Info.plist @@ -22,6 +22,8 @@ ${PRODUCT_NAME} CFBundlePackageType APPL + CFBundleShortVersionString + 1.0 CFBundleSignature ???? CFBundleVersion diff --git a/tests/lua-empty-test/project/proj.ios/LaunchScreenBackground.png b/tests/lua-empty-test/project/proj.ios/LaunchScreenBackground.png index 67d03b172d40..dadccee68624 100644 Binary files a/tests/lua-empty-test/project/proj.ios/LaunchScreenBackground.png and b/tests/lua-empty-test/project/proj.ios/LaunchScreenBackground.png differ diff --git a/tests/lua-empty-test/project/proj.ios/RootViewController.mm b/tests/lua-empty-test/project/proj.ios/RootViewController.mm index 8002ff82d09b..ea3cc791e21e 100644 --- a/tests/lua-empty-test/project/proj.ios/RootViewController.mm +++ b/tests/lua-empty-test/project/proj.ios/RootViewController.mm @@ -25,7 +25,7 @@ of this software and associated documentation files (the "Software"), to deal ****************************************************************************/ #import "RootViewController.h" - +#import "platform/ios/CCDirectorCaller-ios.h" @implementation RootViewController @@ -50,8 +50,15 @@ - (void)loadView { - (void)viewDidLoad { [super viewDidLoad]; } - */ + +//In iOS 12.0+, Screen Time's bug cause UIApplicationDidBecomeActiveNotification and UIApplicationWillResignActiveNotification do not fired +//so we need to active CCDirectorCaller manually +-(void)viewDidAppear:(BOOL)animated{ + [super viewDidAppear:animated]; + [[CCDirectorCaller sharedDirectorCaller] setActive:YES]; +} + // Override to allow orientations other than the default portrait orientation. // This method is deprecated on ios6 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { diff --git a/tests/lua-empty-test/project/proj.mac/en.lproj/MainMenu.xib b/tests/lua-empty-test/project/proj.mac/en.lproj/MainMenu.xib deleted file mode 100644 index 9f99439250c0..000000000000 --- a/tests/lua-empty-test/project/proj.mac/en.lproj/MainMenu.xib +++ /dev/null @@ -1,812 +0,0 @@ - - - - 1060 - 10K549 - 1938 - 1038.36 - 461.00 - - com.apple.InterfaceBuilder.CocoaPlugin - 1938 - - - YES - NSMenuItem - NSCustomObject - NSMenu - - - YES - com.apple.InterfaceBuilder.CocoaPlugin - - - PluginDependencyRecalculationVersion - - - - YES - - NSApplication - - - FirstResponder - - - NSApplication - - - AMainMenu - - YES - - - HelloCpp - - 1048576 - 2147483647 - - NSImage - NSMenuCheckmark - - - NSImage - NSMenuMixedState - - submenuAction: - - HelloCpp - - YES - - - About HelloCpp - - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Preferences… - , - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Services - - 1048576 - 2147483647 - - - submenuAction: - - Services - - YES - - _NSServicesMenu - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Hide HelloCpp - h - 1048576 - 2147483647 - - - - - - Hide Others - h - 1572864 - 2147483647 - - - - - - Show All - - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Quit HelloCpp - q - 1048576 - 2147483647 - - - - - _NSAppleMenu - - - - - View - - 1048576 - 2147483647 - - - submenuAction: - - View - - YES - - - Toggle Fullscreen - f - 1048576 - 2147483647 - - - - - - - - - Window - - 1048576 - 2147483647 - - - submenuAction: - - Window - - YES - - - Minimize - m - 1048576 - 2147483647 - - - - - - Zoom - - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Bring All to Front - - 1048576 - 2147483647 - - - - - _NSWindowsMenu - - - - - Help - - 2147483647 - - - submenuAction: - - Help - - YES - - - HelloCpp Help - ? - 1048576 - 2147483647 - - - - - _NSHelpMenu - - - - _NSMainMenu - - - AppController - - - NSFontManager - - - - - YES - - - terminate: - - - - 449 - - - - orderFrontStandardAboutPanel: - - - - 142 - - - - delegate - - - - 495 - - - - performMiniaturize: - - - - 37 - - - - arrangeInFront: - - - - 39 - - - - performZoom: - - - - 240 - - - - hide: - - - - 367 - - - - hideOtherApplications: - - - - 368 - - - - unhideAllApplications: - - - - 370 - - - - showHelp: - - - - 493 - - - - toggleFullScreen: - - - - 537 - - - - - YES - - 0 - - YES - - - - - - -2 - - - File's Owner - - - -1 - - - First Responder - - - -3 - - - Application - - - 29 - - - YES - - - - - - - - - 19 - - - YES - - - - - - 56 - - - YES - - - - - - 57 - - - YES - - - - - - - - - - - - - - - - 58 - - - - - 134 - - - - - 150 - - - - - 136 - - - - - 144 - - - - - 129 - - - - - 143 - - - - - 236 - - - - - 131 - - - YES - - - - - - 149 - - - - - 145 - - - - - 130 - - - - - 24 - - - YES - - - - - - - - - 92 - - - - - 5 - - - - - 239 - - - - - 23 - - - - - 295 - - - YES - - - - - - 296 - - - YES - - - - - - 420 - - - - - 490 - - - YES - - - - - - 491 - - - YES - - - - - - 492 - - - - - 494 - - - - - 536 - - - - - - - YES - - YES - -1.IBPluginDependency - -2.IBPluginDependency - -3.IBPluginDependency - 129.IBPluginDependency - 130.IBPluginDependency - 131.IBPluginDependency - 134.IBPluginDependency - 136.IBPluginDependency - 143.IBPluginDependency - 144.IBPluginDependency - 145.IBPluginDependency - 149.IBPluginDependency - 150.IBPluginDependency - 19.IBPluginDependency - 23.IBPluginDependency - 236.IBPluginDependency - 239.IBPluginDependency - 24.IBPluginDependency - 29.IBPluginDependency - 295.IBPluginDependency - 296.IBPluginDependency - 420.IBPluginDependency - 490.IBPluginDependency - 491.IBPluginDependency - 492.IBPluginDependency - 494.IBPluginDependency - 5.IBPluginDependency - 536.IBPluginDependency - 56.IBPluginDependency - 57.IBPluginDependency - 58.IBPluginDependency - 92.IBPluginDependency - - - YES - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - - YES - - - - - - YES - - - - - 541 - - - - YES - - AppController - NSObject - - YES - - YES - exitFullScreen: - toggleFullScreen: - - - YES - id - id - - - - YES - - YES - exitFullScreen: - toggleFullScreen: - - - YES - - exitFullScreen: - id - - - toggleFullScreen: - id - - - - - YES - - YES - glView - window - - - YES - EAGLView - Window - - - - YES - - YES - glView - window - - - YES - - glView - EAGLView - - - window - Window - - - - - IBProjectSource - ./Classes/AppController.h - - - - EAGLView - NSOpenGLView - - IBProjectSource - ./Classes/EAGLView.h - - - - - 0 - IBCocoaFramework - - com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 - - - YES - 3 - - YES - - YES - NSMenuCheckmark - NSMenuMixedState - - - YES - {9, 8} - {7, 2} - - - - diff --git a/tests/lua-empty-test/project/proj.win32/lua-empty-test.vcxproj b/tests/lua-empty-test/project/proj.win32/lua-empty-test.vcxproj index 639e7942389c..fdc3cf8db2b5 100644 --- a/tests/lua-empty-test/project/proj.win32/lua-empty-test.vcxproj +++ b/tests/lua-empty-test/project/proj.win32/lua-empty-test.vcxproj @@ -13,6 +13,7 @@ {13E55395-94A2-4CD9-BFC2-1A051F80C17D} lua-empty-test.win32 + 10.0.17134.0 @@ -85,7 +86,7 @@ Disabled - $(ProjectDir)..\Classes;$(EngineRoot)external\lua\lua;$(EngineRoot)external\lua\tolua;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories) + $(ProjectDir)..\Classes;$(EngineRoot)external\lua\luajit\include;$(EngineRoot)external\lua\tolua;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories) WIN32;_WINDOWS;STRICT;_DEBUG;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_USRLUASTATIC;%(PreprocessorDefinitions) false EnableFastChecks @@ -103,19 +104,19 @@ $(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\include;$(IntDir);%(AdditionalIncludeDirectories) - %(AdditionalDependencies) + lua51.lib;%(AdditionalDependencies) $(OutDir);$(SolutionDir)$(Configuration).win32;%(AdditionalLibraryDirectories) true Windows MachineX86 libcmt.lib;%(IgnoreSpecificDefaultLibraries) - - xcopy "$(ProjectDir)..\..\res" "$(OutDir)res" /D /E /I /F /Y -xcopy "$(ProjectDir)..\..\src" "$(OutDir)src" /D /E /I /F /Y -xcopy "$(ProjectDir)..\..\..\..\cocos\scripting\lua-bindings\script" "$(OutDir)src\cocos" /D /E /I /F /Y + + xcopy "$(ProjectDir)..\..\res" "$(OutDir)Resources\res\" /D /E /I /F /Y +xcopy "$(ProjectDir)..\..\src" "$(OutDir)Resources\src\" /D /E /I /F /Y +xcopy "$(ProjectDir)..\..\..\..\cocos\scripting\lua-bindings\script" "$(OutDir)Resources\src\cocos\" /D /E /I /F /Y xcopy "$(OutDir)..\*.dll" "$(OutDir)" /D /Y - + @@ -135,7 +136,7 @@ xcopy "$(OutDir)..\*.dll" "$(OutDir)" /D /Y lua-empty-test_p.c - $(ProjectDir)..\Classes;$(EngineRoot)external\lua\lua;$(EngineRoot)external\lua\tolua;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories) + $(ProjectDir)..\Classes;$(EngineRoot)external\lua\luajit\include;$(EngineRoot)external\lua\tolua;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories) WIN32;_WINDOWS;STRICT;NDEBUG;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_USRLUASTATIC;%(PreprocessorDefinitions) @@ -154,7 +155,7 @@ xcopy "$(OutDir)..\*.dll" "$(OutDir)" /D /Y $(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\include;$(IntDir);%(AdditionalIncludeDirectories) - %(AdditionalDependencies) + lua51.lib;%(AdditionalDependencies) $(OutDir);$(SolutionDir)$(Configuration).win32;%(AdditionalLibraryDirectories) Windows MachineX86 @@ -165,12 +166,12 @@ xcopy "$(OutDir)..\*.dll" "$(OutDir)" /D /Y - - xcopy "$(ProjectDir)..\..\res" "$(OutDir)res" /D /E /I /F /Y -xcopy "$(ProjectDir)..\..\src" "$(OutDir)src" /D /E /I /F /Y -xcopy "$(ProjectDir)..\..\..\..\cocos\scripting\lua-bindings\script" "$(OutDir)src\cocos" /D /E /I /F /Y + + xcopy "$(ProjectDir)..\..\res" "$(OutDir)Resources\res\" /D /E /I /F /Y +xcopy "$(ProjectDir)..\..\src" "$(OutDir)Resources\src\" /D /E /I /F /Y +xcopy "$(ProjectDir)..\..\..\..\cocos\scripting\lua-bindings\script" "$(OutDir)Resources\src\cocos" /D /E /I /F /Y xcopy "$(OutDir)..\*.dll" "$(OutDir)" /D /Y - + diff --git a/tests/lua-empty-test/res/crop.png b/tests/lua-empty-test/res/crop.png index 3c3895f0596b..9ea84bc93fd6 100644 Binary files a/tests/lua-empty-test/res/crop.png and b/tests/lua-empty-test/res/crop.png differ diff --git a/tests/lua-empty-test/res/dog.png b/tests/lua-empty-test/res/dog.png index 9bd6b802e19a..76bdca07a123 100644 Binary files a/tests/lua-empty-test/res/dog.png and b/tests/lua-empty-test/res/dog.png differ diff --git a/tests/lua-empty-test/res/land.png b/tests/lua-empty-test/res/land.png index 3bc0bfa576ca..6e0785b545d7 100644 Binary files a/tests/lua-empty-test/res/land.png and b/tests/lua-empty-test/res/land.png differ diff --git a/tests/lua-empty-test/res/menu1.png b/tests/lua-empty-test/res/menu1.png index cc2600163ac2..eeb327a4cbcd 100644 Binary files a/tests/lua-empty-test/res/menu1.png and b/tests/lua-empty-test/res/menu1.png differ diff --git a/tests/lua-empty-test/res/menu2.png b/tests/lua-empty-test/res/menu2.png index 111415f531c3..04763ea1a443 100644 Binary files a/tests/lua-empty-test/res/menu2.png and b/tests/lua-empty-test/res/menu2.png differ diff --git a/tests/lua-game-controller-test/project/Classes/AppDelegate.cpp b/tests/lua-game-controller-test/project/Classes/AppDelegate.cpp index 740352dde5fd..eca67be144ac 100644 --- a/tests/lua-game-controller-test/project/Classes/AppDelegate.cpp +++ b/tests/lua-game-controller-test/project/Classes/AppDelegate.cpp @@ -43,7 +43,6 @@ AppDelegate::~AppDelegate() { // end simple audio engine here, or it may crashed on win32 SimpleAudioEngine::getInstance()->end(); - //CCScriptEngineManager::destroyInstance(); } bool AppDelegate::applicationDidFinishLaunching() diff --git a/tests/lua-game-controller-test/project/proj.android/app/AndroidManifest.xml b/tests/lua-game-controller-test/project/proj.android/app/AndroidManifest.xml index 197f5e9a3f99..8ea21190c3e4 100644 --- a/tests/lua-game-controller-test/project/proj.android/app/AndroidManifest.xml +++ b/tests/lua-game-controller-test/project/proj.android/app/AndroidManifest.xml @@ -11,6 +11,7 @@ diff --git a/tests/lua-game-controller-test/project/proj.android/app/build.gradle b/tests/lua-game-controller-test/project/proj.android/app/build.gradle index ec08d107c7b8..74d4f0d28071 100644 --- a/tests/lua-game-controller-test/project/proj.android/app/build.gradle +++ b/tests/lua-game-controller-test/project/proj.android/app/build.gradle @@ -26,6 +26,7 @@ android { java.srcDir "src" res.srcDir "res" manifest.srcFile "AndroidManifest.xml" + assets.srcDir "assets" } externalNativeBuild { @@ -112,23 +113,24 @@ def compileLua(srcDir, dstDir, doCompile, is64bit, doEncrypt) { } android.applicationVariants.all { variant -> - // delete previous files first - delete "${buildDir}/intermediates/assets/${variant.dirName}" - variant.mergeAssets.doLast { + delete "${projectDir}/assets" + def targetName = variant.name.capitalize() + def copyTaskName = "copy${targetName}ResourcesToAssets" + tasks.register(copyTaskName) { copy { - from "${buildDir}/../../../../res" - into "${buildDir}/intermediates/assets/${variant.dirName}/res" + from "${projectDir}/../../../res" + into "${projectDir}/assets/res" } copy { - from "${buildDir}/../../../../src" - into "${buildDir}/intermediates/assets/${variant.dirName}/src" + from "${projectDir}/../../../src" + into "${projectDir}/assets/src" } copy { - from "${buildDir}/../../../../../../cocos/scripting/lua-bindings/script" - into "${buildDir}/intermediates/assets/${variant.dirName}/src/cocos" + from "${projectDir}/../../../../../cocos/scripting/lua-bindings/script" + into "${projectDir}/assets/src/cocos" } // compile & encrypt the scripts if necessary @@ -172,37 +174,38 @@ android.applicationVariants.all { variant -> // invoke cocos command to compile & encrypt the lua files switch (buildType) { case -1: - compileLua("${buildDir}/intermediates/assets/${variant.dirName}/src", - "${buildDir}/intermediates/assets/${variant.dirName}/src", + compileLua("${projectDir}/assets/src", + "${projectDir}/assets/src", false, false, encryptLua) break case 0: - compileLua("${buildDir}/intermediates/assets/${variant.dirName}/src", - "${buildDir}/intermediates/assets/${variant.dirName}/src", + compileLua("${projectDir}/assets/src", + "${projectDir}/assets/src", true, false, encryptLua) break case 1: - compileLua("${buildDir}/intermediates/assets/${variant.dirName}/src", - "${buildDir}/intermediates/assets/${variant.dirName}/src/64bit", + compileLua("${projectDir}/assets/src", + "${projectDir}/assets/src/64bit", true, true, encryptLua) // remove the lua files in src dir - delete fileTree("${buildDir}/intermediates/assets/${variant.dirName}/src") { + delete fileTree("${projectDir}/assets/src") { include '**/*.lua' } - delete "${buildDir}/intermediates/assets/${variant.dirName}/src/cocos" + delete "${projectDir}/assets/src/cocos" break case 2: - compileLua("${buildDir}/intermediates/assets/${variant.dirName}/src", - "${buildDir}/intermediates/assets/${variant.dirName}/src/64bit", + compileLua("${projectDir}/assets/src", + "${projectDir}/assets/src/64bit", true, true, encryptLua) - compileLua("${buildDir}/intermediates/assets/${variant.dirName}/src", - "${buildDir}/intermediates/assets/${variant.dirName}/src", + compileLua("${projectDir}/assets/src", + "${projectDir}/assets/src", true, false, encryptLua) break } } } + tasks.getByName("pre${targetName}Build").dependsOn copyTaskName } dependencies { diff --git a/tests/lua-game-controller-test/project/proj.android/app/proguard-rules.pro b/tests/lua-game-controller-test/project/proj.android/app/proguard-rules.pro index 2c062c494602..9f6d4ff6bfb0 100644 --- a/tests/lua-game-controller-test/project/proj.android/app/proguard-rules.pro +++ b/tests/lua-game-controller-test/project/proj.android/app/proguard-rules.pro @@ -23,6 +23,8 @@ -dontwarn com.chukong.** -keep public class com.huawei.android.** { *; } -dontwarn com.huawei.android.** +-keep public class com.oppo.oiface.engine.** { *; } +-dontwarn com.oppo.oiface.engine.** # Proguard Apache HTTP for release -keep class org.apache.http.** { *; } diff --git a/tests/lua-game-controller-test/project/proj.android/app/res/mipmap-hdpi/ic_launcher.png b/tests/lua-game-controller-test/project/proj.android/app/res/mipmap-hdpi/ic_launcher.png index b7c70af06279..45ee51d15f96 100644 Binary files a/tests/lua-game-controller-test/project/proj.android/app/res/mipmap-hdpi/ic_launcher.png and b/tests/lua-game-controller-test/project/proj.android/app/res/mipmap-hdpi/ic_launcher.png differ diff --git a/tests/lua-game-controller-test/project/proj.android/app/res/mipmap-mdpi/ic_launcher.png b/tests/lua-game-controller-test/project/proj.android/app/res/mipmap-mdpi/ic_launcher.png index 205b38de0b80..0dd2a608998e 100644 Binary files a/tests/lua-game-controller-test/project/proj.android/app/res/mipmap-mdpi/ic_launcher.png and b/tests/lua-game-controller-test/project/proj.android/app/res/mipmap-mdpi/ic_launcher.png differ diff --git a/tests/lua-game-controller-test/project/proj.android/app/res/mipmap-xhdpi/ic_launcher.png b/tests/lua-game-controller-test/project/proj.android/app/res/mipmap-xhdpi/ic_launcher.png index 848469586508..a32f16f930b3 100644 Binary files a/tests/lua-game-controller-test/project/proj.android/app/res/mipmap-xhdpi/ic_launcher.png and b/tests/lua-game-controller-test/project/proj.android/app/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/tests/lua-game-controller-test/project/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png b/tests/lua-game-controller-test/project/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png index 1902955a2247..332f268edc46 100644 Binary files a/tests/lua-game-controller-test/project/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png and b/tests/lua-game-controller-test/project/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/tests/lua-game-controller-test/project/proj.android/build.gradle b/tests/lua-game-controller-test/project/proj.android/build.gradle index 5dff94de2a97..63697d83ac6c 100644 --- a/tests/lua-game-controller-test/project/proj.android/build.gradle +++ b/tests/lua-game-controller-test/project/proj.android/build.gradle @@ -7,7 +7,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.1.0' + classpath 'com.android.tools.build:gradle:3.4.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/tests/lua-game-controller-test/project/proj.android/gradle/wrapper/gradle-wrapper.properties b/tests/lua-game-controller-test/project/proj.android/gradle/wrapper/gradle-wrapper.properties index 9750fe6f09ae..77619cb68fd1 100644 --- a/tests/lua-game-controller-test/project/proj.android/gradle/wrapper/gradle-wrapper.properties +++ b/tests/lua-game-controller-test/project/proj.android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip diff --git a/tests/lua-game-controller-test/project/proj.android/settings.gradle b/tests/lua-game-controller-test/project/proj.android/settings.gradle index 57e3fb033030..5f8033f66e93 100644 --- a/tests/lua-game-controller-test/project/proj.android/settings.gradle +++ b/tests/lua-game-controller-test/project/proj.android/settings.gradle @@ -2,3 +2,4 @@ include ':libcocos2dx_with_controller' project(':libcocos2dx_with_controller').projectDir = new File(settingsDir, '../../../../cocos/platform/android/libcocos2dx-with-controller') include ':LuaGameControllerTest' project(':LuaGameControllerTest').projectDir = new File(settingsDir, 'app') +rootProject.name = "lua-game-controller-test" diff --git a/tests/lua-game-controller-test/project/proj.ios/AppController.mm b/tests/lua-game-controller-test/project/proj.ios/AppController.mm index 4a46196a5488..06e9c1ee9535 100644 --- a/tests/lua-game-controller-test/project/proj.ios/AppController.mm +++ b/tests/lua-game-controller-test/project/proj.ios/AppController.mm @@ -73,6 +73,12 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( [[UIApplication sharedApplication] setStatusBarHidden: YES]; + //Launching the app with the arguments -NSAllowsDefaultLineBreakStrategy NO to force back to the old behavior. + if ( [[UIDevice currentDevice].systemVersion floatValue] >= 13.0f) + { + [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"NSAllowsDefaultLineBreakStrategy"]; + } + // IMPORTANT: Setting the GLView should be done after creating the RootViewController cocos2d::GLView *glview = cocos2d::GLViewImpl::createWithEAGLView(eaglView); cocos2d::Director::getInstance()->setOpenGLView(glview); diff --git a/tests/lua-game-controller-test/project/proj.ios/Default-568h@2x.png b/tests/lua-game-controller-test/project/proj.ios/Default-568h@2x.png index f23dc35d9781..66c6d1cead37 100644 Binary files a/tests/lua-game-controller-test/project/proj.ios/Default-568h@2x.png and b/tests/lua-game-controller-test/project/proj.ios/Default-568h@2x.png differ diff --git a/tests/lua-game-controller-test/project/proj.ios/Default-667h@2x.png b/tests/lua-game-controller-test/project/proj.ios/Default-667h@2x.png index c92192a92ec8..a0f61ec8e639 100644 Binary files a/tests/lua-game-controller-test/project/proj.ios/Default-667h@2x.png and b/tests/lua-game-controller-test/project/proj.ios/Default-667h@2x.png differ diff --git a/tests/lua-game-controller-test/project/proj.ios/Default-736h@3x.png b/tests/lua-game-controller-test/project/proj.ios/Default-736h@3x.png index e8bbddf1b925..dadccee68624 100644 Binary files a/tests/lua-game-controller-test/project/proj.ios/Default-736h@3x.png and b/tests/lua-game-controller-test/project/proj.ios/Default-736h@3x.png differ diff --git a/tests/lua-game-controller-test/project/proj.ios/Default.png b/tests/lua-game-controller-test/project/proj.ios/Default.png index 8ca8f3332574..dcb80725de2a 100644 Binary files a/tests/lua-game-controller-test/project/proj.ios/Default.png and b/tests/lua-game-controller-test/project/proj.ios/Default.png differ diff --git a/tests/lua-game-controller-test/project/proj.ios/Default@2x.png b/tests/lua-game-controller-test/project/proj.ios/Default@2x.png index 7b854f39931e..84689888a14a 100644 Binary files a/tests/lua-game-controller-test/project/proj.ios/Default@2x.png and b/tests/lua-game-controller-test/project/proj.ios/Default@2x.png differ diff --git a/tests/lua-game-controller-test/project/proj.ios/Icon-114.png b/tests/lua-game-controller-test/project/proj.ios/Icon-114.png index 6ddb38c633e5..c3807861ad29 100644 Binary files a/tests/lua-game-controller-test/project/proj.ios/Icon-114.png and b/tests/lua-game-controller-test/project/proj.ios/Icon-114.png differ diff --git a/tests/lua-game-controller-test/project/proj.ios/Icon-120.png b/tests/lua-game-controller-test/project/proj.ios/Icon-120.png index 6c50aba2414a..a5b49ccbb199 100644 Binary files a/tests/lua-game-controller-test/project/proj.ios/Icon-120.png and b/tests/lua-game-controller-test/project/proj.ios/Icon-120.png differ diff --git a/tests/lua-game-controller-test/project/proj.ios/Icon-144.png b/tests/lua-game-controller-test/project/proj.ios/Icon-144.png index fe6e1662634d..1526615c02d1 100644 Binary files a/tests/lua-game-controller-test/project/proj.ios/Icon-144.png and b/tests/lua-game-controller-test/project/proj.ios/Icon-144.png differ diff --git a/tests/lua-game-controller-test/project/proj.ios/Icon-152.png b/tests/lua-game-controller-test/project/proj.ios/Icon-152.png index e448eee9d57d..8aa82506d0d1 100644 Binary files a/tests/lua-game-controller-test/project/proj.ios/Icon-152.png and b/tests/lua-game-controller-test/project/proj.ios/Icon-152.png differ diff --git a/tests/lua-game-controller-test/project/proj.ios/Icon-57.png b/tests/lua-game-controller-test/project/proj.ios/Icon-57.png index 5e355f7cb5c1..4fcc6fddffe1 100644 Binary files a/tests/lua-game-controller-test/project/proj.ios/Icon-57.png and b/tests/lua-game-controller-test/project/proj.ios/Icon-57.png differ diff --git a/tests/lua-game-controller-test/project/proj.ios/Icon-72.png b/tests/lua-game-controller-test/project/proj.ios/Icon-72.png index 589f775f5ed2..2c573c8df4c3 100644 Binary files a/tests/lua-game-controller-test/project/proj.ios/Icon-72.png and b/tests/lua-game-controller-test/project/proj.ios/Icon-72.png differ diff --git a/tests/lua-game-controller-test/project/proj.ios/Icon-76.png b/tests/lua-game-controller-test/project/proj.ios/Icon-76.png index 157eeba15884..8a1fa1850c03 100644 Binary files a/tests/lua-game-controller-test/project/proj.ios/Icon-76.png and b/tests/lua-game-controller-test/project/proj.ios/Icon-76.png differ diff --git a/tests/lua-game-controller-test/project/proj.ios/Info.plist b/tests/lua-game-controller-test/project/proj.ios/Info.plist index 73302a2ce337..2c477a37ca0a 100644 --- a/tests/lua-game-controller-test/project/proj.ios/Info.plist +++ b/tests/lua-game-controller-test/project/proj.ios/Info.plist @@ -35,6 +35,8 @@ ${PRODUCT_NAME} CFBundlePackageType APPL + CFBundleShortVersionString + 1.0 CFBundleSignature ???? CFBundleVersion diff --git a/tests/lua-game-controller-test/project/proj.ios/RootViewController.mm b/tests/lua-game-controller-test/project/proj.ios/RootViewController.mm index 8002ff82d09b..ea3cc791e21e 100644 --- a/tests/lua-game-controller-test/project/proj.ios/RootViewController.mm +++ b/tests/lua-game-controller-test/project/proj.ios/RootViewController.mm @@ -25,7 +25,7 @@ of this software and associated documentation files (the "Software"), to deal ****************************************************************************/ #import "RootViewController.h" - +#import "platform/ios/CCDirectorCaller-ios.h" @implementation RootViewController @@ -50,8 +50,15 @@ - (void)loadView { - (void)viewDidLoad { [super viewDidLoad]; } - */ + +//In iOS 12.0+, Screen Time's bug cause UIApplicationDidBecomeActiveNotification and UIApplicationWillResignActiveNotification do not fired +//so we need to active CCDirectorCaller manually +-(void)viewDidAppear:(BOOL)animated{ + [super viewDidAppear:animated]; + [[CCDirectorCaller sharedDirectorCaller] setActive:YES]; +} + // Override to allow orientations other than the default portrait orientation. // This method is deprecated on ios6 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { diff --git a/tests/lua-tests/project/CMakeLists.txt b/tests/lua-tests/project/CMakeLists.txt index 3b7e72dc3f90..a695df024bc7 100644 --- a/tests/lua-tests/project/CMakeLists.txt +++ b/tests/lua-tests/project/CMakeLists.txt @@ -9,10 +9,8 @@ if(NOT DEFINED BUILD_ENGINE_DONE) set(CMAKE_MODULE_PATH ${COCOS2DX_ROOT_PATH}/cmake/Modules/) include(CocosBuildSet) - if(NOT USE_COCOS_PREBUILT) - set(BUILD_LUA_LIBS ON) - add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos ${ENGINE_BINARY_PATH}/cocos/core) - endif() + set(BUILD_LUA_LIBS ON) + add_subdirectory(${COCOS2DX_ROOT_PATH}/cocos ${ENGINE_BINARY_PATH}/cocos/core) endif() set(GAME_HEADER @@ -50,7 +48,6 @@ if(ANDROID) elseif(LINUX) list(APPEND GAME_SOURCE proj.linux/main.cpp) elseif(WINDOWS) - add_definitions(-D_USRLUASTATIC) list(APPEND GAME_HEADER proj.win32/main.h proj.win32/resource.h @@ -80,7 +77,6 @@ elseif(APPLE) proj.ios_mac/mac/LuaObjectCBridgeTest.h ) set(APP_UI_RES - proj.ios_mac/mac/en.lproj/MainMenu.xib proj.ios_mac/mac/Icon.icns proj.ios_mac/mac/Info.plist ) @@ -114,17 +110,21 @@ if(APPLE) if(MACOSX) set_target_properties(${APP_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/proj.ios_mac/mac/Info.plist" + LINK_FLAGS "-pagezero_size 10000 -image_base 100000000" ) elseif(IOS) cocos_pak_xcode(${APP_NAME} INFO_PLIST "iOSBundleInfo.plist.in") set_xcode_property(${APP_NAME} ASSETCATALOG_COMPILER_APPICON_NAME "AppIcon-${APP_NAME}") + set_xcode_property(${APP_NAME} DEVELOPMENT_TEAM "") + set_xcode_property(${APP_NAME} CODE_SIGN_IDENTITY "iPhone Developer") endif() elseif(WINDOWS) - cocos_copy_target_dll(${APP_NAME} COPY_TO ${APP_RES_DIR}) + cocos_copy_target_dll(${APP_NAME}) endif() if(LINUX OR WINDOWS) - cocos_copy_res(COPY_TO ${APP_RES_DIR}/res FOLDERS ${res_res_folders}) - cocos_copy_res(COPY_TO ${APP_RES_DIR}/src FOLDERS ${res_src_folders}) - cocos_copy_res(COPY_TO ${APP_RES_DIR}/src/cocos FOLDERS ${res_script_folders}) + set(APP_RES_DIR "$/Resources") + cocos_copy_target_res(${APP_NAME} COPY_TO ${APP_RES_DIR}/res FOLDERS ${res_res_folders}) + cocos_copy_target_res(${APP_NAME} COPY_TO ${APP_RES_DIR}/src FOLDERS ${res_src_folders}) + cocos_copy_target_res(${APP_NAME} COPY_TO ${APP_RES_DIR}/src/cocos FOLDERS ${res_script_folders}) endif() diff --git a/tests/lua-tests/project/Classes/lua_test_bindings.cpp b/tests/lua-tests/project/Classes/lua_test_bindings.cpp index 58104723278f..25a0f7fbe217 100644 --- a/tests/lua-tests/project/Classes/lua_test_bindings.cpp +++ b/tests/lua-tests/project/Classes/lua_test_bindings.cpp @@ -134,7 +134,7 @@ DrawNode3D::~DrawNode3D() if (Configuration::getInstance()->supportsShareableVAO()) { glDeleteVertexArrays(1, &_vao); - glBindVertexArray(0); + GL::bindVAO(0); _vao = 0; } } @@ -176,7 +176,7 @@ bool DrawNode3D::init() if (Configuration::getInstance()->supportsShareableVAO()) { glGenVertexArrays(1, &_vao); - glBindVertexArray(_vao); + GL::bindVAO(_vao); } glGenBuffers(1, &_vbo); @@ -193,7 +193,7 @@ bool DrawNode3D::init() if (Configuration::getInstance()->supportsShareableVAO()) { - glBindVertexArray(0); + GL::bindVAO(0); } CHECK_GL_ERROR_DEBUG(); @@ -226,7 +226,7 @@ void DrawNode3D::onDraw(const Mat4 &transform, uint32_t flags) glProgram->use(); glProgram->setUniformsForBuiltins(transform); glEnable(GL_DEPTH_TEST); - utils::setBlending(_blendFunc.src, _blendFunc.dst); + GL::blendFunc(_blendFunc.src, _blendFunc.dst); if (_dirty) { @@ -236,12 +236,11 @@ void DrawNode3D::onDraw(const Mat4 &transform, uint32_t flags) } if (Configuration::getInstance()->supportsShareableVAO()) { - glBindVertexArray(_vao); + GL::bindVAO(_vao); } else { - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION); - glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_COLOR); + GL::enableVertexAttribs(GL::VERTEX_ATTRIB_FLAG_POS_COLOR_TEX); glBindBuffer(GL_ARRAY_BUFFER, _vbo); // vertex @@ -324,10 +323,10 @@ void DrawNode3D::setBlendFunc(const BlendFunc &blendFunc) class ValueTypeJudgeInTable:public Node { public: - static ValueTypeJudgeInTable* create(ValueMap valueMap); + static ValueTypeJudgeInTable* create(const ValueMap& valueMap); }; -ValueTypeJudgeInTable* ValueTypeJudgeInTable::create(ValueMap valueMap) +ValueTypeJudgeInTable* ValueTypeJudgeInTable::create(const ValueMap& valueMap) { ValueTypeJudgeInTable* ret = new (std::nothrow) ValueTypeJudgeInTable(); if (ret) @@ -340,7 +339,7 @@ ValueTypeJudgeInTable* ValueTypeJudgeInTable::create(ValueMap valueMap) } int index = 0; - for (auto iter : valueMap) + for (const auto& iter : valueMap) { Value::Type type = iter.second.getType(); if (type == Value::Type::STRING) { diff --git a/tests/lua-tests/project/proj.android/app/AndroidManifest.xml b/tests/lua-tests/project/proj.android/app/AndroidManifest.xml index 16f6cdb54bb1..45c68f522ad4 100644 --- a/tests/lua-tests/project/proj.android/app/AndroidManifest.xml +++ b/tests/lua-tests/project/proj.android/app/AndroidManifest.xml @@ -8,6 +8,7 @@ diff --git a/tests/lua-tests/project/proj.android/app/build.gradle b/tests/lua-tests/project/proj.android/app/build.gradle index fc22e233df32..2b45604699d7 100644 --- a/tests/lua-tests/project/proj.android/app/build.gradle +++ b/tests/lua-tests/project/proj.android/app/build.gradle @@ -34,9 +34,8 @@ android { else if (PROP_BUILD_TYPE == 'cmake') { cmake { targets 'lua_tests' - arguments "-DCMAKE_FIND_ROOT_PATH=", "-DANDROID_STL=c++_static", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE", \ - "-DUSE_CHIPMUNK=TRUE", "-DUSE_BULLET=TRUE", "-DBUILD_LUA_LIBS=TRUE" - cppFlags "-frtti -fexceptions" + arguments "-DCMAKE_FIND_ROOT_PATH=", "-DANDROID_STL=c++_static", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE" + cppFlags "-frtti -fexceptions -fsigned-char" } } } @@ -51,6 +50,7 @@ android { java.srcDir "src" res.srcDir "res" manifest.srcFile "AndroidManifest.xml" + assets.srcDir "assets" } externalNativeBuild { @@ -115,11 +115,19 @@ def getCocosCommandPath() { return 'cocos.bat' } else { + + def env_console_path = System.getenv("COCOS_CONSOLE_ROOT") + + if (env_console_path != null && !env_console_path.trim().isEmpty()) { + return new File(env_console_path.trim() + '/cocos').absolutePath + } + // on unix like system, can not get environments variables easily // so run a shell script to get environment variable sets by cocos2d-x setup.py new ByteArrayOutputStream().withStream { os -> def result = exec { - executable = project.file('get_environment.sh') + executable = "/bin/bash" + args = [ "-i", project.file('get_environment.sh')] standardOutput = os } ext.console_path = os.toString().trim() @@ -161,30 +169,32 @@ def compileLua(srcDir, dstDir, doCompile, is64bit, doEncrypt) { } android.applicationVariants.all { variant -> - // delete previous files first - delete "${buildDir}/intermediates/assets/${variant.dirName}" - variant.mergeAssets.doLast { + delete "${projectDir}/assets" + def targetName = variant.name.capitalize() + def copyTaskName = "copy${targetName}ResourcesToAssets" + + tasks.register(copyTaskName) { copy { - from "${buildDir}/../../../../res" - into "${buildDir}/intermediates/assets/${variant.dirName}/res" + from "${projectDir}/../../../res" + into "${projectDir}/assets/res" } copy { - from("${buildDir}/../../../../../cpp-tests/Resources") { + from("${projectDir}/../../../../cpp-tests/Resources") { exclude "**/*.gz" } - into "${buildDir}/intermediates/assets/${variant.dirName}/res" + into "${projectDir}/assets/res" } copy { - from "${buildDir}/../../../../src" - into "${buildDir}/intermediates/assets/${variant.dirName}/src" + from "${projectDir}/../../../src" + into "${projectDir}/assets/src" } copy { - from "${buildDir}/../../../../../../cocos/scripting/lua-bindings/script" - into "${buildDir}/intermediates/assets/${variant.dirName}/src/cocos" + from "${projectDir}/../../../../../cocos/scripting/lua-bindings/script" + into "${projectDir}/assets/src/cocos" } // compile & encrypt the scripts if necessary @@ -228,37 +238,38 @@ android.applicationVariants.all { variant -> // invoke cocos command to compile & encrypt the lua files switch (buildType) { case -1: - compileLua("${buildDir}/intermediates/assets/${variant.dirName}/src", - "${buildDir}/intermediates/assets/${variant.dirName}/src", + compileLua("${projectDir}/assets/src", + "${projectDir}/assets/src", false, false, encryptLua) break case 0: - compileLua("${buildDir}/intermediates/assets/${variant.dirName}/src", - "${buildDir}/intermediates/assets/${variant.dirName}/src", + compileLua("${projectDir}/assets/src", + "${projectDir}/assets/src", true, false, encryptLua) break case 1: - compileLua("${buildDir}/intermediates/assets/${variant.dirName}/src", - "${buildDir}/intermediates/assets/${variant.dirName}/src/64bit", + compileLua("${projectDir}/assets/src", + "${projectDir}/assets/src/64bit", true, true, encryptLua) // remove the lua files in src dir - delete fileTree("${buildDir}/intermediates/assets/${variant.dirName}/src") { + delete fileTree("${projectDir}/assets/src") { include '**/*.lua' } - delete "${buildDir}/intermediates/assets/${variant.dirName}/src/cocos" + delete "${projectDir}/assets/src/cocos" break case 2: - compileLua("${buildDir}/intermediates/assets/${variant.dirName}/src", - "${buildDir}/intermediates/assets/${variant.dirName}/src/64bit", + compileLua("${projectDir}/assets/src", + "${projectDir}/assets/src/64bit", true, true, encryptLua) - compileLua("${buildDir}/intermediates/assets/${variant.dirName}/src", - "${buildDir}/intermediates/assets/${variant.dirName}/src", + compileLua("${projectDir}/assets/src", + "${projectDir}/assets/src", true, false, encryptLua) break } } } + tasks.getByName("pre${targetName}Build").dependsOn copyTaskName } dependencies { diff --git a/tests/lua-tests/project/proj.android/app/proguard-rules.pro b/tests/lua-tests/project/proj.android/app/proguard-rules.pro index 2c062c494602..58119439a0c6 100644 --- a/tests/lua-tests/project/proj.android/app/proguard-rules.pro +++ b/tests/lua-tests/project/proj.android/app/proguard-rules.pro @@ -23,6 +23,10 @@ -dontwarn com.chukong.** -keep public class com.huawei.android.** { *; } -dontwarn com.huawei.android.** +-keep public class com.cocos2dx.sample.** { *; } +-dontwarn com.cocos2dx.sample.** +-keep public class com.oppo.oiface.engine.** { *; } +-dontwarn com.oppo.oiface.engine.** # Proguard Apache HTTP for release -keep class org.apache.http.** { *; } diff --git a/tests/lua-tests/project/proj.android/app/res/mipmap-hdpi/ic_launcher.png b/tests/lua-tests/project/proj.android/app/res/mipmap-hdpi/ic_launcher.png index a58d118d5339..45ee51d15f96 100644 Binary files a/tests/lua-tests/project/proj.android/app/res/mipmap-hdpi/ic_launcher.png and b/tests/lua-tests/project/proj.android/app/res/mipmap-hdpi/ic_launcher.png differ diff --git a/tests/lua-tests/project/proj.android/app/res/mipmap-mdpi/ic_launcher.png b/tests/lua-tests/project/proj.android/app/res/mipmap-mdpi/ic_launcher.png index 3d921e19265e..0dd2a608998e 100644 Binary files a/tests/lua-tests/project/proj.android/app/res/mipmap-mdpi/ic_launcher.png and b/tests/lua-tests/project/proj.android/app/res/mipmap-mdpi/ic_launcher.png differ diff --git a/tests/lua-tests/project/proj.android/app/res/mipmap-xhdpi/ic_launcher.png b/tests/lua-tests/project/proj.android/app/res/mipmap-xhdpi/ic_launcher.png index 6f4f3fc8f86d..a32f16f930b3 100644 Binary files a/tests/lua-tests/project/proj.android/app/res/mipmap-xhdpi/ic_launcher.png and b/tests/lua-tests/project/proj.android/app/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/tests/lua-tests/project/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png b/tests/lua-tests/project/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png index 7ffc316459a1..332f268edc46 100644 Binary files a/tests/lua-tests/project/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png and b/tests/lua-tests/project/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/tests/lua-tests/project/proj.android/build.gradle b/tests/lua-tests/project/proj.android/build.gradle index 5dff94de2a97..63697d83ac6c 100644 --- a/tests/lua-tests/project/proj.android/build.gradle +++ b/tests/lua-tests/project/proj.android/build.gradle @@ -7,7 +7,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.1.0' + classpath 'com.android.tools.build:gradle:3.4.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/tests/lua-tests/project/proj.android/gradle/wrapper/gradle-wrapper.properties b/tests/lua-tests/project/proj.android/gradle/wrapper/gradle-wrapper.properties index 362b38e5efc7..eb512f24e3ac 100644 --- a/tests/lua-tests/project/proj.android/gradle/wrapper/gradle-wrapper.properties +++ b/tests/lua-tests/project/proj.android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip diff --git a/tests/lua-tests/project/proj.android/settings.gradle b/tests/lua-tests/project/proj.android/settings.gradle index 6087728e424b..05c3a5eb7971 100644 --- a/tests/lua-tests/project/proj.android/settings.gradle +++ b/tests/lua-tests/project/proj.android/settings.gradle @@ -2,3 +2,4 @@ include ':libcocos2dx' project(':libcocos2dx').projectDir = new File(settingsDir, '../../../../cocos/platform/android/libcocos2dx') include ':LuaTests' project(':LuaTests').projectDir = new File(settingsDir, 'app') +rootProject.name = "lua-tests" diff --git a/tests/lua-tests/project/proj.ios_mac/ios/AppController.mm b/tests/lua-tests/project/proj.ios_mac/ios/AppController.mm index 22818380c230..260767392cc8 100644 --- a/tests/lua-tests/project/proj.ios_mac/ios/AppController.mm +++ b/tests/lua-tests/project/proj.ios_mac/ios/AppController.mm @@ -84,6 +84,11 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( [[UIApplication sharedApplication] setStatusBarHidden: YES]; #endif + //Launching the app with the arguments -NSAllowsDefaultLineBreakStrategy NO to force back to the old behavior. + if ( [[UIDevice currentDevice].systemVersion floatValue] >= 13.0f) + { + [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"NSAllowsDefaultLineBreakStrategy"]; + } // IMPORTANT: Setting the GLView should be done after creating the RootViewController cocos2d::GLView *glview = cocos2d::GLViewImpl::createWithEAGLView(eaglView); diff --git a/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-20.png b/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-20.png index 7cba320b858d..8ead23e36507 100644 Binary files a/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-20.png and b/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-20.png differ diff --git a/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-20@2x.png b/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-20@2x.png index 7e34719ba837..775685daca94 100644 Binary files a/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-20@2x.png and b/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-20@2x.png differ diff --git a/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-20@3x.png b/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-20@3x.png index 6c50aba2414a..a5b49ccbb199 100644 Binary files a/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-20@3x.png and b/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-20@3x.png differ diff --git a/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-29.png b/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-29.png index 5fe9afd2372c..0500184c869c 100644 Binary files a/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-29.png and b/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-29.png differ diff --git a/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-29@2x.png b/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-29@2x.png index 6cd69bf338b1..f0f8b7fe9833 100644 Binary files a/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-29@2x.png and b/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-29@2x.png differ diff --git a/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-29@3x.png b/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-29@3x.png index abb89cab6382..5287e50a7986 100644 Binary files a/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-29@3x.png and b/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-29@3x.png differ diff --git a/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-40.png b/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-40.png index 7e34719ba837..775685daca94 100644 Binary files a/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-40.png and b/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-40.png differ diff --git a/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-40@2x.png b/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-40@2x.png index 361307424626..d9c7ab446bb7 100644 Binary files a/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-40@2x.png and b/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-40@2x.png differ diff --git a/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-40@3x.png b/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-40@3x.png index 6c50aba2414a..a5b49ccbb199 100644 Binary files a/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-40@3x.png and b/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-40@3x.png differ diff --git a/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-50.png b/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-50.png index dd23cd1b6fa4..ac381bc20e85 100644 Binary files a/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-50.png and b/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-50.png differ diff --git a/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-50@2x.png b/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-50@2x.png index 29e0b3d01f14..ef38d4500a80 100644 Binary files a/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-50@2x.png and b/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-50@2x.png differ diff --git a/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-57.png b/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-57.png index 5e355f7cb5c1..4fcc6fddffe1 100644 Binary files a/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-57.png and b/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-57.png differ diff --git a/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-57@2x.png b/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-57@2x.png index 6ddb38c633e5..c3807861ad29 100644 Binary files a/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-57@2x.png and b/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-57@2x.png differ diff --git a/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-60@2x.png b/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-60@2x.png index 6c50aba2414a..a5b49ccbb199 100644 Binary files a/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-60@2x.png and b/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-60@2x.png differ diff --git a/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-60@3x.png b/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-60@3x.png index 4ab7ff4aa201..d4bc53132ce3 100644 Binary files a/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-60@3x.png and b/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-60@3x.png differ diff --git a/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-72.png b/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-72.png index 589f775f5ed2..2c573c8df4c3 100644 Binary files a/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-72.png and b/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-72.png differ diff --git a/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-72@2x.png b/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-72@2x.png index fe6e1662634d..1526615c02d1 100644 Binary files a/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-72@2x.png and b/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-72@2x.png differ diff --git a/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-76.png b/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-76.png index 157eeba15884..8a1fa1850c03 100644 Binary files a/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-76.png and b/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-76.png differ diff --git a/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-76@2x.png b/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-76@2x.png index e448eee9d57d..8aa82506d0d1 100644 Binary files a/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-76@2x.png and b/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-76@2x.png differ diff --git a/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-83.5@2x.png b/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-83.5@2x.png index 9a849c7f7caa..6bf801d17507 100644 Binary files a/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-83.5@2x.png and b/tests/lua-tests/project/proj.ios_mac/ios/Images.xcassets/AppIcon-lua-tests.appiconset/Icon-83.5@2x.png differ diff --git a/tests/lua-tests/project/proj.ios_mac/ios/Info.plist b/tests/lua-tests/project/proj.ios_mac/ios/Info.plist index ffa014088562..b84c8ba60baf 100644 --- a/tests/lua-tests/project/proj.ios_mac/ios/Info.plist +++ b/tests/lua-tests/project/proj.ios_mac/ios/Info.plist @@ -29,6 +29,8 @@ ${PRODUCT_NAME} CFBundlePackageType APPL + CFBundleShortVersionString + 1.0 CFBundleSignature ???? CFBundleVersion @@ -42,12 +44,28 @@ UIAppFonts - fonts/A Damn Mess.ttf - fonts/Abberancy.ttf + fonts/American Typewriter.ttf fonts/Abduction.ttf + fonts/ThonburiBold.ttf + fonts/Fingerpop.ttf fonts/Paint Boy.ttf - fonts/Schwarzwald.ttf + fonts/A Damn Mess.ttf + fonts/Schwarzwald Regular.ttf + fonts/Courier New.ttf + fonts/Japanese.ttf + fonts/xingkai-incomplete.ttf + fonts/arial.ttf fonts/Scissor Cuts.ttf + fonts/FingerpopGap.ttf + fonts/NotoEmoji-Regular.ttf + fonts/Marker Felt.ttf + fonts/Schwarzwald.ttf + fonts/cyril.ttf + fonts/tahoma.ttf + fonts/HKYuanMini.ttf + fonts/cyrillic.ttf + fonts/Abberancy.ttf + fonts/Thonburi.ttf UILaunchStoryboardName LaunchScreen diff --git a/tests/lua-tests/project/proj.ios_mac/ios/LaunchScreenBackground.png b/tests/lua-tests/project/proj.ios_mac/ios/LaunchScreenBackground.png index e8bbddf1b925..dadccee68624 100644 Binary files a/tests/lua-tests/project/proj.ios_mac/ios/LaunchScreenBackground.png and b/tests/lua-tests/project/proj.ios_mac/ios/LaunchScreenBackground.png differ diff --git a/tests/lua-tests/project/proj.ios_mac/ios/RootViewController.mm b/tests/lua-tests/project/proj.ios_mac/ios/RootViewController.mm index 8002ff82d09b..ea3cc791e21e 100644 --- a/tests/lua-tests/project/proj.ios_mac/ios/RootViewController.mm +++ b/tests/lua-tests/project/proj.ios_mac/ios/RootViewController.mm @@ -25,7 +25,7 @@ of this software and associated documentation files (the "Software"), to deal ****************************************************************************/ #import "RootViewController.h" - +#import "platform/ios/CCDirectorCaller-ios.h" @implementation RootViewController @@ -50,8 +50,15 @@ - (void)loadView { - (void)viewDidLoad { [super viewDidLoad]; } - */ + +//In iOS 12.0+, Screen Time's bug cause UIApplicationDidBecomeActiveNotification and UIApplicationWillResignActiveNotification do not fired +//so we need to active CCDirectorCaller manually +-(void)viewDidAppear:(BOOL)animated{ + [super viewDidAppear:animated]; + [[CCDirectorCaller sharedDirectorCaller] setActive:YES]; +} + // Override to allow orientations other than the default portrait orientation. // This method is deprecated on ios6 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { diff --git a/tests/lua-tests/project/proj.ios_mac/mac/en.lproj/MainMenu.xib b/tests/lua-tests/project/proj.ios_mac/mac/en.lproj/MainMenu.xib deleted file mode 100644 index 9f99439250c0..000000000000 --- a/tests/lua-tests/project/proj.ios_mac/mac/en.lproj/MainMenu.xib +++ /dev/null @@ -1,812 +0,0 @@ - - - - 1060 - 10K549 - 1938 - 1038.36 - 461.00 - - com.apple.InterfaceBuilder.CocoaPlugin - 1938 - - - YES - NSMenuItem - NSCustomObject - NSMenu - - - YES - com.apple.InterfaceBuilder.CocoaPlugin - - - PluginDependencyRecalculationVersion - - - - YES - - NSApplication - - - FirstResponder - - - NSApplication - - - AMainMenu - - YES - - - HelloCpp - - 1048576 - 2147483647 - - NSImage - NSMenuCheckmark - - - NSImage - NSMenuMixedState - - submenuAction: - - HelloCpp - - YES - - - About HelloCpp - - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Preferences… - , - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Services - - 1048576 - 2147483647 - - - submenuAction: - - Services - - YES - - _NSServicesMenu - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Hide HelloCpp - h - 1048576 - 2147483647 - - - - - - Hide Others - h - 1572864 - 2147483647 - - - - - - Show All - - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Quit HelloCpp - q - 1048576 - 2147483647 - - - - - _NSAppleMenu - - - - - View - - 1048576 - 2147483647 - - - submenuAction: - - View - - YES - - - Toggle Fullscreen - f - 1048576 - 2147483647 - - - - - - - - - Window - - 1048576 - 2147483647 - - - submenuAction: - - Window - - YES - - - Minimize - m - 1048576 - 2147483647 - - - - - - Zoom - - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Bring All to Front - - 1048576 - 2147483647 - - - - - _NSWindowsMenu - - - - - Help - - 2147483647 - - - submenuAction: - - Help - - YES - - - HelloCpp Help - ? - 1048576 - 2147483647 - - - - - _NSHelpMenu - - - - _NSMainMenu - - - AppController - - - NSFontManager - - - - - YES - - - terminate: - - - - 449 - - - - orderFrontStandardAboutPanel: - - - - 142 - - - - delegate - - - - 495 - - - - performMiniaturize: - - - - 37 - - - - arrangeInFront: - - - - 39 - - - - performZoom: - - - - 240 - - - - hide: - - - - 367 - - - - hideOtherApplications: - - - - 368 - - - - unhideAllApplications: - - - - 370 - - - - showHelp: - - - - 493 - - - - toggleFullScreen: - - - - 537 - - - - - YES - - 0 - - YES - - - - - - -2 - - - File's Owner - - - -1 - - - First Responder - - - -3 - - - Application - - - 29 - - - YES - - - - - - - - - 19 - - - YES - - - - - - 56 - - - YES - - - - - - 57 - - - YES - - - - - - - - - - - - - - - - 58 - - - - - 134 - - - - - 150 - - - - - 136 - - - - - 144 - - - - - 129 - - - - - 143 - - - - - 236 - - - - - 131 - - - YES - - - - - - 149 - - - - - 145 - - - - - 130 - - - - - 24 - - - YES - - - - - - - - - 92 - - - - - 5 - - - - - 239 - - - - - 23 - - - - - 295 - - - YES - - - - - - 296 - - - YES - - - - - - 420 - - - - - 490 - - - YES - - - - - - 491 - - - YES - - - - - - 492 - - - - - 494 - - - - - 536 - - - - - - - YES - - YES - -1.IBPluginDependency - -2.IBPluginDependency - -3.IBPluginDependency - 129.IBPluginDependency - 130.IBPluginDependency - 131.IBPluginDependency - 134.IBPluginDependency - 136.IBPluginDependency - 143.IBPluginDependency - 144.IBPluginDependency - 145.IBPluginDependency - 149.IBPluginDependency - 150.IBPluginDependency - 19.IBPluginDependency - 23.IBPluginDependency - 236.IBPluginDependency - 239.IBPluginDependency - 24.IBPluginDependency - 29.IBPluginDependency - 295.IBPluginDependency - 296.IBPluginDependency - 420.IBPluginDependency - 490.IBPluginDependency - 491.IBPluginDependency - 492.IBPluginDependency - 494.IBPluginDependency - 5.IBPluginDependency - 536.IBPluginDependency - 56.IBPluginDependency - 57.IBPluginDependency - 58.IBPluginDependency - 92.IBPluginDependency - - - YES - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - - YES - - - - - - YES - - - - - 541 - - - - YES - - AppController - NSObject - - YES - - YES - exitFullScreen: - toggleFullScreen: - - - YES - id - id - - - - YES - - YES - exitFullScreen: - toggleFullScreen: - - - YES - - exitFullScreen: - id - - - toggleFullScreen: - id - - - - - YES - - YES - glView - window - - - YES - EAGLView - Window - - - - YES - - YES - glView - window - - - YES - - glView - EAGLView - - - window - Window - - - - - IBProjectSource - ./Classes/AppController.h - - - - EAGLView - NSOpenGLView - - IBProjectSource - ./Classes/EAGLView.h - - - - - 0 - IBCocoaFramework - - com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 - - - YES - 3 - - YES - - YES - NSMenuCheckmark - NSMenuMixedState - - - YES - {9, 8} - {7, 2} - - - - diff --git a/tests/lua-tests/project/proj.win32/lua-tests.win32.vcxproj b/tests/lua-tests/project/proj.win32/lua-tests.win32.vcxproj index 16db32e2438d..84ffd915ab7b 100644 --- a/tests/lua-tests/project/proj.win32/lua-tests.win32.vcxproj +++ b/tests/lua-tests/project/proj.win32/lua-tests.win32.vcxproj @@ -13,6 +13,7 @@ {4E6A7A0E-DDD8-4BAA-8B22-C964069364ED} lua-tests + 10.0.17134.0 @@ -90,7 +91,7 @@ MachineX86 true $(OutDir);$(SolutionDir)$(Configuration).win32;%(AdditionalLibraryDirectories) - %(AdditionalDependencies) + lua51.lib;%(AdditionalDependencies) libcmt.lib @@ -110,15 +111,15 @@ - - xcopy "$(ProjectDir)..\..\res" "$(OutDir)res" /D /E /I /F /Y -xcopy "$(ProjectDir)..\..\src" "$(OutDir)src" /D /E /I /F /Y -xcopy "$(ProjectDir)..\..\..\..\tests\cpp-tests\Resources" "$(OutDir)res" /D /E /I /F /Y -xcopy "$(ProjectDir)..\..\..\..\cocos\scripting\lua-bindings\script" "$(OutDir)src\cocos" /D /E /I /F /Y -xcopy "$(ProjectDir)..\..\..\..\external\lua\luasocket\script" "$(OutDir)script" /D /E /I /F /Y + + xcopy "$(ProjectDir)..\..\res" "$(OutDir)Resources\res\" /D /E /I /F /Y +xcopy "$(ProjectDir)..\..\src" "$(OutDir)Resources\src\" /D /E /I /F /Y +xcopy "$(ProjectDir)..\..\..\..\tests\cpp-tests\Resources" "$(OutDir)Resources\res\" /D /E /I /F /Y +xcopy "$(ProjectDir)..\..\..\..\cocos\scripting\lua-bindings\script" "$(OutDir)Resources\src\cocos\" /D /E /I /F /Y +xcopy "$(ProjectDir)..\..\..\..\external\lua\luasocket\script" "$(OutDir)Resources\script\" /D /E /I /F /Y xcopy "$(OutDir)..\*.dll" "$(OutDir)" /D /Y copy files - + @@ -142,7 +143,7 @@ xcopy "$(OutDir)..\*.dll" "$(OutDir)" /D /Y Windows MachineX86 $(OutDir);$(SolutionDir)$(Configuration).win32;%(AdditionalLibraryDirectories) - %(AdditionalDependencies) + lua51.lib;%(AdditionalDependencies) true libcmt.lib @@ -163,21 +164,21 @@ xcopy "$(OutDir)..\*.dll" "$(OutDir)" /D /Y - + copy files - + - xcopy "$(ProjectDir)..\..\res" "$(OutDir)res" /D /E /I /F /Y -xcopy "$(ProjectDir)..\..\src" "$(OutDir)src" /D /E /I /F /Y -xcopy "$(ProjectDir)..\..\..\..\tests\cpp-tests\Resources" "$(OutDir)res" /D /E /I /F /Y -xcopy "$(ProjectDir)..\..\..\..\cocos\scripting\lua-bindings\script" "$(OutDir)src\cocos" /D /E /I /F /Y -xcopy "$(ProjectDir)..\..\..\..\external\lua\luasocket\script" "$(OutDir)script" /D /E /I /F /Y + xcopy "$(ProjectDir)..\..\res" "$(OutDir)Resources\res\" /D /E /I /F /Y +xcopy "$(ProjectDir)..\..\src" "$(OutDir)Resources\src\" /D /E /I /F /Y +xcopy "$(ProjectDir)..\..\..\..\tests\cpp-tests\Resources" "$(OutDir)Resources\res\" /D /E /I /F /Y +xcopy "$(ProjectDir)..\..\..\..\cocos\scripting\lua-bindings\script" "$(OutDir)Resources\src\cocos\" /D /E /I /F /Y +xcopy "$(ProjectDir)..\..\..\..\external\lua\luasocket\script" "$(OutDir)Resources\script\" /D /E /I /F /Y xcopy "$(OutDir)..\*.dll" "$(OutDir)" /D /Y diff --git a/tests/lua-tests/res/cocosbuilderRes/ccb/animated-grossini.png b/tests/lua-tests/res/cocosbuilderRes/ccb/animated-grossini.png old mode 100644 new mode 100755 index 4125591abc88..89736acdaba8 Binary files a/tests/lua-tests/res/cocosbuilderRes/ccb/animated-grossini.png and b/tests/lua-tests/res/cocosbuilderRes/ccb/animated-grossini.png differ diff --git a/tests/lua-tests/res/cocosbuilderRes/ccb/btn-a-0.png b/tests/lua-tests/res/cocosbuilderRes/ccb/btn-a-0.png old mode 100644 new mode 100755 index 088abd2a8e35..66a5d3df7185 Binary files a/tests/lua-tests/res/cocosbuilderRes/ccb/btn-a-0.png and b/tests/lua-tests/res/cocosbuilderRes/ccb/btn-a-0.png differ diff --git a/tests/lua-tests/res/cocosbuilderRes/ccb/btn-a-1.png b/tests/lua-tests/res/cocosbuilderRes/ccb/btn-a-1.png old mode 100644 new mode 100755 index 8ae8c02f9a46..33f8a0c3f041 Binary files a/tests/lua-tests/res/cocosbuilderRes/ccb/btn-a-1.png and b/tests/lua-tests/res/cocosbuilderRes/ccb/btn-a-1.png differ diff --git a/tests/lua-tests/res/cocosbuilderRes/ccb/btn-a-2.png b/tests/lua-tests/res/cocosbuilderRes/ccb/btn-a-2.png old mode 100644 new mode 100755 index e38d806eaf4c..c8532b3e23ae Binary files a/tests/lua-tests/res/cocosbuilderRes/ccb/btn-a-2.png and b/tests/lua-tests/res/cocosbuilderRes/ccb/btn-a-2.png differ diff --git a/tests/lua-tests/res/cocosbuilderRes/ccb/btn-b-0.png b/tests/lua-tests/res/cocosbuilderRes/ccb/btn-b-0.png old mode 100644 new mode 100755 index 6bd4677575d1..abd7d9a00b03 Binary files a/tests/lua-tests/res/cocosbuilderRes/ccb/btn-b-0.png and b/tests/lua-tests/res/cocosbuilderRes/ccb/btn-b-0.png differ diff --git a/tests/lua-tests/res/cocosbuilderRes/ccb/btn-b-1.png b/tests/lua-tests/res/cocosbuilderRes/ccb/btn-b-1.png old mode 100644 new mode 100755 index 57f0e2a55db2..b55f91e77c04 Binary files a/tests/lua-tests/res/cocosbuilderRes/ccb/btn-b-1.png and b/tests/lua-tests/res/cocosbuilderRes/ccb/btn-b-1.png differ diff --git a/tests/lua-tests/res/cocosbuilderRes/ccb/btn-b-2.png b/tests/lua-tests/res/cocosbuilderRes/ccb/btn-b-2.png old mode 100644 new mode 100755 index b7e343084acb..d47c7b6283e6 Binary files a/tests/lua-tests/res/cocosbuilderRes/ccb/btn-b-2.png and b/tests/lua-tests/res/cocosbuilderRes/ccb/btn-b-2.png differ diff --git a/tests/lua-tests/res/cocosbuilderRes/ccb/btn-back-0.png b/tests/lua-tests/res/cocosbuilderRes/ccb/btn-back-0.png old mode 100644 new mode 100755 index 0080cee8acc6..9caae52746ff Binary files a/tests/lua-tests/res/cocosbuilderRes/ccb/btn-back-0.png and b/tests/lua-tests/res/cocosbuilderRes/ccb/btn-back-0.png differ diff --git a/tests/lua-tests/res/cocosbuilderRes/ccb/btn-back-1.png b/tests/lua-tests/res/cocosbuilderRes/ccb/btn-back-1.png old mode 100644 new mode 100755 index 5c874caea9b8..6c7cf5f97a9e Binary files a/tests/lua-tests/res/cocosbuilderRes/ccb/btn-back-1.png and b/tests/lua-tests/res/cocosbuilderRes/ccb/btn-back-1.png differ diff --git a/tests/lua-tests/res/cocosbuilderRes/ccb/btn-test-0.png b/tests/lua-tests/res/cocosbuilderRes/ccb/btn-test-0.png old mode 100644 new mode 100755 index f189b276fa10..2777fd1d5ecc Binary files a/tests/lua-tests/res/cocosbuilderRes/ccb/btn-test-0.png and b/tests/lua-tests/res/cocosbuilderRes/ccb/btn-test-0.png differ diff --git a/tests/lua-tests/res/cocosbuilderRes/ccb/btn-test-1.png b/tests/lua-tests/res/cocosbuilderRes/ccb/btn-test-1.png old mode 100644 new mode 100755 index 394b7ae4313b..b3be2a861637 Binary files a/tests/lua-tests/res/cocosbuilderRes/ccb/btn-test-1.png and b/tests/lua-tests/res/cocosbuilderRes/ccb/btn-test-1.png differ diff --git a/tests/lua-tests/res/cocosbuilderRes/ccb/btn-test-2.png b/tests/lua-tests/res/cocosbuilderRes/ccb/btn-test-2.png old mode 100644 new mode 100755 index ac7ed12942d4..eab72947de72 Binary files a/tests/lua-tests/res/cocosbuilderRes/ccb/btn-test-2.png and b/tests/lua-tests/res/cocosbuilderRes/ccb/btn-test-2.png differ diff --git a/tests/lua-tests/res/cocosbuilderRes/ccb/burst.png b/tests/lua-tests/res/cocosbuilderRes/ccb/burst.png old mode 100644 new mode 100755 index 6f4bf92f1653..8681474538f4 Binary files a/tests/lua-tests/res/cocosbuilderRes/ccb/burst.png and b/tests/lua-tests/res/cocosbuilderRes/ccb/burst.png differ diff --git a/tests/lua-tests/res/cocosbuilderRes/ccb/ccbParticleStars.png b/tests/lua-tests/res/cocosbuilderRes/ccb/ccbParticleStars.png old mode 100644 new mode 100755 index e7042b651a16..f493dcc33470 Binary files a/tests/lua-tests/res/cocosbuilderRes/ccb/ccbParticleStars.png and b/tests/lua-tests/res/cocosbuilderRes/ccb/ccbParticleStars.png differ diff --git a/tests/lua-tests/res/cocosbuilderRes/ccb/grossini-generic.png b/tests/lua-tests/res/cocosbuilderRes/ccb/grossini-generic.png old mode 100644 new mode 100755 index 55eb67b0d6d4..5c0bbc67c854 Binary files a/tests/lua-tests/res/cocosbuilderRes/ccb/grossini-generic.png and b/tests/lua-tests/res/cocosbuilderRes/ccb/grossini-generic.png differ diff --git a/tests/lua-tests/res/cocosbuilderRes/ccb/jungle-left.png b/tests/lua-tests/res/cocosbuilderRes/ccb/jungle-left.png old mode 100644 new mode 100755 index 43f389c8b585..79bbf2033432 Binary files a/tests/lua-tests/res/cocosbuilderRes/ccb/jungle-left.png and b/tests/lua-tests/res/cocosbuilderRes/ccb/jungle-left.png differ diff --git a/tests/lua-tests/res/cocosbuilderRes/ccb/jungle-right.png b/tests/lua-tests/res/cocosbuilderRes/ccb/jungle-right.png old mode 100644 new mode 100755 index b252efc5fab4..8da61b9f5861 Binary files a/tests/lua-tests/res/cocosbuilderRes/ccb/jungle-right.png and b/tests/lua-tests/res/cocosbuilderRes/ccb/jungle-right.png differ diff --git a/tests/lua-tests/res/cocosbuilderRes/ccb/jungle.png b/tests/lua-tests/res/cocosbuilderRes/ccb/jungle.png old mode 100644 new mode 100755 index 303616fee5fb..b3ddd92d2b09 Binary files a/tests/lua-tests/res/cocosbuilderRes/ccb/jungle.png and b/tests/lua-tests/res/cocosbuilderRes/ccb/jungle.png differ diff --git a/tests/lua-tests/res/cocosbuilderRes/ccb/logo-icon.png b/tests/lua-tests/res/cocosbuilderRes/ccb/logo-icon.png old mode 100644 new mode 100755 index f742d1b3b076..c668736dc74d Binary files a/tests/lua-tests/res/cocosbuilderRes/ccb/logo-icon.png and b/tests/lua-tests/res/cocosbuilderRes/ccb/logo-icon.png differ diff --git a/tests/lua-tests/res/cocosbuilderRes/ccb/logo.png b/tests/lua-tests/res/cocosbuilderRes/ccb/logo.png old mode 100644 new mode 100755 index cacbf7d749a6..a4cd20c20e8f Binary files a/tests/lua-tests/res/cocosbuilderRes/ccb/logo.png and b/tests/lua-tests/res/cocosbuilderRes/ccb/logo.png differ diff --git a/tests/lua-tests/res/cocosbuilderRes/ccb/markerfelt24shadow.png b/tests/lua-tests/res/cocosbuilderRes/ccb/markerfelt24shadow.png old mode 100644 new mode 100755 index 82b24297cbec..5bab02849644 Binary files a/tests/lua-tests/res/cocosbuilderRes/ccb/markerfelt24shadow.png and b/tests/lua-tests/res/cocosbuilderRes/ccb/markerfelt24shadow.png differ diff --git a/tests/lua-tests/res/cocosbuilderRes/ccb/particle-fire.png b/tests/lua-tests/res/cocosbuilderRes/ccb/particle-fire.png old mode 100644 new mode 100755 index 3f6c26fee711..81c6d2410bb2 Binary files a/tests/lua-tests/res/cocosbuilderRes/ccb/particle-fire.png and b/tests/lua-tests/res/cocosbuilderRes/ccb/particle-fire.png differ diff --git a/tests/lua-tests/res/cocosbuilderRes/ccb/particle-smoke.png b/tests/lua-tests/res/cocosbuilderRes/ccb/particle-smoke.png old mode 100644 new mode 100755 index 4e0cd72ec1a3..a289b1371e29 Binary files a/tests/lua-tests/res/cocosbuilderRes/ccb/particle-smoke.png and b/tests/lua-tests/res/cocosbuilderRes/ccb/particle-smoke.png differ diff --git a/tests/lua-tests/res/cocosbuilderRes/ccb/particle-snow.png b/tests/lua-tests/res/cocosbuilderRes/ccb/particle-snow.png old mode 100644 new mode 100755 index 6d6e9c7385bf..9e12963498d7 Binary files a/tests/lua-tests/res/cocosbuilderRes/ccb/particle-snow.png and b/tests/lua-tests/res/cocosbuilderRes/ccb/particle-snow.png differ diff --git a/tests/lua-tests/res/cocosbuilderRes/ccb/particle-stars.png b/tests/lua-tests/res/cocosbuilderRes/ccb/particle-stars.png old mode 100644 new mode 100755 index e7042b651a16..f493dcc33470 Binary files a/tests/lua-tests/res/cocosbuilderRes/ccb/particle-stars.png and b/tests/lua-tests/res/cocosbuilderRes/ccb/particle-stars.png differ diff --git a/tests/lua-tests/res/cocosbuilderRes/ccb/scale-9-demo.png b/tests/lua-tests/res/cocosbuilderRes/ccb/scale-9-demo.png old mode 100644 new mode 100755 index af68db072fed..ee4537207f1b Binary files a/tests/lua-tests/res/cocosbuilderRes/ccb/scale-9-demo.png and b/tests/lua-tests/res/cocosbuilderRes/ccb/scale-9-demo.png differ diff --git a/tests/lua-tests/src/BugsTest/BugsTest.lua b/tests/lua-tests/src/BugsTest/BugsTest.lua index ee3a6e44fddc..ce0549b75dc0 100644 --- a/tests/lua-tests/src/BugsTest/BugsTest.lua +++ b/tests/lua-tests/src/BugsTest/BugsTest.lua @@ -441,7 +441,7 @@ local function BugTest1174() print("Test1 - Start") local i = 0 - for i = 0, 9999 do + for i = 0, 999 do --[[ A|b ----- @@ -513,7 +513,7 @@ local function BugTest1174() ok=0 err=0 - for i = 0 , 9999 do + for i = 0 , 999 do -- A | b -- ----- -- c | d diff --git a/tests/lua-tests/src/DownloaderTest/DownloaderTest.lua b/tests/lua-tests/src/DownloaderTest/DownloaderTest.lua new file mode 100644 index 000000000000..a8bdd1722812 --- /dev/null +++ b/tests/lua-tests/src/DownloaderTest/DownloaderTest.lua @@ -0,0 +1,104 @@ +require("json") + + +local imgURI = "http://forum.cocos.com/images/logo.png" +local notExistURI = "http://www.cocos2d-x.org/attachments/1503/no_exist.txt" + +local downloader = cc.Downloader.new() +local writablePath = cc.FileUtils:getInstance():getWritablePath() +local function DownloaderLayer() + local layer = cc.Layer:create() + local winSize = cc.Director:getInstance():getWinSize() + local margin = 40 + local space = 35 + + local task1 = nil + local task2 = nil + + local function init() + + local label = cc.Label:createWithTTF("Downloader Test", s_arialPath, 28) + label:setAnchorPoint(cc.p(0.5, 0.5)) + label:setPosition(cc.p(winSize.width / 2, winSize.height - margin)) + layer:addChild(label, 0) + + --Response Code Label + local labelStatusCode = cc.Label:createWithTTF("status", s_markerFeltFontPath, 20) + labelStatusCode:setAnchorPoint(cc.p(0.5, 0.5)) + labelStatusCode:setPosition(cc.p(winSize.width / 2, winSize.height - margin - 6 * space)) + layer:addChild(labelStatusCode) + + local menuRequest = cc.Menu:create() + menuRequest:setPosition(cc.p(0,0)) + layer:addChild(menuRequest) + + --success + local function onDownloadFileClicked() + downloader:createDownloadFileTask(imgURI, writablePath .. "/2dx_icon_512_rounded.png", "task_img"); + labelStatusCode:setString("waiting...") + end + + local labelGet = cc.Label:createWithTTF("Test Download Image", s_arialPath, 22) + labelGet:setAnchorPoint(cc.p(0.5, 0.5)) + local itemGet = cc.MenuItemLabel:create(labelGet) + itemGet:registerScriptTapHandler(onDownloadFileClicked) + itemGet:setPosition(cc.p(winSize.width / 2, winSize.height - margin - space)) + menuRequest:addChild(itemGet) + + --failure + local function onDownloadTxtClicked() + downloader:createDownloadFileTask(notExistURI, writablePath .. "/no_exists.txt", "task_no_exist"); + labelStatusCode:setString("waiting...") + end + + local labelPost = cc.Label:createWithTTF("Test Download File Not Exists", s_arialPath, 22) + labelPost:setAnchorPoint(cc.p(0.5, 0.5)) + local itemPost = cc.MenuItemLabel:create(labelPost) + itemPost:registerScriptTapHandler(onDownloadTxtClicked) + itemPost:setPosition(cc.p(winSize.width / 2, winSize.height - margin - 2 * space)) + menuRequest:addChild(itemPost) + + local function onTaskSuccess(task) + if task.identifier == "task_img" then + labelStatusCode:setString("image download success") + elseif task.identifier == "task_no_exist" then + labelStatusCode:setString("txt download success") + end + end + local function onProgress(task, bytesReceived, totalBytesReceived, totalBytesExpected) + if task.identifier == "task_img" then + labelStatusCode:setString("image download progress " .. tostring(math.floor(totalBytesReceived/totalBytesExpected*100))) + elseif task.identifier == "task_no_exist" then + labelStatusCode:setString("txt download progress " .. tostring(math.floor(totalBytesReceived/totalBytesExpected*100))) + end + end + local function onTaskError(task, errorCode, errorCodeInternal, errorStr) + if task.identifier == "task_img" then + labelStatusCode:setString("image download error: "..errorStr) + elseif task.identifier == "task_no_exist" then + labelStatusCode:setString("txt download error: "..errorStr) + end + end + downloader:setOnFileTaskSuccess(onTaskSuccess) + downloader:setOnTaskProgress(onProgress) + downloader:setOnTaskError(onTaskError) + + end + + local function onNodeEvent(eventName) + if "enter" == eventName then + init() + end + end + + layer:registerScriptHandler(onNodeEvent) + + return layer +end + +function DownloaderTestMain() + local scene = cc.Scene:create() + scene:addChild(DownloaderLayer()) + scene:addChild(CreateBackMenuItem()) + return scene +end diff --git a/tests/lua-tests/src/EffectsTest/EffectsTest.lua b/tests/lua-tests/src/EffectsTest/EffectsTest.lua index 715171e926cb..0c8dca639151 100644 --- a/tests/lua-tests/src/EffectsTest/EffectsTest.lua +++ b/tests/lua-tests/src/EffectsTest/EffectsTest.lua @@ -48,7 +48,7 @@ end local function nextAction() ActionIdx = ActionIdx + 1 - ActionIdx = math.mod(ActionIdx, MAX_LAYER) + ActionIdx = math.fmod(ActionIdx, MAX_LAYER) return CreateEffectsTestLayer() end diff --git a/tests/lua-tests/src/ExtensionTest/ExtensionTest.lua b/tests/lua-tests/src/ExtensionTest/ExtensionTest.lua index a7ea9477d225..2231ff51d04c 100644 --- a/tests/lua-tests/src/ExtensionTest/ExtensionTest.lua +++ b/tests/lua-tests/src/ExtensionTest/ExtensionTest.lua @@ -226,7 +226,7 @@ local function ExtensionsMainLayer() listener:registerScriptHandler(onTouchesMoved,cc.Handler.EVENT_TOUCHES_MOVED ) local eventDispatcher = layer:getEventDispatcher() - eventDispatcher:addEventListenerWithSceneGraphPriority(listener, layer) + --eventDispatcher:addEventListenerWithSceneGraphPriority(listener, layer) return layer end diff --git a/tests/lua-tests/src/FontTest/FontTest.lua b/tests/lua-tests/src/FontTest/FontTest.lua index 6ac2566635cd..41903b68f888 100644 --- a/tests/lua-tests/src/FontTest/FontTest.lua +++ b/tests/lua-tests/src/FontTest/FontTest.lua @@ -24,15 +24,15 @@ local verticalAlignment = { local vAlignCount = table.getn(verticalAlignment) -local function showFont(ret, pFont) +local function showFont(ret, pFont, index) cclog("vAlignIdx="..vAlignIdx) local s = cc.Director:getInstance():getWinSize() - local blockSize = cc.size(s.width/3, 200) + local blockSize = cc.size(s.width/3, 100) local fontSize = 26 - local top = cc.Label:createWithTTF(pFont, pFont, 24) + local top = cc.Label:createWithTTF(tostring(index) .. ". " ..pFont, pFont, 24) local left = cc.Label:createWithTTF("alignment left", pFont, fontSize, blockSize, cc.TEXT_ALIGNMENT_LEFT, verticalAlignment[vAlignIdx]) local center = cc.Label:createWithTTF("alignment center", pFont, fontSize, @@ -85,7 +85,7 @@ local function createTestLayer() end local ret = originCreateLayer("") - showFont(ret, fontList[Helper.index]) + showFont(ret, fontList[Helper.index], Helper.index) return ret end diff --git a/tests/lua-tests/src/NewEventDispatcherTest/NewEventDispatcherTest.lua b/tests/lua-tests/src/NewEventDispatcherTest/NewEventDispatcherTest.lua index 154a7acb7cb1..4eb1b54ffb8c 100644 --- a/tests/lua-tests/src/NewEventDispatcherTest/NewEventDispatcherTest.lua +++ b/tests/lua-tests/src/NewEventDispatcherTest/NewEventDispatcherTest.lua @@ -212,11 +212,11 @@ function TouchableSpriteTest:onEnter() local function onTouchBegan(touch, event) local target = event:getCurrentTarget() - + local locationInNode = target:convertToNodeSpace(touch:getLocation()) local s = target:getContentSize() local rect = cc.rect(0, 0, s.width, s.height) - + if cc.rectContainsPoint(rect, locationInNode) then print(string.format("sprite began... x = %f, y = %f", locationInNode.x, locationInNode.y)) target:setOpacity(180) @@ -265,7 +265,7 @@ function TouchableSpriteTest:onEnter() nextMenuItem:setFontSizeObj(16) nextMenuItem:setPosition(cc.p(VisibleRect:right().x - 100, VisibleRect:right().y - 30)) nextMenuItem:registerScriptTapHandler(self.nextCallback) - + local menu2 = cc.Menu:create(nextMenuItem) menu2:setPosition(cc.p(0, 0)) menu2:setAnchorPoint(cc.p(0, 0)) @@ -292,7 +292,7 @@ function TouchableSpriteTest.create() elseif event == "exit" then end end - + layer:createMenu() layer:creatTitleAndSubTitle(curLayerIdx) layer:registerScriptHandler(onNodeEvent) @@ -323,17 +323,17 @@ function TouchableSpriteWithFixedPriority:onEnter() local locationInNode = self:convertToNodeSpace(touch:getLocation()) local s = self:getContentSize() local rect = cc.rect(0, 0, s.width, s.height) - + if cc.rectContainsPoint(rect, locationInNode) then self:setColor(cc.c3b(255, 0, 0)) return true end - return false + return false end local function onTouchMoved(touch, event) - + end local function onTouchEnded(touch, event) @@ -348,7 +348,7 @@ function TouchableSpriteWithFixedPriority:onEnter() local listener = cc.EventListenerTouchOneByOne:create() self._listener = listener listener:setSwallowTouches(true) - + listener:registerScriptHandler(onTouchBegan,cc.Handler.EVENT_TOUCH_BEGAN ) listener:registerScriptHandler(onTouchMoved,cc.Handler.EVENT_TOUCH_MOVED ) listener:registerScriptHandler(onTouchEnded,cc.Handler.EVENT_TOUCH_ENDED ) @@ -391,7 +391,7 @@ function TouchableSpriteWithFixedPriority.create() touchableSprite:onExit() end end - + touchableSprite:registerScriptHandler(onNodeEvent) return touchableSprite end @@ -441,7 +441,7 @@ function FixedPriorityTest.create() elseif event == "exit" then end end - + layer:createMenu() layer:creatTitleAndSubTitle(curLayerIdx) layer:registerScriptHandler(onNodeEvent) @@ -478,7 +478,7 @@ function RemoveListenerWhenDispatchingTest:onEnter() sprite1:setColor(cc.c3b(255, 0, 0)) return true end - + return false end @@ -533,7 +533,7 @@ function RemoveListenerWhenDispatchingTest.create() elseif event == "exit" then end end - + layer:createMenu() layer:creatTitleAndSubTitle(curLayerIdx) layer:registerScriptHandler(onNodeEvent) @@ -560,7 +560,7 @@ function CustomEventTest:onEnter() local size = cc.Director:getInstance():getVisibleSize() local count1 = 0 local count2 = 0 - + cc.MenuItemFont:setFontSize(20) local statusLabel1 = cc.Label:createWithSystemFont("No custom event 1 received!", "", 20) @@ -580,7 +580,7 @@ function CustomEventTest:onEnter() local function sendCallback1(tag, sender) count1 = count1 + 1 - + local event = cc.EventCustom:new("game_custom_event1") event._usedata = string.format("%d",count1) eventDispatcher:dispatchEvent(event) @@ -605,7 +605,7 @@ function CustomEventTest:onEnter() local function sendCallback2(tag, sender) count2 = count2 + 1 - + local event = cc.EventCustom:new("game_custom_event2") event._usedata = string.format("%d",count2) eventDispatcher:dispatchEvent(event) @@ -614,7 +614,26 @@ function CustomEventTest:onEnter() sendItem2:registerScriptTapHandler(sendCallback2) sendItem2:setPosition(cc.p(origin.x + size.width/2, origin.y + size.height/2 - 40)) - local menu = cc.Menu:create(sendItem1, sendItem2) + -- addCustomEventListener test begin + local count3 = 0 + local statusLabel3 = cc.Label:createWithSystemFont('addCustomEventListener: Received "event_custom" 0 times', "", 14) + statusLabel3:setAnchorPoint(cc.p(0.5, 0.5)) + statusLabel3:setPosition(cc.p(origin.x + size.width/2, origin.y + size.height-140 )) + self:addChild(statusLabel3) + + eventDispatcher:addCustomEventListener('event_custom' ,function(...) + count3 = count3 + 1 + statusLabel3:setString('addCustomEventListener: Received "event_custom" ' .. count3 .. ' times') + end) + + local sendItem3 = cc.MenuItemFont:create('dispatchCustomEvent("event_custom")') + sendItem3:registerScriptTapHandler(function ( ) + eventDispatcher:dispatchCustomEvent("event_custom") + end) + sendItem3:setPosition(cc.p(origin.x + size.width/2, origin.y + size.height/2 - 80)) + -- addCustomEventListener test end + + local menu = cc.Menu:create(sendItem1, sendItem2, sendItem3) menu:setPosition(cc.p(0, 0)) menu:setAnchorPoint(cc.p(0, 0)) self:addChild(menu, -1) @@ -624,6 +643,7 @@ function CustomEventTest:onExit() local eventDispatcher = self:getEventDispatcher() eventDispatcher:removeEventListener(self._listener1) eventDispatcher:removeEventListener(self._listener2) + eventDispatcher:removeCustomEventListeners('event_custom') end function CustomEventTest.create() @@ -636,7 +656,7 @@ function CustomEventTest.create() layer:onExit() end end - + layer:createMenu() layer:creatTitleAndSubTitle(curLayerIdx) layer:registerScriptHandler(onNodeEvent) @@ -661,7 +681,7 @@ end function LabelKeyboardEventTest:onEnter() local origin = cc.Director:getInstance():getVisibleOrigin() local size = cc.Director:getInstance():getVisibleSize() - + local statusLabel = cc.Label:createWithSystemFont("No keyboard event received!", "", 20) statusLabel:setAnchorPoint(cc.p(0.5, 0.5)) statusLabel:setPosition(cc.p(origin.x + size.width/2,origin.y + size.height/2)) @@ -697,7 +717,7 @@ function LabelKeyboardEventTest.create() elseif event == "exit" then end end - + layer:createMenu() layer:creatTitleAndSubTitle(curLayerIdx) layer:registerScriptHandler(onNodeEvent) @@ -739,7 +759,7 @@ function SpriteAccelerationEventTest:onEnter() elseif ptNowX > maxX then ptNowX = maxX end - + local minY = math.floor(VisibleRect:bottom().y + ballSize.height / 2.0) local maxY = math.floor(VisibleRect:top().y - ballSize.height / 2.0) if ptNowY < minY then @@ -770,7 +790,7 @@ function SpriteAccelerationEventTest.create() layer:onExit() end end - + layer:createMenu() layer:creatTitleAndSubTitle(curLayerIdx) layer:registerScriptHandler(onNodeEvent) @@ -808,13 +828,13 @@ function RemoveAndRetainNodeTest:onEnter() local locationInNode = target:convertToNodeSpace(touch:getLocation()) local s = target:getContentSize() local rect = cc.rect(0, 0, s.width, s.height) - + if cc.rectContainsPoint(rect, locationInNode) then print(string.format("sprite began... x = %f, y = %f", locationInNode.x, locationInNode.y)) target:setOpacity(180) return true end - return false + return false end local function onTouchMoved(touch,event) @@ -882,7 +902,7 @@ function RemoveAndRetainNodeTest.create() layer:onExit() end end - + layer:createMenu() layer:creatTitleAndSubTitle(curLayerIdx) layer:registerScriptHandler(onNodeEvent) @@ -933,7 +953,7 @@ function RemoveListenerAfterAddingTest:onEnter() local nextButton = cc.MenuItemFont:create("Please Click Me To Reset!") nextButton:registerScriptTapHandler(nextButtonCallback) nextButton:setPosition(cc.p(VisibleRect:center().x, VisibleRect:center().y - 40)) - + local menu = cc.Menu:create(nextButton) menu:setPosition(VisibleRect:leftBottom()) menu:setAnchorPoint(cc.p(0,0)) @@ -949,10 +969,10 @@ function RemoveListenerAfterAddingTest:onEnter() local listener = cc.EventListenerTouchOneByOne:create() listener:registerScriptHandler(onTouchBegan,cc.Handler.EVENT_TOUCH_BEGAN) - + eventDispatcher:addEventListenerWithFixedPriority(listener, -1) eventDispatcher:removeEventListenersForType(cc.EVENT_TOUCH_ONE_BY_ONE) - + addNextButton() end @@ -970,10 +990,10 @@ function RemoveListenerAfterAddingTest:onEnter() local listener = cc.EventListenerTouchOneByOne:create() listener:registerScriptHandler(onTouchBegan,cc.Handler.EVENT_TOUCH_BEGAN) - + eventDispatcher:addEventListenerWithFixedPriority(listener, -1) eventDispatcher:removeAllEventListeners() - + addNextButton() end @@ -1003,7 +1023,7 @@ function RemoveListenerAfterAddingTest.create() layer:onExit() end end - + layer:createMenu() layer:creatTitleAndSubTitle(curLayerIdx) layer:registerScriptHandler(onNodeEvent) @@ -1029,11 +1049,11 @@ end function GlobalZTouchTest:onEnter() local function onTouchBegan(touch, event) local target = event:getCurrentTarget() - + local locationInNode = target:convertToNodeSpace(touch:getLocation()) local s = target:getContentSize() local rect = cc.rect(0, 0, s.width, s.height) - + if cc.rectContainsPoint(rect, locationInNode) then print(string.format("sprite began... x = %f, y = %f", locationInNode.x, locationInNode.y)) target:setOpacity(180) @@ -1104,7 +1124,7 @@ function GlobalZTouchTest.create() layer:onExit() end end - + layer:createMenu() layer:creatTitleAndSubTitle(curLayerIdx) layer:registerScriptHandler(onNodeEvent) @@ -1203,14 +1223,14 @@ function StopPropagationTest:onEnter() sprite = cc.Sprite:create("Images/CyanSquare.png") sprite:setTag(TAG_BLUE_SPRITE) self:addChild(sprite, 100) - + sprite2 = cc.Sprite:create("Images/CyanSquare.png") sprite2:setTag(TAG_BLUE_SPRITE2) self:addChild(sprite2, 100) else sprite = cc.Sprite:create("Images/YellowSquare.png") self:addChild(sprite, 0) - + sprite2 = cc.Sprite:create("Images/YellowSquare.png") self:addChild(sprite2, 0) end @@ -1231,7 +1251,7 @@ function StopPropagationTest:onEnter() end function StopPropagationTest:onExit() - + end function StopPropagationTest:isPointInNode(pt, node) @@ -1249,7 +1269,7 @@ function StopPropagationTest:isPointInTopHalfAreaOfScreen(pt) if pt.y >= winSize.height / 2 then return true end - + return false end @@ -1267,7 +1287,7 @@ function StopPropagationTest.create() layer:createMenu() layer:creatTitleAndSubTitle(curLayerIdx) layer:registerScriptHandler(onNodeEvent) - + return layer end @@ -1286,17 +1306,17 @@ end function PauseResumeTargetTest:onEnter() local origin = cc.Director:getInstance():getVisibleOrigin() local size = cc.Director:getInstance():getVisibleSize() - + local sprite1 = TouchableSpriteWithFixedPriority.create() sprite1:setTexture("Images/CyanSquare.png") sprite1:setPosition(cc.p(origin.x + size.width/2 - 80, origin.y + size.height/2 + 40)) self:addChild(sprite1, -10) - + local sprite2 = TouchableSpriteWithFixedPriority.create() sprite2:setTexture("Images/MagentaSquare.png") sprite2:setPosition(cc.p(origin.x + size.width/2, origin.y + size.height/2)) self:addChild(sprite2, -20) - + local sprite3 = TouchableSpriteWithFixedPriority.create() sprite3:setTexture("Images/YellowSquare.png") sprite3:setPosition(cc.p(0, 0)) @@ -1317,28 +1337,28 @@ function PauseResumeTargetTest:onEnter() local closeItem = cc.MenuItemFont:create("close") closeItem:registerScriptTapHandler(closePopUp) closeItem:setPosition(VisibleRect:center()) - + local closeMenu = cc.Menu:create(closeItem) closeMenu:setAnchorPoint(cc.p(0.0, 0.0)) closeMenu:setPosition(cc.p(0.0, 0.0)) - + colorLayer:addChild(closeMenu) end local popUpItem = cc.MenuItemFont:create("Popup") - popUpItem:registerScriptTapHandler(popUp) + popUpItem:registerScriptTapHandler(popUp) popUpItem:setAnchorPoint(cc.p(1.0, 0.5)) popUpItem:setPosition(VisibleRect:right()) - + local menu = cc.Menu:create(popUpItem) menu:setAnchorPoint(cc.p(0.0, 0.0)) menu:setPosition(cc.p(0.0, 0.0)) - + self:addChild(menu) end function PauseResumeTargetTest:onExit() - + end function PauseResumeTargetTest.create() @@ -1355,7 +1375,7 @@ function PauseResumeTargetTest.create() layer:createMenu() layer:creatTitleAndSubTitle(curLayerIdx) layer:registerScriptHandler(onNodeEvent) - + return layer end @@ -1381,7 +1401,7 @@ function Issue4129Test:onEnter() label:setAnchorPoint(cc.p(0, 0.5)) label:setPosition(VisibleRect:left()) self:addChild(label) - + eventDispatcher:removeEventListener(self._customListener) self._customListener = nil @@ -1394,9 +1414,9 @@ function Issue4129Test:onEnter() local function removeAllTouch(tag, sender) local senderItem = sender senderItem:setString("Only 'Reset' item could be clicked") - + eventDispatcher:removeAllEventListeners() - + local function next(tag, sender) assert(bugFixed, "This issue was not fixed!") self.restartCallback() @@ -1405,12 +1425,12 @@ function Issue4129Test:onEnter() nextItem:registerScriptTapHandler(next) nextItem:setFontSizeObj(16) nextItem:setPosition(cc.p(VisibleRect:right().x - 100 , VisibleRect:right().y - 30)) - + local menu2 = cc.Menu:create(nextItem) menu2:setPosition(cc.p(0, 0)) menu2:setAnchorPoint(cc.p(0, 0)) self:addChild(menu2) - + --Simulate to dispatch 'come to background' event local event = cc.EventCustom:new("event_come_to_background") eventDispatcher:dispatchEvent(event) @@ -1420,7 +1440,7 @@ function Issue4129Test:onEnter() removeAllTouchItem:registerScriptTapHandler(removeAllTouch) removeAllTouchItem:setFontSizeObj(16) removeAllTouchItem:setPosition(cc.p(VisibleRect:right().x - 100, VisibleRect:right().y)) - + local menu = cc.Menu:create(removeAllTouchItem) menu:setPosition(cc.p(0, 0)) menu:setAnchorPoint(cc.p(0, 0)) @@ -1448,7 +1468,7 @@ function Issue4129Test.create() layer:createMenu() layer:creatTitleAndSubTitle(curLayerIdx) layer:registerScriptHandler(onNodeEvent) - + return layer end @@ -1468,20 +1488,20 @@ end function Issue4160Test:onEnter() local origin = cc.Director:getInstance():getVisibleOrigin() local size = cc.Director:getInstance():getVisibleSize() - + local sprite1 = TouchableSpriteWithFixedPriority.create() sprite1:setPriority(-30) sprite1:setTexture("Images/CyanSquare.png") sprite1:setPosition(cc.p(origin.x + size.width/2 - 80, origin.y + size.height/2 + 40)) self:addChild(sprite1, -10) - + local sprite2 = TouchableSpriteWithFixedPriority.create() sprite2:setPriority(-20) sprite2:setTexture("Images/MagentaSquare.png") sprite2:removeListenerOnTouchEnded(true) sprite2:setPosition(cc.p(origin.x + size.width/2, origin.y + size.height/2)) self:addChild(sprite2, -20) - + local sprite3 = TouchableSpriteWithFixedPriority.create() sprite3:setPriority(-10) sprite3:setTexture("Images/YellowSquare.png") @@ -1507,7 +1527,7 @@ function Issue4160Test.create() layer:createMenu() layer:creatTitleAndSubTitle(curLayerIdx) layer:registerScriptHandler(onNodeEvent) - + return layer end diff --git a/tests/lua-tests/src/ParticleTest/ParticleTest.lua b/tests/lua-tests/src/ParticleTest/ParticleTest.lua index 7257eb95fd83..869de767ced4 100644 --- a/tests/lua-tests/src/ParticleTest/ParticleTest.lua +++ b/tests/lua-tests/src/ParticleTest/ParticleTest.lua @@ -29,7 +29,7 @@ end local function nextAction() SceneIdx = SceneIdx + 1 - SceneIdx = math.mod(SceneIdx, MAX_LAYER) + SceneIdx = math.fmod(SceneIdx, MAX_LAYER) return CreateParticleLayer() end @@ -208,17 +208,17 @@ local function reorderParticles(dt) local child2 = parent:getChildByTag(2) local child3 = parent:getChildByTag(3) - if math.mod(ParticleReorder_Order, 3) == 0 then + if math.fmod(ParticleReorder_Order, 3) == 0 then parent:reorderChild(child1, 1) parent:reorderChild(child2, 2) parent:reorderChild(child3, 3) - elseif math.mod(ParticleReorder_Order, 3) == 1 then + elseif math.fmod(ParticleReorder_Order, 3) == 1 then parent:reorderChild(child1, 3) parent:reorderChild(child2, 1) parent:reorderChild(child3, 2) - elseif math.mod(ParticleReorder_Order, 3) == 2 then + elseif math.fmod(ParticleReorder_Order, 3) == 2 then parent:reorderChild(child1, 2) parent:reorderChild(child2, 3) parent:reorderChild(child3, 1) @@ -1233,7 +1233,7 @@ local Issue870_entry = nil local function updateQuads(dt) update(dt) - Issue870_index = math.mod(Issue870_index + 1, 4) + Issue870_index = math.fmod(Issue870_index + 1, 4) local rect = cc.rect(Issue870_index * 32, 0, 32, 32) emitter:setTextureWithRect(emitter:getTexture(), rect) end @@ -1344,7 +1344,7 @@ local function removeSystem(dt) local ChildrenCount = table.getn(AddAndDeleteParticleSystems_batchNode:getChildren()) if ChildrenCount > 0 then cclog("remove random system") - local rand = math.mod(math.random(1, 999999), ChildrenCount - 1) + local rand = math.fmod(math.random(1, 999999), ChildrenCount - 1) AddAndDeleteParticleSystems_batchNode:removeChild(AddAndDeleteParticleSystems_batchNode:getChildren()[(rand)], true) --add new @@ -1352,7 +1352,7 @@ local function removeSystem(dt) particleSystem:setPositionType(cc.POSITION_TYPE_GROUPED ) particleSystem:setTotalParticles(200) - particleSystem:setPosition(math.mod(math.random(1, 999999), 300) ,math.mod(math.random(1, 999999), 400)) + particleSystem:setPosition(math.fmod(math.random(1, 999999), 300) ,math.fmod(math.random(1, 999999), 400)) cclog("add a new system") local randZ = math.floor(math.random() * 100) diff --git a/tests/lua-tests/src/SpriteTest/SpriteTest.lua b/tests/lua-tests/src/SpriteTest/SpriteTest.lua index 01e8affbd34f..1556621b440c 100644 --- a/tests/lua-tests/src/SpriteTest/SpriteTest.lua +++ b/tests/lua-tests/src/SpriteTest/SpriteTest.lua @@ -26,7 +26,7 @@ Sprite1.__index = Sprite1 function Sprite1.addNewSpriteWithCoords(layer, point) local idx = math.floor(math.random() * 1400 / 100) - local x = math.floor(math.mod(idx,5) * 85) + local x = math.floor(math.fmod(idx,5) * 85) local y = math.floor(idx / 5) * 121 local sprite = cc.Sprite:create("Images/grossini_dance_atlas.png", cc.rect(x,y,85,121) ) @@ -87,7 +87,7 @@ SpriteBatchNode1.__index = SpriteBatchNode1 function SpriteBatchNode1.addNewSpriteWithCoords(layer, point) local BatchNode = layer:getChildByTag( kTagSpriteBatchNode ) local idx = math.floor(math.random() * 1400 / 100) - local x = math.floor(math.mod(idx,5) * 85) + local x = math.floor(math.fmod(idx,5) * 85) local y = math.floor(idx / 5) * 121 local sprite = cc.Sprite:createWithTexture(BatchNode:getTexture(), cc.rect(x,y,85,121) ) @@ -316,7 +316,7 @@ function SpriteFrameTest.flipSprites(dt) local fx = false local fy = false - local i = math.mod(SpriteFrameTest.m_nCounter, 4) + local i = math.fmod(SpriteFrameTest.m_nCounter, 4) if(i == 0) then fx = false diff --git a/tests/lua-tests/src/TransitionsTest/TransitionsTest.lua b/tests/lua-tests/src/TransitionsTest/TransitionsTest.lua index 79b6eeb09efc..fcefde3395ff 100644 --- a/tests/lua-tests/src/TransitionsTest/TransitionsTest.lua +++ b/tests/lua-tests/src/TransitionsTest/TransitionsTest.lua @@ -30,7 +30,7 @@ end local function nextAction() SceneIdx = SceneIdx + 1 - SceneIdx = math.mod(SceneIdx, Transition_Table.MAX_LAYER) + SceneIdx = math.fmod(SceneIdx, Transition_Table.MAX_LAYER) switchSceneTypeNo() return generateTranScene() diff --git a/tests/lua-tests/src/WebViewTest/WebViewTest.lua b/tests/lua-tests/src/WebViewTest/WebViewTest.lua index a33ca192590b..29dad3ab1b0c 100644 --- a/tests/lua-tests/src/WebViewTest/WebViewTest.lua +++ b/tests/lua-tests/src/WebViewTest/WebViewTest.lua @@ -77,7 +77,7 @@ function WebViewTest:init() local backBtn = ccui.Button:create("cocosui/animationbuttonnormal.png", "cocosui/animationbuttonpressed.png") backBtn:setTitleText("Back") - backBtn:setPosition(winSize.width / 2 + self._webView:getContentSize().width/2 + backBtn:getContentSize().width/2 + 10, winSize.height - 50) + backBtn:setPosition(winSize.width / 2 + self._webView:getContentSize().width/2 + backBtn:getContentSize().width/2 + 10, winSize.height - 10) backBtn:addClickEventListener(function(sender) self._webView:goBack() end) @@ -103,7 +103,7 @@ function WebViewTest:init() evalJsBtn:setTitleText("Evaluate JS") evalJsBtn:setPosition(winSize.width / 2 - self._webView:getContentSize().width/2 - evalJsBtn:getContentSize().width/2 - 30, winSize.height / 2 - 50) evalJsBtn:addClickEventListener(function(sender) - self._webView:evaluateJS("alert(\"hello\")") + self._webView:evaluateJS("setTimeout(function(){alert(\"hello\");}, 0);") end) self:addChild(evalJsBtn) end @@ -127,4 +127,4 @@ function WebViewTestMain() scene:addChild(WebViewTest.create()) scene:addChild(CreateBackMenuItem()) return scene -end \ No newline at end of file +end diff --git a/tests/lua-tests/src/mainMenu.lua b/tests/lua-tests/src/mainMenu.lua index c47123b8fb8c..b0b01e2b29fe 100644 --- a/tests/lua-tests/src/mainMenu.lua +++ b/tests/lua-tests/src/mainMenu.lua @@ -16,6 +16,7 @@ require "ClickAndMoveTest/ClickAndMoveTest" require "CocosDenshionTest/CocosDenshionTest" require "ComponentTest/main" require "CurrentLanguageTest/CurrentLanguageTest" +require "DownloaderTest/DownloaderTest" require "DrawPrimitivesTest/DrawPrimitivesTest" require "EffectsTest/EffectsTest" require "EffectsAdvancedTest/EffectsAdvancedTest" @@ -107,6 +108,7 @@ local _allTests = { { isSupported = true, name = "CocosDenshionTest" , create_func = CocosDenshionTestMain }, { isSupported = true, name = "ComponentTest" , create_func = ComponentTestMain }, { isSupported = false, name = "CurlTest" , create_func= CurlTestMain }, + { isSupported = true, name = "DownloaderTest" , create_func= DownloaderTestMain }, { isSupported = true, name = "CurrentLanguageTest" , create_func= CurrentLanguageTestMain }, { isSupported = true, name = "DrawPrimitivesTest" , create_func= DrawPrimitivesTest }, { isSupported = true, name = "EffectsTest" , create_func = EffectsTest }, @@ -197,17 +199,15 @@ function CreateTestMenu() CloseMenu:setPosition(0, 0) CloseMenu:addChild(CloseItem) menuLayer:addChild(CloseMenu) + local targetPlatform = cc.Application:getInstance():getTargetPlatform() - if (cc.PLATFORM_OS_IPHONE == targetPlatform) or (cc.PLATFORM_OS_IPAD == targetPlatform) then - CloseMenu:setVisible(false) - end -- add menu items for tests local MainMenu = cc.Menu:create() local index = 0 local obj = nil - for index, obj in pairs(_allTests) do - local testLabel = cc.Label:createWithTTF(obj.name, s_arialPath, 24) + for index, obj in pairs(_allTests) do + local testLabel = cc.Label:createWithTTF(index .. ". " .. obj.name, s_arialPath, 24) testLabel:setAnchorPoint(cc.p(0.5, 0.5)) local testMenuItem = cc.MenuItemLabel:create(testLabel) if not obj.isSupported then diff --git a/tests/performance-tests/Classes/tests/BaseTest.cpp b/tests/performance-tests/Classes/tests/BaseTest.cpp index 306cf96be6ee..d028fdb43412 100644 --- a/tests/performance-tests/Classes/tests/BaseTest.cpp +++ b/tests/performance-tests/Classes/tests/BaseTest.cpp @@ -184,9 +184,6 @@ void TestList::runThisTest() TestController::getInstance()->stopAutoTest(); TestController::destroyInstance(); Director::getInstance()->end(); -#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) - exit(0); -#endif }); closeItem->setPosition(VisibleRect::right().x - 30, VisibleRect::top().y - 30); diff --git a/tests/performance-tests/Classes/tests/PerformanceAllocTest.cpp b/tests/performance-tests/Classes/tests/PerformanceAllocTest.cpp index 0218cc5153ea..ac755aadf70d 100644 --- a/tests/performance-tests/Classes/tests/PerformanceAllocTest.cpp +++ b/tests/performance-tests/Classes/tests/PerformanceAllocTest.cpp @@ -403,7 +403,7 @@ std::string SpriteCreateEmptyTest::subtitle() const const char* SpriteCreateEmptyTest::testName() { - return "Sprite::create(void)"; + return "Sprite::create()"; } //////////////////////////////////////////////////////// diff --git a/tests/performance-tests/Resources/CloseNormal.png b/tests/performance-tests/Resources/CloseNormal.png index 4a4bcc91868c..b65498c94159 100644 Binary files a/tests/performance-tests/Resources/CloseNormal.png and b/tests/performance-tests/Resources/CloseNormal.png differ diff --git a/tests/performance-tests/Resources/CloseSelected.png b/tests/performance-tests/Resources/CloseSelected.png index d923b6cf8435..306749ecd20d 100644 Binary files a/tests/performance-tests/Resources/CloseSelected.png and b/tests/performance-tests/Resources/CloseSelected.png differ diff --git a/tests/performance-tests/Resources/Images/PlanetCute-1024x1024.png b/tests/performance-tests/Resources/Images/PlanetCute-1024x1024.png index 59634fef260a..7b047c6f1b8f 100644 Binary files a/tests/performance-tests/Resources/Images/PlanetCute-1024x1024.png and b/tests/performance-tests/Resources/Images/PlanetCute-1024x1024.png differ diff --git a/tests/performance-tests/Resources/Images/b1.png b/tests/performance-tests/Resources/Images/b1.png old mode 100644 new mode 100755 index 67708eaedd2f..93ee8252f088 Binary files a/tests/performance-tests/Resources/Images/b1.png and b/tests/performance-tests/Resources/Images/b1.png differ diff --git a/tests/performance-tests/Resources/Images/b2.png b/tests/performance-tests/Resources/Images/b2.png old mode 100644 new mode 100755 index 5ccecdb6e2e1..8cc30415fbd8 Binary files a/tests/performance-tests/Resources/Images/b2.png and b/tests/performance-tests/Resources/Images/b2.png differ diff --git a/tests/performance-tests/Resources/Images/close.png b/tests/performance-tests/Resources/Images/close.png old mode 100644 new mode 100755 index f04be4fc0100..ef3b1d12ae6b Binary files a/tests/performance-tests/Resources/Images/close.png and b/tests/performance-tests/Resources/Images/close.png differ diff --git a/tests/performance-tests/Resources/Images/f1.png b/tests/performance-tests/Resources/Images/f1.png old mode 100644 new mode 100755 index 561001528faf..385e22707b61 Binary files a/tests/performance-tests/Resources/Images/f1.png and b/tests/performance-tests/Resources/Images/f1.png differ diff --git a/tests/performance-tests/Resources/Images/f2.png b/tests/performance-tests/Resources/Images/f2.png old mode 100644 new mode 100755 index e249137eb252..388a7399c5a3 Binary files a/tests/performance-tests/Resources/Images/f2.png and b/tests/performance-tests/Resources/Images/f2.png differ diff --git a/tests/performance-tests/Resources/Images/fire.png b/tests/performance-tests/Resources/Images/fire.png old mode 100644 new mode 100755 index 5edf1ba6f85f..dd2be34cff9a Binary files a/tests/performance-tests/Resources/Images/fire.png and b/tests/performance-tests/Resources/Images/fire.png differ diff --git a/tests/performance-tests/Resources/Images/grossini.png b/tests/performance-tests/Resources/Images/grossini.png old mode 100644 new mode 100755 index 1fab40708373..fad80b8e9af8 Binary files a/tests/performance-tests/Resources/Images/grossini.png and b/tests/performance-tests/Resources/Images/grossini.png differ diff --git a/tests/performance-tests/Resources/Images/grossini_dance_01.png b/tests/performance-tests/Resources/Images/grossini_dance_01.png old mode 100644 new mode 100755 index 368da44b5f5d..93aa6e983ac3 Binary files a/tests/performance-tests/Resources/Images/grossini_dance_01.png and b/tests/performance-tests/Resources/Images/grossini_dance_01.png differ diff --git a/tests/performance-tests/Resources/Images/grossini_dance_02.png b/tests/performance-tests/Resources/Images/grossini_dance_02.png old mode 100644 new mode 100755 index 21a4d58abdf3..bf03d3312c36 Binary files a/tests/performance-tests/Resources/Images/grossini_dance_02.png and b/tests/performance-tests/Resources/Images/grossini_dance_02.png differ diff --git a/tests/performance-tests/Resources/Images/grossini_dance_03.png b/tests/performance-tests/Resources/Images/grossini_dance_03.png old mode 100644 new mode 100755 index 63a57ca5f845..e01c593b40e5 Binary files a/tests/performance-tests/Resources/Images/grossini_dance_03.png and b/tests/performance-tests/Resources/Images/grossini_dance_03.png differ diff --git a/tests/performance-tests/Resources/Images/grossini_dance_04.png b/tests/performance-tests/Resources/Images/grossini_dance_04.png old mode 100644 new mode 100755 index a12fdb5e492d..c9b0ae252940 Binary files a/tests/performance-tests/Resources/Images/grossini_dance_04.png and b/tests/performance-tests/Resources/Images/grossini_dance_04.png differ diff --git a/tests/performance-tests/Resources/Images/grossini_dance_05.png b/tests/performance-tests/Resources/Images/grossini_dance_05.png old mode 100644 new mode 100755 index 109cd343266f..e65e6b2febb3 Binary files a/tests/performance-tests/Resources/Images/grossini_dance_05.png and b/tests/performance-tests/Resources/Images/grossini_dance_05.png differ diff --git a/tests/performance-tests/Resources/Images/grossini_dance_06.png b/tests/performance-tests/Resources/Images/grossini_dance_06.png old mode 100644 new mode 100755 index 94f4de504749..4c3be2334f25 Binary files a/tests/performance-tests/Resources/Images/grossini_dance_06.png and b/tests/performance-tests/Resources/Images/grossini_dance_06.png differ diff --git a/tests/performance-tests/Resources/Images/grossini_dance_07.png b/tests/performance-tests/Resources/Images/grossini_dance_07.png old mode 100644 new mode 100755 index 7e6cba555802..4c38de3a789d Binary files a/tests/performance-tests/Resources/Images/grossini_dance_07.png and b/tests/performance-tests/Resources/Images/grossini_dance_07.png differ diff --git a/tests/performance-tests/Resources/Images/grossini_dance_08.png b/tests/performance-tests/Resources/Images/grossini_dance_08.png old mode 100644 new mode 100755 index 1fab40708373..fad80b8e9af8 Binary files a/tests/performance-tests/Resources/Images/grossini_dance_08.png and b/tests/performance-tests/Resources/Images/grossini_dance_08.png differ diff --git a/tests/performance-tests/Resources/Images/grossini_dance_09.png b/tests/performance-tests/Resources/Images/grossini_dance_09.png old mode 100644 new mode 100755 index b7ac1b7c1c69..b0fa9aded3a3 Binary files a/tests/performance-tests/Resources/Images/grossini_dance_09.png and b/tests/performance-tests/Resources/Images/grossini_dance_09.png differ diff --git a/tests/performance-tests/Resources/Images/grossini_dance_10.png b/tests/performance-tests/Resources/Images/grossini_dance_10.png old mode 100644 new mode 100755 index 580d1aff223a..0abb6eab9397 Binary files a/tests/performance-tests/Resources/Images/grossini_dance_10.png and b/tests/performance-tests/Resources/Images/grossini_dance_10.png differ diff --git a/tests/performance-tests/Resources/Images/grossini_dance_11.png b/tests/performance-tests/Resources/Images/grossini_dance_11.png old mode 100644 new mode 100755 index 27e9ffb91d27..7285fd6c76de Binary files a/tests/performance-tests/Resources/Images/grossini_dance_11.png and b/tests/performance-tests/Resources/Images/grossini_dance_11.png differ diff --git a/tests/performance-tests/Resources/Images/grossini_dance_12.png b/tests/performance-tests/Resources/Images/grossini_dance_12.png old mode 100644 new mode 100755 index 3d66efff8557..ce7d672004da Binary files a/tests/performance-tests/Resources/Images/grossini_dance_12.png and b/tests/performance-tests/Resources/Images/grossini_dance_12.png differ diff --git a/tests/performance-tests/Resources/Images/grossini_dance_13.png b/tests/performance-tests/Resources/Images/grossini_dance_13.png old mode 100644 new mode 100755 index 74757723ff7b..92cbbd4da184 Binary files a/tests/performance-tests/Resources/Images/grossini_dance_13.png and b/tests/performance-tests/Resources/Images/grossini_dance_13.png differ diff --git a/tests/performance-tests/Resources/Images/grossini_dance_14.png b/tests/performance-tests/Resources/Images/grossini_dance_14.png old mode 100644 new mode 100755 index 021bf4fc1f71..ee7d1bba0aea Binary files a/tests/performance-tests/Resources/Images/grossini_dance_14.png and b/tests/performance-tests/Resources/Images/grossini_dance_14.png differ diff --git a/tests/performance-tests/Resources/Images/grossini_dance_atlas.png b/tests/performance-tests/Resources/Images/grossini_dance_atlas.png old mode 100644 new mode 100755 index 7566b3628469..12bca1310fd7 Binary files a/tests/performance-tests/Resources/Images/grossini_dance_atlas.png and b/tests/performance-tests/Resources/Images/grossini_dance_atlas.png differ diff --git a/tests/performance-tests/Resources/Images/grossini_polygon.png b/tests/performance-tests/Resources/Images/grossini_polygon.png index 012846098cf4..b8a9d7fc8a4d 100644 Binary files a/tests/performance-tests/Resources/Images/grossini_polygon.png and b/tests/performance-tests/Resources/Images/grossini_polygon.png differ diff --git a/tests/performance-tests/Resources/Images/grossini_quad.png b/tests/performance-tests/Resources/Images/grossini_quad.png index 2686cfad9be0..7daa0177d93c 100644 Binary files a/tests/performance-tests/Resources/Images/grossini_quad.png and b/tests/performance-tests/Resources/Images/grossini_quad.png differ diff --git a/tests/performance-tests/Resources/Images/grossinis_sister1.png b/tests/performance-tests/Resources/Images/grossinis_sister1.png old mode 100644 new mode 100755 index cb0185cbafac..5be7918a604c Binary files a/tests/performance-tests/Resources/Images/grossinis_sister1.png and b/tests/performance-tests/Resources/Images/grossinis_sister1.png differ diff --git a/tests/performance-tests/Resources/Images/grossinis_sister1_sp.png b/tests/performance-tests/Resources/Images/grossinis_sister1_sp.png index cd2a69282276..62a42c9a9a93 100644 Binary files a/tests/performance-tests/Resources/Images/grossinis_sister1_sp.png and b/tests/performance-tests/Resources/Images/grossinis_sister1_sp.png differ diff --git a/tests/performance-tests/Resources/Images/grossinis_sister2.png b/tests/performance-tests/Resources/Images/grossinis_sister2.png old mode 100644 new mode 100755 index 51d2a5d95212..b25d759a8fbe Binary files a/tests/performance-tests/Resources/Images/grossinis_sister2.png and b/tests/performance-tests/Resources/Images/grossinis_sister2.png differ diff --git a/tests/performance-tests/Resources/Images/grossinis_sister2_sp.png b/tests/performance-tests/Resources/Images/grossinis_sister2_sp.png index e9446d4795dc..30e7f3c02f8d 100644 Binary files a/tests/performance-tests/Resources/Images/grossinis_sister2_sp.png and b/tests/performance-tests/Resources/Images/grossinis_sister2_sp.png differ diff --git a/tests/performance-tests/Resources/Images/landscape-1024x1024.png b/tests/performance-tests/Resources/Images/landscape-1024x1024.png index 25e9ba2d861e..b592a8ba208c 100644 Binary files a/tests/performance-tests/Resources/Images/landscape-1024x1024.png and b/tests/performance-tests/Resources/Images/landscape-1024x1024.png differ diff --git a/tests/performance-tests/Resources/Images/r1.png b/tests/performance-tests/Resources/Images/r1.png old mode 100644 new mode 100755 index ea985ecd5897..96c070883199 Binary files a/tests/performance-tests/Resources/Images/r1.png and b/tests/performance-tests/Resources/Images/r1.png differ diff --git a/tests/performance-tests/Resources/Images/r2.png b/tests/performance-tests/Resources/Images/r2.png old mode 100644 new mode 100755 index 8fcf6fcdfcd0..1caf31f4bd82 Binary files a/tests/performance-tests/Resources/Images/r2.png and b/tests/performance-tests/Resources/Images/r2.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-0-0.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-0-0.png old mode 100644 new mode 100755 index a118259965bf..8256a5299290 Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-0-0.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-0-0.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-0-1.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-0-1.png old mode 100644 new mode 100755 index 4560f08ce271..ea7d815696ba Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-0-1.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-0-1.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-0-2.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-0-2.png old mode 100644 new mode 100755 index 10e926d6a188..fb444b334845 Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-0-2.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-0-2.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-0-3.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-0-3.png old mode 100644 new mode 100755 index aeedc99268cf..81f6c287b9ff Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-0-3.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-0-3.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-0-4.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-0-4.png old mode 100644 new mode 100755 index eaf7b8d03858..a0d5ba8621f1 Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-0-4.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-0-4.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-0-5.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-0-5.png old mode 100644 new mode 100755 index 183ecb307371..307968b441f8 Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-0-5.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-0-5.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-0-6.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-0-6.png old mode 100644 new mode 100755 index 1fb3808d56ad..e98bbcd94e25 Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-0-6.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-0-6.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-0-7.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-0-7.png old mode 100644 new mode 100755 index 76c66bc696d6..5c13bee7b5fe Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-0-7.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-0-7.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-1-0.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-1-0.png old mode 100644 new mode 100755 index 11681a558252..55836459810f Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-1-0.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-1-0.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-1-1.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-1-1.png old mode 100644 new mode 100755 index b46c5177cfbd..665bb8b606fc Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-1-1.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-1-1.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-1-2.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-1-2.png old mode 100644 new mode 100755 index 3b532bf5c2ae..f73989bc7170 Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-1-2.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-1-2.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-1-3.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-1-3.png old mode 100644 new mode 100755 index ca039392ffa0..92cdc270d936 Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-1-3.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-1-3.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-1-4.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-1-4.png old mode 100644 new mode 100755 index 7f037eb24539..d4c4ff36b10b Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-1-4.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-1-4.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-1-5.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-1-5.png old mode 100644 new mode 100755 index 097433a80466..95fb8ba7e958 Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-1-5.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-1-5.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-1-6.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-1-6.png old mode 100644 new mode 100755 index 7d04557e6610..b576d2e3e65d Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-1-6.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-1-6.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-1-7.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-1-7.png old mode 100644 new mode 100755 index f4f751428e85..f0367c971d56 Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-1-7.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-1-7.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-2-0.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-2-0.png old mode 100644 new mode 100755 index cb69326b5c7d..71044a10b13a Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-2-0.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-2-0.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-2-1.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-2-1.png old mode 100644 new mode 100755 index 4b2d616a7b7c..3feb9e940f3c Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-2-1.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-2-1.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-2-2.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-2-2.png old mode 100644 new mode 100755 index a68a28f9f1f9..e7e874043938 Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-2-2.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-2-2.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-2-3.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-2-3.png old mode 100644 new mode 100755 index 652d45549688..6ef5cc5e788b Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-2-3.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-2-3.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-2-4.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-2-4.png old mode 100644 new mode 100755 index 1f5d4055337e..c6ac17cac89e Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-2-4.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-2-4.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-2-5.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-2-5.png old mode 100644 new mode 100755 index 5bb402c6675d..d496e3d02795 Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-2-5.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-2-5.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-2-6.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-2-6.png old mode 100644 new mode 100755 index 6bf0002c46c1..066b38a5cf68 Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-2-6.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-2-6.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-2-7.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-2-7.png old mode 100644 new mode 100755 index 9281b02fd650..78c89fc74848 Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-2-7.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-2-7.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-3-0.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-3-0.png old mode 100644 new mode 100755 index b013f8d2c08f..230107e65be5 Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-3-0.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-3-0.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-3-1.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-3-1.png old mode 100644 new mode 100755 index 5edf4c6e66a0..ec5990d45159 Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-3-1.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-3-1.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-3-2.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-3-2.png old mode 100644 new mode 100755 index 74d3d08ca349..70b510b38c45 Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-3-2.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-3-2.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-3-3.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-3-3.png old mode 100644 new mode 100755 index 207ab47c05d7..3b7d911e222f Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-3-3.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-3-3.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-3-4.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-3-4.png old mode 100644 new mode 100755 index 83b1a6802118..8455784e3afe Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-3-4.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-3-4.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-3-5.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-3-5.png old mode 100644 new mode 100755 index 78ac3f7c7811..2d28698df5e9 Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-3-5.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-3-5.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-3-6.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-3-6.png old mode 100644 new mode 100755 index 9d86d66a51fb..fdc30ee923ff Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-3-6.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-3-6.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-3-7.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-3-7.png old mode 100644 new mode 100755 index 26f090978952..7dfd55fda38b Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-3-7.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-3-7.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-4-0.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-4-0.png old mode 100644 new mode 100755 index ad514ffddf0b..6bfc144c7e51 Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-4-0.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-4-0.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-4-1.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-4-1.png old mode 100644 new mode 100755 index 8736be3d058c..15d6eb1543d4 Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-4-1.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-4-1.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-4-2.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-4-2.png old mode 100644 new mode 100755 index e306cb367980..32190cb70dca Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-4-2.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-4-2.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-4-3.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-4-3.png old mode 100644 new mode 100755 index 0d0499f85a16..2e0320578ad3 Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-4-3.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-4-3.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-4-4.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-4-4.png old mode 100644 new mode 100755 index 79524d71a7f7..f0708bb42127 Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-4-4.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-4-4.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-4-5.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-4-5.png old mode 100644 new mode 100755 index fed64254f27d..6c9ec9f39f0c Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-4-5.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-4-5.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-4-6.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-4-6.png old mode 100644 new mode 100755 index 78206badc390..d93f278fd71e Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-4-6.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-4-6.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-4-7.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-4-7.png old mode 100644 new mode 100755 index 09a5cd518a29..5dce60c7119f Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-4-7.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-4-7.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-5-0.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-5-0.png old mode 100644 new mode 100755 index a14b948929ae..1adff7adeed4 Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-5-0.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-5-0.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-5-1.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-5-1.png old mode 100644 new mode 100755 index e49a31c2034f..c3e56fe1662c Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-5-1.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-5-1.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-5-2.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-5-2.png old mode 100644 new mode 100755 index caf438864fe1..3659a67fe5a8 Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-5-2.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-5-2.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-5-3.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-5-3.png old mode 100644 new mode 100755 index 384419f3d61b..5e771251db39 Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-5-3.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-5-3.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-5-4.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-5-4.png old mode 100644 new mode 100755 index 436eda4a9b48..907c3696c280 Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-5-4.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-5-4.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-5-5.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-5-5.png old mode 100644 new mode 100755 index 03e2d6c640da..a9175a5d0bf8 Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-5-5.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-5-5.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-5-6.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-5-6.png old mode 100644 new mode 100755 index 9d85a52f164d..14bf384a9c1f Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-5-6.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-5-6.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-5-7.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-5-7.png old mode 100644 new mode 100755 index acf2fb835397..6d3017014732 Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-5-7.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-5-7.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-6-0.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-6-0.png old mode 100644 new mode 100755 index 872c43cb7848..11be173003cc Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-6-0.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-6-0.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-6-1.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-6-1.png old mode 100644 new mode 100755 index 51236b80b782..259b7aed5330 Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-6-1.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-6-1.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-6-2.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-6-2.png old mode 100644 new mode 100755 index 282ea3ac54e4..b9bae9d70331 Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-6-2.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-6-2.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-6-3.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-6-3.png old mode 100644 new mode 100755 index 8724b39e1be3..a84b7b5d0961 Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-6-3.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-6-3.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-6-4.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-6-4.png old mode 100644 new mode 100755 index ccb396293795..5ec22013c41c Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-6-4.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-6-4.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-6-5.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-6-5.png old mode 100644 new mode 100755 index 2cec9196222c..3c07dc5190bc Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-6-5.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-6-5.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-6-6.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-6-6.png old mode 100644 new mode 100755 index fdb542d78319..de9e1e6b4aad Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-6-6.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-6-6.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-6-7.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-6-7.png old mode 100644 new mode 100755 index e04b541ab658..0cf0e8fc17bc Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-6-7.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-6-7.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-7-0.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-7-0.png old mode 100644 new mode 100755 index 9b1bd293b1e3..58964c3fd83b Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-7-0.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-7-0.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-7-1.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-7-1.png old mode 100644 new mode 100755 index 5e73cceb0136..b733b95b4f94 Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-7-1.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-7-1.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-7-2.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-7-2.png old mode 100644 new mode 100755 index 22c2076a2a04..14404fa36b6c Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-7-2.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-7-2.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-7-3.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-7-3.png old mode 100644 new mode 100755 index ff118f4cfba2..1770b6982fb4 Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-7-3.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-7-3.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-7-4.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-7-4.png old mode 100644 new mode 100755 index 219b4b83ec7c..3be136596ed4 Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-7-4.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-7-4.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-7-5.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-7-5.png old mode 100644 new mode 100755 index 2f0b2f435406..594a7a8a732a Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-7-5.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-7-5.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-7-6.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-7-6.png old mode 100644 new mode 100755 index 86f934b51324..72a7ff18705a Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-7-6.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-7-6.png differ diff --git a/tests/performance-tests/Resources/Images/sprites_test/sprite-7-7.png b/tests/performance-tests/Resources/Images/sprites_test/sprite-7-7.png old mode 100644 new mode 100755 index 732d76602e3f..0287bd77116c Binary files a/tests/performance-tests/Resources/Images/sprites_test/sprite-7-7.png and b/tests/performance-tests/Resources/Images/sprites_test/sprite-7-7.png differ diff --git a/tests/performance-tests/Resources/Images/spritesheet1.png b/tests/performance-tests/Resources/Images/spritesheet1.png old mode 100644 new mode 100755 index 817280bb670b..7ab88aaa4e3b Binary files a/tests/performance-tests/Resources/Images/spritesheet1.png and b/tests/performance-tests/Resources/Images/spritesheet1.png differ diff --git a/tests/performance-tests/Resources/Images/test_image.png b/tests/performance-tests/Resources/Images/test_image.png old mode 100644 new mode 100755 index 53090c7f3ac8..eaf947476415 Binary files a/tests/performance-tests/Resources/Images/test_image.png and b/tests/performance-tests/Resources/Images/test_image.png differ diff --git a/tests/performance-tests/Resources/Images/texture1024x1024.png b/tests/performance-tests/Resources/Images/texture1024x1024.png old mode 100644 new mode 100755 index d7d3a7a4836e..12a15fae99ec Binary files a/tests/performance-tests/Resources/Images/texture1024x1024.png and b/tests/performance-tests/Resources/Images/texture1024x1024.png differ diff --git a/tests/performance-tests/Resources/Images/texture512x512.png b/tests/performance-tests/Resources/Images/texture512x512.png old mode 100644 new mode 100755 index ab5a61f0190a..170c02fd828c Binary files a/tests/performance-tests/Resources/Images/texture512x512.png and b/tests/performance-tests/Resources/Images/texture512x512.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/crate6.png b/tests/performance-tests/Resources/Particle3D/textures/crate6.png index ffdc131dd913..a7b0b0ecb3fe 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/crate6.png and b/tests/performance-tests/Resources/Particle3D/textures/crate6.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/interpolate.png b/tests/performance-tests/Resources/Particle3D/textures/interpolate.png index 367bbe50c15d..29620cdca515 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/interpolate.png and b/tests/performance-tests/Resources/Particle3D/textures/interpolate.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/mp_fire_02_2x2.png b/tests/performance-tests/Resources/Particle3D/textures/mp_fire_02_2x2.png index 56d8c9be51be..18d6946ca4a3 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/mp_fire_02_2x2.png and b/tests/performance-tests/Resources/Particle3D/textures/mp_fire_02_2x2.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_barrel_01.png b/tests/performance-tests/Resources/Particle3D/textures/pu_barrel_01.png index edd21fa5d196..402d821b1404 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pu_barrel_01.png and b/tests/performance-tests/Resources/Particle3D/textures/pu_barrel_01.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_barrel_02.png b/tests/performance-tests/Resources/Particle3D/textures/pu_barrel_02.png index 9773c6325757..b5ee14b6cd6e 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pu_barrel_02.png and b/tests/performance-tests/Resources/Particle3D/textures/pu_barrel_02.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_bbal.png b/tests/performance-tests/Resources/Particle3D/textures/pu_bbal.png index 3a64d0a48a4a..7b76a89eb2f4 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pu_bbal.png and b/tests/performance-tests/Resources/Particle3D/textures/pu_bbal.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_beam_01.png b/tests/performance-tests/Resources/Particle3D/textures/pu_beam_01.png index 9da260f56869..b11f8435def4 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pu_beam_01.png and b/tests/performance-tests/Resources/Particle3D/textures/pu_beam_01.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_beam_02.png b/tests/performance-tests/Resources/Particle3D/textures/pu_beam_02.png index 5563796cb8b8..144fb2b9b28e 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pu_beam_02.png and b/tests/performance-tests/Resources/Particle3D/textures/pu_beam_02.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_circle.png b/tests/performance-tests/Resources/Particle3D/textures/pu_circle.png index 54a35d7dd13d..250f42b99cdc 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pu_circle.png and b/tests/performance-tests/Resources/Particle3D/textures/pu_circle.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_dirt_256x512.png b/tests/performance-tests/Resources/Particle3D/textures/pu_dirt_256x512.png index 43bfd5189028..7e95b872cb92 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pu_dirt_256x512.png and b/tests/performance-tests/Resources/Particle3D/textures/pu_dirt_256x512.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_dot_03_64x64.png b/tests/performance-tests/Resources/Particle3D/textures/pu_dot_03_64x64.png index 14151b4b8417..0d85ab4e2c53 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pu_dot_03_64x64.png and b/tests/performance-tests/Resources/Particle3D/textures/pu_dot_03_64x64.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_fire_01_64x64.png b/tests/performance-tests/Resources/Particle3D/textures/pu_fire_01_64x64.png index bbf2486cfbef..f54578862def 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pu_fire_01_64x64.png and b/tests/performance-tests/Resources/Particle3D/textures/pu_fire_01_64x64.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_flame.png b/tests/performance-tests/Resources/Particle3D/textures/pu_flame.png index 3f7c1d0e419c..5b92b5e66f33 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pu_flame.png and b/tests/performance-tests/Resources/Particle3D/textures/pu_flame.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_flare.png b/tests/performance-tests/Resources/Particle3D/textures/pu_flare.png index c146e540e080..4909d7fbf13b 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pu_flare.png and b/tests/performance-tests/Resources/Particle3D/textures/pu_flare.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_flare_12_256x256.png b/tests/performance-tests/Resources/Particle3D/textures/pu_flare_12_256x256.png index 7f7ecaf92519..f2c40269cef9 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pu_flare_12_256x256.png and b/tests/performance-tests/Resources/Particle3D/textures/pu_flare_12_256x256.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_green_ball.png b/tests/performance-tests/Resources/Particle3D/textures/pu_green_ball.png index 9b47d090fdc8..bbb484f3f561 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pu_green_ball.png and b/tests/performance-tests/Resources/Particle3D/textures/pu_green_ball.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_hart.png b/tests/performance-tests/Resources/Particle3D/textures/pu_hart.png index bce6265a3d2a..54a02515dcf9 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pu_hart.png and b/tests/performance-tests/Resources/Particle3D/textures/pu_hart.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_lightning_20x64.png b/tests/performance-tests/Resources/Particle3D/textures/pu_lightning_20x64.png index d5238f452749..a55a98c146d5 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pu_lightning_20x64.png and b/tests/performance-tests/Resources/Particle3D/textures/pu_lightning_20x64.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_nucleus.png b/tests/performance-tests/Resources/Particle3D/textures/pu_nucleus.png index aede95e22e3f..0c7bf955e454 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pu_nucleus.png and b/tests/performance-tests/Resources/Particle3D/textures/pu_nucleus.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_rain.png b/tests/performance-tests/Resources/Particle3D/textures/pu_rain.png index 632735bb6c73..92d77d2bebba 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pu_rain.png and b/tests/performance-tests/Resources/Particle3D/textures/pu_rain.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_rain_01.png b/tests/performance-tests/Resources/Particle3D/textures/pu_rain_01.png index dcd0aed6de40..fc316b7df4ad 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pu_rain_01.png and b/tests/performance-tests/Resources/Particle3D/textures/pu_rain_01.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_ribbontrail.png b/tests/performance-tests/Resources/Particle3D/textures/pu_ribbontrail.png index e0d45f3ebab0..e6966640c0b6 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pu_ribbontrail.png and b/tests/performance-tests/Resources/Particle3D/textures/pu_ribbontrail.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_sand_336x330.png b/tests/performance-tests/Resources/Particle3D/textures/pu_sand_336x330.png index 392263824349..ae895594aeb1 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pu_sand_336x330.png and b/tests/performance-tests/Resources/Particle3D/textures/pu_sand_336x330.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_smoke_02_128x128.png b/tests/performance-tests/Resources/Particle3D/textures/pu_smoke_02_128x128.png index a12d5a51cbdb..d33371658655 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pu_smoke_02_128x128.png and b/tests/performance-tests/Resources/Particle3D/textures/pu_smoke_02_128x128.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pu_smoke_brown_336x330.png b/tests/performance-tests/Resources/Particle3D/textures/pu_smoke_brown_336x330.png index 6a1253c8d3b8..9d13cb3c9abe 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pu_smoke_brown_336x330.png and b/tests/performance-tests/Resources/Particle3D/textures/pu_smoke_brown_336x330.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_atlas_smoke.png b/tests/performance-tests/Resources/Particle3D/textures/pump_atlas_smoke.png index 8bcef1457b28..f946f98f9bdd 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_atlas_smoke.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_atlas_smoke.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_biohazzard.png b/tests/performance-tests/Resources/Particle3D/textures/pump_biohazzard.png index 8b87fb15ecec..091be2f87a79 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_biohazzard.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_biohazzard.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_bubble.png b/tests/performance-tests/Resources/Particle3D/textures/pump_bubble.png index b74c8e39f394..1eec4a3c0667 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_bubble.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_bubble.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_bubble_blurred.png b/tests/performance-tests/Resources/Particle3D/textures/pump_bubble_blurred.png index 20e15e8971b9..a8411139e2ea 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_bubble_blurred.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_bubble_blurred.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_celticknot.png b/tests/performance-tests/Resources/Particle3D/textures/pump_celticknot.png index 4f4bc20e72f3..22c9cd8bbbab 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_celticknot.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_celticknot.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_dirt_01.png b/tests/performance-tests/Resources/Particle3D/textures/pump_dirt_01.png index 9c6c3678e989..c259757bb071 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_dirt_01.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_dirt_01.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_dirt_02.png b/tests/performance-tests/Resources/Particle3D/textures/pump_dirt_02.png index 354593c07470..9a026c93c108 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_dirt_02.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_dirt_02.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_flame_01.png b/tests/performance-tests/Resources/Particle3D/textures/pump_flame_01.png index 2d75c733251a..ed9dc42e1e90 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_flame_01.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_flame_01.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_flame_02.png b/tests/performance-tests/Resources/Particle3D/textures/pump_flame_02.png index 2e3bacb9bf02..c407c30cbc46 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_flame_02.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_flame_02.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_flame_03.png b/tests/performance-tests/Resources/Particle3D/textures/pump_flame_03.png index a36aab49f02e..e77d9983d323 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_flame_03.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_flame_03.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_flame_04.png b/tests/performance-tests/Resources/Particle3D/textures/pump_flame_04.png index f4019eaae99e..592946aa63ea 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_flame_04.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_flame_04.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_flare_01.png b/tests/performance-tests/Resources/Particle3D/textures/pump_flare_01.png index 423731e99e01..a90214bbda43 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_flare_01.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_flare_01.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_flare_02.png b/tests/performance-tests/Resources/Particle3D/textures/pump_flare_02.png index 69ab2447c83d..8ead0155b234 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_flare_02.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_flare_02.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_flare_03.png b/tests/performance-tests/Resources/Particle3D/textures/pump_flare_03.png index e082b2a7b43d..1dc469c8e7f3 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_flare_03.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_flare_03.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_flare_04.png b/tests/performance-tests/Resources/Particle3D/textures/pump_flare_04.png index ccf3d85c9320..868431ec1c77 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_flare_04.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_flare_04.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_flare_05.png b/tests/performance-tests/Resources/Particle3D/textures/pump_flare_05.png index 43a74c10fc39..469acc2de7a1 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_flare_05.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_flare_05.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_flare_06.png b/tests/performance-tests/Resources/Particle3D/textures/pump_flare_06.png index 4fdd093f721e..60dadf22be82 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_flare_06.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_flare_06.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_genesis_01.png b/tests/performance-tests/Resources/Particle3D/textures/pump_genesis_01.png index 06c49a0826e6..5edcb8eebffc 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_genesis_01.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_genesis_01.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_genesis_02.png b/tests/performance-tests/Resources/Particle3D/textures/pump_genesis_02.png index c13bf1f111ee..5473d523a5ef 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_genesis_02.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_genesis_02.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_hourglass.png b/tests/performance-tests/Resources/Particle3D/textures/pump_hourglass.png index 332088adff4e..b322dc56cdca 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_hourglass.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_hourglass.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_leave.png b/tests/performance-tests/Resources/Particle3D/textures/pump_leave.png index 50bf6b59b645..1cda97a7dba4 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_leave.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_leave.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_lightning_01.png b/tests/performance-tests/Resources/Particle3D/textures/pump_lightning_01.png index 4d71749a056b..a48297ddae0d 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_lightning_01.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_lightning_01.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_lightning_02.png b/tests/performance-tests/Resources/Particle3D/textures/pump_lightning_02.png index 54771348fd29..a9dd25c2f77a 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_lightning_02.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_lightning_02.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_lightning_03.png b/tests/performance-tests/Resources/Particle3D/textures/pump_lightning_03.png index cc9598d78f7f..095c1194a589 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_lightning_03.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_lightning_03.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_lightning_04.png b/tests/performance-tests/Resources/Particle3D/textures/pump_lightning_04.png index 28af9efbe793..01f9f07bbbd0 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_lightning_04.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_lightning_04.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_mcdxiiiv.png b/tests/performance-tests/Resources/Particle3D/textures/pump_mcdxiiiv.png index e30005a7d690..81010780e47c 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_mcdxiiiv.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_mcdxiiiv.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_metal_01.png b/tests/performance-tests/Resources/Particle3D/textures/pump_metal_01.png index 9b004bf4d3c7..d77658644435 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_metal_01.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_metal_01.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_metal_02.png b/tests/performance-tests/Resources/Particle3D/textures/pump_metal_02.png index 037a66129f10..e98fcad67394 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_metal_02.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_metal_02.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_mmviii.png b/tests/performance-tests/Resources/Particle3D/textures/pump_mmviii.png index a093b1dc3a79..5cf2fa9153cc 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_mmviii.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_mmviii.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_pentagram_01.png b/tests/performance-tests/Resources/Particle3D/textures/pump_pentagram_01.png index df55ce3254e0..836830d7c75c 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_pentagram_01.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_pentagram_01.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_pentagram_02.png b/tests/performance-tests/Resources/Particle3D/textures/pump_pentagram_02.png index 0723eaec7234..49ddcbc954d3 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_pentagram_02.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_pentagram_02.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_ring_01.png b/tests/performance-tests/Resources/Particle3D/textures/pump_ring_01.png index 24fe5e9386a6..e52ae2032c41 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_ring_01.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_ring_01.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_ring_02.png b/tests/performance-tests/Resources/Particle3D/textures/pump_ring_02.png index 8e11e1f06b46..c3c54817eb9c 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_ring_02.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_ring_02.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_ring_03.png b/tests/performance-tests/Resources/Particle3D/textures/pump_ring_03.png index 1d8da62ba896..812453c62519 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_ring_03.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_ring_03.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_ring_04.png b/tests/performance-tests/Resources/Particle3D/textures/pump_ring_04.png index 9a6d54ed2718..871a3191ff1a 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_ring_04.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_ring_04.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_ring_05.png b/tests/performance-tests/Resources/Particle3D/textures/pump_ring_05.png index b94d220e1d37..f0deb8434e76 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_ring_05.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_ring_05.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_01.png b/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_01.png index 2bbc43e07903..3e2735a056a3 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_01.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_01.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_02.png b/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_02.png index fc8970c31919..0313fadf602e 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_02.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_02.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_03.png b/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_03.png index 167f71da5fab..cd0d92f68b5f 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_03.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_03.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_04.png b/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_04.png index 996b23101cdb..41bc91bf0888 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_04.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_04.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_05.png b/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_05.png index da88a4214098..b70942aebb6f 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_05.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_05.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_06.png b/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_06.png index c3a1bad370d4..6a23466c31c8 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_06.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_06.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_07.png b/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_07.png index 437b9837e766..6a05665f746e 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_07.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_smoke_07.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_snow_01.png b/tests/performance-tests/Resources/Particle3D/textures/pump_snow_01.png index a40b775fe29e..95c414e01820 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_snow_01.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_snow_01.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_spark_01.png b/tests/performance-tests/Resources/Particle3D/textures/pump_spark_01.png index 725b27018790..2e826d60f43a 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_spark_01.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_spark_01.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_star_01.png b/tests/performance-tests/Resources/Particle3D/textures/pump_star_01.png index 21accd59c687..20b4a915f537 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_star_01.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_star_01.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_star_02.png b/tests/performance-tests/Resources/Particle3D/textures/pump_star_02.png index d71f015cf345..2ab43259b700 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_star_02.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_star_02.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_star_03.png b/tests/performance-tests/Resources/Particle3D/textures/pump_star_03.png index d3625f3799a8..21a5d4eb6918 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_star_03.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_star_03.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_star_04.png b/tests/performance-tests/Resources/Particle3D/textures/pump_star_04.png index f55ed4065698..8864c5b5e173 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_star_04.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_star_04.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_star_05.png b/tests/performance-tests/Resources/Particle3D/textures/pump_star_05.png index 8d12369a29bb..34dbd49c40b0 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_star_05.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_star_05.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_streak_01.png b/tests/performance-tests/Resources/Particle3D/textures/pump_streak_01.png index 24c41f881e52..5b2ce2ef20eb 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_streak_01.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_streak_01.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_streak_02.png b/tests/performance-tests/Resources/Particle3D/textures/pump_streak_02.png index 1c1b0f71a41e..893c42189015 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_streak_02.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_streak_02.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_streak_03.png b/tests/performance-tests/Resources/Particle3D/textures/pump_streak_03.png index 510f95e694bc..a9cd103b402e 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_streak_03.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_streak_03.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_streak_04.png b/tests/performance-tests/Resources/Particle3D/textures/pump_streak_04.png index a266795fe863..cf0d7c79fedb 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_streak_04.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_streak_04.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_swirl_01.png b/tests/performance-tests/Resources/Particle3D/textures/pump_swirl_01.png index 9608c01a7e91..418137432e43 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_swirl_01.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_swirl_01.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_swirl_02.png b/tests/performance-tests/Resources/Particle3D/textures/pump_swirl_02.png index ddef5d5cb43b..1825ba5dcc41 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_swirl_02.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_swirl_02.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_swirl_03.png b/tests/performance-tests/Resources/Particle3D/textures/pump_swirl_03.png index 8d88a9a9a851..35b8463fcf43 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_swirl_03.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_swirl_03.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/pump_watch.png b/tests/performance-tests/Resources/Particle3D/textures/pump_watch.png index 2acac9b88644..038fc737d4f3 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/pump_watch.png and b/tests/performance-tests/Resources/Particle3D/textures/pump_watch.png differ diff --git a/tests/performance-tests/Resources/Particle3D/textures/weaponTrail.png b/tests/performance-tests/Resources/Particle3D/textures/weaponTrail.png index 2b471d3b9d19..4fadb7e89f1a 100644 Binary files a/tests/performance-tests/Resources/Particle3D/textures/weaponTrail.png and b/tests/performance-tests/Resources/Particle3D/textures/weaponTrail.png differ diff --git a/tests/performance-tests/Resources/TileMaps/iso-test.png b/tests/performance-tests/Resources/TileMaps/iso-test.png old mode 100644 new mode 100755 index 4b4b88106d7e..00e694810e99 Binary files a/tests/performance-tests/Resources/TileMaps/iso-test.png and b/tests/performance-tests/Resources/TileMaps/iso-test.png differ diff --git a/tests/performance-tests/Resources/TileMaps/iso-test2.png b/tests/performance-tests/Resources/TileMaps/iso-test2.png old mode 100644 new mode 100755 index 5ffde202cbb0..8668e0fe20c1 Binary files a/tests/performance-tests/Resources/TileMaps/iso-test2.png and b/tests/performance-tests/Resources/TileMaps/iso-test2.png differ diff --git a/tests/performance-tests/Resources/fonts/bitmapFontTest3.png b/tests/performance-tests/Resources/fonts/bitmapFontTest3.png old mode 100644 new mode 100755 index 570b8138e42e..d19379f5e776 Binary files a/tests/performance-tests/Resources/fonts/bitmapFontTest3.png and b/tests/performance-tests/Resources/fonts/bitmapFontTest3.png differ diff --git a/tests/performance-tests/Resources/fps_images.png b/tests/performance-tests/Resources/fps_images.png index 6ab40e0a64b9..c7449025bf10 100644 Binary files a/tests/performance-tests/Resources/fps_images.png and b/tests/performance-tests/Resources/fps_images.png differ diff --git a/tests/performance-tests/proj.android/app/AndroidManifest.xml b/tests/performance-tests/proj.android/app/AndroidManifest.xml index 1102ae0b3dc0..8102d060dc07 100644 --- a/tests/performance-tests/proj.android/app/AndroidManifest.xml +++ b/tests/performance-tests/proj.android/app/AndroidManifest.xml @@ -6,6 +6,7 @@ diff --git a/tests/performance-tests/proj.android/app/build.gradle b/tests/performance-tests/proj.android/app/build.gradle index 28481c7edc2c..da0ba0283016 100644 --- a/tests/performance-tests/proj.android/app/build.gradle +++ b/tests/performance-tests/proj.android/app/build.gradle @@ -26,7 +26,7 @@ android { java.srcDir "src" res.srcDir "res" manifest.srcFile "AndroidManifest.xml" - assets.srcDir "../../Resources" + assets.srcDir "assets" } externalNativeBuild { @@ -82,16 +82,18 @@ android { } android.applicationVariants.all { variant -> - // delete previous files first - delete "${buildDir}/intermediates/assets/${variant.dirName}" + delete "${projectDir}/assets" + def targetName = variant.name.capitalize() + def copyTaskName = "copy${targetName}ResourcesToAssets" - variant.mergeAssets.doLast { + tasks.register(copyTaskName) { copy { - from "${buildDir}/../../../Resources" - into "${buildDir}/intermediates/assets/${variant.dirName}" + from "${projectDir}/../../Resources" + into "${projectDir}/assets" exclude "**/*.gz" } } + tasks.getByName("pre${targetName}Build").dependsOn copyTaskName } dependencies { diff --git a/tests/performance-tests/proj.android/app/proguard-rules.pro b/tests/performance-tests/proj.android/app/proguard-rules.pro index 2c062c494602..9f6d4ff6bfb0 100644 --- a/tests/performance-tests/proj.android/app/proguard-rules.pro +++ b/tests/performance-tests/proj.android/app/proguard-rules.pro @@ -23,6 +23,8 @@ -dontwarn com.chukong.** -keep public class com.huawei.android.** { *; } -dontwarn com.huawei.android.** +-keep public class com.oppo.oiface.engine.** { *; } +-dontwarn com.oppo.oiface.engine.** # Proguard Apache HTTP for release -keep class org.apache.http.** { *; } diff --git a/tests/performance-tests/proj.android/app/res/mipmap-hdpi/ic_launcher.png b/tests/performance-tests/proj.android/app/res/mipmap-hdpi/ic_launcher.png index cd0c7c33c806..45ee51d15f96 100644 Binary files a/tests/performance-tests/proj.android/app/res/mipmap-hdpi/ic_launcher.png and b/tests/performance-tests/proj.android/app/res/mipmap-hdpi/ic_launcher.png differ diff --git a/tests/performance-tests/proj.android/app/res/mipmap-mdpi/ic_launcher.png b/tests/performance-tests/proj.android/app/res/mipmap-mdpi/ic_launcher.png index 465779ca4d10..0dd2a608998e 100644 Binary files a/tests/performance-tests/proj.android/app/res/mipmap-mdpi/ic_launcher.png and b/tests/performance-tests/proj.android/app/res/mipmap-mdpi/ic_launcher.png differ diff --git a/tests/performance-tests/proj.android/app/res/mipmap-xhdpi/ic_launcher.png b/tests/performance-tests/proj.android/app/res/mipmap-xhdpi/ic_launcher.png index 292c6c4ae4c9..a32f16f930b3 100644 Binary files a/tests/performance-tests/proj.android/app/res/mipmap-xhdpi/ic_launcher.png and b/tests/performance-tests/proj.android/app/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/tests/performance-tests/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png b/tests/performance-tests/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png index 081feababd55..332f268edc46 100644 Binary files a/tests/performance-tests/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png and b/tests/performance-tests/proj.android/app/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/tests/performance-tests/proj.android/build.gradle b/tests/performance-tests/proj.android/build.gradle index 5dff94de2a97..63697d83ac6c 100644 --- a/tests/performance-tests/proj.android/build.gradle +++ b/tests/performance-tests/proj.android/build.gradle @@ -7,7 +7,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.1.0' + classpath 'com.android.tools.build:gradle:3.4.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/tests/performance-tests/proj.android/gradle/wrapper/gradle-wrapper.properties b/tests/performance-tests/proj.android/gradle/wrapper/gradle-wrapper.properties index 0a6df8a2ce2e..4983492eeae0 100644 --- a/tests/performance-tests/proj.android/gradle/wrapper/gradle-wrapper.properties +++ b/tests/performance-tests/proj.android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip diff --git a/tests/performance-tests/proj.android/settings.gradle b/tests/performance-tests/proj.android/settings.gradle index 9261b5b19a3e..01cf7ba1af9a 100644 --- a/tests/performance-tests/proj.android/settings.gradle +++ b/tests/performance-tests/proj.android/settings.gradle @@ -2,3 +2,4 @@ include ':libcocos2dx' project(':libcocos2dx').projectDir = new File(settingsDir, '../../../cocos/platform/android/libcocos2dx') include ':performance-tests' project(':performance-tests').projectDir = new File(settingsDir, 'app') +rootProject.name = "performance-tests" diff --git a/tests/performance-tests/proj.ios/AppController.mm b/tests/performance-tests/proj.ios/AppController.mm index b1e54524e224..b8765f41fe66 100644 --- a/tests/performance-tests/proj.ios/AppController.mm +++ b/tests/performance-tests/proj.ios/AppController.mm @@ -81,6 +81,12 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( [[UIApplication sharedApplication] setStatusBarHidden:true]; + //Launching the app with the arguments -NSAllowsDefaultLineBreakStrategy NO to force back to the old behavior. + if ( [[UIDevice currentDevice].systemVersion floatValue] >= 13.0f) + { + [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"NSAllowsDefaultLineBreakStrategy"]; + } + // IMPORTANT: Setting the GLView should be done after creating the RootViewController cocos2d::GLView *glview = cocos2d::GLViewImpl::createWithEAGLView(eaglView); cocos2d::Director::getInstance()->setOpenGLView(glview); diff --git a/tests/performance-tests/proj.ios/Default-568h@2x.png b/tests/performance-tests/proj.ios/Default-568h@2x.png index 53e7f7a60f5f..66c6d1cead37 100644 Binary files a/tests/performance-tests/proj.ios/Default-568h@2x.png and b/tests/performance-tests/proj.ios/Default-568h@2x.png differ diff --git a/tests/performance-tests/proj.ios/Default-667h@2x.png b/tests/performance-tests/proj.ios/Default-667h@2x.png index 39a55be13068..a0f61ec8e639 100644 Binary files a/tests/performance-tests/proj.ios/Default-667h@2x.png and b/tests/performance-tests/proj.ios/Default-667h@2x.png differ diff --git a/tests/performance-tests/proj.ios/Default-736h@3x.png b/tests/performance-tests/proj.ios/Default-736h@3x.png index f1ee6557ce14..dadccee68624 100644 Binary files a/tests/performance-tests/proj.ios/Default-736h@3x.png and b/tests/performance-tests/proj.ios/Default-736h@3x.png differ diff --git a/tests/performance-tests/proj.ios/Default.png b/tests/performance-tests/proj.ios/Default.png index ca2c61641521..dcb80725de2a 100644 Binary files a/tests/performance-tests/proj.ios/Default.png and b/tests/performance-tests/proj.ios/Default.png differ diff --git a/tests/performance-tests/proj.ios/Default@2x.png b/tests/performance-tests/proj.ios/Default@2x.png index 4e996dab6493..84689888a14a 100644 Binary files a/tests/performance-tests/proj.ios/Default@2x.png and b/tests/performance-tests/proj.ios/Default@2x.png differ diff --git a/tests/performance-tests/proj.ios/Icon-100.png b/tests/performance-tests/proj.ios/Icon-100.png index c2f17d59cc14..ef38d4500a80 100644 Binary files a/tests/performance-tests/proj.ios/Icon-100.png and b/tests/performance-tests/proj.ios/Icon-100.png differ diff --git a/tests/performance-tests/proj.ios/Icon-114.png b/tests/performance-tests/proj.ios/Icon-114.png index b3539af0a2d3..c3807861ad29 100644 Binary files a/tests/performance-tests/proj.ios/Icon-114.png and b/tests/performance-tests/proj.ios/Icon-114.png differ diff --git a/tests/performance-tests/proj.ios/Icon-120.png b/tests/performance-tests/proj.ios/Icon-120.png index 5a359573c85b..a5b49ccbb199 100644 Binary files a/tests/performance-tests/proj.ios/Icon-120.png and b/tests/performance-tests/proj.ios/Icon-120.png differ diff --git a/tests/performance-tests/proj.ios/Icon-144.png b/tests/performance-tests/proj.ios/Icon-144.png index 8a471ffcd7a0..1526615c02d1 100644 Binary files a/tests/performance-tests/proj.ios/Icon-144.png and b/tests/performance-tests/proj.ios/Icon-144.png differ diff --git a/tests/performance-tests/proj.ios/Icon-152.png b/tests/performance-tests/proj.ios/Icon-152.png index a76648b10c98..8aa82506d0d1 100644 Binary files a/tests/performance-tests/proj.ios/Icon-152.png and b/tests/performance-tests/proj.ios/Icon-152.png differ diff --git a/tests/performance-tests/proj.ios/Icon-29.png b/tests/performance-tests/proj.ios/Icon-29.png index 0ec72eb7331b..0500184c869c 100644 Binary files a/tests/performance-tests/proj.ios/Icon-29.png and b/tests/performance-tests/proj.ios/Icon-29.png differ diff --git a/tests/performance-tests/proj.ios/Icon-40.png b/tests/performance-tests/proj.ios/Icon-40.png index 1a739c28d874..775685daca94 100644 Binary files a/tests/performance-tests/proj.ios/Icon-40.png and b/tests/performance-tests/proj.ios/Icon-40.png differ diff --git a/tests/performance-tests/proj.ios/Icon-50.png b/tests/performance-tests/proj.ios/Icon-50.png index aa19bead4e9b..ac381bc20e85 100644 Binary files a/tests/performance-tests/proj.ios/Icon-50.png and b/tests/performance-tests/proj.ios/Icon-50.png differ diff --git a/tests/performance-tests/proj.ios/Icon-57.png b/tests/performance-tests/proj.ios/Icon-57.png index efd2c898782c..4fcc6fddffe1 100644 Binary files a/tests/performance-tests/proj.ios/Icon-57.png and b/tests/performance-tests/proj.ios/Icon-57.png differ diff --git a/tests/performance-tests/proj.ios/Icon-58.png b/tests/performance-tests/proj.ios/Icon-58.png index f7be6849c135..f0f8b7fe9833 100644 Binary files a/tests/performance-tests/proj.ios/Icon-58.png and b/tests/performance-tests/proj.ios/Icon-58.png differ diff --git a/tests/performance-tests/proj.ios/Icon-72.png b/tests/performance-tests/proj.ios/Icon-72.png index 79dc8d2635ce..2c573c8df4c3 100644 Binary files a/tests/performance-tests/proj.ios/Icon-72.png and b/tests/performance-tests/proj.ios/Icon-72.png differ diff --git a/tests/performance-tests/proj.ios/Icon-76.png b/tests/performance-tests/proj.ios/Icon-76.png index d5f191fa8e53..8a1fa1850c03 100644 Binary files a/tests/performance-tests/proj.ios/Icon-76.png and b/tests/performance-tests/proj.ios/Icon-76.png differ diff --git a/tests/performance-tests/proj.ios/Icon-80.png b/tests/performance-tests/proj.ios/Icon-80.png index 0f434e31dde9..d9c7ab446bb7 100644 Binary files a/tests/performance-tests/proj.ios/Icon-80.png and b/tests/performance-tests/proj.ios/Icon-80.png differ diff --git a/tests/performance-tests/proj.ios/Info.plist b/tests/performance-tests/proj.ios/Info.plist index e28dd7c2c2a3..790b222711cf 100644 --- a/tests/performance-tests/proj.ios/Info.plist +++ b/tests/performance-tests/proj.ios/Info.plist @@ -50,7 +50,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - + 1.0 CFBundleSignature ???? CFBundleVersion diff --git a/tests/performance-tests/proj.ios/RootViewController.mm b/tests/performance-tests/proj.ios/RootViewController.mm index 98b34173d3ce..b8129a1047ba 100644 --- a/tests/performance-tests/proj.ios/RootViewController.mm +++ b/tests/performance-tests/proj.ios/RootViewController.mm @@ -27,6 +27,7 @@ of this software and associated documentation files (the "Software"), to deal #import "RootViewController.h" #import "cocos2d.h" #import "platform/ios/CCEAGLView-ios.h" +#import "platform/ios/CCDirectorCaller-ios.h" @implementation RootViewController @@ -51,8 +52,15 @@ - (void)loadView { - (void)viewDidLoad { [super viewDidLoad]; } - */ + +//In iOS 12.0+, Screen Time's bug cause UIApplicationDidBecomeActiveNotification and UIApplicationWillResignActiveNotification do not fired +//so we need to active CCDirectorCaller manually +-(void)viewDidAppear:(BOOL)animated{ + [super viewDidAppear:animated]; + [[CCDirectorCaller sharedDirectorCaller] setActive:YES]; +} + // Override to allow orientations other than the default portrait orientation. // This method is deprecated on ios6 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { diff --git a/tests/performance-tests/proj.win32/performance-tests.vcxproj b/tests/performance-tests/proj.win32/performance-tests.vcxproj index d2b36e9e9dba..913a93749ec6 100644 --- a/tests/performance-tests/proj.win32/performance-tests.vcxproj +++ b/tests/performance-tests/proj.win32/performance-tests.vcxproj @@ -14,6 +14,7 @@ {2778C02D-DDD0-4A92-A6AA-C3E2B7EDE3FF} test_win32 Win32Proj + 10.0.17134.0 @@ -107,7 +108,7 @@ if not exist "$(OutDir)" mkdir "$(OutDir)" -xcopy "$(ProjectDir)..\Resources" "$(OutDir)" /D /E /I /F /Y +xcopy "$(ProjectDir)..\Resources" "$(OutDir)\Resources\" /D /E /I /F /Y $(TargetName).cab $(TargetFileName) diff --git a/tools/appveyor-scripts/before-build.ps1 b/tools/appveyor-scripts/before-build.ps1 index 4f9b5c46c559..728fc00a727d 100644 --- a/tools/appveyor-scripts/before-build.ps1 +++ b/tools/appveyor-scripts/before-build.ps1 @@ -40,10 +40,15 @@ Download-Deps & python -m pip install retry -If ($env:build_type -eq "windows32") { +# don't need generate binding codes for cpp only target +If ($env:build_type -ne "android_cpp_tests") { & $python -u .\tools\appveyor-scripts\setup_android.py --ndk_only Generate-Binding-Codes -} elseif ($env:build_type -like "android*") { +} + +If ($env:build_type -like "android*") { + & choco install ninja + & ninja --version & $python -u .\tools\appveyor-scripts\setup_android.py if ($lastexitcode -ne 0) {throw} } \ No newline at end of file diff --git a/tools/bindings-generator b/tools/bindings-generator index 2aa9b21f11bf..f85b28b48219 160000 --- a/tools/bindings-generator +++ b/tools/bindings-generator @@ -1 +1 @@ -Subproject commit 2aa9b21f11bf514ca80f243b21750e8c7c28f05e +Subproject commit f85b28b482192e6a26b121d687567098ff4db562 diff --git a/tools/cocos2d-console b/tools/cocos2d-console index 14f9fd26c3a1..af07b34556a1 160000 --- a/tools/cocos2d-console +++ b/tools/cocos2d-console @@ -1 +1 @@ -Subproject commit 14f9fd26c3a17cf81dd147ced8a9c5fcd6582d0b +Subproject commit af07b34556a13a8f6c352d619d91c08b434aae7d diff --git a/tools/simulator/frameworks/runtime-src/proj.android/jni/Android.mk b/tools/simulator/frameworks/runtime-src/proj.android/jni/Android.mk index 6dcdd68a3102..b5e145525e87 100644 --- a/tools/simulator/frameworks/runtime-src/proj.android/jni/Android.mk +++ b/tools/simulator/frameworks/runtime-src/proj.android/jni/Android.mk @@ -4,7 +4,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := cocos2dlua_shared -LOCAL_MODULE_FILENAME := libcclua +LOCAL_MODULE_FILENAME := libcocos2dlua LOCAL_ARM_MODE := arm diff --git a/tools/simulator/frameworks/runtime-src/proj.android/res/drawable-hdpi/icon.png b/tools/simulator/frameworks/runtime-src/proj.android/res/drawable-hdpi/icon.png old mode 100644 new mode 100755 index 05d307bf352d..8aa4767c2fbf Binary files a/tools/simulator/frameworks/runtime-src/proj.android/res/drawable-hdpi/icon.png and b/tools/simulator/frameworks/runtime-src/proj.android/res/drawable-hdpi/icon.png differ diff --git a/tools/simulator/frameworks/runtime-src/proj.android/res/drawable-ldpi/icon.png b/tools/simulator/frameworks/runtime-src/proj.android/res/drawable-ldpi/icon.png old mode 100644 new mode 100755 index c9a1d06eca6e..17ce11a0856b Binary files a/tools/simulator/frameworks/runtime-src/proj.android/res/drawable-ldpi/icon.png and b/tools/simulator/frameworks/runtime-src/proj.android/res/drawable-ldpi/icon.png differ diff --git a/tools/simulator/frameworks/runtime-src/proj.android/res/drawable-mdpi/icon.png b/tools/simulator/frameworks/runtime-src/proj.android/res/drawable-mdpi/icon.png old mode 100644 new mode 100755 index bd7a87ac42e0..3780aac46c76 Binary files a/tools/simulator/frameworks/runtime-src/proj.android/res/drawable-mdpi/icon.png and b/tools/simulator/frameworks/runtime-src/proj.android/res/drawable-mdpi/icon.png differ diff --git a/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Default-568h@2x.png b/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Default-568h@2x.png old mode 100644 new mode 100755 index ccfc3fa9b651..66c6d1cead37 Binary files a/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Default-568h@2x.png and b/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Default-568h@2x.png differ diff --git a/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Default-667h@2x.png b/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Default-667h@2x.png old mode 100644 new mode 100755 index fbed34a3223a..a0f61ec8e639 Binary files a/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Default-667h@2x.png and b/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Default-667h@2x.png differ diff --git a/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Default-736h@3x.png b/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Default-736h@3x.png old mode 100644 new mode 100755 index 93bdb7220920..dadccee68624 Binary files a/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Default-736h@3x.png and b/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Default-736h@3x.png differ diff --git a/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Default.png b/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Default.png old mode 100644 new mode 100755 index cb58a0e2708d..dcb80725de2a Binary files a/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Default.png and b/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Default.png differ diff --git a/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Default@2x.png b/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Default@2x.png old mode 100644 new mode 100755 index bda7cb9b72d2..84689888a14a Binary files a/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Default@2x.png and b/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Default@2x.png differ diff --git a/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-100.png b/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-100.png old mode 100644 new mode 100755 index e6da566e36f6..ef38d4500a80 Binary files a/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-100.png and b/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-100.png differ diff --git a/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-114.png b/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-114.png old mode 100644 new mode 100755 index 78961c7b04cb..c3807861ad29 Binary files a/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-114.png and b/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-114.png differ diff --git a/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-120.png b/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-120.png old mode 100644 new mode 100755 index a9385cc90390..a5b49ccbb199 Binary files a/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-120.png and b/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-120.png differ diff --git a/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-144.png b/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-144.png old mode 100644 new mode 100755 index d75d43f9df3e..1526615c02d1 Binary files a/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-144.png and b/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-144.png differ diff --git a/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-152.png b/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-152.png old mode 100644 new mode 100755 index ebecbfc0f417..8aa82506d0d1 Binary files a/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-152.png and b/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-152.png differ diff --git a/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-29.png b/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-29.png old mode 100644 new mode 100755 index 74129df4a194..0500184c869c Binary files a/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-29.png and b/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-29.png differ diff --git a/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-40.png b/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-40.png old mode 100644 new mode 100755 index d5a1aabb4b16..775685daca94 Binary files a/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-40.png and b/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-40.png differ diff --git a/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-50.png b/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-50.png old mode 100644 new mode 100755 index 590028981f4a..ac381bc20e85 Binary files a/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-50.png and b/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-50.png differ diff --git a/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-57.png b/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-57.png old mode 100644 new mode 100755 index c70c2fb4a046..4fcc6fddffe1 Binary files a/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-57.png and b/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-57.png differ diff --git a/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-58.png b/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-58.png old mode 100644 new mode 100755 index 5a8e3bff7599..f0f8b7fe9833 Binary files a/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-58.png and b/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-58.png differ diff --git a/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-72.png b/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-72.png old mode 100644 new mode 100755 index f75a7556f026..2c573c8df4c3 Binary files a/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-72.png and b/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-72.png differ diff --git a/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-76.png b/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-76.png old mode 100644 new mode 100755 index 093540a3942b..8a1fa1850c03 Binary files a/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-76.png and b/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-76.png differ diff --git a/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-80.png b/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-80.png old mode 100644 new mode 100755 index cec227f48b51..d9c7ab446bb7 Binary files a/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-80.png and b/tools/simulator/frameworks/runtime-src/proj.ios_mac/ios/Icon-80.png differ diff --git a/tools/simulator/libsimulator/CMakeLists.txt b/tools/simulator/libsimulator/CMakeLists.txt index f801663973f2..a9c0be0573df 100644 --- a/tools/simulator/libsimulator/CMakeLists.txt +++ b/tools/simulator/libsimulator/CMakeLists.txt @@ -24,16 +24,7 @@ set(SIMULATOR_LIB_PATH ${COCOS2DX_ROOT_PATH}/tools/simulator/libsimulator/lib) -if(MACOSX) - # add define for mac os GLFW_EXPOSE_NATIVE_NSGL - add_definitions(-DGLFW_EXPOSE_NATIVE_NSGL) -elseif(WINDOWS) - add_definitions(-DUNICODE -D_UNICODE) - add_definitions(-D_USRLIBSIMSTATIC -DGLFW_EXPOSE_NATIVE_WIN32 -D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS) - include_directories(${SIMULATOR_LIB_PATH}/../proj.win32) -endif() - -if(WIN32) +if(WINDOWS) set(PLATFORM_HEADER ${SIMULATOR_LIB_PATH}/../proj.win32/stdafx.h ${SIMULATOR_LIB_PATH}/../proj.win32/targetver.h @@ -189,23 +180,31 @@ set(SIMULATOR_SOURCE ${PLATFORM_SOURCE} ) -include_directories( - ${SIMULATOR_LIB_PATH} - ${SIMULATOR_LIB_PATH}/platform/${PLATFORM_FOLDER} - ${SIMULATOR_LIB_PATH}/protobuf-lite - ${SIMULATOR_LIB_PATH}/runtime - ${COCOS2DX_ROOT_PATH}/cocos/editor-support -) set(LIB_SOURCE ${SIMULATOR_SOURCE} ${SIMULATOR_HEADER}) -add_library(simulator STATIC - ${LIB_SOURCE} - ) +add_library(simulatorlib STATIC ${LIB_SOURCE}) +target_link_libraries(simulatorlib cocos2d) + +if(WINDOWS) + target_compile_definitions(simulatorlib + PUBLIC _USRLIBSIMSTATIC + PRIVATE _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS + ) + target_include_directories(simulatorlib + PRIVATE ${SIMULATOR_LIB_PATH}/../proj.win32 + ) +endif() -target_use_simulator_depend_libs(simulator) +target_include_directories(simulatorlib + PRIVATE ${SIMULATOR_LIB_PATH} + PRIVATE ${SIMULATOR_LIB_PATH}/platform/${PLATFORM_FOLDER} + PRIVATE ${SIMULATOR_LIB_PATH}/protobuf-lite + PRIVATE ${SIMULATOR_LIB_PATH}/runtime + PRIVATE ${COCOS2DX_ROOT_PATH}/cocos/editor-support +) -set_target_properties(simulator +set_target_properties(simulatorlib PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" @@ -213,5 +212,5 @@ set_target_properties(simulator ) if(XCODE OR VS) - cocos_mark_code_files("simulator") + cocos_mark_code_files("simulatorlib") endif() diff --git a/tools/simulator/libsimulator/lib/platform/mac/PlayerFileDialogServiceMac.mm b/tools/simulator/libsimulator/lib/platform/mac/PlayerFileDialogServiceMac.mm index ae8ab1a96064..e8332415753d 100644 --- a/tools/simulator/libsimulator/lib/platform/mac/PlayerFileDialogServiceMac.mm +++ b/tools/simulator/libsimulator/lib/platform/mac/PlayerFileDialogServiceMac.mm @@ -25,6 +25,14 @@ of this software and associated documentation files (the "Software"), to deal #import #include "PlayerFileDialogServiceMac.h" +#ifndef GLFW_EXPOSE_NATIVE_NSGL +#define GLFW_EXPOSE_NATIVE_NSGL +#endif +#ifndef GLFW_EXPOSE_NATIVE_COCOA +#define GLFW_EXPOSE_NATIVE_COCOA +#endif +// (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) + #include "glfw3.h" #include "glfw3native.h" diff --git a/tools/simulator/libsimulator/lib/platform/win32/SimulatorWin.cpp b/tools/simulator/libsimulator/lib/platform/win32/SimulatorWin.cpp index a2b7613cac3c..1b15000c6fc8 100644 --- a/tools/simulator/libsimulator/lib/platform/win32/SimulatorWin.cpp +++ b/tools/simulator/libsimulator/lib/platform/win32/SimulatorWin.cpp @@ -43,6 +43,14 @@ #include "SimulatorWin.h" +#ifndef GLFW_EXPOSE_NATIVE_WIN32 +#define GLFW_EXPOSE_NATIVE_WIN32 +#endif +#ifndef GLFW_EXPOSE_NATIVE_WGL +#define GLFW_EXPOSE_NATIVE_WGL +#endif +/* (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) */ + #include "glfw3.h" #include "glfw3native.h" diff --git a/tools/tolua/cocos2dx.ini b/tools/tolua/cocos2dx.ini index f30d5c3f38e1..b8abd930f2bd 100644 --- a/tools/tolua/cocos2dx.ini +++ b/tools/tolua/cocos2dx.ini @@ -7,11 +7,11 @@ prefix = cocos2dx # all classes will be embedded in that namespace target_namespace = cc -android_headers = +android_headers = android_flags = -target armv7-none-linux-androideabi -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -DANDROID -D__ANDROID_API__=14 -gcc-toolchain %(gcc_toolchain_dir)s --sysroot=%(androidndkdir)s/platforms/android-14/arch-arm -idirafter %(androidndkdir)s/sources/android/support/include -idirafter %(androidndkdir)s/sysroot/usr/include -idirafter %(androidndkdir)s/sysroot/usr/include/arm-linux-androideabi -idirafter %(clangllvmdir)s/lib64/clang/5.0/include -I%(androidndkdir)s/sources/cxx-stl/llvm-libc++/include -clang_headers = +clang_headers = clang_flags = -nostdinc -x c++ -std=c++11 -fsigned-char -U__SSE__ cocos_headers = -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/platform/android -I%(cocosdir)s/cocos/editor-support -I%(cocosdir)s/external @@ -114,6 +114,7 @@ skip = Node::[setGLServerState description getUserObject .*UserData getGLServerS RenderTexture::[listenToBackground listenToForeground], TMXTiledMap::[getPropertiesForGID], EventCustom::[getUserData setUserData], + EventDispatcher::[addCustomEventListener], Component::[serialize], Console::[addCommand addSubCommand getSubCommand delSubCommand getCommand], ParallaxNode::[(s|g)etParallaxArray], diff --git a/tools/travis-scripts/before-install.sh b/tools/travis-scripts/before-install.sh index 393d4e8ea310..003c5438e869 100755 --- a/tools/travis-scripts/before-install.sh +++ b/tools/travis-scripts/before-install.sh @@ -11,9 +11,9 @@ CURL="curl --retry 999 --retry-max-time 0" function install_android_ndk() { sudo python -m pip install retry - if [ "$BUILD_TARGET" == "android_ndk-build" ]\ + if [ "$BUILD_TARGET" == "android_cpp_ndk-build" ]\ || [ "$BUILD_TARGET" == "android_lua_ndk-build" ]\ - || [ "$BUILD_TARGET" == "android_cmake" ]\ + || [ "$BUILD_TARGET" == "android_cpp_cmake" ]\ || [ "$BUILD_TARGET" == "android_js_cmake" ]\ || [ "$BUILD_TARGET" == "android_lua_cmake" ] ; then python $COCOS2DX_ROOT/tools/appveyor-scripts/setup_android.py @@ -24,37 +24,6 @@ function install_android_ndk() function install_linux_environment() { - mkdir -p $HOME/bin - pushd $HOME/bin - - echo "GCC version: `gcc --version`" - # install new version cmake - CMAKE_VERSION="3.7.2" - CMAKE_DOWNLOAD_URL="https://cmake.org/files/v3.7/cmake-${CMAKE_VERSION}.tar.gz" - echo "Download ${CMAKE_DOWNLOAD_URL}" - ${CURL} -O ${CMAKE_DOWNLOAD_URL} - tar -zxf "cmake-${CMAKE_VERSION}.tar.gz" - cd "cmake-${CMAKE_VERSION}" - ./configure > /dev/null - make -j2 > /dev/null - sudo make install > /dev/null - echo "CMake Version: `cmake --version`" - cd .. - - # install new version binutils - BINUTILS_VERSION="2.27" - BINUTILS_URL="http://ftp.gnu.org/gnu/binutils/binutils-${BINUTILS_VERSION}.tar.gz" - echo "Download ${BINUTILS_URL}" - ${CURL} -O ${BINUTILS_URL} - tar -zxf "binutils-${BINUTILS_VERSION}.tar.gz" - cd "binutils-${BINUTILS_VERSION}" - ./configure > /dev/null - make -j2 > /dev/null - sudo make install > /dev/null - echo "ld Version: `ld --version`" - echo "which ld: `which ld`" - sudo rm /usr/bin/ld - popd echo "Installing linux dependence packages ..." echo -e "y" | bash $COCOS2DX_ROOT/build/install-deps-linux.sh echo "Installing linux dependence packages finished!" @@ -90,9 +59,15 @@ function install_environement_for_pull_request() echo "Building pull request ..." if [ "$TRAVIS_OS_NAME" == "linux" ]; then + sudo apt-get update + sudo apt-get install ninja-build + ninja --version if [ "$BUILD_TARGET" == "linux" ]; then install_linux_environment fi + if [ "$BUILD_TARGET" == "linux_clang_tidy" ]; then + install_linux_environment + fi fi if [ "$TRAVIS_OS_NAME" == "osx" ]; then @@ -118,16 +93,22 @@ function install_environement_for_after_merge() download_deps } -if [ "$BUILD_TARGET" == "android_cocos_new_test" ]; then +if [ "$BUILD_TARGET" == "android_cocos_new_cpp_test" ]; then + sudo apt-get update + sudo apt-get install ninja-build + ninja --version download_deps sudo python -m pip install retry python $COCOS2DX_ROOT/tools/appveyor-scripts/setup_android.py exit 0 fi -if [ "$BUILD_TARGET" == "linux_cocos_new_test" ]; then +if [ "$BUILD_TARGET" == "linux_cocos_new_lua_test" ]; then download_deps install_linux_environment + sudo python -m pip install retry + # set android ndk environment by setup_android.py + python $COCOS2DX_ROOT/tools/appveyor-scripts/setup_android.py --ndk_only exit 0 fi diff --git a/tools/travis-scripts/run-script.sh b/tools/travis-scripts/run-script.sh index 366cd65bfd6e..a804dc6e6666 100755 --- a/tools/travis-scripts/run-script.sh +++ b/tools/travis-scripts/run-script.sh @@ -29,14 +29,24 @@ function do_retry() function build_linux() { - CPU_CORES=`grep -c ^processor /proc/cpuinfo` echo "Building tests ..." cd $COCOS2DX_ROOT/build mkdir -p linux-build cd linux-build cmake ../.. - echo "cpu cores: ${CPU_CORES}" - make -j${CPU_CORES} VERBOSE=1 + cmake --build . +} + +function build_linux_clang_tidy() +{ + echo "Building clang tidy test on Linux ..." + cd $COCOS2DX_ROOT/build + mkdir -p clang-tidy-build + cd clang-tidy-build + cmake ../.. -DCMAKE_EXPORT_COMPILE_COMMANDS=on + clang_tidy_script=$(dirname $(dirname $(readlink -f `which clang-tidy`)))/share/clang/run-clang-tidy.py + # disable clang-tidy checks on external directory and cocos/scripting directory + python $clang_tidy_script '^((?!/cocos2d-x/external/|/cocos/scripting/).)*$' } function build_mac() @@ -96,7 +106,7 @@ function build_ios_cmake() exit 0 } -function build_android_ndk-build() +function build_android_cpp_ndk-build() { # Build all samples echo "Building Android samples ..." @@ -119,7 +129,7 @@ function build_android_ndk-build() # popd } -function build_android_cmake() +function build_android_cpp_cmake() { # Build all samples echo "Building Android samples ..." @@ -287,48 +297,64 @@ function generate_pull_request_for_binding_codes_and_cocosfiles() function run_pull_request() { - echo "Building pull request ..." - - # need to generate binding codes for all targets - genernate_binding_codes - # linux if [ $BUILD_TARGET == 'linux' ]; then + genernate_binding_codes build_linux fi + # linux_clang_tidy_test + if [ $BUILD_TARGET == 'linux_clang_tidy' ]; then + build_linux_clang_tidy + fi + # android - if [ $BUILD_TARGET == 'android_ndk-build' ]; then - build_android_ndk-build + if [ $BUILD_TARGET == 'android_cpp_ndk-build' ]; then + build_android_cpp_ndk-build fi # android - if [ $BUILD_TARGET == 'android_cmake' ]; then - build_android_cmake + if [ $BUILD_TARGET == 'android_cpp_cmake' ]; then + build_android_cpp_cmake fi # android_lua if [ $BUILD_TARGET == 'android_lua_ndk-build' ]; then + genernate_binding_codes build_android_lua_ndk-build fi # android_lua if [ $BUILD_TARGET == 'android_lua_cmake' ]; then + genernate_binding_codes build_android_lua_cmake fi # android_js if [ $BUILD_TARGET == 'android_js_cmake' ]; then + genernate_binding_codes build_android_js_cmake fi if [ $BUILD_TARGET == 'mac' ]; then + genernate_binding_codes build_mac fi if [ $BUILD_TARGET == 'ios' ]; then + genernate_binding_codes build_ios fi + + if [ $BUILD_TARGET == 'mac_cmake' ]; then + genernate_binding_codes + build_mac_cmake + fi + + if [ $BUILD_TARGET == 'ios_cmake' ]; then + genernate_binding_codes + build_ios_cmake + fi } function run_after_merge() @@ -358,7 +384,10 @@ function run_after_merge() # build pull request if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then - if [ "$BUILD_TARGET" == "android_cocos_new_test" ]; then + + echo "Building pull request ..." + + if [ "$BUILD_TARGET" == "android_cocos_new_cpp_test" ]; then source ../environment.sh pushd $COCOS2DX_ROOT update_cocos_files @@ -370,28 +399,19 @@ if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then exit 0 fi - if [ "$BUILD_TARGET" == "linux_cocos_new_test" ]; then + if [ "$BUILD_TARGET" == "linux_cocos_new_lua_test" ]; then + genernate_binding_codes pushd $COCOS2DX_ROOT update_cocos_files python -u tools/cocos2d-console/bin/cocos.py --agreement n new -l lua -p my.pack.qqqq cocos_new_test popd - CPU_CORES=`grep -c ^processor /proc/cpuinfo` + echo "Building tests ..." cd $COCOS2DX_ROOT/cocos_new_test mkdir -p linux-build cd linux-build cmake .. - echo "cpu cores: ${CPU_CORES}" - make -j${CPU_CORES} VERBOSE=1 - exit 0 - fi - if [ $BUILD_TARGET == 'mac_cmake' ]; then - build_mac_cmake - exit 0 - fi - - if [ $BUILD_TARGET == 'ios_cmake' ]; then - build_ios_cmake + cmake --build . exit 0 fi