Merge branch 'v3' of github.com:pandamicro/cocos2d-x into hbmemory

Conflicts:
	cocos/base/ccConfig.h
	cocos/scripting/js-bindings/manual/ScriptingCore.cpp
	cocos/scripting/js-bindings/manual/ScriptingCore.h
	cocos/scripting/js-bindings/script/jsb_prepare.js
This commit is contained in:
pandamicro 2016-01-18 16:40:00 +08:00
commit fc19435123
324 changed files with 15204 additions and 2069 deletions

87
AUTHORS
View File

@ -20,6 +20,7 @@ Core Developers:
Framework & Tools Developers:
Bin Zhang (natural-law)
LunHao Guo
Web Developers:
Sijie Wang (VisualSJ)
@ -37,6 +38,9 @@ Windows Platforms Developers (Collaborators from Microsoft):
Dale Stammen (stammen)
Anniruddh (anniruddh)
Community Evangelism / Programmers Guide Author:
Jason Slack-Moehrle (slackmoehrle)
Developers:
Rolando Abarca
Javascript Binding and testjs
@ -326,6 +330,8 @@ Developers:
author of Bada port
Fixed wrong callback setting for webview:setOnDidFailLoading in Lua.
Fixed life control for XMLHttpRequest.
Remove weak reference in ActionNode.
Bug fix for shouldStartLoading method, should return value from JS
Erawppa
implement CCNotificationCenter
@ -422,6 +428,7 @@ Developers:
Added APIs to get an item in specific position like center, leftmost, rightmost, topmost and bottommost.
Added a feature for magnetic scrolling.
Merge logics of Scroll View for scroll by inertia and auto scroll into one.
Change PageView to derive from ListView.
Sam Clegg (sbc100)
Author of Native Client port.
@ -856,21 +863,25 @@ Developers:
Fixed a bug that Node::removeAllChildrenWithCleanup() does not remove PhysicsBody.
newnon
Adds getCurrentLanguageCode() which returns iso 639-1 language code
Adds support for get response when Activity's onActivityResult is triggered
Improve Android projects
Android jni error clear & more readable log
Add support of software PVRTC v1 decompression
Fixed a bug that ttf font have not effect on Mac OS X
Fixed a bug that before touchMove Touch::_prevPoint contains junk
Added Device::setKeepScreenOn()
Fixed Label performance problem
Added Node::stopAllActionsByTag && ActionManager::removeAllActionsByTag
Added getAllTouches() in GLViewProtocol
Precompiled headers improvements
Added Application::openUrl for all supported platforms ecept WP8 and WinRT
Scale9Sprite capInsets set fix
Clang static analyzer crash fix
Adds getCurrentLanguageCode() which returns iso 639-1 language code.
Adds support for get response when Activity's onActivityResult is triggered.
Improve Android projects.
Android jni error clear & more readable log.
Add support of software PVRTC v1 decompression.
Fixed a bug that ttf font have not effect on Mac OS X.
Fixed a bug that before touchMove Touch::_prevPoint contains junk.
Added Device::setKeepScreenOn().
Fixed Label performance problem.
Added Node::stopAllActionsByTag && ActionManager::removeAllActionsByTag.
Added getAllTouches() in GLViewProtocol.
Precompiled headers improvements.
Added Application::openUrl for all supported platforms ecept WP8 and WinRT.
Scale9Sprite capInsets set fix.
Clang static analyzer crash fix.
Fix include in cocos network module.
Slider misprint fix.
Fix web socket crash.
Scale9Sprite cropped sprite frames support.
youknowone
Adds iOS-like elastic bounceback support for cocos2d::extension::ScrollView
@ -1082,7 +1093,8 @@ Developers:
Fixed memory leak of TextureCache::reloadTexture()
wohaaitinciu
WebView support on windows
WebView support on windows.
Fix a fatal bug in EditBox implement for platform win32.
guykogus
Implemented Application::openUrl for WP8 and WinRT
@ -1113,8 +1125,12 @@ Developers:
Add greater than operator to Vec2
liamcindy
update ui button size changed logic
Update ui button size changed logic.
Added support for Cocos Studio Light3D.
Fix scrollview render errorl.
Update for text effect clone.
Update controlButton size calculate with new Scale9Sprite logic.
Update pageview to support adjust child size.
vovkasm
Fix warnings for Xcode6.1
@ -1201,6 +1217,7 @@ Developers:
Fixed a crash bug when csb file is broken.
Fixed a crash bug in LoadingBar.
Fixed a crash bug in destructor of FontFreeType.
UI: Set focus to Widget when touched.
tankorsmash
Fixed the bug that ProgressTimer::setSprite() doesn't take effect
@ -1227,7 +1244,8 @@ Developers:
Lua: Fixed onTouch begin don't return value
xpol
Sprite: Fixed some warnings and a related bug in CCSprite
Sprite: Fixed some warnings and a related bug in CCSprite.
Fixes boring deprecated warning.
marzapower
UI: Fixed inertial scrolling for CCScrollView
@ -1238,6 +1256,34 @@ Developers:
RUKD
ParticleSystem: performance improvement
m-yukio
UI: RichText support new line element.
Fraggle
Fix PMA Handling issue.
nhuanvd
Fix cannot add view to mFrameLayout when extends Cocos2dxActivity.
1scaR1
Add Scale9Sprite fade actions with cascade opacity enabled in js-test.
FrancoisDupayrat
Fix edit box setPlaceholderFontName and scale font size issue.
cesarpachon
AudioEngine on Linux replace the original SimpleAudioEngine with a new version of FMOD, now AudioEngine support all platforms!
cezheng
Fix Downloader bug for iOS & Android.
pandemosth
Fix crash when removing a remotely downloaded image from texture cache in js-binding.
GuoLunHao
Add quiet option for Cocos Toolkit.
Retired Core Developers:
WenSheng Yang
Author of windows port, CCTextField,
@ -1290,10 +1336,14 @@ Retired Core Developers:
Fixed some minor typos.
Fixed Wformat-security warning on Xcode.
Added missing override keyword.
Fix memory leak when initWithImage() failed.
Fix deprecation warning in SkeletonRenderer.
Fix typos in documentation and comments.
njh0602
Clean up the code of setRect() function.
Fixed syntax error in comment.
Add virtual keyword for some render related function.
noshbar
Changed the size of startFlag to 13.
@ -1315,6 +1365,7 @@ Retired Core Developers:
TheCodez
Added missing getChildByTag<>() API.
Fixed a bug that RefPtr test wasn't executed even in debug build.
Added Application::getVersion() to get the app version.
thuydx55
Fixed a bug of loading pluginx lib when compile Android with --compile-script flag.

View File

@ -1,32 +1,73 @@
cocos2d-x-3.10 December ? 2015
[HIGHLIGHT] UI: Rewrite Scale9Sprite and improve the scale9sprite performance and reduce memory consumption.
[HIGHLIGHT] UI: Change PageView to derive from ListView.
[NEW] Core: Added Application::getVersion() to get the app version.
[NEW] UI: Add PageView indicator.
[NEW] Label: Add three Overflow type to new label, see release note for more information.
[NEW] UI: Label add three Overflow type to new label, see release note for more information.
[NEW] UI: UIText::clone supports clone the text effect.
[NEW] Label: Add methods to query label effect state.
[NEW] UI: UIRichText support the new line element.
[REFINE] 3rd party: WebP loading improvements WebP loaded as premultiplied alpha if it has.
[REFINE] UI: Slider `setCapInsetProgressBarRebderer` change to `setCapInsetProgressBarRenderer`.
[REFINE] UI: RichText support new line element.
[REFINE] UI: Set focus to Widget when touched.
[REFINE] UI: Change PageView to derived from ListView.
[REFINE] UI: Rewrite Scale9Sprite and improve the scale9sprite performance and reduce memory consumption.
[REFINE] 3D: Change char* to string in Terrain.
[REFINE] Editor: Merge Studio ActionTimeLine change back into engine.
[REFINE] Studio: Merge Studio ActionTimeLine change back into engine.
[REFINE] Studio: Merge Studio changes for compatible withe 32bit Mac System.
[REFINE] Studio: Merge Studio changes for lua-binding, js-binding and simulator.
[REFINE] Mac: Make engine compatible for 32bit Mac.
[REFINE] 3rd party: WebP loading improvements WebP loaded as premultiplied alpha if it has.
[REFINE] Audio: AudioEngine on Linux replace the original SimpleAudioEngine with a new version of FMOD, now AudioEngine support all platforms!
[REFINE] IOS: Add virtual keyword for some render related function.
[REFINE] UI: Fixes boring deprecated warning in HttpRequest.
[REFINE] Network: Fix Downloader bug on iOS & Android platform.
[REFINE] Studio: Fix deprecation warning in SkeletonRenderer.
[REFINE] JS: Add js test case for fix, improve template.
[REFINE] Network: Permit http access to cocos2d-x.org in test projects on iOS.
[REFINE] Network: Crash when removing a remotely downloaded image from texture cache in js-binding.
[REFINE] Win10: WinRT project update version to v3.10.
[REFINE] Console: Add quiet option for Cocos Toolkit.
[REFINE] JS: New GC model for js-binding.
[REFINE] Doc: Fix typos in documentation and comments.
[REFINE] UI: update controlButton size calculate with new Scale9Sprite logic.
[REFINE] Win10: Added missing _USRJSSTATIC preprocessor define for ARM builds.
[REFINE] JS: Added ccvector_to / ccmap_to converted to new js-binding API.
[REFINE] UI: Slider misprint fix.
[FIX] Network: fix possible websocket crash in its destructor.
[FIX] Core: Fix premultiplyAlpha for mipmaps and compressed textures.
[FIX] UI: Fix Scale9sprite rendering error when content size smaller than the sum of leftInset and rightInset.
[FIX] Win32: Fix EditBox crash when removing an EditBox in a scheduler.
[FIX] Android: Fix cannot add view to mFrameLayout when extends Cocos2dxActivity.
[FIX] 2D: Fixed actionNode position error bug.
[FIX] 2D: Fixed actionNode set at wrong position bug.
[FIX] 3D: Fix the movement of PUParticle lags one frame.
[FIX] UI: Fix the wront argument of setPlaceholderFontName in EditBox.
[FIX] UI: Fix EditBox editBoxEditingDidEnd may use the original text after change the text of EditBox in user script.
[FIX] Audio: Fix `FinishCallback` never be called in Windows.
[FIX] UI: Fix Layout stencil clipping nested with Clipping Node rendering issue.
[FIX] UI: Keyboard doesn't hide when click the screen outside of EditBox on iOS platform.
[FIX] UI: Fix a fatal bug in EditBox implement on Windows platform.
[FIX] UI: Fix edit box setPlaceholderFontName and scale font size issue.
[FIX] Core: Fix memory leak when initWithImage() failed.
[FIX] Network: CCDownloader on iOS is broken in v3.9 js-binding.
[FIX] JS: Bindings fixes for Menu, Sprite and Label.
[FIX] Studio: Remove weak reference in ActionNode.
[FIX] UI: shouldStartLoading method should return value to js in js-binding.
[FIX] UI: Fix scrollview render error.
[FIX] JS: Fix win32 js project crash issue.
[FIX] UI: Button touch doesn't work with scale9 enabled.
[FIX] JS: Fix evalString doesn't return result issue.
[FIX] JS: Fix ComponentJS proxy management issue in JSB.
[FIX] Android: Fix include in cocos network module.
[FIX] Network: Fix web socket crash.
[FIX] UI: Fix TextField missing default password style text setting.
[TEST] S9SpriteTest: Scale9Sprite fade actions with cascade opacity.
[TEST] Web: Remove default focus block from UIFocusTestVertical.
[TEST] Lua: Fix pageViewTest Horizontal scroll won't work in Lua-test.
cocos2d-x-3.9 November.09 2015
@ -1593,49 +1634,4 @@ cocos2d-x-3.0alpha0-pre @Jul.30 2013
[FIX] #2230: Node::onEnterTransitionDidFinish was called twice when a node is added in Node::onEnter
[FIX] #2237: calculation offset in font rendering
[FIX] #2303: missing precision when getting strokeColor and fontFillColor
[FIX] #2312: WebSocket can not parse url like "ws://domain.com/websocket"
[FIX] #2327: implement Node::isScheduled
[FIX] #2338: ccbRootPath is not passed to sub ccb nodes
[FIX] #2346: OpenGL error 0x0502 in TextureAtlas::drawNumberOfQuads
[FIX] #2359: Sprite will become white block when using ControlSwitch
[FIX] #2361: some bug fixed of the Set class
[FIX] #2366: text shadow
[FIX] #2367: ClippingNode works differently on different platforms
[FIX] #2370: Pivotjoint constructor and pointQueryFirst in Space class will return false instead of invalid shape object
[FIX] #2381: ControlSwitch wasn't displayed correctly when adding more than one switch
[FIX] #2384: The submenu of ExtensionTest in TestCpp can't scroll
[FIX] #2386: ClippingNode works wrongly when being set as a child
[FIX] #2396: Scale9Sprite::setInsetLeft/XXX can't work for rotated sprite frame
[FIX] #2401: LabelBMFont crashes in glDrawElements of CCTextureAtlas::drawNumberOfQuads randombly
[FIX] #2410: Black screen appears on android randomly
[FIX] #2411: Opacity option for shadow in CCLabelTTF is not working
[FIX] #2406: Color and Opacity of Scale9Sprite will not be changed when it's added to NodeRGBA and run with FadeIn/Out actions
[FIX] #2415: Warning of AL_INVALID_NAME and AL_INVALID_OPERATION in SimpleAudioEngineOpenAL.cpp
[FIX] #2418: Unused spriteframes also need to be removed when purgeCachedData
[FIX] #2431: Potential crash when loading js files
[FIX] #2229: Explicitly initialising CCAcceleration structure
[FIX] #2234: Add destructor to CCGLBufferedNode
[Feature] #2232: adding Norwegian language support
[Feature] #2235: Ability to save/retrieve CCData into/from CCUserDefault
[Feature] #2250: add support for std::function<> in CCMemuItem and CCCallFunc
[Feature] #2273: Hardware keyboard support
[Feature] #2278: Adds CALLBACK_0, CALLBACK_1 and CALLBACK_2 macros for MenuItems
[Feature] #2279: Updates chipmunk2d to v6.1.5
[Feature] #2283: Adds Polish language support
[Feature] #2289: Uses clone() pattern for actions
[Feature] #2332: Adding project for QtCreator
[Feature] #2364: Adds DrawPrimitives::DrawSolidCircle
[Feature] #2365: Adds Rect::unionWithRect
[Feature] #2385: Implemented pitch, pan and gain for SimpleAudioEngine
[Feature] #2389: Adding cookie support for HttpClient
[Feature] #2392: Adds append() function for String class
[Feature] #2395: Adds Scale9SpriteTest for TestCpp
[Feature] #2399: Adds SocketIO support
[Feature] #2408: Adds String::componentsSeparatedByString function for splitting string
[Feature] #2414: Bindings-generator could bind std::function<> argument
[Refactor] #2129: Removes Hungarian notation from ivars. Removes CC and cc prefixes from name classes and free functions.
[Refactor] #2242: Enables c++11
[Refactor] #2300: Using clone() pattern instead of 'copyWithZone' pattern
[Refactor] #2305: Use std::thread instead of pthread
[Refactor] #2328: ETC support for all platforms
[Refactor] #2373: C
[FIX] #2312: WebSocket can not parse url like "ws://domain.com/websocket

View File

@ -295,6 +295,8 @@ __cocos2d-x_root/build.__
Contributing to the Project
--------------------------------
Cocos2d-x is licensed under the [MIT License](https://opensource.org/licenses/MIT). We welcome paricipation!
Did you find a bug? Do you have feature request? Do you want to merge a feature?
* [contributing to cocos2d-x][8]

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "507B39BF1C31BDD30067B53E"
BuildableName = "libcocos2d tvOS.a"
BlueprintName = "libcocos2d tvOS"
ReferencedContainer = "container:cocos2d_libs.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "507B39BF1C31BDD30067B53E"
BuildableName = "libcocos2d tvOS.a"
BlueprintName = "libcocos2d tvOS"
ReferencedContainer = "container:cocos2d_libs.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "507B39BF1C31BDD30067B53E"
BuildableName = "libcocos2d tvOS.a"
BlueprintName = "libcocos2d tvOS"
ReferencedContainer = "container:cocos2d_libs.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "507B43541C31FB340067B53E"
BuildableName = "build all tests tvOS"
BlueprintName = "build all tests tvOS"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "507B43541C31FB340067B53E"
BuildableName = "build all tests tvOS"
BlueprintName = "build all tests tvOS"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "507B43541C31FB340067B53E"
BuildableName = "build all tests tvOS"
BlueprintName = "build all tests tvOS"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "507B40FE1C31BEA60067B53E"
BuildableName = "cpp-tests tvOS.app"
BlueprintName = "cpp-tests tvOS"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "507B40FE1C31BEA60067B53E"
BuildableName = "cpp-tests tvOS.app"
BlueprintName = "cpp-tests tvOS"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "507B40FE1C31BEA60067B53E"
BuildableName = "cpp-tests tvOS.app"
BlueprintName = "cpp-tests tvOS"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "507B40FE1C31BEA60067B53E"
BuildableName = "cpp-tests tvOS.app"
BlueprintName = "cpp-tests tvOS"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "507B43C31C3201360067B53E"
BuildableName = "game-controller-test tvOS.app"
BlueprintName = "game-controller-test tvOS"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "507B43C31C3201360067B53E"
BuildableName = "game-controller-test tvOS.app"
BlueprintName = "game-controller-test tvOS"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "507B43C31C3201360067B53E"
BuildableName = "game-controller-test tvOS.app"
BlueprintName = "game-controller-test tvOS"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "507B43C31C3201360067B53E"
BuildableName = "game-controller-test tvOS.app"
BlueprintName = "game-controller-test tvOS"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "507B441A1C336EFA0067B53E"
BuildableName = "js-memory-gc-tests Mac.app"
BlueprintName = "js-memory-gc-tests Mac"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "507B441A1C336EFA0067B53E"
BuildableName = "js-memory-gc-tests Mac.app"
BlueprintName = "js-memory-gc-tests Mac"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "507B441A1C336EFA0067B53E"
BuildableName = "js-memory-gc-tests Mac.app"
BlueprintName = "js-memory-gc-tests Mac"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "507B441A1C336EFA0067B53E"
BuildableName = "js-memory-gc-tests Mac.app"
BlueprintName = "js-memory-gc-tests Mac"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "50FC18B41C33725200DD15A3"
BuildableName = "js-memory-gc-tests iOS.app"
BlueprintName = "js-memory-gc-tests iOS"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "50FC18B41C33725200DD15A3"
BuildableName = "js-memory-gc-tests iOS.app"
BlueprintName = "js-memory-gc-tests iOS"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "50FC18B41C33725200DD15A3"
BuildableName = "js-memory-gc-tests iOS.app"
BlueprintName = "js-memory-gc-tests iOS"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "50FC18B41C33725200DD15A3"
BuildableName = "js-memory-gc-tests iOS.app"
BlueprintName = "js-memory-gc-tests iOS"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "507B427E1C31E6070067B53E"
BuildableName = "js-tests tvOS.app"
BlueprintName = "js-tests tvOS"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "507B427E1C31E6070067B53E"
BuildableName = "js-tests tvOS.app"
BlueprintName = "js-tests tvOS"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "507B427E1C31E6070067B53E"
BuildableName = "js-tests tvOS.app"
BlueprintName = "js-tests tvOS"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "507B427E1C31E6070067B53E"
BuildableName = "js-tests tvOS.app"
BlueprintName = "js-tests tvOS"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "507EE84B1C24C94600839198"
BuildableName = "js-tests-memory-gc Mac.app"
BlueprintName = "js-tests-memory-gc Mac"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "507EE84B1C24C94600839198"
BuildableName = "js-tests-memory-gc Mac.app"
BlueprintName = "js-tests-memory-gc Mac"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "507EE84B1C24C94600839198"
BuildableName = "js-tests-memory-gc Mac.app"
BlueprintName = "js-tests-memory-gc Mac"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "507EE84B1C24C94600839198"
BuildableName = "js-tests-memory-gc Mac.app"
BlueprintName = "js-tests-memory-gc Mac"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "50AC0E6E1C2A3CAA0065A4C7"
BuildableName = "js-tests-memory-gc iOS.app"
BlueprintName = "js-tests-memory-gc iOS"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "50AC0E6E1C2A3CAA0065A4C7"
BuildableName = "js-tests-memory-gc iOS.app"
BlueprintName = "js-tests-memory-gc iOS"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "50AC0E6E1C2A3CAA0065A4C7"
BuildableName = "js-tests-memory-gc iOS.app"
BlueprintName = "js-tests-memory-gc iOS"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "50AC0E6E1C2A3CAA0065A4C7"
BuildableName = "js-tests-memory-gc iOS.app"
BlueprintName = "js-tests-memory-gc iOS"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "507B43611C31FB670067B53E"
BuildableName = "lua-tests tvOS.app"
BlueprintName = "lua-tests tvOS"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "507B43611C31FB670067B53E"
BuildableName = "lua-tests tvOS.app"
BlueprintName = "lua-tests tvOS"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "507B43611C31FB670067B53E"
BuildableName = "lua-tests tvOS.app"
BlueprintName = "lua-tests tvOS"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "507B43611C31FB670067B53E"
BuildableName = "lua-tests tvOS.app"
BlueprintName = "lua-tests tvOS"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -119,11 +119,16 @@ const unsigned int PolygonInfo::getVertCount() const
return (unsigned int)triangles.vertCount;
}
const unsigned int PolygonInfo::getTriaglesCount() const
const unsigned int PolygonInfo::getTrianglesCount() const
{
return (unsigned int)triangles.indexCount/3;
}
const unsigned int PolygonInfo::getTriaglesCount() const
{
return getTrianglesCount();
}
const float PolygonInfo::getArea() const
{
float area = 0;

View File

@ -107,7 +107,10 @@ public:
* get triangles count
* @return number of triangles
*/
const unsigned int getTriaglesCount() const;
const unsigned int getTrianglesCount() const;
/** @deprecated Use method getTrianglesCount() instead */
CC_DEPRECATED_ATTRIBUTE const unsigned int getTriaglesCount() const;
/**
* get sum of all triangle area size

View File

@ -508,7 +508,7 @@ void Label::reset()
_enableWrap = true;
_bmFontSize = -1;
_bmfontScale = 1.0f;
_overflow = Overflow::NORMAL;
_overflow = Overflow::NONE;
_originalFontSize = 0.0f;
}

View File

@ -97,16 +97,16 @@ class CC_DLL Label : public Node, public LabelProtocol, public BlendProtocol
public:
enum class Overflow
{
//for keep back compatibility
NORMAL,
/**
* In SHRINK mode, the font size will change dynamically to adapt the content size.
*/
SHRINK,
//In NONE mode, the dimensions is (0,0) and the content size will change dynamically to fit the label.
NONE,
/**
*In CLAMP mode, when label content goes out of the bounding box, it will be clipped.
*/
CLAMP,
/**
* In SHRINK mode, the font size will change dynamically to adapt the content size.
*/
SHRINK,
/**
*In RESIZE_HEIGHT mode, you can only change the width of label and the height is changed automatically.
*/
@ -380,7 +380,7 @@ public:
LabelEffect getLabelEffectType() const { return _currLabelEffect; }
/**
* Return current effect color vlaue.
* Return current effect color value.
*/
Color4F getEffectColor() const { return _effectColorF; }

View File

@ -104,6 +104,14 @@ void MenuItem::activate()
{
_callback(this);
}
#if CC_ENABLE_SCRIPT_BINDING
if (kScriptTypeLua == _scriptType)
{
BasicScriptData data(this);
ScriptEvent scriptEvent(kMenuClickedEvent, &data);
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&scriptEvent);
}
#endif
}
}

View File

@ -1332,4 +1332,13 @@ void ParticleSystem::setScaleY(float newScaleY)
Node::setScaleY(newScaleY);
}
void ParticleSystem::start()
{
resetSystem();
}
void ParticleSystem::stop()
{
stopSystem();
}
NS_CC_END

View File

@ -194,7 +194,7 @@ emitter.startSpin = 0;
#endif
#endif
class CC_DLL ParticleSystem : public Node, public TextureProtocol
class CC_DLL ParticleSystem : public Node, public TextureProtocol, public PlayableProtocol
{
public:
/** Mode
@ -763,6 +763,12 @@ public:
const std::string getResourceFile() const { return _plistFile; }
/// @{
/// @name implement Playable Protocol
virtual void start() override;
virtual void stop() override;
/// @} end of PlaybleProtocol
CC_CONSTRUCTOR_ACCESS:
/**
* @js ctor

View File

@ -47,6 +47,7 @@ RenderTexture::RenderTexture()
, _fullviewPort(Rect::ZERO)
, _FBO(0)
, _depthRenderBufffer(0)
, _stencilRenderBufffer(0)
, _oldFBO(0)
, _texture(0)
, _textureCopy(0)
@ -81,6 +82,12 @@ RenderTexture::~RenderTexture()
{
glDeleteRenderbuffers(1, &_depthRenderBufffer);
}
if (_stencilRenderBufffer)
{
glDeleteRenderbuffers(1, &_stencilRenderBufffer);
}
CC_SAFE_DELETE(_UITextureImage);
}
@ -252,6 +259,11 @@ bool RenderTexture::initWithWidthAndHeight(int w, int h, Texture2D::PixelFormat
if (depthStencilFormat != 0)
{
#if(CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
if(Configuration::getInstance()->supportsOESPackedDepthStencil())
{
//create and attach depth buffer
glGenRenderbuffers(1, &_depthRenderBufffer);
glBindRenderbuffer(GL_RENDERBUFFER, _depthRenderBufffer);
@ -264,6 +276,46 @@ bool RenderTexture::initWithWidthAndHeight(int w, int h, Texture2D::PixelFormat
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, _depthRenderBufffer);
}
}
else
{
glGenRenderbuffers(1, &_depthRenderBufffer);
glGenRenderbuffers(1, &_stencilRenderBufffer);
glBindRenderbuffer(GL_RENDERBUFFER, _depthRenderBufffer);
if(Configuration::getInstance()->supportsOESDepth24())
{
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24_OES, (GLsizei)powW, (GLsizei)powH);
}
else
{
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, (GLsizei)powW, (GLsizei)powH);
}
glBindRenderbuffer(GL_RENDERBUFFER, _stencilRenderBufffer);
glRenderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX8, (GLsizei)powW, (GLsizei)powH);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, _depthRenderBufffer);
glFramebufferRenderbuffer(GL_FRAMEBUFFER,
GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, _stencilRenderBufffer);
}
#else
//create and attach depth buffer
glGenRenderbuffers(1, &_depthRenderBufffer);
glBindRenderbuffer(GL_RENDERBUFFER, _depthRenderBufffer);
glRenderbufferStorage(GL_RENDERBUFFER, depthStencilFormat, (GLsizei)powW, (GLsizei)powH);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, _depthRenderBufffer);
// if depth format is the one with stencil part, bind same render buffer as stencil attachment
if (depthStencilFormat == GL_DEPTH24_STENCIL8)
{
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, _depthRenderBufffer);
}
#endif
}
// check if it worked (probably worth doing :) )
CCASSERT(glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE, "Could not attach texture to framebuffer");

View File

@ -323,6 +323,7 @@ protected:
GLuint _FBO;
GLuint _depthRenderBufffer;
GLuint _stencilRenderBufffer;
GLint _oldFBO;
Texture2D* _texture;
Texture2D* _textureCopy; // a copy of _texture

View File

@ -323,7 +323,7 @@ Sprite::Sprite(void)
#endif //CC_SPRITE_DEBUG_DRAW
}
Sprite::~Sprite(void)
Sprite::~Sprite()
{
CC_SAFE_RELEASE(_spriteFrame);
CC_SAFE_RELEASE(_texture);
@ -594,15 +594,6 @@ void Sprite::updateTransform(void)
float x2 = x1 + size.width;
float y2 = y1 + size.height;
if (_flippedX)
{
std::swap(x1, x2);
}
if (_flippedY)
{
std::swap(y1, y2);
}
float x = _transformToBatch.m[12];
float y = _transformToBatch.m[13];
@ -626,6 +617,7 @@ void Sprite::updateTransform(void)
_quad.br.vertices.set(SPRITE_RENDER_IN_SUBPIXEL(bx), SPRITE_RENDER_IN_SUBPIXEL(by), _positionZ);
_quad.tl.vertices.set(SPRITE_RENDER_IN_SUBPIXEL(dx), SPRITE_RENDER_IN_SUBPIXEL(dy), _positionZ);
_quad.tr.vertices.set(SPRITE_RENDER_IN_SUBPIXEL(cx), SPRITE_RENDER_IN_SUBPIXEL(cy), _positionZ);
setTextureCoords(_rect);
}
// MARMALADE CHANGE: ADDED CHECK FOR nullptr, TO PERMIT SPRITES WITH NO BATCH NODE / TEXTURE ATLAS
@ -1082,6 +1074,10 @@ void Sprite::setSpriteFrame(SpriteFrame *spriteFrame)
{
_polyInfo = spriteFrame->getPolygonInfo();
}
if (spriteFrame->hasAnchorPoint())
{
setAnchorPoint(spriteFrame->getAnchorPoint());
}
}
void Sprite::setDisplayFrameWithAnimationName(const std::string& animationName, ssize_t frameIndex)

View File

@ -104,6 +104,7 @@ bool SpriteFrame::initWithTexture(Texture2D* texture, const Rect& rect, bool rot
_originalSizeInPixels = originalSize;
_originalSize = CC_SIZE_PIXELS_TO_POINTS( _originalSizeInPixels );
_rotated = rotated;
_anchorPoint = Vec2(NAN, NAN);
return true;
}
@ -119,6 +120,7 @@ bool SpriteFrame::initWithTextureFilename(const std::string& filename, const Rec
_originalSizeInPixels = originalSize;
_originalSize = CC_SIZE_PIXELS_TO_POINTS( _originalSizeInPixels );
_rotated = rotated;
_anchorPoint = Vec2(NAN, NAN);
return true;
}
@ -173,6 +175,21 @@ void SpriteFrame::setOffsetInPixels(const Vec2& offsetInPixels)
_offset = CC_POINT_PIXELS_TO_POINTS( _offsetInPixels );
}
const Vec2& SpriteFrame::getAnchorPoint() const
{
return _anchorPoint;
}
void SpriteFrame::setAnchorPoint(const Vec2& anchorPoint)
{
_anchorPoint = anchorPoint;
}
bool SpriteFrame::hasAnchorPoint() const
{
return !isnan(_anchorPoint.x);
}
void SpriteFrame::setTexture(Texture2D * texture)
{
if( _texture != texture ) {

View File

@ -186,6 +186,22 @@ public:
*/
void setOffset(const Vec2& offsets);
/** Get anchor point of the frame.
*
* @return The anchor point of the sprite frame.
*/
const Vec2& getAnchorPoint() const;
/** Set anchor point of the frame.
*
* @param anchorPoint The anchor point of the sprite frame.
*/
void setAnchorPoint(const Vec2& anchorPoint);
/** Check if anchor point is defined for the frame.
*
* @return true if anchor point is available.
*/
bool hasAnchorPoint() const;
// Overrides
virtual SpriteFrame *clone() const override;
@ -242,6 +258,7 @@ CC_CONSTRUCTOR_ACCESS:
protected:
Vec2 _offset;
Vec2 _anchorPoint;
Size _originalSize;
Rect _rectInPixels;
bool _rotated;

View File

@ -276,6 +276,10 @@ void SpriteFrameCache::addSpriteFramesWithDictionary(ValueMap& dictionary, Textu
initializePolygonInfo(textureSize, spriteSourceSize, vertices, verticesUV, indices, info);
spriteFrame->setPolygonInfo(info);
}
if (frameDict.find("anchor") != frameDict.end())
{
spriteFrame->setAnchorPoint(PointFromString(frameDict["anchor"].asString()));
}
}
bool flag = NinePatchImageParser::isNinePatchImage(spriteFrameName);

View File

@ -65,6 +65,7 @@ class PolygonInfo;
- `spriteSourceSize`: size of the original sprite
- `textureRect`: the position of the sprite in the sprite sheet
- `textureRotated`: true if the sprite is rotated clockwise
- `anchor`: anchor point in normalized coordinates (optional)
Optional values when using polygon outlines
- `triangles`: 3 indices per triangle, pointing to vertices and verticesUV coordinates
- `vertices`: vertices in sprite coordinates, each vertex consists of a pair of x and y coordinates

View File

@ -202,6 +202,11 @@ void TransitionScene::onExit()
// _inScene should not receive the onEnter callback
// only the onEnterTransitionDidFinish
_inScene->onEnterTransitionDidFinish();
#if CC_ENABLE_SCRIPT_BINDING
if (ScriptEngineManager::getInstance()->getScriptEngine())
ScriptEngineManager::getInstance()->getScriptEngine()->garbageCollect();
#endif // CC_ENABLE_SCRIPT_BINDING
}
// custom cleanup

View File

@ -26,31 +26,22 @@ THE SOFTWARE.
#include "cddandroidAndroidJavaEngine.h"
#include <stdlib.h>
#include <android/log.h>
#include <jni.h>
#include <sys/system_properties.h>
#include "platform/android/jni/JniHelper.h"
#include "ccdandroidUtils.h"
#include "audio/include/AudioEngine.h"
#include "platform/android/jni/JniHelper.h"
// logging
#define LOG_TAG "cocosdenshion::android::AndroidJavaEngine"
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)
// Java class
#define CLASS_NAME "org/cocos2dx/lib/Cocos2dxHelper"
static const std::string helperClassName = "org/cocos2dx/lib/Cocos2dxHelper";
using namespace cocos2d;
using namespace cocos2d::experimental;
using namespace CocosDenshion::android;
static inline bool getJNIStaticMethodInfo(cocos2d::JniMethodInfo &methodinfo,
const char *methodName,
const char *paramCode) {
return cocos2d::JniHelper::getStaticMethodInfo(methodinfo,
CLASS_NAME,
methodName,
paramCode);
}
AndroidJavaEngine::AndroidJavaEngine()
: _implementBaseOnAudioEngine(false)
, _effectVolume(1.f)
@ -78,89 +69,35 @@ AndroidJavaEngine::~AndroidJavaEngine()
{
stopAllEffects();
}
cocos2d::JniMethodInfo methodInfo;
if (!getJNIStaticMethodInfo(methodInfo, "end", "()V")) {
return;
}
methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID);
methodInfo.env->DeleteLocalRef(methodInfo.classID);
JniHelper::callStaticVoidMethod(helperClassName, "end");
}
void AndroidJavaEngine::preloadBackgroundMusic(const char* filePath) {
std::string fullPath = CocosDenshion::android::getFullPathWithoutAssetsPrefix(filePath);
// void playBackgroundMusic(String,boolean)
cocos2d::JniMethodInfo methodInfo;
if (!getJNIStaticMethodInfo(methodInfo, "preloadBackgroundMusic", "(Ljava/lang/String;)V")) {
return;
}
jstring stringArg = methodInfo.env->NewStringUTF(fullPath.c_str());
methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID, stringArg);
methodInfo.env->DeleteLocalRef(stringArg);
methodInfo.env->DeleteLocalRef(methodInfo.classID);
JniHelper::callStaticVoidMethod(helperClassName, "preloadBackgroundMusic", filePath);
}
void AndroidJavaEngine::playBackgroundMusic(const char* filePath, bool loop) {
std::string fullPath = CocosDenshion::android::getFullPathWithoutAssetsPrefix(filePath);
cocos2d::JniMethodInfo methodInfo;
if (!getJNIStaticMethodInfo(methodInfo, "playBackgroundMusic", "(Ljava/lang/String;Z)V")) {
return;
}
jstring stringArg = methodInfo.env->NewStringUTF(fullPath.c_str());
methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID, stringArg, loop);
methodInfo.env->DeleteLocalRef(stringArg);
methodInfo.env->DeleteLocalRef(methodInfo.classID);
JniHelper::callStaticVoidMethod(helperClassName, "playBackgroundMusic", filePath, loop);
}
void AndroidJavaEngine::stopBackgroundMusic(bool releaseData) {
cocos2d::JniMethodInfo methodInfo;
if (!getJNIStaticMethodInfo(methodInfo, "stopBackgroundMusic", "()V")) {
return;
}
methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID);
methodInfo.env->DeleteLocalRef(methodInfo.classID);
JniHelper::callStaticVoidMethod(helperClassName, "stopBackgroundMusic");
}
void AndroidJavaEngine::pauseBackgroundMusic() {
cocos2d::JniMethodInfo methodInfo;
JniHelper::callStaticVoidMethod(helperClassName, "pauseBackgroundMusic");
if (!getJNIStaticMethodInfo(methodInfo, "pauseBackgroundMusic", "()V")) {
return;
}
methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID);
methodInfo.env->DeleteLocalRef(methodInfo.classID);
}
void AndroidJavaEngine::resumeBackgroundMusic() {
cocos2d::JniMethodInfo methodInfo;
if (!getJNIStaticMethodInfo(methodInfo, "resumeBackgroundMusic", "()V")) {
return;
}
methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID);
methodInfo.env->DeleteLocalRef(methodInfo.classID);
JniHelper::callStaticVoidMethod(helperClassName, "resumeBackgroundMusic");
}
void AndroidJavaEngine::rewindBackgroundMusic() {
cocos2d::JniMethodInfo methodInfo;
if (!getJNIStaticMethodInfo(methodInfo, "rewindBackgroundMusic", "()V")) {
return;
}
methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID);
methodInfo.env->DeleteLocalRef(methodInfo.classID);
JniHelper::callStaticVoidMethod(helperClassName, "rewindBackgroundMusic");
}
bool AndroidJavaEngine::willPlayBackgroundMusic() {
@ -168,181 +105,17 @@ bool AndroidJavaEngine::willPlayBackgroundMusic() {
}
bool AndroidJavaEngine::isBackgroundMusicPlaying() {
cocos2d::JniMethodInfo methodInfo;
jboolean ret = false;
if (!getJNIStaticMethodInfo(methodInfo, "isBackgroundMusicPlaying", "()Z")) {
return ret;
}
ret = methodInfo.env->CallStaticBooleanMethod(methodInfo.classID, methodInfo.methodID);
methodInfo.env->DeleteLocalRef(methodInfo.classID);
return ret;
return JniHelper::callStaticBooleanMethod(helperClassName, "isBackgroundMusicPlaying");
}
float AndroidJavaEngine::getBackgroundMusicVolume() {
cocos2d::JniMethodInfo methodInfo;
jfloat ret = -1.0;
if (!getJNIStaticMethodInfo(methodInfo, "getBackgroundMusicVolume", "()F")) {
return ret;
}
ret = methodInfo.env->CallStaticFloatMethod(methodInfo.classID, methodInfo.methodID);
methodInfo.env->DeleteLocalRef(methodInfo.classID);
return ret;
return JniHelper::callStaticFloatMethod(helperClassName, "getBackgroundMusicVolume");
}
void AndroidJavaEngine::setBackgroundMusicVolume(float volume) {
cocos2d::JniMethodInfo methodInfo;
if (!getJNIStaticMethodInfo(methodInfo, "setBackgroundMusicVolume", "(F)V")) {
return;
JniHelper::callStaticVoidMethod(helperClassName, "setBackgroundMusicVolume", volume);
}
methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID, volume);
methodInfo.env->DeleteLocalRef(methodInfo.classID);
}
static float _jni_getEffectsVolume() {
cocos2d::JniMethodInfo methodInfo;
jfloat ret = -1.0;
if (!getJNIStaticMethodInfo(methodInfo, "getEffectsVolume", "()F")) {
return ret;
}
ret = methodInfo.env->CallStaticFloatMethod(methodInfo.classID, methodInfo.methodID);
methodInfo.env->DeleteLocalRef(methodInfo.classID);
return ret;
}
static void _jni_setEffectsVolume(float volume) {
cocos2d::JniMethodInfo methodInfo;
if (!getJNIStaticMethodInfo(methodInfo, "setEffectsVolume", "(F)V")) {
return;
}
methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID, volume);
methodInfo.env->DeleteLocalRef(methodInfo.classID);
}
static unsigned int _jni_playEffect(const char* filePath, bool loop, float pitch, float pan, float gain)
{
cocos2d::JniMethodInfo methodInfo;
int ret = 0;
std::string fullPath = CocosDenshion::android::getFullPathWithoutAssetsPrefix(filePath);
if (!getJNIStaticMethodInfo(methodInfo, "playEffect", "(Ljava/lang/String;ZFFF)I")) {
return ret;
}
jstring stringArg = methodInfo.env->NewStringUTF(fullPath.c_str());
ret = methodInfo.env->CallStaticIntMethod(methodInfo.classID,
methodInfo.methodID,
stringArg,
loop,
pitch, pan, gain);
methodInfo.env->DeleteLocalRef(stringArg);
methodInfo.env->DeleteLocalRef(methodInfo.classID);
return (unsigned int)ret;
}
static void _jni_pauseEffect(unsigned int soundId) {
cocos2d::JniMethodInfo methodInfo;
if (!getJNIStaticMethodInfo(methodInfo, "pauseEffect", "(I)V")) {
return;
}
methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID, (int)soundId);
methodInfo.env->DeleteLocalRef(methodInfo.classID);
}
static void _jni_pauseAllEffects() {
cocos2d::JniMethodInfo methodInfo;
if (!getJNIStaticMethodInfo(methodInfo, "pauseAllEffects", "()V")) {
return;
}
methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID);
methodInfo.env->DeleteLocalRef(methodInfo.classID);
}
static void _jni_resumeEffect(unsigned int soundId) {
cocos2d::JniMethodInfo methodInfo;
if (!getJNIStaticMethodInfo(methodInfo, "resumeEffect", "(I)V")) {
return;
}
methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID, (int)soundId);
methodInfo.env->DeleteLocalRef(methodInfo.classID);
}
static void _jni_resumeAllEffects() {
cocos2d::JniMethodInfo methodInfo;
if (!getJNIStaticMethodInfo(methodInfo, "resumeAllEffects", "()V")) {
return;
}
methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID);
methodInfo.env->DeleteLocalRef(methodInfo.classID);
}
static void _jni_stopEffect(unsigned int soundId) {
cocos2d::JniMethodInfo methodInfo;
if (!getJNIStaticMethodInfo(methodInfo, "stopEffect", "(I)V")) {
return;
}
methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID, (int)soundId);
methodInfo.env->DeleteLocalRef(methodInfo.classID);
}
static void _jni_stopAllEffects() {
cocos2d::JniMethodInfo methodInfo;
if (!getJNIStaticMethodInfo(methodInfo, "stopAllEffects", "()V")) {
return;
}
methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID);
methodInfo.env->DeleteLocalRef(methodInfo.classID);
}
static void loadEffect(const char* filePath, char* loadEffectName) {
cocos2d::JniMethodInfo methodInfo;
std::string fullPath = CocosDenshion::android::getFullPathWithoutAssetsPrefix(filePath);
if (!cocos2d::JniHelper::getStaticMethodInfo(methodInfo, CLASS_NAME, loadEffectName, "(Ljava/lang/String;)V")) {
return;
}
jstring stringArg = methodInfo.env->NewStringUTF(fullPath.c_str());
methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID, stringArg);
methodInfo.env->DeleteLocalRef(stringArg);
methodInfo.env->DeleteLocalRef(methodInfo.classID);
}
static void _jni_preloadEffect(const char* filePath) {
loadEffect(filePath, "preloadEffect");
}
static void _jni_unloadEffect(const char* filePath) {
loadEffect(filePath, "unloadEffect");
}
float AndroidJavaEngine::getEffectsVolume()
{
if (_implementBaseOnAudioEngine)
@ -351,7 +124,7 @@ float AndroidJavaEngine::getEffectsVolume()
}
else
{
return _jni_getEffectsVolume();
return JniHelper::callStaticFloatMethod(helperClassName, "getEffectsVolume");
}
}
@ -379,7 +152,7 @@ void AndroidJavaEngine::setEffectsVolume(float volume)
}
else
{
_jni_setEffectsVolume(volume);
JniHelper::callStaticVoidMethod(helperClassName, "setEffectsVolume", volume);
}
}
@ -402,7 +175,9 @@ unsigned int AndroidJavaEngine::playEffect(const char* filePath, bool loop,
}
else
{
return _jni_playEffect(filePath, loop, pitch, pan, gain);
std::string fullPath = CocosDenshion::android::getFullPathWithoutAssetsPrefix(filePath);
int ret = JniHelper::callStaticIntMethod(helperClassName, "playEffect", fullPath, loop, pitch, pan, gain);
return (unsigned int)ret;
}
}
@ -414,7 +189,7 @@ void AndroidJavaEngine::pauseEffect(unsigned int soundID)
}
else
{
_jni_pauseEffect(soundID);
JniHelper::callStaticVoidMethod(helperClassName, "pauseEffect", (int)soundID);
}
}
@ -426,7 +201,7 @@ void AndroidJavaEngine::resumeEffect(unsigned int soundID)
}
else
{
_jni_resumeEffect(soundID);
JniHelper::callStaticVoidMethod(helperClassName, "resumeEffect", (int)soundID);
}
}
@ -439,7 +214,7 @@ void AndroidJavaEngine::stopEffect(unsigned int soundID)
}
else
{
_jni_stopEffect(soundID);
JniHelper::callStaticVoidMethod(helperClassName, "stopEffect", (int)soundID);
}
}
@ -454,7 +229,7 @@ void AndroidJavaEngine::pauseAllEffects()
}
else
{
_jni_pauseAllEffects();
JniHelper::callStaticVoidMethod(helperClassName, "pauseAllEffects");
}
}
@ -469,7 +244,7 @@ void AndroidJavaEngine::resumeAllEffects()
}
else
{
_jni_resumeAllEffects();
JniHelper::callStaticVoidMethod(helperClassName, "resumeAllEffects");
}
}
@ -485,7 +260,7 @@ void AndroidJavaEngine::stopAllEffects()
}
else
{
_jni_stopAllEffects();
JniHelper::callStaticVoidMethod(helperClassName, "stopAllEffects");
}
}
@ -493,7 +268,8 @@ void AndroidJavaEngine::preloadEffect(const char* filePath)
{
if (!_implementBaseOnAudioEngine)
{
_jni_preloadEffect(filePath);
std::string fullPath = CocosDenshion::android::getFullPathWithoutAssetsPrefix(filePath);
JniHelper::callStaticVoidMethod(helperClassName, "preloadEffect", fullPath);
}
}
@ -501,6 +277,7 @@ void AndroidJavaEngine::unloadEffect(const char* filePath)
{
if (!_implementBaseOnAudioEngine)
{
_jni_unloadEffect(filePath);
std::string fullPath = CocosDenshion::android::getFullPathWithoutAssetsPrefix(filePath);
JniHelper::callStaticVoidMethod(helperClassName, "unloadEffect", fullPath);
}
}

View File

@ -54,6 +54,8 @@ static ALCcontext *s_ALContext = nullptr;
@implementation AudioEngineSessionHandler
// only enable it on iOS. Disable it on tvOS
#if !defined(CC_TARGET_OS_TVOS)
void AudioEngineInterruptionListenerCallback(void* user_data, UInt32 interruption_state)
{
if (kAudioSessionBeginInterruption == interruption_state)
@ -68,6 +70,7 @@ void AudioEngineInterruptionListenerCallback(void* user_data, UInt32 interruptio
alcMakeContextCurrent(s_ALContext);
}
}
#endif
-(id) init
{
@ -77,9 +80,13 @@ void AudioEngineInterruptionListenerCallback(void* user_data, UInt32 interruptio
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleInterruption:) name:AVAudioSessionInterruptionNotification object:[AVAudioSession sharedInstance]];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleInterruption:) name:UIApplicationDidBecomeActiveNotification object:nil];
}
// only enable it on iOS. Disable it on tvOS
// AudioSessionInitialize removed from tvOS
#if !defined(CC_TARGET_OS_TVOS)
else {
AudioSessionInitialize(NULL, NULL, AudioEngineInterruptionListenerCallback, self);
}
#endif
}
return self;
}

View File

@ -146,7 +146,13 @@ typedef enum {
- Frameworks: OpenAL, AudioToolbox, AVFoundation
@since v0.8
*/
// AVAudioSessionDelegate not available on tvOS
#if defined(CC_TARGET_OS_TVOS)
@interface CDAudioManager : NSObject <CDLongAudioSourceDelegate, CDAudioInterruptProtocol> {
#else
@interface CDAudioManager : NSObject <CDLongAudioSourceDelegate, CDAudioInterruptProtocol, AVAudioSessionDelegate> {
#endif
CDSoundEngine *soundEngine;
CDLongAudioSource *backgroundMusic;
NSMutableArray *audioSourceChannels;

View File

@ -329,11 +329,17 @@ static BOOL configured = FALSE;
configured = TRUE;
}
-(BOOL) isOtherAudioPlaying {
-(BOOL) isOtherAudioPlaying
{
// AudioSessionGetProperty removed from tvOS 9.1
#if defined(CC_TARGET_OS_TVOS)
return false;
#else
UInt32 isPlaying = 0;
UInt32 varSize = sizeof(isPlaying);
AudioSessionGetProperty (kAudioSessionProperty_OtherAudioIsPlaying, &varSize, &isPlaying);
return (isPlaying != 0);
#endif
}
-(void) setMode:(tAudioManagerMode) mode {
@ -410,9 +416,12 @@ static BOOL configured = FALSE;
- (id) init: (tAudioManagerMode) mode {
if ((self = [super init])) {
// 'delegate' not supported on tvOS
#if !defined(CC_TARGET_OS_TVOS)
//Initialise the audio session
AVAudioSession* session = [AVAudioSession sharedInstance];
session.delegate = self;
#endif
_mode = mode;
backgroundMusicCompletionSelector = nil;
@ -482,7 +491,7 @@ static BOOL configured = FALSE;
//determine ringer switch state
-(BOOL) isDeviceMuted {
#if TARGET_IPHONE_SIMULATOR
#if TARGET_IPHONE_SIMULATOR || defined(CC_TARGET_OS_TVOS)
//Calling audio route stuff on the simulator causes problems
return NO;
#else

View File

@ -49,6 +49,8 @@ Configuration::Configuration()
, _supportsBGRA8888(false)
, _supportsDiscardFramebuffer(false)
, _supportsShareableVAO(false)
, _supportsOESDepth24(false)
, _supportsOESPackedDepthStencil(false)
, _maxSamplesAllowed(0)
, _maxTextureUnits(0)
, _glExtensions(nullptr)
@ -150,6 +152,14 @@ void Configuration::gatherGPUInfo()
_supportsShareableVAO = checkForGLExtension("vertex_array_object");
_valueDict["gl.supports_vertex_array_object"] = Value(_supportsShareableVAO);
_supportsOESDepth24 = checkForGLExtension("GL_OES_depth24");
_valueDict["gl.supports_OES_depth24"] = Value(_supportsOESDepth24);
_supportsOESPackedDepthStencil = checkForGLExtension("GL_OES_packed_depth_stencil");
_valueDict["gl.supports_OES_packed_depth_stencil"] = Value(_supportsOESPackedDepthStencil);
CHECK_GL_ERROR_DEBUG();
}
@ -259,6 +269,19 @@ bool Configuration::supportsShareableVAO() const
#endif
}
bool Configuration::supportsOESDepth24() const
{
return _supportsOESDepth24;
}
bool Configuration::supportsOESPackedDepthStencil() const
{
return _supportsOESPackedDepthStencil;
}
int Configuration::getMaxSupportDirLightInShader() const
{
return _maxDirLightInShader;

View File

@ -146,6 +146,22 @@ public:
*/
bool supportsShareableVAO() const;
/** Whether or not OES_depth24 is supported.
*
* @return Is true if supports OES_depth24.
* @since v2.0.0
*/
bool supportsOESDepth24() const;
/** Whether or not OES_Packed_depth_stencil is supported.
*
* @return Is true if supports OES_Packed_depth_stencil.
* @since v2.0.0
*/
bool supportsOESPackedDepthStencil() const;
/** Max support directional light in shader, for Sprite3D.
*
* @return Maximum supports directional light in shader.
@ -232,6 +248,9 @@ protected:
bool _supportsBGRA8888;
bool _supportsDiscardFramebuffer;
bool _supportsShareableVAO;
bool _supportsOESDepth24;
bool _supportsOESPackedDepthStencil;
GLint _maxSamplesAllowed;
GLint _maxTextureUnits;
char * _glExtensions;

View File

@ -155,14 +155,8 @@ Controller::Controller()
init();
}
void Controller::receiveExternalKeyEvent(int externalKeyCode,bool receive)
{
JniMethodInfo t;
if (JniHelper::getStaticMethodInfo(t, "org/cocos2dx/lib/GameControllerHelper", "receiveExternalKeyEvent", "(IIZ)V")) {
t.env->CallStaticVoidMethod(t.classID, t.methodID, _deviceId, externalKeyCode, receive);
t.env->DeleteLocalRef(t.classID);
}
void Controller::receiveExternalKeyEvent(int externalKeyCode,bool receive) {
JniHelper::callStaticVoidMethod("org/cocos2dx/lib/GameControllerHelper", "receiveExternalKeyEvent", _deviceId, externalKeyCode, receive);
}
NS_CC_END

View File

@ -267,6 +267,18 @@ public:
virtual void updateProjection() = 0;
};
/**
* interface for playable items
*/
class CC_DLL PlayableProtocol
{
public:
virtual ~PlayableProtocol(){}
virtual void start() = 0;
virtual void stop() = 0;
};
NS_CC_END
/// @endcond

View File

@ -34,10 +34,6 @@ THE SOFTWARE.
NS_CC_BEGIN
// EXPERIMENTAL: Enable this in order to get rid of retain/release
// when using the Garbage Collector
#define CC_ENABLE_GC_FOR_NATIVE_OBJECTS 0
#if CC_REF_LEAK_DETECTION
static void trackRef(Ref* ref);
static void untrackRef(Ref* ref);
@ -65,7 +61,7 @@ Ref::Ref()
Ref::~Ref()
{
#if CC_ENABLE_SCRIPT_BINDING && not CC_ENABLE_GC_FOR_NATIVE_OBJECTS
#if CC_ENABLE_SCRIPT_BINDING && !CC_ENABLE_GC_FOR_NATIVE_OBJECTS
// if the object is referenced by Lua engine, remove it
if (_luaID)
{

View File

@ -791,6 +791,9 @@ public:
It tells the Garbage Collector that the associated Scripting object can be collected
*/
virtual void unrootObject(Ref* obj) {}
/** Triggers the garbage collector */
virtual void garbageCollect() {}
};
class Node;

View File

@ -29,7 +29,7 @@ THE SOFTWARE.
#include "base/base64.h"
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
#include "platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.h"
#include "platform/android/jni/JniHelper.h"
// root name of xml
#define USERDEFAULT_ROOT_NAME "userDefaultRoot"
@ -43,8 +43,9 @@ THE SOFTWARE.
#include "tinyxml2.h"
#endif
using namespace std;
static const std::string helperClassName = "org/cocos2dx/lib/Cocos2dxHelper";
using namespace std;
NS_CC_BEGIN
/**
@ -191,7 +192,7 @@ bool UserDefault::getBoolForKey(const char* pKey, bool defaultValue)
}
#endif
return getBoolForKeyJNI(pKey, defaultValue);
return JniHelper::callStaticBooleanMethod(helperClassName, "getBoolForKey", pKey, defaultValue);
}
int UserDefault::getIntegerForKey(const char* pKey)
@ -227,7 +228,7 @@ int UserDefault::getIntegerForKey(const char* pKey, int defaultValue)
}
#endif
return getIntegerForKeyJNI(pKey, defaultValue);
return JniHelper::callStaticIntMethod(helperClassName, "getIntegerForKey", pKey, defaultValue);
}
float UserDefault::getFloatForKey(const char* pKey)
@ -263,7 +264,7 @@ float UserDefault::getFloatForKey(const char* pKey, float defaultValue)
}
#endif
return getFloatForKeyJNI(pKey, defaultValue);
return JniHelper::callStaticFloatMethod(helperClassName, "getFloatForKey", pKey, defaultValue);
}
double UserDefault::getDoubleForKey(const char* pKey)
@ -299,7 +300,7 @@ double UserDefault::getDoubleForKey(const char* pKey, double defaultValue)
}
#endif
return getDoubleForKeyJNI(pKey, defaultValue);
return JniHelper::callStaticDoubleMethod(helperClassName, "getDoubleForKey", pKey, defaultValue);
}
std::string UserDefault::getStringForKey(const char* pKey)
@ -335,7 +336,7 @@ string UserDefault::getStringForKey(const char* pKey, const std::string & defaul
}
#endif
return getStringForKeyJNI(pKey, defaultValue.c_str());
return JniHelper::callStaticStringMethod(helperClassName, "getStringForKey", pKey, defaultValue);
}
Data UserDefault::getDataForKey(const char* pKey)
@ -383,7 +384,7 @@ Data UserDefault::getDataForKey(const char* pKey, const Data& defaultValue)
char * encodedDefaultData = NULL;
unsigned int encodedDefaultDataLen = !defaultValue.isNull() ? base64Encode(defaultValue.getBytes(), defaultValue.getSize(), &encodedDefaultData) : 0;
string encodedStr = getStringForKeyJNI(pKey, encodedDefaultData);
string encodedStr = JniHelper::callStaticStringMethod(helperClassName, "getStringForKey", pKey, (const char*)encodedDefaultData);
if (encodedDefaultData)
free(encodedDefaultData);
@ -411,7 +412,7 @@ void UserDefault::setBoolForKey(const char* pKey, bool value)
deleteNodeByKey(pKey);
#endif
return setBoolForKeyJNI(pKey, value);
JniHelper::callStaticVoidMethod(helperClassName, "setBoolForKey", pKey, value);
}
void UserDefault::setIntegerForKey(const char* pKey, int value)
@ -420,7 +421,7 @@ void UserDefault::setIntegerForKey(const char* pKey, int value)
deleteNodeByKey(pKey);
#endif
return setIntegerForKeyJNI(pKey, value);
JniHelper::callStaticVoidMethod(helperClassName, "setIntegerForKey", pKey, value);
}
void UserDefault::setFloatForKey(const char* pKey, float value)
@ -429,7 +430,7 @@ void UserDefault::setFloatForKey(const char* pKey, float value)
deleteNodeByKey(pKey);
#endif
return setFloatForKeyJNI(pKey, value);
JniHelper::callStaticVoidMethod(helperClassName, "setFloatForKey", pKey, value);
}
void UserDefault::setDoubleForKey(const char* pKey, double value)
@ -438,7 +439,7 @@ void UserDefault::setDoubleForKey(const char* pKey, double value)
deleteNodeByKey(pKey);
#endif
return setDoubleForKeyJNI(pKey, value);
JniHelper::callStaticVoidMethod(helperClassName, "setDoubleForKey", pKey, value);
}
void UserDefault::setStringForKey(const char* pKey, const std::string& value)
@ -447,7 +448,7 @@ void UserDefault::setStringForKey(const char* pKey, const std::string & value)
deleteNodeByKey(pKey);
#endif
return setStringForKeyJNI(pKey, value.c_str());
JniHelper::callStaticVoidMethod(helperClassName, "setStringForKey", pKey, value);
}
void UserDefault::setDataForKey(const char* pKey, const Data& value)
@ -462,7 +463,7 @@ void UserDefault::setDataForKey(const char* pKey, const Data& value)
CCLOG("SET DATA ENCODED: --%s", encodedData);
setStringForKeyJNI(pKey, encodedData);
JniHelper::callStaticVoidMethod(helperClassName, "setStringForKey", pKey, (const char*)encodedData);
if (encodedData)
free(encodedData);
@ -498,7 +499,8 @@ void UserDefault::initXMLFilePath()
if (! _isFilePathInitialized)
{
// UserDefault.xml is stored in /data/data/<package-path>/ before v2.1.2
_filePath += "/data/data/" + getPackageNameJNI() + "/" + XML_FILE_NAME;
std::string packageName = JniHelper::callStaticStringMethod(helperClassName, "getCocos2dxPackageName");
_filePath += "/data/data/" + packageName + "/" + XML_FILE_NAME;
_isFilePathInitialized = true;
}
#endif
@ -527,7 +529,7 @@ void UserDefault::deleteValueForKey(const char* key)
CCLOG("the key is invalid");
}
deleteValueForKeyJNI(key);
JniHelper::callStaticVoidMethod(helperClassName, "deleteValueForKey", key);
flush();
}

View File

@ -329,14 +329,15 @@ THE SOFTWARE.
#define CC_ENABLE_SCRIPT_BINDING 1
#endif
/** @def CC_NATIVE_CONTROL_SCRIPT
* Indicate whether use script GC to control native object life cycle to get ride of retain/release usage
* False by default.
/** When CC_ENABLE_SCRIPT_BINDING and CC_ENABLE_GC_FOR_NATIVE_OBJECTS are both 1
then the Garbage collector will will release the native objects, only when the JS/Lua objets
are collected.
The benefit is that users don't need to retain/release the JS/Lua objects manually.
By default this behavior is disabled by default
*/
#if CC_ENABLE_SCRIPT_BINDING
#ifndef CC_ENABLE_GC_FOR_NATIVE_OBJECTS
#define CC_ENABLE_GC_FOR_NATIVE_OBJECTS 1
#endif
#define CC_ENABLE_GC_FOR_NATIVE_OBJECTS 0
#endif
/** @def CC_CONSTRUCTOR_ACCESS

View File

@ -441,4 +441,13 @@ void ActionTimeline::stepToFrame(int frameIndex)
}
}
void ActionTimeline::start()
{
gotoFrameAndPlay(0);
}
void ActionTimeline::stop()
{
pause();
}
NS_TIMELINE_END

View File

@ -26,6 +26,7 @@ THE SOFTWARE.
#define __CCTIMELINE_ACTION_H__
#include "CCTimeLine.h"
#include "base/CCProtocols.h"
#include "cocostudio/CocosStudioExport.h"
#include "2d/CCAction.h"
@ -70,7 +71,7 @@ protected:
};
class CC_STUDIO_DLL ActionTimeline : public cocos2d::Action
class CC_STUDIO_DLL ActionTimeline : public cocos2d::Action, public cocos2d::PlayableProtocol
{
public:
friend class Frame;
@ -196,6 +197,13 @@ public:
virtual void step(float delta) override;
virtual void startWithTarget(cocos2d::Node *target) override;
virtual bool isDone() const override { return false; }
/// @{
/// @name implement Playable Protocol
virtual void start() override;
virtual void stop() override;
/// @} end of PlaybleProtocol
protected:
virtual void gotoFrame(int frameIndex);
virtual void stepToFrame(int frameIndex);

View File

@ -59,7 +59,7 @@ static const char* Property_AnchorPoint = "AnchorPoint";
static const char* Property_ZOrder = "ZOrder";
static const char* Property_ActionValue = "ActionValue";
static const char* Property_BlendValue = "BlendFunc";
static const char* Property_PlayableAct = "PlayableAct";
static const char* ACTION = "action";
static const char* DURATION = "duration";
@ -479,7 +479,7 @@ inline ActionTimeline* ActionTimelineCache::createActionWithDataBuffer(const coc
auto timeLines = nodeAction->timeLines();
int timelineLength = timeLines->size();
std::multimap<std::string, cocostudio::timeline::Timeline*> properTimelineMap;// order the timelines depends property name
std::multimap<std::string,timeline::Timeline*> properTimelineMap;// order the timelines depends property name
for (int i = 0; i < timelineLength; i++)
{
auto timelineFlatBuf = timeLines->Get(i);

View File

@ -907,5 +907,47 @@ Frame* BlendFuncFrame::clone()
return frame;
}
//PlayableFrame
const std::string PlayableFrame::START_ACT = "start";
const std::string PlayableFrame::STOP_ACT = "stop";
const std::string PlayableFrame::PLAYABLE_EXTENTION = "playable_extension";
PlayableFrame* PlayableFrame::create()
{
auto frame = new (std::nothrow) PlayableFrame();
if(frame)
{
frame->autorelease();
return frame;
}
CC_SAFE_DELETE(frame);
return nullptr;
}
PlayableFrame::PlayableFrame()
: _playableAct("")
{
}
void PlayableFrame::onEnter(Frame *nextFrame, int currentFrameINdex)
{
auto playableNode = dynamic_cast<PlayableProtocol*>(_node);
if (nullptr == playableNode) // may be a playable component
playableNode = dynamic_cast<PlayableProtocol*>(_node->getComponent(PLAYABLE_EXTENTION));
if (nullptr == playableNode)
return;
if(_playableAct == START_ACT)
playableNode->start();
else if(_playableAct == STOP_ACT)
playableNode->stop();
}
Frame* PlayableFrame::clone()
{
PlayableFrame* frame = PlayableFrame::create();
frame->cloneProperty(this);
frame->setPlayableAct(_playableAct);
return frame;
}
NS_TIMELINE_END

View File

@ -413,7 +413,27 @@ public:
protected:
cocos2d::BlendFunc _blendFunc;
};
class CC_STUDIO_DLL PlayableFrame : public Frame
{
public:
static PlayableFrame* create();
PlayableFrame();
virtual void onEnter(Frame* nextFrame, int currentFrameINdex) override;
virtual Frame* clone() override;
inline std::string getPlayableAct() const { return _playableAct; }
// @param playact, express the interface in PlayableProtocol, should be "start" or "stop"
inline void setPlayableAct(std::string playact) { _playableAct = playact; }
static const std::string PLAYABLE_EXTENTION;
private:
std::string _playableAct; // express the interface in PlayableProtocol
static const std::string START_ACT;
static const std::string STOP_ACT;
};
NS_TIMELINE_END
#endif /*__CCFRAME_H__*/

View File

@ -1037,6 +1037,7 @@ Node* CSLoader::nodeWithFlatBuffers(const flatbuffers::NodeTree *nodetree, const
Component* component = reader->createComAudioWithFlatBuffers(options->data());
if (component)
{
component->setName(PlayableFrame::PLAYABLE_EXTENTION);
node->addComponent(component);
reader->setPropsWithFlatBuffers(node, options->data());
}

View File

@ -167,7 +167,7 @@ public:
/**
* Gets the ActionInterval of ActionFrame.
*
* @parame duration the duration time of ActionFrame
* @param duration the duration time of ActionFrame
*
* @return ActionInterval
*/
@ -175,9 +175,9 @@ public:
/**
* Gets the ActionInterval of ActionFrame.
*
* @parame duration the duration time of ActionFrame
* @param duration the duration time of ActionFrame
*
* @parame duration the source ActionFrame
* @param duration the source ActionFrame
*
* @return ActionInterval
*/
@ -186,7 +186,7 @@ public:
/**
*Set the ActionInterval easing parameter.
*
*@parame parameter the parameter for frame ease
*@param parameter the parameter for frame ease
*
*/
virtual void setEasingParameter(std::vector<float>& parameter);
@ -194,7 +194,7 @@ protected:
/**
* Gets the Easing Action of ActionFrame.
*
* @parame action the duration time of ActionFrame
* @param action the duration time of ActionFrame
*
* @return ActionInterval
*/
@ -242,7 +242,7 @@ public:
/**
* Gets the ActionInterval of ActionFrame.
*
* @parame duration the duration time of ActionFrame
* @param duration the duration time of ActionFrame
*
* @return ActionInterval
*/
@ -300,7 +300,7 @@ public:
/**
* Gets the ActionInterval of ActionFrame.
*
* @parame duration the duration time of ActionFrame
* @param duration the duration time of ActionFrame
*
* @return ActionInterval
*/
@ -344,7 +344,7 @@ public:
/**
* Gets the ActionInterval of ActionFrame.
*
* @parame duration the duration time of ActionFrame
* @param duration the duration time of ActionFrame
*
* @return ActionInterval
*/
@ -352,9 +352,9 @@ public:
/**
* Gets the ActionInterval of ActionFrame.
*
* @parame duration the duration time of ActionFrame
* @param duration the duration time of ActionFrame
*
* @parame duration the source ActionFrame
* @param duration the source ActionFrame
*
* @return ActionInterval
*/
@ -397,7 +397,7 @@ public:
/**
* Gets the ActionInterval of ActionFrame.
*
* @parame duration the duration time of ActionFrame
* @param duration the duration time of ActionFrame
*
* @return ActionInterval
*/
@ -441,7 +441,7 @@ public:
/**
* Gets the ActionInterval of ActionFrame.
*
* @parame duration the duration time of ActionFrame
* @param duration the duration time of ActionFrame
*
* @return ActionInterval
*/

View File

@ -109,7 +109,7 @@ public:
*/
ActionObject* stopActionByName(const char* jsonName,const char* actionName);
/*init properties with json dictionay*/
/*init properties with json dictionary*/
void initWithDictionary(const char* jsonName,const rapidjson::Value &dic, Ref* root);
void initWithBinary(const char* file, Ref* root, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode);

View File

@ -279,7 +279,7 @@ protected:
Armature *_armature; //! A weak reference of armature
std::string _movementID; //! Current movment's name
std::string _movementID; //! Current movement's name
int _toIndex; //! The frame index in MovementData->m_pMovFrameDataArr, it's different from m_iFrameIndex.

View File

@ -48,7 +48,7 @@ public:
/** @deprecated Use getInstance() instead */
CC_DEPRECATED_ATTRIBUTE static ArmatureDataManager *sharedArmatureDataManager() { return ArmatureDataManager::getInstance(); }
/** @deprecated Use destoryInstance() instead */
/** @deprecated Use destroyInstance() instead */
CC_DEPRECATED_ATTRIBUTE static void purge() { ArmatureDataManager::destroyInstance(); };
static ArmatureDataManager *getInstance();

View File

@ -107,7 +107,7 @@ public:
/**
* Set parent bone.
* If parent is NUll, then also remove this bone from armature.
* If parent is null, then also remove this bone from armature.
* It will not set the Armature, if you want to add the bone to a Armature, you should use Armature::addBone(Bone *bone, const char* parentName).
*
* @param parent the parent bone.

View File

@ -35,6 +35,7 @@ const std::string ComAudio::COMPONENT_NAME = "CCComAudio";
ComAudio::ComAudio()
: _filePath("")
, _loop(false)
, _startedSoundId(0)
{
_name = COMPONENT_NAME;
}
@ -321,4 +322,13 @@ bool ComAudio::isLoop()
return _loop;
}
void ComAudio::start()
{
_startedSoundId = playEffect();
}
void ComAudio::stop()
{
stopEffect(_startedSoundId);
}
}

View File

@ -26,12 +26,13 @@ THE SOFTWARE.
#define __CC_EXTENTIONS_CCCOMAUDIO_H__
#include "CCComBase.h"
#include "base/CCProtocols.h"
#include "2d/CCComponent.h"
#include "cocostudio/CocosStudioExport.h"
namespace cocostudio {
class CC_STUDIO_DLL ComAudio : public cocos2d::Component
class CC_STUDIO_DLL ComAudio : public cocos2d::Component, public cocos2d::PlayableProtocol
{
DECLARE_CLASS_COMPONENT_INFO
public:
@ -105,9 +106,20 @@ public:
const char* getFile();
void setLoop(bool bLoop);
bool isLoop();
/// @{
/// @name implement Playable Protocol
// play the effect sound path in _filePath
virtual void start() override;
// stop the effect sound which started with latest start()
virtual void stop() override;
/// @} end of PlaybleProtocol
private:
std::string _filePath;
bool _loop;
unsigned int _startedSoundId; // !playing sound id from start(), not playEffect
};
}

View File

@ -108,7 +108,7 @@ public:
/**
* x y skewX skewY scaleX scaleY used to calculate transform matrix
* skewX, skewY can have rotation effect
* To get more matrix information, you can have a look at this pape : http://www.senocular.com/flash/tutorials/transformmatrix/
* To get more matrix information, you can have a look at this paper : http://www.senocular.com/flash/tutorials/transformmatrix/
*/
float skewX;
float skewY;
@ -441,7 +441,7 @@ public:
cocos2d::tweenfunc::TweenType tweenEasing;
/**
* @brief save movment bone data
* @brief save movement bone data
* @key const std::string&
* @value MovementBoneData *
*/

View File

@ -51,7 +51,7 @@ public:
/**
* Use BoneData to init the display list.
* If display is a sprite, and it have texture info in the TexutreData, then use TexutreData to init the display's anchor point
* If display is a sprite, and it have texture info in the TextureData, then use TextureData to init the display's anchor point
* If the display is a Armature, then create a new Armature
*/
virtual void initDisplayList(BoneData *boneData);

View File

@ -134,7 +134,7 @@ protected:
Bone *_bone; //! A weak reference to the Bone
TweenType _frameTweenEasing; //! Dedermine which tween effect current frame use
TweenType _frameTweenEasing; //! Determine which tween effect current frame use
int _betweenDuration; //! Current key frame will last _betweenDuration frames
int _totalDuration;

View File

@ -560,7 +560,7 @@ Offset<NodeAction> FlatBuffersSerialize::createNodeAction(const tinyxml2::XMLEle
// ActionTimeline
const tinyxml2::XMLAttribute* attribute = objectData->FirstAttribute();
// attibutes
// attributes
while (attribute)
{
std::string name = attribute->Name();
@ -634,7 +634,7 @@ Offset<TimeLine> FlatBuffersSerialize::createTimeLine(const tinyxml2::XMLElement
int actionTag = 0;
std::string property = "";
// TimelineData attrsibutes
// TimelineData attributes
const tinyxml2::XMLAttribute* attribute = objectData->FirstAttribute();
while (attribute)
{

View File

@ -148,11 +148,11 @@ void NavMeshDebugDraw::drawImplement(const cocos2d::Mat4& transform, uint32_t fl
_dirtyBuffer = false;
}
for (auto &iter : _primitiveList){
if (iter->type == GL_POINTS)
continue;
_stateBlock->setDepthWrite(iter->depthMask);
if (iter->type == GL_POINTS){
//glPointSize(iter->size);
}
else if (iter->type == GL_LINES){
if (iter->type == GL_LINES){
glLineWidth(iter->size);
}
_stateBlock->bind();

View File

@ -46,7 +46,7 @@ namespace network {
/** Singleton that handles asynchrounous http requests.
/** Singleton that handles asynchronous http requests.
*
* Once the request completed, a callback will issued in main thread when it provided during make request.
*
@ -94,7 +94,7 @@ public:
void setSSLVerification(const std::string& caFile);
/**
* Get ths ssl CA filename
* Get the ssl CA filename
*
* @return the ssl CA filename
*/

View File

@ -101,8 +101,8 @@ public:
}
/**
* To see if the http reqeust is returned successfully.
* Althrough users can judge if (http response code = 200), we want an easier way.
* To see if the http request is returned successfully.
* Although users can judge if (http response code = 200), we want an easier way.
* If this getter returns false, you can call getResponseCode and getErrorBuffer to find more details.
* @return bool the flag that represent whether the http request return successfully or not.
*/
@ -228,7 +228,7 @@ protected:
// properties
HttpRequest* _pHttpRequest; /// the corresponding HttpRequest pointer who leads to this response
bool _succeed; /// to indecate if the http request is successful simply
bool _succeed; /// to indicate if the http request is successful simply
std::vector<char> _responseData; /// the returned raw data. You can also dump it as a string
std::vector<char> _responseHeader; /// the returned raw header data. You can also dump it as a string
long _responseCode; /// the status code returned from libcurl, e.g. 200, 404

View File

@ -213,7 +213,7 @@ private:
public:
/**
* Construtor of SIOClient class.
* Constructor of SIOClient class.
*
* @param host the string that represent the host address.
* @param port the int value represent the port number.
@ -223,7 +223,7 @@ public:
*/
SIOClient(const std::string& host, int port, const std::string& path, SIOClientImpl* impl, SocketIO::SIODelegate& delegate);
/**
* Destructior of SIOClient class.
* Destructor of SIOClient class.
*/
virtual ~SIOClient(void);

View File

@ -530,10 +530,11 @@ int WebSocket::onSocketCallback(struct libwebsocket_context *ctx,
std::lock_guard<std::mutex> lk(_wsHelper->_subThreadWsMessageQueueMutex);
std::list<WsMessage*>::iterator iter = _wsHelper->_subThreadWsMessageQueue->begin();
auto iter = _wsHelper->_subThreadWsMessageQueue->begin();
int bytesWrite = 0;
for (; iter != _wsHelper->_subThreadWsMessageQueue->end();)
//To avoid automatically disconnected on Android,send only one WsMessage at a time.
//for (; iter != _wsHelper->_subThreadWsMessageQueue->end();)
if (iter != _wsHelper->_subThreadWsMessageQueue->end())
{
WsMessage* subThreadMsg = *iter;
@ -546,8 +547,6 @@ int WebSocket::onSocketCallback(struct libwebsocket_context *ctx,
size_t remaining = data->len - data->issued;
size_t n = std::min(remaining, c_bufferSize );
//fixme: the log is not thread safe
// CCLOG("[websocket:send] total: %d, sent: %d, remaining: %d, buffer size: %d", static_cast<int>(data->len), static_cast<int>(data->issued), static_cast<int>(remaining), static_cast<int>(n));
unsigned char* buf = new (std::nothrow) unsigned char[LWS_SEND_BUFFER_PRE_PADDING + n + LWS_SEND_BUFFER_POST_PADDING];
@ -576,20 +575,18 @@ int WebSocket::onSocketCallback(struct libwebsocket_context *ctx,
writeProtocol |= LWS_WRITE_NO_FIN;
}
bytesWrite = libwebsocket_write(wsi, &buf[LWS_SEND_BUFFER_PRE_PADDING], n, (libwebsocket_write_protocol)writeProtocol);
//fixme: the log is not thread safe
// CCLOG("[websocket:send] bytesWrite => %d", bytesWrite);
auto bytesWrite = libwebsocket_write(wsi, &buf[LWS_SEND_BUFFER_PRE_PADDING], n, (libwebsocket_write_protocol)writeProtocol);
// Buffer overrun?
if (bytesWrite < 0)
{
break;
//break;
}
// Do we have another fragments to send?
else if (remaining != n)
{
data->issued += n;
break;
//break;
}
// Safely done!
else

View File

@ -59,7 +59,7 @@ class CC_DLL WebSocket
{
public:
/**
* Construtor of WebSocket.
* Constructor of WebSocket.
*
* @js ctor
*/

View File

@ -1189,6 +1189,11 @@ bool FileUtils::createDirectory(const std::string& path)
bool FileUtils::removeDirectory(const std::string& path)
{
// FIXME: Why using subclassing? an interface probably will be better
// to support different OS
// FileUtils::removeDirectory is subclassed on iOS/tvOS
// and system() is not available on tvOS
#if !defined(CC_PLATFORM_IOS)
if (path.size() > 0 && path[path.size() - 1] != '/')
{
CCLOGERROR("Fail to remove directory, path must terminate with '/': %s", path.c_str());
@ -1201,6 +1206,7 @@ bool FileUtils::removeDirectory(const std::string& path)
if (system(command.c_str()) >= 0)
return true;
else
#endif
return false;
}

View File

@ -2121,19 +2121,19 @@ bool Image::initWithWebpData(const unsigned char * data, ssize_t dataLen)
if (WebPGetFeatures(static_cast<const uint8_t*>(data), dataLen, &config.input) != VP8_STATUS_OK) break;
if (config.input.width == 0 || config.input.height == 0) break;
config.output.colorspace = MODE_RGBA;
_renderFormat = Texture2D::PixelFormat::RGBA8888;
config.output.colorspace = config.input.has_alpha?MODE_rgbA:MODE_RGB;
_renderFormat = config.input.has_alpha?Texture2D::PixelFormat::RGBA8888:Texture2D::PixelFormat::RGB888;
_width = config.input.width;
_height = config.input.height;
//webp doesn't have premultipliedAlpha
_hasPremultipliedAlpha = false;
//we ask webp to give data with premultiplied alpha
_hasPremultipliedAlpha = config.input.has_alpha;
_dataLen = _width * _height * 4;
_dataLen = _width * _height * (config.input.has_alpha?4:3);
_data = static_cast<unsigned char*>(malloc(_dataLen * sizeof(unsigned char)));
config.output.u.RGBA.rgba = static_cast<uint8_t*>(_data);
config.output.u.RGBA.stride = _width * 4;
config.output.u.RGBA.stride = _width * (config.input.has_alpha?4:3);
config.output.u.RGBA.size = _dataLen;
config.output.is_external_memory = 1;

View File

@ -62,12 +62,18 @@ THE SOFTWARE.
#define CC_TARGET_PLATFORM CC_PLATFORM_MAC
#endif
// iphone
// ios
#if defined(CC_TARGET_OS_IPHONE)
#undef CC_TARGET_PLATFORM
#define CC_TARGET_PLATFORM CC_PLATFORM_IOS
#endif
// tvOS
#if defined(CC_TARGET_OS_TVOS)
#undef CC_TARGET_PLATFORM
#define CC_TARGET_PLATFORM CC_PLATFORM_IOS
#endif
// android
#if defined(ANDROID)
#undef CC_TARGET_PLATFORM

View File

@ -49,8 +49,6 @@ set(COCOS_PLATFORM_SPECIFIC_SRC
platform/android/CCGLViewImpl-android.cpp
platform/android/CCFileUtils-android.cpp
platform/android/javaactivity-android.cpp
platform/android/jni/DPIJni.cpp
platform/android/jni/IMEJni.cpp
platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxAccelerometer.cpp
platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxBitmap.cpp
platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.cpp

View File

@ -14,8 +14,6 @@ CCGLViewImpl-android.cpp \
CCFileUtils-android.cpp \
javaactivity-android.cpp \
CCEnhanceAPI-android.cpp \
jni/DPIJni.cpp \
jni/IMEJni.cpp \
jni/Java_org_cocos2dx_lib_Cocos2dxAccelerometer.cpp \
jni/Java_org_cocos2dx_lib_Cocos2dxBitmap.cpp \
jni/Java_org_cocos2dx_lib_Cocos2dxHelper.cpp \

View File

@ -26,8 +26,7 @@ THE SOFTWARE.
#include "platform/CCPlatformConfig.h"
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
#include "jni/JniHelper.h"
#include "jni/Java_org_cocos2dx_lib_Cocos2dxHelper.h"
#include "platform/android/jni/JniHelper.h"
#include "CCApplication.h"
#include "base/CCDirector.h"
#include <android/log.h>
@ -45,6 +44,8 @@ extern "C" size_t __ctype_get_mb_cur_max(void) {
}
#endif
static const std::string helperClassName = "org/cocos2dx/lib/Cocos2dxHelper";
NS_CC_BEGIN
// sharedApplication pointer
@ -73,18 +74,8 @@ int Application::run()
return -1;
}
void Application::setAnimationInterval(float interval)
{
JniMethodInfo methodInfo;
if (! JniHelper::getStaticMethodInfo(methodInfo, "org/cocos2dx/lib/Cocos2dxRenderer", "setAnimationInterval",
"(F)V"))
{
CCLOG("%s %d: error to get methodInfo", __FILE__, __LINE__);
}
else
{
methodInfo.env->CallStaticVoidMethod(methodInfo.classID, methodInfo.methodID, interval);
}
void Application::setAnimationInterval(float interval) {
JniHelper::callStaticVoidMethod("org/cocos2dx/lib/Cocos2dxRenderer", "setAnimationInterval", interval);
}
//////////////////////////////////////////////////////////////////////////
@ -105,14 +96,15 @@ Application* Application::sharedApplication()
const char * Application::getCurrentLanguageCode()
{
static char code[3]={0};
strncpy(code,getCurrentLanguageJNI().c_str(),2);
std::string language = JniHelper::callStaticStringMethod(helperClassName, "getCurrentLanguage");
strncpy(code, language.c_str(), 2);
code[2]='\0';
return code;
}
LanguageType Application::getCurrentLanguage()
{
std::string languageName = getCurrentLanguageJNI();
std::string languageName = JniHelper::callStaticStringMethod(helperClassName, "getCurrentLanguage");
const char* pLanguageName = languageName.c_str();
LanguageType ret = LanguageType::ENGLISH;
@ -202,12 +194,12 @@ Application::Platform Application::getTargetPlatform()
std::string Application::getVersion()
{
return getVersionJNI();
return JniHelper::callStaticStringMethod(helperClassName, "getVersion");
}
bool Application::openURL(const std::string &url)
{
return openURLJNI(url.c_str());
return JniHelper::callStaticBooleanMethod(helperClassName, "openURL", url);
}
void Application::applicationScreenSizeChanged(int newWidth, int newHeight) {

View File

@ -27,7 +27,7 @@ THE SOFTWARE.
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
#include "platform/CCCommon.h"
#include "jni/Java_org_cocos2dx_lib_Cocos2dxHelper.h"
#include "platform/android/jni/JniHelper.h"
#include <android/log.h>
#include <stdio.h>
#include <jni.h>
@ -38,7 +38,7 @@ NS_CC_BEGIN
void MessageBox(const char * pszMsg, const char * pszTitle)
{
showDialogJNI(pszMsg, pszTitle);
JniHelper::callStaticVoidMethod("org/cocos2dx/lib/Cocos2dxHelper", "showDialog", pszMsg, pszTitle);
}
void LuaLog(const char * pszFormat)

View File

@ -31,11 +31,11 @@ THE SOFTWARE.
#include <android/log.h>
#include <jni.h>
#include "base/ccTypes.h"
#include "jni/DPIJni.h"
#include "jni/Java_org_cocos2dx_lib_Cocos2dxHelper.h"
#include "jni/JniHelper.h"
#include "platform/android/jni/JniHelper.h"
#include "platform/CCFileUtils.h"
static const std::string helperClassName = "org/cocos2dx/lib/Cocos2dxHelper";
NS_CC_BEGIN
int Device::getDPI()
@ -43,7 +43,7 @@ int Device::getDPI()
static int dpi = -1;
if (dpi == -1)
{
dpi = (int)getDPIJNI();
dpi = JniHelper::callStaticIntMethod(helperClassName, "getDPI");
}
return dpi;
}
@ -52,17 +52,17 @@ void Device::setAccelerometerEnabled(bool isEnabled)
{
if (isEnabled)
{
enableAccelerometerJni();
JniHelper::callStaticVoidMethod(helperClassName, "enableAccelerometer");
}
else
{
disableAccelerometerJni();
JniHelper::callStaticVoidMethod(helperClassName, "disableAccelerometer");
}
}
void Device::setAccelerometerInterval(float interval)
{
setAccelerometerIntervalJni(interval);
JniHelper::callStaticVoidMethod(helperClassName, "setAccelerometerInterval", interval);
}
class BitmapDC
@ -170,12 +170,12 @@ Data Device::getTextureDataForText(const char * text, const FontDefinition& text
void Device::setKeepScreenOn(bool value)
{
setKeepScreenOnJni(value);
JniHelper::callStaticVoidMethod(helperClassName, "setKeepScreenOn", value);
}
void Device::vibrate(float duration)
{
vibrateJni(duration);
JniHelper::callStaticVoidMethod(helperClassName, "vibrate", duration);
}
NS_CC_END

View File

@ -28,10 +28,10 @@ THE SOFTWARE.
#include "CCFileUtils-android.h"
#include "platform/CCCommon.h"
#include "jni/Java_org_cocos2dx_lib_Cocos2dxHelper.h"
#include "platform/android/jni/JniHelper.h"
#include "platform/android/jni/CocosPlayClient.h"
#include "android/asset_manager.h"
#include "android/asset_manager_jni.h"
#include "jni/CocosPlayClient.h"
#include <stdlib.h>
#include <sys/stat.h>
@ -471,7 +471,7 @@ string FileUtilsAndroid::getWritablePath() const
// Fix for Nexus 10 (Android 4.2 multi-user environment)
// the path is retrieved through Java Context.getCacheDir() method
string dir("");
string tmp = getFileDirectoryJNI();
string tmp = JniHelper::callStaticStringMethod("org/cocos2dx/lib/Cocos2dxHelper", "getCocos2dxWritablePath");
if (tmp.length() > 0)
{

View File

@ -29,9 +29,7 @@ THE SOFTWARE.
#include "CCGLViewImpl-android.h"
#include "base/CCDirector.h"
#include "base/ccMacros.h"
#include "jni/IMEJni.h"
#include "jni/JniHelper.h"
#include "jni/Java_org_cocos2dx_lib_Cocos2dxHelper.h"
#include "platform/android/jni/JniHelper.h"
#include "CCGL.h"
#include <stdlib.h>
@ -112,7 +110,7 @@ bool GLViewImpl::isOpenGLReady()
void GLViewImpl::end()
{
terminateProcessJNI();
JniHelper::callStaticVoidMethod("org/cocos2dx/lib/Cocos2dxHelper", "terminateProcess");
}
void GLViewImpl::swapBuffers()
@ -121,7 +119,11 @@ void GLViewImpl::swapBuffers()
void GLViewImpl::setIMEKeyboardState(bool bOpen)
{
setKeyboardStateJNI((int)bOpen);
if (bOpen) {
JniHelper::callStaticVoidMethod("org/cocos2dx/lib/Cocos2dxGLSurfaceView", "openIMEKeyboard");
} else {
JniHelper::callStaticVoidMethod("org/cocos2dx/lib/Cocos2dxGLSurfaceView", "closeIMEKeyboard");
}
}
NS_CC_END

View File

@ -1,19 +0,0 @@
#include "DPIJni.h"
#include "jni/JniHelper.h"
USING_NS_CC;
extern "C" {
int getDPIJNI()
{
JniMethodInfo t;
jint ret = -1;
if (JniHelper::getStaticMethodInfo(t, "org/cocos2dx/lib/Cocos2dxHelper", "getDPI", "()I")) {
ret = t.env->CallStaticIntMethod(t.classID, t.methodID);
t.env->DeleteLocalRef(t.classID);
}
return ret;
}
} // extern "C"

View File

@ -1,10 +0,0 @@
#ifndef __DPIJNI_H__
#define __DPIJNI_H__
extern "C" {
int getDPIJNI();
} // extern "C"
#endif /* __DPIJNI_H__ */

View File

@ -1,61 +0,0 @@
/****************************************************************************
Copyright (c) 2011-2012 cocos2d-x.org
Copyright (c) 2013-2014 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.
****************************************************************************/
#include "IMEJni.h"
#include "base/CCIMEDispatcher.h"
#include "JniHelper.h"
#include <android/log.h>
#include <string.h>
#include <jni.h>
using namespace cocos2d;
extern "C" {
void setKeyboardStateJNI(int bOpen) {
if (bOpen) {
openKeyboardJNI();
} else {
closeKeyboardJNI();
}
}
void openKeyboardJNI() {
JniMethodInfo t;
if (JniHelper::getStaticMethodInfo(t, "org/cocos2dx/lib/Cocos2dxGLSurfaceView", "openIMEKeyboard", "()V")) {
t.env->CallStaticVoidMethod(t.classID, t.methodID);
t.env->DeleteLocalRef(t.classID);
}
}
void closeKeyboardJNI() {
JniMethodInfo t;
if (JniHelper::getStaticMethodInfo(t, "org/cocos2dx/lib/Cocos2dxGLSurfaceView", "closeIMEKeyboard", "()V")) {
t.env->CallStaticVoidMethod(t.classID, t.methodID);
t.env->DeleteLocalRef(t.classID);
}
}
}

View File

@ -1,34 +0,0 @@
/****************************************************************************
Copyright (c) 2011-2012 cocos2d-x.org
Copyright (c) 2013-2014 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.
****************************************************************************/
#ifndef __ANDROID_IME_JNI_H__
#define __ANDROID_IME_JNI_H__
extern "C" {
extern void setKeyboardStateJNI(int open);
extern void openKeyboardJNI();
extern void closeKeyboardJNI();
}
#endif // __ANDROID_IME_JNI_H__

View File

@ -23,48 +23,22 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "JniHelper.h"
#include "platform/android/jni/JniHelper.h"
#include <string.h>
#include "base/CCDirector.h"
#include "../CCApplication.h"
#include "platform/CCFileUtils.h"
#include <jni.h>
#include "base/ccUTF8.h"
static const std::string className = "org/cocos2dx/lib/Cocos2dxBitmap";
using namespace cocos2d;
int getFontSizeAccordingHeightJni(int height) {
int ret = 0;
JniMethodInfo t;
if (JniHelper::getStaticMethodInfo(t, "org/cocos2dx/lib/Cocos2dxBitmap", "getFontSizeAccordingHeight", "(I)I")) {
ret = t.env->CallStaticIntMethod(t.classID, t.methodID, height);
t.env->DeleteLocalRef(t.classID);
}
return ret;
return JniHelper::callStaticIntMethod(className, "getFontSizeAccordingHeight", height);
}
std::string getStringWithEllipsisJni(const char* text, float width, float fontSize) {
std::string ret;
JniMethodInfo t;
if (JniHelper::getStaticMethodInfo(t, "org/cocos2dx/lib/Cocos2dxBitmap", "getStringWithEllipsis", "(Ljava/lang/String;FF)Ljava/lang/String;")) {
jstring stringArg1;
if (!text) {
stringArg1 = t.env->NewStringUTF("");
} else {
stringArg1 = t.env->NewStringUTF(text);
}
jstring retFromJava = (jstring)t.env->CallStaticObjectMethod(t.classID, t.methodID, stringArg1, width, fontSize);
ret = cocos2d::StringUtils::getStringUTFCharsJNI(t.env, retFromJava);
t.env->DeleteLocalRef(stringArg1);
t.env->DeleteLocalRef(t.classID);
}
return ret;
return JniHelper::callStaticStringMethod(className, "getStringWithEllipsis", text, width, fontSize);
}

View File

@ -37,8 +37,7 @@ THE SOFTWARE.
#define LOG_TAG "Java_org_cocos2dx_lib_Cocos2dxHelper.cpp"
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)
#define CLASS_NAME "org/cocos2dx/lib/Cocos2dxHelper"
#define EDITBOX_CLASS_NAME "org/cocos2dx/lib/Cocos2dxEditBoxHelper"
static const std::string className = "org/cocos2dx/lib/Cocos2dxHelper";
static EditTextCallback s_editTextCallback = nullptr;
static void* s_ctx = nullptr;
@ -84,492 +83,15 @@ const char * getApkPath() {
return g_apkPath.c_str();
}
void showDialogJNI(const char * message, const char * title) {
if (!message) {
return;
}
JniMethodInfo t;
if (JniHelper::getStaticMethodInfo(t, CLASS_NAME, "showDialog", "(Ljava/lang/String;Ljava/lang/String;)V")) {
jstring stringArg1;
if (!title) {
stringArg1 = t.env->NewStringUTF("");
} else {
stringArg1 = t.env->NewStringUTF(title);
}
jstring stringArg2 = t.env->NewStringUTF(message);
t.env->CallStaticVoidMethod(t.classID, t.methodID, stringArg1, stringArg2);
t.env->DeleteLocalRef(stringArg1);
t.env->DeleteLocalRef(stringArg2);
t.env->DeleteLocalRef(t.classID);
}
}
void terminateProcessJNI() {
JniMethodInfo t;
if (JniHelper::getStaticMethodInfo(t, CLASS_NAME, "terminateProcess", "()V")) {
t.env->CallStaticVoidMethod(t.classID, t.methodID);
t.env->DeleteLocalRef(t.classID);
}
}
std::string getPackageNameJNI() {
JniMethodInfo t;
std::string ret("");
if (JniHelper::getStaticMethodInfo(t, CLASS_NAME, "getCocos2dxPackageName", "()Ljava/lang/String;")) {
jstring str = (jstring)t.env->CallStaticObjectMethod(t.classID, t.methodID);
t.env->DeleteLocalRef(t.classID);
ret = JniHelper::jstring2string(str);
t.env->DeleteLocalRef(str);
}
return ret;
}
std::string getFileDirectoryJNI() {
JniMethodInfo t;
std::string ret("");
if (JniHelper::getStaticMethodInfo(t, CLASS_NAME, "getCocos2dxWritablePath", "()Ljava/lang/String;")) {
jstring str = (jstring)t.env->CallStaticObjectMethod(t.classID, t.methodID);
t.env->DeleteLocalRef(t.classID);
ret = JniHelper::jstring2string(str);
t.env->DeleteLocalRef(str);
}
return ret;
}
std::string getCurrentLanguageJNI() {
JniMethodInfo t;
std::string ret("");
if (JniHelper::getStaticMethodInfo(t, CLASS_NAME, "getCurrentLanguage", "()Ljava/lang/String;")) {
jstring str = (jstring)t.env->CallStaticObjectMethod(t.classID, t.methodID);
t.env->DeleteLocalRef(t.classID);
ret = JniHelper::jstring2string(str);
t.env->DeleteLocalRef(str);
}
return ret;
}
void enableAccelerometerJni() {
JniMethodInfo t;
if (JniHelper::getStaticMethodInfo(t, CLASS_NAME, "enableAccelerometer", "()V")) {
t.env->CallStaticVoidMethod(t.classID, t.methodID);
t.env->DeleteLocalRef(t.classID);
}
}
void setAccelerometerIntervalJni(float interval) {
JniMethodInfo t;
if (JniHelper::getStaticMethodInfo(t, CLASS_NAME, "setAccelerometerInterval", "(F)V")) {
t.env->CallStaticVoidMethod(t.classID, t.methodID, interval);
t.env->DeleteLocalRef(t.classID);
}
}
void disableAccelerometerJni() {
JniMethodInfo t;
if (JniHelper::getStaticMethodInfo(t, CLASS_NAME, "disableAccelerometer", "()V")) {
t.env->CallStaticVoidMethod(t.classID, t.methodID);
t.env->DeleteLocalRef(t.classID);
}
}
void setKeepScreenOnJni(bool value) {
JniMethodInfo t;
if (JniHelper::getStaticMethodInfo(t, CLASS_NAME, "setKeepScreenOn", "(Z)V")) {
t.env->CallStaticVoidMethod(t.classID, t.methodID, value);
t.env->DeleteLocalRef(t.classID);
}
}
void vibrateJni(float duration) {
JniMethodInfo t;
if (JniHelper::getStaticMethodInfo(t, CLASS_NAME, "vibrate", "(F)V")) {
t.env->CallStaticVoidMethod(t.classID, t.methodID, duration);
t.env->DeleteLocalRef(t.classID);
}
}
std::string getVersionJNI() {
JniMethodInfo t;
std::string ret("");
if (JniHelper::getStaticMethodInfo(t, CLASS_NAME, "getVersion", "()Ljava/lang/String;")) {
jstring str = (jstring)t.env->CallStaticObjectMethod(t.classID, t.methodID);
t.env->DeleteLocalRef(t.classID);
ret = JniHelper::jstring2string(str);
t.env->DeleteLocalRef(str);
}
return ret;
}
extern bool openURLJNI(const char* url) {
JniMethodInfo t;
bool ret = false;
if (JniHelper::getStaticMethodInfo(t, CLASS_NAME, "openURL", "(Ljava/lang/String;)Z")) {
jstring stringArg = t.env->NewStringUTF(url);
ret = t.env->CallStaticBooleanMethod(t.classID, t.methodID, stringArg);
t.env->DeleteLocalRef(t.classID);
t.env->DeleteLocalRef(stringArg);
}
return ret;
}
// functions for UserDefault
bool getBoolForKeyJNI(const char* key, bool defaultValue)
{
JniMethodInfo t;
if (JniHelper::getStaticMethodInfo(t, CLASS_NAME, "getBoolForKey", "(Ljava/lang/String;Z)Z")) {
jstring stringArg = t.env->NewStringUTF(key);
jboolean ret = t.env->CallStaticBooleanMethod(t.classID, t.methodID, stringArg, defaultValue);
t.env->DeleteLocalRef(t.classID);
t.env->DeleteLocalRef(stringArg);
return ret;
}
return defaultValue;
}
int getIntegerForKeyJNI(const char* key, int defaultValue)
{
JniMethodInfo t;
if (JniHelper::getStaticMethodInfo(t, CLASS_NAME, "getIntegerForKey", "(Ljava/lang/String;I)I")) {
jstring stringArg = t.env->NewStringUTF(key);
jint ret = t.env->CallStaticIntMethod(t.classID, t.methodID, stringArg, defaultValue);
t.env->DeleteLocalRef(t.classID);
t.env->DeleteLocalRef(stringArg);
return ret;
}
return defaultValue;
}
float getFloatForKeyJNI(const char* key, float defaultValue)
{
JniMethodInfo t;
if (JniHelper::getStaticMethodInfo(t, CLASS_NAME, "getFloatForKey", "(Ljava/lang/String;F)F")) {
jstring stringArg = t.env->NewStringUTF(key);
jfloat ret = t.env->CallStaticFloatMethod(t.classID, t.methodID, stringArg, defaultValue);
t.env->DeleteLocalRef(t.classID);
t.env->DeleteLocalRef(stringArg);
return ret;
}
return defaultValue;
}
double getDoubleForKeyJNI(const char* key, double defaultValue)
{
JniMethodInfo t;
if (JniHelper::getStaticMethodInfo(t, CLASS_NAME, "getDoubleForKey", "(Ljava/lang/String;D)D")) {
jstring stringArg = t.env->NewStringUTF(key);
jdouble ret = t.env->CallStaticDoubleMethod(t.classID, t.methodID, stringArg, defaultValue);
t.env->DeleteLocalRef(t.classID);
t.env->DeleteLocalRef(stringArg);
return ret;
}
return defaultValue;
}
std::string getStringForKeyJNI(const char* key, const char* defaultValue)
{
JniMethodInfo t;
std::string ret("");
if (JniHelper::getStaticMethodInfo(t, CLASS_NAME, "getStringForKey", "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;")) {
jstring stringArg1 = t.env->NewStringUTF(key);
jstring stringArg2 = t.env->NewStringUTF(defaultValue);
jstring str = (jstring)t.env->CallStaticObjectMethod(t.classID, t.methodID, stringArg1, stringArg2);
ret = JniHelper::jstring2string(str);
t.env->DeleteLocalRef(t.classID);
t.env->DeleteLocalRef(stringArg1);
t.env->DeleteLocalRef(stringArg2);
t.env->DeleteLocalRef(str);
return ret;
}
return defaultValue;
}
void setBoolForKeyJNI(const char* key, bool value)
{
JniMethodInfo t;
if (JniHelper::getStaticMethodInfo(t, CLASS_NAME, "setBoolForKey", "(Ljava/lang/String;Z)V")) {
jstring stringArg = t.env->NewStringUTF(key);
t.env->CallStaticVoidMethod(t.classID, t.methodID, stringArg, value);
t.env->DeleteLocalRef(t.classID);
t.env->DeleteLocalRef(stringArg);
}
}
void setIntegerForKeyJNI(const char* key, int value)
{
JniMethodInfo t;
if (JniHelper::getStaticMethodInfo(t, CLASS_NAME, "setIntegerForKey", "(Ljava/lang/String;I)V")) {
jstring stringArg = t.env->NewStringUTF(key);
t.env->CallStaticVoidMethod(t.classID, t.methodID, stringArg, value);
t.env->DeleteLocalRef(t.classID);
t.env->DeleteLocalRef(stringArg);
}
}
void setFloatForKeyJNI(const char* key, float value)
{
JniMethodInfo t;
if (JniHelper::getStaticMethodInfo(t, CLASS_NAME, "setFloatForKey", "(Ljava/lang/String;F)V")) {
jstring stringArg = t.env->NewStringUTF(key);
t.env->CallStaticVoidMethod(t.classID, t.methodID, stringArg, value);
t.env->DeleteLocalRef(t.classID);
t.env->DeleteLocalRef(stringArg);
}
}
void setDoubleForKeyJNI(const char* key, double value)
{
JniMethodInfo t;
if (JniHelper::getStaticMethodInfo(t, CLASS_NAME, "setDoubleForKey", "(Ljava/lang/String;D)V")) {
jstring stringArg = t.env->NewStringUTF(key);
t.env->CallStaticVoidMethod(t.classID, t.methodID, stringArg, value);
t.env->DeleteLocalRef(t.classID);
t.env->DeleteLocalRef(stringArg);
}
}
void setStringForKeyJNI(const char* key, const char* value)
{
JniMethodInfo t;
if (JniHelper::getStaticMethodInfo(t, CLASS_NAME, "setStringForKey", "(Ljava/lang/String;Ljava/lang/String;)V")) {
jstring stringArg1 = t.env->NewStringUTF(key);
jstring stringArg2 = t.env->NewStringUTF(value);
t.env->CallStaticVoidMethod(t.classID, t.methodID, stringArg1, stringArg2);
t.env->DeleteLocalRef(t.classID);
t.env->DeleteLocalRef(stringArg1);
t.env->DeleteLocalRef(stringArg2);
}
}
void deleteValueForKeyJNI(const char* key)
{
JniMethodInfo t;
if (JniHelper::getStaticMethodInfo(t, CLASS_NAME, "deleteValueForKey", "(Ljava/lang/String;)V")) {
jstring stringArg1 = t.env->NewStringUTF(key);
t.env->CallStaticVoidMethod(t.classID, t.methodID, stringArg1);
t.env->DeleteLocalRef(t.classID);
t.env->DeleteLocalRef(stringArg1);
}
}
int addEditBoxJNI(int left, int top, int width, int height, float scaleX){
JniMethodInfo t;
int ret = -1;
if (JniHelper::getStaticMethodInfo(t, EDITBOX_CLASS_NAME, "createEditBox", "(IIIIF)I")) {
ret = t.env->CallStaticIntMethod(t.classID, t.methodID, left, top, width, height, scaleX);
t.env->DeleteLocalRef(t.classID);
}
return ret;
}
void removeEditBoxJNI(int index)
{
JniMethodInfo t;
if (JniHelper::getStaticMethodInfo(t, EDITBOX_CLASS_NAME, "removeEditBox", "(I)V")) {
t.env->CallStaticVoidMethod(t.classID, t.methodID, index);
t.env->DeleteLocalRef(t.classID);
}
}
void setEditBoxViewRectJNI(int index, int left, int top, int width, int height)
{
JniMethodInfo t;
if (JniHelper::getStaticMethodInfo(t, EDITBOX_CLASS_NAME, "setEditBoxViewRect", "(IIIII)V")) {
t.env->CallStaticVoidMethod(t.classID, t.methodID, index, left, top, width, height);
t.env->DeleteLocalRef(t.classID);
}
}
void setMaxLengthJNI(int index, int maxLength)
{
JniMethodInfo t;
if (JniHelper::getStaticMethodInfo(t, EDITBOX_CLASS_NAME, "setMaxLength", "(II)V")) {
t.env->CallStaticVoidMethod(t.classID, t.methodID, index, maxLength);
t.env->DeleteLocalRef(t.classID);
}
}
void openEditBoxKeyboardJNI(int index)
{
JniMethodInfo t;
if (JniHelper::getStaticMethodInfo(t, EDITBOX_CLASS_NAME, "openKeyboard", "(I)V")) {
t.env->CallStaticVoidMethod(t.classID, t.methodID, index);
t.env->DeleteLocalRef(t.classID);
}
}
void closeEditBoxKeyboardJNI(int index)
{
JniMethodInfo t;
if (JniHelper::getStaticMethodInfo(t, EDITBOX_CLASS_NAME, "closeKeyboard", "(I)V")) {
t.env->CallStaticVoidMethod(t.classID, t.methodID, index);
t.env->DeleteLocalRef(t.classID);
}
}
void setVisibleEditBoxJNI(int index, bool visibility)
{
JniMethodInfo t;
if (JniHelper::getStaticMethodInfo(t, EDITBOX_CLASS_NAME, "setVisible", "(IZ)V")) {
t.env->CallStaticVoidMethod(t.classID, t.methodID, index, visibility);
t.env->DeleteLocalRef(t.classID);
}
}
void setReturnTypeEditBoxJNI(int index, int returnType)
{
JniMethodInfo t;
if (JniHelper::getStaticMethodInfo(t, EDITBOX_CLASS_NAME, "setReturnType", "(II)V")) {
t.env->CallStaticVoidMethod(t.classID, t.methodID, index, returnType);
t.env->DeleteLocalRef(t.classID);
}
}
void setInputFlagEditBoxJNI(int index, int returnType)
{
JniMethodInfo t;
if (JniHelper::getStaticMethodInfo(t, EDITBOX_CLASS_NAME, "setInputFlag", "(II)V")) {
t.env->CallStaticVoidMethod(t.classID, t.methodID, index, returnType);
t.env->DeleteLocalRef(t.classID);
}
}
void setInputModeEditBoxJNI(int index, int inputMode)
{
JniMethodInfo t;
if (JniHelper::getStaticMethodInfo(t, EDITBOX_CLASS_NAME, "setInputMode", "(II)V")) {
t.env->CallStaticVoidMethod(t.classID, t.methodID, index, inputMode);
t.env->DeleteLocalRef(t.classID);
}
}
void setTextEditBoxJNI(int index, const char* text)
{
JniMethodInfo t;
if (JniHelper::getStaticMethodInfo(t, EDITBOX_CLASS_NAME, "setText", "(ILjava/lang/String;)V")) {
jstring stringText = StringUtils::newStringUTFJNI(t.env,text);
t.env->CallStaticVoidMethod(t.classID, t.methodID,index, stringText);
t.env->DeleteLocalRef(stringText);
t.env->DeleteLocalRef(t.classID);
}
}
void setFontEditBoxJNI(int index, const char* fontName, float fontSize)
{
JniMethodInfo t;
if (JniHelper::getStaticMethodInfo(t, EDITBOX_CLASS_NAME, "setFont", "(ILjava/lang/String;F)V")) {
jstring stringText = StringUtils::newStringUTFJNI(t.env,fontName);
t.env->CallStaticVoidMethod(t.classID, t.methodID,index, stringText, fontSize);
t.env->DeleteLocalRef(t.classID);
t.env->DeleteLocalRef(stringText);
}
}
void setFontColorEditBoxJNI(int index, int red, int green, int blue, int alpha)
{
JniMethodInfo t;
if (JniHelper::getStaticMethodInfo(t, EDITBOX_CLASS_NAME, "setFontColor", "(IIIII)V")) {
t.env->CallStaticVoidMethod(t.classID, t.methodID,index, red, green, blue, alpha);
t.env->DeleteLocalRef(t.classID);
}
}
void setPlaceHolderTextEditBoxJNI(int index, const char* text)
{
JniMethodInfo t;
if (JniHelper::getStaticMethodInfo(t, EDITBOX_CLASS_NAME, "setPlaceHolderText", "(ILjava/lang/String;)V")) {
jstring stringText = StringUtils::newStringUTFJNI(t.env,text);
t.env->CallStaticVoidMethod(t.classID, t.methodID,index, stringText);
t.env->DeleteLocalRef(t.classID);
t.env->DeleteLocalRef(stringText);
}
}
void setPlaceHolderTextColorEditBoxJNI(int index, int red, int green, int blue, int alpha)
{
JniMethodInfo t;
if (JniHelper::getStaticMethodInfo(t, EDITBOX_CLASS_NAME, "setPlaceHolderTextColor", "(IIIII)V")) {
t.env->CallStaticVoidMethod(t.classID, t.methodID,index, red, green, blue, alpha);
t.env->DeleteLocalRef(t.classID);
}
return JniHelper::callStaticStringMethod(className, "getCocos2dxPackageName");
}
void conversionEncodingJNI(const char* src, int byteSize, const char* fromCharset, char* dst, const char* newCharset)
{
JniMethodInfo methodInfo;
if (JniHelper::getStaticMethodInfo(methodInfo, CLASS_NAME, "conversionEncoding", "([BLjava/lang/String;Ljava/lang/String;)[B")) {
if (JniHelper::getStaticMethodInfo(methodInfo, className.c_str(), "conversionEncoding", "([BLjava/lang/String;Ljava/lang/String;)[B")) {
jbyteArray strArray = methodInfo.env->NewByteArray(byteSize);
methodInfo.env->SetByteArrayRegion(strArray, 0, byteSize, reinterpret_cast<const jbyte*>(src));

View File

@ -30,46 +30,7 @@ THE SOFTWARE.
typedef void (*EditTextCallback)(const char* text, void* ctx);
extern const char * getApkPath();
extern void showDialogJNI(const char * message, const char * title);
extern void terminateProcessJNI();
extern std::string getCurrentLanguageJNI();
extern std::string getPackageNameJNI();
extern std::string getFileDirectoryJNI();
extern void enableAccelerometerJni();
extern void disableAccelerometerJni();
extern void setAccelerometerIntervalJni(float interval);
extern void setKeepScreenOnJni(bool value);
extern void vibrateJni(float duration);
extern std::string getVersionJNI();
extern bool openURLJNI(const char* url);
// functions for UserDefault
extern bool getBoolForKeyJNI(const char* key, bool defaultValue);
extern int getIntegerForKeyJNI(const char* key, int defaultValue);
extern float getFloatForKeyJNI(const char* key, float defaultValue);
extern double getDoubleForKeyJNI(const char* key, double defaultValue);
extern std::string getStringForKeyJNI(const char* key, const char* defaultValue);
extern void setBoolForKeyJNI(const char* key, bool value);
extern void setIntegerForKeyJNI(const char* key, int value);
extern void setFloatForKeyJNI(const char* key, float value);
extern void setDoubleForKeyJNI(const char* key, double value);
extern void setStringForKeyJNI(const char* key, const char* value);
extern void deleteValueForKeyJNI(const char* key);
extern void conversionEncodingJNI(const char* src, int byteSize, const char* fromCharset, char* dst, const char* newCharset);
//Added for new Android EditBox
extern int addEditBoxJNI(int left, int top, int width, int height, float scaleX);
extern void removeEditBoxJNI(int index);
extern void setEditBoxViewRectJNI(int index, int left, int top, int width, int height);
extern void setMaxLengthJNI(int index, int maxLength);
extern void openEditBoxKeyboardJNI(int index);
extern void closeEditBoxKeyboardJNI(int index);
extern void setVisibleEditBoxJNI(int index, bool visibility);
extern void setReturnTypeEditBoxJNI(int index, int returnType);
extern void setInputFlagEditBoxJNI(int index, int inputFlag);
extern void setInputModeEditBoxJNI(int index, int inputMode);
extern void setTextEditBoxJNI(int index, const char* text);
extern void setFontEditBoxJNI(int index, const char* fontName, float fontSize);
extern void setFontColorEditBoxJNI(int index, int red, int green, int blue, int alpha);
extern void setPlaceHolderTextEditBoxJNI(int index, const char* text);
extern void setPlaceHolderTextColorEditBoxJNI(int index, int red, int green, int blue, int alpha);
#endif /* __Java_org_cocos2dx_lib_Cocos2dxHelper_H__ */

View File

@ -67,6 +67,7 @@ namespace cocos2d {
JavaVM* JniHelper::_psJavaVM = nullptr;
jmethodID JniHelper::loadclassMethod_methodID = nullptr;
jobject JniHelper::classloader = nullptr;
std::unordered_map<JNIEnv*, std::vector<jobject>> JniHelper::localRefs;
JavaVM* JniHelper::getJavaVM() {
pthread_t thisthread = pthread_self();
@ -275,4 +276,29 @@ namespace cocos2d {
return strValue;
}
jstring JniHelper::convert(cocos2d::JniMethodInfo& t, const char* x) {
jstring ret = cocos2d::StringUtils::newStringUTFJNI(t.env, x ? x : "");
localRefs[t.env].push_back(ret);
return ret;
}
jstring JniHelper::convert(cocos2d::JniMethodInfo& t, const std::string& x) {
return convert(t, x.c_str());
}
void JniHelper::deleteLocalRefs(JNIEnv* env) {
if (!env) {
return;
}
for (const auto& ref : localRefs[env]) {
env->DeleteLocalRef(ref);
}
localRefs[env].clear();
}
void JniHelper::reportError(const std::string& className, const std::string& methodName, const std::string& signature) {
LOGE("Failed to find static java method. Class name: %s, method name: %s, signature: %s ", className.c_str(), methodName.c_str(), signature.c_str());
}
} //namespace cocos2d

View File

@ -27,6 +27,8 @@ THE SOFTWARE.
#include <jni.h>
#include <string>
#include <vector>
#include <unordered_map>
#include "platform/CCPlatformMacros.h"
NS_CC_BEGIN
@ -60,6 +62,109 @@ public:
static jmethodID loadclassMethod_methodID;
static jobject classloader;
template <typename... Ts>
static void callStaticVoidMethod(const std::string& className,
const std::string& methodName,
Ts... xs) {
cocos2d::JniMethodInfo t;
std::string signature = "(" + std::string(getJNISignature(xs...)) + ")V";
if (cocos2d::JniHelper::getStaticMethodInfo(t, className.c_str(), methodName.c_str(), signature.c_str())) {
t.env->CallStaticVoidMethod(t.classID, t.methodID, convert(t, xs)...);
t.env->DeleteLocalRef(t.classID);
deleteLocalRefs(t.env);
} else {
reportError(className, methodName, signature);
}
}
template <typename... Ts>
static bool callStaticBooleanMethod(const std::string& className,
const std::string& methodName,
Ts... xs) {
jboolean jret = JNI_FALSE;
cocos2d::JniMethodInfo t;
std::string signature = "(" + std::string(getJNISignature(xs...)) + ")Z";
if (cocos2d::JniHelper::getStaticMethodInfo(t, className.c_str(), methodName.c_str(), signature.c_str())) {
jret = t.env->CallStaticBooleanMethod(t.classID, t.methodID, convert(t, xs)...);
t.env->DeleteLocalRef(t.classID);
deleteLocalRefs(t.env);
} else {
reportError(className, methodName, signature);
}
return (jret == JNI_TRUE);
}
template <typename... Ts>
static int callStaticIntMethod(const std::string& className,
const std::string& methodName,
Ts... xs) {
jint ret = 0;
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())) {
ret = t.env->CallStaticIntMethod(t.classID, t.methodID, convert(t, xs)...);
t.env->DeleteLocalRef(t.classID);
deleteLocalRefs(t.env);
} else {
reportError(className, methodName, signature);
}
return ret;
}
template <typename... Ts>
static float callStaticFloatMethod(const std::string& className,
const std::string& methodName,
Ts... xs) {
jfloat ret = 0.0;
cocos2d::JniMethodInfo t;
std::string signature = "(" + std::string(getJNISignature(xs...)) + ")F";
if (cocos2d::JniHelper::getStaticMethodInfo(t, className.c_str(), methodName.c_str(), signature.c_str())) {
ret = t.env->CallStaticFloatMethod(t.classID, t.methodID, convert(t, xs)...);
t.env->DeleteLocalRef(t.classID);
deleteLocalRefs(t.env);
} else {
reportError(className, methodName, signature);
}
return ret;
}
template <typename... Ts>
static double callStaticDoubleMethod(const std::string& className,
const std::string& methodName,
Ts... xs) {
jdouble ret = 0.0;
cocos2d::JniMethodInfo t;
std::string signature = "(" + std::string(getJNISignature(xs...)) + ")D";
if (cocos2d::JniHelper::getStaticMethodInfo(t, className.c_str(), methodName.c_str(), signature.c_str())) {
ret = t.env->CallStaticDoubleMethod(t.classID, t.methodID, convert(t, xs)...);
t.env->DeleteLocalRef(t.classID);
deleteLocalRefs(t.env);
} else {
reportError(className, methodName, signature);
}
return ret;
}
template <typename... Ts>
static std::string callStaticStringMethod(const std::string& className,
const std::string& methodName,
Ts... xs) {
std::string ret;
cocos2d::JniMethodInfo t;
std::string signature = "(" + std::string(getJNISignature(xs...)) + ")Ljava/lang/String;";
if (cocos2d::JniHelper::getStaticMethodInfo(t, className.c_str(), methodName.c_str(), signature.c_str())) {
jstring jret = (jstring)t.env->CallStaticObjectMethod(t.classID, t.methodID, convert(t, xs)...);
ret = cocos2d::JniHelper::jstring2string(jret);
t.env->DeleteLocalRef(t.classID);
t.env->DeleteLocalRef(jret);
deleteLocalRefs(t.env);
} else {
reportError(className, methodName, signature);
}
return ret;
}
private:
static JNIEnv* cacheEnv(JavaVM* jvm);
@ -69,6 +174,73 @@ private:
const char *paramCode);
static JavaVM* _psJavaVM;
static jstring convert(cocos2d::JniMethodInfo& t, const char* x);
static jstring convert(cocos2d::JniMethodInfo& t, const std::string& x);
template <typename T>
static T convert(cocos2d::JniMethodInfo&, T x) {
return x;
}
static std::unordered_map<JNIEnv*, std::vector<jobject>> localRefs;
static void deleteLocalRefs(JNIEnv* env);
static std::string getJNISignature() {
return "";
}
static std::string getJNISignature(bool) {
return "Z";
}
static std::string getJNISignature(char) {
return "C";
}
static std::string getJNISignature(short) {
return "S";
}
static std::string getJNISignature(int) {
return "I";
}
static std::string getJNISignature(long) {
return "J";
}
static std::string getJNISignature(float) {
return "F";
}
static std::string getJNISignature(double) {
return "D";
}
static std::string getJNISignature(const char*) {
return "Ljava/lang/String;";
}
static std::string getJNISignature(const std::string&) {
return "Ljava/lang/String;";
}
template <typename T>
static std::string getJNISignature(T x) {
// This template should never be instantiated
static_assert(sizeof(x) == 0, "Unsupported argument type");
return "";
}
template <typename T, typename... Ts>
static std::string getJNISignature(T x, Ts... xs) {
return getJNISignature(x) + getJNISignature(xs...);
}
static void reportError(const std::string& className, const std::string& methodName, const std::string& signature);
};
NS_CC_END

View File

@ -40,6 +40,9 @@ NS_CC_BEGIN
// ios no MessageBox, use log instead
void MessageBox(const char * msg, const char * title)
{
// only enable it on iOS.
// FIXME: Implement it for tvOS
#if !defined(CC_TARGET_OS_TVOS)
NSString * tmpTitle = (title) ? [NSString stringWithUTF8String : title] : nil;
NSString * tmpMsg = (msg) ? [NSString stringWithUTF8String : msg] : nil;
UIAlertView * messageBox = [[UIAlertView alloc] initWithTitle: tmpTitle
@ -49,6 +52,8 @@ void MessageBox(const char * msg, const char * title)
otherButtonTitles: nil];
[messageBox autorelease];
[messageBox show];
#endif
}
void LuaLog(const char * format)

View File

@ -35,7 +35,9 @@
#import <UIKit/UIKit.h>
// Accelerometer
#if !defined(CC_TARGET_OS_TVOS)
#import<CoreMotion/CoreMotion.h>
#endif
#import<CoreFoundation/CoreFoundation.h>
// Vibrate
@ -43,6 +45,7 @@
#define SENSOR_DELAY_GAME 0.02
#if !defined(CC_TARGET_OS_TVOS)
@interface CCAccelerometerDispatcher : NSObject<UIAccelerometerDelegate>
{
cocos2d::Acceleration *_acceleration;
@ -142,8 +145,9 @@ static CCAccelerometerDispatcher* s_pAccelerometerDispatcher;
auto dispatcher = cocos2d::Director::getInstance()->getEventDispatcher();
dispatcher->dispatchEvent(&event);
}
@end
#endif // !defined(CC_TARGET_OS_TVOS)
//
@ -173,16 +177,18 @@ int Device::getDPI()
}
void Device::setAccelerometerEnabled(bool isEnabled)
{
#if !defined(CC_TARGET_OS_TVOS)
[[CCAccelerometerDispatcher sharedAccelerometerDispatcher] setAccelerometerEnabled:isEnabled];
#endif
}
void Device::setAccelerometerInterval(float interval)
{
#if !defined(CC_TARGET_OS_TVOS)
[[CCAccelerometerDispatcher sharedAccelerometerDispatcher] setAccelerometerInterval:interval];
#endif
}
typedef struct
@ -234,9 +240,12 @@ static CGSize _calculateStringSize(NSString *str, id font, CGSize *constrainSize
NSDictionary *attibutes = @{NSFontAttributeName:font};
dim = [str boundingRectWithSize:textRect options:(NSStringDrawingOptions)(NSStringDrawingUsesLineFragmentOrigin) attributes:attibutes context:nil].size;
}
#if !defined(CC_TARGET_OS_TVOS)
// not available on tvOS, and tvOS version is >= 7.0
else {
dim = [str sizeWithFont:font constrainedToSize:textRect];
}
#endif
dim.width = ceilf(dim.width);
dim.height = ceilf(dim.height);
@ -421,6 +430,9 @@ static bool _initWithString(const char * text, cocos2d::Device::TextAlign align,
[paragraphStyle release];
}
#if !defined(CC_TARGET_OS_TVOS)
// not available on tvOS, and tvOS version is >= 7.0
else
{
CGContextSetRGBStrokeColor(context, info->strokeColorR, info->strokeColorG, info->strokeColorB, info->strokeColorA);
@ -429,12 +441,34 @@ static bool _initWithString(const char * text, cocos2d::Device::TextAlign align,
//original code that was not working in iOS 7
[str drawInRect: rect withFont:font lineBreakMode:NSLineBreakByWordWrapping alignment:nsAlign];
}
#endif
}
CGContextSetTextDrawingMode(context, kCGTextFill);
// actually draw the text in the context
if (s_isIOS7OrHigher)
{
NSMutableParagraphStyle* paragraphStyle = [[NSMutableParagraphStyle alloc] init];
paragraphStyle.lineBreakMode = NSLineBreakByWordWrapping;
paragraphStyle.alignment = nsAlign;
NSDictionary *attributes = @{ NSFontAttributeName: font,
NSParagraphStyleAttributeName: paragraphStyle,
NSForegroundColorAttributeName: [UIColor colorWithRed:info->tintColorR
green:info->tintColorG
blue:info->tintColorB
alpha:info->tintColorA]
};
[str drawInRect:rect withAttributes: attributes];
[paragraphStyle release];
}
#if !defined(CC_TARGET_OS_TVOS)
else
{
[str drawInRect: rect withFont:font lineBreakMode:NSLineBreakByWordWrapping alignment:nsAlign];
}
#endif
CGContextEndTransparencyLayer(context);

View File

@ -119,7 +119,7 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ (id) viewWithFrame:(CGRect)frame pixelFormat:(NSString*)format;
/** creates an initializes an CCEAGLView with a frame, a color buffer format, and a depth buffer format */
+ (id) viewWithFrame:(CGRect)frame pixelFormat:(NSString*)format depthFormat:(GLuint)depth;
/** creates an initializes an CCEAGLView with a frame, a color buffer format, a depth buffer format, a sharegroup, and multisamping */
/** creates an initializes an CCEAGLView with a frame, a color buffer format, a depth buffer format, a sharegroup, and multisampling */
+ (id) viewWithFrame:(CGRect)frame pixelFormat:(NSString*)format depthFormat:(GLuint)depth preserveBackbuffer:(BOOL)retained sharegroup:(EAGLSharegroup*)sharegroup multiSampling:(BOOL)multisampling numberOfSamples:(unsigned int)samples;
/** Initializes an CCEAGLView with a frame and 0-bit depth buffer, and a RGB565 color buffer */

View File

@ -738,8 +738,14 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
double aniDuration = [[info objectForKey:UIKeyboardAnimationDurationUserInfoKey] doubleValue];
CGSize viewSize = self.frame.size;
CGFloat tmp;
#if defined(CC_TARGET_OS_TVOS)
// statusBarOrientation not defined on tvOS, and also, orientation makes
// no sense on tvOS
begin.origin.y = viewSize.height - begin.origin.y - begin.size.height;
end.origin.y = viewSize.height - end.origin.y - end.size.height;
#else
CGFloat tmp;
switch (getFixedOrientation([[UIApplication sharedApplication] statusBarOrientation]))
{
case UIInterfaceOrientationPortrait:
@ -781,6 +787,7 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
default:
break;
}
#endif
auto glview = cocos2d::Director::getInstance()->getOpenGLView();
float scaleX = glview->getScaleX();
@ -828,7 +835,14 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
//CGSize screenSize = self.window.screen.bounds.size;
dispatcher->dispatchKeyboardDidShow(notiInfo);
caretRect_ = end;
caretRect_.origin.y = viewSize.height - (caretRect_.origin.y + caretRect_.size.height + [UIFont smallSystemFontSize]);
#if defined(CC_TARGET_OS_TVOS)
// smallSystemFontSize not available on TVOS
int fontSize = 12;
#else
int fontSize = [UIFont smallSystemFontSize];
#endif
caretRect_.origin.y = viewSize.height - (caretRect_.origin.y + caretRect_.size.height + fontSize);
caretRect_.size.height = 0;
isKeyboardShown_ = YES;
}
@ -844,6 +858,7 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
}
}
#if !defined(CC_TARGET_OS_TVOS)
UIInterfaceOrientation getFixedOrientation(UIInterfaceOrientation statusBarOrientation)
{
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
@ -852,6 +867,7 @@ UIInterfaceOrientation getFixedOrientation(UIInterfaceOrientation statusBarOrien
}
return statusBarOrientation;
}
#endif
-(void) doAnimationWhenKeyboardMoveWithDuration:(float)duration distance:(float)dis
{
@ -869,6 +885,9 @@ UIInterfaceOrientation getFixedOrientation(UIInterfaceOrientation statusBarOrien
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:
@ -890,6 +909,7 @@ UIInterfaceOrientation getFixedOrientation(UIInterfaceOrientation statusBarOrien
default:
break;
}
#endif
[UIView commitAnimations];
}

View File

@ -142,7 +142,10 @@ bool GLViewImpl::initWithRect(const std::string& viewName, Rect rect, float fram
multiSampling: NO
numberOfSamples: 0];
// Not available on tvOS
#if !defined(CC_TARGET_OS_TVOS)
[eaglview setMultipleTouchEnabled:YES];
#endif
_screenSize.width = _designResolutionSize.width = [eaglview getWidth];
_screenSize.height = _designResolutionSize.height = [eaglview getHeight];

View File

@ -63,17 +63,42 @@ typedef struct
unsigned char* data;
} tImageInfo;
static NSSize _calculateStringSize(NSString *str, id font, CGSize *constrainSize)
{
NSSize textRect = NSZeroSize;
textRect.width = constrainSize->width > 0 ? constrainSize->width
: 0x7fffffff;
textRect.height = constrainSize->height > 0 ? constrainSize->height
: 0x7fffffff;
NSSize dim;
NSDictionary *attibutes = @{NSFontAttributeName:font};
#ifdef __MAC_10_11
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_10_11
dim = [str boundingRectWithSize:textRect options:(NSStringDrawingOptions)(NSStringDrawingUsesLineFragmentOrigin) attributes:attibutes context:nil].size;
#else
dim = [str boundingRectWithSize:textRect options:(NSStringDrawingOptions)(NSStringDrawingUsesLineFragmentOrigin) attributes:attibutes].size;
#endif
#else
dim = [str boundingRectWithSize:textRect options:(NSStringDrawingOptions)(NSStringDrawingUsesLineFragmentOrigin) attributes:attibutes].size;
#endif
dim.width = ceilf(dim.width);
dim.height = ceilf(dim.height);
return dim;
}
static bool _initWithString(const char * text, Device::TextAlign align, const char * fontName, int size, tImageInfo* info, const Color3B* fontColor, int fontAlpha)
{
bool ret = false;
CCASSERT(text, "Invalid pText");
CCASSERT(info, "Invalid pInfo");
CCASSERT(text, "Invalid text");
CCASSERT(info, "Invalid info");
do {
NSString * string = [NSString stringWithUTF8String:text];
NSString * fntName = [NSString stringWithUTF8String:fontName];
fntName = [[fntName lastPathComponent] stringByDeletingPathExtension];
// font
@ -82,7 +107,6 @@ static bool _initWithString(const char * text, Device::TextAlign align, const ch
traits:NSUnboldFontMask | NSUnitalicFontMask
weight:0
size:size];
if (font == nil) {
font = [[NSFontManager sharedFontManager]
fontWithFamily:@"Arial"
@ -100,17 +124,23 @@ static bool _initWithString(const char * text, Device::TextAlign align, const ch
foregroundColor = [NSColor whiteColor];
}
// alignment, linebreak
// alignment
unsigned horiFlag = (int)align & 0x0f;
unsigned vertFlag = ((int)align >> 4) & 0x0f;
NSTextAlignment textAlign = (2 == horiFlag) ? NSRightTextAlignment
: (3 == horiFlag) ? NSCenterTextAlignment
: NSLeftTextAlignment;
NSTextAlignment textAlign = NSLeftTextAlignment;
switch (horiFlag) {
case 2:
textAlign = NSRightTextAlignment;
break;
case 3:
textAlign = NSCenterTextAlignment;
break;
default:
break;
}
NSMutableParagraphStyle *paragraphStyle = [[[NSMutableParagraphStyle alloc] init] autorelease];
[paragraphStyle setParagraphStyle:[NSParagraphStyle defaultParagraphStyle]];
[paragraphStyle setLineBreakMode:NSLineBreakByCharWrapping];
[paragraphStyle setLineBreakMode:NSLineBreakByWordWrapping];
[paragraphStyle setAlignment:textAlign];
// attribute
@ -118,53 +148,14 @@ static bool _initWithString(const char * text, Device::TextAlign align, const ch
foregroundColor,NSForegroundColorAttributeName,
font, NSFontAttributeName,
paragraphStyle, NSParagraphStyleAttributeName, nil];
// linebreak
if (info->width > 0) {
if ([string sizeWithAttributes:tokenAttributesDict].width > info->width) {
int nextLineTop = 0;
NSMutableString *lineBreak = [[[NSMutableString alloc] init] autorelease];
NSUInteger length = [string length];
NSRange range = NSMakeRange(0, 1);
NSSize textSize;
NSUInteger lastBreakLocation = 0;
NSUInteger insertCount = 0;
for (NSUInteger i = 0; i < length; i++) {
range.location = i;
NSString *character = [string substringWithRange:range];
[lineBreak appendString:character];
if ([@"!?.,-= " rangeOfString:character].location != NSNotFound) {
lastBreakLocation = i + insertCount;
}
textSize = [lineBreak sizeWithAttributes:tokenAttributesDict];
if ((int)textSize.width > info->width) {
if(lastBreakLocation > 0) {
[lineBreak insertString:@"\r" atIndex:lastBreakLocation];
lastBreakLocation = 0;
}
else {
[lineBreak insertString:@"\r" atIndex:[lineBreak length] - 1];
}
insertCount += 1;
nextLineTop += (int)textSize.height;
if(info->height > 0 && nextLineTop > (int)info->height)
break;
}
}
string = lineBreak;
}
}
NSAttributedString *stringWithAttributes =[[[NSAttributedString alloc] initWithString:string
attributes:tokenAttributesDict] autorelease];
NSSize realDimensions = [stringWithAttributes size];
CGSize dimensions = CGSizeMake(info->width, info->height);
NSSize realDimensions = _calculateStringSize(string, font, &dimensions);
// Mac crashes if the width or height is 0
CC_BREAK_IF(realDimensions.width <= 0 || realDimensions.height <= 0);
CGSize dimensions = CGSizeMake(info->width, info->height);
if(dimensions.width <= 0.f) {
dimensions.width = realDimensions.width;
}
@ -172,10 +163,6 @@ static bool _initWithString(const char * text, Device::TextAlign align, const ch
dimensions.height = realDimensions.height;
}
NSInteger POTWide = dimensions.width;
NSInteger POTHigh = dimensions.height;
unsigned char* data = nullptr;
//Alignment
CGFloat xPadding = 0;
switch (textAlign) {
@ -186,6 +173,7 @@ static bool _initWithString(const char * text, Device::TextAlign align, const ch
}
CGFloat yPadding = 0.f;
unsigned vertFlag = ((int)align >> 4) & 0x0f;
switch (vertFlag) {
// align to top
case 1: yPadding = dimensions.height - realDimensions.height; break;
@ -196,29 +184,23 @@ static bool _initWithString(const char * text, Device::TextAlign align, const ch
default: break;
}
NSInteger POTWide = dimensions.width;
NSInteger POTHigh = dimensions.height;
NSRect textRect = NSMakeRect(xPadding, POTHigh - dimensions.height + yPadding, realDimensions.width, realDimensions.height);
//Disable antialias
[[NSGraphicsContext currentContext] setShouldAntialias:NO];
NSImage *image = [[NSImage alloc] initWithSize:NSMakeSize(POTWide, POTHigh)];
[image lockFocus];
// patch for mac retina display and labelTTF
// patch for mac retina display and lableTTF
[[NSAffineTransform transform] set];
//[stringWithAttributes drawAtPoint:NSMakePoint(xPadding, offsetY)]; // draw at offset position
[stringWithAttributes drawInRect:textRect];
//[stringWithAttributes drawInRect:textRect withAttributes:tokenAttributesDict];
NSBitmapImageRep *bitmap = [[NSBitmapImageRep alloc] initWithFocusedViewRect:NSMakeRect (0.0f, 0.0f, POTWide, POTHigh)];
[image unlockFocus];
data = (unsigned char*) [bitmap bitmapData]; //Use the same buffer to improve the performance.
auto data = (unsigned char*) [bitmap bitmapData]; //Use the same buffer to improve the performance.
NSUInteger textureSize = POTWide * POTHigh * 4;
unsigned char* dataNew = (unsigned char*)malloc(sizeof(unsigned char) * textureSize);
auto dataNew = (unsigned char*)malloc(sizeof(unsigned char) * textureSize);
if (dataNew) {
memcpy(dataNew, data, textureSize);
// output params

View File

@ -10,6 +10,7 @@ const char* ccPositionTexture_GrayScale_frag = STRINGIFY(
\nvoid main(void)\n
\n{\n
\nvec4 c = texture2D(CC_Texture0, v_texCoord);\n
\n c = v_fragmentColor * c; \n
\ngl_FragColor.xyz = vec3(0.2126*c.r + 0.7152*c.g + 0.0722*c.b);\n
\ngl_FragColor.w = c.w;\n
\n}\n

View File

@ -4218,6 +4218,16 @@ str
*/
cc.SpriteFrame = {
/**
* @method setAnchorPoint
* @param {vec2_object} arg0
*/
setAnchorPoint : function (
vec2
)
{
},
/**
* @method setTexture
* @param {cc.Texture2D} arg0
@ -4418,6 +4428,26 @@ size
{
},
/**
* @method getAnchorPoint
* @return {vec2_object}
*/
getAnchorPoint : function (
)
{
return cc.Vec2;
},
/**
* @method hasAnchorPoint
* @return {bool}
*/
hasAnchorPoint : function (
)
{
return false;
},
/**
* @method getOffsetInPixels
* @return {vec2_object}

View File

@ -4899,6 +4899,14 @@ str
{
},
/**
* @method resetRender
*/
resetRender : function (
)
{
},
/**
* @method create
* @param {String} str

View File

@ -10457,6 +10457,26 @@ void js_register_cocos2dx_GLProgramState(JSContext *cx, JS::HandleObject global)
JSClass *jsb_cocos2d_SpriteFrame_class;
JSObject *jsb_cocos2d_SpriteFrame_prototype;
bool js_cocos2dx_SpriteFrame_setAnchorPoint(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::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_setAnchorPoint : Invalid Native Object");
if (argc == 1) {
cocos2d::Vec2 arg0;
ok &= jsval_to_vector2(cx, args.get(0), &arg0);
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_SpriteFrame_setAnchorPoint : Error processing arguments");
cobj->setAnchorPoint(arg0);
args.rval().setUndefined();
return true;
}
JS_ReportError(cx, "js_cocos2dx_SpriteFrame_setAnchorPoint : wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
}
bool js_cocos2dx_SpriteFrame_setTexture(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
@ -10901,6 +10921,42 @@ bool js_cocos2dx_SpriteFrame_setOriginalSizeInPixels(JSContext *cx, uint32_t arg
JS_ReportError(cx, "js_cocos2dx_SpriteFrame_setOriginalSizeInPixels : wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
}
bool js_cocos2dx_SpriteFrame_getAnchorPoint(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::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_getAnchorPoint : Invalid Native Object");
if (argc == 0) {
const cocos2d::Vec2& ret = cobj->getAnchorPoint();
jsval jsret = JSVAL_NULL;
jsret = vector2_to_jsval(cx, ret);
args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_SpriteFrame_getAnchorPoint : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_SpriteFrame_hasAnchorPoint(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::SpriteFrame* cobj = (cocos2d::SpriteFrame *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_SpriteFrame_hasAnchorPoint : Invalid Native Object");
if (argc == 0) {
bool ret = cobj->hasAnchorPoint();
jsval jsret = JSVAL_NULL;
jsret = BOOLEAN_TO_JSVAL(ret);
args.rval().set(jsret);
return true;
}
JS_ReportError(cx, "js_cocos2dx_SpriteFrame_hasAnchorPoint : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_SpriteFrame_getOffsetInPixels(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
@ -11097,6 +11153,7 @@ void js_register_cocos2dx_SpriteFrame(JSContext *cx, JS::HandleObject global) {
};
static JSFunctionSpec funcs[] = {
JS_FN("setAnchorPoint", js_cocos2dx_SpriteFrame_setAnchorPoint, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setTexture", js_cocos2dx_SpriteFrame_setTexture, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getTexture", js_cocos2dx_SpriteFrame_getTexture, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setOffsetInPixels", js_cocos2dx_SpriteFrame_setOffsetInPixels, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
@ -11115,6 +11172,8 @@ void js_register_cocos2dx_SpriteFrame(JSContext *cx, JS::HandleObject global) {
JS_FN("setRotated", js_cocos2dx_SpriteFrame_setRotated, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getOffset", js_cocos2dx_SpriteFrame_getOffset, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setOriginalSizeInPixels", js_cocos2dx_SpriteFrame_setOriginalSizeInPixels, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getAnchorPoint", js_cocos2dx_SpriteFrame_getAnchorPoint, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("hasAnchorPoint", js_cocos2dx_SpriteFrame_hasAnchorPoint, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getOffsetInPixels", js_cocos2dx_SpriteFrame_getOffsetInPixels, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("ctor", js_cocos2dx_SpriteFrame_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FS_END

View File

@ -558,6 +558,7 @@ bool js_cocos2dx_SpriteFrame_constructor(JSContext *cx, uint32_t argc, jsval *vp
void js_cocos2dx_SpriteFrame_finalize(JSContext *cx, JSObject *obj);
void js_register_cocos2dx_SpriteFrame(JSContext *cx, JS::HandleObject global);
void register_all_cocos2dx(JSContext* cx, JS::HandleObject obj);
bool js_cocos2dx_SpriteFrame_setAnchorPoint(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_SpriteFrame_setTexture(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_SpriteFrame_getTexture(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_SpriteFrame_setOffsetInPixels(JSContext *cx, uint32_t argc, jsval *vp);
@ -576,6 +577,8 @@ bool js_cocos2dx_SpriteFrame_isRotated(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_SpriteFrame_setRotated(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_SpriteFrame_getOffset(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_SpriteFrame_setOriginalSizeInPixels(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_SpriteFrame_getAnchorPoint(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_SpriteFrame_hasAnchorPoint(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_SpriteFrame_getOffsetInPixels(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_SpriteFrame_create(JSContext *cx, uint32_t argc, jsval *vp);
bool js_cocos2dx_SpriteFrame_createWithTexture(JSContext *cx, uint32_t argc, jsval *vp);

View File

@ -1,5 +1,5 @@
#include "jsb_cocos2dx_experimental_video_auto.hpp"
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) && !defined(CC_TARGET_OS_TVOS)
#include "cocos2d_specifics.hpp"
#include "UIVideoPlayer.h"
@ -363,4 +363,4 @@ void register_all_cocos2dx_experimental_video(JSContext* cx, JS::HandleObject ob
js_register_cocos2dx_experimental_video_VideoPlayer(cx, ns);
}
#endif //#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
#endif //#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) && !defined(CC_TARGET_OS_TVOS)

View File

@ -1,5 +1,5 @@
#include "base/ccConfig.h"
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) && !defined(CC_TARGET_OS_TVOS)
#ifndef __cocos2dx_experimental_video_h__
#define __cocos2dx_experimental_video_h__
@ -30,4 +30,4 @@ bool js_cocos2dx_experimental_video_VideoPlayer_create(JSContext *cx, uint32_t a
bool js_cocos2dx_experimental_video_VideoPlayer_VideoPlayer(JSContext *cx, uint32_t argc, jsval *vp);
#endif // __cocos2dx_experimental_video_h__
#endif //#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
#endif //#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) && !defined(CC_TARGET_OS_TVOS)

View File

@ -1,5 +1,5 @@
#include "jsb_cocos2dx_experimental_webView_auto.hpp"
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) && !defined(CC_TARGET_OS_TVOS)
#include "cocos2d_specifics.hpp"
#include "UIWebView.h"
@ -426,4 +426,4 @@ void register_all_cocos2dx_experimental_webView(JSContext* cx, JS::HandleObject
js_register_cocos2dx_experimental_webView_WebView(cx, ns);
}
#endif //#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
#endif //#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) && !defined(CC_TARGET_OS_TVOS)

View File

@ -1,5 +1,5 @@
#include "base/ccConfig.h"
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) && !defined(CC_TARGET_OS_TVOS)
#ifndef __cocos2dx_experimental_webView_h__
#define __cocos2dx_experimental_webView_h__
@ -33,4 +33,4 @@ bool js_cocos2dx_experimental_webView_WebView_create(JSContext *cx, uint32_t arg
bool js_cocos2dx_experimental_webView_WebView_WebView(JSContext *cx, uint32_t argc, jsval *vp);
#endif // __cocos2dx_experimental_webView_h__
#endif //#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
#endif //#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS) && !defined(CC_TARGET_OS_TVOS)

View File

@ -11838,6 +11838,22 @@ bool js_cocos2dx_ui_TextBMFont_setFntFile(JSContext *cx, uint32_t argc, jsval *v
JS_ReportError(cx, "js_cocos2dx_ui_TextBMFont_setFntFile : wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
}
bool js_cocos2dx_ui_TextBMFont_resetRender(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::TextBMFont* cobj = (cocos2d::ui::TextBMFont *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_TextBMFont_resetRender : Invalid Native Object");
if (argc == 0) {
cobj->resetRender();
args.rval().setUndefined();
return true;
}
JS_ReportError(cx, "js_cocos2dx_ui_TextBMFont_resetRender : wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_ui_TextBMFont_create(JSContext *cx, uint32_t argc, jsval *vp)
{
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
@ -11936,6 +11952,7 @@ void js_register_cocos2dx_ui_TextBMFont(JSContext *cx, JS::HandleObject global)
JS_FN("setString", js_cocos2dx_ui_TextBMFont_setString, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("getRenderFile", js_cocos2dx_ui_TextBMFont_getRenderFile, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("setFntFile", js_cocos2dx_ui_TextBMFont_setFntFile, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("resetRender", js_cocos2dx_ui_TextBMFont_resetRender, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("ctor", js_cocos2dx_ui_TextBMFont_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FS_END
};

Some files were not shown because too many files have changed in this diff Show More