mirror of https://github.com/axmolengine/axmol.git
Merge branch 'v3' of https://github.com/cocos2d/cocos2d-x into v3
This commit is contained in:
commit
ca02f167c6
39
AUTHORS
39
AUTHORS
|
@ -9,10 +9,31 @@ Core Developers:
|
||||||
Zhe Wang (Walzer)
|
Zhe Wang (Walzer)
|
||||||
Qingkui Hu (samuele3hu)
|
Qingkui Hu (samuele3hu)
|
||||||
Huabing Xu (dabingnn)
|
Huabing Xu (dabingnn)
|
||||||
Bo Yu (boyu0)
|
|
||||||
Wenhai Lin (Dhilan007)
|
Wenhai Lin (Dhilan007)
|
||||||
Guanghui Qu (andyque)
|
Guanghui Qu (andyque)
|
||||||
|
Wensheng Yang (yangws)
|
||||||
|
Yulei Liao (dualface)
|
||||||
|
Huabin Ling (pandamicro)
|
||||||
|
Long Jiang (jianglong0156)
|
||||||
|
Sijie Fu (fusijie)
|
||||||
|
|
||||||
|
Framework & Tools Developers:
|
||||||
|
Bin Zhang (natural-law)
|
||||||
|
|
||||||
|
Web Developers:
|
||||||
|
Sijie Wang (VisualSJ)
|
||||||
|
|
||||||
|
3D Developers:
|
||||||
|
Xiao Yang (super626)
|
||||||
|
Yintao Hou (masterhou)
|
||||||
|
|
||||||
|
Editor Support Developers:
|
||||||
|
Cheng Zhang (chengstory)
|
||||||
|
Feng Xiao (xiaofeng11)
|
||||||
|
|
||||||
|
Windows Platforms Developers (Collaborators from Microsoft):
|
||||||
|
Dale Stammen (stammen)
|
||||||
|
Anniruddh (anniruddh)
|
||||||
|
|
||||||
Developers:
|
Developers:
|
||||||
Rolando Abarca
|
Rolando Abarca
|
||||||
|
@ -71,12 +92,14 @@ Developers:
|
||||||
|
|
||||||
stari4ek
|
stari4ek
|
||||||
Fix VideoPlayer on Android ignore search paths
|
Fix VideoPlayer on Android ignore search paths
|
||||||
|
Label: Improve rendering of letter's inner shapes when outline is used
|
||||||
|
|
||||||
FlagellumDei
|
FlagellumDei
|
||||||
Center the window correctly on windows
|
Center the window correctly on windows
|
||||||
|
|
||||||
ggggamer
|
ggggamer
|
||||||
fixed memory leak of preloadEffect on windows
|
fixed memory leak of preloadEffect on windows
|
||||||
|
Some small performance improvements
|
||||||
|
|
||||||
CodeSnooker
|
CodeSnooker
|
||||||
Added Method to create a CCMenuItemToggle from a CCArray with a target selector
|
Added Method to create a CCMenuItemToggle from a CCArray with a target selector
|
||||||
|
@ -377,6 +400,7 @@ Developers:
|
||||||
neokim
|
neokim
|
||||||
Adds 'setFont' and 'setAnchorPoint' to CCEditBox.
|
Adds 'setFont' and 'setAnchorPoint' to CCEditBox.
|
||||||
Workaround for some problems due to UITextField of CCEditBoxImplIOS is attached as a view above OpenGL view.
|
Workaround for some problems due to UITextField of CCEditBoxImplIOS is attached as a view above OpenGL view.
|
||||||
|
Enhance ScrollView with easing out scrolling.
|
||||||
|
|
||||||
Sam Clegg (sbc100)
|
Sam Clegg (sbc100)
|
||||||
Author of Native Client port.
|
Author of Native Client port.
|
||||||
|
@ -1134,6 +1158,17 @@ Developers:
|
||||||
namezero111111
|
namezero111111
|
||||||
ui: TextField add `getTextColor`, `getTextHorizontalAlignment` and `getTextVerticalAlignment` API
|
ui: TextField add `getTextColor`, `getTextHorizontalAlignment` and `getTextVerticalAlignment` API
|
||||||
|
|
||||||
|
shinhirota
|
||||||
|
JS: Fixed issue of iOS/JS reflection `callStaticMethod` with bool arg
|
||||||
|
|
||||||
|
oscr
|
||||||
|
Fix two issues with download-deps.py
|
||||||
|
Capitalize default option in download-deps.py
|
||||||
|
platform: Added debug flag -Wextra to linux CMakeFile
|
||||||
|
|
||||||
|
iris-wy
|
||||||
|
platform: Fixed warning "Service Intent must be explicit" on Android
|
||||||
|
|
||||||
Retired Core Developers:
|
Retired Core Developers:
|
||||||
WenSheng Yang
|
WenSheng Yang
|
||||||
Author of windows port, CCTextField,
|
Author of windows port, CCTextField,
|
||||||
|
@ -1146,6 +1181,8 @@ Retired Core Developers:
|
||||||
RongHong Huang (flyingpaper)
|
RongHong Huang (flyingpaper)
|
||||||
Author of cocos2d-xna and spent all his time on wp7.
|
Author of cocos2d-xna and spent all his time on wp7.
|
||||||
|
|
||||||
|
Bo Yu (boyu0)
|
||||||
|
|
||||||
Cocos2d-x can not grow so fast without the active community.
|
Cocos2d-x can not grow so fast without the active community.
|
||||||
Thanks to all developers who report & trace bugs, discuss the engine usage in forum & QQ groups!
|
Thanks to all developers who report & trace bugs, discuss the engine usage in forum & QQ groups!
|
||||||
Special thanks to Ricardo Quesada for giving us lots of guidances & suggestions.
|
Special thanks to Ricardo Quesada for giving us lots of guidances & suggestions.
|
||||||
|
|
134
CHANGELOG
134
CHANGELOG
|
@ -1,50 +1,94 @@
|
||||||
cocos2d-x-3.7 ??
|
cocos2d-x-3.8 ??
|
||||||
[NEW] android: Add Samsung API for cocos, please refer to the release note for more details.
|
[NEW] ui: Enhance ScrollView with easing out scrolling
|
||||||
[NEW] 3rd: updated rapidjson to v1.0.2
|
|
||||||
[NEW] 3d: added physics3d support
|
[FIX] renderer: UI component can't click correctly by moving UI and camera far away of origin.
|
||||||
[NEW] console: support build & run Android Studio project
|
[FIX] JS: Fixed issue of iOS/JS reflection `callStaticMethod` with bool arg
|
||||||
[NEW] C++: added ActionFloat
|
|
||||||
[NEW] C++: supported physical keyboard on WinRT
|
cocos2d-x-3.7rc0 July.1 2015
|
||||||
[NEW] C++: added Android Studio support
|
[HIGHLIGHT] core: Added Material system (JS/Lua ready)
|
||||||
|
[HIGHLIGHT] 3d: Added Physics3d support (JS/Lua ready)
|
||||||
|
[HIGHLIGHT] 3d: Added NavMesh support (JS/Lua ready)
|
||||||
|
[HIGHLIGHT] Scale9Sprite: Added Android 9-patch image support (JS/Lua ready)
|
||||||
|
[HIGHLIGHT] sprite: Supportted polygon sprite with AutoPolygon generator (JS/Lua ready)
|
||||||
|
[HIGHLIGHT] platform: Added Windows 10.0 Universal App(UWP) support
|
||||||
|
[HIGHLIGHT] platform: Add Samsung Enhanced API on Android for cocos, please refer to the release note for more details
|
||||||
|
[HIGHLIGHT] C++: Added Android Studio support
|
||||||
|
[HIGHLIGHT] JS: Merged JSB and web engine into Cocos2d-x for a All-in-one engine
|
||||||
|
[HIGHLIGHT] JS: Added `ccui.VideoPlayer` and `ccui.WebView` for iOS/Android/Web
|
||||||
|
[HIGHLIGHT] console: Supported build & run Android Studio project with cocos console
|
||||||
|
|
||||||
|
[NEW] C++: Added ActionFloat
|
||||||
|
[NEW] C++: Supported physical keyboard on WinRT
|
||||||
[NEW] FileUtils: checked filename case characters on windows
|
[NEW] FileUtils: checked filename case characters on windows
|
||||||
[NEW] FileUitls: added supporting loading files that which file path include utf-8 characters
|
[NEW] FileUitls: added supporting loading files that which file path include utf-8 characters
|
||||||
[NEW] PhysicsShape: added sensor property
|
[NEW] PhysicsShape: added sensor property
|
||||||
[NEW] Scale9Sprite: added Android 9-patch image support
|
|
||||||
[NEW] Sprite: used triangle command
|
[NEW] Sprite: used triangle command
|
||||||
[NEW] 3d: add `getFarPlane` and `getNearPlane` in `Camera` class
|
[NEW] 3d: Added `getFarPlane` and `getNearPlane` in `Camera` class
|
||||||
[NEW] 3d: add opengl version project/unproject function in camera.
|
[NEW] 3d: Added opengl version project/unproject function in camera
|
||||||
[NEW] ui: button add BMFont title support
|
[NEW] ui: button add BMFont title support
|
||||||
[NEW] ui: TextField add `getTextColor`, `getTextHorizontalAlignment` and `getTextVerticalAlignment` API
|
[NEW] ui: TextField add `getTextColor`, `getTextHorizontalAlignment` and `getTextVerticalAlignment` API
|
||||||
[NEW] ui: Reduce memory consumption of a few UI widgets.
|
[NEW] ui: Reduce memory consumption of a few UI widgets.
|
||||||
[NEW] audio: added support on WP8.1, now it supports wav format
|
[NEW] audio: added support on WP8.1, now it supports wav format
|
||||||
[NEW] audio: Added MP3 support to winrt audio
|
[NEW] audio: Added MP3 support to winrt audio
|
||||||
[NEW] audio: Added OGG support to winrt audio
|
[NEW] audio: Added OGG support to winrt audio
|
||||||
[NEW] win10: Added Windows 10.0 Universal App(UWP) support.
|
[NEW] 3rd: updated rapidjson to v1.0.2
|
||||||
|
[NEW] web: SIMD.js optimization for kazmath functions (from Intel)
|
||||||
|
[NEW] web: The json loader of Cocos Studio will automatically load dependencies resources
|
||||||
|
[NEW] Framework: Added Cocos Framework compilation script tool (used by Cocos)
|
||||||
|
[NEW] Simulator: Added Cocos Simulator project (used by Cocos)
|
||||||
|
|
||||||
[FIX] network: Win32 CURL doesn't support zlib.
|
[REFINE] core: Use quaternion instead of euler angle in `Camera::lookAt`
|
||||||
[FIX] studio: Fix ActionNode memory leaks.
|
[REFINE] platform: Differentiated Windows Phone Application and Windows Store Application with `Application::getTargetPlatform`
|
||||||
[FIX] studio: Fix CocoLoader destructor memory release bug.
|
[REFINE] platform: Improved UserDefault's robustness on Android, now the converting behavior is the same as iOS platform
|
||||||
[FIX] network: Fix memory leak of HttpClient on iOS and Mac platform.
|
[REFINE] platform: Added debug flag -Wextra to linux CMakeFile
|
||||||
[FIX] android: Improve UserDefault's robustness, now the converting behavior is the same as iOS platform.
|
[REFINE] audio: Permitted to play large ogg files on windows
|
||||||
[FIX] android: Fix VideoPlayer on Android ignore search paths.
|
[REFINE] ui: Use inch for childFocusCancelOffset in UIScrollView
|
||||||
|
[REFINE] 3d: Improved `Terrain::getIntersectionPoint` by calculating the intersection with triangles
|
||||||
|
[REFINE] Label: Improve rendering of letter's inner shapes when outline is used
|
||||||
|
[REFINE] console: Built engine with `LOCAL_ARM_MODE=arm` when building JS projects for android
|
||||||
|
[REFINE] web: Deleted the redundant variables defined and log informations in ccui.RichText
|
||||||
|
[REFINE] web: Allowed timeline animations with only one frame
|
||||||
|
[REFINE] web: Improved property declaration of cc.Texture2D
|
||||||
|
|
||||||
|
[FIX] core: Fixed `Director::setClearColor` has no effect bug
|
||||||
|
[FIX] platform: Fixed VideoPlayer on Android ignore search paths
|
||||||
|
[FIX] platform: Fixed crash while using s3tc on Nexus 9 (Android 5.0.1)
|
||||||
|
[FIX] platform: Fixed Application may be created more than once on Android
|
||||||
|
[FIX] platform: Fixed the Windows 8.1 Universal Apps crash when there is no audio device
|
||||||
|
[FIX] platform: Fixed android background and foreground switching bug with VertexAttributeBinding
|
||||||
|
[FIX] platform: Fixed warning "Service Intent must be explicit" on Android
|
||||||
|
[FIX] studio: Fixed ActionNode memory leaks
|
||||||
|
[FIX] studio: Fixed CocoLoader destructor memory release bug
|
||||||
|
[FIX] studio: Fixed cocos studio json reader's bug in percentage mode
|
||||||
|
[FIX] studio: Fixed rapidjson assert error in cocos studio module
|
||||||
|
[FIX] network: Win32 CURL doesn't support zlib
|
||||||
|
[FIX] network: Fixed memory leak of HttpClient on iOS and Mac platform
|
||||||
[FIX] audio: Fixed program may freeze if `AudioEngine::stop` or `AudioEngine::stopAll()` is invoked frequently on Android
|
[FIX] audio: Fixed program may freeze if `AudioEngine::stop` or `AudioEngine::stopAll()` is invoked frequently on Android
|
||||||
[FIX] audio: Fixed audio can't resume if it is interrupted by an incoming phone call.
|
[FIX] audio: Fixed a freezing crash in Windows 10 with the new audio engine when pressing stop after play
|
||||||
[FIX] audio: Fixed SimpleAudioEngine::playEffect() lagged on Android 5.0.x
|
[FIX] audio: Fixed audio can't resume if it is interrupted by an incoming phone call
|
||||||
[FIX] audio: can not play large ogg files on windows
|
[FIX] audio: Fixed `SimpleAudioEngine::playEffect` lagged on Android 5.0.x
|
||||||
[FIX] audio: Fixed thread safety problem on Android.
|
[FIX] audio: Fixed `SimpleAudioEngine` may cause application to crash on Android 5.0.x
|
||||||
[FIX] ui: Text scale factor is wrong with multiline text.
|
[FIX] audio: Fixed thread safety problem on Android
|
||||||
|
[FIX] audio: Added guard to audio engine pointer in `SimpleAudioEngine::end`
|
||||||
|
[FIX] ui: Text scale factor is wrong with multiline text
|
||||||
[FIX] 3d: skybox can't move to other position except origin point in world space
|
[FIX] 3d: skybox can't move to other position except origin point in world space
|
||||||
[FIX] 3d: terrain can't move to other position except origin point in world space
|
[FIX] 3d: terrain can't move to other position except origin point in world space
|
||||||
[FIX] 3rd: fix PIE link error on iOS caused by libpng and libtiff
|
[FIX] 3d: Fixed Terrain lod computing bugs
|
||||||
|
[FIX] 3d: Fixed clipping node not working for Sprite3D
|
||||||
|
[FIX] 3rd: Fixed PIE link error on iOS caused by libpng and libtiff
|
||||||
|
[FIX] 3rd: Fixed iOS libtiff 32bit header file error
|
||||||
[FIX] AssetsManager: crashed issue
|
[FIX] AssetsManager: crashed issue
|
||||||
[FIX] EaseRateAction: no way to create an `EaseRateAction` instance
|
[FIX] EaseRateAction: no way to create an `EaseRateAction` instance
|
||||||
[FIX] Label: Fixed compile error when enabling CC_ENABLE_BOX2D_INTEGRATION.
|
[FIX] Label: Fixed compile error when enabling CC_ENABLE_BOX2D_INTEGRATION
|
||||||
[FIX] Label: Improve rendering of letter's inner shapes when outline is used.
|
|
||||||
[FIX] Label: crashed if invoking `setString(text` after `getLetter(letterIndex)` and `letterIndex` is greater than the length of text
|
[FIX] Label: crashed if invoking `setString(text` after `getLetter(letterIndex)` and `letterIndex` is greater than the length of text
|
||||||
[FIX] Label: position is wrong if label content is changed after invoking `getLetter(letterIndex)`
|
[FIX] Label: position is wrong if label content is changed after invoking `getLetter(letterIndex)`
|
||||||
[FIX] Label: shadow effect cause OpenGL error on iOS
|
[FIX] Label: shadow effect cause OpenGL error on iOS
|
||||||
[FIX] Label: outline effect doesn't match characters well
|
[FIX] Label: outline effect doesn't match characters well
|
||||||
[FIX] Label: Fixed system font label line height calculation is wrong on Android.
|
[FIX] Label: Fixed system font label line height calculation is wrong on Android.
|
||||||
|
[FIX] Label: Fixed IllegalArgumentException on Android 2.3.x
|
||||||
|
[FIX] Label: Fixed line wrap error without space.
|
||||||
|
[FIX] Label: The texture of character have not cropped if character cross the axis-aligned bounding-box
|
||||||
|
[FIX] Label: Fixed the top of character's texture may be tailored if enable outline effect
|
||||||
[FIX] ProgressTimer: `setSprite()` doesn't take effect
|
[FIX] ProgressTimer: `setSprite()` doesn't take effect
|
||||||
[FIX] Sprite3D: setGLProgram() does not work
|
[FIX] Sprite3D: setGLProgram() does not work
|
||||||
[FIX] Sprite3D: transition breaks when there is a Sprite3D in the scene
|
[FIX] Sprite3D: transition breaks when there is a Sprite3D in the scene
|
||||||
|
@ -55,6 +99,44 @@ cocos2d-x-3.7 ??
|
||||||
[FIX] WebView: Fixed crash on Android
|
[FIX] WebView: Fixed crash on Android
|
||||||
[FIX] WebView: crashed if url contains illegal characters on Android
|
[FIX] WebView: crashed if url contains illegal characters on Android
|
||||||
[FIX] Lua: luaLoadChunksFromZip should just remove .lua or .luac extension
|
[FIX] Lua: luaLoadChunksFromZip should just remove .lua or .luac extension
|
||||||
|
[FIX] Lua: Added some skipped create functions for Sprite
|
||||||
|
[FIX] Lua: Fixed some lua test case bugs
|
||||||
|
[FIX] JS: Enabled touches support for Windows 8.1 platform
|
||||||
|
[FIX] JS: Fixed keyboard support for Windows Phone 8.1 platform
|
||||||
|
[FIX] web: Fixed positionType error of particle system in timeline parser
|
||||||
|
[FIX] web: Fixed setAnimationName issue while the property is undefined in timeline parser
|
||||||
|
[FIX] web: Fixed `cc.TMXObjectGroup#objectNamed` not returning the result bug
|
||||||
|
[FIX] web: Fixed TransitionSlideX callback sequence issue
|
||||||
|
[FIX] web: Fixed issue in music end event
|
||||||
|
[FIX] web: Fixed bug that LayerColor's color will disappear when update transform after being baked
|
||||||
|
[FIX] web: Fixed `inverse` function bug of `cc.math.Matrix4`
|
||||||
|
[FIX] web: Fixed the webaudio's invalid loop attribute bug for chrome 42
|
||||||
|
[FIX] web: Fixed crash when character not found into BMP font
|
||||||
|
[FIX] web: Fixed spine's js parser issue by avoid NaN duration
|
||||||
|
[FIX] web: Fixed LabelTTF multiline detection
|
||||||
|
[FIX] web: Fixed issue in ccui.Widget#getScale
|
||||||
|
[FIX] web: Fixed texture is not updated in some cases
|
||||||
|
[FIX] web: PlayMusic should not use the search path (timeline 2.x)
|
||||||
|
[FIX] web: Fixed bug of loading path of resources
|
||||||
|
[FIX] web: Premultiply texture's alpha for png by default to fix Cocos Studio render issues
|
||||||
|
[FIX] web: Fixed cache update issue of Layout after bake
|
||||||
|
[FIX] web: Fixed isBaked returning undefined issue
|
||||||
|
[FIX] web: Made CCProgressTimerCanvasRenderCmd to properly show colorized sprites
|
||||||
|
[FIX] web: Fixed attributes being reset issue while baked cache canvas' size changed
|
||||||
|
[FIX] web: Fixed texture does not rotate bug of ccui.LoadingBar
|
||||||
|
[FIX] web: Fixed color not being set issue in timeline parser
|
||||||
|
[FIX] web: Fixed custom easing animation bug
|
||||||
|
[FIX] web: Fixed return empty texture2d bug when adding image with same url multiple times
|
||||||
|
[FIX] web: Fixed actiontimeline can not step to last frame issue when loop play
|
||||||
|
[FIX] web: Fixed the prompt can not be used in iOS wechat 6.2
|
||||||
|
[FIX] web: Fixed restoring of sprite's color issue
|
||||||
|
[FIX] web: Fixed Uint8Array initialize issue
|
||||||
|
[FIX] web: Fixed cc.TextFieldTTF Delegate memory leaks
|
||||||
|
[FIX] web: Fixed sorted result is wrong in cc.eventManager (_sortEventListenersOfSceneGraphPriorityDes)
|
||||||
|
[FIX] web: Fixed BinaryLoader issue on IE11
|
||||||
|
[FIX] web: Fixed the sprite's texture bug when frequently change the color
|
||||||
|
[FIX] web: Fixed an issue that action will result in automatic termination
|
||||||
|
[FIX] web: Fixed ScrollView initWithViewSize issue
|
||||||
|
|
||||||
cocos2d-x-3.6 Apr.30 2015
|
cocos2d-x-3.6 Apr.30 2015
|
||||||
[NEW] 3rd: update chipmunk to v 6.2.2 on Windows 8.1 Universal App
|
[NEW] 3rd: update chipmunk to v 6.2.2 on Windows 8.1 Universal App
|
||||||
|
|
|
@ -2009,6 +2009,14 @@
|
||||||
B29A7E3F19EE1B7700872B35 /* AnimationState.h in Headers */ = {isa = PBXBuildFile; fileRef = B29A7DC619EE1B7700872B35 /* AnimationState.h */; };
|
B29A7E3F19EE1B7700872B35 /* AnimationState.h in Headers */ = {isa = PBXBuildFile; fileRef = B29A7DC619EE1B7700872B35 /* AnimationState.h */; };
|
||||||
B29A7E4019EE1B7700872B35 /* AnimationState.h in Headers */ = {isa = PBXBuildFile; fileRef = B29A7DC619EE1B7700872B35 /* AnimationState.h */; };
|
B29A7E4019EE1B7700872B35 /* AnimationState.h in Headers */ = {isa = PBXBuildFile; fileRef = B29A7DC619EE1B7700872B35 /* AnimationState.h */; };
|
||||||
B2CC507C19776DD10041958E /* CCPhysicsJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46A170721807CE7A005B8026 /* CCPhysicsJoint.cpp */; };
|
B2CC507C19776DD10041958E /* CCPhysicsJoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46A170721807CE7A005B8026 /* CCPhysicsJoint.cpp */; };
|
||||||
|
B5CE6DBE1B3BF2B1002B0419 /* UIAbstractCheckButton.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B5CE6DBC1B3BF2B1002B0419 /* UIAbstractCheckButton.cpp */; };
|
||||||
|
B5CE6DBF1B3BF2B1002B0419 /* UIAbstractCheckButton.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B5CE6DBC1B3BF2B1002B0419 /* UIAbstractCheckButton.cpp */; };
|
||||||
|
B5CE6DC01B3BF2B1002B0419 /* UIAbstractCheckButton.h in Headers */ = {isa = PBXBuildFile; fileRef = B5CE6DBD1B3BF2B1002B0419 /* UIAbstractCheckButton.h */; };
|
||||||
|
B5CE6DC11B3BF2B1002B0419 /* UIAbstractCheckButton.h in Headers */ = {isa = PBXBuildFile; fileRef = B5CE6DBD1B3BF2B1002B0419 /* UIAbstractCheckButton.h */; };
|
||||||
|
B5CE6DC81B3C05BA002B0419 /* UIRadioButton.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B5CE6DC61B3C05BA002B0419 /* UIRadioButton.cpp */; };
|
||||||
|
B5CE6DC91B3C05BA002B0419 /* UIRadioButton.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B5CE6DC61B3C05BA002B0419 /* UIRadioButton.cpp */; };
|
||||||
|
B5CE6DCA1B3C05BA002B0419 /* UIRadioButton.h in Headers */ = {isa = PBXBuildFile; fileRef = B5CE6DC71B3C05BA002B0419 /* UIRadioButton.h */; };
|
||||||
|
B5CE6DCB1B3C05BA002B0419 /* UIRadioButton.h in Headers */ = {isa = PBXBuildFile; fileRef = B5CE6DC71B3C05BA002B0419 /* UIRadioButton.h */; };
|
||||||
B603F1A81AC8EA0900A9579C /* CCTerrain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B603F1A61AC8EA0900A9579C /* CCTerrain.cpp */; };
|
B603F1A81AC8EA0900A9579C /* CCTerrain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B603F1A61AC8EA0900A9579C /* CCTerrain.cpp */; };
|
||||||
B603F1A91AC8EA0900A9579C /* CCTerrain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B603F1A61AC8EA0900A9579C /* CCTerrain.cpp */; };
|
B603F1A91AC8EA0900A9579C /* CCTerrain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B603F1A61AC8EA0900A9579C /* CCTerrain.cpp */; };
|
||||||
B603F1AA1AC8EA0900A9579C /* CCTerrain.h in Headers */ = {isa = PBXBuildFile; fileRef = B603F1A71AC8EA0900A9579C /* CCTerrain.h */; };
|
B603F1AA1AC8EA0900A9579C /* CCTerrain.h in Headers */ = {isa = PBXBuildFile; fileRef = B603F1A71AC8EA0900A9579C /* CCTerrain.h */; };
|
||||||
|
@ -4692,6 +4700,10 @@
|
||||||
B29A7DC619EE1B7700872B35 /* AnimationState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AnimationState.h; sourceTree = "<group>"; };
|
B29A7DC619EE1B7700872B35 /* AnimationState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AnimationState.h; sourceTree = "<group>"; };
|
||||||
B3AF019E1842FBA400A98B85 /* b2MotorJoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2MotorJoint.cpp; sourceTree = "<group>"; };
|
B3AF019E1842FBA400A98B85 /* b2MotorJoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b2MotorJoint.cpp; sourceTree = "<group>"; };
|
||||||
B3AF019F1842FBA400A98B85 /* b2MotorJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2MotorJoint.h; sourceTree = "<group>"; };
|
B3AF019F1842FBA400A98B85 /* b2MotorJoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b2MotorJoint.h; sourceTree = "<group>"; };
|
||||||
|
B5CE6DBC1B3BF2B1002B0419 /* UIAbstractCheckButton.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIAbstractCheckButton.cpp; sourceTree = "<group>"; };
|
||||||
|
B5CE6DBD1B3BF2B1002B0419 /* UIAbstractCheckButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIAbstractCheckButton.h; sourceTree = "<group>"; };
|
||||||
|
B5CE6DC61B3C05BA002B0419 /* UIRadioButton.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIRadioButton.cpp; sourceTree = "<group>"; };
|
||||||
|
B5CE6DC71B3C05BA002B0419 /* UIRadioButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIRadioButton.h; sourceTree = "<group>"; };
|
||||||
B603F1A61AC8EA0900A9579C /* CCTerrain.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCTerrain.cpp; sourceTree = "<group>"; };
|
B603F1A61AC8EA0900A9579C /* CCTerrain.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCTerrain.cpp; sourceTree = "<group>"; };
|
||||||
B603F1A71AC8EA0900A9579C /* CCTerrain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCTerrain.h; sourceTree = "<group>"; };
|
B603F1A71AC8EA0900A9579C /* CCTerrain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCTerrain.h; sourceTree = "<group>"; };
|
||||||
B603F1B11AC8F1FD00A9579C /* ccShader_3D_Terrain.frag */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = ccShader_3D_Terrain.frag; sourceTree = "<group>"; };
|
B603F1B11AC8F1FD00A9579C /* ccShader_3D_Terrain.frag */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = ccShader_3D_Terrain.frag; sourceTree = "<group>"; };
|
||||||
|
@ -6841,8 +6853,12 @@
|
||||||
2905FA1218CF08D100240AA3 /* UITextField.h */,
|
2905FA1218CF08D100240AA3 /* UITextField.h */,
|
||||||
2905F9F018CF08D000240AA3 /* UIButton.cpp */,
|
2905F9F018CF08D000240AA3 /* UIButton.cpp */,
|
||||||
2905F9F118CF08D000240AA3 /* UIButton.h */,
|
2905F9F118CF08D000240AA3 /* UIButton.h */,
|
||||||
|
B5CE6DBC1B3BF2B1002B0419 /* UIAbstractCheckButton.cpp */,
|
||||||
|
B5CE6DBD1B3BF2B1002B0419 /* UIAbstractCheckButton.h */,
|
||||||
2905F9F218CF08D000240AA3 /* UICheckBox.cpp */,
|
2905F9F218CF08D000240AA3 /* UICheckBox.cpp */,
|
||||||
2905F9F318CF08D000240AA3 /* UICheckBox.h */,
|
2905F9F318CF08D000240AA3 /* UICheckBox.h */,
|
||||||
|
B5CE6DC61B3C05BA002B0419 /* UIRadioButton.cpp */,
|
||||||
|
B5CE6DC71B3C05BA002B0419 /* UIRadioButton.h */,
|
||||||
2905F9F618CF08D000240AA3 /* UIImageView.cpp */,
|
2905F9F618CF08D000240AA3 /* UIImageView.cpp */,
|
||||||
2905F9F718CF08D000240AA3 /* UIImageView.h */,
|
2905F9F718CF08D000240AA3 /* UIImageView.h */,
|
||||||
);
|
);
|
||||||
|
@ -9483,6 +9499,7 @@
|
||||||
50643BD419BFAECF00EF68ED /* CCGL.h in Headers */,
|
50643BD419BFAECF00EF68ED /* CCGL.h in Headers */,
|
||||||
15AE190C19AAD35000C27E9E /* CCDisplayFactory.h in Headers */,
|
15AE190C19AAD35000C27E9E /* CCDisplayFactory.h in Headers */,
|
||||||
15AE1A8B19AAD40300C27E9E /* b2PulleyJoint.h in Headers */,
|
15AE1A8B19AAD40300C27E9E /* b2PulleyJoint.h in Headers */,
|
||||||
|
B5CE6DCA1B3C05BA002B0419 /* UIRadioButton.h in Headers */,
|
||||||
15AE1A5119AAD40300C27E9E /* b2BlockAllocator.h in Headers */,
|
15AE1A5119AAD40300C27E9E /* b2BlockAllocator.h in Headers */,
|
||||||
15AE199119AAD37200C27E9E /* ImageViewReader.h in Headers */,
|
15AE199119AAD37200C27E9E /* ImageViewReader.h in Headers */,
|
||||||
B6CAB42B1AF9AA1A00B9B856 /* btRaycastVehicle.h in Headers */,
|
B6CAB42B1AF9AA1A00B9B856 /* btRaycastVehicle.h in Headers */,
|
||||||
|
@ -9763,6 +9780,7 @@
|
||||||
50ABBECD1925AB6F00A911A9 /* s3tc.h in Headers */,
|
50ABBECD1925AB6F00A911A9 /* s3tc.h in Headers */,
|
||||||
B6CAB3651AF9AA1A00B9B856 /* btContinuousConvexCollision.h in Headers */,
|
B6CAB3651AF9AA1A00B9B856 /* btContinuousConvexCollision.h in Headers */,
|
||||||
15AE1BD119AAE01E00C27E9E /* CCControlHuePicker.h in Headers */,
|
15AE1BD119AAE01E00C27E9E /* CCControlHuePicker.h in Headers */,
|
||||||
|
B5CE6DC01B3BF2B1002B0419 /* UIAbstractCheckButton.h in Headers */,
|
||||||
D0FD03571A3B51AA00825BB5 /* CCAllocatorMutex.h in Headers */,
|
D0FD03571A3B51AA00825BB5 /* CCAllocatorMutex.h in Headers */,
|
||||||
B6CAB36D1AF9AA1A00B9B856 /* btDiscreteCollisionDetectorInterface.h in Headers */,
|
B6CAB36D1AF9AA1A00B9B856 /* btDiscreteCollisionDetectorInterface.h in Headers */,
|
||||||
50ABBE771925AB6F00A911A9 /* CCEventListenerTouch.h in Headers */,
|
50ABBE771925AB6F00A911A9 /* CCEventListenerTouch.h in Headers */,
|
||||||
|
@ -9880,6 +9898,7 @@
|
||||||
ED74D76A1A5B8A2600157FD4 /* CCPhysicsHelper.h in Headers */,
|
ED74D76A1A5B8A2600157FD4 /* CCPhysicsHelper.h in Headers */,
|
||||||
5034CA40191D591100CE6051 /* ccShader_Position_uColor.vert in Headers */,
|
5034CA40191D591100CE6051 /* ccShader_Position_uColor.vert in Headers */,
|
||||||
B6DD2FD41B04825B00E47F5F /* DetourStatus.h in Headers */,
|
B6DD2FD41B04825B00E47F5F /* DetourStatus.h in Headers */,
|
||||||
|
B5CE6DCB1B3C05BA002B0419 /* UIRadioButton.h in Headers */,
|
||||||
B665E2891AA80A6500DDB1C5 /* CCPUDoStopSystemEventHandlerTranslator.h in Headers */,
|
B665E2891AA80A6500DDB1C5 /* CCPUDoStopSystemEventHandlerTranslator.h in Headers */,
|
||||||
15AE184719AAD2F700C27E9E /* CCSprite3DMaterial.h in Headers */,
|
15AE184719AAD2F700C27E9E /* CCSprite3DMaterial.h in Headers */,
|
||||||
B6DD2FC21B04825B00E47F5F /* DetourMath.h in Headers */,
|
B6DD2FC21B04825B00E47F5F /* DetourMath.h in Headers */,
|
||||||
|
@ -10225,6 +10244,7 @@
|
||||||
B6CAB2F41AF9AA1A00B9B856 /* btTetrahedronShape.h in Headers */,
|
B6CAB2F41AF9AA1A00B9B856 /* btTetrahedronShape.h in Headers */,
|
||||||
1A5701E9180BCB8C0088DEC7 /* CCTransition.h in Headers */,
|
1A5701E9180BCB8C0088DEC7 /* CCTransition.h in Headers */,
|
||||||
15AE198F19AAD36E00C27E9E /* CheckBoxReader.h in Headers */,
|
15AE198F19AAD36E00C27E9E /* CheckBoxReader.h in Headers */,
|
||||||
|
B5CE6DC11B3BF2B1002B0419 /* UIAbstractCheckButton.h in Headers */,
|
||||||
B665E3911AA80A6500DDB1C5 /* CCPUPlaneCollider.h in Headers */,
|
B665E3911AA80A6500DDB1C5 /* CCPUPlaneCollider.h in Headers */,
|
||||||
B6DD2FAE1B04825B00E47F5F /* DetourDebugDraw.h in Headers */,
|
B6DD2FAE1B04825B00E47F5F /* DetourDebugDraw.h in Headers */,
|
||||||
382384011A258FA7002C4610 /* util.h in Headers */,
|
382384011A258FA7002C4610 /* util.h in Headers */,
|
||||||
|
@ -10886,6 +10906,7 @@
|
||||||
B665E3961AA80A6500DDB1C5 /* CCPUPointEmitter.cpp in Sources */,
|
B665E3961AA80A6500DDB1C5 /* CCPUPointEmitter.cpp in Sources */,
|
||||||
15AE184019AAD2F700C27E9E /* CCSprite3D.cpp in Sources */,
|
15AE184019AAD2F700C27E9E /* CCSprite3D.cpp in Sources */,
|
||||||
B6CAB2E51AF9AA1A00B9B856 /* btSphereShape.cpp in Sources */,
|
B6CAB2E51AF9AA1A00B9B856 /* btSphereShape.cpp in Sources */,
|
||||||
|
B5CE6DBE1B3BF2B1002B0419 /* UIAbstractCheckButton.cpp in Sources */,
|
||||||
B6CAB41F1AF9AA1A00B9B856 /* btMLCPSolver.cpp in Sources */,
|
B6CAB41F1AF9AA1A00B9B856 /* btMLCPSolver.cpp in Sources */,
|
||||||
46A170E61807CECA005B8026 /* CCPhysicsBody.cpp in Sources */,
|
46A170E61807CECA005B8026 /* CCPhysicsBody.cpp in Sources */,
|
||||||
B665E40A1AA80A6600DDB1C5 /* CCPUSphereSurfaceEmitterTranslator.cpp in Sources */,
|
B665E40A1AA80A6600DDB1C5 /* CCPUSphereSurfaceEmitterTranslator.cpp in Sources */,
|
||||||
|
@ -11593,6 +11614,7 @@
|
||||||
B665E42A1AA80A6600DDB1C5 /* CCPUVelocityMatchingAffector.cpp in Sources */,
|
B665E42A1AA80A6600DDB1C5 /* CCPUVelocityMatchingAffector.cpp in Sources */,
|
||||||
15AE19A619AAD39600C27E9E /* TextReader.cpp in Sources */,
|
15AE19A619AAD39600C27E9E /* TextReader.cpp in Sources */,
|
||||||
15AE198819AAD36A00C27E9E /* ButtonReader.cpp in Sources */,
|
15AE198819AAD36A00C27E9E /* ButtonReader.cpp in Sources */,
|
||||||
|
B5CE6DC81B3C05BA002B0419 /* UIRadioButton.cpp in Sources */,
|
||||||
B6CAB4131AF9AA1A00B9B856 /* btMultiBodyPoint2Point.cpp in Sources */,
|
B6CAB4131AF9AA1A00B9B856 /* btMultiBodyPoint2Point.cpp in Sources */,
|
||||||
B6CAB2C91AF9AA1A00B9B856 /* btMinkowskiSumShape.cpp in Sources */,
|
B6CAB2C91AF9AA1A00B9B856 /* btMinkowskiSumShape.cpp in Sources */,
|
||||||
4D76BE3A1A4AAF0A00102962 /* CCActionTimelineNode.cpp in Sources */,
|
4D76BE3A1A4AAF0A00102962 /* CCActionTimelineNode.cpp in Sources */,
|
||||||
|
@ -11985,6 +12007,7 @@
|
||||||
1A5701BA180BCB5A0088DEC7 /* CCLabel.cpp in Sources */,
|
1A5701BA180BCB5A0088DEC7 /* CCLabel.cpp in Sources */,
|
||||||
15AE18AD19AAD33D00C27E9E /* CCBFileLoader.cpp in Sources */,
|
15AE18AD19AAD33D00C27E9E /* CCBFileLoader.cpp in Sources */,
|
||||||
B6CAB1F61AF9AA1A00B9B856 /* btDbvt.cpp in Sources */,
|
B6CAB1F61AF9AA1A00B9B856 /* btDbvt.cpp in Sources */,
|
||||||
|
B5CE6DC91B3C05BA002B0419 /* UIRadioButton.cpp in Sources */,
|
||||||
15AE18AB19AAD33D00C27E9E /* CCBAnimationManager.cpp in Sources */,
|
15AE18AB19AAD33D00C27E9E /* CCBAnimationManager.cpp in Sources */,
|
||||||
15AE1B7219AADA9A00C27E9E /* UIListView.cpp in Sources */,
|
15AE1B7219AADA9A00C27E9E /* UIListView.cpp in Sources */,
|
||||||
1A5701BE180BCB5A0088DEC7 /* CCLabelAtlas.cpp in Sources */,
|
1A5701BE180BCB5A0088DEC7 /* CCLabelAtlas.cpp in Sources */,
|
||||||
|
@ -12240,6 +12263,7 @@
|
||||||
15AE195319AAD35100C27E9E /* CCDisplayFactory.cpp in Sources */,
|
15AE195319AAD35100C27E9E /* CCDisplayFactory.cpp in Sources */,
|
||||||
182C5CD71A98F30500C30D34 /* Sprite3DReader.cpp in Sources */,
|
182C5CD71A98F30500C30D34 /* Sprite3DReader.cpp in Sources */,
|
||||||
50ABC0061926664800A911A9 /* CCThread-apple.mm in Sources */,
|
50ABC0061926664800A911A9 /* CCThread-apple.mm in Sources */,
|
||||||
|
B5CE6DBF1B3BF2B1002B0419 /* UIAbstractCheckButton.cpp in Sources */,
|
||||||
B6CAB4B81AF9AA1A00B9B856 /* SpuFakeDma.cpp in Sources */,
|
B6CAB4B81AF9AA1A00B9B856 /* SpuFakeDma.cpp in Sources */,
|
||||||
50ABBEB61925AB6F00A911A9 /* CCUserDefault-android.cpp in Sources */,
|
50ABBEB61925AB6F00A911A9 /* CCUserDefault-android.cpp in Sources */,
|
||||||
B6CAB4481AF9AA1A00B9B856 /* btThreadSupportInterface.cpp in Sources */,
|
B6CAB4481AF9AA1A00B9B856 /* btThreadSupportInterface.cpp in Sources */,
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
buildPhases = (
|
buildPhases = (
|
||||||
);
|
);
|
||||||
dependencies = (
|
dependencies = (
|
||||||
|
293CE83A1B43F3ED00F66EF1 /* PBXTargetDependency */,
|
||||||
1ADA8BA418CF277400AE24B9 /* PBXTargetDependency */,
|
1ADA8BA418CF277400AE24B9 /* PBXTargetDependency */,
|
||||||
1ADA8BA618CF277400AE24B9 /* PBXTargetDependency */,
|
1ADA8BA618CF277400AE24B9 /* PBXTargetDependency */,
|
||||||
1ADA8BA818CF277400AE24B9 /* PBXTargetDependency */,
|
1ADA8BA818CF277400AE24B9 /* PBXTargetDependency */,
|
||||||
|
@ -27,6 +28,7 @@
|
||||||
buildPhases = (
|
buildPhases = (
|
||||||
);
|
);
|
||||||
dependencies = (
|
dependencies = (
|
||||||
|
293CE83C1B43F3F300F66EF1 /* PBXTargetDependency */,
|
||||||
1ADA8BAC18CF277C00AE24B9 /* PBXTargetDependency */,
|
1ADA8BAC18CF277C00AE24B9 /* PBXTargetDependency */,
|
||||||
1ADA8BAE18CF277C00AE24B9 /* PBXTargetDependency */,
|
1ADA8BAE18CF277C00AE24B9 /* PBXTargetDependency */,
|
||||||
1ADA8BB018CF277C00AE24B9 /* PBXTargetDependency */,
|
1ADA8BB018CF277C00AE24B9 /* PBXTargetDependency */,
|
||||||
|
@ -897,6 +899,8 @@
|
||||||
A5030C3619D059DA000E78E7 /* OpenURLTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5030C3319D059DA000E78E7 /* OpenURLTest.cpp */; };
|
A5030C3619D059DA000E78E7 /* OpenURLTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5030C3319D059DA000E78E7 /* OpenURLTest.cpp */; };
|
||||||
B2507B6B192589AF00FA4972 /* Shaders3D in Resources */ = {isa = PBXBuildFile; fileRef = B2507B6A192589AF00FA4972 /* Shaders3D */; };
|
B2507B6B192589AF00FA4972 /* Shaders3D in Resources */ = {isa = PBXBuildFile; fileRef = B2507B6A192589AF00FA4972 /* Shaders3D */; };
|
||||||
B2507B6C192589AF00FA4972 /* Shaders3D in Resources */ = {isa = PBXBuildFile; fileRef = B2507B6A192589AF00FA4972 /* Shaders3D */; };
|
B2507B6C192589AF00FA4972 /* Shaders3D in Resources */ = {isa = PBXBuildFile; fileRef = B2507B6A192589AF00FA4972 /* Shaders3D */; };
|
||||||
|
B5CE6DD11B3C08F8002B0419 /* UIRadioButtonTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B5CE6DCD1B3C08F8002B0419 /* UIRadioButtonTest.cpp */; };
|
||||||
|
B5CE6DD21B3C08F8002B0419 /* UIRadioButtonTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B5CE6DCD1B3C08F8002B0419 /* UIRadioButtonTest.cpp */; };
|
||||||
B603F1AF1AC8EA4E00A9579C /* TerrainTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B603F1AD1AC8EA4E00A9579C /* TerrainTest.cpp */; };
|
B603F1AF1AC8EA4E00A9579C /* TerrainTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B603F1AD1AC8EA4E00A9579C /* TerrainTest.cpp */; };
|
||||||
B603F1B01AC8EA4E00A9579C /* TerrainTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B603F1AD1AC8EA4E00A9579C /* TerrainTest.cpp */; };
|
B603F1B01AC8EA4E00A9579C /* TerrainTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B603F1AD1AC8EA4E00A9579C /* TerrainTest.cpp */; };
|
||||||
B603F1B41AC8FBFB00A9579C /* TerrainTest in Resources */ = {isa = PBXBuildFile; fileRef = B603F1B31AC8FBFB00A9579C /* TerrainTest */; };
|
B603F1B41AC8FBFB00A9579C /* TerrainTest in Resources */ = {isa = PBXBuildFile; fileRef = B603F1B31AC8FBFB00A9579C /* TerrainTest */; };
|
||||||
|
@ -1126,6 +1130,20 @@
|
||||||
remoteGlobalIDString = 1A0EE41918CDF799004CD58F;
|
remoteGlobalIDString = 1A0EE41918CDF799004CD58F;
|
||||||
remoteInfo = "lua-empty-test iOS";
|
remoteInfo = "lua-empty-test iOS";
|
||||||
};
|
};
|
||||||
|
293CE8391B43F3ED00F66EF1 /* PBXContainerItemProxy */ = {
|
||||||
|
isa = PBXContainerItemProxy;
|
||||||
|
containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */;
|
||||||
|
proxyType = 1;
|
||||||
|
remoteGlobalIDString = 1856634B1B4155D3009EF2AE;
|
||||||
|
remoteInfo = "js-tests Mac";
|
||||||
|
};
|
||||||
|
293CE83B1B43F3F300F66EF1 /* PBXContainerItemProxy */ = {
|
||||||
|
isa = PBXContainerItemProxy;
|
||||||
|
containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */;
|
||||||
|
proxyType = 1;
|
||||||
|
remoteGlobalIDString = 185663961B4155DD009EF2AE;
|
||||||
|
remoteInfo = "js-tests iOS";
|
||||||
|
};
|
||||||
3E6177011960FAED00DE83F5 /* PBXContainerItemProxy */ = {
|
3E6177011960FAED00DE83F5 /* PBXContainerItemProxy */ = {
|
||||||
isa = PBXContainerItemProxy;
|
isa = PBXContainerItemProxy;
|
||||||
containerPortal = 46A15F9C1807A4F8005B8026 /* cocos2d_libs.xcodeproj */;
|
containerPortal = 46A15F9C1807A4F8005B8026 /* cocos2d_libs.xcodeproj */;
|
||||||
|
@ -1938,6 +1956,8 @@
|
||||||
A5030C3319D059DA000E78E7 /* OpenURLTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OpenURLTest.cpp; path = OpenURLTest/OpenURLTest.cpp; sourceTree = "<group>"; };
|
A5030C3319D059DA000E78E7 /* OpenURLTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OpenURLTest.cpp; path = OpenURLTest/OpenURLTest.cpp; sourceTree = "<group>"; };
|
||||||
A5030C3419D059DA000E78E7 /* OpenURLTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OpenURLTest.h; path = OpenURLTest/OpenURLTest.h; sourceTree = "<group>"; };
|
A5030C3419D059DA000E78E7 /* OpenURLTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OpenURLTest.h; path = OpenURLTest/OpenURLTest.h; sourceTree = "<group>"; };
|
||||||
B2507B6A192589AF00FA4972 /* Shaders3D */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Shaders3D; path = "../tests/cpp-tests/Resources/Shaders3D"; sourceTree = "<group>"; };
|
B2507B6A192589AF00FA4972 /* Shaders3D */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Shaders3D; path = "../tests/cpp-tests/Resources/Shaders3D"; sourceTree = "<group>"; };
|
||||||
|
B5CE6DCD1B3C08F8002B0419 /* UIRadioButtonTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIRadioButtonTest.cpp; sourceTree = "<group>"; };
|
||||||
|
B5CE6DCE1B3C08F8002B0419 /* UIRadioButtonTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIRadioButtonTest.h; sourceTree = "<group>"; };
|
||||||
B603F1AD1AC8EA4E00A9579C /* TerrainTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TerrainTest.cpp; path = TerrainTest/TerrainTest.cpp; sourceTree = "<group>"; };
|
B603F1AD1AC8EA4E00A9579C /* TerrainTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TerrainTest.cpp; path = TerrainTest/TerrainTest.cpp; sourceTree = "<group>"; };
|
||||||
B603F1AE1AC8EA4E00A9579C /* TerrainTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TerrainTest.h; path = TerrainTest/TerrainTest.h; sourceTree = "<group>"; };
|
B603F1AE1AC8EA4E00A9579C /* TerrainTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TerrainTest.h; path = TerrainTest/TerrainTest.h; sourceTree = "<group>"; };
|
||||||
B603F1B31AC8FBFB00A9579C /* TerrainTest */ = {isa = PBXFileReference; lastKnownFileType = folder; name = TerrainTest; path = "../tests/cpp-tests/Resources/TerrainTest"; sourceTree = "<group>"; };
|
B603F1B31AC8FBFB00A9579C /* TerrainTest */ = {isa = PBXFileReference; lastKnownFileType = folder; name = TerrainTest; path = "../tests/cpp-tests/Resources/TerrainTest"; sourceTree = "<group>"; };
|
||||||
|
@ -3493,15 +3513,6 @@
|
||||||
path = ZwoptexTest;
|
path = ZwoptexTest;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
1AC35C6F18CECF0C00F37B72 /* VibrateTest */ = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
1AC35C6D18CECF0C00F37B72 /* VibrateTest.cpp */,
|
|
||||||
1AC35C6E18CECF0C00F37B72 /* VibrateTest.h */,
|
|
||||||
);
|
|
||||||
path = VibrateTest;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
1AC35C6D18CECF1400F37B72 /* proj.ios */ = {
|
1AC35C6D18CECF1400F37B72 /* proj.ios */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
@ -3542,6 +3553,15 @@
|
||||||
path = Classes;
|
path = Classes;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
1AC35C6F18CECF0C00F37B72 /* VibrateTest */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
1AC35C6D18CECF0C00F37B72 /* VibrateTest.cpp */,
|
||||||
|
1AC35C6E18CECF0C00F37B72 /* VibrateTest.h */,
|
||||||
|
);
|
||||||
|
path = VibrateTest;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
1AC35C9A18CECF1E00F37B72 /* proj.mac */ = {
|
1AC35C9A18CECF1E00F37B72 /* proj.mac */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
@ -4154,6 +4174,7 @@
|
||||||
29080D50191B595E0066F8DF /* UIListViewTest */,
|
29080D50191B595E0066F8DF /* UIListViewTest */,
|
||||||
29080D55191B595E0066F8DF /* UILoadingBarTest */,
|
29080D55191B595E0066F8DF /* UILoadingBarTest */,
|
||||||
29080D5A191B595E0066F8DF /* UIPageViewTest */,
|
29080D5A191B595E0066F8DF /* UIPageViewTest */,
|
||||||
|
B5CE6DCC1B3C08F8002B0419 /* UIRadioButtonTest */,
|
||||||
29080D5F191B595E0066F8DF /* UIRichTextTest */,
|
29080D5F191B595E0066F8DF /* UIRichTextTest */,
|
||||||
3EA0FB6F191C844400B170C8 /* UIVideoPlayerTest */,
|
3EA0FB6F191C844400B170C8 /* UIVideoPlayerTest */,
|
||||||
);
|
);
|
||||||
|
@ -4329,6 +4350,15 @@
|
||||||
name = OpenURLTest;
|
name = OpenURLTest;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
B5CE6DCC1B3C08F8002B0419 /* UIRadioButtonTest */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
B5CE6DCD1B3C08F8002B0419 /* UIRadioButtonTest.cpp */,
|
||||||
|
B5CE6DCE1B3C08F8002B0419 /* UIRadioButtonTest.h */,
|
||||||
|
);
|
||||||
|
path = UIRadioButtonTest;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
B603F1AC1AC8EA2E00A9579C /* TerrainTest */ = {
|
B603F1AC1AC8EA2E00A9579C /* TerrainTest */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
@ -5424,6 +5454,7 @@
|
||||||
1AC35C4F18CECF0C00F37B72 /* SpriteTest.cpp in Sources */,
|
1AC35C4F18CECF0C00F37B72 /* SpriteTest.cpp in Sources */,
|
||||||
29080D9D191B595E0066F8DF /* CustomParticleWidgetReader.cpp in Sources */,
|
29080D9D191B595E0066F8DF /* CustomParticleWidgetReader.cpp in Sources */,
|
||||||
1AC35C0318CECF0C00F37B72 /* FileUtilsTest.cpp in Sources */,
|
1AC35C0318CECF0C00F37B72 /* FileUtilsTest.cpp in Sources */,
|
||||||
|
B5CE6DD11B3C08F8002B0419 /* UIRadioButtonTest.cpp in Sources */,
|
||||||
B6C039D919C95D83007207DC /* LightTest.cpp in Sources */,
|
B6C039D919C95D83007207DC /* LightTest.cpp in Sources */,
|
||||||
1AC35B5B18CECF0C00F37B72 /* CurlTest.cpp in Sources */,
|
1AC35B5B18CECF0C00F37B72 /* CurlTest.cpp in Sources */,
|
||||||
29080DD5191B595E0066F8DF /* UITextAtlasTest_Editor.cpp in Sources */,
|
29080DD5191B595E0066F8DF /* UITextAtlasTest_Editor.cpp in Sources */,
|
||||||
|
@ -5574,6 +5605,7 @@
|
||||||
B6CAB54F1AF9AA6C00B9B856 /* Physics3DTest.cpp in Sources */,
|
B6CAB54F1AF9AA6C00B9B856 /* Physics3DTest.cpp in Sources */,
|
||||||
1AC35C1E18CECF0C00F37B72 /* NewRendererTest.cpp in Sources */,
|
1AC35C1E18CECF0C00F37B72 /* NewRendererTest.cpp in Sources */,
|
||||||
5EBEECB11995247000429821 /* DrawNode3D.cpp in Sources */,
|
5EBEECB11995247000429821 /* DrawNode3D.cpp in Sources */,
|
||||||
|
B5CE6DD21B3C08F8002B0419 /* UIRadioButtonTest.cpp in Sources */,
|
||||||
1AC35B6818CECF0C00F37B72 /* AnimationsTestLayer.cpp in Sources */,
|
1AC35B6818CECF0C00F37B72 /* AnimationsTestLayer.cpp in Sources */,
|
||||||
29080D8E191B595E0066F8DF /* CocosGUIScene.cpp in Sources */,
|
29080D8E191B595E0066F8DF /* CocosGUIScene.cpp in Sources */,
|
||||||
1AC35BFA18CECF0C00F37B72 /* WebSocketTest.cpp in Sources */,
|
1AC35BFA18CECF0C00F37B72 /* WebSocketTest.cpp in Sources */,
|
||||||
|
@ -5890,6 +5922,16 @@
|
||||||
target = 1A0EE41918CDF799004CD58F /* lua-empty-test iOS */;
|
target = 1A0EE41918CDF799004CD58F /* lua-empty-test iOS */;
|
||||||
targetProxy = 1ADA8BAF18CF277C00AE24B9 /* PBXContainerItemProxy */;
|
targetProxy = 1ADA8BAF18CF277C00AE24B9 /* PBXContainerItemProxy */;
|
||||||
};
|
};
|
||||||
|
293CE83A1B43F3ED00F66EF1 /* PBXTargetDependency */ = {
|
||||||
|
isa = PBXTargetDependency;
|
||||||
|
target = 1856634B1B4155D3009EF2AE /* js-tests Mac */;
|
||||||
|
targetProxy = 293CE8391B43F3ED00F66EF1 /* PBXContainerItemProxy */;
|
||||||
|
};
|
||||||
|
293CE83C1B43F3F300F66EF1 /* PBXTargetDependency */ = {
|
||||||
|
isa = PBXTargetDependency;
|
||||||
|
target = 185663961B4155DD009EF2AE /* js-tests iOS */;
|
||||||
|
targetProxy = 293CE83B1B43F3F300F66EF1 /* PBXContainerItemProxy */;
|
||||||
|
};
|
||||||
3E6177001960FAED00DE83F5 /* PBXTargetDependency */ = {
|
3E6177001960FAED00DE83F5 /* PBXTargetDependency */ = {
|
||||||
isa = PBXTargetDependency;
|
isa = PBXTargetDependency;
|
||||||
name = "cocos2dx iOS";
|
name = "cocos2dx iOS";
|
||||||
|
|
|
@ -474,7 +474,7 @@ void Camera::clearBackground(float depth)
|
||||||
The other values don't need to be updated since they were restored to their original values
|
The other values don't need to be updated since they were restored to their original values
|
||||||
*/
|
*/
|
||||||
glStencilMask(0xFFFFF);
|
glStencilMask(0xFFFFF);
|
||||||
RenderState::StateBlock::_defaultState->setStencilWrite(0xFFFFF);
|
// RenderState::StateBlock::_defaultState->setStencilWrite(0xFFFFF);
|
||||||
|
|
||||||
/* BUG: RenderState does not support glColorMask yet. */
|
/* BUG: RenderState does not support glColorMask yet. */
|
||||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||||
|
|
|
@ -396,7 +396,7 @@ void ClippingNode::onBeforeVisit()
|
||||||
|
|
||||||
// enable stencil use
|
// enable stencil use
|
||||||
glEnable(GL_STENCIL_TEST);
|
glEnable(GL_STENCIL_TEST);
|
||||||
RenderState::StateBlock::_defaultState->setStencilTest(true);
|
// RenderState::StateBlock::_defaultState->setStencilTest(true);
|
||||||
|
|
||||||
// check for OpenGL error while enabling stencil test
|
// check for OpenGL error while enabling stencil test
|
||||||
CHECK_GL_ERROR_DEBUG();
|
CHECK_GL_ERROR_DEBUG();
|
||||||
|
@ -404,7 +404,7 @@ void ClippingNode::onBeforeVisit()
|
||||||
// all bits on the stencil buffer are readonly, except the current layer bit,
|
// all bits on the stencil buffer are readonly, except the current layer bit,
|
||||||
// this means that operation like glClear or glStencilOp will be masked with this value
|
// this means that operation like glClear or glStencilOp will be masked with this value
|
||||||
glStencilMask(mask_layer);
|
glStencilMask(mask_layer);
|
||||||
RenderState::StateBlock::_defaultState->setStencilWrite(mask_layer);
|
// RenderState::StateBlock::_defaultState->setStencilWrite(mask_layer);
|
||||||
|
|
||||||
// manually save the depth test state
|
// manually save the depth test state
|
||||||
|
|
||||||
|
@ -444,13 +444,13 @@ void ClippingNode::onBeforeVisit()
|
||||||
// if not in inverted mode: set the current layer value to 1 in the stencil buffer
|
// if not in inverted mode: set the current layer value to 1 in the stencil buffer
|
||||||
// if in inverted mode: set the current layer value to 0 in the stencil buffer
|
// if in inverted mode: set the current layer value to 0 in the stencil buffer
|
||||||
glStencilFunc(GL_NEVER, mask_layer, mask_layer);
|
glStencilFunc(GL_NEVER, mask_layer, mask_layer);
|
||||||
RenderState::StateBlock::_defaultState->setStencilFunction(RenderState::STENCIL_NEVER, mask_layer, mask_layer);
|
// RenderState::StateBlock::_defaultState->setStencilFunction(RenderState::STENCIL_NEVER, mask_layer, mask_layer);
|
||||||
|
|
||||||
glStencilOp(!_inverted ? GL_REPLACE : GL_ZERO, GL_KEEP, GL_KEEP);
|
glStencilOp(!_inverted ? GL_REPLACE : GL_ZERO, GL_KEEP, GL_KEEP);
|
||||||
RenderState::StateBlock::_defaultState->setStencilOperation(
|
// RenderState::StateBlock::_defaultState->setStencilOperation(
|
||||||
!_inverted ? RenderState::STENCIL_OP_REPLACE : RenderState::STENCIL_OP_ZERO,
|
// !_inverted ? RenderState::STENCIL_OP_REPLACE : RenderState::STENCIL_OP_ZERO,
|
||||||
RenderState::STENCIL_OP_KEEP,
|
// RenderState::STENCIL_OP_KEEP,
|
||||||
RenderState::STENCIL_OP_KEEP);
|
// RenderState::STENCIL_OP_KEEP);
|
||||||
|
|
||||||
|
|
||||||
// enable alpha test only if the alpha threshold < 1,
|
// enable alpha test only if the alpha threshold < 1,
|
||||||
|
@ -508,10 +508,10 @@ void ClippingNode::onAfterDrawStencil()
|
||||||
// else
|
// else
|
||||||
// do not draw the pixel but keep the current layer in the stencil buffer
|
// do not draw the pixel but keep the current layer in the stencil buffer
|
||||||
glStencilFunc(GL_EQUAL, _mask_layer_le, _mask_layer_le);
|
glStencilFunc(GL_EQUAL, _mask_layer_le, _mask_layer_le);
|
||||||
RenderState::StateBlock::_defaultState->setStencilFunction(RenderState::STENCIL_EQUAL, _mask_layer_le, _mask_layer_le);
|
// RenderState::StateBlock::_defaultState->setStencilFunction(RenderState::STENCIL_EQUAL, _mask_layer_le, _mask_layer_le);
|
||||||
|
|
||||||
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
|
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
|
||||||
RenderState::StateBlock::_defaultState->setStencilOperation(RenderState::STENCIL_OP_KEEP, RenderState::STENCIL_OP_KEEP, RenderState::STENCIL_OP_KEEP);
|
// RenderState::StateBlock::_defaultState->setStencilOperation(RenderState::STENCIL_OP_KEEP, RenderState::STENCIL_OP_KEEP, RenderState::STENCIL_OP_KEEP);
|
||||||
|
|
||||||
// draw (according to the stencil test func) this node and its childs
|
// draw (according to the stencil test func) this node and its childs
|
||||||
}
|
}
|
||||||
|
@ -524,18 +524,18 @@ void ClippingNode::onAfterVisit()
|
||||||
|
|
||||||
// manually restore the stencil state
|
// manually restore the stencil state
|
||||||
glStencilFunc(_currentStencilFunc, _currentStencilRef, _currentStencilValueMask);
|
glStencilFunc(_currentStencilFunc, _currentStencilRef, _currentStencilValueMask);
|
||||||
RenderState::StateBlock::_defaultState->setStencilFunction((RenderState::StencilFunction)_currentStencilFunc, _currentStencilRef, _currentStencilValueMask);
|
// RenderState::StateBlock::_defaultState->setStencilFunction((RenderState::StencilFunction)_currentStencilFunc, _currentStencilRef, _currentStencilValueMask);
|
||||||
|
|
||||||
glStencilOp(_currentStencilFail, _currentStencilPassDepthFail, _currentStencilPassDepthPass);
|
glStencilOp(_currentStencilFail, _currentStencilPassDepthFail, _currentStencilPassDepthPass);
|
||||||
RenderState::StateBlock::_defaultState->setStencilOperation((RenderState::StencilOperation)_currentStencilFail,
|
// RenderState::StateBlock::_defaultState->setStencilOperation((RenderState::StencilOperation)_currentStencilFail,
|
||||||
(RenderState::StencilOperation)_currentStencilPassDepthFail,
|
// (RenderState::StencilOperation)_currentStencilPassDepthFail,
|
||||||
(RenderState::StencilOperation)_currentStencilPassDepthPass);
|
// (RenderState::StencilOperation)_currentStencilPassDepthPass);
|
||||||
|
|
||||||
glStencilMask(_currentStencilWriteMask);
|
glStencilMask(_currentStencilWriteMask);
|
||||||
if (!_currentStencilEnabled)
|
if (!_currentStencilEnabled)
|
||||||
{
|
{
|
||||||
glDisable(GL_STENCIL_TEST);
|
glDisable(GL_STENCIL_TEST);
|
||||||
RenderState::StateBlock::_defaultState->setStencilTest(false);
|
// RenderState::StateBlock::_defaultState->setStencilTest(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// we are done using this layer, decrement
|
// we are done using this layer, decrement
|
||||||
|
|
|
@ -97,6 +97,8 @@ FontFreeType::FontFreeType(bool distanceFieldEnabled /* = false */,int outline /
|
||||||
, _stroker(nullptr)
|
, _stroker(nullptr)
|
||||||
, _distanceFieldEnabled(distanceFieldEnabled)
|
, _distanceFieldEnabled(distanceFieldEnabled)
|
||||||
, _outlineSize(0.0f)
|
, _outlineSize(0.0f)
|
||||||
|
, _lineHeight(0)
|
||||||
|
, _fontAtlas(nullptr)
|
||||||
{
|
{
|
||||||
if (outline > 0)
|
if (outline > 0)
|
||||||
{
|
{
|
||||||
|
@ -147,6 +149,7 @@ bool FontFreeType::createFontObject(const std::string &fontName, int fontSize)
|
||||||
|
|
||||||
// store the face globally
|
// store the face globally
|
||||||
_fontRef = face;
|
_fontRef = face;
|
||||||
|
_lineHeight = static_cast<int>(_fontRef->size->metrics.height >> 6);
|
||||||
|
|
||||||
// done and good
|
// done and good
|
||||||
return true;
|
return true;
|
||||||
|
@ -172,17 +175,21 @@ FontFreeType::~FontFreeType()
|
||||||
|
|
||||||
FontAtlas * FontFreeType::createFontAtlas()
|
FontAtlas * FontFreeType::createFontAtlas()
|
||||||
{
|
{
|
||||||
FontAtlas *atlas = new (std::nothrow) FontAtlas(*this);
|
if (_fontAtlas == nullptr)
|
||||||
if (_usedGlyphs != GlyphCollection::DYNAMIC)
|
{
|
||||||
|
_fontAtlas = new (std::nothrow) FontAtlas(*this);
|
||||||
|
if (_fontAtlas && _usedGlyphs != GlyphCollection::DYNAMIC)
|
||||||
{
|
{
|
||||||
std::u16string utf16;
|
std::u16string utf16;
|
||||||
if (StringUtils::UTF8ToUTF16(getCurrentGlyphCollection(), utf16))
|
if (StringUtils::UTF8ToUTF16(getCurrentGlyphCollection(), utf16))
|
||||||
{
|
{
|
||||||
atlas->prepareLetterDefinitions(utf16);
|
_fontAtlas->prepareLetterDefinitions(utf16);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this->release();
|
this->release();
|
||||||
return atlas;
|
}
|
||||||
|
|
||||||
|
return _fontAtlas;
|
||||||
}
|
}
|
||||||
|
|
||||||
int * FontFreeType::getHorizontalKerningForTextUTF16(const std::u16string& text, int &outNumLetters) const
|
int * FontFreeType::getHorizontalKerningForTextUTF16(const std::u16string& text, int &outNumLetters) const
|
||||||
|
@ -234,11 +241,6 @@ int FontFreeType::getHorizontalKerningForChars(unsigned short firstChar, unsign
|
||||||
return (static_cast<int>(kerning.x >> 6));
|
return (static_cast<int>(kerning.x >> 6));
|
||||||
}
|
}
|
||||||
|
|
||||||
int FontFreeType::getFontMaxHeight() const
|
|
||||||
{
|
|
||||||
return (static_cast<int>(_fontRef->size->metrics.height >> 6));
|
|
||||||
}
|
|
||||||
|
|
||||||
int FontFreeType::getFontAscender() const
|
int FontFreeType::getFontAscender() const
|
||||||
{
|
{
|
||||||
return (static_cast<int>(_fontRef->size->metrics.ascender >> 6));
|
return (static_cast<int>(_fontRef->size->metrics.ascender >> 6));
|
||||||
|
@ -313,7 +315,7 @@ unsigned char* FontFreeType::getGlyphBitmap(unsigned short theChar, long &outWid
|
||||||
auto blendHeight = blendImageMaxY - MIN(outlineMinY, glyphMinY);
|
auto blendHeight = blendImageMaxY - MIN(outlineMinY, glyphMinY);
|
||||||
|
|
||||||
outRect.origin.x = blendImageMinX;
|
outRect.origin.x = blendImageMinX;
|
||||||
outRect.origin.y = -blendImageMaxY;
|
outRect.origin.y = -blendImageMaxY + _outlineSize;
|
||||||
|
|
||||||
long index, index2;
|
long index, index2;
|
||||||
auto blendImage = new unsigned char[blendWidth * blendHeight * 2];
|
auto blendImage = new unsigned char[blendWidth * blendHeight * 2];
|
||||||
|
|
|
@ -66,7 +66,7 @@ public:
|
||||||
|
|
||||||
unsigned char * getGlyphBitmap(unsigned short theChar, long &outWidth, long &outHeight, Rect &outRect,int &xAdvance);
|
unsigned char * getGlyphBitmap(unsigned short theChar, long &outWidth, long &outHeight, Rect &outRect,int &xAdvance);
|
||||||
|
|
||||||
virtual int getFontMaxHeight() const override;
|
virtual int getFontMaxHeight() const override { return _lineHeight; }
|
||||||
virtual int getFontAscender() const;
|
virtual int getFontAscender() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -90,6 +90,8 @@ private:
|
||||||
std::string _fontName;
|
std::string _fontName;
|
||||||
bool _distanceFieldEnabled;
|
bool _distanceFieldEnabled;
|
||||||
float _outlineSize;
|
float _outlineSize;
|
||||||
|
int _lineHeight;
|
||||||
|
FontAtlas* _fontAtlas;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// @endcond
|
/// @endcond
|
||||||
|
|
|
@ -262,7 +262,7 @@ Label::Label(FontAtlas *atlas /* = nullptr */, TextHAlignment hAlignment /* = Te
|
||||||
setAnchorPoint(Vec2::ANCHOR_MIDDLE);
|
setAnchorPoint(Vec2::ANCHOR_MIDDLE);
|
||||||
reset();
|
reset();
|
||||||
|
|
||||||
auto purgeTextureListener = EventListenerCustom::create(FontAtlas::CMD_PURGE_FONTATLAS, [this](EventCustom* event){
|
_purgeTextureListener = EventListenerCustom::create(FontAtlas::CMD_PURGE_FONTATLAS, [this](EventCustom* event){
|
||||||
if (_fontAtlas && _currentLabelType == LabelType::TTF && event->getUserData() == _fontAtlas)
|
if (_fontAtlas && _currentLabelType == LabelType::TTF && event->getUserData() == _fontAtlas)
|
||||||
{
|
{
|
||||||
Node::removeAllChildrenWithCleanup(true);
|
Node::removeAllChildrenWithCleanup(true);
|
||||||
|
@ -275,16 +275,16 @@ Label::Label(FontAtlas *atlas /* = nullptr */, TextHAlignment hAlignment /* = Te
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
_eventDispatcher->addEventListenerWithSceneGraphPriority(purgeTextureListener, this);
|
_eventDispatcher->addEventListenerWithFixedPriority(_purgeTextureListener, 1);
|
||||||
|
|
||||||
auto resetTextureListener = EventListenerCustom::create(FontAtlas::CMD_RESET_FONTATLAS, [this](EventCustom* event){
|
_resetTextureListener = EventListenerCustom::create(FontAtlas::CMD_RESET_FONTATLAS, [this](EventCustom* event){
|
||||||
if (_fontAtlas && _currentLabelType == LabelType::TTF && event->getUserData() == _fontAtlas)
|
if (_fontAtlas && _currentLabelType == LabelType::TTF && event->getUserData() == _fontAtlas)
|
||||||
{
|
{
|
||||||
_fontAtlas = nullptr;
|
_fontAtlas = nullptr;
|
||||||
this->setTTFConfig(_fontConfig);
|
this->setTTFConfig(_fontConfig);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
_eventDispatcher->addEventListenerWithSceneGraphPriority(resetTextureListener, this);
|
_eventDispatcher->addEventListenerWithFixedPriority(_resetTextureListener, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
Label::~Label()
|
Label::~Label()
|
||||||
|
@ -295,6 +295,8 @@ Label::~Label()
|
||||||
{
|
{
|
||||||
FontAtlasCache::releaseFontAtlas(_fontAtlas);
|
FontAtlasCache::releaseFontAtlas(_fontAtlas);
|
||||||
}
|
}
|
||||||
|
_eventDispatcher->removeEventListener(_purgeTextureListener);
|
||||||
|
_eventDispatcher->removeEventListener(_resetTextureListener);
|
||||||
|
|
||||||
CC_SAFE_RELEASE_NULL(_reusedLetter);
|
CC_SAFE_RELEASE_NULL(_reusedLetter);
|
||||||
}
|
}
|
||||||
|
|
|
@ -546,6 +546,8 @@ protected:
|
||||||
std::vector<SpriteBatchNode*> _batchNodes;
|
std::vector<SpriteBatchNode*> _batchNodes;
|
||||||
FontAtlas * _fontAtlas;
|
FontAtlas * _fontAtlas;
|
||||||
std::vector<LetterInfo> _lettersInfo;
|
std::vector<LetterInfo> _lettersInfo;
|
||||||
|
EventListenerCustom* _purgeTextureListener;
|
||||||
|
EventListenerCustom* _resetTextureListener;
|
||||||
|
|
||||||
TTFConfig _fontConfig;
|
TTFConfig _fontConfig;
|
||||||
|
|
||||||
|
|
|
@ -120,13 +120,15 @@ void ParticleBatchNode::visit(Renderer *renderer, const Mat4 &parentTransform, u
|
||||||
// The alternative is to have a void Sprite#visit, but
|
// The alternative is to have a void Sprite#visit, but
|
||||||
// although this is less maintainable, is faster
|
// although this is less maintainable, is faster
|
||||||
//
|
//
|
||||||
if (!_visible || !isVisitableByVisitingCamera())
|
if (!_visible)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t flags = processParentFlags(parentTransform, parentFlags);
|
uint32_t flags = processParentFlags(parentTransform, parentFlags);
|
||||||
|
|
||||||
|
if (isVisitableByVisitingCamera())
|
||||||
|
{
|
||||||
// IMPORTANT:
|
// IMPORTANT:
|
||||||
// To ease the migration to v3.0, we still support the Mat4 stack,
|
// To ease the migration to v3.0, we still support the Mat4 stack,
|
||||||
// but it is deprecated and your code should not rely on it
|
// but it is deprecated and your code should not rely on it
|
||||||
|
@ -138,6 +140,7 @@ void ParticleBatchNode::visit(Renderer *renderer, const Mat4 &parentTransform, u
|
||||||
|
|
||||||
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// override addChild:
|
// override addChild:
|
||||||
void ParticleBatchNode::addChild(Node * aChild, int zOrder, int tag)
|
void ParticleBatchNode::addChild(Node * aChild, int zOrder, int tag)
|
||||||
|
|
|
@ -271,7 +271,7 @@ void ProtectedNode::reorderProtectedChild(cocos2d::Node *child, int localZOrder)
|
||||||
void ProtectedNode::visit(Renderer* renderer, const Mat4 &parentTransform, uint32_t parentFlags)
|
void ProtectedNode::visit(Renderer* renderer, const Mat4 &parentTransform, uint32_t parentFlags)
|
||||||
{
|
{
|
||||||
// quick return if not visible. children won't be drawn.
|
// quick return if not visible. children won't be drawn.
|
||||||
if (!_visible || !isVisitableByVisitingCamera())
|
if (!_visible)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -384,7 +384,7 @@ void RenderTexture::visit(Renderer *renderer, const Mat4 &parentTransform, uint3
|
||||||
{
|
{
|
||||||
// override visit.
|
// override visit.
|
||||||
// Don't call visit on its children
|
// Don't call visit on its children
|
||||||
if (!_visible || !isVisitableByVisitingCamera())
|
if (!_visible)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -399,7 +399,10 @@ void RenderTexture::visit(Renderer *renderer, const Mat4 &parentTransform, uint3
|
||||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewTransform);
|
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewTransform);
|
||||||
|
|
||||||
_sprite->visit(renderer, _modelViewTransform, flags);
|
_sprite->visit(renderer, _modelViewTransform, flags);
|
||||||
|
if (isVisitableByVisitingCamera())
|
||||||
|
{
|
||||||
draw(renderer, _modelViewTransform, flags);
|
draw(renderer, _modelViewTransform, flags);
|
||||||
|
}
|
||||||
|
|
||||||
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
||||||
|
|
||||||
|
|
|
@ -134,7 +134,7 @@ void SpriteBatchNode::visit(Renderer *renderer, const Mat4 &parentTransform, uin
|
||||||
// The alternative is to have a void Sprite#visit, but
|
// The alternative is to have a void Sprite#visit, but
|
||||||
// although this is less maintainable, is faster
|
// although this is less maintainable, is faster
|
||||||
//
|
//
|
||||||
if (! _visible || !isVisitableByVisitingCamera())
|
if (! _visible)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -143,6 +143,8 @@ void SpriteBatchNode::visit(Renderer *renderer, const Mat4 &parentTransform, uin
|
||||||
|
|
||||||
uint32_t flags = processParentFlags(parentTransform, parentFlags);
|
uint32_t flags = processParentFlags(parentTransform, parentFlags);
|
||||||
|
|
||||||
|
if (isVisitableByVisitingCamera())
|
||||||
|
{
|
||||||
// IMPORTANT:
|
// IMPORTANT:
|
||||||
// To ease the migration to v3.0, we still support the Mat4 stack,
|
// To ease the migration to v3.0, we still support the Mat4 stack,
|
||||||
// but it is deprecated and your code should not rely on it
|
// but it is deprecated and your code should not rely on it
|
||||||
|
@ -159,6 +161,7 @@ void SpriteBatchNode::visit(Renderer *renderer, const Mat4 &parentTransform, uin
|
||||||
|
|
||||||
CC_PROFILER_STOP_CATEGORY(kProfilerCategoryBatchSprite, "CCSpriteBatchNode - visit");
|
CC_PROFILER_STOP_CATEGORY(kProfilerCategoryBatchSprite, "CCSpriteBatchNode - visit");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SpriteBatchNode::addChild(Node *child, int zOrder, int tag)
|
void SpriteBatchNode::addChild(Node *child, int zOrder, int tag)
|
||||||
{
|
{
|
||||||
|
|
|
@ -627,7 +627,9 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\chipmunk\prebuilt\win32\release-lib\*.*
|
||||||
<ClCompile Include="..\storage\local-storage\LocalStorage.cpp" />
|
<ClCompile Include="..\storage\local-storage\LocalStorage.cpp" />
|
||||||
<ClCompile Include="..\ui\CocosGUI.cpp" />
|
<ClCompile Include="..\ui\CocosGUI.cpp" />
|
||||||
<ClCompile Include="..\ui\UIButton.cpp" />
|
<ClCompile Include="..\ui\UIButton.cpp" />
|
||||||
|
<ClCompile Include="..\ui\UIAbstractCheckButton.cpp" />
|
||||||
<ClCompile Include="..\ui\UICheckBox.cpp" />
|
<ClCompile Include="..\ui\UICheckBox.cpp" />
|
||||||
|
<ClCompile Include="..\ui\UIRadioButton.cpp" />
|
||||||
<ClCompile Include="..\ui\UIDeprecated.cpp" />
|
<ClCompile Include="..\ui\UIDeprecated.cpp" />
|
||||||
<ClCompile Include="..\ui\UIEditBox\UIEditBox.cpp" />
|
<ClCompile Include="..\ui\UIEditBox\UIEditBox.cpp" />
|
||||||
<ClCompile Include="..\ui\UIEditBox\UIEditBoxImpl-win32.cpp" />
|
<ClCompile Include="..\ui\UIEditBox\UIEditBoxImpl-win32.cpp" />
|
||||||
|
|
|
@ -889,9 +889,15 @@
|
||||||
<ClCompile Include="..\ui\UIButton.cpp">
|
<ClCompile Include="..\ui\UIButton.cpp">
|
||||||
<Filter>ui\UIWidgets</Filter>
|
<Filter>ui\UIWidgets</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\ui\UIAbstractCheckButton.cpp">
|
||||||
|
<Filter>ui\UIWidgets</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="..\ui\UICheckBox.cpp">
|
<ClCompile Include="..\ui\UICheckBox.cpp">
|
||||||
<Filter>ui\UIWidgets</Filter>
|
<Filter>ui\UIWidgets</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\ui\UIRadioButton.cpp">
|
||||||
|
<Filter>ui\UIWidgets</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="..\ui\UIImageView.cpp">
|
<ClCompile Include="..\ui\UIImageView.cpp">
|
||||||
<Filter>ui\UIWidgets</Filter>
|
<Filter>ui\UIWidgets</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|
|
@ -1116,7 +1116,9 @@
|
||||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\storage\local-storage\LocalStorage.cpp" />
|
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\storage\local-storage\LocalStorage.cpp" />
|
||||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\CocosGUI.cpp" />
|
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\CocosGUI.cpp" />
|
||||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UIButton.cpp" />
|
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UIButton.cpp" />
|
||||||
|
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UIAbstractCheckButton.cpp" />
|
||||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UICheckBox.cpp" />
|
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UICheckBox.cpp" />
|
||||||
|
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UIRadioButton.cpp" />
|
||||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UIDeprecated.cpp" />
|
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UIDeprecated.cpp" />
|
||||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UIEditBox\UIEditBox.cpp" />
|
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UIEditBox\UIEditBox.cpp" />
|
||||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UIEditBox\UIEditBoxImpl-winrt.cpp" />
|
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UIEditBox\UIEditBoxImpl-winrt.cpp" />
|
||||||
|
|
|
@ -2294,9 +2294,15 @@
|
||||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UIButton.cpp">
|
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UIButton.cpp">
|
||||||
<Filter>ui\UIWidgets</Filter>
|
<Filter>ui\UIWidgets</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UIAbstractCheckButton.cpp">
|
||||||
|
<Filter>ui\UIWidgets</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UICheckBox.cpp">
|
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UICheckBox.cpp">
|
||||||
<Filter>ui\UIWidgets</Filter>
|
<Filter>ui\UIWidgets</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UIRadioButton.cpp">
|
||||||
|
<Filter>ui\UIWidgets</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UILoadingBar.cpp">
|
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\..\..\ui\UILoadingBar.cpp">
|
||||||
<Filter>ui\UIWidgets</Filter>
|
<Filter>ui\UIWidgets</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|
|
@ -622,7 +622,9 @@
|
||||||
<ClCompile Include="..\..\storage\local-storage\LocalStorage.cpp" />
|
<ClCompile Include="..\..\storage\local-storage\LocalStorage.cpp" />
|
||||||
<ClCompile Include="..\..\ui\CocosGUI.cpp" />
|
<ClCompile Include="..\..\ui\CocosGUI.cpp" />
|
||||||
<ClCompile Include="..\..\ui\UIButton.cpp" />
|
<ClCompile Include="..\..\ui\UIButton.cpp" />
|
||||||
|
<ClCompile Include="..\..\ui\UIAbstractCheckButton.cpp" />
|
||||||
<ClCompile Include="..\..\ui\UICheckBox.cpp" />
|
<ClCompile Include="..\..\ui\UICheckBox.cpp" />
|
||||||
|
<ClCompile Include="..\..\ui\UIRadioButton.cpp" />
|
||||||
<ClCompile Include="..\..\ui\UIDeprecated.cpp" />
|
<ClCompile Include="..\..\ui\UIDeprecated.cpp" />
|
||||||
<ClCompile Include="..\..\ui\UIEditBox\UIEditBox.cpp" />
|
<ClCompile Include="..\..\ui\UIEditBox\UIEditBox.cpp" />
|
||||||
<ClCompile Include="..\..\ui\UIEditBox\UIEditBoxImpl-winrt.cpp" />
|
<ClCompile Include="..\..\ui\UIEditBox\UIEditBoxImpl-winrt.cpp" />
|
||||||
|
|
|
@ -1764,9 +1764,15 @@
|
||||||
<ClCompile Include="..\..\ui\UIButton.cpp">
|
<ClCompile Include="..\..\ui\UIButton.cpp">
|
||||||
<Filter>ui\UIWidgets</Filter>
|
<Filter>ui\UIWidgets</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\ui\UIAbstractCheckButton.cpp">
|
||||||
|
<Filter>ui\UIWidgets</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\ui\UICheckBox.cpp">
|
<ClCompile Include="..\..\ui\UICheckBox.cpp">
|
||||||
<Filter>ui\UIWidgets</Filter>
|
<Filter>ui\UIWidgets</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\ui\UIRadioButton.cpp">
|
||||||
|
<Filter>ui\UIWidgets</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\ui\UIImageView.cpp">
|
<ClCompile Include="..\..\ui\UIImageView.cpp">
|
||||||
<Filter>ui\UIWidgets</Filter>
|
<Filter>ui\UIWidgets</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|
|
@ -103,8 +103,6 @@ void BillBoard::visit(Renderer *renderer, const Mat4& parentTransform, uint32_t
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bool visibleByCamera = isVisitableByVisitingCamera();
|
bool visibleByCamera = isVisitableByVisitingCamera();
|
||||||
if (!visibleByCamera && _children.empty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
uint32_t flags = processParentFlags(parentTransform, parentFlags);
|
uint32_t flags = processParentFlags(parentTransform, parentFlags);
|
||||||
|
|
||||||
|
@ -122,8 +120,6 @@ void BillBoard::visit(Renderer *renderer, const Mat4& parentTransform, uint32_t
|
||||||
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
||||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewTransform);
|
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewTransform);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
if(!_children.empty())
|
if(!_children.empty())
|
||||||
|
|
|
@ -127,6 +127,7 @@ Mesh::Mesh()
|
||||||
, _blend(BlendFunc::ALPHA_NON_PREMULTIPLIED)
|
, _blend(BlendFunc::ALPHA_NON_PREMULTIPLIED)
|
||||||
, _visibleChanged(nullptr)
|
, _visibleChanged(nullptr)
|
||||||
, _blendDirty(true)
|
, _blendDirty(true)
|
||||||
|
, _force2DQueue(false)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -354,6 +355,7 @@ void Mesh::draw(Renderer* renderer, float globalZOrder, const Mat4& transform, u
|
||||||
|
|
||||||
_meshCommand.setSkipBatching(isTransparent);
|
_meshCommand.setSkipBatching(isTransparent);
|
||||||
_meshCommand.setTransparent(isTransparent);
|
_meshCommand.setTransparent(isTransparent);
|
||||||
|
_meshCommand.set3D(!_force2DQueue);
|
||||||
|
|
||||||
// set default uniforms for Mesh
|
// set default uniforms for Mesh
|
||||||
// 'u_color' and others
|
// 'u_color' and others
|
||||||
|
|
|
@ -189,6 +189,10 @@ public:
|
||||||
*/
|
*/
|
||||||
void calculateAABB();
|
void calculateAABB();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* force set this Sprite3D to 2D render queue
|
||||||
|
*/
|
||||||
|
void setForce2DQueue(bool force2D) { _force2DQueue = force2D; }
|
||||||
|
|
||||||
CC_CONSTRUCTOR_ACCESS:
|
CC_CONSTRUCTOR_ACCESS:
|
||||||
|
|
||||||
|
@ -203,6 +207,7 @@ protected:
|
||||||
MeshSkin* _skin; //skin
|
MeshSkin* _skin; //skin
|
||||||
bool _visible; // is the submesh visible
|
bool _visible; // is the submesh visible
|
||||||
bool _isTransparent; // is this mesh transparent, it is a property of material in fact
|
bool _isTransparent; // is this mesh transparent, it is a property of material in fact
|
||||||
|
bool _force2DQueue; // add this mesh to 2D render queue
|
||||||
|
|
||||||
std::string _name;
|
std::string _name;
|
||||||
MeshCommand _meshCommand;
|
MeshCommand _meshCommand;
|
||||||
|
|
|
@ -882,6 +882,13 @@ MeshSkin* Sprite3D::getSkin() const
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Sprite3D::setForce2DQueue(bool force2D)
|
||||||
|
{
|
||||||
|
for (const auto &mesh : _meshes) {
|
||||||
|
mesh->setForce2DQueue(force2D);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
Sprite3DCache* Sprite3DCache::_cacheInstance = nullptr;
|
Sprite3DCache* Sprite3DCache::_cacheInstance = nullptr;
|
||||||
Sprite3DCache* Sprite3DCache::getInstance()
|
Sprite3DCache* Sprite3DCache::getInstance()
|
||||||
|
|
|
@ -195,6 +195,11 @@ public:
|
||||||
*/
|
*/
|
||||||
Material* getMaterial(int meshIndex) const;
|
Material* getMaterial(int meshIndex) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* force set this Sprite3D to 2D render queue
|
||||||
|
*/
|
||||||
|
void setForce2DQueue(bool force2D);
|
||||||
|
|
||||||
CC_CONSTRUCTOR_ACCESS:
|
CC_CONSTRUCTOR_ACCESS:
|
||||||
|
|
||||||
Sprite3D();
|
Sprite3D();
|
||||||
|
|
|
@ -231,6 +231,8 @@ bool TextureCube::init(const std::string& positive_x, const std::string& negativ
|
||||||
|
|
||||||
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
|
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||||
|
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||||
|
|
||||||
_name = handle;
|
_name = handle;
|
||||||
|
|
||||||
|
|
|
@ -68,14 +68,12 @@ bool AudioPlayer::play2d(AudioCache* cache)
|
||||||
alSourcei(_alSource, AL_BUFFER, 0);
|
alSourcei(_alSource, AL_BUFFER, 0);
|
||||||
alSourcef(_alSource, AL_PITCH, 1.0f);
|
alSourcef(_alSource, AL_PITCH, 1.0f);
|
||||||
alSourcef(_alSource, AL_GAIN, _volume);
|
alSourcef(_alSource, AL_GAIN, _volume);
|
||||||
|
alSourcei(_alSource, AL_LOOPING, AL_FALSE);
|
||||||
|
|
||||||
if (_audioCache->_queBufferFrames == 0) {
|
if (_audioCache->_queBufferFrames == 0) {
|
||||||
if (_loop) {
|
if (_loop) {
|
||||||
alSourcei(_alSource, AL_LOOPING, AL_TRUE);
|
alSourcei(_alSource, AL_LOOPING, AL_TRUE);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
alSourcei(_alSource, AL_LOOPING, AL_FALSE);
|
|
||||||
}
|
|
||||||
alSourcei(_alSource, AL_BUFFER, _audioCache->_alBufferId);
|
alSourcei(_alSource, AL_BUFFER, _audioCache->_alBufferId);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -222,6 +222,8 @@ EventDispatcher::~EventDispatcher()
|
||||||
|
|
||||||
void EventDispatcher::visitTarget(Node* node, bool isRootNode)
|
void EventDispatcher::visitTarget(Node* node, bool isRootNode)
|
||||||
{
|
{
|
||||||
|
node->sortAllChildren();
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
auto& children = node->getChildren();
|
auto& children = node->getChildren();
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ NS_CC_BEGIN
|
||||||
|
|
||||||
CC_DLL const char* cocos2dVersion()
|
CC_DLL const char* cocos2dVersion()
|
||||||
{
|
{
|
||||||
return "cocos2d-x-3.7beta0";
|
return "cocos2d-x-3.7rc0";
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_CC_END
|
NS_CC_END
|
||||||
|
|
|
@ -472,13 +472,15 @@ void Armature::onExit()
|
||||||
void Armature::visit(cocos2d::Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags)
|
void Armature::visit(cocos2d::Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags)
|
||||||
{
|
{
|
||||||
// quick return if not visible. children won't be drawn.
|
// quick return if not visible. children won't be drawn.
|
||||||
if (!_visible || !isVisitableByVisitingCamera())
|
if (!_visible)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t flags = processParentFlags(parentTransform, parentFlags);
|
uint32_t flags = processParentFlags(parentTransform, parentFlags);
|
||||||
|
|
||||||
|
if (isVisitableByVisitingCamera())
|
||||||
|
{
|
||||||
// IMPORTANT:
|
// IMPORTANT:
|
||||||
// To ease the migration to v3.0, we still support the Mat4 stack,
|
// To ease the migration to v3.0, we still support the Mat4 stack,
|
||||||
// but it is deprecated and your code should not rely on it
|
// but it is deprecated and your code should not rely on it
|
||||||
|
@ -497,6 +499,7 @@ void Armature::visit(cocos2d::Renderer *renderer, const Mat4 &parentTransform, u
|
||||||
|
|
||||||
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Rect Armature::getBoundingBox() const
|
Rect Armature::getBoundingBox() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -107,13 +107,15 @@ void BatchNode::removeChild(Node* child, bool cleanup)
|
||||||
void BatchNode::visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags)
|
void BatchNode::visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags)
|
||||||
{
|
{
|
||||||
// quick return if not visible. children won't be drawn.
|
// quick return if not visible. children won't be drawn.
|
||||||
if (!_visible || !isVisitableByVisitingCamera())
|
if (!_visible)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t flags = processParentFlags(parentTransform, parentFlags);
|
uint32_t flags = processParentFlags(parentTransform, parentFlags);
|
||||||
|
|
||||||
|
if (isVisitableByVisitingCamera())
|
||||||
|
{
|
||||||
// IMPORTANT:
|
// IMPORTANT:
|
||||||
// To ease the migration to v3.0, we still support the Mat4 stack,
|
// To ease the migration to v3.0, we still support the Mat4 stack,
|
||||||
// but it is deprecated and your code should not rely on it
|
// but it is deprecated and your code should not rely on it
|
||||||
|
@ -130,6 +132,7 @@ void BatchNode::visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t
|
||||||
|
|
||||||
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void BatchNode::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
void BatchNode::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
||||||
{
|
{
|
||||||
|
|
|
@ -313,6 +313,30 @@ public class Cocos2dxGLSurfaceView extends GLSurfaceView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onKeyUp(final int keyCode, KeyEvent event) {
|
||||||
|
switch (keyCode) {
|
||||||
|
case KeyEvent.KEYCODE_BACK:
|
||||||
|
case KeyEvent.KEYCODE_MENU:
|
||||||
|
case KeyEvent.KEYCODE_DPAD_LEFT:
|
||||||
|
case KeyEvent.KEYCODE_DPAD_RIGHT:
|
||||||
|
case KeyEvent.KEYCODE_DPAD_UP:
|
||||||
|
case KeyEvent.KEYCODE_DPAD_DOWN:
|
||||||
|
case KeyEvent.KEYCODE_ENTER:
|
||||||
|
case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
|
||||||
|
case KeyEvent.KEYCODE_DPAD_CENTER:
|
||||||
|
this.queueEvent(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
Cocos2dxGLSurfaceView.this.mCocos2dxRenderer.handleKeyUp(keyCode);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return super.onKeyUp(keyCode, event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ===========================================================
|
// ===========================================================
|
||||||
// Methods
|
// Methods
|
||||||
// ===========================================================
|
// ===========================================================
|
||||||
|
|
|
@ -115,7 +115,7 @@ public class Cocos2dxRenderer implements GLSurfaceView.Renderer {
|
||||||
private static native void nativeTouchesEnd(final int id, final float x, final float y);
|
private static native void nativeTouchesEnd(final int id, final float x, final float y);
|
||||||
private static native void nativeTouchesMove(final int[] ids, final float[] xs, final float[] ys);
|
private static native void nativeTouchesMove(final int[] ids, final float[] xs, final float[] ys);
|
||||||
private static native void nativeTouchesCancel(final int[] ids, final float[] xs, final float[] ys);
|
private static native void nativeTouchesCancel(final int[] ids, final float[] xs, final float[] ys);
|
||||||
private static native boolean nativeKeyDown(final int keyCode);
|
private static native boolean nativeKeyEvent(final int keyCode,boolean isPressed);
|
||||||
private static native void nativeRender();
|
private static native void nativeRender();
|
||||||
private static native void nativeInit(final int width, final int height);
|
private static native void nativeInit(final int width, final int height);
|
||||||
private static native void nativeOnSurfaceChanged(final int width, final int height);
|
private static native void nativeOnSurfaceChanged(final int width, final int height);
|
||||||
|
@ -139,7 +139,11 @@ public class Cocos2dxRenderer implements GLSurfaceView.Renderer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleKeyDown(final int keyCode) {
|
public void handleKeyDown(final int keyCode) {
|
||||||
Cocos2dxRenderer.nativeKeyDown(keyCode);
|
Cocos2dxRenderer.nativeKeyEvent(keyCode, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleKeyUp(final int keyCode) {
|
||||||
|
Cocos2dxRenderer.nativeKeyEvent(keyCode, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleOnPause() {
|
public void handleOnPause() {
|
||||||
|
|
|
@ -100,7 +100,7 @@ extern "C" {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
JNIEXPORT jboolean JNICALL Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeKeyDown(JNIEnv * env, jobject thiz, jint keyCode) {
|
JNIEXPORT jboolean JNICALL Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeKeyEvent(JNIEnv * env, jobject thiz, jint keyCode, jboolean isPressed) {
|
||||||
Director* pDirector = Director::getInstance();
|
Director* pDirector = Director::getInstance();
|
||||||
|
|
||||||
auto iterKeyCode = g_keyCodeMap.find(keyCode);
|
auto iterKeyCode = g_keyCodeMap.find(keyCode);
|
||||||
|
@ -109,7 +109,7 @@ extern "C" {
|
||||||
}
|
}
|
||||||
|
|
||||||
cocos2d::EventKeyboard::KeyCode cocos2dKey = g_keyCodeMap.at(keyCode);
|
cocos2d::EventKeyboard::KeyCode cocos2dKey = g_keyCodeMap.at(keyCode);
|
||||||
cocos2d::EventKeyboard event(cocos2dKey, false);
|
cocos2d::EventKeyboard event(cocos2dKey, isPressed);
|
||||||
cocos2d::Director::getInstance()->getEventDispatcher()->dispatchEvent(&event);
|
cocos2d::Director::getInstance()->getEventDispatcher()->dispatchEvent(&event);
|
||||||
return JNI_TRUE;
|
return JNI_TRUE;
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ NS_CC_BEGIN
|
||||||
|
|
||||||
static WICConvert g_WICConvert[] =
|
static WICConvert g_WICConvert[] =
|
||||||
{
|
{
|
||||||
// Note target GUID in this conversion table must be one of those directly supported formats (above).
|
// Note target GUID in this conversion table must be one of those directly supported by cocos2d-x
|
||||||
|
|
||||||
{ GUID_WICPixelFormatBlackWhite, GUID_WICPixelFormat8bppGray }, // DXGI_FORMAT_R8_UNORM
|
{ GUID_WICPixelFormatBlackWhite, GUID_WICPixelFormat8bppGray }, // DXGI_FORMAT_R8_UNORM
|
||||||
|
|
||||||
|
@ -58,30 +58,11 @@ static WICConvert g_WICConvert[] =
|
||||||
{ GUID_WICPixelFormat32bppPBGRA, GUID_WICPixelFormat32bppRGBA }, // DXGI_FORMAT_R8G8B8A8_UNORM
|
{ GUID_WICPixelFormat32bppPBGRA, GUID_WICPixelFormat32bppRGBA }, // DXGI_FORMAT_R8G8B8A8_UNORM
|
||||||
{ GUID_WICPixelFormat32bppPRGBA, GUID_WICPixelFormat32bppRGBA }, // DXGI_FORMAT_R8G8B8A8_UNORM
|
{ GUID_WICPixelFormat32bppPRGBA, GUID_WICPixelFormat32bppRGBA }, // DXGI_FORMAT_R8G8B8A8_UNORM
|
||||||
|
|
||||||
{ GUID_WICPixelFormat48bppRGB, GUID_WICPixelFormat64bppRGBA }, // DXGI_FORMAT_R16G16B16A16_UNORM
|
{ GUID_WICPixelFormat48bppRGB, GUID_WICPixelFormat24bppRGB }, // DXGI_FORMAT_R16G16B16A16_UNORM
|
||||||
{ GUID_WICPixelFormat48bppBGR, GUID_WICPixelFormat64bppRGBA }, // DXGI_FORMAT_R16G16B16A16_UNORM
|
{ GUID_WICPixelFormat48bppBGR, GUID_WICPixelFormat24bppRGB }, // DXGI_FORMAT_R16G16B16A16_UNORM
|
||||||
{ GUID_WICPixelFormat64bppBGRA, GUID_WICPixelFormat64bppRGBA }, // DXGI_FORMAT_R16G16B16A16_UNORM
|
|
||||||
{ GUID_WICPixelFormat64bppPRGBA, GUID_WICPixelFormat64bppRGBA }, // DXGI_FORMAT_R16G16B16A16_UNORM
|
|
||||||
{ GUID_WICPixelFormat64bppPBGRA, GUID_WICPixelFormat64bppRGBA }, // DXGI_FORMAT_R16G16B16A16_UNORM
|
|
||||||
|
|
||||||
{ GUID_WICPixelFormat48bppRGBFixedPoint, GUID_WICPixelFormat64bppRGBAHalf }, // DXGI_FORMAT_R16G16B16A16_FLOAT
|
{ GUID_WICPixelFormat48bppRGBFixedPoint, GUID_WICPixelFormat24bppRGB }, // DXGI_FORMAT_R16G16B16A16_FLOAT
|
||||||
{ GUID_WICPixelFormat48bppBGRFixedPoint, GUID_WICPixelFormat64bppRGBAHalf }, // DXGI_FORMAT_R16G16B16A16_FLOAT
|
{ GUID_WICPixelFormat48bppBGRFixedPoint, GUID_WICPixelFormat24bppRGB }, // DXGI_FORMAT_R16G16B16A16_FLOAT
|
||||||
{ GUID_WICPixelFormat64bppRGBAFixedPoint, GUID_WICPixelFormat64bppRGBAHalf }, // DXGI_FORMAT_R16G16B16A16_FLOAT
|
|
||||||
{ GUID_WICPixelFormat64bppBGRAFixedPoint, GUID_WICPixelFormat64bppRGBAHalf }, // DXGI_FORMAT_R16G16B16A16_FLOAT
|
|
||||||
{ GUID_WICPixelFormat64bppRGBFixedPoint, GUID_WICPixelFormat64bppRGBAHalf }, // DXGI_FORMAT_R16G16B16A16_FLOAT
|
|
||||||
{ GUID_WICPixelFormat64bppRGBHalf, GUID_WICPixelFormat64bppRGBAHalf }, // DXGI_FORMAT_R16G16B16A16_FLOAT
|
|
||||||
{ GUID_WICPixelFormat48bppRGBHalf, GUID_WICPixelFormat64bppRGBAHalf }, // DXGI_FORMAT_R16G16B16A16_FLOAT
|
|
||||||
|
|
||||||
{ GUID_WICPixelFormat128bppPRGBAFloat, GUID_WICPixelFormat128bppRGBAFloat }, // DXGI_FORMAT_R32G32B32A32_FLOAT
|
|
||||||
{ GUID_WICPixelFormat128bppRGBFloat, GUID_WICPixelFormat128bppRGBAFloat }, // DXGI_FORMAT_R32G32B32A32_FLOAT
|
|
||||||
{ GUID_WICPixelFormat128bppRGBAFixedPoint, GUID_WICPixelFormat128bppRGBAFloat }, // DXGI_FORMAT_R32G32B32A32_FLOAT
|
|
||||||
{ GUID_WICPixelFormat128bppRGBFixedPoint, GUID_WICPixelFormat128bppRGBAFloat }, // DXGI_FORMAT_R32G32B32A32_FLOAT
|
|
||||||
{ GUID_WICPixelFormat32bppRGBE, GUID_WICPixelFormat128bppRGBAFloat }, // DXGI_FORMAT_R32G32B32A32_FLOAT
|
|
||||||
|
|
||||||
{ GUID_WICPixelFormat32bppCMYK, GUID_WICPixelFormat32bppRGBA }, // DXGI_FORMAT_R8G8B8A8_UNORM
|
|
||||||
{ GUID_WICPixelFormat64bppCMYK, GUID_WICPixelFormat64bppRGBA }, // DXGI_FORMAT_R16G16B16A16_UNORM
|
|
||||||
{ GUID_WICPixelFormat40bppCMYKAlpha, GUID_WICPixelFormat64bppRGBA }, // DXGI_FORMAT_R16G16B16A16_UNORM
|
|
||||||
{ GUID_WICPixelFormat80bppCMYKAlpha, GUID_WICPixelFormat64bppRGBA }, // DXGI_FORMAT_R16G16B16A16_UNORM
|
|
||||||
|
|
||||||
//#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) || defined(_WIN7_PLATFORM_UPDATE)
|
//#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) || defined(_WIN7_PLATFORM_UPDATE)
|
||||||
// { GUID_WICPixelFormat32bppRGB, GUID_WICPixelFormat32bppRGBA }, // DXGI_FORMAT_R8G8B8A8_UNORM
|
// { GUID_WICPixelFormat32bppRGB, GUID_WICPixelFormat32bppRGBA }, // DXGI_FORMAT_R8G8B8A8_UNORM
|
||||||
|
|
|
@ -277,37 +277,37 @@ void RenderState::StateBlock::bindNoRestore()
|
||||||
glDepthFunc((GLenum)_depthFunction);
|
glDepthFunc((GLenum)_depthFunction);
|
||||||
_defaultState->_depthFunction = _depthFunction;
|
_defaultState->_depthFunction = _depthFunction;
|
||||||
}
|
}
|
||||||
if ((_bits & RS_STENCIL_TEST) && (_stencilTestEnabled != _defaultState->_stencilTestEnabled))
|
// if ((_bits & RS_STENCIL_TEST) && (_stencilTestEnabled != _defaultState->_stencilTestEnabled))
|
||||||
{
|
// {
|
||||||
if (_stencilTestEnabled)
|
// if (_stencilTestEnabled)
|
||||||
glEnable(GL_STENCIL_TEST);
|
// glEnable(GL_STENCIL_TEST);
|
||||||
else
|
// else
|
||||||
glDisable(GL_STENCIL_TEST);
|
// glDisable(GL_STENCIL_TEST);
|
||||||
_defaultState->_stencilTestEnabled = _stencilTestEnabled;
|
// _defaultState->_stencilTestEnabled = _stencilTestEnabled;
|
||||||
}
|
// }
|
||||||
if ((_bits & RS_STENCIL_WRITE) && (_stencilWrite != _defaultState->_stencilWrite))
|
// if ((_bits & RS_STENCIL_WRITE) && (_stencilWrite != _defaultState->_stencilWrite))
|
||||||
{
|
// {
|
||||||
glStencilMask(_stencilWrite);
|
// glStencilMask(_stencilWrite);
|
||||||
_defaultState->_stencilWrite = _stencilWrite;
|
// _defaultState->_stencilWrite = _stencilWrite;
|
||||||
}
|
// }
|
||||||
if ((_bits & RS_STENCIL_FUNC) && (_stencilFunction != _defaultState->_stencilFunction ||
|
// if ((_bits & RS_STENCIL_FUNC) && (_stencilFunction != _defaultState->_stencilFunction ||
|
||||||
_stencilFunctionRef != _defaultState->_stencilFunctionRef ||
|
// _stencilFunctionRef != _defaultState->_stencilFunctionRef ||
|
||||||
_stencilFunctionMask != _defaultState->_stencilFunctionMask))
|
// _stencilFunctionMask != _defaultState->_stencilFunctionMask))
|
||||||
{
|
// {
|
||||||
glStencilFunc((GLenum)_stencilFunction, _stencilFunctionRef, _stencilFunctionMask);
|
// glStencilFunc((GLenum)_stencilFunction, _stencilFunctionRef, _stencilFunctionMask);
|
||||||
_defaultState->_stencilFunction = _stencilFunction;
|
// _defaultState->_stencilFunction = _stencilFunction;
|
||||||
_defaultState->_stencilFunctionRef = _stencilFunctionRef;
|
// _defaultState->_stencilFunctionRef = _stencilFunctionRef;
|
||||||
_defaultState->_stencilFunctionMask = _stencilFunctionMask;
|
// _defaultState->_stencilFunctionMask = _stencilFunctionMask;
|
||||||
}
|
// }
|
||||||
if ((_bits & RS_STENCIL_OP) && (_stencilOpSfail != _defaultState->_stencilOpSfail ||
|
// if ((_bits & RS_STENCIL_OP) && (_stencilOpSfail != _defaultState->_stencilOpSfail ||
|
||||||
_stencilOpDpfail != _defaultState->_stencilOpDpfail ||
|
// _stencilOpDpfail != _defaultState->_stencilOpDpfail ||
|
||||||
_stencilOpDppass != _defaultState->_stencilOpDppass))
|
// _stencilOpDppass != _defaultState->_stencilOpDppass))
|
||||||
{
|
// {
|
||||||
glStencilOp((GLenum)_stencilOpSfail, (GLenum)_stencilOpDpfail, (GLenum)_stencilOpDppass);
|
// glStencilOp((GLenum)_stencilOpSfail, (GLenum)_stencilOpDpfail, (GLenum)_stencilOpDppass);
|
||||||
_defaultState->_stencilOpSfail = _stencilOpSfail;
|
// _defaultState->_stencilOpSfail = _stencilOpSfail;
|
||||||
_defaultState->_stencilOpDpfail = _stencilOpDpfail;
|
// _defaultState->_stencilOpDpfail = _stencilOpDpfail;
|
||||||
_defaultState->_stencilOpDppass = _stencilOpDppass;
|
// _defaultState->_stencilOpDppass = _stencilOpDppass;
|
||||||
}
|
// }
|
||||||
|
|
||||||
_defaultState->_bits |= _bits;
|
_defaultState->_bits |= _bits;
|
||||||
}
|
}
|
||||||
|
@ -373,34 +373,34 @@ void RenderState::StateBlock::restore(long stateOverrideBits)
|
||||||
_defaultState->_bits &= ~RS_DEPTH_FUNC;
|
_defaultState->_bits &= ~RS_DEPTH_FUNC;
|
||||||
_defaultState->_depthFunction = RenderState::DEPTH_LESS;
|
_defaultState->_depthFunction = RenderState::DEPTH_LESS;
|
||||||
}
|
}
|
||||||
if (!(stateOverrideBits & RS_STENCIL_TEST) && (_defaultState->_bits & RS_STENCIL_TEST))
|
// if (!(stateOverrideBits & RS_STENCIL_TEST) && (_defaultState->_bits & RS_STENCIL_TEST))
|
||||||
{
|
// {
|
||||||
glDisable(GL_STENCIL_TEST);
|
// glDisable(GL_STENCIL_TEST);
|
||||||
_defaultState->_bits &= ~RS_STENCIL_TEST;
|
// _defaultState->_bits &= ~RS_STENCIL_TEST;
|
||||||
_defaultState->_stencilTestEnabled = false;
|
// _defaultState->_stencilTestEnabled = false;
|
||||||
}
|
// }
|
||||||
if (!(stateOverrideBits & RS_STENCIL_WRITE) && (_defaultState->_bits & RS_STENCIL_WRITE))
|
// if (!(stateOverrideBits & RS_STENCIL_WRITE) && (_defaultState->_bits & RS_STENCIL_WRITE))
|
||||||
{
|
// {
|
||||||
glStencilMask(RS_ALL_ONES);
|
// glStencilMask(RS_ALL_ONES);
|
||||||
_defaultState->_bits &= ~RS_STENCIL_WRITE;
|
// _defaultState->_bits &= ~RS_STENCIL_WRITE;
|
||||||
_defaultState->_stencilWrite = RS_ALL_ONES;
|
// _defaultState->_stencilWrite = RS_ALL_ONES;
|
||||||
}
|
// }
|
||||||
if (!(stateOverrideBits & RS_STENCIL_FUNC) && (_defaultState->_bits & RS_STENCIL_FUNC))
|
// if (!(stateOverrideBits & RS_STENCIL_FUNC) && (_defaultState->_bits & RS_STENCIL_FUNC))
|
||||||
{
|
// {
|
||||||
glStencilFunc((GLenum)RenderState::STENCIL_ALWAYS, 0, RS_ALL_ONES);
|
// glStencilFunc((GLenum)RenderState::STENCIL_ALWAYS, 0, RS_ALL_ONES);
|
||||||
_defaultState->_bits &= ~RS_STENCIL_FUNC;
|
// _defaultState->_bits &= ~RS_STENCIL_FUNC;
|
||||||
_defaultState->_stencilFunction = RenderState::STENCIL_ALWAYS;
|
// _defaultState->_stencilFunction = RenderState::STENCIL_ALWAYS;
|
||||||
_defaultState->_stencilFunctionRef = 0;
|
// _defaultState->_stencilFunctionRef = 0;
|
||||||
_defaultState->_stencilFunctionMask = RS_ALL_ONES;
|
// _defaultState->_stencilFunctionMask = RS_ALL_ONES;
|
||||||
}
|
// }
|
||||||
if (!(stateOverrideBits & RS_STENCIL_OP) && (_defaultState->_bits & RS_STENCIL_OP))
|
// if (!(stateOverrideBits & RS_STENCIL_OP) && (_defaultState->_bits & RS_STENCIL_OP))
|
||||||
{
|
// {
|
||||||
glStencilOp((GLenum)RenderState::STENCIL_OP_KEEP, (GLenum)RenderState::STENCIL_OP_KEEP, (GLenum)RenderState::STENCIL_OP_KEEP);
|
// glStencilOp((GLenum)RenderState::STENCIL_OP_KEEP, (GLenum)RenderState::STENCIL_OP_KEEP, (GLenum)RenderState::STENCIL_OP_KEEP);
|
||||||
_defaultState->_bits &= ~RS_STENCIL_OP;
|
// _defaultState->_bits &= ~RS_STENCIL_OP;
|
||||||
_defaultState->_stencilOpSfail = RenderState::STENCIL_OP_KEEP;
|
// _defaultState->_stencilOpSfail = RenderState::STENCIL_OP_KEEP;
|
||||||
_defaultState->_stencilOpDpfail = RenderState::STENCIL_OP_KEEP;
|
// _defaultState->_stencilOpDpfail = RenderState::STENCIL_OP_KEEP;
|
||||||
_defaultState->_stencilOpDppass = RenderState::STENCIL_OP_KEEP;
|
// _defaultState->_stencilOpDppass = RenderState::STENCIL_OP_KEEP;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderState::StateBlock::enableDepthWrite()
|
void RenderState::StateBlock::enableDepthWrite()
|
||||||
|
@ -662,38 +662,38 @@ void RenderState::StateBlock::setState(const std::string& name, const std::strin
|
||||||
{
|
{
|
||||||
setDepthFunction(parseDepthFunc(value));
|
setDepthFunction(parseDepthFunc(value));
|
||||||
}
|
}
|
||||||
else if (name.compare("stencilTest") == 0)
|
// else if (name.compare("stencilTest") == 0)
|
||||||
{
|
// {
|
||||||
setStencilTest(parseBoolean(value));
|
// setStencilTest(parseBoolean(value));
|
||||||
}
|
// }
|
||||||
else if (name.compare("stencilWrite") == 0)
|
// else if (name.compare("stencilWrite") == 0)
|
||||||
{
|
// {
|
||||||
setStencilWrite(parseUInt(value));
|
// setStencilWrite(parseUInt(value));
|
||||||
}
|
// }
|
||||||
else if (name.compare("stencilFunc") == 0)
|
// else if (name.compare("stencilFunc") == 0)
|
||||||
{
|
// {
|
||||||
setStencilFunction(parseStencilFunc(value), _stencilFunctionRef, _stencilFunctionMask);
|
// setStencilFunction(parseStencilFunc(value), _stencilFunctionRef, _stencilFunctionMask);
|
||||||
}
|
// }
|
||||||
else if (name.compare("stencilFuncRef") == 0)
|
// else if (name.compare("stencilFuncRef") == 0)
|
||||||
{
|
// {
|
||||||
setStencilFunction(_stencilFunction, parseInt(value), _stencilFunctionMask);
|
// setStencilFunction(_stencilFunction, parseInt(value), _stencilFunctionMask);
|
||||||
}
|
// }
|
||||||
else if (name.compare("stencilFuncMask") == 0)
|
// else if (name.compare("stencilFuncMask") == 0)
|
||||||
{
|
// {
|
||||||
setStencilFunction(_stencilFunction, _stencilFunctionRef, parseUInt(value));
|
// setStencilFunction(_stencilFunction, _stencilFunctionRef, parseUInt(value));
|
||||||
}
|
// }
|
||||||
else if (name.compare("stencilOpSfail") == 0)
|
// else if (name.compare("stencilOpSfail") == 0)
|
||||||
{
|
// {
|
||||||
setStencilOperation(parseStencilOp(value), _stencilOpDpfail, _stencilOpDppass);
|
// setStencilOperation(parseStencilOp(value), _stencilOpDpfail, _stencilOpDppass);
|
||||||
}
|
// }
|
||||||
else if (name.compare("stencilOpDpfail") == 0)
|
// else if (name.compare("stencilOpDpfail") == 0)
|
||||||
{
|
// {
|
||||||
setStencilOperation(_stencilOpSfail, parseStencilOp(value), _stencilOpDppass);
|
// setStencilOperation(_stencilOpSfail, parseStencilOp(value), _stencilOpDppass);
|
||||||
}
|
// }
|
||||||
else if (name.compare("stencilOpDppass") == 0)
|
// else if (name.compare("stencilOpDppass") == 0)
|
||||||
{
|
// {
|
||||||
setStencilOperation(_stencilOpSfail, _stencilOpDpfail, parseStencilOp(value));
|
// setStencilOperation(_stencilOpSfail, _stencilOpDpfail, parseStencilOp(value));
|
||||||
}
|
// }
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CCLOG("Unsupported render state string '%s'.", name.c_str());
|
CCLOG("Unsupported render state string '%s'.", name.c_str());
|
||||||
|
@ -848,63 +848,63 @@ void RenderState::StateBlock::setDepthFunction(DepthFunction func)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderState::StateBlock::setStencilTest(bool enabled)
|
//void RenderState::StateBlock::setStencilTest(bool enabled)
|
||||||
{
|
//{
|
||||||
_stencilTestEnabled = enabled;
|
// _stencilTestEnabled = enabled;
|
||||||
if (!enabled)
|
// if (!enabled)
|
||||||
{
|
// {
|
||||||
_bits &= ~RS_STENCIL_TEST;
|
// _bits &= ~RS_STENCIL_TEST;
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
_bits |= RS_STENCIL_TEST;
|
// _bits |= RS_STENCIL_TEST;
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
void RenderState::StateBlock::setStencilWrite(unsigned int mask)
|
//void RenderState::StateBlock::setStencilWrite(unsigned int mask)
|
||||||
{
|
//{
|
||||||
_stencilWrite = mask;
|
// _stencilWrite = mask;
|
||||||
if (mask == RS_ALL_ONES)
|
// if (mask == RS_ALL_ONES)
|
||||||
{
|
// {
|
||||||
// Default stencil write
|
// // Default stencil write
|
||||||
_bits &= ~RS_STENCIL_WRITE;
|
// _bits &= ~RS_STENCIL_WRITE;
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
_bits |= RS_STENCIL_WRITE;
|
// _bits |= RS_STENCIL_WRITE;
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
void RenderState::StateBlock::setStencilFunction(StencilFunction func, int ref, unsigned int mask)
|
//void RenderState::StateBlock::setStencilFunction(StencilFunction func, int ref, unsigned int mask)
|
||||||
{
|
//{
|
||||||
_stencilFunction = func;
|
// _stencilFunction = func;
|
||||||
_stencilFunctionRef = ref;
|
// _stencilFunctionRef = ref;
|
||||||
_stencilFunctionMask = mask;
|
// _stencilFunctionMask = mask;
|
||||||
if (func == STENCIL_ALWAYS && ref == 0 && mask == RS_ALL_ONES)
|
// if (func == STENCIL_ALWAYS && ref == 0 && mask == RS_ALL_ONES)
|
||||||
{
|
// {
|
||||||
// Default stencil function
|
// // Default stencil function
|
||||||
_bits &= ~RS_STENCIL_FUNC;
|
// _bits &= ~RS_STENCIL_FUNC;
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
_bits |= RS_STENCIL_FUNC;
|
// _bits |= RS_STENCIL_FUNC;
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
void RenderState::StateBlock::setStencilOperation(StencilOperation sfail, StencilOperation dpfail, StencilOperation dppass)
|
//void RenderState::StateBlock::setStencilOperation(StencilOperation sfail, StencilOperation dpfail, StencilOperation dppass)
|
||||||
{
|
//{
|
||||||
_stencilOpSfail = sfail;
|
// _stencilOpSfail = sfail;
|
||||||
_stencilOpDpfail = dpfail;
|
// _stencilOpDpfail = dpfail;
|
||||||
_stencilOpDppass = dppass;
|
// _stencilOpDppass = dppass;
|
||||||
if (sfail == STENCIL_OP_KEEP && dpfail == STENCIL_OP_KEEP && dppass == STENCIL_OP_KEEP)
|
// if (sfail == STENCIL_OP_KEEP && dpfail == STENCIL_OP_KEEP && dppass == STENCIL_OP_KEEP)
|
||||||
{
|
// {
|
||||||
// Default stencil operation
|
// // Default stencil operation
|
||||||
_bits &= ~RS_STENCIL_OP;
|
// _bits &= ~RS_STENCIL_OP;
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
_bits |= RS_STENCIL_OP;
|
// _bits |= RS_STENCIL_OP;
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
NS_CC_END
|
NS_CC_END
|
|
@ -301,45 +301,45 @@ public:
|
||||||
*/
|
*/
|
||||||
void setDepthFunction(DepthFunction func);
|
void setDepthFunction(DepthFunction func);
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* Toggles stencil testing.
|
// * Toggles stencil testing.
|
||||||
*
|
// *
|
||||||
* By default, stencil testing is disabled.
|
// * By default, stencil testing is disabled.
|
||||||
*
|
// *
|
||||||
* @param enabled true to enable, false to disable.
|
// * @param enabled true to enable, false to disable.
|
||||||
*/
|
// */
|
||||||
void setStencilTest(bool enabled);
|
// void setStencilTest(bool enabled);
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* Sets the stencil writing mask.
|
// * Sets the stencil writing mask.
|
||||||
*
|
// *
|
||||||
* By default, the stencil writing mask is all 1's.
|
// * By default, the stencil writing mask is all 1's.
|
||||||
*
|
// *
|
||||||
* @param mask Bit mask controlling writing to individual stencil planes.
|
// * @param mask Bit mask controlling writing to individual stencil planes.
|
||||||
*/
|
// */
|
||||||
void setStencilWrite(unsigned int mask);
|
// void setStencilWrite(unsigned int mask);
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* Sets the stencil function.
|
// * Sets the stencil function.
|
||||||
*
|
// *
|
||||||
* By default, the function is set to STENCIL_ALWAYS, the reference value is 0, and the mask is all 1's.
|
// * By default, the function is set to STENCIL_ALWAYS, the reference value is 0, and the mask is all 1's.
|
||||||
*
|
// *
|
||||||
* @param func The stencil function.
|
// * @param func The stencil function.
|
||||||
* @param ref The stencil reference value.
|
// * @param ref The stencil reference value.
|
||||||
* @param mask The stencil mask.
|
// * @param mask The stencil mask.
|
||||||
*/
|
// */
|
||||||
void setStencilFunction(StencilFunction func, int ref, unsigned int mask);
|
// void setStencilFunction(StencilFunction func, int ref, unsigned int mask);
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* Sets the stencil operation.
|
// * Sets the stencil operation.
|
||||||
*
|
// *
|
||||||
* By default, stencil fail, stencil pass/depth fail, and stencil and depth pass are set to STENCIL_OP_KEEP.
|
// * By default, stencil fail, stencil pass/depth fail, and stencil and depth pass are set to STENCIL_OP_KEEP.
|
||||||
*
|
// *
|
||||||
* @param sfail The stencil operation if the stencil test fails.
|
// * @param sfail The stencil operation if the stencil test fails.
|
||||||
* @param dpfail The stencil operation if the stencil test passes, but the depth test fails.
|
// * @param dpfail The stencil operation if the stencil test passes, but the depth test fails.
|
||||||
* @param dppass The stencil operation if both the stencil test and depth test pass.
|
// * @param dppass The stencil operation if both the stencil test and depth test pass.
|
||||||
*/
|
// */
|
||||||
void setStencilOperation(StencilOperation sfail, StencilOperation dpfail, StencilOperation dppass);
|
// void setStencilOperation(StencilOperation sfail, StencilOperation dpfail, StencilOperation dppass);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a render state from the given name and value strings.
|
* Sets a render state from the given name and value strings.
|
||||||
|
@ -366,10 +366,10 @@ public:
|
||||||
RS_DEPTH_WRITE = (1 << 4),
|
RS_DEPTH_WRITE = (1 << 4),
|
||||||
RS_DEPTH_FUNC = (1 << 5),
|
RS_DEPTH_FUNC = (1 << 5),
|
||||||
RS_CULL_FACE_SIDE = (1 << 6),
|
RS_CULL_FACE_SIDE = (1 << 6),
|
||||||
RS_STENCIL_TEST = (1 << 7),
|
// RS_STENCIL_TEST = (1 << 7),
|
||||||
RS_STENCIL_WRITE = (1 << 8),
|
// RS_STENCIL_WRITE = (1 << 8),
|
||||||
RS_STENCIL_FUNC = (1 << 9),
|
// RS_STENCIL_FUNC = (1 << 9),
|
||||||
RS_STENCIL_OP = (1 << 10),
|
// RS_STENCIL_OP = (1 << 10),
|
||||||
RS_FRONT_FACE = (1 << 11),
|
RS_FRONT_FACE = (1 << 11),
|
||||||
|
|
||||||
RS_ALL_ONES = 0xFFFFFFFF,
|
RS_ALL_ONES = 0xFFFFFFFF,
|
||||||
|
|
|
@ -562,6 +562,16 @@ blendfunc
|
||||||
{
|
{
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @method setForce2DQueue
|
||||||
|
* @param {bool} arg0
|
||||||
|
*/
|
||||||
|
setForce2DQueue : function (
|
||||||
|
bool
|
||||||
|
)
|
||||||
|
{
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @method getPrimitiveType
|
* @method getPrimitiveType
|
||||||
* @return {unsigned int}
|
* @return {unsigned int}
|
||||||
|
@ -1132,6 +1142,16 @@ blendfunc
|
||||||
{
|
{
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @method setForce2DQueue
|
||||||
|
* @param {bool} arg0
|
||||||
|
*/
|
||||||
|
setForce2DQueue : function (
|
||||||
|
bool
|
||||||
|
)
|
||||||
|
{
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @method removeAttachNode
|
* @method removeAttachNode
|
||||||
* @param {String} arg0
|
* @param {String} arg0
|
||||||
|
|
|
@ -1705,6 +1705,26 @@ bool js_cocos2dx_3d_Mesh_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp)
|
||||||
JS_ReportError(cx, "js_cocos2dx_3d_Mesh_setBlendFunc : wrong number of arguments: %d, was expecting %d", argc, 1);
|
JS_ReportError(cx, "js_cocos2dx_3d_Mesh_setBlendFunc : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
bool js_cocos2dx_3d_Mesh_setForce2DQueue(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::Mesh* cobj = (cocos2d::Mesh *)(proxy ? proxy->ptr : NULL);
|
||||||
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Mesh_setForce2DQueue : Invalid Native Object");
|
||||||
|
if (argc == 1) {
|
||||||
|
bool arg0;
|
||||||
|
arg0 = JS::ToBoolean(args.get(0));
|
||||||
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Mesh_setForce2DQueue : Error processing arguments");
|
||||||
|
cobj->setForce2DQueue(arg0);
|
||||||
|
args.rval().setUndefined();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
JS_ReportError(cx, "js_cocos2dx_3d_Mesh_setForce2DQueue : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
bool js_cocos2dx_3d_Mesh_getPrimitiveType(JSContext *cx, uint32_t argc, jsval *vp)
|
bool js_cocos2dx_3d_Mesh_getPrimitiveType(JSContext *cx, uint32_t argc, jsval *vp)
|
||||||
{
|
{
|
||||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||||
|
@ -1908,6 +1928,7 @@ void js_register_cocos2dx_3d_Mesh(JSContext *cx, JS::HandleObject global) {
|
||||||
JS_FN("setMeshIndexData", js_cocos2dx_3d_Mesh_setMeshIndexData, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
JS_FN("setMeshIndexData", js_cocos2dx_3d_Mesh_setMeshIndexData, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||||
JS_FN("getMeshVertexAttribCount", js_cocos2dx_3d_Mesh_getMeshVertexAttribCount, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
JS_FN("getMeshVertexAttribCount", js_cocos2dx_3d_Mesh_getMeshVertexAttribCount, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||||
JS_FN("setBlendFunc", js_cocos2dx_3d_Mesh_setBlendFunc, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
JS_FN("setBlendFunc", js_cocos2dx_3d_Mesh_setBlendFunc, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||||
|
JS_FN("setForce2DQueue", js_cocos2dx_3d_Mesh_setForce2DQueue, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||||
JS_FN("getPrimitiveType", js_cocos2dx_3d_Mesh_getPrimitiveType, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
JS_FN("getPrimitiveType", js_cocos2dx_3d_Mesh_getPrimitiveType, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||||
JS_FN("setSkin", js_cocos2dx_3d_Mesh_setSkin, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
JS_FN("setSkin", js_cocos2dx_3d_Mesh_setSkin, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||||
JS_FN("isVisible", js_cocos2dx_3d_Mesh_isVisible, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
JS_FN("isVisible", js_cocos2dx_3d_Mesh_isVisible, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||||
|
@ -3212,6 +3233,26 @@ bool js_cocos2dx_3d_Sprite3D_setBlendFunc(JSContext *cx, uint32_t argc, jsval *v
|
||||||
JS_ReportError(cx, "js_cocos2dx_3d_Sprite3D_setBlendFunc : wrong number of arguments: %d, was expecting %d", argc, 1);
|
JS_ReportError(cx, "js_cocos2dx_3d_Sprite3D_setBlendFunc : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
bool js_cocos2dx_3d_Sprite3D_setForce2DQueue(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::Sprite3D* cobj = (cocos2d::Sprite3D *)(proxy ? proxy->ptr : NULL);
|
||||||
|
JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_3d_Sprite3D_setForce2DQueue : Invalid Native Object");
|
||||||
|
if (argc == 1) {
|
||||||
|
bool arg0;
|
||||||
|
arg0 = JS::ToBoolean(args.get(0));
|
||||||
|
JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_3d_Sprite3D_setForce2DQueue : Error processing arguments");
|
||||||
|
cobj->setForce2DQueue(arg0);
|
||||||
|
args.rval().setUndefined();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
JS_ReportError(cx, "js_cocos2dx_3d_Sprite3D_setForce2DQueue : wrong number of arguments: %d, was expecting %d", argc, 1);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
bool js_cocos2dx_3d_Sprite3D_removeAttachNode(JSContext *cx, uint32_t argc, jsval *vp)
|
bool js_cocos2dx_3d_Sprite3D_removeAttachNode(JSContext *cx, uint32_t argc, jsval *vp)
|
||||||
{
|
{
|
||||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||||
|
@ -3471,6 +3512,7 @@ void js_register_cocos2dx_3d_Sprite3D(JSContext *cx, JS::HandleObject global) {
|
||||||
JS_FN("getAttachNode", js_cocos2dx_3d_Sprite3D_getAttachNode, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
JS_FN("getAttachNode", js_cocos2dx_3d_Sprite3D_getAttachNode, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||||
JS_FN("initWithFile", js_cocos2dx_3d_Sprite3D_initWithFile, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
JS_FN("initWithFile", js_cocos2dx_3d_Sprite3D_initWithFile, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||||
JS_FN("setBlendFunc", js_cocos2dx_3d_Sprite3D_setBlendFunc, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
JS_FN("setBlendFunc", js_cocos2dx_3d_Sprite3D_setBlendFunc, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||||
|
JS_FN("setForce2DQueue", js_cocos2dx_3d_Sprite3D_setForce2DQueue, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||||
JS_FN("removeAttachNode", js_cocos2dx_3d_Sprite3D_removeAttachNode, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
JS_FN("removeAttachNode", js_cocos2dx_3d_Sprite3D_removeAttachNode, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||||
JS_FN("getSkeleton", js_cocos2dx_3d_Sprite3D_getSkeleton, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
JS_FN("getSkeleton", js_cocos2dx_3d_Sprite3D_getSkeleton, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||||
JS_FN("setForceDepthWrite", js_cocos2dx_3d_Sprite3D_setForceDepthWrite, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
JS_FN("setForceDepthWrite", js_cocos2dx_3d_Sprite3D_setForceDepthWrite, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
|
||||||
|
|
|
@ -92,6 +92,7 @@ bool js_cocos2dx_3d_Mesh_getIndexCount(JSContext *cx, uint32_t argc, jsval *vp);
|
||||||
bool js_cocos2dx_3d_Mesh_setMeshIndexData(JSContext *cx, uint32_t argc, jsval *vp);
|
bool js_cocos2dx_3d_Mesh_setMeshIndexData(JSContext *cx, uint32_t argc, jsval *vp);
|
||||||
bool js_cocos2dx_3d_Mesh_getMeshVertexAttribCount(JSContext *cx, uint32_t argc, jsval *vp);
|
bool js_cocos2dx_3d_Mesh_getMeshVertexAttribCount(JSContext *cx, uint32_t argc, jsval *vp);
|
||||||
bool js_cocos2dx_3d_Mesh_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp);
|
bool js_cocos2dx_3d_Mesh_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp);
|
||||||
|
bool js_cocos2dx_3d_Mesh_setForce2DQueue(JSContext *cx, uint32_t argc, jsval *vp);
|
||||||
bool js_cocos2dx_3d_Mesh_getPrimitiveType(JSContext *cx, uint32_t argc, jsval *vp);
|
bool js_cocos2dx_3d_Mesh_getPrimitiveType(JSContext *cx, uint32_t argc, jsval *vp);
|
||||||
bool js_cocos2dx_3d_Mesh_setSkin(JSContext *cx, uint32_t argc, jsval *vp);
|
bool js_cocos2dx_3d_Mesh_setSkin(JSContext *cx, uint32_t argc, jsval *vp);
|
||||||
bool js_cocos2dx_3d_Mesh_isVisible(JSContext *cx, uint32_t argc, jsval *vp);
|
bool js_cocos2dx_3d_Mesh_isVisible(JSContext *cx, uint32_t argc, jsval *vp);
|
||||||
|
@ -165,6 +166,7 @@ bool js_cocos2dx_3d_Sprite3D_initFrom(JSContext *cx, uint32_t argc, jsval *vp);
|
||||||
bool js_cocos2dx_3d_Sprite3D_getAttachNode(JSContext *cx, uint32_t argc, jsval *vp);
|
bool js_cocos2dx_3d_Sprite3D_getAttachNode(JSContext *cx, uint32_t argc, jsval *vp);
|
||||||
bool js_cocos2dx_3d_Sprite3D_initWithFile(JSContext *cx, uint32_t argc, jsval *vp);
|
bool js_cocos2dx_3d_Sprite3D_initWithFile(JSContext *cx, uint32_t argc, jsval *vp);
|
||||||
bool js_cocos2dx_3d_Sprite3D_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp);
|
bool js_cocos2dx_3d_Sprite3D_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp);
|
||||||
|
bool js_cocos2dx_3d_Sprite3D_setForce2DQueue(JSContext *cx, uint32_t argc, jsval *vp);
|
||||||
bool js_cocos2dx_3d_Sprite3D_removeAttachNode(JSContext *cx, uint32_t argc, jsval *vp);
|
bool js_cocos2dx_3d_Sprite3D_removeAttachNode(JSContext *cx, uint32_t argc, jsval *vp);
|
||||||
bool js_cocos2dx_3d_Sprite3D_getSkeleton(JSContext *cx, uint32_t argc, jsval *vp);
|
bool js_cocos2dx_3d_Sprite3D_getSkeleton(JSContext *cx, uint32_t argc, jsval *vp);
|
||||||
bool js_cocos2dx_3d_Sprite3D_setForceDepthWrite(JSContext *cx, uint32_t argc, jsval *vp);
|
bool js_cocos2dx_3d_Sprite3D_setForceDepthWrite(JSContext *cx, uint32_t argc, jsval *vp);
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#define ENGINE_VERSION "Cocos2d-JS v3.7 Beta0"
|
#define ENGINE_VERSION "Cocos2d-JS v3.7 RC0"
|
||||||
|
|
||||||
void js_log(const char *format, ...);
|
void js_log(const char *format, ...);
|
||||||
|
|
||||||
|
|
|
@ -172,21 +172,6 @@
|
||||||
BA4095C31A6F730A005E53F6 /* jsb_cocos2dx_studio_conversions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA4095C01A6F730A005E53F6 /* jsb_cocos2dx_studio_conversions.cpp */; };
|
BA4095C31A6F730A005E53F6 /* jsb_cocos2dx_studio_conversions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA4095C01A6F730A005E53F6 /* jsb_cocos2dx_studio_conversions.cpp */; };
|
||||||
BA4095C41A6F730A005E53F6 /* jsb_cocos2dx_studio_conversions.h in Headers */ = {isa = PBXBuildFile; fileRef = BA4095C11A6F730A005E53F6 /* jsb_cocos2dx_studio_conversions.h */; };
|
BA4095C41A6F730A005E53F6 /* jsb_cocos2dx_studio_conversions.h in Headers */ = {isa = PBXBuildFile; fileRef = BA4095C11A6F730A005E53F6 /* jsb_cocos2dx_studio_conversions.h */; };
|
||||||
BA4095C51A6F730A005E53F6 /* jsb_cocos2dx_studio_conversions.h in Headers */ = {isa = PBXBuildFile; fileRef = BA4095C11A6F730A005E53F6 /* jsb_cocos2dx_studio_conversions.h */; };
|
BA4095C51A6F730A005E53F6 /* jsb_cocos2dx_studio_conversions.h in Headers */ = {isa = PBXBuildFile; fileRef = BA4095C11A6F730A005E53F6 /* jsb_cocos2dx_studio_conversions.h */; };
|
||||||
BA623E09191A195F00761F37 /* jsb_pluginx_basic_conversions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA623DFC191A195F00761F37 /* jsb_pluginx_basic_conversions.cpp */; };
|
|
||||||
BA623E0A191A195F00761F37 /* jsb_pluginx_basic_conversions.h in Headers */ = {isa = PBXBuildFile; fileRef = BA623DFD191A195F00761F37 /* jsb_pluginx_basic_conversions.h */; };
|
|
||||||
BA623E0B191A195F00761F37 /* jsb_pluginx_extension_registration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA623DFE191A195F00761F37 /* jsb_pluginx_extension_registration.cpp */; };
|
|
||||||
BA623E0C191A195F00761F37 /* jsb_pluginx_extension_registration.h in Headers */ = {isa = PBXBuildFile; fileRef = BA623DFF191A195F00761F37 /* jsb_pluginx_extension_registration.h */; };
|
|
||||||
BA623E0D191A195F00761F37 /* jsb_pluginx_manual_callback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA623E00191A195F00761F37 /* jsb_pluginx_manual_callback.cpp */; };
|
|
||||||
BA623E0E191A195F00761F37 /* jsb_pluginx_manual_callback.h in Headers */ = {isa = PBXBuildFile; fileRef = BA623E01191A195F00761F37 /* jsb_pluginx_manual_callback.h */; };
|
|
||||||
BA623E0F191A195F00761F37 /* jsb_pluginx_manual_protocols.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA623E02191A195F00761F37 /* jsb_pluginx_manual_protocols.cpp */; };
|
|
||||||
BA623E10191A195F00761F37 /* jsb_pluginx_manual_protocols.h in Headers */ = {isa = PBXBuildFile; fileRef = BA623E03191A195F00761F37 /* jsb_pluginx_manual_protocols.h */; };
|
|
||||||
BA623E11191A195F00761F37 /* jsb_pluginx_spidermonkey_specifics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA623E04191A195F00761F37 /* jsb_pluginx_spidermonkey_specifics.cpp */; };
|
|
||||||
BA623E12191A195F00761F37 /* jsb_pluginx_spidermonkey_specifics.h in Headers */ = {isa = PBXBuildFile; fileRef = BA623E05191A195F00761F37 /* jsb_pluginx_spidermonkey_specifics.h */; };
|
|
||||||
BA623E13191A195F00761F37 /* pluginxUTF8.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA623E06191A195F00761F37 /* pluginxUTF8.cpp */; };
|
|
||||||
BA623E14191A195F00761F37 /* pluginxUTF8.h in Headers */ = {isa = PBXBuildFile; fileRef = BA623E07191A195F00761F37 /* pluginxUTF8.h */; };
|
|
||||||
BA623E15191A195F00761F37 /* uthash.h in Headers */ = {isa = PBXBuildFile; fileRef = BA623E08191A195F00761F37 /* uthash.h */; };
|
|
||||||
BA623E18191A196F00761F37 /* jsb_cocos2dx_pluginx_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA623E16191A196F00761F37 /* jsb_cocos2dx_pluginx_auto.cpp */; };
|
|
||||||
BA623E19191A196F00761F37 /* jsb_cocos2dx_pluginx_auto.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BA623E17191A196F00761F37 /* jsb_cocos2dx_pluginx_auto.hpp */; };
|
|
||||||
BAEE4D711AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BAEE4D6F1AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.cpp */; };
|
BAEE4D711AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BAEE4D6F1AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.cpp */; };
|
||||||
BAEE4D721AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BAEE4D6F1AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.cpp */; };
|
BAEE4D721AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BAEE4D6F1AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.cpp */; };
|
||||||
BAEE4D731AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BAEE4D701AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.hpp */; };
|
BAEE4D731AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BAEE4D701AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.hpp */; };
|
||||||
|
@ -302,21 +287,6 @@
|
||||||
B38AD56D1B1D38700057DD7F /* jsb_cocos2dx_experimental_video_auto.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = jsb_cocos2dx_experimental_video_auto.hpp; sourceTree = "<group>"; };
|
B38AD56D1B1D38700057DD7F /* jsb_cocos2dx_experimental_video_auto.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = jsb_cocos2dx_experimental_video_auto.hpp; sourceTree = "<group>"; };
|
||||||
BA4095C01A6F730A005E53F6 /* jsb_cocos2dx_studio_conversions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jsb_cocos2dx_studio_conversions.cpp; sourceTree = "<group>"; };
|
BA4095C01A6F730A005E53F6 /* jsb_cocos2dx_studio_conversions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jsb_cocos2dx_studio_conversions.cpp; sourceTree = "<group>"; };
|
||||||
BA4095C11A6F730A005E53F6 /* jsb_cocos2dx_studio_conversions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jsb_cocos2dx_studio_conversions.h; sourceTree = "<group>"; };
|
BA4095C11A6F730A005E53F6 /* jsb_cocos2dx_studio_conversions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jsb_cocos2dx_studio_conversions.h; sourceTree = "<group>"; };
|
||||||
BA623DFC191A195F00761F37 /* jsb_pluginx_basic_conversions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = jsb_pluginx_basic_conversions.cpp; path = ../../../../plugin/jsbindings/manual/jsb_pluginx_basic_conversions.cpp; sourceTree = "<group>"; };
|
|
||||||
BA623DFD191A195F00761F37 /* jsb_pluginx_basic_conversions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = jsb_pluginx_basic_conversions.h; path = ../../../../plugin/jsbindings/manual/jsb_pluginx_basic_conversions.h; sourceTree = "<group>"; };
|
|
||||||
BA623DFE191A195F00761F37 /* jsb_pluginx_extension_registration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = jsb_pluginx_extension_registration.cpp; path = ../../../../plugin/jsbindings/manual/jsb_pluginx_extension_registration.cpp; sourceTree = "<group>"; };
|
|
||||||
BA623DFF191A195F00761F37 /* jsb_pluginx_extension_registration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = jsb_pluginx_extension_registration.h; path = ../../../../plugin/jsbindings/manual/jsb_pluginx_extension_registration.h; sourceTree = "<group>"; };
|
|
||||||
BA623E00191A195F00761F37 /* jsb_pluginx_manual_callback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = jsb_pluginx_manual_callback.cpp; path = ../../../../plugin/jsbindings/manual/jsb_pluginx_manual_callback.cpp; sourceTree = "<group>"; };
|
|
||||||
BA623E01191A195F00761F37 /* jsb_pluginx_manual_callback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = jsb_pluginx_manual_callback.h; path = ../../../../plugin/jsbindings/manual/jsb_pluginx_manual_callback.h; sourceTree = "<group>"; };
|
|
||||||
BA623E02191A195F00761F37 /* jsb_pluginx_manual_protocols.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = jsb_pluginx_manual_protocols.cpp; path = ../../../../plugin/jsbindings/manual/jsb_pluginx_manual_protocols.cpp; sourceTree = "<group>"; };
|
|
||||||
BA623E03191A195F00761F37 /* jsb_pluginx_manual_protocols.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = jsb_pluginx_manual_protocols.h; path = ../../../../plugin/jsbindings/manual/jsb_pluginx_manual_protocols.h; sourceTree = "<group>"; };
|
|
||||||
BA623E04191A195F00761F37 /* jsb_pluginx_spidermonkey_specifics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = jsb_pluginx_spidermonkey_specifics.cpp; path = ../../../../plugin/jsbindings/manual/jsb_pluginx_spidermonkey_specifics.cpp; sourceTree = "<group>"; };
|
|
||||||
BA623E05191A195F00761F37 /* jsb_pluginx_spidermonkey_specifics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = jsb_pluginx_spidermonkey_specifics.h; path = ../../../../plugin/jsbindings/manual/jsb_pluginx_spidermonkey_specifics.h; sourceTree = "<group>"; };
|
|
||||||
BA623E06191A195F00761F37 /* pluginxUTF8.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = pluginxUTF8.cpp; path = ../../../../plugin/jsbindings/manual/pluginxUTF8.cpp; sourceTree = "<group>"; };
|
|
||||||
BA623E07191A195F00761F37 /* pluginxUTF8.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pluginxUTF8.h; path = ../../../../plugin/jsbindings/manual/pluginxUTF8.h; sourceTree = "<group>"; };
|
|
||||||
BA623E08191A195F00761F37 /* uthash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = uthash.h; path = ../../../../plugin/jsbindings/manual/uthash.h; sourceTree = "<group>"; };
|
|
||||||
BA623E16191A196F00761F37 /* jsb_cocos2dx_pluginx_auto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = jsb_cocos2dx_pluginx_auto.cpp; path = ../../../../plugin/jsbindings/auto/jsb_cocos2dx_pluginx_auto.cpp; sourceTree = "<group>"; };
|
|
||||||
BA623E17191A196F00761F37 /* jsb_cocos2dx_pluginx_auto.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = jsb_cocos2dx_pluginx_auto.hpp; path = ../../../../plugin/jsbindings/auto/jsb_cocos2dx_pluginx_auto.hpp; sourceTree = "<group>"; };
|
|
||||||
BAEE4D6F1AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jsb_cocos2dx_3d_extension_auto.cpp; sourceTree = "<group>"; };
|
BAEE4D6F1AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jsb_cocos2dx_3d_extension_auto.cpp; sourceTree = "<group>"; };
|
||||||
BAEE4D701AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = jsb_cocos2dx_3d_extension_auto.hpp; sourceTree = "<group>"; };
|
BAEE4D701AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = jsb_cocos2dx_3d_extension_auto.hpp; sourceTree = "<group>"; };
|
||||||
BAFA58F91B319F05004F9246 /* jsb_cocos2dx_navmesh_auto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jsb_cocos2dx_navmesh_auto.cpp; sourceTree = "<group>"; };
|
BAFA58F91B319F05004F9246 /* jsb_cocos2dx_navmesh_auto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jsb_cocos2dx_navmesh_auto.cpp; sourceTree = "<group>"; };
|
||||||
|
@ -393,8 +363,6 @@
|
||||||
1A119E3F18BDF19200352BAA /* jsb_cocos2dx_studio_auto.hpp */,
|
1A119E3F18BDF19200352BAA /* jsb_cocos2dx_studio_auto.hpp */,
|
||||||
1AB5E62918D05BC80088DAA4 /* jsb_cocos2dx_ui_auto.cpp */,
|
1AB5E62918D05BC80088DAA4 /* jsb_cocos2dx_ui_auto.cpp */,
|
||||||
1AB5E62A18D05BC80088DAA4 /* jsb_cocos2dx_ui_auto.hpp */,
|
1AB5E62A18D05BC80088DAA4 /* jsb_cocos2dx_ui_auto.hpp */,
|
||||||
BA623E16191A196F00761F37 /* jsb_cocos2dx_pluginx_auto.cpp */,
|
|
||||||
BA623E17191A196F00761F37 /* jsb_cocos2dx_pluginx_auto.hpp */,
|
|
||||||
BAFA58F91B319F05004F9246 /* jsb_cocos2dx_navmesh_auto.cpp */,
|
BAFA58F91B319F05004F9246 /* jsb_cocos2dx_navmesh_auto.cpp */,
|
||||||
BAFA58FA1B319F05004F9246 /* jsb_cocos2dx_navmesh_auto.hpp */,
|
BAFA58FA1B319F05004F9246 /* jsb_cocos2dx_navmesh_auto.hpp */,
|
||||||
);
|
);
|
||||||
|
@ -439,7 +407,6 @@
|
||||||
1A119E7E18BDF19200352BAA /* spidermonkey_specifics.h */,
|
1A119E7E18BDF19200352BAA /* spidermonkey_specifics.h */,
|
||||||
1A119E7F18BDF19200352BAA /* spine */,
|
1A119E7F18BDF19200352BAA /* spine */,
|
||||||
1AB5E62F18D05BF30088DAA4 /* ui */,
|
1AB5E62F18D05BF30088DAA4 /* ui */,
|
||||||
BA623DFB191A192700761F37 /* pluginx */,
|
|
||||||
);
|
);
|
||||||
name = manual;
|
name = manual;
|
||||||
path = ../manual;
|
path = ../manual;
|
||||||
|
@ -603,26 +570,6 @@
|
||||||
name = experimental;
|
name = experimental;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
BA623DFB191A192700761F37 /* pluginx */ = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
BA623DFC191A195F00761F37 /* jsb_pluginx_basic_conversions.cpp */,
|
|
||||||
BA623DFD191A195F00761F37 /* jsb_pluginx_basic_conversions.h */,
|
|
||||||
BA623DFE191A195F00761F37 /* jsb_pluginx_extension_registration.cpp */,
|
|
||||||
BA623DFF191A195F00761F37 /* jsb_pluginx_extension_registration.h */,
|
|
||||||
BA623E00191A195F00761F37 /* jsb_pluginx_manual_callback.cpp */,
|
|
||||||
BA623E01191A195F00761F37 /* jsb_pluginx_manual_callback.h */,
|
|
||||||
BA623E02191A195F00761F37 /* jsb_pluginx_manual_protocols.cpp */,
|
|
||||||
BA623E03191A195F00761F37 /* jsb_pluginx_manual_protocols.h */,
|
|
||||||
BA623E04191A195F00761F37 /* jsb_pluginx_spidermonkey_specifics.cpp */,
|
|
||||||
BA623E05191A195F00761F37 /* jsb_pluginx_spidermonkey_specifics.h */,
|
|
||||||
BA623E06191A195F00761F37 /* pluginxUTF8.cpp */,
|
|
||||||
BA623E07191A195F00761F37 /* pluginxUTF8.h */,
|
|
||||||
BA623E08191A195F00761F37 /* uthash.h */,
|
|
||||||
);
|
|
||||||
name = pluginx;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
BAFA59001B319F38004F9246 /* navmesh */ = {
|
BAFA59001B319F38004F9246 /* navmesh */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
@ -715,11 +662,9 @@
|
||||||
4B22F4AC1B159A7A0044C14E /* jsb_cocos2dx_experimental_webView_manual.h in Headers */,
|
4B22F4AC1B159A7A0044C14E /* jsb_cocos2dx_experimental_webView_manual.h in Headers */,
|
||||||
1A119E8C18BDF19200352BAA /* jsb_cocos2dx_builder_auto.hpp in Headers */,
|
1A119E8C18BDF19200352BAA /* jsb_cocos2dx_builder_auto.hpp in Headers */,
|
||||||
4BE089E51ADF965E00D65D4B /* jsb_cocos2dx_experimental_webView_auto.hpp in Headers */,
|
4BE089E51ADF965E00D65D4B /* jsb_cocos2dx_experimental_webView_auto.hpp in Headers */,
|
||||||
BA623E19191A196F00761F37 /* jsb_cocos2dx_pluginx_auto.hpp in Headers */,
|
|
||||||
1A119EAA18BDF19200352BAA /* js_bindings_chipmunk_auto_classes.h in Headers */,
|
1A119EAA18BDF19200352BAA /* js_bindings_chipmunk_auto_classes.h in Headers */,
|
||||||
1A119E9E18BDF19200352BAA /* jsb_cocos2dx_spine_auto.hpp in Headers */,
|
1A119E9E18BDF19200352BAA /* jsb_cocos2dx_spine_auto.hpp in Headers */,
|
||||||
1A119EEC18BDF19200352BAA /* jsb_opengl_registration.h in Headers */,
|
1A119EEC18BDF19200352BAA /* jsb_opengl_registration.h in Headers */,
|
||||||
BA623E15191A195F00761F37 /* uthash.h in Headers */,
|
|
||||||
1A119F0418BDF19200352BAA /* spidermonkey_specifics.h in Headers */,
|
1A119F0418BDF19200352BAA /* spidermonkey_specifics.h in Headers */,
|
||||||
1A119EE818BDF19200352BAA /* jsb_opengl_manual.h in Headers */,
|
1A119EE818BDF19200352BAA /* jsb_opengl_manual.h in Headers */,
|
||||||
1A119ED618BDF19200352BAA /* js_bindings_core.h in Headers */,
|
1A119ED618BDF19200352BAA /* js_bindings_core.h in Headers */,
|
||||||
|
@ -731,28 +676,22 @@
|
||||||
1A119EFE18BDF19200352BAA /* XMLHTTPRequest.h in Headers */,
|
1A119EFE18BDF19200352BAA /* XMLHTTPRequest.h in Headers */,
|
||||||
1AB5E63618D05BF30088DAA4 /* jsb_cocos2dx_ui_manual.h in Headers */,
|
1AB5E63618D05BF30088DAA4 /* jsb_cocos2dx_ui_manual.h in Headers */,
|
||||||
1A119EE418BDF19200352BAA /* jsb_opengl_functions.h in Headers */,
|
1A119EE418BDF19200352BAA /* jsb_opengl_functions.h in Headers */,
|
||||||
BA623E10191A195F00761F37 /* jsb_pluginx_manual_protocols.h in Headers */,
|
|
||||||
1AB5E62E18D05BC80088DAA4 /* jsb_cocos2dx_ui_auto.hpp in Headers */,
|
1AB5E62E18D05BC80088DAA4 /* jsb_cocos2dx_ui_auto.hpp in Headers */,
|
||||||
1A119EDA18BDF19200352BAA /* js_bindings_opengl.h in Headers */,
|
1A119EDA18BDF19200352BAA /* js_bindings_opengl.h in Headers */,
|
||||||
1A119EC818BDF19200352BAA /* jsb_cocos2dx_studio_manual.h in Headers */,
|
1A119EC818BDF19200352BAA /* jsb_cocos2dx_studio_manual.h in Headers */,
|
||||||
426390001B0EC1B7004C53A2 /* jsb_cocos2dx_physics3d_auto.hpp in Headers */,
|
426390001B0EC1B7004C53A2 /* jsb_cocos2dx_physics3d_auto.hpp in Headers */,
|
||||||
420BBCFA1AA48EE900493976 /* jsb_cocos2dx_3d_manual.h in Headers */,
|
420BBCFA1AA48EE900493976 /* jsb_cocos2dx_3d_manual.h in Headers */,
|
||||||
BA623E0C191A195F00761F37 /* jsb_pluginx_extension_registration.h in Headers */,
|
|
||||||
1A119EAC18BDF19200352BAA /* js_bindings_chipmunk_auto_classes_registration.h in Headers */,
|
1A119EAC18BDF19200352BAA /* js_bindings_chipmunk_auto_classes_registration.h in Headers */,
|
||||||
420BBCF31AA48EDE00493976 /* jsb_cocos2dx_3d_auto.hpp in Headers */,
|
420BBCF31AA48EDE00493976 /* jsb_cocos2dx_3d_auto.hpp in Headers */,
|
||||||
1A119EBA18BDF19200352BAA /* js_bindings_chipmunk_registration.h in Headers */,
|
1A119EBA18BDF19200352BAA /* js_bindings_chipmunk_registration.h in Headers */,
|
||||||
1A119EB018BDF19200352BAA /* js_bindings_chipmunk_functions.h in Headers */,
|
1A119EB018BDF19200352BAA /* js_bindings_chipmunk_functions.h in Headers */,
|
||||||
4BE089EC1ADF967400D65D4B /* jsb_cocos2dx_experimental_webView_manual.h in Headers */,
|
4BE089EC1ADF967400D65D4B /* jsb_cocos2dx_experimental_webView_manual.h in Headers */,
|
||||||
BA623E0E191A195F00761F37 /* jsb_pluginx_manual_callback.h in Headers */,
|
|
||||||
BAFA58FE1B319F05004F9246 /* jsb_cocos2dx_navmesh_auto.hpp in Headers */,
|
BAFA58FE1B319F05004F9246 /* jsb_cocos2dx_navmesh_auto.hpp in Headers */,
|
||||||
1A119EB218BDF19200352BAA /* js_bindings_chipmunk_functions_registration.h in Headers */,
|
1A119EB218BDF19200352BAA /* js_bindings_chipmunk_functions_registration.h in Headers */,
|
||||||
1A119EF218BDF19200352BAA /* js_bindings_system_functions_registration.h in Headers */,
|
1A119EF218BDF19200352BAA /* js_bindings_system_functions_registration.h in Headers */,
|
||||||
1A119E8618BDF19200352BAA /* jsb_cocos2dx_auto.hpp in Headers */,
|
1A119E8618BDF19200352BAA /* jsb_cocos2dx_auto.hpp in Headers */,
|
||||||
BA623E12191A195F00761F37 /* jsb_pluginx_spidermonkey_specifics.h in Headers */,
|
|
||||||
1A119F0818BDF19200352BAA /* jsb_cocos2dx_spine_manual.h in Headers */,
|
1A119F0818BDF19200352BAA /* jsb_cocos2dx_spine_manual.h in Headers */,
|
||||||
B38AD56F1B1D38700057DD7F /* jsb_cocos2dx_experimental_video_auto.hpp in Headers */,
|
B38AD56F1B1D38700057DD7F /* jsb_cocos2dx_experimental_video_auto.hpp in Headers */,
|
||||||
BA623E0A191A195F00761F37 /* jsb_pluginx_basic_conversions.h in Headers */,
|
|
||||||
BA623E14191A195F00761F37 /* pluginxUTF8.h in Headers */,
|
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
@ -898,8 +837,6 @@
|
||||||
42638FFE1B0EC1B7004C53A2 /* jsb_cocos2dx_physics3d_auto.cpp in Sources */,
|
42638FFE1B0EC1B7004C53A2 /* jsb_cocos2dx_physics3d_auto.cpp in Sources */,
|
||||||
1A119EE618BDF19200352BAA /* jsb_opengl_manual.cpp in Sources */,
|
1A119EE618BDF19200352BAA /* jsb_opengl_manual.cpp in Sources */,
|
||||||
1A119F0618BDF19200352BAA /* jsb_cocos2dx_spine_manual.cpp in Sources */,
|
1A119F0618BDF19200352BAA /* jsb_cocos2dx_spine_manual.cpp in Sources */,
|
||||||
BA623E0F191A195F00761F37 /* jsb_pluginx_manual_protocols.cpp in Sources */,
|
|
||||||
BA623E13191A195F00761F37 /* pluginxUTF8.cpp in Sources */,
|
|
||||||
BAEE4D721AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.cpp in Sources */,
|
BAEE4D721AC3FFAD003BEB0F /* jsb_cocos2dx_3d_extension_auto.cpp in Sources */,
|
||||||
1A119EB818BDF19200352BAA /* js_bindings_chipmunk_registration.cpp in Sources */,
|
1A119EB818BDF19200352BAA /* js_bindings_chipmunk_registration.cpp in Sources */,
|
||||||
1A119E8418BDF19200352BAA /* jsb_cocos2dx_auto.cpp in Sources */,
|
1A119E8418BDF19200352BAA /* jsb_cocos2dx_auto.cpp in Sources */,
|
||||||
|
@ -912,13 +849,8 @@
|
||||||
1A119EE218BDF19200352BAA /* jsb_opengl_functions.cpp in Sources */,
|
1A119EE218BDF19200352BAA /* jsb_opengl_functions.cpp in Sources */,
|
||||||
1A119EA818BDF19200352BAA /* js_bindings_chipmunk_auto_classes.cpp in Sources */,
|
1A119EA818BDF19200352BAA /* js_bindings_chipmunk_auto_classes.cpp in Sources */,
|
||||||
BA4095C31A6F730A005E53F6 /* jsb_cocos2dx_studio_conversions.cpp in Sources */,
|
BA4095C31A6F730A005E53F6 /* jsb_cocos2dx_studio_conversions.cpp in Sources */,
|
||||||
BA623E0B191A195F00761F37 /* jsb_pluginx_extension_registration.cpp in Sources */,
|
|
||||||
BA623E11191A195F00761F37 /* jsb_pluginx_spidermonkey_specifics.cpp in Sources */,
|
|
||||||
BAFA590A1B319F7E004F9246 /* jsb_cocos2dx_navmesh_conversions.cpp in Sources */,
|
BAFA590A1B319F7E004F9246 /* jsb_cocos2dx_navmesh_conversions.cpp in Sources */,
|
||||||
BA623E18191A196F00761F37 /* jsb_cocos2dx_pluginx_auto.cpp in Sources */,
|
|
||||||
1A119F0018BDF19200352BAA /* ScriptingCore.cpp in Sources */,
|
1A119F0018BDF19200352BAA /* ScriptingCore.cpp in Sources */,
|
||||||
BA623E09191A195F00761F37 /* jsb_pluginx_basic_conversions.cpp in Sources */,
|
|
||||||
BA623E0D191A195F00761F37 /* jsb_pluginx_manual_callback.cpp in Sources */,
|
|
||||||
B38AD56A1B1D384A0057DD7F /* jsb_cocos2dx_experimental_video_manual.cpp in Sources */,
|
B38AD56A1B1D384A0057DD7F /* jsb_cocos2dx_experimental_video_manual.cpp in Sources */,
|
||||||
1A1D3B7918C44FD000922D3C /* jsb_event_dispatcher_manual.cpp in Sources */,
|
1A1D3B7918C44FD000922D3C /* jsb_event_dispatcher_manual.cpp in Sources */,
|
||||||
);
|
);
|
||||||
|
|
|
@ -102,7 +102,7 @@ cc.isString = function(obj) {
|
||||||
*/
|
*/
|
||||||
cc.isArray = function(obj) {
|
cc.isArray = function(obj) {
|
||||||
return Array.isArray(obj) ||
|
return Array.isArray(obj) ||
|
||||||
(typeof obj === 'object' && objectToString(obj) === '[object Array]');
|
(typeof obj === 'object' && Object.prototype.toString.call(obj) === '[object Array]');
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1477,12 +1477,15 @@ cc._initSys = function(config, CONFIG_KEY){
|
||||||
if( locSys.isMobile ) {
|
if( locSys.isMobile ) {
|
||||||
capabilities["accelerometer"] = true;
|
capabilities["accelerometer"] = true;
|
||||||
capabilities["touches"] = true;
|
capabilities["touches"] = true;
|
||||||
|
if (platform === locSys.WINRT || platform === locSys.WP8) {
|
||||||
|
capabilities["keyboard"] = true;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// desktop
|
// desktop
|
||||||
capabilities["keyboard"] = true;
|
capabilities["keyboard"] = true;
|
||||||
capabilities["mouse"] = true;
|
capabilities["mouse"] = true;
|
||||||
// winrt can't suppot mouse in current version
|
// winrt can't suppot mouse in current version
|
||||||
if (platform === locSys.WINRT)
|
if (platform === locSys.WINRT || platform === locSys.WP8)
|
||||||
{
|
{
|
||||||
capabilities["touches"] = true;
|
capabilities["touches"] = true;
|
||||||
capabilities["mouse"] = false;
|
capabilities["mouse"] = false;
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
// CCConfig.js
|
// CCConfig.js
|
||||||
//
|
//
|
||||||
cc.ENGINE_VERSION = "Cocos2d-JS v3.7 Beta0";
|
cc.ENGINE_VERSION = "Cocos2d-JS v3.7 RC0";
|
||||||
|
|
||||||
cc.FIX_ARTIFACTS_BY_STRECHING_TEXEL = 0;
|
cc.FIX_ARTIFACTS_BY_STRECHING_TEXEL = 0;
|
||||||
cc.DIRECTOR_STATS_POSITION = {x: 0, y: 0};
|
cc.DIRECTOR_STATS_POSITION = {x: 0, y: 0};
|
||||||
|
|
|
@ -204,6 +204,7 @@
|
||||||
if(!spriteFrame && plist){
|
if(!spriteFrame && plist){
|
||||||
if(cc.loader.getRes(resourcePath + plist)){
|
if(cc.loader.getRes(resourcePath + plist)){
|
||||||
cc.spriteFrameCache.addSpriteFrames(resourcePath + plist);
|
cc.spriteFrameCache.addSpriteFrames(resourcePath + plist);
|
||||||
|
spriteFrame = cc.spriteFrameCache.getSpriteFrame(path);
|
||||||
}else{
|
}else{
|
||||||
cc.log("%s need to be preloaded", resourcePath + plist);
|
cc.log("%s need to be preloaded", resourcePath + plist);
|
||||||
}
|
}
|
||||||
|
|
|
@ -339,8 +339,8 @@
|
||||||
if(!layoutComponent)
|
if(!layoutComponent)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var positionXPercentEnabled = json["PositionPercentXEnable"] || false;
|
var positionXPercentEnabled = json["PositionPercentXEnable"] || json["PositionPercentXEnabled"] || false;
|
||||||
var positionYPercentEnabled = json["PositionPercentYEnable"] || false;
|
var positionYPercentEnabled = json["PositionPercentYEnable"] || json["PositionPercentYEnabled"] || false;
|
||||||
var positionXPercent = 0,
|
var positionXPercent = 0,
|
||||||
positionYPercent = 0,
|
positionYPercent = 0,
|
||||||
PrePosition = json["PrePosition"];
|
PrePosition = json["PrePosition"];
|
||||||
|
|
|
@ -103,6 +103,13 @@
|
||||||
-- @param #cc.BlendFunc blendFunc
|
-- @param #cc.BlendFunc blendFunc
|
||||||
-- @return Mesh#Mesh self (return value: cc.Mesh)
|
-- @return Mesh#Mesh self (return value: cc.Mesh)
|
||||||
|
|
||||||
|
--------------------------------
|
||||||
|
-- force set this Sprite3D to 2D render queue
|
||||||
|
-- @function [parent=#Mesh] setForce2DQueue
|
||||||
|
-- @param self
|
||||||
|
-- @param #bool force2D
|
||||||
|
-- @return Mesh#Mesh self (return value: cc.Mesh)
|
||||||
|
|
||||||
--------------------------------
|
--------------------------------
|
||||||
-- skin setter
|
-- skin setter
|
||||||
-- @function [parent=#Mesh] setSkin
|
-- @function [parent=#Mesh] setSkin
|
||||||
|
|
|
@ -108,6 +108,13 @@
|
||||||
-- @param #cc.BlendFunc blendFunc
|
-- @param #cc.BlendFunc blendFunc
|
||||||
-- @return Sprite3D#Sprite3D self (return value: cc.Sprite3D)
|
-- @return Sprite3D#Sprite3D self (return value: cc.Sprite3D)
|
||||||
|
|
||||||
|
--------------------------------
|
||||||
|
-- force set this Sprite3D to 2D render queue
|
||||||
|
-- @function [parent=#Sprite3D] setForce2DQueue
|
||||||
|
-- @param self
|
||||||
|
-- @param #bool force2D
|
||||||
|
-- @return Sprite3D#Sprite3D self (return value: cc.Sprite3D)
|
||||||
|
|
||||||
--------------------------------
|
--------------------------------
|
||||||
-- remove attach node
|
-- remove attach node
|
||||||
-- @function [parent=#Sprite3D] removeAttachNode
|
-- @function [parent=#Sprite3D] removeAttachNode
|
||||||
|
|
|
@ -2194,6 +2194,56 @@ int lua_cocos2dx_3d_Mesh_setBlendFunc(lua_State* tolua_S)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
int lua_cocos2dx_3d_Mesh_setForce2DQueue(lua_State* tolua_S)
|
||||||
|
{
|
||||||
|
int argc = 0;
|
||||||
|
cocos2d::Mesh* cobj = nullptr;
|
||||||
|
bool ok = true;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_Error tolua_err;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!tolua_isusertype(tolua_S,1,"cc.Mesh",0,&tolua_err)) goto tolua_lerror;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
cobj = (cocos2d::Mesh*)tolua_tousertype(tolua_S,1,0);
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!cobj)
|
||||||
|
{
|
||||||
|
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Mesh_setForce2DQueue'", nullptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
argc = lua_gettop(tolua_S)-1;
|
||||||
|
if (argc == 1)
|
||||||
|
{
|
||||||
|
bool arg0;
|
||||||
|
|
||||||
|
ok &= luaval_to_boolean(tolua_S, 2,&arg0, "cc.Mesh:setForce2DQueue");
|
||||||
|
if(!ok)
|
||||||
|
{
|
||||||
|
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_3d_Mesh_setForce2DQueue'", nullptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
cobj->setForce2DQueue(arg0);
|
||||||
|
lua_settop(tolua_S, 1);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Mesh:setForce2DQueue",argc, 1);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_lerror:
|
||||||
|
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Mesh_setForce2DQueue'.",&tolua_err);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
int lua_cocos2dx_3d_Mesh_setSkin(lua_State* tolua_S)
|
int lua_cocos2dx_3d_Mesh_setSkin(lua_State* tolua_S)
|
||||||
{
|
{
|
||||||
int argc = 0;
|
int argc = 0;
|
||||||
|
@ -2455,6 +2505,7 @@ int lua_register_cocos2dx_3d_Mesh(lua_State* tolua_S)
|
||||||
tolua_function(tolua_S,"setMeshIndexData",lua_cocos2dx_3d_Mesh_setMeshIndexData);
|
tolua_function(tolua_S,"setMeshIndexData",lua_cocos2dx_3d_Mesh_setMeshIndexData);
|
||||||
tolua_function(tolua_S,"getMeshVertexAttribCount",lua_cocos2dx_3d_Mesh_getMeshVertexAttribCount);
|
tolua_function(tolua_S,"getMeshVertexAttribCount",lua_cocos2dx_3d_Mesh_getMeshVertexAttribCount);
|
||||||
tolua_function(tolua_S,"setBlendFunc",lua_cocos2dx_3d_Mesh_setBlendFunc);
|
tolua_function(tolua_S,"setBlendFunc",lua_cocos2dx_3d_Mesh_setBlendFunc);
|
||||||
|
tolua_function(tolua_S,"setForce2DQueue",lua_cocos2dx_3d_Mesh_setForce2DQueue);
|
||||||
tolua_function(tolua_S,"setSkin",lua_cocos2dx_3d_Mesh_setSkin);
|
tolua_function(tolua_S,"setSkin",lua_cocos2dx_3d_Mesh_setSkin);
|
||||||
tolua_function(tolua_S,"isVisible",lua_cocos2dx_3d_Mesh_isVisible);
|
tolua_function(tolua_S,"isVisible",lua_cocos2dx_3d_Mesh_isVisible);
|
||||||
tolua_function(tolua_S,"setGLProgramState",lua_cocos2dx_3d_Mesh_setGLProgramState);
|
tolua_function(tolua_S,"setGLProgramState",lua_cocos2dx_3d_Mesh_setGLProgramState);
|
||||||
|
@ -4005,6 +4056,56 @@ int lua_cocos2dx_3d_Sprite3D_setBlendFunc(lua_State* tolua_S)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
int lua_cocos2dx_3d_Sprite3D_setForce2DQueue(lua_State* tolua_S)
|
||||||
|
{
|
||||||
|
int argc = 0;
|
||||||
|
cocos2d::Sprite3D* cobj = nullptr;
|
||||||
|
bool ok = true;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_Error tolua_err;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!tolua_isusertype(tolua_S,1,"cc.Sprite3D",0,&tolua_err)) goto tolua_lerror;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
cobj = (cocos2d::Sprite3D*)tolua_tousertype(tolua_S,1,0);
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!cobj)
|
||||||
|
{
|
||||||
|
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_3d_Sprite3D_setForce2DQueue'", nullptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
argc = lua_gettop(tolua_S)-1;
|
||||||
|
if (argc == 1)
|
||||||
|
{
|
||||||
|
bool arg0;
|
||||||
|
|
||||||
|
ok &= luaval_to_boolean(tolua_S, 2,&arg0, "cc.Sprite3D:setForce2DQueue");
|
||||||
|
if(!ok)
|
||||||
|
{
|
||||||
|
tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_3d_Sprite3D_setForce2DQueue'", nullptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
cobj->setForce2DQueue(arg0);
|
||||||
|
lua_settop(tolua_S, 1);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "cc.Sprite3D:setForce2DQueue",argc, 1);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_lerror:
|
||||||
|
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_3d_Sprite3D_setForce2DQueue'.",&tolua_err);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
int lua_cocos2dx_3d_Sprite3D_removeAttachNode(lua_State* tolua_S)
|
int lua_cocos2dx_3d_Sprite3D_removeAttachNode(lua_State* tolua_S)
|
||||||
{
|
{
|
||||||
int argc = 0;
|
int argc = 0;
|
||||||
|
@ -4290,6 +4391,7 @@ int lua_register_cocos2dx_3d_Sprite3D(lua_State* tolua_S)
|
||||||
tolua_function(tolua_S,"setLightMask",lua_cocos2dx_3d_Sprite3D_setLightMask);
|
tolua_function(tolua_S,"setLightMask",lua_cocos2dx_3d_Sprite3D_setLightMask);
|
||||||
tolua_function(tolua_S,"getAttachNode",lua_cocos2dx_3d_Sprite3D_getAttachNode);
|
tolua_function(tolua_S,"getAttachNode",lua_cocos2dx_3d_Sprite3D_getAttachNode);
|
||||||
tolua_function(tolua_S,"setBlendFunc",lua_cocos2dx_3d_Sprite3D_setBlendFunc);
|
tolua_function(tolua_S,"setBlendFunc",lua_cocos2dx_3d_Sprite3D_setBlendFunc);
|
||||||
|
tolua_function(tolua_S,"setForce2DQueue",lua_cocos2dx_3d_Sprite3D_setForce2DQueue);
|
||||||
tolua_function(tolua_S,"removeAttachNode",lua_cocos2dx_3d_Sprite3D_removeAttachNode);
|
tolua_function(tolua_S,"removeAttachNode",lua_cocos2dx_3d_Sprite3D_removeAttachNode);
|
||||||
tolua_function(tolua_S,"getSkeleton",lua_cocos2dx_3d_Sprite3D_getSkeleton);
|
tolua_function(tolua_S,"getSkeleton",lua_cocos2dx_3d_Sprite3D_getSkeleton);
|
||||||
tolua_function(tolua_S,"setForceDepthWrite",lua_cocos2dx_3d_Sprite3D_setForceDepthWrite);
|
tolua_function(tolua_S,"setForceDepthWrite",lua_cocos2dx_3d_Sprite3D_setForceDepthWrite);
|
||||||
|
|
|
@ -140,6 +140,8 @@ int register_all_cocos2dx_3d(lua_State* tolua_S);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,10 @@ LOCAL_MODULE := cocos2d_lua_static
|
||||||
|
|
||||||
LOCAL_MODULE_FILENAME := libluacocos2d
|
LOCAL_MODULE_FILENAME := libluacocos2d
|
||||||
|
|
||||||
|
ifeq ($(COCOS_SIMULATOR_BUILD),1)
|
||||||
|
LOCAL_ARM_MODE := arm
|
||||||
|
endif
|
||||||
|
|
||||||
LOCAL_SRC_FILES := ../manual/CCLuaBridge.cpp \
|
LOCAL_SRC_FILES := ../manual/CCLuaBridge.cpp \
|
||||||
../manual/CCLuaEngine.cpp \
|
../manual/CCLuaEngine.cpp \
|
||||||
../manual/CCLuaStack.cpp \
|
../manual/CCLuaStack.cpp \
|
||||||
|
|
|
@ -20,7 +20,9 @@ UIListView.cpp \
|
||||||
UIPageView.cpp \
|
UIPageView.cpp \
|
||||||
UIScrollView.cpp \
|
UIScrollView.cpp \
|
||||||
UIButton.cpp \
|
UIButton.cpp \
|
||||||
|
UIAbstractCheckButton.cpp \
|
||||||
UICheckBox.cpp \
|
UICheckBox.cpp \
|
||||||
|
UIRadioButton.cpp \
|
||||||
UIImageView.cpp \
|
UIImageView.cpp \
|
||||||
UIText.cpp \
|
UIText.cpp \
|
||||||
UITextAtlas.cpp \
|
UITextAtlas.cpp \
|
||||||
|
|
|
@ -24,7 +24,9 @@ set(COCOS_UI_SRC
|
||||||
|
|
||||||
ui/CocosGUI.cpp
|
ui/CocosGUI.cpp
|
||||||
ui/UIButton.cpp
|
ui/UIButton.cpp
|
||||||
|
ui/UIAbstractCheckButton.cpp
|
||||||
ui/UICheckBox.cpp
|
ui/UICheckBox.cpp
|
||||||
|
ui/UIRadioButton.cpp
|
||||||
ui/UIDeprecated.cpp
|
ui/UIDeprecated.cpp
|
||||||
ui/UIHBox.cpp
|
ui/UIHBox.cpp
|
||||||
ui/UIHelper.cpp
|
ui/UIHelper.cpp
|
||||||
|
|
|
@ -30,6 +30,7 @@ THE SOFTWARE.
|
||||||
#include "ui/UILayout.h"
|
#include "ui/UILayout.h"
|
||||||
#include "ui/UIButton.h"
|
#include "ui/UIButton.h"
|
||||||
#include "ui/UICheckBox.h"
|
#include "ui/UICheckBox.h"
|
||||||
|
#include "ui/UIRadioButton.h"
|
||||||
#include "ui/UIImageView.h"
|
#include "ui/UIImageView.h"
|
||||||
#include "ui/UIText.h"
|
#include "ui/UIText.h"
|
||||||
#include "ui/UITextAtlas.h"
|
#include "ui/UITextAtlas.h"
|
||||||
|
|
|
@ -0,0 +1,584 @@
|
||||||
|
/****************************************************************************
|
||||||
|
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 "ui/UIAbstractCheckButton.h"
|
||||||
|
#include "2d/CCSprite.h"
|
||||||
|
|
||||||
|
NS_CC_BEGIN
|
||||||
|
|
||||||
|
namespace ui {
|
||||||
|
|
||||||
|
static const int BACKGROUNDBOX_RENDERER_Z = (-1);
|
||||||
|
static const int BACKGROUNDSELECTEDBOX_RENDERER_Z = (-1);
|
||||||
|
static const int FRONTCROSS_RENDERER_Z = (-1);
|
||||||
|
static const int BACKGROUNDBOXDISABLED_RENDERER_Z = (-1);
|
||||||
|
static const int FRONTCROSSDISABLED_RENDERER_Z = (-1);
|
||||||
|
|
||||||
|
AbstractCheckButton::AbstractCheckButton():
|
||||||
|
_backGroundBoxRenderer(nullptr),
|
||||||
|
_backGroundSelectedBoxRenderer(nullptr),
|
||||||
|
_frontCrossRenderer(nullptr),
|
||||||
|
_backGroundBoxDisabledRenderer(nullptr),
|
||||||
|
_frontCrossDisabledRenderer(nullptr),
|
||||||
|
_isSelected(true),
|
||||||
|
_isBackgroundSelectedTextureLoaded(false),
|
||||||
|
_isBackgroundDisabledTextureLoaded(false),
|
||||||
|
_isFrontCrossDisabledTextureLoaded(false),
|
||||||
|
_backGroundTexType(TextureResType::LOCAL),
|
||||||
|
_backGroundSelectedTexType(TextureResType::LOCAL),
|
||||||
|
_frontCrossTexType(TextureResType::LOCAL),
|
||||||
|
_backGroundDisabledTexType(TextureResType::LOCAL),
|
||||||
|
_frontCrossDisabledTexType(TextureResType::LOCAL),
|
||||||
|
_zoomScale(0.1f),
|
||||||
|
_backgroundTextureScaleX(1.0),
|
||||||
|
_backgroundTextureScaleY(1.0),
|
||||||
|
_backGroundBoxRendererAdaptDirty(true),
|
||||||
|
_backGroundSelectedBoxRendererAdaptDirty(true),
|
||||||
|
_frontCrossRendererAdaptDirty(true),
|
||||||
|
_backGroundBoxDisabledRendererAdaptDirty(true),
|
||||||
|
_frontCrossDisabledRendererAdaptDirty(true)
|
||||||
|
{
|
||||||
|
setTouchEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
AbstractCheckButton::~AbstractCheckButton()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AbstractCheckButton::init(const std::string& backGround,
|
||||||
|
const std::string& backGroundSeleted,
|
||||||
|
const std::string& cross,
|
||||||
|
const std::string& backGroundDisabled,
|
||||||
|
const std::string& frontCrossDisabled,
|
||||||
|
TextureResType texType)
|
||||||
|
{
|
||||||
|
bool ret = true;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if (!Widget::init())
|
||||||
|
{
|
||||||
|
ret = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
setSelected(false);
|
||||||
|
loadTextures(backGround, backGroundSeleted, cross, backGroundDisabled, frontCrossDisabled,texType);
|
||||||
|
} while (0);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AbstractCheckButton::init()
|
||||||
|
{
|
||||||
|
if (Widget::init())
|
||||||
|
{
|
||||||
|
setSelected(false);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbstractCheckButton::initRenderer()
|
||||||
|
{
|
||||||
|
_backGroundBoxRenderer = Sprite::create();
|
||||||
|
_backGroundSelectedBoxRenderer = Sprite::create();
|
||||||
|
_frontCrossRenderer = Sprite::create();
|
||||||
|
_backGroundBoxDisabledRenderer = Sprite::create();
|
||||||
|
_frontCrossDisabledRenderer = Sprite::create();
|
||||||
|
|
||||||
|
addProtectedChild(_backGroundBoxRenderer, BACKGROUNDBOX_RENDERER_Z, -1);
|
||||||
|
addProtectedChild(_backGroundSelectedBoxRenderer, BACKGROUNDSELECTEDBOX_RENDERER_Z, -1);
|
||||||
|
addProtectedChild(_frontCrossRenderer, FRONTCROSS_RENDERER_Z, -1);
|
||||||
|
addProtectedChild(_backGroundBoxDisabledRenderer, BACKGROUNDBOXDISABLED_RENDERER_Z, -1);
|
||||||
|
addProtectedChild(_frontCrossDisabledRenderer, FRONTCROSSDISABLED_RENDERER_Z, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbstractCheckButton::loadTextures(const std::string& backGround,
|
||||||
|
const std::string& backGroundSelected,
|
||||||
|
const std::string& cross,
|
||||||
|
const std::string& backGroundDisabled,
|
||||||
|
const std::string& frontCrossDisabled,
|
||||||
|
TextureResType texType)
|
||||||
|
{
|
||||||
|
loadTextureBackGround(backGround,texType);
|
||||||
|
loadTextureBackGroundSelected(backGroundSelected,texType);
|
||||||
|
loadTextureFrontCross(cross,texType);
|
||||||
|
loadTextureBackGroundDisabled(backGroundDisabled,texType);
|
||||||
|
loadTextureFrontCrossDisabled(frontCrossDisabled,texType);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbstractCheckButton::loadTextureBackGround(const std::string& backGround,TextureResType texType)
|
||||||
|
{
|
||||||
|
if (backGround.empty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_backGroundTexType = texType;
|
||||||
|
switch (_backGroundTexType)
|
||||||
|
{
|
||||||
|
case TextureResType::LOCAL:
|
||||||
|
_backGroundBoxRenderer->setTexture(backGround);
|
||||||
|
break;
|
||||||
|
case TextureResType::PLIST:
|
||||||
|
_backGroundBoxRenderer->setSpriteFrame(backGround);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->setupBackgroundTexture();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbstractCheckButton::setupBackgroundTexture()
|
||||||
|
{
|
||||||
|
|
||||||
|
this->updateChildrenDisplayedRGBA();
|
||||||
|
|
||||||
|
updateContentSizeWithTextureSize(_backGroundBoxRenderer->getContentSize());
|
||||||
|
_backGroundBoxRendererAdaptDirty = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbstractCheckButton::loadTextureBackGround(SpriteFrame* spriteFrame)
|
||||||
|
{
|
||||||
|
_backGroundBoxRenderer->setSpriteFrame(spriteFrame);
|
||||||
|
this->setupBackgroundTexture();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbstractCheckButton::loadTextureBackGroundSelected(const std::string& backGroundSelected,TextureResType texType)
|
||||||
|
{
|
||||||
|
if (backGroundSelected.empty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_backGroundSelectedTexType = texType;
|
||||||
|
_isBackgroundSelectedTextureLoaded = true;
|
||||||
|
switch (_backGroundSelectedTexType)
|
||||||
|
{
|
||||||
|
case TextureResType::LOCAL:
|
||||||
|
_backGroundSelectedBoxRenderer->setTexture(backGroundSelected);
|
||||||
|
break;
|
||||||
|
case TextureResType::PLIST:
|
||||||
|
_backGroundSelectedBoxRenderer->setSpriteFrame(backGroundSelected);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
this->setupBackgroundSelectedTexture();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbstractCheckButton::loadTextureBackGroundSelected(SpriteFrame* spriteframe)
|
||||||
|
{
|
||||||
|
this->_backGroundSelectedBoxRenderer->setSpriteFrame(spriteframe);
|
||||||
|
this->setupBackgroundSelectedTexture();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbstractCheckButton::setupBackgroundSelectedTexture()
|
||||||
|
{
|
||||||
|
this->updateChildrenDisplayedRGBA();
|
||||||
|
_backGroundSelectedBoxRendererAdaptDirty = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbstractCheckButton::loadTextureFrontCross(const std::string& cross,TextureResType texType)
|
||||||
|
{
|
||||||
|
if (cross.empty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_frontCrossTexType = texType;
|
||||||
|
switch (_frontCrossTexType)
|
||||||
|
{
|
||||||
|
case TextureResType::LOCAL:
|
||||||
|
_frontCrossRenderer->setTexture(cross);
|
||||||
|
break;
|
||||||
|
case TextureResType::PLIST:
|
||||||
|
_frontCrossRenderer->setSpriteFrame(cross);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
this->setupFrontCrossTexture();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbstractCheckButton::loadTextureFrontCross(SpriteFrame* spriteFrame)
|
||||||
|
{
|
||||||
|
this->_frontCrossRenderer->setSpriteFrame(spriteFrame);
|
||||||
|
this->setupFrontCrossTexture();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbstractCheckButton::setupFrontCrossTexture()
|
||||||
|
{
|
||||||
|
this->updateChildrenDisplayedRGBA();
|
||||||
|
_frontCrossRendererAdaptDirty = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbstractCheckButton::loadTextureBackGroundDisabled(const std::string& backGroundDisabled,TextureResType texType)
|
||||||
|
{
|
||||||
|
if (backGroundDisabled.empty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_backGroundDisabledTexType = texType;
|
||||||
|
_isBackgroundDisabledTextureLoaded = true;
|
||||||
|
switch (_backGroundDisabledTexType)
|
||||||
|
{
|
||||||
|
case TextureResType::LOCAL:
|
||||||
|
_backGroundBoxDisabledRenderer->setTexture(backGroundDisabled);
|
||||||
|
break;
|
||||||
|
case TextureResType::PLIST:
|
||||||
|
_backGroundBoxDisabledRenderer->setSpriteFrame(backGroundDisabled);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
this->setupBackgroundDisable();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbstractCheckButton::loadTextureBackGroundDisabled(SpriteFrame* spriteframe)
|
||||||
|
{
|
||||||
|
this->_backGroundBoxDisabledRenderer->setSpriteFrame(spriteframe);
|
||||||
|
this->setupBackgroundDisable();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbstractCheckButton::setupBackgroundDisable()
|
||||||
|
{
|
||||||
|
this->updateChildrenDisplayedRGBA();
|
||||||
|
|
||||||
|
_backGroundBoxDisabledRendererAdaptDirty = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbstractCheckButton::loadTextureFrontCrossDisabled(const std::string& frontCrossDisabled,TextureResType texType)
|
||||||
|
{
|
||||||
|
if (frontCrossDisabled.empty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_frontCrossDisabledTexType = texType;
|
||||||
|
_isFrontCrossDisabledTextureLoaded = true;
|
||||||
|
switch (_frontCrossDisabledTexType)
|
||||||
|
{
|
||||||
|
case TextureResType::LOCAL:
|
||||||
|
_frontCrossDisabledRenderer->setTexture(frontCrossDisabled);
|
||||||
|
break;
|
||||||
|
case TextureResType::PLIST:
|
||||||
|
_frontCrossDisabledRenderer->setSpriteFrame(frontCrossDisabled);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
this->setupFrontCrossDisableTexture();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbstractCheckButton::loadTextureFrontCrossDisabled(SpriteFrame* spriteframe)
|
||||||
|
{
|
||||||
|
this->_frontCrossDisabledRenderer->setSpriteFrame(spriteframe);
|
||||||
|
this->setupFrontCrossDisableTexture();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbstractCheckButton::setupFrontCrossDisableTexture()
|
||||||
|
{
|
||||||
|
this->updateChildrenDisplayedRGBA();
|
||||||
|
_frontCrossDisabledRendererAdaptDirty = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbstractCheckButton::onPressStateChangedToNormal()
|
||||||
|
{
|
||||||
|
_backGroundBoxRenderer->setVisible(true);
|
||||||
|
_backGroundSelectedBoxRenderer->setVisible(false);
|
||||||
|
_backGroundBoxDisabledRenderer->setVisible(false);
|
||||||
|
_frontCrossDisabledRenderer->setVisible(false);
|
||||||
|
|
||||||
|
_backGroundBoxRenderer->setGLProgramState(this->getNormalGLProgramState());
|
||||||
|
_frontCrossRenderer->setGLProgramState(this->getNormalGLProgramState());
|
||||||
|
|
||||||
|
|
||||||
|
_backGroundBoxRenderer->setScale(_backgroundTextureScaleX, _backgroundTextureScaleY);
|
||||||
|
_frontCrossRenderer->setScale(_backgroundTextureScaleX, _backgroundTextureScaleY);
|
||||||
|
|
||||||
|
|
||||||
|
if (_isSelected)
|
||||||
|
{
|
||||||
|
_frontCrossRenderer->setVisible(true);
|
||||||
|
_frontCrossRendererAdaptDirty = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbstractCheckButton::onPressStateChangedToPressed()
|
||||||
|
{
|
||||||
|
_backGroundBoxRenderer->setGLProgramState(this->getNormalGLProgramState());
|
||||||
|
_frontCrossRenderer->setGLProgramState(this->getNormalGLProgramState());
|
||||||
|
|
||||||
|
if (!_isBackgroundSelectedTextureLoaded)
|
||||||
|
{
|
||||||
|
_backGroundBoxRenderer->setScale(_backgroundTextureScaleX + _zoomScale,
|
||||||
|
_backgroundTextureScaleY + _zoomScale);
|
||||||
|
_frontCrossRenderer->setScale(_backgroundTextureScaleX + _zoomScale,
|
||||||
|
_backgroundTextureScaleY + _zoomScale);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_backGroundBoxRenderer->setVisible(false);
|
||||||
|
_backGroundSelectedBoxRenderer->setVisible(true);
|
||||||
|
_backGroundBoxDisabledRenderer->setVisible(false);
|
||||||
|
_frontCrossDisabledRenderer->setVisible(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbstractCheckButton::onPressStateChangedToDisabled()
|
||||||
|
{
|
||||||
|
if (!_isBackgroundDisabledTextureLoaded
|
||||||
|
|| !_isFrontCrossDisabledTextureLoaded)
|
||||||
|
{
|
||||||
|
_backGroundBoxRenderer->setGLProgramState(this->getGrayGLProgramState());
|
||||||
|
_frontCrossRenderer->setGLProgramState(this->getGrayGLProgramState());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_backGroundBoxRenderer->setVisible(false);
|
||||||
|
_backGroundBoxDisabledRenderer->setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
_backGroundSelectedBoxRenderer->setVisible(false);
|
||||||
|
_frontCrossRenderer->setVisible(false);
|
||||||
|
_backGroundBoxRenderer->setScale(_backgroundTextureScaleX, _backgroundTextureScaleY);
|
||||||
|
_frontCrossRenderer->setScale(_backgroundTextureScaleX, _backgroundTextureScaleY);
|
||||||
|
|
||||||
|
if (_isSelected)
|
||||||
|
{
|
||||||
|
_frontCrossDisabledRenderer->setVisible(true);
|
||||||
|
_frontCrossDisabledRendererAdaptDirty = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbstractCheckButton::setZoomScale(float scale)
|
||||||
|
{
|
||||||
|
_zoomScale = scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
float AbstractCheckButton::getZoomScale()const
|
||||||
|
{
|
||||||
|
return _zoomScale;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbstractCheckButton::setSelected(bool selected)
|
||||||
|
{
|
||||||
|
if (selected == _isSelected)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_isSelected = selected;
|
||||||
|
_frontCrossRenderer->setVisible(_isSelected);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AbstractCheckButton::isSelected()const
|
||||||
|
{
|
||||||
|
return _isSelected;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbstractCheckButton::onSizeChanged()
|
||||||
|
{
|
||||||
|
Widget::onSizeChanged();
|
||||||
|
_backGroundBoxRendererAdaptDirty = true;
|
||||||
|
_backGroundSelectedBoxRendererAdaptDirty = true;
|
||||||
|
_frontCrossRendererAdaptDirty = true;
|
||||||
|
_backGroundBoxDisabledRendererAdaptDirty = true;
|
||||||
|
_frontCrossDisabledRendererAdaptDirty = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbstractCheckButton::adaptRenderers()
|
||||||
|
{
|
||||||
|
if (_backGroundBoxRendererAdaptDirty)
|
||||||
|
{
|
||||||
|
backGroundTextureScaleChangedWithSize();
|
||||||
|
_backGroundBoxRendererAdaptDirty = false;
|
||||||
|
}
|
||||||
|
if (_backGroundSelectedBoxRendererAdaptDirty)
|
||||||
|
{
|
||||||
|
backGroundSelectedTextureScaleChangedWithSize();
|
||||||
|
_backGroundSelectedBoxRendererAdaptDirty = false;
|
||||||
|
}
|
||||||
|
if (_frontCrossRendererAdaptDirty)
|
||||||
|
{
|
||||||
|
frontCrossTextureScaleChangedWithSize();
|
||||||
|
_frontCrossRendererAdaptDirty = false;
|
||||||
|
}
|
||||||
|
if (_backGroundBoxDisabledRendererAdaptDirty)
|
||||||
|
{
|
||||||
|
backGroundDisabledTextureScaleChangedWithSize();
|
||||||
|
_backGroundBoxDisabledRendererAdaptDirty = false;
|
||||||
|
}
|
||||||
|
if (_frontCrossDisabledRendererAdaptDirty)
|
||||||
|
{
|
||||||
|
frontCrossDisabledTextureScaleChangedWithSize();
|
||||||
|
_frontCrossDisabledRendererAdaptDirty = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Size AbstractCheckButton::getVirtualRendererSize() const
|
||||||
|
{
|
||||||
|
return _backGroundBoxRenderer->getContentSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
Node* AbstractCheckButton::getVirtualRenderer()
|
||||||
|
{
|
||||||
|
return _backGroundBoxRenderer;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbstractCheckButton::backGroundTextureScaleChangedWithSize()
|
||||||
|
{
|
||||||
|
if (_ignoreSize)
|
||||||
|
{
|
||||||
|
_backGroundBoxRenderer->setScale(1.0f);
|
||||||
|
_backgroundTextureScaleX = _backgroundTextureScaleY = 1.0f;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Size textureSize = _backGroundBoxRenderer->getContentSize();
|
||||||
|
if (textureSize.width <= 0.0f || textureSize.height <= 0.0f)
|
||||||
|
{
|
||||||
|
_backGroundBoxRenderer->setScale(1.0f);
|
||||||
|
_backgroundTextureScaleX = _backgroundTextureScaleY = 1.0f;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
float scaleX = _contentSize.width / textureSize.width;
|
||||||
|
float scaleY = _contentSize.height / textureSize.height;
|
||||||
|
_backgroundTextureScaleX = scaleX;
|
||||||
|
_backgroundTextureScaleY = scaleY;
|
||||||
|
_backGroundBoxRenderer->setScaleX(scaleX);
|
||||||
|
_backGroundBoxRenderer->setScaleY(scaleY);
|
||||||
|
}
|
||||||
|
_backGroundBoxRenderer->setPosition(_contentSize.width / 2, _contentSize.height / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbstractCheckButton::backGroundSelectedTextureScaleChangedWithSize()
|
||||||
|
{
|
||||||
|
if (_ignoreSize)
|
||||||
|
{
|
||||||
|
_backGroundSelectedBoxRenderer->setScale(1.0f);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Size textureSize = _backGroundSelectedBoxRenderer->getContentSize();
|
||||||
|
if (textureSize.width <= 0.0f || textureSize.height <= 0.0f)
|
||||||
|
{
|
||||||
|
_backGroundSelectedBoxRenderer->setScale(1.0f);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
float scaleX = _contentSize.width / textureSize.width;
|
||||||
|
float scaleY = _contentSize.height / textureSize.height;
|
||||||
|
_backGroundSelectedBoxRenderer->setScaleX(scaleX);
|
||||||
|
_backGroundSelectedBoxRenderer->setScaleY(scaleY);
|
||||||
|
}
|
||||||
|
_backGroundSelectedBoxRenderer->setPosition(_contentSize.width / 2, _contentSize.height / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbstractCheckButton::frontCrossTextureScaleChangedWithSize()
|
||||||
|
{
|
||||||
|
if (_ignoreSize)
|
||||||
|
{
|
||||||
|
_frontCrossRenderer->setScale(1.0f);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Size textureSize = _frontCrossRenderer->getContentSize();
|
||||||
|
if (textureSize.width <= 0.0f || textureSize.height <= 0.0f)
|
||||||
|
{
|
||||||
|
_frontCrossRenderer->setScale(1.0f);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
float scaleX = _contentSize.width / textureSize.width;
|
||||||
|
float scaleY = _contentSize.height / textureSize.height;
|
||||||
|
_frontCrossRenderer->setScaleX(scaleX);
|
||||||
|
_frontCrossRenderer->setScaleY(scaleY);
|
||||||
|
}
|
||||||
|
_frontCrossRenderer->setPosition(_contentSize.width / 2, _contentSize.height / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbstractCheckButton::backGroundDisabledTextureScaleChangedWithSize()
|
||||||
|
{
|
||||||
|
if (_ignoreSize)
|
||||||
|
{
|
||||||
|
_backGroundBoxDisabledRenderer->setScale(1.0f);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Size textureSize = _backGroundBoxDisabledRenderer->getContentSize();
|
||||||
|
if (textureSize.width <= 0.0f || textureSize.height <= 0.0f)
|
||||||
|
{
|
||||||
|
_backGroundBoxDisabledRenderer->setScale(1.0f);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
float scaleX = _contentSize.width / textureSize.width;
|
||||||
|
float scaleY = _contentSize.height / textureSize.height;
|
||||||
|
_backGroundBoxDisabledRenderer->setScaleX(scaleX);
|
||||||
|
_backGroundBoxDisabledRenderer->setScaleY(scaleY);
|
||||||
|
}
|
||||||
|
_backGroundBoxDisabledRenderer->setPosition(_contentSize.width / 2, _contentSize.height / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbstractCheckButton::frontCrossDisabledTextureScaleChangedWithSize()
|
||||||
|
{
|
||||||
|
if (_ignoreSize)
|
||||||
|
{
|
||||||
|
_frontCrossDisabledRenderer->setScale(1.0f);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Size textureSize = _frontCrossDisabledRenderer->getContentSize();
|
||||||
|
if (textureSize.width <= 0.0f || textureSize.height <= 0.0f)
|
||||||
|
{
|
||||||
|
_frontCrossDisabledRenderer->setScale(1.0f);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
float scaleX = _contentSize.width / textureSize.width;
|
||||||
|
float scaleY = _contentSize.height / textureSize.height;
|
||||||
|
_frontCrossDisabledRenderer->setScaleX(scaleX);
|
||||||
|
_frontCrossDisabledRenderer->setScaleY(scaleY);
|
||||||
|
}
|
||||||
|
_frontCrossDisabledRenderer->setPosition(_contentSize.width / 2, _contentSize.height / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbstractCheckButton::copySpecialProperties(Widget *widget)
|
||||||
|
{
|
||||||
|
AbstractCheckButton* abstractCheckButton = dynamic_cast<AbstractCheckButton*>(widget);
|
||||||
|
if (abstractCheckButton)
|
||||||
|
{
|
||||||
|
loadTextureBackGround(abstractCheckButton->_backGroundBoxRenderer->getSpriteFrame());
|
||||||
|
loadTextureBackGroundSelected(abstractCheckButton->_backGroundSelectedBoxRenderer->getSpriteFrame());
|
||||||
|
loadTextureFrontCross(abstractCheckButton->_frontCrossRenderer->getSpriteFrame());
|
||||||
|
loadTextureBackGroundDisabled(abstractCheckButton->_backGroundBoxDisabledRenderer->getSpriteFrame());
|
||||||
|
loadTextureFrontCrossDisabled(abstractCheckButton->_frontCrossDisabledRenderer->getSpriteFrame());
|
||||||
|
setSelected(abstractCheckButton->_isSelected);
|
||||||
|
_zoomScale = abstractCheckButton->_zoomScale;
|
||||||
|
_backgroundTextureScaleX = abstractCheckButton->_backgroundTextureScaleX;
|
||||||
|
_backgroundTextureScaleY = abstractCheckButton->_backgroundTextureScaleY;
|
||||||
|
_isBackgroundSelectedTextureLoaded = abstractCheckButton->_isBackgroundSelectedTextureLoaded;
|
||||||
|
_isBackgroundDisabledTextureLoaded = abstractCheckButton->_isBackgroundDisabledTextureLoaded;
|
||||||
|
_isFrontCrossDisabledTextureLoaded = abstractCheckButton->_isFrontCrossDisabledTextureLoaded;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_CC_END
|
|
@ -0,0 +1,218 @@
|
||||||
|
/****************************************************************************
|
||||||
|
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 __UIABSTRACTCHECKBUTTON_H__
|
||||||
|
#define __UIABSTRACTCHECKBUTTON_H__
|
||||||
|
|
||||||
|
#include "ui/UIWidget.h"
|
||||||
|
#include "ui/GUIExport.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @addtogroup ui
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
NS_CC_BEGIN
|
||||||
|
class Sprite;
|
||||||
|
|
||||||
|
namespace ui {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AbstractCheckButton is a specific type of two-states button that can be either checked or unchecked.
|
||||||
|
*/
|
||||||
|
class CC_GUI_DLL AbstractCheckButton : public Widget
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Load all textures for initializing a check button.
|
||||||
|
*
|
||||||
|
* @param background The background image name.
|
||||||
|
* @param backgroundSelected The background selected image name.
|
||||||
|
* @param cross The cross image name.
|
||||||
|
* @param backgroundDisabled The background disabled state texture.
|
||||||
|
* @param frontCrossDisabled The front cross disabled state image name.
|
||||||
|
* @param texType @see `Widget::TextureResType`
|
||||||
|
*/
|
||||||
|
void loadTextures(const std::string& background,
|
||||||
|
const std::string& backgroundSelected,
|
||||||
|
const std::string& cross,
|
||||||
|
const std::string& backgroundDisabled,
|
||||||
|
const std::string& frontCrossDisabled,
|
||||||
|
TextureResType texType = TextureResType::LOCAL);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load background texture for check button.
|
||||||
|
*
|
||||||
|
* @param backGround The background image name.
|
||||||
|
* @param type @see `Widget::TextureResType`
|
||||||
|
*/
|
||||||
|
void loadTextureBackGround(const std::string& backGround,TextureResType type = TextureResType::LOCAL);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load background selected state texture for check button.
|
||||||
|
*
|
||||||
|
* @param backGroundSelected The background selected state image name.
|
||||||
|
* @param texType @see `Widget::TextureResType`
|
||||||
|
*/
|
||||||
|
void loadTextureBackGroundSelected(const std::string& backGroundSelected,TextureResType texType = TextureResType::LOCAL);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load cross texture for check button.
|
||||||
|
*
|
||||||
|
* @param crossTextureName The cross texture name.
|
||||||
|
* @param texType @see `Widget::TextureResType`
|
||||||
|
*/
|
||||||
|
void loadTextureFrontCross(const std::string& crossTextureName,TextureResType texType = TextureResType::LOCAL);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load background disabled state texture for checkbox.
|
||||||
|
*
|
||||||
|
* @param backGroundDisabled The background disabled state texture name.
|
||||||
|
*
|
||||||
|
* @param texType @see `Widget::TextureResType`
|
||||||
|
*/
|
||||||
|
void loadTextureBackGroundDisabled(const std::string& backGroundDisabled,TextureResType texType = TextureResType::LOCAL);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load frontcross disabled texture for checkbox.
|
||||||
|
*
|
||||||
|
* @param frontCrossDisabled The front cross disabled state texture name.
|
||||||
|
* @param texType @see `Widget::TextureResType`
|
||||||
|
*/
|
||||||
|
void loadTextureFrontCrossDisabled(const std::string& frontCrossDisabled,TextureResType texType = TextureResType::LOCAL);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Query whether CheckBox is selected or not.
|
||||||
|
*@return true means "selected", false otherwise.
|
||||||
|
*/
|
||||||
|
bool isSelected()const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change CheckBox state.
|
||||||
|
* Set to true will cause the CheckBox's state to "selected", false otherwise.
|
||||||
|
*@param selected Set to true will change CheckBox to selected state, false otherwise.
|
||||||
|
*/
|
||||||
|
void setSelected(bool selected);
|
||||||
|
|
||||||
|
//override functions
|
||||||
|
virtual Size getVirtualRendererSize() const override;
|
||||||
|
virtual Node* getVirtualRenderer() override;
|
||||||
|
|
||||||
|
/** When user pressed the CheckBox, the button will zoom to a scale.
|
||||||
|
* The final scale of the CheckBox equals (CheckBox original scale + _zoomScale)
|
||||||
|
* @since v3.3
|
||||||
|
*/
|
||||||
|
void setZoomScale(float scale);
|
||||||
|
/**
|
||||||
|
* @brief Return a zoom scale
|
||||||
|
* @return A zoom scale of Checkbox.
|
||||||
|
* @since v3.3
|
||||||
|
*/
|
||||||
|
float getZoomScale()const;
|
||||||
|
|
||||||
|
CC_CONSTRUCTOR_ACCESS:
|
||||||
|
virtual bool init() override;
|
||||||
|
virtual bool init(const std::string& backGround,
|
||||||
|
const std::string& backGroundSeleted,
|
||||||
|
const std::string& cross,
|
||||||
|
const std::string& backGroundDisabled,
|
||||||
|
const std::string& frontCrossDisabled,
|
||||||
|
TextureResType texType = TextureResType::LOCAL);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/**
|
||||||
|
* Default constructor.
|
||||||
|
*/
|
||||||
|
AbstractCheckButton();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default destructor.
|
||||||
|
*
|
||||||
|
* @lua NA
|
||||||
|
*/
|
||||||
|
virtual ~AbstractCheckButton();
|
||||||
|
|
||||||
|
virtual void initRenderer() override;
|
||||||
|
virtual void onPressStateChangedToNormal() override;
|
||||||
|
virtual void onPressStateChangedToPressed() override;
|
||||||
|
virtual void onPressStateChangedToDisabled() override;
|
||||||
|
|
||||||
|
void setupBackgroundTexture();
|
||||||
|
void loadTextureBackGround(SpriteFrame* spriteFrame);
|
||||||
|
void setupBackgroundSelectedTexture();
|
||||||
|
void loadTextureBackGroundSelected(SpriteFrame* spriteFrame);
|
||||||
|
void setupFrontCrossTexture();
|
||||||
|
void loadTextureFrontCross(SpriteFrame* spriteframe);
|
||||||
|
void setupBackgroundDisable();
|
||||||
|
void loadTextureBackGroundDisabled(SpriteFrame* spriteframe);
|
||||||
|
void setupFrontCrossDisableTexture();
|
||||||
|
void loadTextureFrontCrossDisabled(SpriteFrame* spriteframe);
|
||||||
|
|
||||||
|
virtual void dispatchSelectChangedEvent(bool selected) = 0;
|
||||||
|
|
||||||
|
virtual void onSizeChanged() override;
|
||||||
|
|
||||||
|
void backGroundTextureScaleChangedWithSize();
|
||||||
|
void backGroundSelectedTextureScaleChangedWithSize();
|
||||||
|
void frontCrossTextureScaleChangedWithSize();
|
||||||
|
void backGroundDisabledTextureScaleChangedWithSize();
|
||||||
|
void frontCrossDisabledTextureScaleChangedWithSize();
|
||||||
|
|
||||||
|
virtual void copySpecialProperties(Widget* model) override;
|
||||||
|
virtual void adaptRenderers() override;
|
||||||
|
protected:
|
||||||
|
Sprite* _backGroundBoxRenderer;
|
||||||
|
Sprite* _backGroundSelectedBoxRenderer;
|
||||||
|
Sprite* _frontCrossRenderer;
|
||||||
|
Sprite* _backGroundBoxDisabledRenderer;
|
||||||
|
Sprite* _frontCrossDisabledRenderer;
|
||||||
|
bool _isSelected;
|
||||||
|
|
||||||
|
bool _isBackgroundSelectedTextureLoaded;
|
||||||
|
bool _isBackgroundDisabledTextureLoaded;
|
||||||
|
bool _isFrontCrossDisabledTextureLoaded;
|
||||||
|
TextureResType _backGroundTexType;
|
||||||
|
TextureResType _backGroundSelectedTexType;
|
||||||
|
TextureResType _frontCrossTexType;
|
||||||
|
TextureResType _backGroundDisabledTexType;
|
||||||
|
TextureResType _frontCrossDisabledTexType;
|
||||||
|
|
||||||
|
float _zoomScale;
|
||||||
|
float _backgroundTextureScaleX;
|
||||||
|
float _backgroundTextureScaleY;
|
||||||
|
|
||||||
|
bool _backGroundBoxRendererAdaptDirty;
|
||||||
|
bool _backGroundSelectedBoxRendererAdaptDirty;
|
||||||
|
bool _frontCrossRendererAdaptDirty;
|
||||||
|
bool _backGroundBoxDisabledRendererAdaptDirty;
|
||||||
|
bool _frontCrossDisabledRendererAdaptDirty;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_CC_END
|
||||||
|
// end of ui group
|
||||||
|
/// @}
|
||||||
|
|
||||||
|
#endif /* defined(__UIABSTRACTCHECKBUTTON_H__) */
|
|
@ -23,47 +23,17 @@ THE SOFTWARE.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "ui/UICheckBox.h"
|
#include "ui/UICheckBox.h"
|
||||||
#include "2d/CCSprite.h"
|
|
||||||
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
static const int BACKGROUNDBOX_RENDERER_Z = (-1);
|
|
||||||
static const int BACKGROUNDSELECTEDBOX_RENDERER_Z = (-1);
|
|
||||||
static const int FRONTCROSS_RENDERER_Z = (-1);
|
|
||||||
static const int BACKGROUNDBOXDISABLED_RENDERER_Z = (-1);
|
|
||||||
static const int FRONTCROSSDISABLED_RENDERER_Z = (-1);
|
|
||||||
|
|
||||||
IMPLEMENT_CLASS_GUI_INFO(CheckBox)
|
IMPLEMENT_CLASS_GUI_INFO(CheckBox)
|
||||||
|
|
||||||
CheckBox::CheckBox():
|
CheckBox::CheckBox():
|
||||||
_backGroundBoxRenderer(nullptr),
|
|
||||||
_backGroundSelectedBoxRenderer(nullptr),
|
|
||||||
_frontCrossRenderer(nullptr),
|
|
||||||
_backGroundBoxDisabledRenderer(nullptr),
|
|
||||||
_frontCrossDisabledRenderer(nullptr),
|
|
||||||
_isSelected(true),
|
|
||||||
_checkBoxEventListener(nullptr),
|
_checkBoxEventListener(nullptr),
|
||||||
_checkBoxEventSelector(nullptr),
|
_checkBoxEventSelector(nullptr)
|
||||||
_isBackgroundSelectedTextureLoaded(false),
|
|
||||||
_isBackgroundDisabledTextureLoaded(false),
|
|
||||||
_isFrontCrossDisabledTextureLoaded(false),
|
|
||||||
_backGroundTexType(TextureResType::LOCAL),
|
|
||||||
_backGroundSelectedTexType(TextureResType::LOCAL),
|
|
||||||
_frontCrossTexType(TextureResType::LOCAL),
|
|
||||||
_backGroundDisabledTexType(TextureResType::LOCAL),
|
|
||||||
_frontCrossDisabledTexType(TextureResType::LOCAL),
|
|
||||||
_zoomScale(0.1f),
|
|
||||||
_backgroundTextureScaleX(1.0),
|
|
||||||
_backgroundTextureScaleY(1.0),
|
|
||||||
_backGroundBoxRendererAdaptDirty(true),
|
|
||||||
_backGroundSelectedBoxRendererAdaptDirty(true),
|
|
||||||
_frontCrossRendererAdaptDirty(true),
|
|
||||||
_backGroundBoxDisabledRendererAdaptDirty(true),
|
|
||||||
_frontCrossDisabledRendererAdaptDirty(true)
|
|
||||||
{
|
{
|
||||||
setTouchEnabled(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckBox::~CheckBox()
|
CheckBox::~CheckBox()
|
||||||
|
@ -124,243 +94,6 @@ CheckBox* CheckBox::create(const std::string& backGround,
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CheckBox::init(const std::string& backGround,
|
|
||||||
const std::string& backGroundSeleted,
|
|
||||||
const std::string& cross,
|
|
||||||
const std::string& backGroundDisabled,
|
|
||||||
const std::string& frontCrossDisabled,
|
|
||||||
TextureResType texType)
|
|
||||||
{
|
|
||||||
bool ret = true;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
if (!Widget::init())
|
|
||||||
{
|
|
||||||
ret = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
setSelected(false);
|
|
||||||
loadTextures(backGround, backGroundSeleted, cross, backGroundDisabled, frontCrossDisabled,texType);
|
|
||||||
} while (0);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CheckBox::init()
|
|
||||||
{
|
|
||||||
if (Widget::init())
|
|
||||||
{
|
|
||||||
setSelected(false);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CheckBox::initRenderer()
|
|
||||||
{
|
|
||||||
_backGroundBoxRenderer = Sprite::create();
|
|
||||||
_backGroundSelectedBoxRenderer = Sprite::create();
|
|
||||||
_frontCrossRenderer = Sprite::create();
|
|
||||||
_backGroundBoxDisabledRenderer = Sprite::create();
|
|
||||||
_frontCrossDisabledRenderer = Sprite::create();
|
|
||||||
|
|
||||||
addProtectedChild(_backGroundBoxRenderer, BACKGROUNDBOX_RENDERER_Z, -1);
|
|
||||||
addProtectedChild(_backGroundSelectedBoxRenderer, BACKGROUNDSELECTEDBOX_RENDERER_Z, -1);
|
|
||||||
addProtectedChild(_frontCrossRenderer, FRONTCROSS_RENDERER_Z, -1);
|
|
||||||
addProtectedChild(_backGroundBoxDisabledRenderer, BACKGROUNDBOXDISABLED_RENDERER_Z, -1);
|
|
||||||
addProtectedChild(_frontCrossDisabledRenderer, FRONTCROSSDISABLED_RENDERER_Z, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CheckBox::loadTextures(const std::string& backGround,
|
|
||||||
const std::string& backGroundSelected,
|
|
||||||
const std::string& cross,
|
|
||||||
const std::string& backGroundDisabled,
|
|
||||||
const std::string& frontCrossDisabled,
|
|
||||||
TextureResType texType)
|
|
||||||
{
|
|
||||||
loadTextureBackGround(backGround,texType);
|
|
||||||
loadTextureBackGroundSelected(backGroundSelected,texType);
|
|
||||||
loadTextureFrontCross(cross,texType);
|
|
||||||
loadTextureBackGroundDisabled(backGroundDisabled,texType);
|
|
||||||
loadTextureFrontCrossDisabled(frontCrossDisabled,texType);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CheckBox::loadTextureBackGround(const std::string& backGround,TextureResType texType)
|
|
||||||
{
|
|
||||||
if (backGround.empty())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_backGroundTexType = texType;
|
|
||||||
switch (_backGroundTexType)
|
|
||||||
{
|
|
||||||
case TextureResType::LOCAL:
|
|
||||||
_backGroundBoxRenderer->setTexture(backGround);
|
|
||||||
break;
|
|
||||||
case TextureResType::PLIST:
|
|
||||||
_backGroundBoxRenderer->setSpriteFrame(backGround);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
this->setupBackgroundTexture();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CheckBox::setupBackgroundTexture()
|
|
||||||
{
|
|
||||||
|
|
||||||
this->updateChildrenDisplayedRGBA();
|
|
||||||
|
|
||||||
updateContentSizeWithTextureSize(_backGroundBoxRenderer->getContentSize());
|
|
||||||
_backGroundBoxRendererAdaptDirty = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CheckBox::loadTextureBackGround(SpriteFrame* spriteFrame)
|
|
||||||
{
|
|
||||||
_backGroundBoxRenderer->setSpriteFrame(spriteFrame);
|
|
||||||
this->setupBackgroundTexture();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CheckBox::loadTextureBackGroundSelected(const std::string& backGroundSelected,TextureResType texType)
|
|
||||||
{
|
|
||||||
if (backGroundSelected.empty())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_backGroundSelectedTexType = texType;
|
|
||||||
_isBackgroundSelectedTextureLoaded = true;
|
|
||||||
switch (_backGroundSelectedTexType)
|
|
||||||
{
|
|
||||||
case TextureResType::LOCAL:
|
|
||||||
_backGroundSelectedBoxRenderer->setTexture(backGroundSelected);
|
|
||||||
break;
|
|
||||||
case TextureResType::PLIST:
|
|
||||||
_backGroundSelectedBoxRenderer->setSpriteFrame(backGroundSelected);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
this->setupBackgroundSelectedTexture();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CheckBox::loadTextureBackGroundSelected(SpriteFrame* spriteframe)
|
|
||||||
{
|
|
||||||
this->_backGroundSelectedBoxRenderer->setSpriteFrame(spriteframe);
|
|
||||||
this->setupBackgroundSelectedTexture();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CheckBox::setupBackgroundSelectedTexture()
|
|
||||||
{
|
|
||||||
this->updateChildrenDisplayedRGBA();
|
|
||||||
_backGroundSelectedBoxRendererAdaptDirty = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CheckBox::loadTextureFrontCross(const std::string& cross,TextureResType texType)
|
|
||||||
{
|
|
||||||
if (cross.empty())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_frontCrossTexType = texType;
|
|
||||||
switch (_frontCrossTexType)
|
|
||||||
{
|
|
||||||
case TextureResType::LOCAL:
|
|
||||||
_frontCrossRenderer->setTexture(cross);
|
|
||||||
break;
|
|
||||||
case TextureResType::PLIST:
|
|
||||||
_frontCrossRenderer->setSpriteFrame(cross);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
this->setupFrontCrossTexture();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CheckBox::loadTextureFrontCross(SpriteFrame* spriteFrame)
|
|
||||||
{
|
|
||||||
this->_frontCrossRenderer->setSpriteFrame(spriteFrame);
|
|
||||||
this->setupFrontCrossTexture();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CheckBox::setupFrontCrossTexture()
|
|
||||||
{
|
|
||||||
this->updateChildrenDisplayedRGBA();
|
|
||||||
_frontCrossRendererAdaptDirty = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CheckBox::loadTextureBackGroundDisabled(const std::string& backGroundDisabled,TextureResType texType)
|
|
||||||
{
|
|
||||||
if (backGroundDisabled.empty())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_backGroundDisabledTexType = texType;
|
|
||||||
_isBackgroundDisabledTextureLoaded = true;
|
|
||||||
switch (_backGroundDisabledTexType)
|
|
||||||
{
|
|
||||||
case TextureResType::LOCAL:
|
|
||||||
_backGroundBoxDisabledRenderer->setTexture(backGroundDisabled);
|
|
||||||
break;
|
|
||||||
case TextureResType::PLIST:
|
|
||||||
_backGroundBoxDisabledRenderer->setSpriteFrame(backGroundDisabled);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
this->setupBackgroundDisable();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CheckBox::loadTextureBackGroundDisabled(SpriteFrame* spriteframe)
|
|
||||||
{
|
|
||||||
this->_backGroundBoxDisabledRenderer->setSpriteFrame(spriteframe);
|
|
||||||
this->setupBackgroundDisable();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CheckBox::setupBackgroundDisable()
|
|
||||||
{
|
|
||||||
this->updateChildrenDisplayedRGBA();
|
|
||||||
|
|
||||||
_backGroundBoxDisabledRendererAdaptDirty = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CheckBox::loadTextureFrontCrossDisabled(const std::string& frontCrossDisabled,TextureResType texType)
|
|
||||||
{
|
|
||||||
if (frontCrossDisabled.empty())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_frontCrossDisabledTexType = texType;
|
|
||||||
_isFrontCrossDisabledTextureLoaded = true;
|
|
||||||
switch (_frontCrossDisabledTexType)
|
|
||||||
{
|
|
||||||
case TextureResType::LOCAL:
|
|
||||||
_frontCrossDisabledRenderer->setTexture(frontCrossDisabled);
|
|
||||||
break;
|
|
||||||
case TextureResType::PLIST:
|
|
||||||
_frontCrossDisabledRenderer->setSpriteFrame(frontCrossDisabled);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
this->setupFrontCrossDisableTexture();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void CheckBox::loadTextureFrontCrossDisabled(SpriteFrame* spriteframe)
|
|
||||||
{
|
|
||||||
this->_frontCrossDisabledRenderer->setSpriteFrame(spriteframe);
|
|
||||||
this->setupFrontCrossDisableTexture();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CheckBox::setupFrontCrossDisableTexture()
|
|
||||||
{
|
|
||||||
this->updateChildrenDisplayedRGBA();
|
|
||||||
_frontCrossDisabledRendererAdaptDirty = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void CheckBox::releaseUpEvent()
|
void CheckBox::releaseUpEvent()
|
||||||
{
|
{
|
||||||
Widget::releaseUpEvent();
|
Widget::releaseUpEvent();
|
||||||
|
@ -368,144 +101,36 @@ void CheckBox::releaseUpEvent()
|
||||||
if (_isSelected)
|
if (_isSelected)
|
||||||
{
|
{
|
||||||
setSelected(false);
|
setSelected(false);
|
||||||
unSelectedEvent();
|
dispatchSelectChangedEvent(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setSelected(true);
|
setSelected(true);
|
||||||
selectedEvent();
|
dispatchSelectChangedEvent(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CheckBox::dispatchSelectChangedEvent(bool selected)
|
||||||
void CheckBox::onPressStateChangedToNormal()
|
|
||||||
{
|
{
|
||||||
_backGroundBoxRenderer->setVisible(true);
|
EventType eventType = (selected ? EventType::SELECTED : EventType::UNSELECTED);
|
||||||
_backGroundSelectedBoxRenderer->setVisible(false);
|
CheckBoxEventType checkBoxEventType = (selected ? CHECKBOX_STATE_EVENT_SELECTED : CHECKBOX_STATE_EVENT_UNSELECTED);
|
||||||
_backGroundBoxDisabledRenderer->setVisible(false);
|
|
||||||
_frontCrossDisabledRenderer->setVisible(false);
|
|
||||||
|
|
||||||
_backGroundBoxRenderer->setGLProgramState(this->getNormalGLProgramState());
|
|
||||||
_frontCrossRenderer->setGLProgramState(this->getNormalGLProgramState());
|
|
||||||
|
|
||||||
|
|
||||||
_backGroundBoxRenderer->setScale(_backgroundTextureScaleX, _backgroundTextureScaleY);
|
|
||||||
_frontCrossRenderer->setScale(_backgroundTextureScaleX, _backgroundTextureScaleY);
|
|
||||||
|
|
||||||
|
|
||||||
if (_isSelected)
|
|
||||||
{
|
|
||||||
_frontCrossRenderer->setVisible(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CheckBox::onPressStateChangedToPressed()
|
|
||||||
{
|
|
||||||
_backGroundBoxRenderer->setGLProgramState(this->getNormalGLProgramState());
|
|
||||||
_frontCrossRenderer->setGLProgramState(this->getNormalGLProgramState());
|
|
||||||
|
|
||||||
if (!_isBackgroundSelectedTextureLoaded)
|
|
||||||
{
|
|
||||||
_backGroundBoxRenderer->setScale(_backgroundTextureScaleX + _zoomScale,
|
|
||||||
_backgroundTextureScaleY + _zoomScale);
|
|
||||||
_frontCrossRenderer->setScale(_backgroundTextureScaleX + _zoomScale,
|
|
||||||
_backgroundTextureScaleY + _zoomScale);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_backGroundBoxRenderer->setVisible(false);
|
|
||||||
_backGroundSelectedBoxRenderer->setVisible(true);
|
|
||||||
_backGroundBoxDisabledRenderer->setVisible(false);
|
|
||||||
_frontCrossDisabledRenderer->setVisible(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CheckBox::onPressStateChangedToDisabled()
|
|
||||||
{
|
|
||||||
if (!_isBackgroundDisabledTextureLoaded
|
|
||||||
|| !_isFrontCrossDisabledTextureLoaded)
|
|
||||||
{
|
|
||||||
_backGroundBoxRenderer->setGLProgramState(this->getGrayGLProgramState());
|
|
||||||
_frontCrossRenderer->setGLProgramState(this->getGrayGLProgramState());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_backGroundBoxRenderer->setVisible(false);
|
|
||||||
_backGroundBoxDisabledRenderer->setVisible(true);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
_backGroundSelectedBoxRenderer->setVisible(false);
|
|
||||||
_frontCrossRenderer->setVisible(false);
|
|
||||||
_backGroundBoxRenderer->setScale(_backgroundTextureScaleX, _backgroundTextureScaleY);
|
|
||||||
_frontCrossRenderer->setScale(_backgroundTextureScaleX, _backgroundTextureScaleY);
|
|
||||||
|
|
||||||
if (_isSelected)
|
|
||||||
{
|
|
||||||
_frontCrossDisabledRenderer->setVisible(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CheckBox::setZoomScale(float scale)
|
|
||||||
{
|
|
||||||
_zoomScale = scale;
|
|
||||||
}
|
|
||||||
|
|
||||||
float CheckBox::getZoomScale()const
|
|
||||||
{
|
|
||||||
return _zoomScale;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CheckBox::setSelected(bool selected)
|
|
||||||
{
|
|
||||||
if (selected == _isSelected)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_isSelected = selected;
|
|
||||||
_frontCrossRenderer->setVisible(_isSelected);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CheckBox::isSelected()const
|
|
||||||
{
|
|
||||||
return _isSelected;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CheckBox::selectedEvent()
|
|
||||||
{
|
|
||||||
this->retain();
|
this->retain();
|
||||||
if (_checkBoxEventCallback)
|
if (_checkBoxEventCallback)
|
||||||
{
|
{
|
||||||
_checkBoxEventCallback(this, EventType::SELECTED);
|
_checkBoxEventCallback(this, eventType);
|
||||||
}
|
}
|
||||||
if (_ccEventCallback)
|
if (_ccEventCallback)
|
||||||
{
|
{
|
||||||
_ccEventCallback(this, static_cast<int>(EventType::SELECTED));
|
_ccEventCallback(this, static_cast<int>(eventType));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_checkBoxEventListener && _checkBoxEventSelector)
|
if (_checkBoxEventListener && _checkBoxEventSelector)
|
||||||
{
|
{
|
||||||
(_checkBoxEventListener->*_checkBoxEventSelector)(this,CHECKBOX_STATE_EVENT_SELECTED);
|
(_checkBoxEventListener->*_checkBoxEventSelector)(this, checkBoxEventType);
|
||||||
}
|
}
|
||||||
this->release();
|
this->release();
|
||||||
}
|
|
||||||
|
|
||||||
void CheckBox::unSelectedEvent()
|
|
||||||
{
|
|
||||||
this->retain();
|
|
||||||
if (_checkBoxEventCallback)
|
|
||||||
{
|
|
||||||
_checkBoxEventCallback(this, EventType::UNSELECTED);
|
|
||||||
}
|
|
||||||
if (_ccEventCallback)
|
|
||||||
{
|
|
||||||
_ccEventCallback(this, static_cast<int>(EventType::UNSELECTED));
|
|
||||||
}
|
|
||||||
if (_checkBoxEventListener && _checkBoxEventSelector)
|
|
||||||
{
|
|
||||||
(_checkBoxEventListener->*_checkBoxEventSelector)(this,CHECKBOX_STATE_EVENT_UNSELECTED);
|
|
||||||
}
|
|
||||||
this->release();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckBox::addEventListenerCheckBox(Ref *target, SEL_SelectedStateEvent selector)
|
void CheckBox::addEventListenerCheckBox(Ref *target, SEL_SelectedStateEvent selector)
|
||||||
|
@ -519,169 +144,6 @@ void CheckBox::addEventListener(const ccCheckBoxCallback& callback)
|
||||||
_checkBoxEventCallback = callback;
|
_checkBoxEventCallback = callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckBox::onSizeChanged()
|
|
||||||
{
|
|
||||||
Widget::onSizeChanged();
|
|
||||||
_backGroundBoxRendererAdaptDirty = true;
|
|
||||||
_backGroundSelectedBoxRendererAdaptDirty = true;
|
|
||||||
_frontCrossRendererAdaptDirty = true;
|
|
||||||
_backGroundBoxDisabledRendererAdaptDirty = true;
|
|
||||||
_frontCrossDisabledRendererAdaptDirty = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CheckBox::adaptRenderers()
|
|
||||||
{
|
|
||||||
if (_backGroundBoxRendererAdaptDirty)
|
|
||||||
{
|
|
||||||
backGroundTextureScaleChangedWithSize();
|
|
||||||
_backGroundBoxRendererAdaptDirty = false;
|
|
||||||
}
|
|
||||||
if (_backGroundSelectedBoxRendererAdaptDirty)
|
|
||||||
{
|
|
||||||
backGroundSelectedTextureScaleChangedWithSize();
|
|
||||||
_backGroundSelectedBoxRendererAdaptDirty = false;
|
|
||||||
}
|
|
||||||
if (_frontCrossRendererAdaptDirty)
|
|
||||||
{
|
|
||||||
frontCrossTextureScaleChangedWithSize();
|
|
||||||
_frontCrossRendererAdaptDirty = false;
|
|
||||||
}
|
|
||||||
if (_backGroundBoxDisabledRendererAdaptDirty)
|
|
||||||
{
|
|
||||||
backGroundDisabledTextureScaleChangedWithSize();
|
|
||||||
_backGroundBoxDisabledRendererAdaptDirty = false;
|
|
||||||
}
|
|
||||||
if (_frontCrossDisabledRendererAdaptDirty)
|
|
||||||
{
|
|
||||||
frontCrossDisabledTextureScaleChangedWithSize();
|
|
||||||
_frontCrossDisabledRendererAdaptDirty = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Size CheckBox::getVirtualRendererSize() const
|
|
||||||
{
|
|
||||||
return _backGroundBoxRenderer->getContentSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
Node* CheckBox::getVirtualRenderer()
|
|
||||||
{
|
|
||||||
return _backGroundBoxRenderer;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CheckBox::backGroundTextureScaleChangedWithSize()
|
|
||||||
{
|
|
||||||
if (_ignoreSize)
|
|
||||||
{
|
|
||||||
_backGroundBoxRenderer->setScale(1.0f);
|
|
||||||
_backgroundTextureScaleX = _backgroundTextureScaleY = 1.0f;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Size textureSize = _backGroundBoxRenderer->getContentSize();
|
|
||||||
if (textureSize.width <= 0.0f || textureSize.height <= 0.0f)
|
|
||||||
{
|
|
||||||
_backGroundBoxRenderer->setScale(1.0f);
|
|
||||||
_backgroundTextureScaleX = _backgroundTextureScaleY = 1.0f;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
float scaleX = _contentSize.width / textureSize.width;
|
|
||||||
float scaleY = _contentSize.height / textureSize.height;
|
|
||||||
_backgroundTextureScaleX = scaleX;
|
|
||||||
_backgroundTextureScaleY = scaleY;
|
|
||||||
_backGroundBoxRenderer->setScaleX(scaleX);
|
|
||||||
_backGroundBoxRenderer->setScaleY(scaleY);
|
|
||||||
}
|
|
||||||
_backGroundBoxRenderer->setPosition(_contentSize.width / 2, _contentSize.height / 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CheckBox::backGroundSelectedTextureScaleChangedWithSize()
|
|
||||||
{
|
|
||||||
if (_ignoreSize)
|
|
||||||
{
|
|
||||||
_backGroundSelectedBoxRenderer->setScale(1.0f);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Size textureSize = _backGroundSelectedBoxRenderer->getContentSize();
|
|
||||||
if (textureSize.width <= 0.0f || textureSize.height <= 0.0f)
|
|
||||||
{
|
|
||||||
_backGroundSelectedBoxRenderer->setScale(1.0f);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
float scaleX = _contentSize.width / textureSize.width;
|
|
||||||
float scaleY = _contentSize.height / textureSize.height;
|
|
||||||
_backGroundSelectedBoxRenderer->setScaleX(scaleX);
|
|
||||||
_backGroundSelectedBoxRenderer->setScaleY(scaleY);
|
|
||||||
}
|
|
||||||
_backGroundSelectedBoxRenderer->setPosition(_contentSize.width / 2, _contentSize.height / 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CheckBox::frontCrossTextureScaleChangedWithSize()
|
|
||||||
{
|
|
||||||
if (_ignoreSize)
|
|
||||||
{
|
|
||||||
_frontCrossRenderer->setScale(1.0f);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Size textureSize = _frontCrossRenderer->getContentSize();
|
|
||||||
if (textureSize.width <= 0.0f || textureSize.height <= 0.0f)
|
|
||||||
{
|
|
||||||
_frontCrossRenderer->setScale(1.0f);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
float scaleX = _contentSize.width / textureSize.width;
|
|
||||||
float scaleY = _contentSize.height / textureSize.height;
|
|
||||||
_frontCrossRenderer->setScaleX(scaleX);
|
|
||||||
_frontCrossRenderer->setScaleY(scaleY);
|
|
||||||
}
|
|
||||||
_frontCrossRenderer->setPosition(_contentSize.width / 2, _contentSize.height / 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CheckBox::backGroundDisabledTextureScaleChangedWithSize()
|
|
||||||
{
|
|
||||||
if (_ignoreSize)
|
|
||||||
{
|
|
||||||
_backGroundBoxDisabledRenderer->setScale(1.0f);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Size textureSize = _backGroundBoxDisabledRenderer->getContentSize();
|
|
||||||
if (textureSize.width <= 0.0f || textureSize.height <= 0.0f)
|
|
||||||
{
|
|
||||||
_backGroundBoxDisabledRenderer->setScale(1.0f);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
float scaleX = _contentSize.width / textureSize.width;
|
|
||||||
float scaleY = _contentSize.height / textureSize.height;
|
|
||||||
_backGroundBoxDisabledRenderer->setScaleX(scaleX);
|
|
||||||
_backGroundBoxDisabledRenderer->setScaleY(scaleY);
|
|
||||||
}
|
|
||||||
_backGroundBoxDisabledRenderer->setPosition(_contentSize.width / 2, _contentSize.height / 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CheckBox::frontCrossDisabledTextureScaleChangedWithSize()
|
|
||||||
{
|
|
||||||
if (_ignoreSize)
|
|
||||||
{
|
|
||||||
_frontCrossDisabledRenderer->setScale(1.0f);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Size textureSize = _frontCrossDisabledRenderer->getContentSize();
|
|
||||||
if (textureSize.width <= 0.0f || textureSize.height <= 0.0f)
|
|
||||||
{
|
|
||||||
_frontCrossDisabledRenderer->setScale(1.0f);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
float scaleX = _contentSize.width / textureSize.width;
|
|
||||||
float scaleY = _contentSize.height / textureSize.height;
|
|
||||||
_frontCrossDisabledRenderer->setScaleX(scaleX);
|
|
||||||
_frontCrossDisabledRenderer->setScaleY(scaleY);
|
|
||||||
}
|
|
||||||
_frontCrossDisabledRenderer->setPosition(_contentSize.width / 2, _contentSize.height / 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string CheckBox::getDescription() const
|
std::string CheckBox::getDescription() const
|
||||||
{
|
{
|
||||||
return "CheckBox";
|
return "CheckBox";
|
||||||
|
@ -697,22 +159,11 @@ void CheckBox::copySpecialProperties(Widget *widget)
|
||||||
CheckBox* checkBox = dynamic_cast<CheckBox*>(widget);
|
CheckBox* checkBox = dynamic_cast<CheckBox*>(widget);
|
||||||
if (checkBox)
|
if (checkBox)
|
||||||
{
|
{
|
||||||
loadTextureBackGround(checkBox->_backGroundBoxRenderer->getSpriteFrame());
|
AbstractCheckButton::copySpecialProperties(widget);
|
||||||
loadTextureBackGroundSelected(checkBox->_backGroundSelectedBoxRenderer->getSpriteFrame());
|
|
||||||
loadTextureFrontCross(checkBox->_frontCrossRenderer->getSpriteFrame());
|
|
||||||
loadTextureBackGroundDisabled(checkBox->_backGroundBoxDisabledRenderer->getSpriteFrame());
|
|
||||||
loadTextureFrontCrossDisabled(checkBox->_frontCrossDisabledRenderer->getSpriteFrame());
|
|
||||||
setSelected(checkBox->_isSelected);
|
|
||||||
_checkBoxEventListener = checkBox->_checkBoxEventListener;
|
_checkBoxEventListener = checkBox->_checkBoxEventListener;
|
||||||
_checkBoxEventSelector = checkBox->_checkBoxEventSelector;
|
_checkBoxEventSelector = checkBox->_checkBoxEventSelector;
|
||||||
_checkBoxEventCallback = checkBox->_checkBoxEventCallback;
|
_checkBoxEventCallback = checkBox->_checkBoxEventCallback;
|
||||||
_ccEventCallback = checkBox->_ccEventCallback;
|
_ccEventCallback = checkBox->_ccEventCallback;
|
||||||
_zoomScale = checkBox->_zoomScale;
|
|
||||||
_backgroundTextureScaleX = checkBox->_backgroundTextureScaleX;
|
|
||||||
_backgroundTextureScaleY = checkBox->_backgroundTextureScaleY;
|
|
||||||
_isBackgroundSelectedTextureLoaded = checkBox->_isBackgroundSelectedTextureLoaded;
|
|
||||||
_isBackgroundDisabledTextureLoaded = checkBox->_isBackgroundDisabledTextureLoaded;
|
|
||||||
_isFrontCrossDisabledTextureLoaded = checkBox->_isFrontCrossDisabledTextureLoaded;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ THE SOFTWARE.
|
||||||
#ifndef __UICHECKBOX_H__
|
#ifndef __UICHECKBOX_H__
|
||||||
#define __UICHECKBOX_H__
|
#define __UICHECKBOX_H__
|
||||||
|
|
||||||
#include "ui/UIWidget.h"
|
#include "ui/UIAbstractCheckButton.h"
|
||||||
#include "ui/GUIExport.h"
|
#include "ui/GUIExport.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,7 +33,6 @@ THE SOFTWARE.
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
class Sprite;
|
|
||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
|
@ -59,7 +58,7 @@ typedef void (Ref::*SEL_SelectedStateEvent)(Ref*,CheckBoxEventType);
|
||||||
/**
|
/**
|
||||||
* Checkbox is a specific type of two-states button that can be either checked or unchecked.
|
* Checkbox is a specific type of two-states button that can be either checked or unchecked.
|
||||||
*/
|
*/
|
||||||
class CC_GUI_DLL CheckBox : public Widget
|
class CC_GUI_DLL CheckBox : public AbstractCheckButton
|
||||||
{
|
{
|
||||||
|
|
||||||
DECLARE_CLASS_GUI_INFO
|
DECLARE_CLASS_GUI_INFO
|
||||||
|
@ -130,64 +129,6 @@ public:
|
||||||
const std::string& cross,
|
const std::string& cross,
|
||||||
TextureResType texType = TextureResType::LOCAL);
|
TextureResType texType = TextureResType::LOCAL);
|
||||||
|
|
||||||
/**
|
|
||||||
* Load all textures for initializing a checkbox.
|
|
||||||
*
|
|
||||||
* @param background The background image name.
|
|
||||||
* @param backgroundSelected The background selected image name.
|
|
||||||
* @param cross The cross image name.
|
|
||||||
* @param backgroundDisabled The background disabled state texture.
|
|
||||||
* @param frontCrossDisabled The front cross disabled state image name.
|
|
||||||
* @param texType @see `Widget::TextureResType`
|
|
||||||
*/
|
|
||||||
void loadTextures(const std::string& background,
|
|
||||||
const std::string& backgroundSelected,
|
|
||||||
const std::string& cross,
|
|
||||||
const std::string& backgroundDisabled,
|
|
||||||
const std::string& frontCrossDisabled,
|
|
||||||
TextureResType texType = TextureResType::LOCAL);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Load background texture for checkbox.
|
|
||||||
*
|
|
||||||
* @param backGround The background image name.
|
|
||||||
* @param type @see `Widget::TextureResType`
|
|
||||||
*/
|
|
||||||
void loadTextureBackGround(const std::string& backGround,TextureResType type = TextureResType::LOCAL);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Load background selected state texture for checkbox.
|
|
||||||
*
|
|
||||||
* @param backGroundSelected The background selected state image name.
|
|
||||||
* @param texType @see `Widget::TextureResType`
|
|
||||||
*/
|
|
||||||
void loadTextureBackGroundSelected(const std::string& backGroundSelected,TextureResType texType = TextureResType::LOCAL);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Load cross texture for checkbox.
|
|
||||||
*
|
|
||||||
* @param crossTextureName The cross texture name.
|
|
||||||
* @param texType @see `Widget::TextureResType`
|
|
||||||
*/
|
|
||||||
void loadTextureFrontCross(const std::string& crossTextureName,TextureResType texType = TextureResType::LOCAL);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Load background disabled state texture for checkbox.
|
|
||||||
*
|
|
||||||
* @param backGroundDisabled The background disabled state texture name.
|
|
||||||
*
|
|
||||||
* @param texType @see `Widget::TextureResType`
|
|
||||||
*/
|
|
||||||
void loadTextureBackGroundDisabled(const std::string& backGroundDisabled,TextureResType texType = TextureResType::LOCAL);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Load frontcross disabled texture for checkbox.
|
|
||||||
*
|
|
||||||
* @param frontCrossDisabled The front cross disabled state texture name.
|
|
||||||
* @param texType @see `Widget::TextureResType`
|
|
||||||
*/
|
|
||||||
void loadTextureFrontCrossDisabled(const std::string& frontCrossDisabled,TextureResType texType = TextureResType::LOCAL);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change Checkbox state to selected.
|
* Change Checkbox state to selected.
|
||||||
*
|
*
|
||||||
|
@ -204,19 +145,6 @@ public:
|
||||||
*/
|
*/
|
||||||
CC_DEPRECATED_ATTRIBUTE bool getSelectedState()const{return this->isSelected();}
|
CC_DEPRECATED_ATTRIBUTE bool getSelectedState()const{return this->isSelected();}
|
||||||
|
|
||||||
/**
|
|
||||||
* Query whether CheckBox is selected or not.
|
|
||||||
*@return true means "selected", false otherwise.
|
|
||||||
*/
|
|
||||||
bool isSelected()const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Change CheckBox state.
|
|
||||||
* Set to true will cause the CheckBox's state to "selected", false otherwise.
|
|
||||||
*@param selected Set to true will change CheckBox to selected state, false otherwise.
|
|
||||||
*/
|
|
||||||
void setSelected(bool selected);
|
|
||||||
|
|
||||||
/**Add a callback function which would be called when checkbox is selected or unselected.
|
/**Add a callback function which would be called when checkbox is selected or unselected.
|
||||||
*@deprecated use `addEventListener(const ccCheckBoxCallback&)` instead
|
*@deprecated use `addEventListener(const ccCheckBoxCallback&)` instead
|
||||||
*@param target A pointer type in Ref*.
|
*@param target A pointer type in Ref*.
|
||||||
|
@ -232,71 +160,17 @@ public:
|
||||||
|
|
||||||
|
|
||||||
//override functions
|
//override functions
|
||||||
virtual Size getVirtualRendererSize() const override;
|
|
||||||
virtual Node* getVirtualRenderer() override;
|
|
||||||
virtual std::string getDescription() const override;
|
virtual std::string getDescription() const override;
|
||||||
|
|
||||||
/** When user pressed the CheckBox, the button will zoom to a scale.
|
|
||||||
* The final scale of the CheckBox equals (CheckBox original scale + _zoomScale)
|
|
||||||
* @since v3.3
|
|
||||||
*/
|
|
||||||
void setZoomScale(float scale);
|
|
||||||
/**
|
|
||||||
* @brief Return a zoom scale
|
|
||||||
* @return A zoom scale of Checkbox.
|
|
||||||
* @since v3.3
|
|
||||||
*/
|
|
||||||
float getZoomScale()const;
|
|
||||||
|
|
||||||
CC_CONSTRUCTOR_ACCESS:
|
|
||||||
virtual bool init() override;
|
|
||||||
virtual bool init(const std::string& backGround,
|
|
||||||
const std::string& backGroundSeleted,
|
|
||||||
const std::string& cross,
|
|
||||||
const std::string& backGroundDisabled,
|
|
||||||
const std::string& frontCrossDisabled,
|
|
||||||
TextureResType texType = TextureResType::LOCAL);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void initRenderer() override;
|
|
||||||
virtual void onPressStateChangedToNormal() override;
|
|
||||||
virtual void onPressStateChangedToPressed() override;
|
|
||||||
virtual void onPressStateChangedToDisabled() override;
|
|
||||||
|
|
||||||
void setupBackgroundTexture();
|
|
||||||
void loadTextureBackGround(SpriteFrame* spriteFrame);
|
|
||||||
void setupBackgroundSelectedTexture();
|
|
||||||
void loadTextureBackGroundSelected(SpriteFrame* spriteFrame);
|
|
||||||
void setupFrontCrossTexture();
|
|
||||||
void loadTextureFrontCross(SpriteFrame* spriteframe);
|
|
||||||
void setupBackgroundDisable();
|
|
||||||
void loadTextureBackGroundDisabled(SpriteFrame* spriteframe);
|
|
||||||
void setupFrontCrossDisableTexture();
|
|
||||||
void loadTextureFrontCrossDisabled(SpriteFrame* spriteframe);
|
|
||||||
|
|
||||||
void selectedEvent();
|
|
||||||
void unSelectedEvent();
|
|
||||||
|
|
||||||
virtual void releaseUpEvent() override;
|
virtual void releaseUpEvent() override;
|
||||||
|
|
||||||
virtual void onSizeChanged() override;
|
virtual void dispatchSelectChangedEvent(bool selected) override;
|
||||||
|
|
||||||
void backGroundTextureScaleChangedWithSize();
|
|
||||||
void backGroundSelectedTextureScaleChangedWithSize();
|
|
||||||
void frontCrossTextureScaleChangedWithSize();
|
|
||||||
void backGroundDisabledTextureScaleChangedWithSize();
|
|
||||||
void frontCrossDisabledTextureScaleChangedWithSize();
|
|
||||||
|
|
||||||
virtual Widget* createCloneInstance() override;
|
virtual Widget* createCloneInstance() override;
|
||||||
virtual void copySpecialProperties(Widget* model) override;
|
virtual void copySpecialProperties(Widget* model) override;
|
||||||
virtual void adaptRenderers() override;
|
|
||||||
protected:
|
protected:
|
||||||
Sprite* _backGroundBoxRenderer;
|
|
||||||
Sprite* _backGroundSelectedBoxRenderer;
|
|
||||||
Sprite* _frontCrossRenderer;
|
|
||||||
Sprite* _backGroundBoxDisabledRenderer;
|
|
||||||
Sprite* _frontCrossDisabledRenderer;
|
|
||||||
bool _isSelected;
|
|
||||||
//if you use the old event callback, it will retain the _checkBoxEventListener
|
//if you use the old event callback, it will retain the _checkBoxEventListener
|
||||||
Ref* _checkBoxEventListener;
|
Ref* _checkBoxEventListener;
|
||||||
|
|
||||||
|
@ -315,24 +189,6 @@ protected:
|
||||||
|
|
||||||
ccCheckBoxCallback _checkBoxEventCallback;
|
ccCheckBoxCallback _checkBoxEventCallback;
|
||||||
|
|
||||||
bool _isBackgroundSelectedTextureLoaded;
|
|
||||||
bool _isBackgroundDisabledTextureLoaded;
|
|
||||||
bool _isFrontCrossDisabledTextureLoaded;
|
|
||||||
TextureResType _backGroundTexType;
|
|
||||||
TextureResType _backGroundSelectedTexType;
|
|
||||||
TextureResType _frontCrossTexType;
|
|
||||||
TextureResType _backGroundDisabledTexType;
|
|
||||||
TextureResType _frontCrossDisabledTexType;
|
|
||||||
|
|
||||||
float _zoomScale;
|
|
||||||
float _backgroundTextureScaleX;
|
|
||||||
float _backgroundTextureScaleY;
|
|
||||||
|
|
||||||
bool _backGroundBoxRendererAdaptDirty;
|
|
||||||
bool _backGroundSelectedBoxRendererAdaptDirty;
|
|
||||||
bool _frontCrossRendererAdaptDirty;
|
|
||||||
bool _backGroundBoxDisabledRendererAdaptDirty;
|
|
||||||
bool _frontCrossDisabledRendererAdaptDirty;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -336,11 +336,11 @@ void Layout::onBeforeVisitStencil()
|
||||||
glGetIntegerv(GL_STENCIL_PASS_DEPTH_PASS, (GLint *)&_currentStencilPassDepthPass);
|
glGetIntegerv(GL_STENCIL_PASS_DEPTH_PASS, (GLint *)&_currentStencilPassDepthPass);
|
||||||
|
|
||||||
glEnable(GL_STENCIL_TEST);
|
glEnable(GL_STENCIL_TEST);
|
||||||
RenderState::StateBlock::_defaultState->setStencilTest(true);
|
// RenderState::StateBlock::_defaultState->setStencilTest(true);
|
||||||
|
|
||||||
CHECK_GL_ERROR_DEBUG();
|
CHECK_GL_ERROR_DEBUG();
|
||||||
glStencilMask(mask_layer);
|
glStencilMask(mask_layer);
|
||||||
RenderState::StateBlock::_defaultState->setStencilWrite(mask_layer);
|
// RenderState::StateBlock::_defaultState->setStencilWrite(mask_layer);
|
||||||
|
|
||||||
glGetBooleanv(GL_DEPTH_WRITEMASK, &_currentDepthWriteMask);
|
glGetBooleanv(GL_DEPTH_WRITEMASK, &_currentDepthWriteMask);
|
||||||
|
|
||||||
|
@ -354,16 +354,16 @@ void Layout::onBeforeVisitStencil()
|
||||||
this->drawFullScreenQuadClearStencil();
|
this->drawFullScreenQuadClearStencil();
|
||||||
|
|
||||||
glStencilFunc(GL_NEVER, mask_layer, mask_layer);
|
glStencilFunc(GL_NEVER, mask_layer, mask_layer);
|
||||||
RenderState::StateBlock::_defaultState->setStencilFunction(
|
// RenderState::StateBlock::_defaultState->setStencilFunction(
|
||||||
RenderState::STENCIL_NEVER,
|
// RenderState::STENCIL_NEVER,
|
||||||
mask_layer,
|
// mask_layer,
|
||||||
mask_layer);
|
// mask_layer);
|
||||||
|
|
||||||
glStencilOp(GL_REPLACE, GL_KEEP, GL_KEEP);
|
glStencilOp(GL_REPLACE, GL_KEEP, GL_KEEP);
|
||||||
RenderState::StateBlock::_defaultState->setStencilOperation(
|
// RenderState::StateBlock::_defaultState->setStencilOperation(
|
||||||
RenderState::STENCIL_OP_REPLACE,
|
// RenderState::STENCIL_OP_REPLACE,
|
||||||
RenderState::STENCIL_OP_KEEP,
|
// RenderState::STENCIL_OP_KEEP,
|
||||||
RenderState::STENCIL_OP_KEEP);
|
// RenderState::STENCIL_OP_KEEP);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Layout::drawFullScreenQuadClearStencil()
|
void Layout::drawFullScreenQuadClearStencil()
|
||||||
|
@ -413,16 +413,16 @@ void Layout::onAfterDrawStencil()
|
||||||
RenderState::StateBlock::_defaultState->setDepthWrite(_currentDepthWriteMask);
|
RenderState::StateBlock::_defaultState->setDepthWrite(_currentDepthWriteMask);
|
||||||
|
|
||||||
glStencilFunc(GL_EQUAL, _mask_layer_le, _mask_layer_le);
|
glStencilFunc(GL_EQUAL, _mask_layer_le, _mask_layer_le);
|
||||||
RenderState::StateBlock::_defaultState->setStencilFunction(
|
// RenderState::StateBlock::_defaultState->setStencilFunction(
|
||||||
RenderState::STENCIL_EQUAL,
|
// RenderState::STENCIL_EQUAL,
|
||||||
_mask_layer_le,
|
// _mask_layer_le,
|
||||||
_mask_layer_le);
|
// _mask_layer_le);
|
||||||
|
|
||||||
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
|
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
|
||||||
RenderState::StateBlock::_defaultState->setStencilOperation(
|
// RenderState::StateBlock::_defaultState->setStencilOperation(
|
||||||
RenderState::STENCIL_OP_KEEP,
|
// RenderState::STENCIL_OP_KEEP,
|
||||||
RenderState::STENCIL_OP_KEEP,
|
// RenderState::STENCIL_OP_KEEP,
|
||||||
RenderState::STENCIL_OP_KEEP);
|
// RenderState::STENCIL_OP_KEEP);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -430,22 +430,22 @@ void Layout::onAfterDrawStencil()
|
||||||
void Layout::onAfterVisitStencil()
|
void Layout::onAfterVisitStencil()
|
||||||
{
|
{
|
||||||
glStencilFunc(_currentStencilFunc, _currentStencilRef, _currentStencilValueMask);
|
glStencilFunc(_currentStencilFunc, _currentStencilRef, _currentStencilValueMask);
|
||||||
RenderState::StateBlock::_defaultState->setStencilFunction(
|
// RenderState::StateBlock::_defaultState->setStencilFunction(
|
||||||
(RenderState::StencilFunction)_currentStencilFunc,
|
// (RenderState::StencilFunction)_currentStencilFunc,
|
||||||
_currentStencilRef,
|
// _currentStencilRef,
|
||||||
_currentStencilValueMask);
|
// _currentStencilValueMask);
|
||||||
|
|
||||||
glStencilOp(_currentStencilFail, _currentStencilPassDepthFail, _currentStencilPassDepthPass);
|
glStencilOp(_currentStencilFail, _currentStencilPassDepthFail, _currentStencilPassDepthPass);
|
||||||
RenderState::StateBlock::_defaultState->setStencilOperation(
|
// RenderState::StateBlock::_defaultState->setStencilOperation(
|
||||||
(RenderState::StencilOperation)_currentStencilFail,
|
// (RenderState::StencilOperation)_currentStencilFail,
|
||||||
(RenderState::StencilOperation)_currentStencilPassDepthFail,
|
// (RenderState::StencilOperation)_currentStencilPassDepthFail,
|
||||||
(RenderState::StencilOperation)_currentStencilPassDepthPass);
|
// (RenderState::StencilOperation)_currentStencilPassDepthPass);
|
||||||
|
|
||||||
glStencilMask(_currentStencilWriteMask);
|
glStencilMask(_currentStencilWriteMask);
|
||||||
if (!_currentStencilEnabled)
|
if (!_currentStencilEnabled)
|
||||||
{
|
{
|
||||||
glDisable(GL_STENCIL_TEST);
|
glDisable(GL_STENCIL_TEST);
|
||||||
RenderState::StateBlock::_defaultState->setStencilTest(false);
|
// RenderState::StateBlock::_defaultState->setStencilTest(false);
|
||||||
}
|
}
|
||||||
s_layer--;
|
s_layer--;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,349 @@
|
||||||
|
/****************************************************************************
|
||||||
|
Copyright (c) 2015 Neo Kim (neo.kim@neofect.com)
|
||||||
|
|
||||||
|
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 "ui/UIRadioButton.h"
|
||||||
|
|
||||||
|
NS_CC_BEGIN
|
||||||
|
|
||||||
|
namespace ui {
|
||||||
|
|
||||||
|
IMPLEMENT_CLASS_GUI_INFO(RadioButton)
|
||||||
|
|
||||||
|
RadioButton::RadioButton() :
|
||||||
|
_radioButtonEventCallback(nullptr),
|
||||||
|
_group(nullptr)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
RadioButton::~RadioButton()
|
||||||
|
{
|
||||||
|
_radioButtonEventCallback = nullptr;
|
||||||
|
_group = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
RadioButton* RadioButton::create()
|
||||||
|
{
|
||||||
|
RadioButton* widget = new (std::nothrow) RadioButton();
|
||||||
|
if (widget && widget->init())
|
||||||
|
{
|
||||||
|
widget->autorelease();
|
||||||
|
return widget;
|
||||||
|
}
|
||||||
|
CC_SAFE_DELETE(widget);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
RadioButton* RadioButton::create(const std::string& backGround,
|
||||||
|
const std::string& backGroundSeleted,
|
||||||
|
const std::string& cross,
|
||||||
|
const std::string& backGroundDisabled,
|
||||||
|
const std::string& frontCrossDisabled,
|
||||||
|
TextureResType texType)
|
||||||
|
{
|
||||||
|
RadioButton *pWidget = new (std::nothrow) RadioButton;
|
||||||
|
if (pWidget && pWidget->init(backGround,
|
||||||
|
backGroundSeleted,
|
||||||
|
cross,
|
||||||
|
backGroundDisabled,
|
||||||
|
frontCrossDisabled,
|
||||||
|
texType))
|
||||||
|
{
|
||||||
|
pWidget->autorelease();
|
||||||
|
return pWidget;
|
||||||
|
}
|
||||||
|
CC_SAFE_DELETE(pWidget);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
RadioButton* RadioButton::create(const std::string& backGround,
|
||||||
|
const std::string& cross,
|
||||||
|
TextureResType texType)
|
||||||
|
{
|
||||||
|
RadioButton *pWidget = new (std::nothrow) RadioButton;
|
||||||
|
if (pWidget && pWidget->init(backGround,
|
||||||
|
"",
|
||||||
|
cross,
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
texType))
|
||||||
|
{
|
||||||
|
pWidget->autorelease();
|
||||||
|
return pWidget;
|
||||||
|
}
|
||||||
|
CC_SAFE_DELETE(pWidget);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadioButton::dispatchSelectChangedEvent(bool selected)
|
||||||
|
{
|
||||||
|
EventType eventType = (selected ? EventType::SELECTED : EventType::UNSELECTED);
|
||||||
|
this->retain();
|
||||||
|
if (_radioButtonEventCallback)
|
||||||
|
{
|
||||||
|
_radioButtonEventCallback(this, eventType);
|
||||||
|
}
|
||||||
|
if (_ccEventCallback)
|
||||||
|
{
|
||||||
|
_ccEventCallback(this, static_cast<int>(eventType));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(selected && _group != nullptr)
|
||||||
|
{
|
||||||
|
_group->onChangedRadioButtonSelect(this);
|
||||||
|
}
|
||||||
|
this->release();
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadioButton::addEventListener(const ccRadioButtonCallback& callback)
|
||||||
|
{
|
||||||
|
_radioButtonEventCallback = callback;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadioButton::releaseUpEvent()
|
||||||
|
{
|
||||||
|
Widget::releaseUpEvent();
|
||||||
|
|
||||||
|
if (!_isSelected)
|
||||||
|
{
|
||||||
|
setSelected(true);
|
||||||
|
dispatchSelectChangedEvent(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string RadioButton::getDescription() const
|
||||||
|
{
|
||||||
|
return "RadioButton";
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget* RadioButton::createCloneInstance()
|
||||||
|
{
|
||||||
|
return RadioButton::create();
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadioButton::copySpecialProperties(Widget *widget)
|
||||||
|
{
|
||||||
|
RadioButton* radioButton = dynamic_cast<RadioButton*>(widget);
|
||||||
|
if (radioButton)
|
||||||
|
{
|
||||||
|
AbstractCheckButton::copySpecialProperties(widget);
|
||||||
|
_radioButtonEventCallback = radioButton->_radioButtonEventCallback;
|
||||||
|
_ccEventCallback = radioButton->_ccEventCallback;
|
||||||
|
_group = radioButton->_group;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RadioButtonGroup::RadioButtonGroup() :
|
||||||
|
_radioButtonGroupEventCallback(nullptr),
|
||||||
|
_selectedRadioButton(nullptr),
|
||||||
|
_allowedNoSelection(false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
RadioButtonGroup::~RadioButtonGroup()
|
||||||
|
{
|
||||||
|
_radioButtonGroupEventCallback = nullptr;
|
||||||
|
_selectedRadioButton = nullptr;
|
||||||
|
_radioButtons.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
RadioButtonGroup* RadioButtonGroup::create()
|
||||||
|
{
|
||||||
|
RadioButtonGroup* widget = new (std::nothrow) RadioButtonGroup();
|
||||||
|
if (widget && widget->init())
|
||||||
|
{
|
||||||
|
widget->autorelease();
|
||||||
|
return widget;
|
||||||
|
}
|
||||||
|
CC_SAFE_DELETE(widget);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadioButtonGroup::addEventListener(const ccRadioButtonGroupCallback& callback)
|
||||||
|
{
|
||||||
|
_radioButtonGroupEventCallback = callback;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadioButtonGroup::addRadioButton(RadioButton* radioButton)
|
||||||
|
{
|
||||||
|
if(radioButton != nullptr)
|
||||||
|
{
|
||||||
|
CCASSERT(!radioButton->_group, "It already belongs to a group!");
|
||||||
|
radioButton->_group = this;
|
||||||
|
_radioButtons.pushBack(radioButton);
|
||||||
|
|
||||||
|
if(!_allowedNoSelection && _selectedRadioButton == nullptr)
|
||||||
|
{
|
||||||
|
setSelectedButton(radioButton);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadioButtonGroup::removeRadioButton(RadioButton* radioButton)
|
||||||
|
{
|
||||||
|
ssize_t index = _radioButtons.getIndex(radioButton);
|
||||||
|
if( index == CC_INVALID_INDEX )
|
||||||
|
{
|
||||||
|
CCLOGERROR("The radio button does not belong to this group!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(radioButton != nullptr)
|
||||||
|
{
|
||||||
|
radioButton->_group = nullptr;
|
||||||
|
if(radioButton == _selectedRadioButton)
|
||||||
|
{
|
||||||
|
deselect();
|
||||||
|
}
|
||||||
|
_radioButtons.erase(index);
|
||||||
|
|
||||||
|
if(!_allowedNoSelection && _selectedRadioButton == nullptr && !_radioButtons.empty())
|
||||||
|
{
|
||||||
|
setSelectedButton(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ssize_t RadioButtonGroup::getNumberOfRadioButtons() const
|
||||||
|
{
|
||||||
|
return _radioButtons.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
RadioButton* RadioButtonGroup::getRadioButtonByIndex(int index) const
|
||||||
|
{
|
||||||
|
if(index >= _radioButtons.size())
|
||||||
|
{
|
||||||
|
CCLOGERROR("Out of array index! length=%d, requestedIndex=%d", (int)_radioButtons.size(), index);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
return _radioButtons.at(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadioButtonGroup::deselect()
|
||||||
|
{
|
||||||
|
if(_selectedRadioButton != nullptr)
|
||||||
|
{
|
||||||
|
_selectedRadioButton->setSelected(false);
|
||||||
|
_selectedRadioButton->dispatchSelectChangedEvent(false);
|
||||||
|
}
|
||||||
|
_selectedRadioButton = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
int RadioButtonGroup::getSelectedButtonIndex() const
|
||||||
|
{
|
||||||
|
return (int) _radioButtons.getIndex(_selectedRadioButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadioButtonGroup::setSelectedButton(int index)
|
||||||
|
{
|
||||||
|
CCASSERT(index < _radioButtons.size(), "Out of array index!");
|
||||||
|
setSelectedButton(_radioButtons.at(index));
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadioButtonGroup::setSelectedButton(RadioButton* radioButton)
|
||||||
|
{
|
||||||
|
if(!_allowedNoSelection && radioButton == nullptr)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(_selectedRadioButton == radioButton)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(!_radioButtons.contains(radioButton))
|
||||||
|
{
|
||||||
|
CCLOGERROR("The radio button does not belong to this group!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
deselect();
|
||||||
|
_selectedRadioButton = radioButton;
|
||||||
|
if(_selectedRadioButton != nullptr)
|
||||||
|
{
|
||||||
|
_selectedRadioButton->setSelected(true);
|
||||||
|
}
|
||||||
|
onChangedRadioButtonSelect(_selectedRadioButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string RadioButtonGroup::getDescription() const
|
||||||
|
{
|
||||||
|
return "RadioButtonGroup";
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadioButtonGroup::setAllowedNoSelection(bool allowedNoSelection)
|
||||||
|
{
|
||||||
|
_allowedNoSelection = allowedNoSelection;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RadioButtonGroup::isAllowedNoSelection() const
|
||||||
|
{
|
||||||
|
return _allowedNoSelection;
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget* RadioButtonGroup::createCloneInstance()
|
||||||
|
{
|
||||||
|
return RadioButtonGroup::create();
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadioButtonGroup::copySpecialProperties(Widget *widget)
|
||||||
|
{
|
||||||
|
RadioButtonGroup* radioButtonGroup = dynamic_cast<RadioButtonGroup*>(widget);
|
||||||
|
if (radioButtonGroup)
|
||||||
|
{
|
||||||
|
_radioButtonGroupEventCallback = radioButtonGroup->_radioButtonGroupEventCallback;
|
||||||
|
_ccEventCallback = radioButtonGroup->_ccEventCallback;
|
||||||
|
_selectedRadioButton = radioButtonGroup->_selectedRadioButton;
|
||||||
|
_allowedNoSelection = radioButtonGroup->_allowedNoSelection;
|
||||||
|
|
||||||
|
_radioButtons.clear();
|
||||||
|
for(const auto& radioButton : radioButtonGroup->_radioButtons)
|
||||||
|
{
|
||||||
|
_radioButtons.pushBack(radioButton);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadioButtonGroup::onChangedRadioButtonSelect(RadioButton* radioButton)
|
||||||
|
{
|
||||||
|
if(_selectedRadioButton != radioButton)
|
||||||
|
{
|
||||||
|
deselect();
|
||||||
|
_selectedRadioButton = radioButton;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->retain();
|
||||||
|
if (_radioButtonGroupEventCallback)
|
||||||
|
{
|
||||||
|
int index = (int) _radioButtons.getIndex(radioButton);
|
||||||
|
_radioButtonGroupEventCallback(_selectedRadioButton, index, EventType::SELECT_CHANGED);
|
||||||
|
}
|
||||||
|
if (_ccEventCallback)
|
||||||
|
{
|
||||||
|
_ccEventCallback(this, static_cast<int>(EventType::SELECT_CHANGED));
|
||||||
|
}
|
||||||
|
this->release();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_CC_END
|
|
@ -0,0 +1,275 @@
|
||||||
|
/****************************************************************************
|
||||||
|
Copyright (c) 2015 Neo Kim (neo.kim@neofect.com)
|
||||||
|
|
||||||
|
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 __UIRADIOBUTTON_H__
|
||||||
|
#define __UIRADIOBUTTON_H__
|
||||||
|
|
||||||
|
#include "ui/UIAbstractCheckButton.h"
|
||||||
|
#include "ui/GUIExport.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @addtogroup ui
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
NS_CC_BEGIN
|
||||||
|
|
||||||
|
namespace ui {
|
||||||
|
|
||||||
|
class RadioButtonGroup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RadioButton is a specific type of two-states button that is similar to CheckBox.
|
||||||
|
* Additionally, it can be used together with RadioButtonGroup to interact with other radio buttons.
|
||||||
|
*/
|
||||||
|
class CC_GUI_DLL RadioButton : public AbstractCheckButton
|
||||||
|
{
|
||||||
|
|
||||||
|
DECLARE_CLASS_GUI_INFO
|
||||||
|
|
||||||
|
friend class RadioButtonGroup;
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Radio button event types.
|
||||||
|
*/
|
||||||
|
enum class EventType
|
||||||
|
{
|
||||||
|
SELECTED,
|
||||||
|
UNSELECTED
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A callback which will be called after certain RadioButton event issue.
|
||||||
|
* @see `RadioButton::EventType`
|
||||||
|
*/
|
||||||
|
typedef std::function<void(RadioButton* radioButton, EventType)> ccRadioButtonCallback;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default constructor.
|
||||||
|
*
|
||||||
|
* @lua new
|
||||||
|
*/
|
||||||
|
RadioButton();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default destructor.
|
||||||
|
*
|
||||||
|
* @lua NA
|
||||||
|
*/
|
||||||
|
virtual ~RadioButton();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create and return a empty RadioButton instance pointer.
|
||||||
|
*/
|
||||||
|
static RadioButton* create();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a radio button with various images.
|
||||||
|
*
|
||||||
|
* @param backGround backGround texture.
|
||||||
|
* @param backGroundSelected backGround selected state texture.
|
||||||
|
* @param cross cross texture.
|
||||||
|
* @param backGroundDisabled backGround disabled state texture.
|
||||||
|
* @param frontCrossDisabled cross dark state texture.
|
||||||
|
* @param texType @see `Widget::TextureResType`
|
||||||
|
*
|
||||||
|
* @return A RadioButton instance pointer.
|
||||||
|
*/
|
||||||
|
static RadioButton* create(const std::string& backGround,
|
||||||
|
const std::string& backGroundSelected,
|
||||||
|
const std::string& cross,
|
||||||
|
const std::string& backGroundDisabled,
|
||||||
|
const std::string& frontCrossDisabled,
|
||||||
|
TextureResType texType = TextureResType::LOCAL);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Another factory method to create a RadioButton instance.
|
||||||
|
* This method uses less resource to create a RadioButton.
|
||||||
|
* @param backGround The background image name in `std::string`.
|
||||||
|
* @param cross The cross image name in `std::string`.
|
||||||
|
* @param texType The texture's resource type in `Widget::TextureResType`.
|
||||||
|
* @return A RadioButton instance pointer
|
||||||
|
*/
|
||||||
|
static RadioButton* create(const std::string& backGround,
|
||||||
|
const std::string& cross,
|
||||||
|
TextureResType texType = TextureResType::LOCAL);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a callback function which would be called when radio button is selected or unselected.
|
||||||
|
*@param callback A std::function with type @see `ccRadioButtonCallback`
|
||||||
|
*/
|
||||||
|
void addEventListener(const ccRadioButtonCallback& callback);
|
||||||
|
|
||||||
|
virtual std::string getDescription() const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void releaseUpEvent() override;
|
||||||
|
|
||||||
|
virtual void dispatchSelectChangedEvent(bool selected) override;
|
||||||
|
|
||||||
|
virtual Widget* createCloneInstance() override;
|
||||||
|
virtual void copySpecialProperties(Widget* model) override;
|
||||||
|
|
||||||
|
ccRadioButtonCallback _radioButtonEventCallback;
|
||||||
|
RadioButtonGroup* _group;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RadioButtonGroup groups designated radio buttons to make them interact to each other.
|
||||||
|
* In one RadioButtonGroup, only one or no RadioButton can be checked.
|
||||||
|
*/
|
||||||
|
class CC_GUI_DLL RadioButtonGroup : public Widget
|
||||||
|
{
|
||||||
|
friend class RadioButton;
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Radio button group event types.
|
||||||
|
*/
|
||||||
|
enum class EventType
|
||||||
|
{
|
||||||
|
SELECT_CHANGED,
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A callback which will be called after RadioButtonGroup event issue.
|
||||||
|
* @see `RadioButtonGroup::EventType`
|
||||||
|
*/
|
||||||
|
typedef std::function<void(RadioButton* radioButton, int index, EventType)> ccRadioButtonGroupCallback;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default constructor.
|
||||||
|
*
|
||||||
|
* @lua new
|
||||||
|
*/
|
||||||
|
RadioButtonGroup();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default destructor.
|
||||||
|
*
|
||||||
|
* @lua NA
|
||||||
|
*/
|
||||||
|
virtual ~RadioButtonGroup();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create and return a empty RadioButtonGroup instance pointer.
|
||||||
|
*/
|
||||||
|
static RadioButtonGroup* create();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a callback function which would be called when radio button is selected or unselected.
|
||||||
|
*@param callback A std::function with type @see `ccRadioButtonGroupCallback`
|
||||||
|
*/
|
||||||
|
void addEventListener(const ccRadioButtonGroupCallback& callback);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the index of selected radio button.
|
||||||
|
*
|
||||||
|
* @return the selected button's index. Returns -1 if no button is selected.
|
||||||
|
*/
|
||||||
|
virtual int getSelectedButtonIndex() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Select a radio button by index.
|
||||||
|
*
|
||||||
|
* @param index of the radio button
|
||||||
|
*/
|
||||||
|
virtual void setSelectedButton(int index);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Select a radio button by instance.
|
||||||
|
*
|
||||||
|
* @param radio button instance
|
||||||
|
*/
|
||||||
|
virtual void setSelectedButton(RadioButton* radioButton);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a radio button into this group.
|
||||||
|
*
|
||||||
|
* @param radio button instance
|
||||||
|
*/
|
||||||
|
virtual void addRadioButton(RadioButton* radioButton);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a radio button from this group.
|
||||||
|
*
|
||||||
|
* @param radio button instance
|
||||||
|
*/
|
||||||
|
virtual void removeRadioButton(RadioButton* radioButton);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the number of radio buttons in this group.
|
||||||
|
*
|
||||||
|
* @return the number of radio buttons in this group
|
||||||
|
*/
|
||||||
|
ssize_t getNumberOfRadioButtons() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a radio button in this group by index.
|
||||||
|
*
|
||||||
|
* @param index of the radio button
|
||||||
|
* @return radio button instance. Returns nullptr if out of index.
|
||||||
|
*/
|
||||||
|
RadioButton* getRadioButtonByIndex(int index) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a flag for allowing no-selection feature.
|
||||||
|
* If it is allowed, no radio button can be selected.
|
||||||
|
* If it is not allowed, one radio button must be selected all time except it is empty.
|
||||||
|
* Default is not allowed.
|
||||||
|
*
|
||||||
|
* @param true means allowing no-selection, false means disallowing no-selection.
|
||||||
|
*/
|
||||||
|
void setAllowedNoSelection(bool allowedNoSelection);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Query whether no-selection is allowed or not.
|
||||||
|
*
|
||||||
|
* @param true means no-selection is allowed, false means no-selection is not allowed.
|
||||||
|
*/
|
||||||
|
bool isAllowedNoSelection() const;
|
||||||
|
|
||||||
|
virtual std::string getDescription() const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual Widget* createCloneInstance() override;
|
||||||
|
virtual void copySpecialProperties(Widget* model) override;
|
||||||
|
|
||||||
|
void onChangedRadioButtonSelect(RadioButton* radioButton);
|
||||||
|
void deselect();
|
||||||
|
|
||||||
|
Vector<RadioButton*> _radioButtons;
|
||||||
|
ccRadioButtonGroupCallback _radioButtonGroupEventCallback;
|
||||||
|
RadioButton* _selectedRadioButton;
|
||||||
|
bool _allowedNoSelection;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_CC_END
|
||||||
|
// end of ui group
|
||||||
|
/// @}
|
||||||
|
|
||||||
|
#endif /* defined(__UIRADIOBUTTON_H__) */
|
|
@ -650,6 +650,7 @@ void Slider::onPressStateChangedToDisabled()
|
||||||
if (!_isSliderBallDisabledTexturedLoaded)
|
if (!_isSliderBallDisabledTexturedLoaded)
|
||||||
{
|
{
|
||||||
_slidBallNormalRenderer->setGLProgramState(this->getGrayGLProgramState());
|
_slidBallNormalRenderer->setGLProgramState(this->getGrayGLProgramState());
|
||||||
|
_slidBallNormalRenderer->setVisible(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -236,7 +236,7 @@ void Widget::onExit()
|
||||||
|
|
||||||
void Widget::visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags)
|
void Widget::visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags)
|
||||||
{
|
{
|
||||||
if (_visible || !isVisitableByVisitingCamera())
|
if (_visible)
|
||||||
{
|
{
|
||||||
adaptRenderers();
|
adaptRenderers();
|
||||||
ProtectedNode::visit(renderer, parentTransform, parentFlags);
|
ProtectedNode::visit(renderer, parentTransform, parentFlags);
|
||||||
|
|
|
@ -47,7 +47,9 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\CocosGUI.cpp" />
|
<ClCompile Include="..\CocosGUI.cpp" />
|
||||||
<ClCompile Include="..\UIButton.cpp" />
|
<ClCompile Include="..\UIButton.cpp" />
|
||||||
|
<ClCompile Include="..\UIAbstractCheckButton.cpp" />
|
||||||
<ClCompile Include="..\UICheckBox.cpp" />
|
<ClCompile Include="..\UICheckBox.cpp" />
|
||||||
|
<ClCompile Include="..\UIRadioButton.cpp" />
|
||||||
<ClCompile Include="..\UIDeprecated.cpp" />
|
<ClCompile Include="..\UIDeprecated.cpp" />
|
||||||
<ClCompile Include="..\UIEditBox\UIEditBox.cpp" />
|
<ClCompile Include="..\UIEditBox\UIEditBox.cpp" />
|
||||||
<ClCompile Include="..\UIEditBox\UIEditBoxImplWin.cpp" />
|
<ClCompile Include="..\UIEditBox\UIEditBoxImplWin.cpp" />
|
||||||
|
|
|
@ -131,9 +131,15 @@
|
||||||
<ClCompile Include="..\UIButton.cpp">
|
<ClCompile Include="..\UIButton.cpp">
|
||||||
<Filter>UIWidgets</Filter>
|
<Filter>UIWidgets</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\UIAbstractCheckButton.cpp">
|
||||||
|
<Filter>UIWidgets</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="..\UICheckBox.cpp">
|
<ClCompile Include="..\UICheckBox.cpp">
|
||||||
<Filter>UIWidgets</Filter>
|
<Filter>UIWidgets</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\UIRadioButton.cpp">
|
||||||
|
<Filter>UIWidgets</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="..\UIImageView.cpp">
|
<ClCompile Include="..\UIImageView.cpp">
|
||||||
<Filter>UIWidgets</Filter>
|
<Filter>UIWidgets</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|
|
@ -1,35 +1,41 @@
|
||||||
# cocos2d-x v3.6 Release Notes #
|
|
||||||
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
||||||
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
||||||
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
|
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
|
||||||
|
|
||||||
|
- [Cocos2d-x v3.7 RC0 Release Notes](#cocos2d-x-v37-rc0-release-notes)
|
||||||
- [Misc Information](#misc-information)
|
- [Misc Information](#misc-information)
|
||||||
- [Requirements](#requirements)
|
- [Requirements](#requirements)
|
||||||
- [Runtime Requirements](#runtime-requirements)
|
- [Runtime Requirements](#runtime-requirements)
|
||||||
- [Compiler Requirements](#compiler-requirements)
|
- [Compiler Requirements](#compiler-requirements)
|
||||||
- [How to run tests](#how-to-run-tests)
|
- [How to run tests](#how-to-run-tests)
|
||||||
|
- [Cocos Console](#cocos-console)
|
||||||
- [Mac OSX & iOS](#mac-osx-&-ios)
|
- [Mac OSX & iOS](#mac-osx-&-ios)
|
||||||
- [Android](#android)
|
- [Android](#android)
|
||||||
- [Windows](#windows)
|
- [Windows](#windows)
|
||||||
- [Linux](#linux)
|
- [Linux](#linux)
|
||||||
- [How to start a new game](#how-to-start-a-new-game)
|
- [How to start a new game](#how-to-start-a-new-game)
|
||||||
- [v3.6](#v36)
|
- [v3.7](#v37)
|
||||||
- [Highlights of v3.6](#highlights-of-v36)
|
- [Highlights of v3.7](#highlights-of-v37)
|
||||||
- [Features in detail](#features-in-detail-1)
|
- [Download](#download)
|
||||||
- [3D TextureCube](#3d-texturecube)
|
- [The main features in detail:](#the-main-features-in-detail)
|
||||||
- [3D Skybox](#3d-skybox)
|
- [3D Physics](#3d-physics)
|
||||||
- [3D Terrain](#3d-terrain)
|
- [3D Navigation mesh](#3d-navigation-mesh)
|
||||||
- [Animate3D Quality Control](#animate3d-quality-control)
|
- [Material system](#material-system)
|
||||||
- [Un-bottleneck your fill-rate with SpritePolygon](#un-bottleneck-your-fill-rate-with-spritepolygon)
|
- [All in one Cocos2d-x](#all-in-one-cocos2d-x)
|
||||||
- [LuaJit ARM64](#luajit-arm64)
|
- [Enhanced Polygon Sprite](#enhanced-polygon-sprite)
|
||||||
- [Button memory usage optimization](#button-memory-usage-optimization)
|
- [WebView and VideoPlayer in JS (native and web)](#webview-and-videoplayer-in-js-native-and-web)
|
||||||
|
- [Nine Patch format support](#nine-patch-format-support)
|
||||||
|
- [Android Studio support](#android-studio-support)
|
||||||
|
- [Samsung Enhanced API support](#samsung-enhanced-api-support)
|
||||||
|
- [The Next Step](#the-next-step)
|
||||||
|
|
||||||
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
||||||
|
|
||||||
|
# Cocos2d-x v3.7 RC0 Release Notes #
|
||||||
|
|
||||||
# Misc Information
|
# Misc Information
|
||||||
|
|
||||||
* [Full Changelog](https://github.com/cocos2d/cocos2d-x/blob/v3/CHANGELOG)
|
* [Full Changelog](https://github.com/cocos2d/cocos2d-x/blob/v3/CHANGELOG)
|
||||||
* v3.0 Release Notes can be found here: [v3.0 Release Notes](https://github.com/cocos2d/cocos2d-x/blob/cocos2d-x-3.0/docs/RELEASE_NOTES.md)
|
|
||||||
|
|
||||||
# Requirements
|
# Requirements
|
||||||
|
|
||||||
|
@ -52,9 +58,33 @@
|
||||||
|
|
||||||
## How to run tests
|
## How to run tests
|
||||||
|
|
||||||
|
### Cocos Console
|
||||||
|
|
||||||
|
You can use [Cocos Console](www.cocos2d-x.org/wiki/Cocos2d-console) command line tool to run the test cases on almost all supported platforms.
|
||||||
|
|
||||||
|
In console application:
|
||||||
|
```
|
||||||
|
// Enter cpp test folder
|
||||||
|
cd tests/cpp-tests
|
||||||
|
// Or enter js test folder
|
||||||
|
cd tests/js-tests
|
||||||
|
// Or enter lua test folder
|
||||||
|
cd tests/lua-tests
|
||||||
|
|
||||||
|
// Compile or run test case
|
||||||
|
cocos compile -p ios|mac|android|win32|win8_1|metro|web -m debug|release
|
||||||
|
cocos run -p ios|mac|android|win32|win8_1|metro|web -m debug|release
|
||||||
|
```
|
||||||
|
|
||||||
|
For example, if you want to run cpp test in release mode on Android, you can use the following command:
|
||||||
|
|
||||||
|
```
|
||||||
|
cocos run -p android -m release
|
||||||
|
```
|
||||||
|
|
||||||
### Mac OSX & iOS
|
### Mac OSX & iOS
|
||||||
|
|
||||||
* Enter `cocos2d-x/build` folder, open `cocos2d_test.xcodeproj`
|
* Enter `cocos2d-x/build` folder, open `cocos2d_test.xcodeproj` or `cocos2d_js_tests.xcodeproj` (For JS test, we will merge these two project in v3.8)
|
||||||
* Select `iOS` or `OS X` target in scheme toolbar
|
* Select `iOS` or `OS X` target in scheme toolbar
|
||||||
* Click `run` button
|
* Click `run` button
|
||||||
|
|
||||||
|
@ -87,11 +117,12 @@ Then
|
||||||
|
|
||||||
### Windows
|
### Windows
|
||||||
|
|
||||||
* Enter `cocos2d-x/build`, and open `cocos2d-win32.vs2012.sln`
|
* For win32 project, enter `cocos2d-x/build`, and open `cocos2d-win32.sln` or `cocos2d-js-win32.sln`
|
||||||
* Select `cpp-empty-test` as running target
|
* For win 8.1 project, enter `cocos2d-x/build`, and open `cocos2d-win8.1-universal.sln` or `cocos2d-js-win8.1-universal.sln`
|
||||||
|
* For win 10 project, enter `cocos2d-x/build`, and open `cocos2d-win10.sln`
|
||||||
|
* Select running target
|
||||||
* Click run button
|
* Click run button
|
||||||
|
|
||||||
|
|
||||||
### Linux
|
### Linux
|
||||||
|
|
||||||
$ cd cocos2d-x/build
|
$ cd cocos2d-x/build
|
||||||
|
@ -112,205 +143,101 @@ Run
|
||||||
|
|
||||||
## How to start a new game
|
## How to start a new game
|
||||||
|
|
||||||
Please refer to this document: [ReadMe](../README.md)
|
Use Cocos Console to create a new game:
|
||||||
|
|
||||||
# v3.6
|
|
||||||
|
|
||||||
## Highlights of v3.6
|
|
||||||
|
|
||||||
* 3D: added skybox support
|
|
||||||
* 3D: added terrain support
|
|
||||||
* added `SpritePolygon` to fix overdraw issue
|
|
||||||
* used luajit v2.1-20150331 on 64-bit iOS devices
|
|
||||||
* removed WP8 support
|
|
||||||
* memory usage optimization of `ui::Button`
|
|
||||||
* 3rd: updated Spine runtime to v2.1.25
|
|
||||||
* 3rd: updated libcurl to v7.4 on all supported platforms except WP8.1 universal
|
|
||||||
* 3rd: updated chipmunk to v6.2.2
|
|
||||||
* 3rd: updated openssl to v1.0.11
|
|
||||||
* 3rd: updated freetype to v2.5.5
|
|
||||||
* 3rd: updated png to v1.6.16
|
|
||||||
|
|
||||||
Because Angle doesn't support WP8 any more, and WP8's market share is around 20% worldwide with variations across countries, so we removed WP8 support suggested by MS OPEN TECK guys since v3.6.
|
|
||||||
|
|
||||||
|
|
||||||
## Features in detail
|
|
||||||
|
|
||||||
### 3D TextureCube
|
|
||||||
|
|
||||||
TextureCube is useful for skybox and environment mapping. It uses 6 faces of a cube as map shape, and 6 pictures are projected onto the sides of a cube and stored as six square textures.
|
|
||||||
|
|
||||||
**TexturesCube usage**
|
|
||||||
|
|
||||||
```c++
|
|
||||||
auto texturecube = TextureCube::create("left.jpg", "right.jpg", "top.jpg", "bottom.jpg","front.jpg", "back.jpg");
|
|
||||||
//set texture parameters
|
|
||||||
Texture2D::TexParams tRepeatParams;
|
|
||||||
tRepeatParams.magFilter = GL_NEAREST;
|
|
||||||
tRepeatParams.minFilter = GL_NEAREST;
|
|
||||||
tRepeatParams.wrapS = GL_MIRRORED_REPEAT;
|
|
||||||
tRepeatParams.wrapT = GL_MIRRORED_REPEAT;
|
|
||||||
texturecube->setTexParameters(tRepeatParams);
|
|
||||||
|
|
||||||
//create a GLProgramState using custom shader
|
|
||||||
auto shader = GLProgram::createWithFilenames("cube_map.vert", "cube_map.frag");
|
|
||||||
auto state = GLProgramState::create(shader);
|
|
||||||
// pass the texture sampler to our custom shader, state is a pointer of GLProgramState, u_cubeTex is a uniform in shader
|
|
||||||
state->setUniformTexture("u_cubeTex", texturecube);
|
|
||||||
```
|
|
||||||
|
|
||||||
Then the shader cube_map.frag can be something like this,
|
|
||||||
|
|
||||||
```c++
|
|
||||||
varying vec3 v_reflect; //reflect direction
|
|
||||||
uniform samplerCube u_cubeTex;
|
|
||||||
|
|
||||||
void main(void)
|
|
||||||
{
|
|
||||||
gl_FragColor = textureCube(u_cubeTex, v_reflect); //sample the color of reflection direction
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
For more information please refer to cpp-tests/Sprite3DTest/Sprite3DCubeMapTest.
|
|
||||||
|
|
||||||
### 3D Skybox
|
|
||||||
|
|
||||||
Skybox is a common component in 3D game. It is based on TextureCube.
|
|
||||||
|
|
||||||
Usage of skybox
|
|
||||||
|
|
||||||
```c++
|
|
||||||
// create a texture cube
|
|
||||||
auto textureCube = TextureCube::create("left.jpg", "right.jpg","top.jpg", "bottom.jpg","front.jpg", "back.jpg");
|
|
||||||
//create a skybox
|
|
||||||
auto skyBox = Skybox::create();
|
|
||||||
skyBox->retain();
|
|
||||||
//set cube texture to the skybox
|
|
||||||
skyBox->setTexture(textureCube);
|
|
||||||
addChild(_skyBox);
|
|
||||||
```
|
|
||||||
|
|
||||||
For more information please refer to cpp-tests/Sprite3DTest/Sprite3DCubeMapTest.
|
|
||||||
|
|
||||||
![tecturecube-and-skybox](https://raw.githubusercontent.com/minggo/Pictures/master/texturecube-skybox.gif)
|
|
||||||
|
|
||||||
### 3D Terrain
|
|
||||||
|
|
||||||
Terrain is an important component in 3D game. A texture is used to stand for the height map. And up to 4 textures can be used to blend the details of the terrain, grass, road, and so on.
|
|
||||||
|
|
||||||
Usage of terrain
|
|
||||||
|
|
||||||
```c++
|
|
||||||
//blended layers
|
|
||||||
Terrain::DetailMap dirt("TerrainTest/dirt.jpg"), grass("TerrainTest/Grass2.jpg"), road("TerrainTest/road.jpg"), green("TerrainTest/GreenSkin.jpg");
|
|
||||||
|
|
||||||
//height map, alpha map (blend weight), and blended layers
|
|
||||||
Terrain::TerrainData data("TerrainTest/heightmap16.jpg", "TerrainTest/alphamap.png", dirt, grass, road, green);
|
|
||||||
|
|
||||||
//create terrain here
|
|
||||||
_terrain = Terrain::create(data,Terrain::CrackFixedType::SKIRT);
|
|
||||||
//set lod distance
|
|
||||||
_terrain->setLODDistance(3.2,6.4,9.6);
|
|
||||||
//it must be less than 5
|
|
||||||
_terrain->setMaxDetailMapAmount(4);
|
|
||||||
addChild(_terrain);
|
|
||||||
```
|
|
||||||
|
|
||||||
For more information please refer to cpp-tests/Sprite3DTest/TerrainTest.
|
|
||||||
|
|
||||||
![terrian](https://raw.githubusercontent.com/minggo/Pictures/master/terrian.png)
|
|
||||||
|
|
||||||
### Animate3D Quality Control
|
|
||||||
|
|
||||||
In order to make Animate3D run fast, you can use low quality animation. There are three types of animation quality:
|
|
||||||
|
|
||||||
* Animate3DQuality::QUALITY_NONE
|
|
||||||
* Animate3DQuality::QUALITY_LOW
|
|
||||||
* Animate3DQuality::QUALITY_HIGH
|
|
||||||
|
|
||||||
`Animate3DQuality::QUALITY_NONE` means the animation will not be updated. You can use this type on the animation that you are sure it is not visible. `Animate3DQuality::QUALITY_LOW` will use the nearest keyframe to display current frame; `Animate3DQuality::QUALITY_HIGH` will will interpolate between keyframes.
|
|
||||||
|
|
||||||
|
|
||||||
```c++
|
|
||||||
std::string fileName = "Sprite3DTest/orc.c3b";
|
|
||||||
auto sprite = Sprite3D::create(fileName);
|
|
||||||
addChild(sprite);
|
|
||||||
|
|
||||||
auto animation = Animation3D::create(fileName);
|
|
||||||
if (animation)
|
|
||||||
{
|
|
||||||
auto animate = Animate3D::create(animation);
|
|
||||||
//use low quality animation
|
|
||||||
animate->setQuality(Animate3DQuality::QUALITY_LOW);
|
|
||||||
sprite->runAction(RepeatForever::create(animate));
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
The animation quality is also configurable in config.plist, the key is cocos2d.x.3d.animate_high_quality. All created Animate3D base on this key if exist. You can modify it using the above method.
|
|
||||||
|
|
||||||
### Un-bottleneck your fill-rate with SpritePolygon
|
|
||||||
|
|
||||||
SpritePolygon is a 2d Node, like Sprites, it displays a 2d Image.
|
|
||||||
But the difference is where Sprites is made of 2 triangles to form a quad, SpritePolygon is made of N number of triangles. `It is an experimental feature.`
|
|
||||||
|
|
||||||
![sprite-polygon](https://raw.githubusercontent.com/minggo/Pictures/master/sprite-polygon.jpg)
|
|
||||||
|
|
||||||
This allows the GPU to draw the same graphics with much lower pixels.
|
|
||||||
|
|
||||||
Because 2d games tends to not use much vertices compared to 3d games, but almost of all sprites are `none rectangular`, GPU wastes precious bandwidth drawing area that is totally transparent. Fill-rate is often the bottleneck in a graphic intense 2d game. SpritePolygon is the perfect cure for "Over-Draw".
|
|
||||||
|
|
||||||
Following picture is the result of performance comparing, corresponding performance test cases are in `tests/cpp-tests/Classes/SpritePolygonTest`:
|
|
||||||
|
|
||||||
![spritepolygon-performance](http://discuss.cocos2d-x.org/uploads/default/_optimized/336/215/1423528cff_690x149.png)
|
|
||||||
|
|
||||||
For more detail description of SpritePolygon please refer to [this thread](http://discuss.cocos2d-x.org/t/new-feature-meshsprite-polygonsprite/21153)
|
|
||||||
|
|
||||||
### luajit arm64
|
|
||||||
|
|
||||||
The version of the luajit is [v2.1-20150331](https://github.com/openresty/luajit2/releases). We have consulted the author of luajit, he said it was stability enough to be used. We will update to v2.1 when it is released.
|
|
||||||
|
|
||||||
Using luajit arm64 version is that because it can improve the performance. In previous versions of cocos2d-x, it uses lua on iOS 64-bit devices.
|
|
||||||
|
|
||||||
Bytecode of luajit and luajit arm64 are not compatible, which means you can not use one version of bytecode on iOS 32-bit devices and iOS 64-bit devices.
|
|
||||||
|
|
||||||
As there is not mandatory requirement of having arm64 bit bin on Android, so we don't use luajit arm64 on Android as its bytecode is not compatible with luajit arm32.
|
|
||||||
|
|
||||||
### Button memory usage optimization
|
|
||||||
Now the title label of Button is created on demand. A Button without title won't
|
|
||||||
create an extra empty label.
|
|
||||||
|
|
||||||
And we have also removed some redundant string variables in Button's header file.
|
|
||||||
|
|
||||||
We use Cpp-Empty-Test to verify this optimization.
|
|
||||||
|
|
||||||
Here is the test code:
|
|
||||||
|
|
||||||
```
|
```
|
||||||
auto visibleSize = Director::getInstance()->getVisibleSize();
|
cocos new -l cpp|js|lua MyGame
|
||||||
auto origin = Director::getInstance()->getVisibleOrigin();
|
|
||||||
|
|
||||||
int num = 100;
|
|
||||||
for (int i=0; i < num; ++i)
|
|
||||||
{
|
|
||||||
auto button = ui::Button::create("ClosedNormal.png",
|
|
||||||
"ClosedSelected.png");
|
|
||||||
button->setPosition(origin + visibleSize/2);
|
|
||||||
this->addChild(button);
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
And here is the result:
|
# v3.7
|
||||||
|
|
||||||
#### On iOS platform
|
## Highlights of v3.7
|
||||||
|
|
||||||
|Num of buttons|100 | 200 | 500| 1000|
|
1. Cocos2d-x will only publish the final versions publicly in the future, all alpha, beta, rc versions will be exclusively published in the community. By that I mean in the English and Chinese forum, in developers QQ groups, by the github tags. The final versions will be published with the all in one Cocos.
|
||||||
|-----|-----|-----|-----|-----|
|
|
||||||
|Before optimization | 61M | 61.9M | 67.1M | 72.2M|
|
|
||||||
|After optimization |60.7M| 61.1M | 66M | 67.9M|
|
|
||||||
|
|
||||||
#### On Mac platform
|
2. Cocos2d-JS is merged into Cocos2d-x in v3.7, from now on, developers won't get confused about which product they should use. With Cocos2d-x, you can work with C++/Lua/JS and publish to Windows/WP8.1/Android/Mac/iOS/Linux and Web if you use JS. For a smooth transition, we will still announce two products in v3.7, Cocos2d-x v3.7 and Cocos2d-JS v3.7, but they share exactly the same package. In the future versions, there will be only one package. For reference, this have been discussed in [another thread](http://discuss.cocos2d-x.org/t/discuss-the-next-step-of-cocos2d-x/21182/)
|
||||||
|
|
||||||
|Num of buttons|100 | 200 | 500| 1000|
|
* 3d: Added Physics3d support (JS/Lua ready)
|
||||||
|-----|-----|-----|-----|-----|
|
* 3d: Added NavMesh support (JS/Lua ready)
|
||||||
|Before optimization |26.8M | 27.1M| 33.2M| 35.4M|
|
* core: Added Material system (JS/Lua ready)
|
||||||
|After optimization |25.1M|25.9M|28M|32.4M|
|
* sprite: Supportted polygon sprite with AutoPolygon generator (JS/Lua ready)
|
||||||
|
* Scale9Sprite: Added Android 9-patch image support (JS/Lua ready)
|
||||||
|
* platform: Added Windows 10.0 Universal App(UWP) support
|
||||||
|
* platform: Add Samsung Enhanced API on Android for cocos
|
||||||
|
* C++: Added Android Studio support
|
||||||
|
* JS: Merged JSB and web engine into Cocos2d-x for a All-in-one engine
|
||||||
|
* JS: Added `ccui.VideoPlayer` and `ccui.WebView` for iOS/Android/Web
|
||||||
|
* console: Supported build & run Android Studio project with cocos console
|
||||||
|
|
||||||
|
## Download
|
||||||
|
|
||||||
|
[Cocos2d-x v3.7 RC0](http://www.cocos2d-x.org/filedown/cocos2d-x-3.7rc0.zip) including : C++, Lua & JS
|
||||||
|
|
||||||
|
## The main features in detail:
|
||||||
|
|
||||||
|
### 3D Physics
|
||||||
|
|
||||||
|
It's the physics engine we provided for providing 3D physics game capability, it works great with our current 3D modules, like 3D sprites, 3D Terrain, etc. We used [bullet](http://bulletphysics.org/wordpress/) library as base of 3D physics, encapsulate it into our Cocos 3D physics APIs. You can refer to Physics3DTest test case for its API and usage, we will add documentation into [programmers guide](http://cocos2d-x.org/programmersguide) lately.
|
||||||
|
|
||||||
|
![](http://cdn.cocimg.com/bbs/attachment/Fid_41/41_300874_348f31ee628da2b.png)
|
||||||
|
|
||||||
|
### 3D Navigation mesh
|
||||||
|
|
||||||
|
The navigation mesh system provides simple to use API to find path in a complexe 3D world, you can add mesh with a triangles list, add obstacles. Then you will add agents which can perform a path finding task and move your 3D sprites to a certain place following the path. You can refer to NavmeshTest test case for its API and usage, we will add documentation into [programmers guide](http://cocos2d-x.org/programmersguide) lately.
|
||||||
|
|
||||||
|
![](http://cdn.cocimg.com/bbs/attachment/Fid_41/41_300874_6589cbf376a639b.png)
|
||||||
|
|
||||||
|
### Material system
|
||||||
|
|
||||||
|
Material system is an advanced system which defines all visual informations (it may contain aural or physical informations in the future) of an object. Instead of just plain an simple texture, you can have more than one texture, and much more features like multi-pass rendering. Refer to [the documentation](https://github.com/chukong/programmers-guide/blob/v3.7/chapters/14.md#shaders-and-materials) for more details.
|
||||||
|
|
||||||
|
![](http://cdn.cocimg.com/bbs/attachment/Fid_41/41_300874_a94a91aeeaf401d.png)
|
||||||
|
|
||||||
|
### All in one Cocos2d-x
|
||||||
|
|
||||||
|
After merged Cocos2d-JS into Cocos2d-x, nothing have changed for C++ and Lua developers, but the engine structure may look very strange to JS developers. Don't worry, the upgrade is still very simple, because the project structure remains the same as before. Refer to [this discussion](http://discuss.cocos2d-x.org/t/cocos2d-js-v3-6-1-hot-fix-for-remote-debugger/21524/2) for more informations.
|
||||||
|
|
||||||
|
### Enhanced Polygon Sprite
|
||||||
|
|
||||||
|
As it's not very easy to used in the previous version, we have refactored the API for Polygon Sprite. It's now becoming a internal feature of 2d Sprite, you can use AutoPolygon to generate polygons for a sprite, then use it to create the sprite directly, very simple to use.
|
||||||
|
|
||||||
|
```
|
||||||
|
auto pinfo = AutoPolygon::generatePolygon("filename.png");
|
||||||
|
auto spp = Sprite::create(pinfo);
|
||||||
|
```
|
||||||
|
|
||||||
|
Although it do takes time to generate the polygons information, you can cache and reuse it, we also plan to support the polygons information generation in the editor in the future.
|
||||||
|
|
||||||
|
![](http://cdn.cocimg.com/bbs/attachment/Fid_41/41_300874_7b5ef9b52f054f3.png)
|
||||||
|
|
||||||
|
### WebView and VideoPlayer in JS (native and web)
|
||||||
|
|
||||||
|
The WebView and VideoPlayer have finally been ported to JS, and it supports iOS, Android and Web browsers. You can refer to its usage in the test case: [WebViewTest](https://github.com/cocos2d/cocos2d-x/blob/v3/tests/js-tests/src/GUITest/UIWebViewTest/UIWebViewTest.js) and [VideoPlayerTest](https://github.com/cocos2d/cocos2d-x/blob/v3/tests/js-tests/src/GUITest/UIVideoPlayerTest/UIVideoPlayerTest.js).
|
||||||
|
|
||||||
|
### Nine Patch format support
|
||||||
|
|
||||||
|
The Nine Patch image is a stretchable bitmap image which can be used as the texture of Scale9Sprite. Now Cocos2d-x support creating the Scale9Sprite node directly with a Nine Patch file. More informations about the [Nine Patch format](http://developer.android.com/guide/topics/graphics/2d-graphics.html#nine-patch) and [its tool](http://developer.android.com/tools/help/draw9patch.html). You can also refer to our test case for its usage: [C++](https://github.com/cocos2d/cocos2d-x/blob/v3/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScale9SpriteTest.cpp#L857), [Lua](https://github.com/cocos2d/cocos2d-x/blob/v3/tests/lua-tests/src/CocoStudioTest/CocoStudioGUITest/CocoStudioGUITest.lua#L4020), [JS](https://github.com/cocos2d/cocos2d-x/blob/v3/tests/js-tests/src/GUITest/UIS9NinePatchTest/UIS9NinePatchTest.js)
|
||||||
|
|
||||||
|
### Android Studio support
|
||||||
|
|
||||||
|
Cocos console now supports compilation and package with Android Studio 1.2, use it with a `--android-studio` flag
|
||||||
|
|
||||||
|
```
|
||||||
|
cocos run/compile -p android --android-studio
|
||||||
|
```
|
||||||
|
|
||||||
|
### Samsung Enhanced API support
|
||||||
|
|
||||||
|
Samsung have provided a series of Enhanced API to optimize Cocos2d-x games for Samsung products with Android 5.0+ system. It include some very cool features like: Boost Up API, Power Saving Mode API, Dynamic FPS API, etc. The current API can be found in [this header file](https://github.com/cocos2d/cocos2d-x/blob/v3/cocos/platform/android/CCEnhanceAPI-android.h), we will provide a detailed documentation later.
|
||||||
|
|
||||||
|
### Win32 platform resource name become case sensitive
|
||||||
|
|
||||||
|
In the previous versions, the resources file name's case is ignored on win32 platform, but not ignored in other platforms. This will lead to some unexpected issues, especially when user develop with win32 platform and pulish to other platforms like Android. In win32, the file name may be found without matching the case, but on other platforms it won't be found. So we decided to make win32 platform's resources case sensitive. Please make sure you are using the correct file name for your resources.
|
||||||
|
|
||||||
|
## The Next Step
|
||||||
|
|
||||||
|
As you can see, in v3.7, we have enhanced our 2d rendering with material system and integrated polygon sprite. More importantly, our 3d features become more and more complete, 3d Physics and Navigation Mesh with the previous Camera, 3d Sprite, 3d Particle System, 3d Light, 3d Terrain, Skybox, now you can really start to use Cocos to make a 3d game.
|
||||||
|
|
||||||
|
In v3.8, we won't do much more features, but we'd like to slow down and refine our current 3D and 2D modules.
|
||||||
|
|
||||||
|
[The v3.8 milestone tasks](https://github.com/cocos2d/cocos2d-x/milestones/v3.8)
|
|
@ -587,7 +587,7 @@ void ScrollView::onAfterDraw()
|
||||||
void ScrollView::visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags)
|
void ScrollView::visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags)
|
||||||
{
|
{
|
||||||
// quick return if not visible
|
// quick return if not visible
|
||||||
if (!isVisible() || !isVisitableByVisitingCamera())
|
if (!isVisible())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version":"v3-deps-67",
|
"version":"v3-deps-69",
|
||||||
"zip_file_size":"131253061",
|
"zip_file_size":"131253061",
|
||||||
"repo_name":"cocos2d-x-3rd-party-libs-bin",
|
"repo_name":"cocos2d-x-3rd-party-libs-bin",
|
||||||
"repo_parent":"https://github.com/cocos2d/",
|
"repo_parent":"https://github.com/cocos2d/",
|
||||||
|
|
|
@ -1165,8 +1165,12 @@
|
||||||
"cocos/ui/GUIExport.h",
|
"cocos/ui/GUIExport.h",
|
||||||
"cocos/ui/UIButton.cpp",
|
"cocos/ui/UIButton.cpp",
|
||||||
"cocos/ui/UIButton.h",
|
"cocos/ui/UIButton.h",
|
||||||
|
"cocos/ui/UIAbstractCheckButton.cpp",
|
||||||
|
"cocos/ui/UIAbstractCheckButton.h",
|
||||||
"cocos/ui/UICheckBox.cpp",
|
"cocos/ui/UICheckBox.cpp",
|
||||||
"cocos/ui/UICheckBox.h",
|
"cocos/ui/UICheckBox.h",
|
||||||
|
"cocos/ui/UIRadioButton.cpp",
|
||||||
|
"cocos/ui/UIRadioButton.h",
|
||||||
"cocos/ui/UIDeprecated.cpp",
|
"cocos/ui/UIDeprecated.cpp",
|
||||||
"cocos/ui/UIDeprecated.h",
|
"cocos/ui/UIDeprecated.h",
|
||||||
"cocos/ui/UIEditBox/UIEditBox.cpp",
|
"cocos/ui/UIEditBox/UIEditBox.cpp",
|
||||||
|
@ -3051,6 +3055,8 @@
|
||||||
"external/tiff/include/linux/tiffio.h",
|
"external/tiff/include/linux/tiffio.h",
|
||||||
"external/tiff/include/linux/tiffvers.h",
|
"external/tiff/include/linux/tiffvers.h",
|
||||||
"external/tiff/include/mac/tiff.h",
|
"external/tiff/include/mac/tiff.h",
|
||||||
|
"external/tiff/include/mac/tiffconf-32.h",
|
||||||
|
"external/tiff/include/mac/tiffconf-64.h",
|
||||||
"external/tiff/include/mac/tiffconf.h",
|
"external/tiff/include/mac/tiffconf.h",
|
||||||
"external/tiff/include/mac/tiffio.h",
|
"external/tiff/include/mac/tiffio.h",
|
||||||
"external/tiff/include/mac/tiffvers.h",
|
"external/tiff/include/mac/tiffvers.h",
|
||||||
|
|
|
@ -26,6 +26,13 @@
|
||||||
#include "jsb_cocos2dx_navmesh_auto.hpp"
|
#include "jsb_cocos2dx_navmesh_auto.hpp"
|
||||||
#include "navmesh/jsb_cocos2dx_navmesh_manual.h"
|
#include "navmesh/jsb_cocos2dx_navmesh_manual.h"
|
||||||
|
|
||||||
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
|
||||||
|
#include "jsb_cocos2dx_experimental_video_auto.hpp"
|
||||||
|
#include "experimental/jsb_cocos2dx_experimental_video_manual.h"
|
||||||
|
#include "jsb_cocos2dx_experimental_webView_auto.hpp"
|
||||||
|
#include "experimental/jsb_cocos2dx_experimental_webView_manual.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
||||||
#include "platform/android/CCJavascriptJavaBridge.h"
|
#include "platform/android/CCJavascriptJavaBridge.h"
|
||||||
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
|
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
|
||||||
|
@ -123,6 +130,13 @@ bool AppDelegate::applicationDidFinishLaunching()
|
||||||
sc->addRegisterCallback(register_all_cocos2dx_navmesh_manual);
|
sc->addRegisterCallback(register_all_cocos2dx_navmesh_manual);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
|
||||||
|
sc->addRegisterCallback(register_all_cocos2dx_experimental_video);
|
||||||
|
sc->addRegisterCallback(register_all_cocos2dx_experimental_video_manual);
|
||||||
|
sc->addRegisterCallback(register_all_cocos2dx_experimental_webView);
|
||||||
|
sc->addRegisterCallback(register_all_cocos2dx_experimental_webView_manual);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
||||||
sc->addRegisterCallback(JavascriptJavaBridge::_js_register);
|
sc->addRegisterCallback(JavascriptJavaBridge::_js_register);
|
||||||
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
|
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
|
||||||
|
|
|
@ -170,6 +170,13 @@
|
||||||
"tojs"
|
"tojs"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"from": "tools/simulator/frameworks/runtime-src/Classes",
|
||||||
|
"to": "frameworks/runtime-src/Classes",
|
||||||
|
"include": [
|
||||||
|
"js_module_register.h"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"from": "tools/simulator/frameworks/runtime-src/Classes/ide-support",
|
"from": "tools/simulator/frameworks/runtime-src/Classes/ide-support",
|
||||||
"to": "frameworks/runtime-src/Classes/ide-support",
|
"to": "frameworks/runtime-src/Classes/ide-support",
|
||||||
|
@ -196,44 +203,17 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"from": "tools/simulator/frameworks/runtime-src/proj.win32/build-cfg.json",
|
"from": "tools/simulator/frameworks/runtime-src/proj.win32/",
|
||||||
"to": "frameworks/runtime-src/proj.win32/",
|
"to": "frameworks/runtime-src/proj.win32/",
|
||||||
"exclude": []
|
"include": [
|
||||||
},
|
"build-cfg.json",
|
||||||
{
|
"game.rc",
|
||||||
"from": "templates/lua-template-default/frameworks/runtime-src/proj.win32/game.rc",
|
"main.cpp",
|
||||||
"to": "frameworks/runtime-src/proj.win32/",
|
"main.h",
|
||||||
"exclude": []
|
"res/",
|
||||||
},
|
"resource.h",
|
||||||
{
|
"SimulatorWin.*"
|
||||||
"from": "tools/simulator/frameworks/runtime-src/proj.win32/main.cpp",
|
]
|
||||||
"to": "frameworks/runtime-src/proj.win32/",
|
|
||||||
"exclude": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"from": "tools/simulator/frameworks/runtime-src/proj.win32/main.h",
|
|
||||||
"to": "frameworks/runtime-src/proj.win32/",
|
|
||||||
"exclude": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"from": "tools/simulator/frameworks/runtime-src/proj.win32/res",
|
|
||||||
"to": "frameworks/runtime-src/proj.win32/res",
|
|
||||||
"exclude": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"from": "tools/simulator/frameworks/runtime-src/proj.win32/resource.h",
|
|
||||||
"to": "frameworks/runtime-src/proj.win32/",
|
|
||||||
"exclude": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"from": "tools/simulator/frameworks/runtime-src/proj.win32/SimulatorWin.cpp",
|
|
||||||
"to": "frameworks/runtime-src/proj.win32/",
|
|
||||||
"exclude": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"from": "tools/simulator/frameworks/runtime-src/proj.win32/SimulatorWin.h",
|
|
||||||
"to": "frameworks/runtime-src/proj.win32/",
|
|
||||||
"exclude": []
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"append_x_engine":{
|
"append_x_engine":{
|
||||||
|
|
|
@ -1,80 +0,0 @@
|
||||||
#ifndef __JS_TEMPLATE_RUNTIME_FRAMEWORKS_RUNTIME_SRC_CLASSES_JS_MODULE_HELPER_H__
|
|
||||||
#define __JS_TEMPLATE_RUNTIME_FRAMEWORKS_RUNTIME_SRC_CLASSES_JS_MODULE_HELPER_H__
|
|
||||||
|
|
||||||
#include "scripting/js-bindings/manual/ScriptingCore.h"
|
|
||||||
#include "jsb_cocos2dx_auto.hpp"
|
|
||||||
#include "jsb_cocos2dx_ui_auto.hpp"
|
|
||||||
#include "jsb_cocos2dx_studio_auto.hpp"
|
|
||||||
#include "jsb_cocos2dx_builder_auto.hpp"
|
|
||||||
#include "jsb_cocos2dx_spine_auto.hpp"
|
|
||||||
#include "jsb_cocos2dx_extension_auto.hpp"
|
|
||||||
#include "ui/jsb_cocos2dx_ui_manual.h"
|
|
||||||
#include "cocostudio/jsb_cocos2dx_studio_manual.h"
|
|
||||||
#include "cocosbuilder/js_bindings_ccbreader.h"
|
|
||||||
#include "spine/jsb_cocos2dx_spine_manual.h"
|
|
||||||
#include "extension/jsb_cocos2dx_extension_manual.h"
|
|
||||||
#include "localstorage/js_bindings_system_registration.h"
|
|
||||||
#include "chipmunk/js_bindings_chipmunk_registration.h"
|
|
||||||
#include "jsb_opengl_registration.h"
|
|
||||||
#include "network/XMLHTTPRequest.h"
|
|
||||||
#include "network/jsb_websocket.h"
|
|
||||||
#include "network/jsb_socketio.h"
|
|
||||||
#include "cocos2d_specifics.hpp"
|
|
||||||
|
|
||||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
|
||||||
#include "platform/android/CCJavascriptJavaBridge.h"
|
|
||||||
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
|
|
||||||
#include "platform/ios/JavaScriptObjCBridge.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
USING_NS_CC;
|
|
||||||
int js_module_register()
|
|
||||||
{
|
|
||||||
ScriptingCore* sc = ScriptingCore::getInstance();
|
|
||||||
sc->addRegisterCallback(register_all_cocos2dx);
|
|
||||||
sc->addRegisterCallback(register_cocos2dx_js_core);
|
|
||||||
//sc->addRegisterCallback(register_cocos2dx_js_extensions);
|
|
||||||
sc->addRegisterCallback(jsb_register_system);
|
|
||||||
|
|
||||||
// extension can be commented out to reduce the package
|
|
||||||
sc->addRegisterCallback(register_all_cocos2dx_extension);
|
|
||||||
sc->addRegisterCallback(register_all_cocos2dx_extension_manual);
|
|
||||||
|
|
||||||
// chipmunk can be commented out to reduce the package
|
|
||||||
sc->addRegisterCallback(jsb_register_chipmunk);
|
|
||||||
// opengl can be commented out to reduce the package
|
|
||||||
sc->addRegisterCallback(JSB_register_opengl);
|
|
||||||
|
|
||||||
// builder can be commented out to reduce the package
|
|
||||||
sc->addRegisterCallback(register_all_cocos2dx_builder);
|
|
||||||
sc->addRegisterCallback(register_CCBuilderReader);
|
|
||||||
|
|
||||||
// ui can be commented out to reduce the package, attension studio need ui module
|
|
||||||
sc->addRegisterCallback(register_all_cocos2dx_ui);
|
|
||||||
sc->addRegisterCallback(register_all_cocos2dx_ui_manual);
|
|
||||||
|
|
||||||
// studio can be commented out to reduce the package,
|
|
||||||
sc->addRegisterCallback(register_all_cocos2dx_studio);
|
|
||||||
sc->addRegisterCallback(register_all_cocos2dx_studio_manual);
|
|
||||||
|
|
||||||
// spine can be commented out to reduce the package
|
|
||||||
sc->addRegisterCallback(register_all_cocos2dx_spine);
|
|
||||||
sc->addRegisterCallback(register_all_cocos2dx_spine_manual);
|
|
||||||
|
|
||||||
// XmlHttpRequest can be commented out to reduce the package
|
|
||||||
sc->addRegisterCallback(MinXmlHttpRequest::_js_register);
|
|
||||||
// websocket can be commented out to reduce the package
|
|
||||||
sc->addRegisterCallback(register_jsb_websocket);
|
|
||||||
// sokcet io can be commented out to reduce the package
|
|
||||||
sc->addRegisterCallback(register_jsb_socketio);
|
|
||||||
|
|
||||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
|
||||||
sc->addRegisterCallback(JavascriptJavaBridge::_js_register);
|
|
||||||
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS|| CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
|
|
||||||
sc->addRegisterCallback(JavaScriptObjCBridge::_js_register);
|
|
||||||
#endif
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // __JS_TEMPLATE_RUNTIME_FRAMEWORKS_RUNTIME_SRC_CLASSES_JS_MODULE_HELPER_H__
|
|
||||||
|
|
|
@ -169,6 +169,7 @@ set(TESTS_SRC
|
||||||
Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp
|
Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp
|
||||||
Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest.cpp
|
Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest.cpp
|
||||||
Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp
|
Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp
|
||||||
|
Classes/UITest/CocoStudioGUITest/UIRadioButtonTest/UIRadioButtonTest.cpp
|
||||||
Classes/UITest/CocoStudioGUITest/UIFocusTest/UIFocusTest.cpp
|
Classes/UITest/CocoStudioGUITest/UIFocusTest/UIFocusTest.cpp
|
||||||
Classes/UITest/CocoStudioGUITest/UIImageViewTest/UIImageViewTest.cpp
|
Classes/UITest/CocoStudioGUITest/UIImageViewTest/UIImageViewTest.cpp
|
||||||
Classes/UITest/CocoStudioGUITest/UIImageViewTest/UIImageViewTest_Editor.cpp
|
Classes/UITest/CocoStudioGUITest/UIImageViewTest/UIImageViewTest_Editor.cpp
|
||||||
|
|
|
@ -29,6 +29,7 @@ EventDispatcherTests::EventDispatcherTests()
|
||||||
ADD_TEST_CASE(Issue4160);
|
ADD_TEST_CASE(Issue4160);
|
||||||
ADD_TEST_CASE(DanglingNodePointersTest);
|
ADD_TEST_CASE(DanglingNodePointersTest);
|
||||||
ADD_TEST_CASE(RegisterAndUnregisterWhileEventHanldingTest);
|
ADD_TEST_CASE(RegisterAndUnregisterWhileEventHanldingTest);
|
||||||
|
ADD_TEST_CASE(Issue8194);
|
||||||
ADD_TEST_CASE(Issue9898)
|
ADD_TEST_CASE(Issue9898)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1370,6 +1371,76 @@ std::string RegisterAndUnregisterWhileEventHanldingTest::subtitle() const
|
||||||
return "Tap the square multiple times - should not crash!";
|
return "Tap the square multiple times - should not crash!";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://github.com/cocos2d/cocos2d-x/issues/8194
|
||||||
|
Issue8194::Issue8194()
|
||||||
|
{
|
||||||
|
auto origin = Director::getInstance()->getVisibleOrigin();
|
||||||
|
auto size = Director::getInstance()->getVisibleSize();
|
||||||
|
static bool nodesAdded = false;
|
||||||
|
#define tagA 100
|
||||||
|
#define tagB 101
|
||||||
|
// dispatch custom event in another custom event, make the custom event "Issue8194" take effect immediately
|
||||||
|
_listener = getEventDispatcher()->addCustomEventListener(Director::EVENT_AFTER_UPDATE, [this](cocos2d::EventCustom *event){
|
||||||
|
if (nodesAdded)
|
||||||
|
{
|
||||||
|
// CCLOG("Fire Issue8194 Event");
|
||||||
|
getEventDispatcher()->dispatchCustomEvent("Issue8194");
|
||||||
|
|
||||||
|
// clear test nodes and listeners
|
||||||
|
getEventDispatcher()->removeCustomEventListeners("Issue8194");
|
||||||
|
removeChildByTag(tagA);
|
||||||
|
removeChildByTag(tagB);
|
||||||
|
nodesAdded = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// When click this menuitem, it will add two node A and B, then send a custom event.
|
||||||
|
// Because Node B's localZOrder < A's, the custom event should process by node B.
|
||||||
|
auto menuItem = MenuItemFont::create("Dispatch Custom Event", [this](Ref *sender) {
|
||||||
|
// add nodeA to scene
|
||||||
|
auto nodeA = Node::create();
|
||||||
|
addChild(nodeA, 1, tagA);
|
||||||
|
|
||||||
|
cocos2d::EventListenerCustom* listenerA = cocos2d::EventListenerCustom::create("Issue8194", [&](cocos2d::EventCustom *event){
|
||||||
|
_subtitleLabel->setString("Bug has been fixed.");
|
||||||
|
event->stopPropagation();
|
||||||
|
});
|
||||||
|
getEventDispatcher()->addEventListenerWithSceneGraphPriority(listenerA, nodeA);
|
||||||
|
|
||||||
|
// add nodeB to scene
|
||||||
|
auto nodeB = Node::create();
|
||||||
|
addChild(nodeB, -1, tagB);
|
||||||
|
|
||||||
|
cocos2d::EventListenerCustom* listenerB = cocos2d::EventListenerCustom::create("Issue8194", [&](cocos2d::EventCustom *event){
|
||||||
|
_subtitleLabel->setString("Bug exist yet.");
|
||||||
|
event->stopPropagation();
|
||||||
|
});
|
||||||
|
getEventDispatcher()->addEventListenerWithSceneGraphPriority(listenerB, nodeB);
|
||||||
|
|
||||||
|
nodesAdded = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
menuItem->setPosition(origin.x + size.width/2, origin.y + size.height/2);
|
||||||
|
auto menu = Menu::create(menuItem, nullptr);
|
||||||
|
menu->setPosition(Vec2::ZERO);
|
||||||
|
addChild(menu);
|
||||||
|
}
|
||||||
|
|
||||||
|
Issue8194::~Issue8194()
|
||||||
|
{
|
||||||
|
getEventDispatcher()->removeEventListener(_listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Issue8194::title() const
|
||||||
|
{
|
||||||
|
return "Issue 8194";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Issue8194::subtitle() const
|
||||||
|
{
|
||||||
|
return "After click button, should show 'Bug has been fixed.'";
|
||||||
|
}
|
||||||
|
|
||||||
Issue9898::Issue9898()
|
Issue9898::Issue9898()
|
||||||
{
|
{
|
||||||
auto origin = Director::getInstance()->getVisibleOrigin();
|
auto origin = Director::getInstance()->getVisibleOrigin();
|
||||||
|
@ -1395,7 +1466,7 @@ Issue9898::Issue9898()
|
||||||
|
|
||||||
std::string Issue9898::title() const
|
std::string Issue9898::title() const
|
||||||
{
|
{
|
||||||
return "";
|
return "Issue 9898";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Issue9898::subtitle() const
|
std::string Issue9898::subtitle() const
|
||||||
|
|
|
@ -217,6 +217,20 @@ public:
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class Issue8194 : public EventDispatcherTestDemo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CREATE_FUNC(Issue8194);
|
||||||
|
Issue8194();
|
||||||
|
virtual ~Issue8194();
|
||||||
|
|
||||||
|
virtual std::string title() const override;
|
||||||
|
virtual std::string subtitle() const override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
cocos2d::EventListenerCustom* _listener;
|
||||||
|
};
|
||||||
|
|
||||||
class Issue9898 : public EventDispatcherTestDemo
|
class Issue9898 : public EventDispatcherTestDemo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -465,7 +465,7 @@ void RenderTextureTestDepthStencil::onBeforeClear()
|
||||||
|
|
||||||
// Since cocos2d-x v3.7, users should avoid calling GL directly because it will break the internal GL state
|
// Since cocos2d-x v3.7, users should avoid calling GL directly because it will break the internal GL state
|
||||||
// But if users must call GL directly, they should update the state manually,
|
// But if users must call GL directly, they should update the state manually,
|
||||||
RenderState::StateBlock::_defaultState->setStencilWrite(0xFF);
|
// RenderState::StateBlock::_defaultState->setStencilWrite(0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderTextureTestDepthStencil::onBeforeStencil()
|
void RenderTextureTestDepthStencil::onBeforeStencil()
|
||||||
|
@ -477,9 +477,9 @@ void RenderTextureTestDepthStencil::onBeforeStencil()
|
||||||
|
|
||||||
// Since cocos2d-x v3.7, users should avoid calling GL directly because it will break the internal GL state
|
// Since cocos2d-x v3.7, users should avoid calling GL directly because it will break the internal GL state
|
||||||
// But if users must call GL directly, they should update the state manually,
|
// But if users must call GL directly, they should update the state manually,
|
||||||
RenderState::StateBlock::_defaultState->setStencilTest(true);
|
// RenderState::StateBlock::_defaultState->setStencilTest(true);
|
||||||
RenderState::StateBlock::_defaultState->setStencilFunction(RenderState::STENCIL_NEVER, 1, 0xFF);
|
// RenderState::StateBlock::_defaultState->setStencilFunction(RenderState::STENCIL_NEVER, 1, 0xFF);
|
||||||
RenderState::StateBlock::_defaultState->setStencilOperation(RenderState::STENCIL_OP_REPLACE, RenderState::STENCIL_OP_REPLACE, RenderState::STENCIL_OP_REPLACE);
|
// RenderState::StateBlock::_defaultState->setStencilOperation(RenderState::STENCIL_OP_REPLACE, RenderState::STENCIL_OP_REPLACE, RenderState::STENCIL_OP_REPLACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderTextureTestDepthStencil::onBeforDraw()
|
void RenderTextureTestDepthStencil::onBeforDraw()
|
||||||
|
@ -488,7 +488,7 @@ void RenderTextureTestDepthStencil::onBeforDraw()
|
||||||
|
|
||||||
// Since cocos2d-x v3.7, users should avoid calling GL directly because it will break the internal GL state
|
// Since cocos2d-x v3.7, users should avoid calling GL directly because it will break the internal GL state
|
||||||
// But if users must call GL directly, they should update the state manually,
|
// But if users must call GL directly, they should update the state manually,
|
||||||
RenderState::StateBlock::_defaultState->setStencilFunction(RenderState::STENCIL_NOTEQUAL, 1, 0xFF);
|
// RenderState::StateBlock::_defaultState->setStencilFunction(RenderState::STENCIL_NOTEQUAL, 1, 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderTextureTestDepthStencil::onAfterDraw()
|
void RenderTextureTestDepthStencil::onAfterDraw()
|
||||||
|
@ -497,7 +497,7 @@ void RenderTextureTestDepthStencil::onAfterDraw()
|
||||||
|
|
||||||
// Since cocos2d-x v3.7, users should avoid calling GL directly because it will break the internal GL state
|
// Since cocos2d-x v3.7, users should avoid calling GL directly because it will break the internal GL state
|
||||||
// But if users must call GL directly, they should update the state manually,
|
// But if users must call GL directly, they should update the state manually,
|
||||||
RenderState::StateBlock::_defaultState->setStencilTest(false);
|
// RenderState::StateBlock::_defaultState->setStencilTest(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string RenderTextureTestDepthStencil::title() const
|
std::string RenderTextureTestDepthStencil::title() const
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "Scene3DTest.h"
|
#include "Scene3DTest.h"
|
||||||
|
|
||||||
#include "ui/CocosGUI.h"
|
#include "ui/CocosGUI.h"
|
||||||
|
#include "renderer/CCRenderState.h"
|
||||||
#include <spine/spine-cocos2dx.h>
|
#include <spine/spine-cocos2dx.h>
|
||||||
|
|
||||||
#include "../testResource.h"
|
#include "../testResource.h"
|
||||||
|
@ -9,6 +10,28 @@
|
||||||
USING_NS_CC;
|
USING_NS_CC;
|
||||||
using namespace spine;
|
using namespace spine;
|
||||||
|
|
||||||
|
class SkeletonAnimationCullingFix : public SkeletonAnimation
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SkeletonAnimationCullingFix(const std::string& skeletonDataFile, const std::string& atlasFile, float scale)
|
||||||
|
: SkeletonAnimation(skeletonDataFile, atlasFile, scale)
|
||||||
|
{}
|
||||||
|
|
||||||
|
virtual void drawSkeleton (const cocos2d::Mat4& transform, uint32_t transformFlags) override
|
||||||
|
{
|
||||||
|
glDisable(GL_CULL_FACE);
|
||||||
|
SkeletonAnimation::drawSkeleton(transform, transformFlags);
|
||||||
|
RenderState::StateBlock::invalidate(cocos2d::RenderState::StateBlock::RS_ALL_ONES);
|
||||||
|
}
|
||||||
|
|
||||||
|
static SkeletonAnimationCullingFix* createWithFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale = 1)
|
||||||
|
{
|
||||||
|
SkeletonAnimationCullingFix* node = new SkeletonAnimationCullingFix(skeletonDataFile, atlasFile, scale);
|
||||||
|
node->autorelease();
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Declare Scene3DTestScene
|
// Declare Scene3DTestScene
|
||||||
|
|
||||||
|
@ -631,7 +654,7 @@ void Scene3DTestScene::createDetailDlg()
|
||||||
|
|
||||||
// add a spine ffd animation on it
|
// add a spine ffd animation on it
|
||||||
auto skeletonNode =
|
auto skeletonNode =
|
||||||
SkeletonAnimation::createWithFile("spine/goblins-ffd.json",
|
SkeletonAnimationCullingFix::createWithFile("spine/goblins-ffd.json",
|
||||||
"spine/goblins-ffd.atlas",
|
"spine/goblins-ffd.atlas",
|
||||||
1.5f);
|
1.5f);
|
||||||
skeletonNode->setAnimation(0, "walk", true);
|
skeletonNode->setAnimation(0, "walk", true);
|
||||||
|
|
|
@ -56,6 +56,7 @@ Sprite3DTests::Sprite3DTests()
|
||||||
ADD_TEST_CASE(Sprite3DCubeMapTest);
|
ADD_TEST_CASE(Sprite3DCubeMapTest);
|
||||||
ADD_TEST_CASE(NodeAnimationTest);
|
ADD_TEST_CASE(NodeAnimationTest);
|
||||||
ADD_TEST_CASE(Issue9767);
|
ADD_TEST_CASE(Issue9767);
|
||||||
|
ADD_TEST_CASE(Sprite3DClippingTest);
|
||||||
};
|
};
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
@ -2570,3 +2571,41 @@ std::string Issue9767::subtitle() const
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Sprite3DClippingTest::Sprite3DClippingTest()
|
||||||
|
{
|
||||||
|
auto size = Director::getInstance()->getWinSize();
|
||||||
|
auto stencil = Sprite::create("Images/close.png");
|
||||||
|
auto clipSprite3D = ClippingNode::create();
|
||||||
|
clipSprite3D->setStencil(stencil);
|
||||||
|
this->addChild(clipSprite3D);
|
||||||
|
clipSprite3D->setScale(3.0f);
|
||||||
|
|
||||||
|
auto sprite3D = Sprite3D::create("Sprite3DTest/orc.c3b");
|
||||||
|
sprite3D->setScale(1.0f);
|
||||||
|
sprite3D->setRotation3D(Vec3(0.0f, 180.0f, 0.0f));
|
||||||
|
clipSprite3D->addChild(sprite3D);//5
|
||||||
|
|
||||||
|
clipSprite3D->setPosition(Vec2(size.width / 2, size.height / 2));
|
||||||
|
|
||||||
|
auto seq = Sequence::create(ScaleTo::create(2.f, 3), ScaleTo::create(2.f, 0.5f), NULL);
|
||||||
|
sprite3D->runAction(RepeatForever::create(seq));
|
||||||
|
auto animation = Animation3D::create("Sprite3DTest/orc.c3b");
|
||||||
|
auto animate = Animate3D::create(animation);
|
||||||
|
sprite3D->runAction(RepeatForever::create(animate));
|
||||||
|
sprite3D->setForce2DQueue(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
Sprite3DClippingTest::~Sprite3DClippingTest()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Sprite3DClippingTest::title() const
|
||||||
|
{
|
||||||
|
return "Sprite3D Clipping Test";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Sprite3DClippingTest::subtitle() const
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
|
@ -554,4 +554,15 @@ protected:
|
||||||
cocos2d::Sprite3D* _sprite;
|
cocos2d::Sprite3D* _sprite;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// Clipping Sprite3D
|
||||||
|
class Sprite3DClippingTest : public Sprite3DTestDemo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CREATE_FUNC(Sprite3DClippingTest);
|
||||||
|
Sprite3DClippingTest();
|
||||||
|
~Sprite3DClippingTest();
|
||||||
|
virtual std::string title() const override;
|
||||||
|
virtual std::string subtitle() const override;
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include "UIButtonTest/UIButtonTest.h"
|
#include "UIButtonTest/UIButtonTest.h"
|
||||||
#include "UICheckBoxTest/UICheckBoxTest.h"
|
#include "UICheckBoxTest/UICheckBoxTest.h"
|
||||||
|
#include "UIRadioButtonTest/UIRadioButtonTest.h"
|
||||||
#include "UISliderTest/UISliderTest.h"
|
#include "UISliderTest/UISliderTest.h"
|
||||||
#include "UIImageViewTest/UIImageViewTest.h"
|
#include "UIImageViewTest/UIImageViewTest.h"
|
||||||
#include "UILoadingBarTest/UILoadingBarTest.h"
|
#include "UILoadingBarTest/UILoadingBarTest.h"
|
||||||
|
@ -42,6 +43,7 @@ GUIDynamicCreateTests::GUIDynamicCreateTests()
|
||||||
addTest("Scale9Sprite Test", [](){ return new (std::nothrow) UIScale9SpriteTests; });
|
addTest("Scale9Sprite Test", [](){ return new (std::nothrow) UIScale9SpriteTests; });
|
||||||
addTest("Button Test", [](){ return new (std::nothrow) UIButtonTests; });
|
addTest("Button Test", [](){ return new (std::nothrow) UIButtonTests; });
|
||||||
addTest("CheckBox Test", [](){ return new (std::nothrow) UICheckBoxTests; });
|
addTest("CheckBox Test", [](){ return new (std::nothrow) UICheckBoxTests; });
|
||||||
|
addTest("RadioButton Test", [](){ return new (std::nothrow) UIRadioButtonTests; });
|
||||||
addTest("Slider Test", [](){ return new (std::nothrow) UISliderTests; });
|
addTest("Slider Test", [](){ return new (std::nothrow) UISliderTests; });
|
||||||
|
|
||||||
addTest("ImageView Test", [](){ return new (std::nothrow) UIImageViewTests; });
|
addTest("ImageView Test", [](){ return new (std::nothrow) UIImageViewTests; });
|
||||||
|
|
|
@ -0,0 +1,334 @@
|
||||||
|
#include "UIRadioButtonTest.h"
|
||||||
|
|
||||||
|
USING_NS_CC;
|
||||||
|
using namespace cocos2d::ui;
|
||||||
|
|
||||||
|
UIRadioButtonTests::UIRadioButtonTests()
|
||||||
|
{
|
||||||
|
ADD_TEST_CASE(UIRadioButtonTest);
|
||||||
|
ADD_TEST_CASE(UIRadioButtonTwoGroupsTest);
|
||||||
|
ADD_TEST_CASE(UIRadioButtonTabTest);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// UIRadioButtonTest
|
||||||
|
UIRadioButtonTest::UIRadioButtonTest() :
|
||||||
|
_radioButtonGroup(nullptr),
|
||||||
|
_allowNoSelectionText(nullptr)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
UIRadioButtonTest::~UIRadioButtonTest()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static const float BUTTON_WIDTH = 30;
|
||||||
|
static float startPosX = 0;
|
||||||
|
|
||||||
|
bool UIRadioButtonTest::init()
|
||||||
|
{
|
||||||
|
if (UIScene::init())
|
||||||
|
{
|
||||||
|
Size widgetSize = _widget->getContentSize();
|
||||||
|
|
||||||
|
// Create a radio button group
|
||||||
|
_radioButtonGroup = RadioButtonGroup::create();
|
||||||
|
_uiLayer->addChild(_radioButtonGroup);
|
||||||
|
|
||||||
|
// Create the radio buttons
|
||||||
|
static const int NUMBER_OF_BUTTONS = 5;
|
||||||
|
startPosX = widgetSize.width / 2.0f - ((NUMBER_OF_BUTTONS - 1) / 2.0f) * BUTTON_WIDTH;
|
||||||
|
for(int i = 0; i < NUMBER_OF_BUTTONS; ++i)
|
||||||
|
{
|
||||||
|
RadioButton* radioButton = RadioButton::create("cocosui/radio_button_off.png", "cocosui/radio_button_on.png");
|
||||||
|
float posX = startPosX + BUTTON_WIDTH * i;
|
||||||
|
radioButton->setPosition(Vec2(posX, widgetSize.height / 2.0f + 10));
|
||||||
|
radioButton->setScale(1.2f);
|
||||||
|
_radioButtonGroup->addRadioButton(radioButton);
|
||||||
|
_uiLayer->addChild(radioButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add button
|
||||||
|
Button* addButton = Button::create("cocosui/backtotopnormal.png", "cocosui/backtotoppressed.png");
|
||||||
|
addButton->setTitleText("Add");
|
||||||
|
addButton->setPosition(Vec2(widgetSize.width / 2.0f - 100, widgetSize.height / 2.0f - 65));
|
||||||
|
addButton->addClickEventListener(CC_CALLBACK_1(UIRadioButtonTest::addRadioButton, this));
|
||||||
|
addButton->setScale(0.7f);
|
||||||
|
_uiLayer->addChild(addButton);
|
||||||
|
|
||||||
|
// Delete button
|
||||||
|
Button* deleteButton = Button::create("cocosui/backtotopnormal.png", "cocosui/backtotoppressed.png");
|
||||||
|
deleteButton->setTitleText("Delete");
|
||||||
|
deleteButton->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f - 65));
|
||||||
|
deleteButton->addClickEventListener(CC_CALLBACK_1(UIRadioButtonTest::deleteRadioButton, this));
|
||||||
|
deleteButton->setScale(0.7f);
|
||||||
|
_uiLayer->addChild(deleteButton);
|
||||||
|
|
||||||
|
// Toggle button
|
||||||
|
Button* allowNoSelectionToggle = Button::create("cocosui/backtotopnormal.png", "cocosui/backtotoppressed.png");
|
||||||
|
allowNoSelectionToggle->setTitleText("Toggle Allow-No-Selection");
|
||||||
|
allowNoSelectionToggle->setPosition(Vec2(widgetSize.width / 2.0f + 100, widgetSize.height / 2.0f - 65));
|
||||||
|
allowNoSelectionToggle->addClickEventListener([this](Ref*) {
|
||||||
|
_radioButtonGroup->setAllowedNoSelection(!_radioButtonGroup->isAllowedNoSelection());
|
||||||
|
_allowNoSelectionText->setString(_radioButtonGroup->isAllowedNoSelection() ? "No selection is allowed." : "No selection is disallowed.");
|
||||||
|
});
|
||||||
|
allowNoSelectionToggle->setScale(0.7f);
|
||||||
|
_uiLayer->addChild(allowNoSelectionToggle);
|
||||||
|
|
||||||
|
// Add a label for toggle
|
||||||
|
_allowNoSelectionText = Text::create("No selection is disallowed.", "fonts/Marker Felt.ttf", 20);
|
||||||
|
_allowNoSelectionText->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f + 70));
|
||||||
|
_uiLayer->addChild(_allowNoSelectionText);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void UIRadioButtonTest::addRadioButton(Ref* sender)
|
||||||
|
{
|
||||||
|
Vec2 pos;
|
||||||
|
if(_radioButtonGroup->getNumberOfRadioButtons() > 0)
|
||||||
|
{
|
||||||
|
RadioButton* lastRadioButton = _radioButtonGroup->getRadioButtonByIndex((int)_radioButtonGroup->getNumberOfRadioButtons() - 1);
|
||||||
|
pos = lastRadioButton->getPosition();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pos.x = startPosX - BUTTON_WIDTH;
|
||||||
|
pos.y = _widget->getContentSize().height / 2.0f + 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
RadioButton* radioButton = RadioButton::create("cocosui/radio_button_off.png", "cocosui/radio_button_on.png");
|
||||||
|
pos.x += + BUTTON_WIDTH;
|
||||||
|
radioButton->setPosition(pos);
|
||||||
|
_radioButtonGroup->addRadioButton(radioButton);
|
||||||
|
_uiLayer->addChild(radioButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UIRadioButtonTest::deleteRadioButton(Ref* sender)
|
||||||
|
{
|
||||||
|
if(_radioButtonGroup->getNumberOfRadioButtons() > 0)
|
||||||
|
{
|
||||||
|
RadioButton* radioButton = _radioButtonGroup->getRadioButtonByIndex((int)_radioButtonGroup->getNumberOfRadioButtons() - 1);
|
||||||
|
_radioButtonGroup->removeRadioButton(radioButton);
|
||||||
|
_uiLayer->removeChild(radioButton);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// UIRadioButtonTwoGroupsTest
|
||||||
|
UIRadioButtonTwoGroupsTest::UIRadioButtonTwoGroupsTest()
|
||||||
|
: _groupEventLabel(nullptr),
|
||||||
|
_buttonEventLabel(nullptr),
|
||||||
|
_logConsole(nullptr),
|
||||||
|
_numberOfLogLines(0)
|
||||||
|
{
|
||||||
|
_radioButtonGroups[0] = nullptr;
|
||||||
|
_radioButtonGroups[1] = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
UIRadioButtonTwoGroupsTest::~UIRadioButtonTwoGroupsTest()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UIRadioButtonTwoGroupsTest::init()
|
||||||
|
{
|
||||||
|
if (UIScene::init())
|
||||||
|
{
|
||||||
|
Size widgetSize = _widget->getContentSize();;
|
||||||
|
|
||||||
|
// Add a label in which the radio button events will be displayed
|
||||||
|
_groupEventLabel = Text::create("RadioButtonGroup : No Event", "fonts/Marker Felt.ttf", 25);
|
||||||
|
_groupEventLabel->setAnchorPoint(Vec2(0.5f, -1));
|
||||||
|
_groupEventLabel->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f + 70));
|
||||||
|
_uiLayer->addChild(_groupEventLabel);
|
||||||
|
|
||||||
|
_buttonEventLabel = Text::create("RadioButton : No Event", "fonts/Marker Felt.ttf", 25);
|
||||||
|
_buttonEventLabel->setAnchorPoint(Vec2(0.5f, -1));
|
||||||
|
_buttonEventLabel->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f + 35));
|
||||||
|
_uiLayer->addChild(_buttonEventLabel);
|
||||||
|
|
||||||
|
_logConsole = Text::create("", "fonts/Marker Felt.ttf", 10);
|
||||||
|
_logConsole->setAnchorPoint(Vec2(0, 1));
|
||||||
|
_logConsole->setPosition(Vec2(widgetSize.width / 2.0f + 110, widgetSize.height / 2.0f + 55));
|
||||||
|
_uiLayer->addChild(_logConsole);
|
||||||
|
|
||||||
|
static const int NUMBER_OF_BUTTONS = 4;
|
||||||
|
static const float SPACE_BETWEEN_BUTTONS = 50;
|
||||||
|
float startPosX = widgetSize.width / 2.0f - ((NUMBER_OF_BUTTONS - 1) / 2.0f) * SPACE_BETWEEN_BUTTONS;
|
||||||
|
|
||||||
|
for(int type = 0; type < 2; ++type)
|
||||||
|
{
|
||||||
|
// Create a radio button group
|
||||||
|
const char *normalImage, *selectedImage;
|
||||||
|
float posYAdjust = 0;
|
||||||
|
_radioButtonGroups[type] = RadioButtonGroup::create();
|
||||||
|
if(type == 0)
|
||||||
|
{
|
||||||
|
_radioButtonGroups[type]->addEventListener(CC_CALLBACK_3(UIRadioButtonTwoGroupsTest::onChangedRadioButtonGroup1, this));
|
||||||
|
normalImage = "cocosui/radio_button_off.png";
|
||||||
|
selectedImage = "cocosui/radio_button_on.png";
|
||||||
|
posYAdjust = 35;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_radioButtonGroups[type]->addEventListener(CC_CALLBACK_3(UIRadioButtonTwoGroupsTest::onChangedRadioButtonGroup2, this));
|
||||||
|
normalImage = "cocosui/UIEditorTest/2.1/Button/button_common_box03_003 copy 221.png";
|
||||||
|
selectedImage = "cocosui/UIEditorTest/2.1/Button/button_common_box03_001.png";
|
||||||
|
posYAdjust = -15;
|
||||||
|
}
|
||||||
|
_uiLayer->addChild(_radioButtonGroups[type]);
|
||||||
|
|
||||||
|
// Set allowing no selections
|
||||||
|
_radioButtonGroups[type]->setAllowedNoSelection(type == 0);
|
||||||
|
|
||||||
|
// Create the radio buttons
|
||||||
|
for(int i = 0; i < NUMBER_OF_BUTTONS; ++i)
|
||||||
|
{
|
||||||
|
RadioButton* radioButton = nullptr;
|
||||||
|
float posY = widgetSize.height / 2.0f + posYAdjust;
|
||||||
|
radioButton = RadioButton::create(normalImage, selectedImage);
|
||||||
|
float posX = startPosX + SPACE_BETWEEN_BUTTONS * i;
|
||||||
|
radioButton->setScale(1.5f);
|
||||||
|
radioButton->setPosition(Vec2(posX, posY));
|
||||||
|
|
||||||
|
radioButton->addEventListener(CC_CALLBACK_2(UIRadioButtonTwoGroupsTest::onChangedRadioButtonSelect, this));
|
||||||
|
radioButton->setTag(i);
|
||||||
|
_uiLayer->addChild(radioButton);
|
||||||
|
_radioButtonGroups[type]->addRadioButton(radioButton);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Button* clearButton = Button::create("cocosui/backtotopnormal.png", "cocosui/backtotoppressed.png");
|
||||||
|
clearButton->setTitleText("Clear");
|
||||||
|
clearButton->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f - 65));
|
||||||
|
clearButton->addClickEventListener(CC_CALLBACK_1(UIRadioButtonTwoGroupsTest::clearRadioButtonGroup, this));
|
||||||
|
clearButton->setScale(0.8f);
|
||||||
|
_uiLayer->addChild(clearButton);
|
||||||
|
|
||||||
|
Text* text1 = Text::create("Upper radio button group is allowed non-selection, but lower one is not.", "fonts/Marker Felt.ttf", 15);
|
||||||
|
text1->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f - 100));
|
||||||
|
_uiLayer->addChild(text1);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void UIRadioButtonTwoGroupsTest::onChangedRadioButtonGroup1(RadioButton* radioButton, int index, cocos2d::ui::RadioButtonGroup::EventType type)
|
||||||
|
{
|
||||||
|
CCASSERT(index == _radioButtonGroups[0]->getSelectedButtonIndex(), "The two indexes must match!");
|
||||||
|
__String* text = String::createWithFormat("RadioButtonGroup1 : %d", index);
|
||||||
|
_groupEventLabel->setString(text->getCString());
|
||||||
|
addLog(text->getCString());
|
||||||
|
}
|
||||||
|
|
||||||
|
void UIRadioButtonTwoGroupsTest::onChangedRadioButtonGroup2(RadioButton* radioButton, int index, cocos2d::ui::RadioButtonGroup::EventType type)
|
||||||
|
{
|
||||||
|
CCASSERT(index == _radioButtonGroups[1]->getSelectedButtonIndex(), "The two indexes must match!");
|
||||||
|
__String* text = String::createWithFormat("RadioButtonGroup2 : %d", index);
|
||||||
|
_groupEventLabel->setString(text->getCString());
|
||||||
|
addLog(text->getCString());
|
||||||
|
}
|
||||||
|
|
||||||
|
void UIRadioButtonTwoGroupsTest::onChangedRadioButtonSelect(RadioButton* radioButton, RadioButton::EventType type)
|
||||||
|
{
|
||||||
|
if(radioButton == nullptr)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
__String* text = String::createWithFormat("RadioButton %d : ", radioButton->getTag());
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case RadioButton::EventType::SELECTED:
|
||||||
|
{
|
||||||
|
text->append("Selected");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case RadioButton::EventType::UNSELECTED:
|
||||||
|
{
|
||||||
|
text->append("Unselected");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
_buttonEventLabel->setString(text->getCString());
|
||||||
|
addLog(text->getCString());
|
||||||
|
}
|
||||||
|
|
||||||
|
void UIRadioButtonTwoGroupsTest::clearRadioButtonGroup(Ref* sender)
|
||||||
|
{
|
||||||
|
for(int i = 0; i < 2; ++i)
|
||||||
|
{
|
||||||
|
_radioButtonGroups[i]->setSelectedButton(nullptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void UIRadioButtonTwoGroupsTest::addLog(const std::string& log)
|
||||||
|
{
|
||||||
|
std::string existingLog = _logConsole->getString();
|
||||||
|
if(!existingLog.empty())
|
||||||
|
{
|
||||||
|
existingLog = existingLog + "\n";
|
||||||
|
}
|
||||||
|
existingLog = existingLog + log;
|
||||||
|
++_numberOfLogLines;
|
||||||
|
|
||||||
|
if(_numberOfLogLines > 10)
|
||||||
|
{
|
||||||
|
size_t pos = existingLog.find("\n") + 1;
|
||||||
|
std::string newLog = existingLog.substr(pos);
|
||||||
|
existingLog = newLog;
|
||||||
|
--_numberOfLogLines;
|
||||||
|
}
|
||||||
|
|
||||||
|
_logConsole->setString(existingLog);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// UIRadioButtonTabTest
|
||||||
|
bool UIRadioButtonTabTest::init()
|
||||||
|
{
|
||||||
|
if (UIScene::init())
|
||||||
|
{
|
||||||
|
Size widgetSize = _widget->getContentSize();;
|
||||||
|
|
||||||
|
static const float BUTTON_SCALE = 0.5f;
|
||||||
|
const float buttonWidth = 350 * BUTTON_SCALE / Director::getInstance()->getContentScaleFactor();
|
||||||
|
|
||||||
|
// Background for buttons
|
||||||
|
LayerColor* colorLayer = LayerColor::create(Color4B::WHITE);
|
||||||
|
colorLayer->ignoreAnchorPointForPosition(false);
|
||||||
|
colorLayer->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
|
||||||
|
colorLayer->setContentSize(Size(buttonWidth * 3, 170 / Director::getInstance()->getContentScaleFactor()));
|
||||||
|
colorLayer->setPosition(widgetSize / 2.0f);
|
||||||
|
_uiLayer->addChild(colorLayer);
|
||||||
|
|
||||||
|
// Create a radio button group
|
||||||
|
RadioButtonGroup* radioButtonGroup = RadioButtonGroup::create();
|
||||||
|
_uiLayer->addChild(radioButtonGroup);
|
||||||
|
|
||||||
|
// Create the radio buttons
|
||||||
|
static const int NUMBER_OF_BUTTONS = 3;
|
||||||
|
float startPosX = widgetSize.width / 2.0f - ((NUMBER_OF_BUTTONS - 1) / 2.0f) * buttonWidth;
|
||||||
|
for(int i = 0; i < NUMBER_OF_BUTTONS; ++i)
|
||||||
|
{
|
||||||
|
__String* filePathNormal = String::createWithFormat("cocosui/btn_exercise%02d_n.png", i + 1);
|
||||||
|
__String* filePathSelected = String::createWithFormat("cocosui/btn_exercise%02d_p.png", i + 1);
|
||||||
|
RadioButton* radioButton = RadioButton::create(filePathNormal->getCString(), filePathSelected->getCString());
|
||||||
|
float posX = startPosX + buttonWidth * i;
|
||||||
|
radioButton->setPosition(Vec2(posX, widgetSize.height / 2.0f));
|
||||||
|
radioButton->setScale(BUTTON_SCALE);
|
||||||
|
radioButton->setZoomScale(0.05f);
|
||||||
|
radioButtonGroup->addRadioButton(radioButton);
|
||||||
|
_uiLayer->addChild(radioButton);
|
||||||
|
}
|
||||||
|
radioButtonGroup->setSelectedButton(0);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
|
@ -0,0 +1,84 @@
|
||||||
|
/****************************************************************************
|
||||||
|
Copyright (c) 2015 cocos2d-x.org
|
||||||
|
|
||||||
|
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 __TestCpp__UIRadioButtonTest__
|
||||||
|
#define __TestCpp__UIRadioButtonTest__
|
||||||
|
|
||||||
|
#include "../UIScene.h"
|
||||||
|
|
||||||
|
DEFINE_TEST_SUITE(UIRadioButtonTests);
|
||||||
|
|
||||||
|
class UIRadioButtonTest : public UIScene
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CREATE_FUNC(UIRadioButtonTest);
|
||||||
|
|
||||||
|
UIRadioButtonTest();
|
||||||
|
~UIRadioButtonTest();
|
||||||
|
|
||||||
|
virtual bool init() override;
|
||||||
|
|
||||||
|
void addRadioButton(Ref* sender);
|
||||||
|
void deleteRadioButton(Ref* sender);
|
||||||
|
|
||||||
|
private:
|
||||||
|
cocos2d::ui::RadioButtonGroup* _radioButtonGroup;
|
||||||
|
cocos2d::ui::Text* _allowNoSelectionText;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class UIRadioButtonTwoGroupsTest : public UIScene
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CREATE_FUNC(UIRadioButtonTwoGroupsTest);
|
||||||
|
|
||||||
|
UIRadioButtonTwoGroupsTest();
|
||||||
|
~UIRadioButtonTwoGroupsTest();
|
||||||
|
|
||||||
|
virtual bool init() override;
|
||||||
|
void onChangedRadioButtonGroup1(cocos2d::ui::RadioButton* radioButton, int index, cocos2d::ui::RadioButtonGroup::EventType type);
|
||||||
|
void onChangedRadioButtonGroup2(cocos2d::ui::RadioButton* radioButton, int index, cocos2d::ui::RadioButtonGroup::EventType type);
|
||||||
|
void onChangedRadioButtonSelect(cocos2d::ui::RadioButton* radioButton,cocos2d::ui::RadioButton::EventType type);
|
||||||
|
void clearRadioButtonGroup(Ref* sender);
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void addLog(const std::string& log);
|
||||||
|
|
||||||
|
cocos2d::ui::RadioButtonGroup* _radioButtonGroups[2];
|
||||||
|
cocos2d::ui::Text* _groupEventLabel;
|
||||||
|
cocos2d::ui::Text* _buttonEventLabel;
|
||||||
|
cocos2d::ui::Text* _logConsole;
|
||||||
|
int _numberOfLogLines;
|
||||||
|
};
|
||||||
|
|
||||||
|
class UIRadioButtonTabTest : public UIScene
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CREATE_FUNC(UIRadioButtonTabTest);
|
||||||
|
virtual bool init() override;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* defined(__TestCpp__UIRadioButtonTest__) */
|
|
@ -1 +1 @@
|
||||||
Subproject commit dc719c167623d343cd5fdaaba867e9e1a26a24d3
|
Subproject commit 37b53805dedbfb1df8549a3e2417df5c47c134ff
|
|
@ -161,6 +161,7 @@ LOCAL_SRC_FILES := main.cpp \
|
||||||
../../../Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp \
|
../../../Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp \
|
||||||
../../../Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest.cpp \
|
../../../Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest.cpp \
|
||||||
../../../Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp \
|
../../../Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp \
|
||||||
|
../../../Classes/UITest/CocoStudioGUITest/UIRadioButtonTest/UIRadioButtonTest.cpp \
|
||||||
../../../Classes/UITest/CocoStudioGUITest/UIEditBoxTest.cpp \
|
../../../Classes/UITest/CocoStudioGUITest/UIEditBoxTest.cpp \
|
||||||
../../../Classes/UITest/CocoStudioGUITest/UIFocusTest/UIFocusTest.cpp \
|
../../../Classes/UITest/CocoStudioGUITest/UIFocusTest/UIFocusTest.cpp \
|
||||||
../../../Classes/UITest/CocoStudioGUITest/UIImageViewTest/UIImageViewTest.cpp \
|
../../../Classes/UITest/CocoStudioGUITest/UIImageViewTest/UIImageViewTest.cpp \
|
||||||
|
|
|
@ -162,6 +162,7 @@ LOCAL_SRC_FILES := main.cpp \
|
||||||
../../Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp \
|
../../Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp \
|
||||||
../../Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest.cpp \
|
../../Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest.cpp \
|
||||||
../../Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp \
|
../../Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp \
|
||||||
|
../../Classes/UITest/CocoStudioGUITest/UIRadioButtonTest/UIRadioButtonTest.cpp \
|
||||||
../../Classes/UITest/CocoStudioGUITest/UIEditBoxTest.cpp \
|
../../Classes/UITest/CocoStudioGUITest/UIEditBoxTest.cpp \
|
||||||
../../Classes/UITest/CocoStudioGUITest/UIFocusTest/UIFocusTest.cpp \
|
../../Classes/UITest/CocoStudioGUITest/UIFocusTest/UIFocusTest.cpp \
|
||||||
../../Classes/UITest/CocoStudioGUITest/UIImageViewTest/UIImageViewTest.cpp \
|
../../Classes/UITest/CocoStudioGUITest/UIImageViewTest/UIImageViewTest.cpp \
|
||||||
|
|
|
@ -689,6 +689,7 @@
|
||||||
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UIButtonTest\UIButtonTest_Editor.cpp" />
|
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UIButtonTest\UIButtonTest_Editor.cpp" />
|
||||||
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UICheckBoxTest\UICheckBoxTest.cpp" />
|
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UICheckBoxTest\UICheckBoxTest.cpp" />
|
||||||
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UICheckBoxTest\UICheckBoxTest_Editor.cpp" />
|
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UICheckBoxTest\UICheckBoxTest_Editor.cpp" />
|
||||||
|
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UIRadioButtonTest\UIRadioButtonTest.cpp" />
|
||||||
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UIEditBoxTest.cpp" />
|
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UIEditBoxTest.cpp" />
|
||||||
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UIFocusTest\UIFocusTest.cpp" />
|
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UIFocusTest\UIFocusTest.cpp" />
|
||||||
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UIImageViewTest\UIImageViewTest.cpp" />
|
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UIImageViewTest\UIImageViewTest.cpp" />
|
||||||
|
|
|
@ -869,6 +869,9 @@
|
||||||
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UICheckBoxTest\UICheckBoxTest_Editor.cpp">
|
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UICheckBoxTest\UICheckBoxTest_Editor.cpp">
|
||||||
<Filter>Classes\UITest\CocoStudioGUITest\UICheckBoxTest</Filter>
|
<Filter>Classes\UITest\CocoStudioGUITest\UICheckBoxTest</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UIRadioButtonTest\UIRadioButtonTest.cpp">
|
||||||
|
<Filter>Classes\UITest\CocoStudioGUITest\UIRadioButtonTest</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UIFocusTest\UIFocusTest.cpp">
|
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UIFocusTest\UIFocusTest.cpp">
|
||||||
<Filter>Classes\UITest\CocoStudioGUITest\UIFocusTest</Filter>
|
<Filter>Classes\UITest\CocoStudioGUITest\UIFocusTest</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|
|
@ -230,6 +230,7 @@ xcopy "$(OutDir)..\*.dll" "$(OutDir)" /D /Y</Command>
|
||||||
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UIButtonTest\UIButtonTest_Editor.cpp" />
|
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UIButtonTest\UIButtonTest_Editor.cpp" />
|
||||||
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UICheckBoxTest\UICheckBoxTest.cpp" />
|
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UICheckBoxTest\UICheckBoxTest.cpp" />
|
||||||
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UICheckBoxTest\UICheckBoxTest_Editor.cpp" />
|
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UICheckBoxTest\UICheckBoxTest_Editor.cpp" />
|
||||||
|
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UIRadioButtonTest\UIRadioButtonTest.cpp" />
|
||||||
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UIEditBoxTest.cpp" />
|
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UIEditBoxTest.cpp" />
|
||||||
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UIFocusTest\UIFocusTest.cpp" />
|
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UIFocusTest\UIFocusTest.cpp" />
|
||||||
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UIImageViewTest\UIImageViewTest.cpp" />
|
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UIImageViewTest\UIImageViewTest.cpp" />
|
||||||
|
|
|
@ -792,6 +792,9 @@
|
||||||
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UICheckBoxTest\UICheckBoxTest_Editor.cpp">
|
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UICheckBoxTest\UICheckBoxTest_Editor.cpp">
|
||||||
<Filter>Classes\UITest\CocostudioGUISceneTest\UICheckBoxTest</Filter>
|
<Filter>Classes\UITest\CocostudioGUISceneTest\UICheckBoxTest</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UIRadioButtonTest\UIRadioButtonTest.cpp">
|
||||||
|
<Filter>Classes\UITest\CocostudioGUISceneTest\UIRadioButtonTest</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UIFocusTest\UIFocusTest.cpp">
|
<ClCompile Include="..\Classes\UITest\CocoStudioGUITest\UIFocusTest\UIFocusTest.cpp">
|
||||||
<Filter>Classes\UITest\CocostudioGUISceneTest\UIFocusTest</Filter>
|
<Filter>Classes\UITest\CocostudioGUISceneTest\UIFocusTest</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|
|
@ -182,6 +182,7 @@
|
||||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\UITest\CocoStudioGUITest\UIButtonTest\UIButtonTest_Editor.cpp" />
|
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\UITest\CocoStudioGUITest\UIButtonTest\UIButtonTest_Editor.cpp" />
|
||||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\UITest\CocoStudioGUITest\UICheckBoxTest\UICheckBoxTest.cpp" />
|
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\UITest\CocoStudioGUITest\UICheckBoxTest\UICheckBoxTest.cpp" />
|
||||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\UITest\CocoStudioGUITest\UICheckBoxTest\UICheckBoxTest_Editor.cpp" />
|
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\UITest\CocoStudioGUITest\UICheckBoxTest\UICheckBoxTest_Editor.cpp" />
|
||||||
|
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\UITest\CocoStudioGUITest\UIRadioButtonTest\UIRadioButtonTest.cpp" />
|
||||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\UITest\CocoStudioGUITest\UIEditBoxTest.cpp" />
|
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\UITest\CocoStudioGUITest\UIEditBoxTest.cpp" />
|
||||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\UITest\CocoStudioGUITest\UIFocusTest\UIFocusTest.cpp" />
|
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\UITest\CocoStudioGUITest\UIFocusTest\UIFocusTest.cpp" />
|
||||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\UITest\CocoStudioGUITest\UIImageViewTest\UIImageViewTest.cpp" />
|
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\UITest\CocoStudioGUITest\UIImageViewTest\UIImageViewTest.cpp" />
|
||||||
|
|
|
@ -1260,6 +1260,9 @@
|
||||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\UITest\CocoStudioGUITest\UICheckBoxTest\UICheckBoxTest_Editor.cpp">
|
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\UITest\CocoStudioGUITest\UICheckBoxTest\UICheckBoxTest_Editor.cpp">
|
||||||
<Filter>Classes\UITest\CocostudioGUISceneTest\UICheckBoxTest</Filter>
|
<Filter>Classes\UITest\CocostudioGUISceneTest\UICheckBoxTest</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\UITest\CocoStudioGUITest\UIRadioButtonTest\UIRadioButtonTest.cpp">
|
||||||
|
<Filter>Classes\UITest\CocostudioGUISceneTest\UIRadioButtonTest</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\UITest\CocoStudioGUITest\UIFocusTest\UIFocusTest.cpp">
|
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\Classes\UITest\CocoStudioGUITest\UIFocusTest\UIFocusTest.cpp">
|
||||||
<Filter>Classes\UITest\CocostudioGUISceneTest\UIFocusTest</Filter>
|
<Filter>Classes\UITest\CocostudioGUISceneTest\UIFocusTest</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|
|
@ -76,5 +76,34 @@ public class AppActivity extends Cocos2dxActivity {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
public static void showAlertDialog(final String title, final String message, final boolean logicSwitch) {
|
||||||
|
app.runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
AlertDialog alertDialog = new AlertDialog.Builder(app).create();
|
||||||
|
alertDialog.setTitle(title);
|
||||||
|
alertDialog.setMessage(message);
|
||||||
|
alertDialog.setCancelable(true);
|
||||||
|
alertDialog.setIcon(R.drawable.icon);
|
||||||
|
String buttonStr = "it's false";
|
||||||
|
if (logicSwitch)
|
||||||
|
{
|
||||||
|
buttonStr = "it's true";
|
||||||
|
}
|
||||||
|
alertDialog.setButton(buttonStr, new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
app.runOnGLThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
|
||||||
|
Cocos2dxJavascriptJavaBridge.evalString("cc.log(\"Javascript Java bridge!\")");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
alertDialog.show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,5 +29,6 @@
|
||||||
+(void) callNativeWithParam:(NSString *)str;
|
+(void) callNativeWithParam:(NSString *)str;
|
||||||
+(NSString *)callNativeWithReturnString;
|
+(NSString *)callNativeWithReturnString;
|
||||||
+(BOOL)callNativeUIWithTitle:(NSString *) title andContent:(NSString *)content;
|
+(BOOL)callNativeUIWithTitle:(NSString *) title andContent:(NSString *)content;
|
||||||
|
+(BOOL)callNativeUIWithTitle:(NSString *) title andContent:(NSString *)content addBool:(BOOL)logicSwitch;
|
||||||
+(int)callNativeWithAdd:(NSNumber *)num1 and:(NSNumber *)num2;
|
+(int)callNativeWithAdd:(NSNumber *)num1 and:(NSNumber *)num2;
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -50,6 +50,19 @@
|
||||||
[alertView show];
|
[alertView show];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
+(BOOL)callNativeUIWithTitle:(NSString *) title andContent:(NSString *)content addBool:(BOOL)logicSwitch{
|
||||||
|
if (logicSwitch)
|
||||||
|
{
|
||||||
|
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:title message:content delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"it's true", nil];
|
||||||
|
[alertView show];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:title message:content delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"it's false", nil];
|
||||||
|
[alertView show];
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
#elif TARGET_OS_MAC
|
#elif TARGET_OS_MAC
|
||||||
|
|
||||||
+(BOOL)callNativeUIWithTitle:(NSString *) title andContent:(NSString *)content{
|
+(BOOL)callNativeUIWithTitle:(NSString *) title andContent:(NSString *)content{
|
||||||
|
@ -63,5 +76,24 @@
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+(BOOL)callNativeUIWithTitle:(NSString *) title andContent:(NSString *)content addBool:(BOOL)logicSwitch{
|
||||||
|
NSAlert *alert = [[NSAlert alloc] init];
|
||||||
|
if (logicSwitch)
|
||||||
|
{
|
||||||
|
[alert addButtonWithTitle:@"it's true"];
|
||||||
|
[alert addButtonWithTitle:@"Cancel"];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[alert addButtonWithTitle:@"it's false"];
|
||||||
|
[alert addButtonWithTitle:@"Cancel"];
|
||||||
|
}
|
||||||
|
|
||||||
|
[alert setMessageText:title];
|
||||||
|
[alert setInformativeText:content];
|
||||||
|
[alert setAlertStyle:NSWarningAlertStyle];
|
||||||
|
[alert runModal];
|
||||||
|
return true;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -41,12 +41,19 @@ var ReflectionTestLayer = BaseTestLayer.extend({
|
||||||
cc.log("ret val is "+ret);
|
cc.log("ret val is "+ret);
|
||||||
}
|
}
|
||||||
}, this);
|
}, this);
|
||||||
menuItem.x = winSize.width / 2;
|
|
||||||
menuItem.y = winSize.height / 2;
|
|
||||||
|
|
||||||
var menu = new cc.Menu(menuItem);
|
var label2 = new cc.LabelTTF("CallReflectionWithBool", "Arial", 35);
|
||||||
menu.x = 0;
|
var menuItem2 = new cc.MenuItemLabel(label2, function(){
|
||||||
menu.y = 0;
|
if(cc.sys.os == cc.sys.OS_ANDROID){
|
||||||
|
jsb.reflection.callStaticMethod("org/cocos2dx/js_tests/AppActivity", "showAlertDialog", "(Ljava/lang/String;Ljava/lang/String;Z)V", "How are you ?", "I'm great !", true);
|
||||||
|
}else if(cc.sys.os == cc.sys.OS_IOS || cc.sys.os == cc.sys.OS_OSX){
|
||||||
|
var ret = jsb.reflection.callStaticMethod("NativeOcClass","callNativeUIWithTitle:andContent:addBool:","cocos2d-js","Yes! you call a Native UI from Reflection", true);
|
||||||
|
cc.log("ret val is "+ret);
|
||||||
|
}
|
||||||
|
}, this);
|
||||||
|
|
||||||
|
var menu = new cc.Menu(menuItem, menuItem2);
|
||||||
|
menu.alignItemsVerticallyWithPadding(4);
|
||||||
|
|
||||||
this.addChild(menu);
|
this.addChild(menu);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ import os
|
||||||
import json
|
import json
|
||||||
import excopy
|
import excopy
|
||||||
import utils_cocos
|
import utils_cocos
|
||||||
import gen_prebuilt_mk
|
|
||||||
import modify_template
|
import modify_template
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
@ -14,7 +13,6 @@ from argparse import ArgumentParser
|
||||||
class CocosBinTemplateGenerator(object):
|
class CocosBinTemplateGenerator(object):
|
||||||
|
|
||||||
KEY_COPY_CONFIG = 'template_copy_config'
|
KEY_COPY_CONFIG = 'template_copy_config'
|
||||||
KEY_ANDROID_MKS = "android_mks"
|
|
||||||
|
|
||||||
def __init__(self, args):
|
def __init__(self, args):
|
||||||
print("Generate cocos binary template")
|
print("Generate cocos binary template")
|
||||||
|
@ -22,7 +20,6 @@ class CocosBinTemplateGenerator(object):
|
||||||
# get path variables
|
# get path variables
|
||||||
self.cur_dir = os.path.realpath(os.path.dirname(__file__))
|
self.cur_dir = os.path.realpath(os.path.dirname(__file__))
|
||||||
self.repo_x = os.path.realpath(args.repo_x)
|
self.repo_x = os.path.realpath(args.repo_x)
|
||||||
self.temp_dir = os.path.join(self.cur_dir, os.pardir, "templates")
|
|
||||||
self.lib_dir = os.path.join(self.repo_x, 'prebuilt')
|
self.lib_dir = os.path.join(self.repo_x, 'prebuilt')
|
||||||
self.engine_template_dir = os.path.join(self.repo_x, "templates")
|
self.engine_template_dir = os.path.join(self.repo_x, "templates")
|
||||||
|
|
||||||
|
@ -40,41 +37,16 @@ class CocosBinTemplateGenerator(object):
|
||||||
def generate(self):
|
def generate(self):
|
||||||
self.clean_template()
|
self.clean_template()
|
||||||
self.copy_template()
|
self.copy_template()
|
||||||
self.modify_binary_mk()
|
|
||||||
self.gen_templates()
|
self.gen_templates()
|
||||||
|
|
||||||
# copy the templates into the templates folder of engine
|
|
||||||
excopy.copy_files_in_dir(self.temp_dir, os.path.join(self.repo_x, "templates"))
|
|
||||||
|
|
||||||
# remove the temp dir
|
|
||||||
utils_cocos.rmdir(self.temp_dir)
|
|
||||||
|
|
||||||
def clean_template(self):
|
def clean_template(self):
|
||||||
utils_cocos.rmdir(self.temp_dir)
|
|
||||||
utils_cocos.rmdir(os.path.join(self.engine_template_dir, "cpp-template-binary"))
|
utils_cocos.rmdir(os.path.join(self.engine_template_dir, "cpp-template-binary"))
|
||||||
utils_cocos.rmdir(os.path.join(self.engine_template_dir, "lua-template-binary"))
|
utils_cocos.rmdir(os.path.join(self.engine_template_dir, "lua-template-binary"))
|
||||||
utils_cocos.rmdir(os.path.join(self.engine_template_dir, "js-template-binary"))
|
utils_cocos.rmdir(os.path.join(self.engine_template_dir, "js-template-binary"))
|
||||||
|
|
||||||
def copy_template(self):
|
def copy_template(self):
|
||||||
for item in self.config_json[CocosBinTemplateGenerator.KEY_COPY_CONFIG]:
|
for item in self.config_json[CocosBinTemplateGenerator.KEY_COPY_CONFIG]:
|
||||||
excopy.copy_files_with_config(item, self.repo_x, self.temp_dir)
|
excopy.copy_files_with_config(item, self.repo_x, self.engine_template_dir)
|
||||||
|
|
||||||
templates_dir = os.path.join(self.cur_dir, os.path.pardir, "bin-templates")
|
|
||||||
excopy.copy_files_in_dir(os.path.join(templates_dir, "cpp-template-default"),
|
|
||||||
os.path.join(self.temp_dir, "cpp-template-binary"))
|
|
||||||
excopy.copy_files_in_dir(os.path.join(templates_dir, "lua-template-runtime"),
|
|
||||||
os.path.join(self.temp_dir, "lua-template-binary"))
|
|
||||||
excopy.copy_files_in_dir(os.path.join(templates_dir, "js-template-runtime"),
|
|
||||||
os.path.join(self.temp_dir, "js-template-binary"))
|
|
||||||
|
|
||||||
def modify_binary_mk(self):
|
|
||||||
android_libs = os.path.join(self.lib_dir, "android")
|
|
||||||
android_mks = self.config_json[CocosBinTemplateGenerator.KEY_ANDROID_MKS]
|
|
||||||
for mk_file in android_mks:
|
|
||||||
mk_file_path = os.path.join(self.repo_x, mk_file)
|
|
||||||
dst_file_path = os.path.join(os.path.dirname(mk_file_path), "prebuilt-mk", os.path.basename(mk_file_path))
|
|
||||||
tmp_obj = gen_prebuilt_mk.MKGenerator(mk_file_path, android_libs, dst_file_path)
|
|
||||||
tmp_obj.do_generate()
|
|
||||||
|
|
||||||
def getConfigJson(self):
|
def getConfigJson(self):
|
||||||
cfg_json_path = os.path.join(self.cur_dir, "template_binary_config.json")
|
cfg_json_path = os.path.join(self.cur_dir, "template_binary_config.json")
|
||||||
|
@ -85,7 +57,7 @@ class CocosBinTemplateGenerator(object):
|
||||||
return config_json
|
return config_json
|
||||||
|
|
||||||
def gen_templates(self):
|
def gen_templates(self):
|
||||||
dst_dir = self.temp_dir
|
dst_dir = self.engine_template_dir
|
||||||
x_path = self.repo_x
|
x_path = self.repo_x
|
||||||
lib_dir = self.lib_dir
|
lib_dir = self.lib_dir
|
||||||
# modify the VS project file of templates
|
# modify the VS project file of templates
|
||||||
|
@ -168,7 +140,7 @@ class CocosBinTemplateGenerator(object):
|
||||||
if not os.path.isdir(fullPath):
|
if not os.path.isdir(fullPath):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if not re.match(".*-template-.*", name):
|
if not re.match(".*-template-binary", name):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
cfg_path = os.path.join(fullPath, ".cocos-project.json")
|
cfg_path = os.path.join(fullPath, ".cocos-project.json")
|
||||||
|
|
|
@ -8,6 +8,7 @@ import shutil
|
||||||
import excopy
|
import excopy
|
||||||
import json
|
import json
|
||||||
import utils_cocos
|
import utils_cocos
|
||||||
|
import gen_prebuilt_mk
|
||||||
|
|
||||||
from custom_error import CustomError
|
from custom_error import CustomError
|
||||||
from custom_error import Logging
|
from custom_error import Logging
|
||||||
|
@ -21,11 +22,13 @@ class CocosLibsCompiler(object):
|
||||||
KEY_XCODE_PROJS_INFO = 'xcode_projs_info'
|
KEY_XCODE_PROJS_INFO = 'xcode_projs_info'
|
||||||
KEY_VS_PROJS_INFO = 'vs_projs_info'
|
KEY_VS_PROJS_INFO = 'vs_projs_info'
|
||||||
KEY_SUPPORT_VS_VERSIONS = 'support_vs_versions'
|
KEY_SUPPORT_VS_VERSIONS = 'support_vs_versions'
|
||||||
|
KEY_ANDROID_MKS = "android_mks"
|
||||||
CHECK_KEYS = [
|
CHECK_KEYS = [
|
||||||
KEY_LIBS_OUTPUT,
|
KEY_LIBS_OUTPUT,
|
||||||
KEY_XCODE_PROJS_INFO,
|
KEY_XCODE_PROJS_INFO,
|
||||||
KEY_VS_PROJS_INFO,
|
KEY_VS_PROJS_INFO,
|
||||||
KEY_SUPPORT_VS_VERSIONS
|
KEY_SUPPORT_VS_VERSIONS,
|
||||||
|
KEY_ANDROID_MKS
|
||||||
]
|
]
|
||||||
|
|
||||||
KEY_XCODE_TARGETS = 'targets'
|
KEY_XCODE_TARGETS = 'targets'
|
||||||
|
@ -87,9 +90,9 @@ class CocosLibsCompiler(object):
|
||||||
if self.build_mac:
|
if self.build_mac:
|
||||||
self.compile_mac_ios()
|
self.compile_mac_ios()
|
||||||
if self.build_android:
|
if self.build_android:
|
||||||
self.compile_android("js")
|
self.compile_android()
|
||||||
self.compile_android("lua")
|
# generate prebuilt mk files
|
||||||
|
self.modify_binary_mk()
|
||||||
|
|
||||||
def build_win32_proj(self, cmd_path, sln_path, proj_name, mode):
|
def build_win32_proj(self, cmd_path, sln_path, proj_name, mode):
|
||||||
build_cmd = " ".join([
|
build_cmd = " ".join([
|
||||||
|
@ -276,7 +279,7 @@ class CocosLibsCompiler(object):
|
||||||
mac_strip_cmd = "xcrun strip -S %s/*.a" % mac_out_dir
|
mac_strip_cmd = "xcrun strip -S %s/*.a" % mac_out_dir
|
||||||
utils_cocos.execute_command(mac_strip_cmd)
|
utils_cocos.execute_command(mac_strip_cmd)
|
||||||
|
|
||||||
def compile_android(self, language):
|
def compile_android(self):
|
||||||
print("compile android")
|
print("compile android")
|
||||||
# build .so for android
|
# build .so for android
|
||||||
CONSOLE_PATH = "tools/cocos2d-console/bin"
|
CONSOLE_PATH = "tools/cocos2d-console/bin"
|
||||||
|
@ -290,17 +293,9 @@ class CocosLibsCompiler(object):
|
||||||
else:
|
else:
|
||||||
cmd_path = os.path.join(console_dir, "cocos")
|
cmd_path = os.path.join(console_dir, "cocos")
|
||||||
|
|
||||||
proj_name = "My%sGame" % language
|
# build the simulator project
|
||||||
proj_dir = engine_dir
|
proj_path = os.path.join(engine_dir, 'tools/simulator')
|
||||||
proj_path = os.path.join(proj_dir, proj_name)
|
build_cmd = "%s compile -s %s -p android --ndk-mode release --app-abi %s" % (cmd_path, proj_path, self.app_abi)
|
||||||
utils_cocos.rmdir(proj_path)
|
|
||||||
|
|
||||||
# create a runtime project
|
|
||||||
create_cmd = "%s new -l %s -t runtime -d %s %s" % (cmd_path, language, proj_dir, proj_name)
|
|
||||||
utils_cocos.execute_command(create_cmd)
|
|
||||||
|
|
||||||
# build it
|
|
||||||
build_cmd = "%s compile -s %s -p android --ndk-mode release -j 4 --app-abi %s" % (cmd_path, proj_path, self.app_abi)
|
|
||||||
utils_cocos.execute_command(build_cmd)
|
utils_cocos.execute_command(build_cmd)
|
||||||
|
|
||||||
# copy .a to prebuilt dir
|
# copy .a to prebuilt dir
|
||||||
|
@ -348,9 +343,6 @@ class CocosLibsCompiler(object):
|
||||||
if os.path.exists(strip_cmd_path) and os.path.exists(os.path.join(android_out_dir, "x86")):
|
if os.path.exists(strip_cmd_path) and os.path.exists(os.path.join(android_out_dir, "x86")):
|
||||||
self.trip_libs(strip_cmd_path, os.path.join(android_out_dir, 'x86'))
|
self.trip_libs(strip_cmd_path, os.path.join(android_out_dir, 'x86'))
|
||||||
|
|
||||||
# remove the project
|
|
||||||
utils_cocos.rmdir(proj_path)
|
|
||||||
|
|
||||||
def trip_libs(self, strip_cmd, folder):
|
def trip_libs(self, strip_cmd, folder):
|
||||||
if not os.path.isdir(folder):
|
if not os.path.isdir(folder):
|
||||||
return
|
return
|
||||||
|
@ -366,6 +358,16 @@ class CocosLibsCompiler(object):
|
||||||
strip_cmd = "%s -S %s/*.a" % (strip_cmd, folder)
|
strip_cmd = "%s -S %s/*.a" % (strip_cmd, folder)
|
||||||
utils_cocos.execute_command(strip_cmd)
|
utils_cocos.execute_command(strip_cmd)
|
||||||
|
|
||||||
|
def modify_binary_mk(self):
|
||||||
|
android_libs = os.path.join(self.lib_dir, "android")
|
||||||
|
android_mks = self.cfg_info[CocosLibsCompiler.KEY_ANDROID_MKS]
|
||||||
|
for mk_file in android_mks:
|
||||||
|
mk_file_path = os.path.join(self.repo_x, mk_file)
|
||||||
|
print('gen %s' % mk_file_path)
|
||||||
|
dst_file_path = os.path.join(os.path.dirname(mk_file_path), "prebuilt-mk", os.path.basename(mk_file_path))
|
||||||
|
tmp_obj = gen_prebuilt_mk.MKGenerator(mk_file_path, android_libs, dst_file_path)
|
||||||
|
tmp_obj.do_generate()
|
||||||
|
|
||||||
def clean_libs(self):
|
def clean_libs(self):
|
||||||
print("to clean libs")
|
print("to clean libs")
|
||||||
utils_cocos.rmdir(self.lib_dir)
|
utils_cocos.rmdir(self.lib_dir)
|
||||||
|
|
|
@ -0,0 +1,406 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
#-*- coding: UTF-8 -*-
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Generate Cocos Simulator
|
||||||
|
#
|
||||||
|
# Copyright 2015 (C) zhangbin
|
||||||
|
#
|
||||||
|
# License: MIT
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import shutil
|
||||||
|
import string
|
||||||
|
|
||||||
|
import utils_cocos
|
||||||
|
|
||||||
|
from datetime import date
|
||||||
|
from custom_error import Logging, CustomError
|
||||||
|
from argparse import ArgumentParser
|
||||||
|
|
||||||
|
class SimulatorCompiler(object):
|
||||||
|
SIMULATOR_PROJ_PATH = 'tools/simulator'
|
||||||
|
COCOS_CMD_PATH = 'tools/cocos2d-console/bin/cocos'
|
||||||
|
|
||||||
|
DEFAULT_OUTPUT_FOLDER_NAME = 'simulator'
|
||||||
|
|
||||||
|
SUPPORT_PLATFORMS = {
|
||||||
|
"win" : [ 'win32', 'android' ],
|
||||||
|
"mac" : [ 'ios', 'mac', 'android' ],
|
||||||
|
"other" : [ 'android' ]
|
||||||
|
}
|
||||||
|
|
||||||
|
def __init__(self, args):
|
||||||
|
self.cur_dir = os.path.realpath(os.path.dirname(__file__))
|
||||||
|
self.engine_root = os.path.abspath(os.path.join(self.cur_dir, os.pardir, os.pardir, os.pardir))
|
||||||
|
self.simulator_abs_path = os.path.join(self.engine_root, SimulatorCompiler.SIMULATOR_PROJ_PATH)
|
||||||
|
self.cocos_bin = os.path.join(self.engine_root, SimulatorCompiler.COCOS_CMD_PATH)
|
||||||
|
|
||||||
|
# get the full path of output dir.
|
||||||
|
if args.out_dir is None:
|
||||||
|
self.simulator_output_dir = os.path.join(self.engine_root, SimulatorCompiler.DEFAULT_OUTPUT_FOLDER_NAME)
|
||||||
|
else:
|
||||||
|
out_dir = os.path.expanduser(args.out_dir)
|
||||||
|
if os.path.isabs(out_dir):
|
||||||
|
self.simulator_output_dir = os.path.normpath(out_dir)
|
||||||
|
else:
|
||||||
|
self.simulator_output_dir = os.path.normpath(os.path.abspath(out_dir))
|
||||||
|
|
||||||
|
# get arguments
|
||||||
|
self.is_clean_before_build = args.do_clean
|
||||||
|
if args.compile_mode is None:
|
||||||
|
self.mode = 'debug'
|
||||||
|
else:
|
||||||
|
self.mode = args.compile_mode
|
||||||
|
self.platform = args.platform
|
||||||
|
self.build_log = ""
|
||||||
|
self.vs_version = args.vs_version
|
||||||
|
|
||||||
|
def replace_keyword_with_content(self,content,old,new):
|
||||||
|
found_string = string.find(content,old) >= 0
|
||||||
|
return found_string, string.replace(content,old,new)
|
||||||
|
|
||||||
|
def get_content_from_file(self,file_path):
|
||||||
|
if not os.path.isfile(file_path):
|
||||||
|
raise Exception("Could not find (%s)" % (file_path))
|
||||||
|
|
||||||
|
with open(file_path) as f:
|
||||||
|
return f.read()
|
||||||
|
|
||||||
|
def write_content_to_file(self,content, file_path):
|
||||||
|
if not os.path.isfile(file_path):
|
||||||
|
raise Exception("Could not find (%s)" % (file_path))
|
||||||
|
|
||||||
|
with open(file_path, 'w') as f:
|
||||||
|
f.write(content)
|
||||||
|
|
||||||
|
def replace_keyword_with_file(self,file_path,keyword_map):
|
||||||
|
content = self.get_content_from_file(file_path)
|
||||||
|
|
||||||
|
found = False
|
||||||
|
for k in keyword_map:
|
||||||
|
old, new = k, keyword_map[k]
|
||||||
|
has_found, content = self.replace_keyword_with_content(content, old, new)
|
||||||
|
if has_found :
|
||||||
|
found = has_found
|
||||||
|
|
||||||
|
if found == True:
|
||||||
|
self.write_content_to_file(content,file_path)
|
||||||
|
|
||||||
|
def get_keywords(self):
|
||||||
|
osx_keyword = {
|
||||||
|
"CC_TARGET_OS_IPHONE,":"CC_TARGET_OS_IPHONE,\n\"COCOS2D_DEBUG=1\",",
|
||||||
|
"CC_TARGET_OS_MAC,":"CC_TARGET_OS_MAC,\n\"COCOS2D_DEBUG=1\",",
|
||||||
|
"COCOS2D_DEBUG=0":"COCOS2D_DEBUG=1",
|
||||||
|
}
|
||||||
|
|
||||||
|
win_keyword = {
|
||||||
|
"_WINDOWS":"_WINDOWS;COCOS2D_DEBUG=1",
|
||||||
|
}
|
||||||
|
|
||||||
|
if utils_cocos.os_is_mac():
|
||||||
|
return osx_keyword
|
||||||
|
if utils_cocos.os_is_win32():
|
||||||
|
return win_keyword
|
||||||
|
|
||||||
|
return {}
|
||||||
|
|
||||||
|
def convert_path_to_python(self,path):
|
||||||
|
""" Convert path which include space to correct style which python can treat correctly.
|
||||||
|
|
||||||
|
eg: on mac: convert '/usr/xxx/apache-ant\ 1.9.3' to '/usr/xxx/apache-ant 1.9.3'
|
||||||
|
eg: on windows: convert '"c:\apache-ant 1.9.3"\bin' to 'c:\apache-ant 1.9.3\bin'
|
||||||
|
"""
|
||||||
|
ret = path
|
||||||
|
if utils_cocos.os_is_mac():
|
||||||
|
ret = path.replace("\ ", " ")
|
||||||
|
|
||||||
|
if utils_cocos.os_is_win32():
|
||||||
|
ret = ret.replace("\"", "")
|
||||||
|
|
||||||
|
return ret
|
||||||
|
|
||||||
|
def convert_path_to_win32(self,path):
|
||||||
|
return path.replace("/","\\")
|
||||||
|
|
||||||
|
def get_depend_project_file_list(self):
|
||||||
|
file_list = []
|
||||||
|
|
||||||
|
if utils_cocos.os_is_mac():
|
||||||
|
IOS_MAC_PROJECT_SUFFIX = "project.pbxproj"
|
||||||
|
IOS_MAC_PROJECT_REFERENCES_TAG = 'ProjectRef ='
|
||||||
|
IOS_MAC_PROJECT_NAME_RE = r'\w+.xcodeproj'
|
||||||
|
IOS_MAC_PROJECT_PATH_RE = r'name = %s; path = (.)*.xcodeproj'
|
||||||
|
|
||||||
|
project_file_path = os.path.join(self.simulator_abs_path,
|
||||||
|
"frameworks/runtime-src/proj.ios_mac/simulator.xcodeproj",
|
||||||
|
IOS_MAC_PROJECT_SUFFIX)
|
||||||
|
contents_str = self.get_content_from_file(project_file_path)
|
||||||
|
lines = re.split(r'\n', contents_str)
|
||||||
|
|
||||||
|
simulator_mac_project_path = os.path.dirname(os.path.dirname(project_file_path))
|
||||||
|
project_references = []
|
||||||
|
for l in lines:
|
||||||
|
if IOS_MAC_PROJECT_REFERENCES_TAG in l:
|
||||||
|
ret = re.search(IOS_MAC_PROJECT_NAME_RE, l)
|
||||||
|
if ret: project_references.append(ret.group(0))
|
||||||
|
|
||||||
|
for references in project_references:
|
||||||
|
re_str = IOS_MAC_PROJECT_PATH_RE % references
|
||||||
|
ret = re.search(re_str, contents_str)
|
||||||
|
if ret:
|
||||||
|
match_str = ret.group(0)
|
||||||
|
match_str = match_str.replace("name = %s; path = " % references, "")
|
||||||
|
match_str = match_str.replace('"', "")
|
||||||
|
file_list.append(os.path.join(simulator_mac_project_path, match_str, IOS_MAC_PROJECT_SUFFIX))
|
||||||
|
|
||||||
|
elif utils_cocos.os_is_win32():
|
||||||
|
WIN32_PROJECT_TAG = "Project(\""
|
||||||
|
project_file_path = os.path.join(self.simulator_abs_path, "frameworks/runtime-src/proj.win32/simulator.sln")
|
||||||
|
simulator_win32_project_path = os.path.dirname(project_file_path)
|
||||||
|
|
||||||
|
content_str = self.get_content_from_file(project_file_path)
|
||||||
|
lines = content_str.split('\n')
|
||||||
|
for l in lines:
|
||||||
|
if l.startswith(WIN32_PROJECT_TAG):
|
||||||
|
ret = re.compile('"(.*?)"').findall(l.split(',')[1])
|
||||||
|
if ret:
|
||||||
|
path = self.convert_path_to_win32(os.path.join(simulator_win32_project_path, ret[0]))
|
||||||
|
file_list.append(path)
|
||||||
|
|
||||||
|
return file_list
|
||||||
|
|
||||||
|
def compile_for_osx(self):
|
||||||
|
if self.is_clean_before_build:
|
||||||
|
project_directory = os.path.join(self.simulator_abs_path, "frameworks/runtime-src/proj.ios_mac/")
|
||||||
|
|
||||||
|
command = "xcodebuild -alltargets -configuration %s clean" % ("Debug" if self.mode == 'debug' else 'Release')
|
||||||
|
utils_cocos.execute_command(command, project_directory)
|
||||||
|
|
||||||
|
command = ' '.join([
|
||||||
|
"mkdir -p %s" % (os.path.join(self.simulator_abs_path, "src")),
|
||||||
|
" && %s compile -p mac -m %s -o \"%s\" --no-res --compile-script 0" % (self.cocos_bin
|
||||||
|
, "debug" if self.mode == 'debug' else "release"
|
||||||
|
, os.path.join(self.simulator_output_dir,"mac")),
|
||||||
|
" && strip %s" % (os.path.join(self.simulator_output_dir,"mac","Simulator.app/Contents/MacOS/Simulator")),
|
||||||
|
])
|
||||||
|
|
||||||
|
ret = utils_cocos.execute_command(command, self.simulator_abs_path)
|
||||||
|
self.build_log += "Build osx %s %s\n" % (self.mode, "success" if ret == 0 else "failed")
|
||||||
|
return ret
|
||||||
|
|
||||||
|
def compile_for_ios(self):
|
||||||
|
if self.is_clean_before_build:
|
||||||
|
project_directory = os.path.join(self.simulator_abs_path, "frameworks/runtime-src/proj.ios_mac/")
|
||||||
|
|
||||||
|
command = "xcodebuild -alltargets -configuration %s clean" % ("Debug" if self.mode =='debug' else 'Release')
|
||||||
|
utils_cocos.execute_command(command, project_directory)
|
||||||
|
|
||||||
|
command = ' '.join([
|
||||||
|
" %s compile -p ios -m %s -o \"%s\" --no-res --compile-script 0" % (self.cocos_bin
|
||||||
|
, "debug" if self.mode == 'debug' else "release"
|
||||||
|
, os.path.join(self.simulator_output_dir,"ios")),
|
||||||
|
" && strip %s" % (os.path.join(self.simulator_output_dir,"ios","Simulator.app/Simulator")),
|
||||||
|
" && rm -fr %s" % (os.path.join(self.simulator_output_dir,"ios","Simulator.app.dSYM")),
|
||||||
|
])
|
||||||
|
|
||||||
|
ret = utils_cocos.execute_command(command, self.simulator_abs_path)
|
||||||
|
self.build_log += "Build ios %s %s\n" % (self.mode, "success" if ret == 0 else "failed")
|
||||||
|
return ret
|
||||||
|
|
||||||
|
def compile_for_win32(self):
|
||||||
|
win32_output_dir = os.path.join(self.simulator_output_dir, "win32")
|
||||||
|
win32_output_dir = self.convert_path_to_win32(win32_output_dir)
|
||||||
|
utils_cocos.mkdir(win32_output_dir)
|
||||||
|
|
||||||
|
lang_file_path = os.path.join(self.simulator_abs_path,"frameworks/runtime-src/Classes/ide-support/lang")
|
||||||
|
lang_copy_command = "xcopy /Y %s %s" % (self.convert_path_to_win32(lang_file_path), win32_output_dir)
|
||||||
|
|
||||||
|
# get the vs version should be used
|
||||||
|
if self.vs_version is None:
|
||||||
|
ver_param = ''
|
||||||
|
else:
|
||||||
|
ver_param = '--vs %d' % self.vs_version
|
||||||
|
|
||||||
|
if self.mode == 'debug':
|
||||||
|
win32_src_dir = os.path.join(self.simulator_abs_path,"runtime/win32/")
|
||||||
|
win32_src_dir = self.convert_path_to_win32(win32_src_dir)
|
||||||
|
win32_dll_dir = self.convert_path_to_win32(os.path.join(os.path.dirname(self.cur_dir),"dll/"))
|
||||||
|
command = ' '.join([
|
||||||
|
" %s compile -p win32 -m debug --no-res --compile-script 0 %s" % (self.cocos_bin, ver_param),
|
||||||
|
" && xcopy /Y %s*.dll %s" % (win32_src_dir, win32_output_dir),
|
||||||
|
" && xcopy /Y %s*.exe %s" % (win32_src_dir, win32_output_dir),
|
||||||
|
" && %s" % (lang_copy_command),
|
||||||
|
" && if exist %s*.dll xcopy /Y %s*.dll %s" % (win32_dll_dir,win32_dll_dir,win32_output_dir)
|
||||||
|
])
|
||||||
|
else:
|
||||||
|
command = ' '.join([
|
||||||
|
" %s compile -p win32 -m release --no-res --compile-script 0 -o %s %s" % (self.cocos_bin,win32_output_dir,ver_param),
|
||||||
|
" && %s" % (lang_copy_command),
|
||||||
|
])
|
||||||
|
|
||||||
|
ret = utils_cocos.execute_command(command, self.simulator_abs_path, use_py_path=False)
|
||||||
|
|
||||||
|
self.build_log += "Build win32 %s %s\n" % (self.mode, "success" if ret == 0 else "failed")
|
||||||
|
return ret
|
||||||
|
|
||||||
|
def compile_for_android(self):
|
||||||
|
rename_command = ' '.join([
|
||||||
|
"mv %s %s" % (os.path.join(self.simulator_output_dir,"android","simulator-debug.apk"),
|
||||||
|
os.path.join(self.simulator_output_dir,"android","Simulator.apk"))
|
||||||
|
])
|
||||||
|
|
||||||
|
command = ' '.join([
|
||||||
|
" %s compile -p android --ndk-mode %s -o \"%s\" --no-res --compile-script 0" % (self.cocos_bin
|
||||||
|
, "debug" if self.mode == 'debug' else "release"
|
||||||
|
, os.path.join(self.simulator_output_dir,"android")),
|
||||||
|
"&& %s" % (rename_command),
|
||||||
|
])
|
||||||
|
|
||||||
|
ret = utils_cocos.execute_command(command, self.simulator_abs_path)
|
||||||
|
self.build_log += "Build android %s %s\n" % (self.mode, "success" if ret == 0 else "failed")
|
||||||
|
return ret
|
||||||
|
|
||||||
|
def compile_all(self):
|
||||||
|
if utils_cocos.os_is_mac():
|
||||||
|
self.compile_for_android()
|
||||||
|
self.compile_for_osx()
|
||||||
|
self.compile_for_ios()
|
||||||
|
elif utils_cocos.os_is_win32():
|
||||||
|
self.compile_for_win32()
|
||||||
|
self.compile_for_android()
|
||||||
|
|
||||||
|
def do_compile(self):
|
||||||
|
if self.platform == 'all':
|
||||||
|
self.compile_all()
|
||||||
|
return
|
||||||
|
|
||||||
|
if utils_cocos.os_is_mac():
|
||||||
|
support_platforms = SimulatorCompiler.SUPPORT_PLATFORMS['mac']
|
||||||
|
elif utils_cocos.os_is_win32():
|
||||||
|
support_platforms = SimulatorCompiler.SUPPORT_PLATFORMS['win']
|
||||||
|
else:
|
||||||
|
support_platforms = SimulatorCompiler.SUPPORT_PLATFORMS['other']
|
||||||
|
|
||||||
|
if self.platform not in support_platforms:
|
||||||
|
raise CustomError('%s is not support in current system.' % self.platform,
|
||||||
|
CustomError.ERROR_WRONG_ARGS)
|
||||||
|
|
||||||
|
if self.platform == 'win32':
|
||||||
|
self.compile_for_win32()
|
||||||
|
elif self.platform == 'android':
|
||||||
|
self.compile_for_android()
|
||||||
|
elif self.platform == 'ios':
|
||||||
|
self.compile_for_ios()
|
||||||
|
elif self.platform == 'mac':
|
||||||
|
self.compile_for_osx()
|
||||||
|
|
||||||
|
def change_cocos2d_debug_macro_to_1(self, file_list):
|
||||||
|
keyword = self.get_keywords()
|
||||||
|
for file_path in file_list:
|
||||||
|
self.replace_keyword_with_file(file_path, keyword)
|
||||||
|
|
||||||
|
def update_bundle_version(self):
|
||||||
|
build_date = date.today().strftime("%Y%m%d")
|
||||||
|
|
||||||
|
if utils_cocos.os_is_mac():
|
||||||
|
# mac
|
||||||
|
info_plist_path = os.path.join(self.simulator_abs_path, "frameworks/runtime-src/proj.ios_mac/mac/Info.plist")
|
||||||
|
info_plist_content = self.get_content_from_file(info_plist_path)
|
||||||
|
|
||||||
|
match = re.compile('<key>CFBundleVersion</key>(\s)*<string>(.*?)</string>').findall(info_plist_content)
|
||||||
|
if len(match):
|
||||||
|
build_date_tag = "<string>%s</string>" % match[0][1]
|
||||||
|
keyword_map = { build_date_tag : "<string>%s</string>" % build_date }
|
||||||
|
self.replace_keyword_with_file(info_plist_path, keyword_map)
|
||||||
|
|
||||||
|
if utils_cocos.os_is_win32():
|
||||||
|
# win32
|
||||||
|
game_rc_path = os.path.join(self.simulator_abs_path,"frameworks/runtime-src/proj.win32/game.rc")
|
||||||
|
game_rc_content = self.get_content_from_file(game_rc_path)
|
||||||
|
match = re.compile('"Version[^\(]*\(.*\)"').findall(game_rc_content)
|
||||||
|
if len(match):
|
||||||
|
build_info_str = match[0]
|
||||||
|
m = re.match(r'"(Version[^\(]*)\(.*\)', build_info_str)
|
||||||
|
target_str = '"%s(%s)"' % (m.group(1), build_date)
|
||||||
|
keyword_map = { build_info_str : target_str}
|
||||||
|
self.replace_keyword_with_file(game_rc_path,keyword_map)
|
||||||
|
|
||||||
|
def backup_files(self, files):
|
||||||
|
for f in files:
|
||||||
|
full_path = os.path.abspath(f)
|
||||||
|
if not os.path.isfile(full_path):
|
||||||
|
continue
|
||||||
|
|
||||||
|
backup_file_path = '%s.bak' % full_path
|
||||||
|
shutil.copyfile(full_path, backup_file_path)
|
||||||
|
|
||||||
|
def rollback_files(self, files):
|
||||||
|
for f in files:
|
||||||
|
full_path = os.path.abspath(f)
|
||||||
|
backup_file_path = '%s.bak' % full_path
|
||||||
|
if not os.path.isfile(backup_file_path):
|
||||||
|
continue
|
||||||
|
|
||||||
|
try:
|
||||||
|
shutil.copyfile(backup_file_path, full_path)
|
||||||
|
os.remove(backup_file_path)
|
||||||
|
except:
|
||||||
|
print('Roll back file %s failed.' % full_path)
|
||||||
|
print('Please rename %s to %s manually.' % (backup_file_path, full_path))
|
||||||
|
pass
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
if self.is_clean_before_build:
|
||||||
|
utils_cocos.rmdir(self.simulator_output_dir)
|
||||||
|
|
||||||
|
# backup some files
|
||||||
|
modify_files = self.get_depend_project_file_list()
|
||||||
|
if utils_cocos.os_is_mac():
|
||||||
|
modify_files.append(os.path.join(self.simulator_abs_path, 'frameworks/runtime-src/proj.ios_mac/mac/Info.plist'))
|
||||||
|
elif utils_cocos.os_is_win32():
|
||||||
|
modify_files.append(os.path.join(self.simulator_abs_path, 'frameworks/runtime-src/proj.win32/game.rc'))
|
||||||
|
|
||||||
|
self.backup_files(modify_files)
|
||||||
|
|
||||||
|
try:
|
||||||
|
# modify bundle version
|
||||||
|
self.update_bundle_version()
|
||||||
|
|
||||||
|
# modify project config files
|
||||||
|
self.change_cocos2d_debug_macro_to_1(modify_files)
|
||||||
|
|
||||||
|
# compile simulator
|
||||||
|
self.do_compile()
|
||||||
|
except Exception as e:
|
||||||
|
raise e
|
||||||
|
finally:
|
||||||
|
# roll back modified files
|
||||||
|
self.rollback_files(modify_files)
|
||||||
|
Logging.info("")
|
||||||
|
Logging.info(self.build_log)
|
||||||
|
Logging.info("")
|
||||||
|
|
||||||
|
return 0
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
parser = ArgumentParser(description="Generate Cocos Simulator.")
|
||||||
|
parser.add_argument('-c', '--clean', dest='do_clean', action='store_true',
|
||||||
|
help='Clean the output directory before generating. Will remove the output directory at first.')
|
||||||
|
parser.add_argument('-m', "--mode", dest='compile_mode', type=str, choices=['debug', 'release'],
|
||||||
|
help='Generate simulator for debug or release. Default is debug.')
|
||||||
|
parser.add_argument('-o', '--output', dest='out_dir',
|
||||||
|
help='Where to save Cocos Simulator. Default is the simulator folder in the root path of engine.')
|
||||||
|
parser.add_argument('-p', '--platform', dest='platform', required=True,
|
||||||
|
choices=['ios', 'mac', 'android', 'win32', 'all'],
|
||||||
|
help='Which platform will be generated for.')
|
||||||
|
parser.add_argument('--vs', dest='vs_version', type=int,
|
||||||
|
help='Specify the Visual Studio version will be used. Such as: 2013. Default find available version automatically.')
|
||||||
|
|
||||||
|
(args, unknown) = parser.parse_known_args()
|
||||||
|
if len(unknown) > 0:
|
||||||
|
print("unknown arguments: %s" % unknown)
|
||||||
|
|
||||||
|
compiler = SimulatorCompiler(args)
|
||||||
|
compiler.run()
|
|
@ -26,5 +26,25 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"android_mks" : [
|
||||||
|
"cocos/Android.mk",
|
||||||
|
"cocos/audio/android/Android.mk",
|
||||||
|
"cocos/scripting/js-bindings/proj.android/Android.mk",
|
||||||
|
"cocos/scripting/lua-bindings/proj.android/Android.mk",
|
||||||
|
"cocos/storage/local-storage/Android.mk",
|
||||||
|
"external/bullet/Android.mk",
|
||||||
|
"external/recast/Android.mk",
|
||||||
|
"external/flatbuffers/Android.mk",
|
||||||
|
"external/Box2D/Android.mk",
|
||||||
|
"cocos/editor-support/cocosbuilder/Android.mk",
|
||||||
|
"extensions/Android.mk",
|
||||||
|
"cocos/3d/Android.mk",
|
||||||
|
"cocos/ui/Android.mk",
|
||||||
|
"cocos/editor-support/cocostudio/Android.mk",
|
||||||
|
"cocos/network/Android.mk",
|
||||||
|
"cocos/platform/android/Android.mk",
|
||||||
|
"cocos/editor-support/spine/Android.mk",
|
||||||
|
"tools/simulator/libsimulator/proj.android/Android.mk"
|
||||||
|
],
|
||||||
"support_vs_versions" : [ 2015, 2013 ]
|
"support_vs_versions" : [ 2015, 2013 ]
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue