This commit is contained in:
lite3 2014-06-21 17:34:11 +08:00
commit 758a1f5dc4
198 changed files with 7742 additions and 306 deletions

View File

@ -752,7 +752,9 @@ Developers:
hanjukim
Fixed a bug that color and opacity settings were not applied when invoking Label::alignText.
Fixed the bug that FileUtils:getStringFromFile() may return a unterminated string
Skip BOM in DataReaderHelper::addDataFromJsonCache()
bagobor
Fixed a memory leak in AssetsManager::uncompress.
Code format fix and small optimizations in cocostudio/CCActionNode.cpp.
@ -892,6 +894,9 @@ Developers:
kyokomi
Fix the bug that UIButton doesn't support TTF font
Fix a but of TextReader
gin0606
Add a new line at the end of a file
Retired Core Developers:
WenSheng Yang

View File

@ -2,6 +2,7 @@ cocos2d-x-3.2 ???
[NEW] Node: added getName(), setName(), getChildByName(), enumerateChildren()
[NEW] Label: support setting line height and additional kerning of label that not using system font
[FIX] FileUtils: getStringFromFile may return a unterminated string
[FIX] UIButton: doesn't support TTF font
cocos2d-x-3.2-alpha0 Jun.17 2014

View File

@ -100,6 +100,8 @@ endif()
if(MINGW)
add_definitions(-DGLEW_STATIC)
add_definitions(-D__SSIZE_T)
set(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} -lws2_32")
set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lws2_32")
endif()

View File

@ -40,6 +40,28 @@
/* End PBXAggregateTarget section */
/* Begin PBXBuildFile section */
0634A4D0194B19E400E608AF /* CCActionTimeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0634A4C5194B19E400E608AF /* CCActionTimeline.cpp */; };
0634A4D1194B19E400E608AF /* CCActionTimeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0634A4C5194B19E400E608AF /* CCActionTimeline.cpp */; };
0634A4D2194B19E400E608AF /* CCActionTimeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 0634A4C6194B19E400E608AF /* CCActionTimeline.h */; };
0634A4D3194B19E400E608AF /* CCActionTimeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 0634A4C6194B19E400E608AF /* CCActionTimeline.h */; };
0634A4D4194B19E400E608AF /* CCActionTimelineCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0634A4C7194B19E400E608AF /* CCActionTimelineCache.cpp */; };
0634A4D5194B19E400E608AF /* CCActionTimelineCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0634A4C7194B19E400E608AF /* CCActionTimelineCache.cpp */; };
0634A4D6194B19E400E608AF /* CCActionTimelineCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 0634A4C8194B19E400E608AF /* CCActionTimelineCache.h */; };
0634A4D7194B19E400E608AF /* CCActionTimelineCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 0634A4C8194B19E400E608AF /* CCActionTimelineCache.h */; };
0634A4D8194B19E400E608AF /* CCFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0634A4C9194B19E400E608AF /* CCFrame.cpp */; };
0634A4D9194B19E400E608AF /* CCFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0634A4C9194B19E400E608AF /* CCFrame.cpp */; };
0634A4DA194B19E400E608AF /* CCFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 0634A4CA194B19E400E608AF /* CCFrame.h */; };
0634A4DB194B19E400E608AF /* CCFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 0634A4CA194B19E400E608AF /* CCFrame.h */; };
0634A4DC194B19E400E608AF /* CCNodeReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0634A4CB194B19E400E608AF /* CCNodeReader.cpp */; };
0634A4DD194B19E400E608AF /* CCNodeReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0634A4CB194B19E400E608AF /* CCNodeReader.cpp */; };
0634A4DE194B19E400E608AF /* CCNodeReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 0634A4CC194B19E400E608AF /* CCNodeReader.h */; };
0634A4DF194B19E400E608AF /* CCNodeReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 0634A4CC194B19E400E608AF /* CCNodeReader.h */; };
0634A4E0194B19E400E608AF /* CCTimeLine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0634A4CD194B19E400E608AF /* CCTimeLine.cpp */; };
0634A4E1194B19E400E608AF /* CCTimeLine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0634A4CD194B19E400E608AF /* CCTimeLine.cpp */; };
0634A4E2194B19E400E608AF /* CCTimeLine.h in Headers */ = {isa = PBXBuildFile; fileRef = 0634A4CE194B19E400E608AF /* CCTimeLine.h */; };
0634A4E3194B19E400E608AF /* CCTimeLine.h in Headers */ = {isa = PBXBuildFile; fileRef = 0634A4CE194B19E400E608AF /* CCTimeLine.h */; };
0634A4E4194B19E400E608AF /* CCTimelineMacro.h in Headers */ = {isa = PBXBuildFile; fileRef = 0634A4CF194B19E400E608AF /* CCTimelineMacro.h */; };
0634A4E5194B19E400E608AF /* CCTimelineMacro.h in Headers */ = {isa = PBXBuildFile; fileRef = 0634A4CF194B19E400E608AF /* CCTimelineMacro.h */; };
06CAAAC5186AD7E50012A414 /* TriggerObj.h in Headers */ = {isa = PBXBuildFile; fileRef = 06CAAAC1186AD63B0012A414 /* TriggerObj.h */; };
06CAAAC6186AD7E60012A414 /* TriggerObj.h in Headers */ = {isa = PBXBuildFile; fileRef = 06CAAAC1186AD63B0012A414 /* TriggerObj.h */; };
06CAAAC7186AD7E90012A414 /* TriggerObj.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 06CAAAC0186AD63B0012A414 /* TriggerObj.cpp */; };
@ -1887,6 +1909,17 @@
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
0634A4C5194B19E400E608AF /* CCActionTimeline.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCActionTimeline.cpp; sourceTree = "<group>"; };
0634A4C6194B19E400E608AF /* CCActionTimeline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCActionTimeline.h; sourceTree = "<group>"; };
0634A4C7194B19E400E608AF /* CCActionTimelineCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCActionTimelineCache.cpp; sourceTree = "<group>"; };
0634A4C8194B19E400E608AF /* CCActionTimelineCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCActionTimelineCache.h; sourceTree = "<group>"; };
0634A4C9194B19E400E608AF /* CCFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCFrame.cpp; sourceTree = "<group>"; };
0634A4CA194B19E400E608AF /* CCFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCFrame.h; sourceTree = "<group>"; };
0634A4CB194B19E400E608AF /* CCNodeReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCNodeReader.cpp; sourceTree = "<group>"; };
0634A4CC194B19E400E608AF /* CCNodeReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCNodeReader.h; sourceTree = "<group>"; };
0634A4CD194B19E400E608AF /* CCTimeLine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCTimeLine.cpp; sourceTree = "<group>"; };
0634A4CE194B19E400E608AF /* CCTimeLine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCTimeLine.h; sourceTree = "<group>"; };
0634A4CF194B19E400E608AF /* CCTimelineMacro.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCTimelineMacro.h; sourceTree = "<group>"; };
06CAAABC186AD63B0012A414 /* TriggerBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TriggerBase.cpp; sourceTree = "<group>"; };
06CAAABD186AD63B0012A414 /* TriggerBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TriggerBase.h; sourceTree = "<group>"; };
06CAAABE186AD63B0012A414 /* TriggerMng.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TriggerMng.cpp; sourceTree = "<group>"; };
@ -2934,6 +2967,24 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
0634A4C4194B19E400E608AF /* ActionTimeline */ = {
isa = PBXGroup;
children = (
0634A4C5194B19E400E608AF /* CCActionTimeline.cpp */,
0634A4C6194B19E400E608AF /* CCActionTimeline.h */,
0634A4C7194B19E400E608AF /* CCActionTimelineCache.cpp */,
0634A4C8194B19E400E608AF /* CCActionTimelineCache.h */,
0634A4C9194B19E400E608AF /* CCFrame.cpp */,
0634A4CA194B19E400E608AF /* CCFrame.h */,
0634A4CB194B19E400E608AF /* CCNodeReader.cpp */,
0634A4CC194B19E400E608AF /* CCNodeReader.h */,
0634A4CD194B19E400E608AF /* CCTimeLine.cpp */,
0634A4CE194B19E400E608AF /* CCTimeLine.h */,
0634A4CF194B19E400E608AF /* CCTimelineMacro.h */,
);
path = ActionTimeline;
sourceTree = "<group>";
};
1551A334158F2AB200E66CFE = {
isa = PBXGroup;
children = (
@ -3590,6 +3641,7 @@
1A8C5946180E930E00EF57C3 /* cocostudio */ = {
isa = PBXGroup;
children = (
0634A4C4194B19E400E608AF /* ActionTimeline */,
50FCEB6818C72017004AD434 /* WidgetReader */,
06CAAAC1186AD63B0012A414 /* TriggerObj.h */,
06CAAABC186AD63B0012A414 /* TriggerBase.cpp */,
@ -4916,6 +4968,7 @@
50ABBE731925AB6F00A911A9 /* CCEventListenerMouse.h in Headers */,
1A570063180BC5A10088DEC7 /* CCAction.h in Headers */,
1A570067180BC5A10088DEC7 /* CCActionCamera.h in Headers */,
0634A4DA194B19E400E608AF /* CCFrame.h in Headers */,
1A57006B180BC5A10088DEC7 /* CCActionCatmullRom.h in Headers */,
1A57006F180BC5A10088DEC7 /* CCActionEase.h in Headers */,
1A570073180BC5A10088DEC7 /* CCActionGrid.h in Headers */,
@ -5020,6 +5073,7 @@
1A570294180BCCAB0088DEC7 /* CCAnimation.h in Headers */,
50ABBD421925AB0000A911A9 /* CCMathBase.h in Headers */,
1A570298180BCCAB0088DEC7 /* CCAnimationCache.h in Headers */,
0634A4DE194B19E400E608AF /* CCNodeReader.h in Headers */,
50FCEB9D18C72017004AD434 /* ImageViewReader.h in Headers */,
B29594C81926D61F003EEF37 /* CCObjLoader.h in Headers */,
50ABBE911925AB6F00A911A9 /* CCPlatformMacros.h in Headers */,
@ -5080,6 +5134,7 @@
1AD71DCF180E26E600808F54 /* CCControlLoader.h in Headers */,
50ABBE7B1925AB6F00A911A9 /* CCEventMouse.h in Headers */,
1AD71DD3180E26E600808F54 /* CCLabelBMFontLoader.h in Headers */,
0634A4D6194B19E400E608AF /* CCActionTimelineCache.h in Headers */,
1AD71DD7180E26E600808F54 /* CCLabelTTFLoader.h in Headers */,
1AD71DDB180E26E600808F54 /* CCLayerColorLoader.h in Headers */,
503DD8F91926B0DB00CD74DD /* CCIMEDispatcher.h in Headers */,
@ -5148,6 +5203,7 @@
50ABBE3F1925AB6F00A911A9 /* CCDataVisitor.h in Headers */,
1AD71EDF180E26E600808F54 /* Slot.h in Headers */,
1AD71EE3180E26E600808F54 /* SlotData.h in Headers */,
0634A4E2194B19E400E608AF /* CCTimeLine.h in Headers */,
1AD71EE7180E26E600808F54 /* spine-cocos2dx.h in Headers */,
1AD71EE9180E26E600808F54 /* spine.h in Headers */,
1AAF536C180E3374000584C8 /* HttpClient.h in Headers */,
@ -5179,6 +5235,7 @@
50ABBE371925AB6F00A911A9 /* CCConsole.h in Headers */,
1A8C59A1180E930E00EF57C3 /* CCArmature.h in Headers */,
1A8C59A5180E930E00EF57C3 /* CCArmatureAnimation.h in Headers */,
0634A4D2194B19E400E608AF /* CCActionTimeline.h in Headers */,
1A8C59A9180E930E00EF57C3 /* CCArmatureDataManager.h in Headers */,
50ABC00B1926664800A911A9 /* CCDevice.h in Headers */,
2905FA7A18CF08D100240AA3 /* UISlider.h in Headers */,
@ -5217,6 +5274,7 @@
50ABBD951925AB4100A911A9 /* CCGLProgramState.h in Headers */,
1A8C59F1180E930E00EF57C3 /* CCSpriteFrameCacheHelper.h in Headers */,
1A8C59F5180E930E00EF57C3 /* CCSSceneReader.h in Headers */,
0634A4E4194B19E400E608AF /* CCTimelineMacro.h in Headers */,
1A8C59F9180E930E00EF57C3 /* CCTransformHelp.h in Headers */,
1A8C59FD180E930E00EF57C3 /* CCTween.h in Headers */,
1A8C5A05180E930E00EF57C3 /* CCUtilMath.h in Headers */,
@ -5380,6 +5438,7 @@
2AC795EA1862875D005EC8E1 /* BoundingBoxAttachment.h in Headers */,
503DD8F01926736A00CD74DD /* CCStdC.h in Headers */,
46A170FF1807CECB005B8026 /* CCPhysicsContact.h in Headers */,
0634A4D3194B19E400E608AF /* CCActionTimeline.h in Headers */,
50ABBDA21925AB4100A911A9 /* CCGroupCommand.h in Headers */,
503DD8EF1926736A00CD74DD /* CCPlatformDefine.h in Headers */,
46A171041807CECB005B8026 /* CCPhysicsShape.h in Headers */,
@ -5392,6 +5451,7 @@
46A170FD1807CECB005B8026 /* CCPhysicsBody.h in Headers */,
2905FA6118CF08D100240AA3 /* UILayoutParameter.h in Headers */,
B29594C51926D61F003EEF37 /* CCMesh.h in Headers */,
0634A4DB194B19E400E608AF /* CCFrame.h in Headers */,
50ABBE9C1925AB6F00A911A9 /* CCRef.h in Headers */,
50ABBD961925AB4100A911A9 /* CCGLProgramState.h in Headers */,
46A171061807CECB005B8026 /* CCPhysicsWorld.h in Headers */,
@ -5403,6 +5463,7 @@
50ABBEC21925AB6F00A911A9 /* CCValue.h in Headers */,
2905FA5518CF08D100240AA3 /* UIImageView.h in Headers */,
50ABBECA1925AB6F00A911A9 /* firePngData.h in Headers */,
0634A4E3194B19E400E608AF /* CCTimeLine.h in Headers */,
50ABBE401925AB6F00A911A9 /* CCDataVisitor.h in Headers */,
1A570064180BC5A10088DEC7 /* CCAction.h in Headers */,
06CAAACE186AD7FA0012A414 /* TriggerBase.h in Headers */,
@ -5460,6 +5521,7 @@
1A57011E180BC90D0088DEC7 /* CCGrabber.h in Headers */,
1A570122180BC90D0088DEC7 /* CCGrid.h in Headers */,
50FCEBBA18C72017004AD434 /* TextAtlasReader.h in Headers */,
0634A4D7194B19E400E608AF /* CCActionTimelineCache.h in Headers */,
5034CA2E191D591100CE6051 /* ccShader_PositionTextureA8Color.frag in Headers */,
50ABBD5B1925AB0000A911A9 /* Vec2.h in Headers */,
50ABBD411925AB0000A911A9 /* CCMath.h in Headers */,
@ -5543,6 +5605,7 @@
50ABBE2A1925AB6F00A911A9 /* CCAutoreleasePool.h in Headers */,
1A57030F180BCF190088DEC7 /* CCComponent.h in Headers */,
1A570313180BCF190088DEC7 /* CCComponentContainer.h in Headers */,
0634A4DF194B19E400E608AF /* CCNodeReader.h in Headers */,
1A087AEB1860400400196EF5 /* edtaa3func.h in Headers */,
2905FA6518CF08D100240AA3 /* UIListView.h in Headers */,
50FCEBAA18C72017004AD434 /* LoadingBarReader.h in Headers */,
@ -5664,6 +5727,7 @@
1A9DCA2A180E6955007A3AD4 /* CCGLBufferedNode.h in Headers */,
1A01C69F18F57BE800EFE3A6 /* CCString.h in Headers */,
1A01C69118F57BE800EFE3A6 /* CCDictionary.h in Headers */,
0634A4E5194B19E400E608AF /* CCTimelineMacro.h in Headers */,
1A8C598E180E930E00EF57C3 /* CCActionFrame.h in Headers */,
1A8C5992180E930E00EF57C3 /* CCActionFrameEasing.h in Headers */,
5034CA36191D591100CE6051 /* ccShader_PositionTexture.frag in Headers */,
@ -6100,6 +6164,7 @@
1A01C6A418F58F7500EFE3A6 /* CCNotificationCenter.cpp in Sources */,
46A170EA1807CECA005B8026 /* CCPhysicsJoint.cpp in Sources */,
5027253C190BF1B900AAF4ED /* cocos2d.cpp in Sources */,
0634A4D4194B19E400E608AF /* CCActionTimelineCache.cpp in Sources */,
50ABC0611926664800A911A9 /* CCCommon.mm in Sources */,
50ABBDB11925AB4100A911A9 /* ccShaders.cpp in Sources */,
46A170EF1807CECA005B8026 /* CCPhysicsWorld.cpp in Sources */,
@ -6218,6 +6283,7 @@
1A5702EE180BCE750088DEC7 /* CCTMXLayer.cpp in Sources */,
50ABBE691925AB6F00A911A9 /* CCEventListenerFocus.cpp in Sources */,
1A5702F2180BCE750088DEC7 /* CCTMXObjectGroup.cpp in Sources */,
0634A4DC194B19E400E608AF /* CCNodeReader.cpp in Sources */,
1A5702F6180BCE750088DEC7 /* CCTMXTiledMap.cpp in Sources */,
1A5702FA180BCE750088DEC7 /* CCTMXXMLParser.cpp in Sources */,
50ABBD5C1925AB0000A911A9 /* Vec3.cpp in Sources */,
@ -6306,6 +6372,7 @@
1AD71EE5180E26E600808F54 /* spine-cocos2dx.cpp in Sources */,
1AAF536A180E3374000584C8 /* HttpClient.cpp in Sources */,
50ABC0631926664800A911A9 /* CCDevice.mm in Sources */,
0634A4E0194B19E400E608AF /* CCTimeLine.cpp in Sources */,
1AAF5372180E3374000584C8 /* SocketIO.cpp in Sources */,
50ABBE1F1925AB6F00A911A9 /* atitc.cpp in Sources */,
1AAF5376180E3374000584C8 /* WebSocket.cpp in Sources */,
@ -6348,6 +6415,7 @@
2905FA7C18CF08D100240AA3 /* UIText.cpp in Sources */,
50FCEB9F18C72017004AD434 /* LayoutReader.cpp in Sources */,
50ABC0211926664800A911A9 /* CCGLView.cpp in Sources */,
0634A4D8194B19E400E608AF /* CCFrame.cpp in Sources */,
1A8C59C7180E930E00EF57C3 /* CCComRender.cpp in Sources */,
50ABC00D1926664800A911A9 /* CCFileUtils.cpp in Sources */,
1A8C59CB180E930E00EF57C3 /* CCDataReaderHelper.cpp in Sources */,
@ -6362,6 +6430,7 @@
1A8C59D7180E930E00EF57C3 /* CCDisplayFactory.cpp in Sources */,
50ABBD601925AB0000A911A9 /* Vec4.cpp in Sources */,
1A8C59DB180E930E00EF57C3 /* CCDisplayManager.cpp in Sources */,
0634A4D0194B19E400E608AF /* CCActionTimeline.cpp in Sources */,
2905FA6218CF08D100240AA3 /* UIListView.cpp in Sources */,
1A8C59DF180E930E00EF57C3 /* CCInputDelegate.cpp in Sources */,
1A8C59E3180E930E00EF57C3 /* CCProcessBase.cpp in Sources */,
@ -6556,6 +6625,7 @@
3EA0FB6C191C841D00B170C8 /* UIVideoPlayerIOS.mm in Sources */,
1A570062180BC5A10088DEC7 /* CCAction.cpp in Sources */,
1A570066180BC5A10088DEC7 /* CCActionCamera.cpp in Sources */,
0634A4D9194B19E400E608AF /* CCFrame.cpp in Sources */,
1A57006A180BC5A10088DEC7 /* CCActionCatmullRom.cpp in Sources */,
1A57006E180BC5A10088DEC7 /* CCActionEase.cpp in Sources */,
50ABBD8C1925AB4100A911A9 /* CCGLProgram.cpp in Sources */,
@ -6564,6 +6634,7 @@
B37510811823ACA100B3BA6A /* CCPhysicsJointInfo_chipmunk.cpp in Sources */,
2905FA8D18CF08D100240AA3 /* UIWidget.cpp in Sources */,
B29594B51926D5EC003EEF37 /* CCMeshCommand.cpp in Sources */,
0634A4D5194B19E400E608AF /* CCActionTimelineCache.cpp in Sources */,
50ABBE7E1925AB6F00A911A9 /* CCEventTouch.cpp in Sources */,
50FCEB9818C72017004AD434 /* CheckBoxReader.cpp in Sources */,
50ABBE6E1925AB6F00A911A9 /* CCEventListenerKeyboard.cpp in Sources */,
@ -6623,6 +6694,7 @@
50ABBD9C1925AB4100A911A9 /* ccGLStateCache.cpp in Sources */,
1A5701E7180BCB8C0088DEC7 /* CCTransition.cpp in Sources */,
50ABC01E1926664800A911A9 /* CCThread.cpp in Sources */,
0634A4D1194B19E400E608AF /* CCActionTimeline.cpp in Sources */,
1A5701EB180BCB8C0088DEC7 /* CCTransitionPageTurn.cpp in Sources */,
1A5701EF180BCB8C0088DEC7 /* CCTransitionProgress.cpp in Sources */,
1A5701F8180BCBAD0088DEC7 /* CCMenu.cpp in Sources */,
@ -6680,6 +6752,7 @@
50ABBDB61925AB4100A911A9 /* CCTexture2D.cpp in Sources */,
1A570355180BD0B00088DEC7 /* ioapi.cpp in Sources */,
1A570359180BD0B00088DEC7 /* unzip.cpp in Sources */,
0634A4E1194B19E400E608AF /* CCTimeLine.cpp in Sources */,
1AD71DAA180E26E600808F54 /* CCBAnimationManager.cpp in Sources */,
50ABBD881925AB4100A911A9 /* CCCustomCommand.cpp in Sources */,
50ABBE941925AB6F00A911A9 /* CCProfiling.cpp in Sources */,
@ -6826,6 +6899,7 @@
2905FA7518CF08D100240AA3 /* UIScrollView.cpp in Sources */,
1A8C5A0E180E930E00EF57C3 /* DictionaryHelper.cpp in Sources */,
1ABA68AF1888D700007D1BB4 /* CCFontCharMap.cpp in Sources */,
0634A4DD194B19E400E608AF /* CCNodeReader.cpp in Sources */,
50ABBE7A1925AB6F00A911A9 /* CCEventMouse.cpp in Sources */,
50ABBD981925AB4100A911A9 /* CCGLProgramStateCache.cpp in Sources */,
B6B26344193884D60088FE25 /* CCAnimation3D.cpp in Sources */,

View File

@ -804,6 +804,10 @@
29080DE4191B595E0066F8DF /* UIWidgetAddNodeTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29080D89191B595E0066F8DF /* UIWidgetAddNodeTest.cpp */; };
29080DE5191B595E0066F8DF /* UIWidgetAddNodeTest_Editor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29080D8B191B595E0066F8DF /* UIWidgetAddNodeTest_Editor.cpp */; };
29080DE6191B595E0066F8DF /* UIWidgetAddNodeTest_Editor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29080D8B191B595E0066F8DF /* UIWidgetAddNodeTest_Editor.cpp */; };
38FA2E73194AEBE100FF2BE4 /* ActionTimelineTestScene.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 38FA2E71194AEBE100FF2BE4 /* ActionTimelineTestScene.cpp */; };
38FA2E74194AEBE100FF2BE4 /* ActionTimelineTestScene.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 38FA2E71194AEBE100FF2BE4 /* ActionTimelineTestScene.cpp */; };
38FA2E76194AECF800FF2BE4 /* ActionTimeline in Resources */ = {isa = PBXBuildFile; fileRef = 38FA2E75194AECF800FF2BE4 /* ActionTimeline */; };
38FA2E77194AECF800FF2BE4 /* ActionTimeline in Resources */ = {isa = PBXBuildFile; fileRef = 38FA2E75194AECF800FF2BE4 /* ActionTimeline */; };
3E92EA821921A1400094CD21 /* Sprite3DTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E92EA801921A1400094CD21 /* Sprite3DTest.cpp */; };
3E92EA831921A1400094CD21 /* Sprite3DTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3E92EA801921A1400094CD21 /* Sprite3DTest.cpp */; };
3E92EA851921A7720094CD21 /* Sprite3DTest in Resources */ = {isa = PBXBuildFile; fileRef = 3E92EA841921A7720094CD21 /* Sprite3DTest */; };
@ -1840,6 +1844,9 @@
29080D8A191B595E0066F8DF /* UIWidgetAddNodeTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIWidgetAddNodeTest.h; sourceTree = "<group>"; };
29080D8B191B595E0066F8DF /* UIWidgetAddNodeTest_Editor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIWidgetAddNodeTest_Editor.cpp; sourceTree = "<group>"; };
29080D8C191B595E0066F8DF /* UIWidgetAddNodeTest_Editor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIWidgetAddNodeTest_Editor.h; sourceTree = "<group>"; };
38FA2E71194AEBE100FF2BE4 /* ActionTimelineTestScene.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ActionTimelineTestScene.cpp; sourceTree = "<group>"; };
38FA2E72194AEBE100FF2BE4 /* ActionTimelineTestScene.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ActionTimelineTestScene.h; sourceTree = "<group>"; };
38FA2E75194AECF800FF2BE4 /* ActionTimeline */ = {isa = PBXFileReference; lastKnownFileType = folder; name = ActionTimeline; path = "../tests/cpp-tests/Resources/ActionTimeline"; sourceTree = "<group>"; };
3E92EA801921A1400094CD21 /* Sprite3DTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Sprite3DTest.cpp; path = Sprite3DTest/Sprite3DTest.cpp; sourceTree = "<group>"; };
3E92EA811921A1400094CD21 /* Sprite3DTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Sprite3DTest.h; path = Sprite3DTest/Sprite3DTest.h; sourceTree = "<group>"; };
3E92EA841921A7720094CD21 /* Sprite3DTest */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Sprite3DTest; path = "../tests/cpp-tests/Resources/Sprite3DTest"; sourceTree = "<group>"; };
@ -2541,6 +2548,7 @@
1AC359B418CECF0B00F37B72 /* ExtensionsTest */ = {
isa = PBXGroup;
children = (
38FA2E70194AEBE100FF2BE4 /* CocoStudioActionTimelineTest */,
1AC359B518CECF0B00F37B72 /* CocosBuilderTest */,
1AC359DC18CECF0B00F37B72 /* CocoStudioArmatureTest */,
1AC359DF18CECF0B00F37B72 /* CocoStudioComponentsTest */,
@ -3240,6 +3248,7 @@
1AC35CA818CED83500F37B72 /* Resources */ = {
isa = PBXGroup;
children = (
38FA2E75194AECF800FF2BE4 /* ActionTimeline */,
B2507B6A192589AF00FA4972 /* Shaders3D */,
3E92EA841921A7720094CD21 /* Sprite3DTest */,
3EA0FB5D191B92F100B170C8 /* cocosvideo.mp4 */,
@ -3757,6 +3766,15 @@
name = Frameworks;
sourceTree = "<group>";
};
38FA2E70194AEBE100FF2BE4 /* CocoStudioActionTimelineTest */ = {
isa = PBXGroup;
children = (
38FA2E71194AEBE100FF2BE4 /* ActionTimelineTestScene.cpp */,
38FA2E72194AEBE100FF2BE4 /* ActionTimelineTestScene.h */,
);
path = CocoStudioActionTimelineTest;
sourceTree = "<group>";
};
3E92EA7D1921A0C60094CD21 /* Sprite3DTest */ = {
isa = PBXGroup;
children = (
@ -4383,6 +4401,7 @@
1AC35CE018CED84500F37B72 /* configs in Resources */,
1AC35CE618CED84500F37B72 /* effect2.ogg in Resources */,
1AC35CFA18CED84500F37B72 /* Misc in Resources */,
38FA2E76194AECF800FF2BE4 /* ActionTimeline in Resources */,
1AC35D0418CED84500F37B72 /* Shaders in Resources */,
1AC35CD818CED84500F37B72 /* CocosBuilderExample.ccbresourcelog in Resources */,
B2507B6B192589AF00FA4972 /* Shaders3D in Resources */,
@ -4451,6 +4470,7 @@
1AC35CF318CED84500F37B72 /* Hello.png in Resources */,
1AC35C8F18CECF1400F37B72 /* Icon-152.png in Resources */,
1AC35CE718CED84500F37B72 /* effect2.ogg in Resources */,
38FA2E77194AECF800FF2BE4 /* ActionTimeline in Resources */,
1AC35C9718CECF1400F37B72 /* Icon-80.png in Resources */,
1AC35CEB18CED84500F37B72 /* fileLookup.plist in Resources */,
1AC35CFD18CED84500F37B72 /* music.mid in Resources */,
@ -4686,6 +4706,7 @@
1AC35C2B18CECF0C00F37B72 /* PerformanceLabelTest.cpp in Sources */,
1AC35C0118CECF0C00F37B72 /* TableViewTestScene.cpp in Sources */,
1AC35C4B18CECF0C00F37B72 /* ShaderTest2.cpp in Sources */,
38FA2E73194AEBE100FF2BE4 /* ActionTimelineTestScene.cpp in Sources */,
1AC35C6518CECF0C00F37B72 /* UnitTest.cpp in Sources */,
29080DC9191B595E0066F8DF /* UISceneManager_Editor.cpp in Sources */,
1AC35B3F18CECF0C00F37B72 /* Bug-458.cpp in Sources */,
@ -4729,6 +4750,7 @@
29080D8E191B595E0066F8DF /* CocosGUIScene.cpp in Sources */,
1AC35BFA18CECF0C00F37B72 /* WebSocketTest.cpp in Sources */,
1AC35BF218CECF0C00F37B72 /* EditBoxTest.cpp in Sources */,
38FA2E74194AEBE100FF2BE4 /* ActionTimelineTestScene.cpp in Sources */,
1AC35B3A18CECF0C00F37B72 /* Bug-1174.cpp in Sources */,
1AC35BE418CECF0C00F37B72 /* CCControlColourPickerTest.cpp in Sources */,
29080DD4191B595E0066F8DF /* UITextAtlasTest.cpp in Sources */,

View File

@ -9,14 +9,15 @@
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<StackPanel Orientation="Horizontal" Margin="40,100,0,0" Height="50" VerticalAlignment="Top">
<TextBlock Text="Memory: " FontSize="36"/>
<TextBlock x:Name="MemoryTextBlock" FontSize="36"/>
<TextBlock Text=" MB" FontSize="36"/>
<TextBlock Text=" Peak: " FontSize="36"/>
<TextBlock x:Name="PeakMemoryTextBlock" FontSize="36"/>
<TextBlock Text=" MB" FontSize="36"/>
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Horizontal" Margin="40,100,0,0" Height="50" VerticalAlignment="Top">
<TextBlock Text="Save file to cocos\platform\wp8\shaders\precompiledshaders.h" FontSize="36"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="40,100,0,0" Height="50" VerticalAlignment="Top">
<TextBlock Text="Result: " FontSize="36"/>
<TextBlock Text="" FontSize="36" x:Name="ResultText" />
</StackPanel>
<Button Margin="40,100,0,0" x:Name="compileButton" Content="Compile" Width="150" Click="OnCompile" />
</StackPanel>
<Button Margin="40,10,0,0" x:Name="compileButton" Content="Compile" Width="150" Click="OnCompile" />
</Grid>
</Page>

View File

@ -60,7 +60,7 @@ DirectXPage::~DirectXPage()
void DirectXPage::OnCompile(Object^ sender, RoutedEventArgs^ args)
{
compiler.Compile();
compiler.Compile(ResultText);
}
// Saves the current state of the app for suspend and terminate events.

View File

@ -35,7 +35,11 @@ using namespace Windows::UI::Core;
USING_NS_CC;
ShaderCompiler::ShaderCompiler() : m_display(nullptr), m_context(nullptr), m_initialized(false)
ShaderCompiler::ShaderCompiler()
: m_display(nullptr),
m_context(nullptr),
m_initialized(false),
m_resultText(nullptr)
{
}
@ -64,14 +68,22 @@ void ShaderCompiler::applicationWillEnterForeground()
}
bool ShaderCompiler::Compile()
bool ShaderCompiler::Compile(Windows::UI::Xaml::Controls::TextBlock^ resultText)
{
m_resultText = resultText;
resultText->Text = "Compiling shaders...";
if (!InitializeAngle(ANGLE_D3D_FEATURE_LEVEL::ANGLE_D3D_FEATURE_LEVEL_9_3))
{
resultText->Text = "Unable to initialize Angle";
return false;
}
bool result = InitializeAngle(ANGLE_D3D_FEATURE_LEVEL::ANGLE_D3D_FEATURE_LEVEL_9_3);
Director::getInstance()->setAnimationInterval(1.0 / 60.0);
CCShaderCache::getInstance()->loadDefaultShaders();
CCPrecompiledShaders::getInstance()->savePrecompiledShaders();
return result;
resultText->Text = "Complete";
return true;
}

View File

@ -34,10 +34,12 @@ class ShaderCompiler : private cocos2d::Application
public:
ShaderCompiler();
~ShaderCompiler();
bool Compile();
bool Compile(Windows::UI::Xaml::Controls::TextBlock^ resultText);
private:
Windows::UI::Xaml::Controls::TextBlock^ m_resultText;
virtual bool applicationDidFinishLaunching();
virtual void applicationDidEnterBackground();
virtual void applicationWillEnterForeground();

View File

@ -13,4 +13,4 @@
#include <agile.h>
#include <concrt.h>
#include <collection.h>
#include "App.xaml.h"
#include "App.xaml.h"

View File

@ -0,0 +1,7 @@
How to compile precompiled shaders for Windows Phone 8.0 (WP8)
1. Open the VS project Cocos2dShaderCompiler\Cocos2dShaderCompiler.sln
2. Build and run the project
3. Click the Compile button
4. Select the file cocos\platform\wp8\shaders\precompiledshaders.h in the file dialog box
5. Program will precompile all of the cached cocos2d-x shaders.

View File

@ -138,4 +138,4 @@ protected:
NS_CC_END
#endif //__CCCAMERA_ACTION_H__
#endif //__CCCAMERA_ACTION_H__

View File

@ -201,4 +201,4 @@ Animation* Animation::clone() const
return a;
}
NS_CC_END
NS_CC_END

View File

@ -237,4 +237,4 @@ void AnimationCache::addAnimationsWithFile(const std::string& plist)
}
NS_CC_END
NS_CC_END

View File

@ -160,4 +160,4 @@ FontAtlas * FontCharMap::createFontAtlas()
return tempAtlas;
}
NS_CC_END
NS_CC_END

View File

@ -74,4 +74,4 @@ private:
};
NS_CC_END
#endif
#endif

View File

@ -110,4 +110,4 @@ protected:
NS_CC_END
#endif //__CCTMX_OBJECT_GROUP_H__
#endif //__CCTMX_OBJECT_GROUP_H__

View File

@ -99,6 +99,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\jpeg\prebuilt\win32\*.*" "$(OutDir)"
xcopy /Y /Q "$(ProjectDir)..\..\external\png\prebuilt\win32\*.*" "$(OutDir)"
xcopy /Y /Q "$(ProjectDir)..\..\external\tiff\prebuilt\win32\*.*" "$(OutDir)"
xcopy /Y /Q "$(ProjectDir)..\..\external\webp\prebuilt\win32\*.*" "$(OutDir)"
xcopy /Y /Q "$(ProjectDir)..\..\external\websockets\prebuilt\win32\*.*" "$(OutDir)"
xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\zlib\prebuilt\*.*" "$(OutDir)"
xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\icon\prebuilt\*.*" "$(OutDir)"
xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(OutDir)"
@ -125,16 +126,18 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou
</Command>
</PreBuildEvent>
<ClCompile>
<AdditionalIncludeDirectories>$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\include;$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\win32;$(EngineRoot)external\jpeg\include\win32;$(EngineRoot)external\tiff\include\win32;$(EngineRoot)external\webp\include\win32;$(EngineRoot)external\freetype2\include\win32;$(EngineRoot)external\win32-specific\icon\include;$(EngineRoot)external\win32-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\xxhash;$(EngineRoot)external\ConvertUTF;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\include;$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\win32;$(EngineRoot)external\jpeg\include\win32;$(EngineRoot)external\tiff\include\win32;$(EngineRoot)external\webp\include\win32;$(EngineRoot)external\freetype2\include\win32;$(EngineRoot)external\win32-specific\icon\include;$(EngineRoot)external\win32-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\xxhash;$(EngineRoot)external\ConvertUTF;$(EngineRoot)external;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_LIB;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DebugInformationFormat>None</DebugInformationFormat>
<DisableSpecificWarnings>4267;4251;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<CompileAs>CompileAsCpp</CompileAs>
<WholeProgramOptimization>false</WholeProgramOptimization>
<Optimization>MinSpace</Optimization>
</ClCompile>
<PreLinkEvent>
<Command>if not exist "$(OutDir)" mkdir "$(OutDir)"
@ -145,6 +148,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\jpeg\prebuilt\win32\*.*" "$(OutDir)"
xcopy /Y /Q "$(ProjectDir)..\..\external\png\prebuilt\win32\*.*" "$(OutDir)"
xcopy /Y /Q "$(ProjectDir)..\..\external\tiff\prebuilt\win32\*.*" "$(OutDir)"
xcopy /Y /Q "$(ProjectDir)..\..\external\webp\prebuilt\win32\*.*" "$(OutDir)"
xcopy /Y /Q "$(ProjectDir)..\..\external\websockets\prebuilt\win32\*.*" "$(OutDir)"
xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\zlib\prebuilt\*.*" "$(OutDir)"
xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\icon\prebuilt\*.*" "$(OutDir)"
xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(OutDir)"

View File

@ -139,7 +139,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<CompileAsWinRT>true</CompileAsWinRT>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\winrt;$(EngineRoot)external\jpeg\include\winrt;$(EngineRoot)external\tiff\include\winrt;$(EngineRoot)external\webp\include\win32;$(EngineRoot)external\freetype2\include\winrt;$(EngineRoot)external\winrt-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(EngineRoot)external;$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\winrt;$(EngineRoot)external\jpeg\include\winrt;$(EngineRoot)external\tiff\include\winrt;$(EngineRoot)external\webp\include\win32;$(EngineRoot)external\freetype2\include\winrt;$(EngineRoot)external\winrt-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WINRT;_DEBUG;_LIB;GL_GLEXT_PROTOTYPES;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DisableSpecificWarnings>4267;4251;4244;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
@ -160,7 +160,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<CompileAsWinRT>true</CompileAsWinRT>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\winrt;$(EngineRoot)external\jpeg\include\winrt;$(EngineRoot)external\tiff\include\winrt;$(EngineRoot)external\webp\include\win32;$(EngineRoot)external\freetype2\include\winrt;$(EngineRoot)external\winrt-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(EngineRoot)external;$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\winrt;$(EngineRoot)external\jpeg\include\winrt;$(EngineRoot)external\tiff\include\winrt;$(EngineRoot)external\webp\include\win32;$(EngineRoot)external\freetype2\include\winrt;$(EngineRoot)external\winrt-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WINRT;NDEBUG;_LIB;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DisableSpecificWarnings>4267;4251;4244;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
@ -181,7 +181,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<CompileAsWinRT>true</CompileAsWinRT>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\winrt;$(EngineRoot)external\jpeg\include\winrt;$(EngineRoot)external\tiff\include\winrt;$(EngineRoot)external\webp\include\win32;$(EngineRoot)external\freetype2\include\winrt;$(EngineRoot)external\winrt-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(EngineRoot)external;$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\winrt;$(EngineRoot)external\jpeg\include\winrt;$(EngineRoot)external\tiff\include\winrt;$(EngineRoot)external\webp\include\win32;$(EngineRoot)external\freetype2\include\winrt;$(EngineRoot)external\winrt-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WINRT;_DEBUG;_LIB;GL_GLEXT_PROTOTYPES;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DisableSpecificWarnings>4267;4251;4244;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
@ -202,7 +202,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<CompileAsWinRT>true</CompileAsWinRT>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\winrt;$(EngineRoot)external\jpeg\include\winrt;$(EngineRoot)external\tiff\include\winrt;$(EngineRoot)external\webp\include\win32;$(EngineRoot)external\freetype2\include\winrt;$(EngineRoot)external\winrt-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(EngineRoot)external;$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\winrt;$(EngineRoot)external\jpeg\include\winrt;$(EngineRoot)external\tiff\include\winrt;$(EngineRoot)external\webp\include\win32;$(EngineRoot)external\freetype2\include\winrt;$(EngineRoot)external\winrt-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WINRT;NDEBUG;_LIB;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DisableSpecificWarnings>4267;4251;4244;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
@ -223,7 +223,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<CompileAsWinRT>true</CompileAsWinRT>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\winrt;$(EngineRoot)external\jpeg\include\winrt;$(EngineRoot)external\tiff\include\winrt;$(EngineRoot)external\webp\include\win32;$(EngineRoot)external\freetype2\include\winrt;$(EngineRoot)external\winrt-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(EngineRoot)external;$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\winrt;$(EngineRoot)external\jpeg\include\winrt;$(EngineRoot)external\tiff\include\winrt;$(EngineRoot)external\webp\include\win32;$(EngineRoot)external\freetype2\include\winrt;$(EngineRoot)external\winrt-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WINRT;_DEBUG;_LIB;GL_GLEXT_PROTOTYPES;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DisableSpecificWarnings>4267;4251;4244;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
@ -244,7 +244,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<CompileAsWinRT>true</CompileAsWinRT>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\winrt;$(EngineRoot)external\jpeg\include\winrt;$(EngineRoot)external\tiff\include\winrt;$(EngineRoot)external\webp\include\win32;$(EngineRoot)external\freetype2\include\winrt;$(EngineRoot)external\winrt-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(EngineRoot)external;$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\winrt;$(EngineRoot)external\jpeg\include\winrt;$(EngineRoot)external\tiff\include\winrt;$(EngineRoot)external\webp\include\win32;$(EngineRoot)external\freetype2\include\winrt;$(EngineRoot)external\winrt-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WINRT;NDEBUG;_LIB;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DisableSpecificWarnings>4267;4251;4244;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
@ -312,7 +312,6 @@
<ClCompile Include="..\3d\CCMesh.cpp" />
<ClCompile Include="..\3d\CCObjLoader.cpp" />
<ClCompile Include="..\3d\CCSprite3D.cpp" />
<ClCompile Include="..\3d\CCSprite3DDataCache.cpp" />
<ClCompile Include="..\base\atitc.cpp" />
<ClCompile Include="..\base\base64.cpp" />
<ClCompile Include="..\base\CCAutoreleasePool.cpp" />
@ -505,7 +504,6 @@
<ClInclude Include="..\3d\CCMesh.h" />
<ClInclude Include="..\3d\CCObjLoader.h" />
<ClInclude Include="..\3d\CCSprite3D.h" />
<ClInclude Include="..\3d\CCSprite3DDataCache.h" />
<ClInclude Include="..\base\atitc.h" />
<ClInclude Include="..\base\base64.h" />
<ClInclude Include="..\base\CCAutoreleasePool.h" />

View File

@ -308,9 +308,6 @@
<ClCompile Include="..\3d\CCSprite3D.cpp">
<Filter>3d</Filter>
</ClCompile>
<ClCompile Include="..\3d\CCSprite3DDataCache.cpp">
<Filter>3d</Filter>
</ClCompile>
<ClCompile Include="..\base\atitc.cpp">
<Filter>base</Filter>
</ClCompile>
@ -858,9 +855,6 @@
<ClInclude Include="..\3d\CCSprite3D.h">
<Filter>3d</Filter>
</ClInclude>
<ClInclude Include="..\3d\CCSprite3DDataCache.h">
<Filter>3d</Filter>
</ClInclude>
<ClInclude Include="..\base\atitc.h">
<Filter>base</Filter>
</ClInclude>

View File

@ -179,4 +179,4 @@ OSStatus AudioSessionGetProperty(UInt32 inID, UInt32 *ioDataSize, void *outData)
- (BOOL)setPreferredIOBufferDuration:(NSTimeInterval)duration error:(NSError**)outError {return YES;}
@end
#endif
#endif

View File

@ -23,8 +23,8 @@
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v120_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v120_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
@ -32,8 +32,8 @@
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v120_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v120_xp</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
@ -103,9 +103,11 @@
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DebugInformationFormat>None</DebugInformationFormat>
<DisableSpecificWarnings>4251</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<Optimization>MinSpace</Optimization>
<WholeProgramOptimization>false</WholeProgramOptimization>
</ClCompile>
<Link>
<AdditionalDependencies>winmm.lib;libcocos2d.lib;%(AdditionalDependencies)</AdditionalDependencies>

View File

@ -212,4 +212,4 @@ void MediaStreamer::Restart()
ThrowIfFailed(
m_reader->SetCurrentPosition(GUID_NULL, var)
);
}
}

View File

@ -38,4 +38,4 @@ public:
bool GetNextBuffer(uint8* buffer, uint32 maxBufferSize, uint32* bufferLength);
void ReadAll(uint8* buffer, uint32 maxBufferSize, uint32* bufferLength);
void Restart();
};
};

View File

@ -213,4 +213,4 @@ void MediaStreamer::ReadAll(uint8* buffer, uint32 maxBufferSize, uint32* bufferL
void MediaStreamer::Restart()
{
m_offset = 0;
}
}

View File

@ -55,4 +55,4 @@ internal:
void Initialize(_In_ const WCHAR* url);
void ReadAll(uint8* buffer, uint32 maxBufferSize, uint32* bufferLength);
void Restart();
};
};

View File

@ -39,4 +39,4 @@ _widgetGetFocus(widgetGetFocus)
NS_CC_END
NS_CC_END

View File

@ -22,6 +22,7 @@
THE SOFTWARE.
****************************************************************************/
#include "base/CCConsole.h"
#include "base/CCEventListener.h"
#include "platform/CCCommon.h"

View File

@ -95,4 +95,4 @@ bool EventListenerFocus::checkAvailable()
NS_CC_END
NS_CC_END

View File

@ -109,4 +109,4 @@ bool EventListenerMouse::init()
return false;
}
NS_CC_END
NS_CC_END

View File

@ -187,4 +187,4 @@ EventListenerTouchAllAtOnce* EventListenerTouchAllAtOnce::clone()
return ret;
}
NS_CC_END
NS_CC_END

View File

@ -38,4 +38,4 @@ EventMouse::EventMouse(MouseEventType mouseEventCode)
{
};
NS_CC_END
NS_CC_END

View File

@ -70,4 +70,4 @@ Vec2 Touch::getDelta() const
return getLocation() - getPreviousLocation();
}
NS_CC_END
NS_CC_END

View File

@ -26,6 +26,7 @@
#define __CCINTEGER_H__
#include "base/CCRef.h"
#include "base/CCConsole.h"
#include "base/CCDataVisitor.h"
#include "platform/CCCommon.h"

View File

@ -86,4 +86,4 @@ void CCBSequence::setChainedSequenceId(int nChainedSequenceId)
mChainedSequenceId = nChainedSequenceId;
}
}
}

View File

@ -114,4 +114,4 @@ void ControlButtonLoader::onHandlePropTypeColor3(Node * pNode, Node * pParent, c
}
}
};
};

View File

@ -27,4 +27,4 @@ void ControlLoader::onHandlePropTypeBlockControl(Node * pNode, Node * pParent, c
}
}
}
}

View File

@ -50,4 +50,4 @@ void LabelBMFontLoader::onHandlePropTypeText(Node * pNode, Node * pParent, const
}
}
}
}

View File

@ -80,4 +80,4 @@ void LabelTTFLoader::onHandlePropTypeSize(Node * pNode, Node * pParent, const ch
}
}
}
}

View File

@ -32,4 +32,4 @@ void LayerColorLoader::onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, c
}
}
}
}

View File

@ -42,4 +42,4 @@ void LayerLoader::onHandlePropTypeCheck(Node * pNode, Node * pParent, const char
#pragma GCC diagnostic warning "-Wdeprecated-declarations"
#elif _MSC_VER >= 1400 //vs 2005 or higher
#pragma warning (pop)
#endif
#endif

View File

@ -27,4 +27,4 @@ void MenuItemLoader::onHandlePropTypeCheck(Node * pNode, Node * pParent, const c
}
}
}
}

View File

@ -102,4 +102,4 @@ NodeLoaderLibrary * NodeLoaderLibrary::newDefaultNodeLoaderLibrary() {
return ccNodeLoaderLibrary;
}
}
}

View File

@ -137,4 +137,4 @@ void ParticleSystemQuadLoader::onHandlePropTypeTexture(Node * pNode, Node * pPar
}
}
}
}

View File

@ -54,4 +54,4 @@ void ScrollViewLoader::onHandlePropTypeIntegerLabeled(Node * pNode, Node * pPare
}
}
}
}

View File

@ -21,8 +21,8 @@
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v120_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v120_xp</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
@ -31,8 +31,8 @@
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v120_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v120_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
@ -76,13 +76,15 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<Optimization>MinSpace</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>
</SDLCheck>
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)extensions;$(EngineRoot)cocos\audio\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WINDOWS;_LIB;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DebugInformationFormat>None</DebugInformationFormat>
<WholeProgramOptimization>false</WholeProgramOptimization>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>

View File

@ -0,0 +1,278 @@
/****************************************************************************
Copyright (c) 2013 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.
****************************************************************************/
#include "CCActionTimeline.h"
USING_NS_CC;
NS_TIMELINE_BEGIN
// ActionTimelineData
ActionTimelineData* ActionTimelineData::create(int actionTag)
{
ActionTimelineData * ret = new ActionTimelineData();
if (ret && ret->init(actionTag))
{
ret->autorelease();
}
else
{
CC_SAFE_DELETE(ret);
}
return ret;
}
ActionTimelineData::ActionTimelineData()
: _actionTag(0)
{
}
bool ActionTimelineData::init(int actionTag)
{
_actionTag = actionTag;
return true;
}
// ActionTimeline
ActionTimeline* ActionTimeline::create()
{
ActionTimeline* object = new ActionTimeline();
if (object && object->init())
{
object->autorelease();
return object;
}
CC_SAFE_DELETE(object);
return nullptr;
}
ActionTimeline::ActionTimeline()
: _duration(0)
, _time(0)
, _timeSpeed(1)
, _frameInternal(1/60.0f)
, _playing(false)
, _currentFrame(0)
, _startFrame(0)
, _endFrame(0)
, _frameEventListener(nullptr)
{
}
ActionTimeline::~ActionTimeline()
{
}
bool ActionTimeline::init()
{
return true;
}
void ActionTimeline::gotoFrameAndPlay(int startIndex)
{
gotoFrameAndPlay(startIndex, true);
}
void ActionTimeline::gotoFrameAndPlay(int startIndex, bool loop)
{
gotoFrameAndPlay(startIndex, _duration, loop);
}
void ActionTimeline::gotoFrameAndPlay(int startIndex, int endIndex, bool loop)
{
_startFrame = _currentFrame = startIndex;
_endFrame = endIndex;
_loop = loop;
_time = _currentFrame * _frameInternal;
resume();
gotoFrame(_currentFrame);
}
void ActionTimeline::gotoFrameAndPause(int startIndex)
{
_startFrame = _currentFrame = startIndex;
_time = _currentFrame * _frameInternal;
pause();
gotoFrame(_currentFrame);
}
void ActionTimeline::pause()
{
_playing = false;
}
void ActionTimeline::resume()
{
_playing = true;
}
bool ActionTimeline::isPlaying() const
{
return _playing;
}
ActionTimeline* ActionTimeline::clone() const
{
ActionTimeline* newAction = ActionTimeline::create();
newAction->setDuration(_duration);
newAction->setTimeSpeed(_timeSpeed);
for (auto timelines : _timelineMap)
{
for(auto timeline : timelines.second)
{
Timeline* newTimeline = timeline->clone();
newAction->addTimeline(newTimeline);
}
}
return newAction;
}
void ActionTimeline::step(float delta)
{
if (!_playing || _timelineMap.size() == 0 || _duration == 0)
{
return;
}
_time += delta * _timeSpeed;
_currentFrame = (int)(_time / _frameInternal);
stepToFrame(_currentFrame);
if(_time > _endFrame * _frameInternal)
{
_playing = _loop;
if(!_playing)
_time = _endFrame * _frameInternal;
else
_time = _startFrame * _frameInternal;
}
}
typedef std::function<void(Node*)> tCallBack;
void foreachNodeDescendant(Node* parent, tCallBack callback)
{
callback(parent);
auto children = parent->getChildren();
for (auto child : children)
{
foreachNodeDescendant(child, callback);
}
}
void ActionTimeline::startWithTarget(Node *target)
{
Action::startWithTarget(target);
foreachNodeDescendant(target,
[this, target](Node* child)
{
ActionTimelineData* data = dynamic_cast<ActionTimelineData*>(child->getUserObject());
int actionTag = data->getActionTag();
if(_timelineMap.find(actionTag) != _timelineMap.end())
{
auto timelines = this->_timelineMap[actionTag];
for (auto timeline : timelines)
{
timeline->setNode(child);
}
}
});
}
void ActionTimeline::addTimeline(Timeline* timeline)
{
int tag = timeline->getActionTag();
if (_timelineMap.find(tag) == _timelineMap.end())
{
_timelineMap[tag] = Vector<Timeline*>();
}
if (!_timelineMap[tag].contains(timeline))
{
_timelineList.pushBack(timeline);
_timelineMap[tag].pushBack(timeline);
timeline->setActionTimeline(this);
}
}
void ActionTimeline::removeTimeline(Timeline* timeline)
{
int tag = timeline->getActionTag();
if (_timelineMap.find(tag) != _timelineMap.end())
{
if(_timelineMap[tag].contains(timeline))
{
_timelineMap[tag].eraseObject(timeline);
_timelineList.eraseObject(timeline);
timeline->setActionTimeline(nullptr);
}
}
}
void ActionTimeline::setFrameEventCallFunc(std::function<void(Frame *)> listener)
{
_frameEventListener = listener;
}
void ActionTimeline::clearFrameEventCallFunc()
{
_frameEventListener = nullptr;
}
void ActionTimeline::emitFrameEvent(Frame* frame)
{
if(_frameEventListener)
{
_frameEventListener(frame);
}
}
void ActionTimeline::gotoFrame(int frameIndex)
{
int size = _timelineList.size();
for(int i = 0; i<size; i++)
{
_timelineList.at(i)->gotoFrame(frameIndex);
}
}
void ActionTimeline::stepToFrame(int frameIndex)
{
int size = _timelineList.size();
for(int i = 0; i<size; i++)
{
_timelineList.at(i)->stepToFrame(frameIndex);
}
}
NS_TIMELINE_END

View File

@ -0,0 +1,160 @@
/****************************************************************************
Copyright (c) 2013 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 __CCTIMELINE_ACTION_H__
#define __CCTIMELINE_ACTION_H__
#include "CCTimeLine.h"
#include "renderer/CCRenderer.h"
NS_TIMELINE_BEGIN
class ActionTimelineData : public cocos2d::Ref
{
public:
static ActionTimelineData* create(int actionTag);
virtual void setActionTag(int actionTag) { _actionTag = actionTag; }
virtual int getActionTag() const { return _actionTag; }
protected:
ActionTimelineData();
virtual bool init(int actionTag);
int _actionTag;
};
class ActionTimeline : public cocos2d::Action
{
public:
friend class Frame;
static ActionTimeline* create();
ActionTimeline();
virtual ~ActionTimeline();
virtual bool init();
/** Goto the specified frame index, and start playing from this index.
* @param startIndex The animation will play from this index.
*/
virtual void gotoFrameAndPlay(int startIndex);
/** Goto the specified frame index, and start playing from this index.
* @param startIndex The animation will play from this index.
* @param loop Whether or not the animation need loop.
*/
virtual void gotoFrameAndPlay(int startIndex, bool loop);
/** Goto the specified frame index, and start playing from start index, end at end index.
* @param startIndex The animation will play from this index.
* @param endIndex The animation will end at this index.
* @param loop Whether or not the animation need loop.
*/
virtual void gotoFrameAndPlay(int startIndex, int endIndex, bool loop);
/** Goto the specified frame index, and pause at this index.
* @param startIndex The animation will pause at this index.
*/
virtual void gotoFrameAndPause(int startIndex);
/** Pause the animation. */
virtual void pause();
/** Resume the animation. */
virtual void resume();
/** Whether or not Action is playing. */
virtual bool isPlaying() const;
/** Set the animation speed, this will speed up or slow down the speed. */
virtual void setTimeSpeed(float speed) { _timeSpeed = speed; }
/** Get current animation speed. */
virtual float getTimeSpeed() const { return _timeSpeed; }
/** duration of the whole action*/
virtual void setDuration(int duration) { _duration = duration; }
virtual int getDuration() const { return _duration; }
/** Start frame index of this action*/
virtual int getStartFrame() const { return _startFrame; }
/** End frame of this action.
* When action play to this frame, if action is not loop, then it will stop,
* or it will play from start frame again. */
virtual int getEndFrame() const { return _endFrame; }
/** Get current frame. */
virtual int getCurrentFrame() const { return _currentFrame; }
/** add Timeline to ActionTimeline */
virtual void addTimeline(Timeline* timeline);
virtual void removeTimeline(Timeline* timeline);
virtual const cocos2d::Vector<Timeline*>& getTimelines() const { return _timelineList; }
/** Set ActionTimeline's frame event callback function */
void setFrameEventCallFunc(std::function<void(Frame *)> listener);
void clearFrameEventCallFunc();
/** Inherit from Action. */
/** Returns a clone of ActionTimeline */
virtual ActionTimeline* clone() const override;
/** Returns a reverse of ActionTimeline.
* Not implement yet.
*/
virtual ActionTimeline* reverse() const override { return nullptr; }
virtual void step(float delta) override;
virtual void startWithTarget(cocos2d::Node *target) override;
virtual bool isDone() const override { return false; }
protected:
virtual void gotoFrame(int frameIndex);
virtual void stepToFrame(int frameIndex);
/** emit frame event, call it when enter a frame*/
virtual void emitFrameEvent(Frame* frame);
std::map<int, cocos2d::Vector<Timeline*>> _timelineMap;
cocos2d::Vector<Timeline*> _timelineList;
int _duration;
double _time;
float _timeSpeed;
float _frameInternal;
bool _playing;
int _currentFrame;
int _startFrame;
int _endFrame;
bool _loop;
std::function<void(Frame*)> _frameEventListener;
};
NS_TIMELINE_END
#endif /*__CCTIMELINE_ACTION_H__*/

View File

@ -0,0 +1,374 @@
/****************************************************************************
Copyright (c) 2013 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.
****************************************************************************/
#include "CCActionTimelineCache.h"
#include "CCNodeReader.h"
#include "CCFrame.h"
#include "CCTimeLine.h"
#include "CCActionTimeline.h"
using namespace cocos2d;
namespace cocostudio {
namespace timeline{
static const char* FrameType_VisibleFrame = "VisibleFrame";
static const char* FrameType_PositionFrame = "PositionFrame";
static const char* FrameType_ScaleFrame = "ScaleFrame";
static const char* FrameType_RotationFrame = "RotationFrame";
static const char* FrameType_SkewFrame = "SkewFrame";
static const char* FrameType_RotationSkewFrame = "RotationSkewFrame";
static const char* FrameType_AnchorFrame = "AnchorFrame";
static const char* FrameType_InnerActionFrame = "InnerActionFrame";
static const char* FrameType_ColorFrame = "ColorFrame";
static const char* FrameType_TextureFrame = "TextureFrame";
static const char* FrameType_EventFrame = "EventFrame";
static const char* FrameType_ZOrderFrame = "ZOrderFrame";
static const char* ACTION = "action";
static const char* DURATION = "duration";
static const char* TIMELINES = "timelines";
static const char* FRAME_TYPE = "frameType";
static const char* FRAMES = "frames";
static const char* FRAME_INDEX = "frameIndex";
static const char* TWEEN = "tween";
static const char* TIME_SPEED = "speed";
static const char* ACTION_TAG = "actionTag";
static const char* INNER_ACTION = "innerActionType";
static const char* START_FRAME = "startFrame";
static const char* X = "x";
static const char* Y = "y";
static const char* ROTATION = "rotation";
static const char* ALPHA = "alpha";
static const char* RED = "red";
static const char* GREEN = "green";
static const char* BLUE = "blue";
static const char* Value = "value";
static ActionTimelineCache* _sharedActionCache = nullptr;
ActionTimelineCache* ActionTimelineCache::getInstance()
{
if (! _sharedActionCache)
{
_sharedActionCache = new ActionTimelineCache();
_sharedActionCache->init();
}
return _sharedActionCache;
}
void ActionTimelineCache::destroyInstance()
{
CC_SAFE_DELETE(_sharedActionCache);
}
void ActionTimelineCache::purge()
{
_animationActions.clear();
}
void ActionTimelineCache::init()
{
using namespace std::placeholders;
_funcs.insert(Pair(FrameType_VisibleFrame, std::bind(&ActionTimelineCache::loadVisibleFrame, this, _1)));
_funcs.insert(Pair(FrameType_PositionFrame, std::bind(&ActionTimelineCache::loadPositionFrame, this, _1)));
_funcs.insert(Pair(FrameType_ScaleFrame, std::bind(&ActionTimelineCache::loadScaleFrame, this, _1)));
_funcs.insert(Pair(FrameType_RotationFrame, std::bind(&ActionTimelineCache::loadRotationFrame, this, _1)));
_funcs.insert(Pair(FrameType_SkewFrame, std::bind(&ActionTimelineCache::loadSkewFrame, this, _1)));
_funcs.insert(Pair(FrameType_RotationSkewFrame, std::bind(&ActionTimelineCache::loadRotationSkewFrame, this, _1)));
_funcs.insert(Pair(FrameType_AnchorFrame, std::bind(&ActionTimelineCache::loadAnchorPointFrame, this, _1)));
_funcs.insert(Pair(FrameType_InnerActionFrame, std::bind(&ActionTimelineCache::loadInnerActionFrame, this, _1)));
_funcs.insert(Pair(FrameType_ColorFrame, std::bind(&ActionTimelineCache::loadColorFrame, this, _1)));
_funcs.insert(Pair(FrameType_TextureFrame, std::bind(&ActionTimelineCache::loadTextureFrame, this, _1)));
_funcs.insert(Pair(FrameType_EventFrame, std::bind(&ActionTimelineCache::loadEventFrame, this, _1)));
_funcs.insert(Pair(FrameType_ZOrderFrame, std::bind(&ActionTimelineCache::loadZOrderFrame, this, _1)));
}
void ActionTimelineCache::removeAction(const std::string& fileName)
{
if (_animationActions.find(fileName) != _animationActions.end())
{
_animationActions.erase(fileName);
}
}
ActionTimeline* ActionTimelineCache::createAction(const std::string& fileName)
{
ActionTimeline* action = _animationActions.at(fileName);
if (action == nullptr)
{
action = loadAnimationActionWithFile(fileName);
}
return action->clone();
}
ActionTimeline* ActionTimelineCache::loadAnimationActionWithFile(const std::string& fileName)
{
// Read content from file
std::string fullPath = CCFileUtils::getInstance()->fullPathForFilename(fileName);
std::string contentStr = FileUtils::getInstance()->getStringFromFile(fullPath);
return loadAnimationActionWithContent(fileName, contentStr);
}
ActionTimeline* ActionTimelineCache::loadAnimationActionWithContent(const std::string&fileName, const std::string& content)
{
// if already exists an action with filename, then return this action
ActionTimeline* action = _animationActions.at(fileName);
if(action)
return action;
rapidjson::Document doc;
doc.Parse<0>(content.c_str());
if (doc.HasParseError())
{
CCLOG("GetParseError %s\n", doc.GetParseError());
}
const rapidjson::Value& json = DICTOOL->getSubDictionary_json(doc, ACTION);
action = ActionTimeline::create();
action->setDuration(DICTOOL->getIntValue_json(json, DURATION));
action->setTimeSpeed(DICTOOL->getFloatValue_json(json, TIME_SPEED, 1.0f));
int timelineLength = DICTOOL->getArrayCount_json(json, TIMELINES);
for (int i = 0; i<timelineLength; i++)
{
const rapidjson::Value& dic = DICTOOL->getSubDictionary_json(json, TIMELINES, i);
Timeline* timeline = loadTimeline(dic);
if(timeline)
action->addTimeline(timeline);
}
_animationActions.insert(fileName, action);
return action;
}
Timeline* ActionTimelineCache::loadTimeline(const rapidjson::Value& json)
{
Timeline* timeline = nullptr;
// get frame type
const char* frameType = DICTOOL->getStringValue_json(json, FRAME_TYPE);
if(frameType == nullptr)
return nullptr;
if(frameType && _funcs.find(frameType) != _funcs.end())
{
timeline = Timeline::create();
int actionTag = DICTOOL->getIntValue_json(json, ACTION_TAG);
timeline->setActionTag(actionTag);
FrameCreateFunc func = _funcs.at(frameType);
int length = DICTOOL->getArrayCount_json(json, FRAMES);
for (int i = 0; i<length; i++)
{
const rapidjson::Value& dic = DICTOOL->getSubDictionary_json(json, FRAMES, i);
Frame* frame = nullptr;
if (func != nullptr)
{
frame = func(dic);
int frameIndex = DICTOOL->getIntValue_json(dic, FRAME_INDEX);
frame->setFrameIndex(frameIndex);
bool tween = DICTOOL->getBooleanValue_json(dic, TWEEN, false);
frame->setTween(tween);
}
timeline->addFrame(frame);
}
}
return timeline;
}
Frame* ActionTimelineCache::loadVisibleFrame(const rapidjson::Value& json)
{
VisibleFrame* frame = VisibleFrame::create();
bool visible = DICTOOL->getBooleanValue_json(json, Value);
frame->setVisible(visible);
return frame;
}
Frame* ActionTimelineCache::loadPositionFrame(const rapidjson::Value& json)
{
PositionFrame* frame = PositionFrame::create();
float x = DICTOOL->getFloatValue_json(json, X);
float y = DICTOOL->getFloatValue_json(json, Y);
frame->setPosition(Point(x,y));
return frame;
}
Frame* ActionTimelineCache::loadScaleFrame(const rapidjson::Value& json)
{
ScaleFrame* frame = ScaleFrame::create();
float scalex = DICTOOL->getFloatValue_json(json, X);
float scaley = DICTOOL->getFloatValue_json(json, Y);
frame->setScaleX(scalex);
frame->setScaleY(scaley);
return frame;
}
Frame* ActionTimelineCache::loadSkewFrame(const rapidjson::Value& json)
{
SkewFrame* frame = SkewFrame::create();
float skewx = DICTOOL->getFloatValue_json(json, X);
float skewy = DICTOOL->getFloatValue_json(json, Y);
frame->setSkewX(skewx);
frame->setSkewY(skewy);
return frame;
}
Frame* ActionTimelineCache::loadRotationSkewFrame(const rapidjson::Value& json)
{
RotationSkewFrame* frame = RotationSkewFrame::create();
float skewx = DICTOOL->getFloatValue_json(json, X);
float skewy = DICTOOL->getFloatValue_json(json, Y);
frame->setSkewX(skewx);
frame->setSkewY(skewy);
return frame;
}
Frame* ActionTimelineCache::loadRotationFrame(const rapidjson::Value& json)
{
RotationFrame* frame = RotationFrame::create();
float rotation = DICTOOL->getFloatValue_json(json, ROTATION);
frame->setRotation(rotation);
return frame;
}
Frame* ActionTimelineCache::loadAnchorPointFrame (const rapidjson::Value& json)
{
AnchorPointFrame* frame = AnchorPointFrame::create();
float anchorx = DICTOOL->getFloatValue_json(json, X);
float anchory = DICTOOL->getFloatValue_json(json, Y);
frame->setAnchorPoint(Point(anchorx, anchory));
return frame;
}
Frame* ActionTimelineCache::loadInnerActionFrame(const rapidjson::Value& json)
{
InnerActionFrame* frame = InnerActionFrame::create();
InnerActionType type = (InnerActionType)DICTOOL->getIntValue_json(json, INNER_ACTION);
int startFrame = DICTOOL->getIntValue_json(json, START_FRAME);
frame->setInnerActionType(type);
frame->setStartFrameIndex(startFrame);
return frame;
}
Frame* ActionTimelineCache::loadColorFrame(const rapidjson::Value& json)
{
ColorFrame* frame = ColorFrame::create();
GLubyte alpha = (GLubyte)DICTOOL->getIntValue_json(json, ALPHA);
GLubyte red = (GLubyte)DICTOOL->getIntValue_json(json, RED);
GLubyte green = (GLubyte)DICTOOL->getIntValue_json(json, GREEN);
GLubyte blue = (GLubyte)DICTOOL->getIntValue_json(json, BLUE);
frame->setAlpha(alpha);
frame->setColor(Color3B(red, green, blue));
return frame;
}
Frame* ActionTimelineCache::loadTextureFrame(const rapidjson::Value& json)
{
TextureFrame* frame = TextureFrame::create();
const char* texture = DICTOOL->getStringValue_json(json, Value);
if(texture != NULL)
{
std::string path = texture;
SpriteFrame* spriteFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName(path);
if(spriteFrame == nullptr)
{
std::string jsonPath = NodeReader::getInstance()->getJsonPath();
path = jsonPath + texture;
}
frame->setTextureName(path);
}
return frame;
}
Frame* ActionTimelineCache::loadEventFrame(const rapidjson::Value& json)
{
EventFrame* frame = EventFrame::create();
const char* evnt = DICTOOL->getStringValue_json(json, Value);
if(evnt != NULL)
frame->setEvent(evnt);
return frame;
}
Frame* ActionTimelineCache::loadZOrderFrame(const rapidjson::Value& json)
{
ZOrderFrame* frame = ZOrderFrame::create();
int zorder = DICTOOL->getIntValue_json(json, Value);
frame->setZOrder(zorder);
return frame;
}
}
}

View File

@ -0,0 +1,87 @@
/****************************************************************************
Copyright (c) 2013 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 __CCTIMELINE_ACTION_CACHE_H__
#define __CCTIMELINE_ACTION_CACHE_H__
#include "cocos2d.h"
#include "cocostudio/DictionaryHelper.h"
#include "CCTimelineMacro.h"
NS_TIMELINE_BEGIN
class ActionTimeline;
class Timeline;
class Frame;
class ActionTimelineCache
{
public:
/** Gets the singleton */
static ActionTimelineCache* getInstance();
/** Destroys the singleton */
static void destroyInstance();
void purge();
void init();
/** Remove action with filename, and also remove other resource relate with this file */
void removeAction(const std::string& fileName);
/** Clone a action with the specified name from the container. */
ActionTimeline* createAction(const std::string& fileName);
ActionTimeline* loadAnimationActionWithFile(const std::string& fileName);
ActionTimeline* loadAnimationActionWithContent(const std::string&fileName, const std::string& content);
protected:
Timeline* loadTimeline(const rapidjson::Value& json);
Frame* loadVisibleFrame (const rapidjson::Value& json);
Frame* loadPositionFrame (const rapidjson::Value& json);
Frame* loadScaleFrame (const rapidjson::Value& json);
Frame* loadSkewFrame (const rapidjson::Value& json);
Frame* loadRotationSkewFrame(const rapidjson::Value& json);
Frame* loadRotationFrame (const rapidjson::Value& json);
Frame* loadAnchorPointFrame (const rapidjson::Value& json);
Frame* loadInnerActionFrame (const rapidjson::Value& json);
Frame* loadColorFrame (const rapidjson::Value& json);
Frame* loadTextureFrame (const rapidjson::Value& json);
Frame* loadEventFrame (const rapidjson::Value& json);
Frame* loadZOrderFrame (const rapidjson::Value& json);
protected:
typedef std::function<Frame*(const rapidjson::Value& json)> FrameCreateFunc;
typedef std::pair<std::string, FrameCreateFunc> Pair;
std::unordered_map<std::string, FrameCreateFunc> _funcs;
cocos2d::Map<std::string, ActionTimeline*> _animationActions;
};
NS_TIMELINE_END
#endif /*__CCTIMELINE_ACTION_CACHE_H__*/

View File

@ -0,0 +1,622 @@
/****************************************************************************
Copyright (c) 2013 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.
****************************************************************************/
#include "CCFrame.h"
#include "CCTimeLine.h"
#include "CCActionTimeline.h"
USING_NS_CC;
NS_TIMELINE_BEGIN
// Frame
Frame::Frame()
: _frameIndex(0)
, _tween(true)
, _timeline(nullptr)
, _node(nullptr)
{
}
Frame::~Frame()
{
}
void Frame::emitEvent()
{
if (_timeline)
{
_timeline->getActionTimeline()->emitFrameEvent(this);
}
}
void Frame::cloneProperty(Frame* frame)
{
_frameIndex = frame->getFrameIndex();
_tween = frame->isTween();
}
// VisibleFrame
VisibleFrame* VisibleFrame::create()
{
VisibleFrame* frame = new VisibleFrame();
if (frame)
{
frame->autorelease();
return frame;
}
CC_SAFE_DELETE(frame);
return NULL;
}
VisibleFrame::VisibleFrame()
: _visible(true)
{
}
void VisibleFrame::onEnter(Frame *nextFrame)
{
_node->setVisible(_visible);
}
Frame* VisibleFrame::clone()
{
VisibleFrame* frame = VisibleFrame::create();
frame->setVisible(_visible);
frame->cloneProperty(this);
return frame;
}
// TextureFrame
TextureFrame* TextureFrame::create()
{
TextureFrame* frame = new TextureFrame();
if (frame)
{
frame->autorelease();
return frame;
}
CC_SAFE_DELETE(frame);
return NULL;
}
TextureFrame::TextureFrame()
: _textureName("")
{
}
void TextureFrame::setNode(Node* node)
{
Frame::setNode(node);
_sprite = dynamic_cast<Sprite*>(node);
}
void TextureFrame::onEnter(Frame *nextFrame)
{
if(_sprite)
{
SpriteFrame* spriteFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName(_textureName);
if(spriteFrame != nullptr)
_sprite->setSpriteFrame(spriteFrame);
else
_sprite->setTexture(_textureName);
}
}
Frame* TextureFrame::clone()
{
TextureFrame* frame = TextureFrame::create();
frame->setTextureName(_textureName);
frame->cloneProperty(this);
return frame;
}
// RotationFrame
RotationFrame* RotationFrame::create()
{
RotationFrame* frame = new RotationFrame();
if (frame)
{
frame->autorelease();
return frame;
}
CC_SAFE_DELETE(frame);
return NULL;
}
RotationFrame::RotationFrame()
: _rotation(0)
{
}
void RotationFrame::onEnter(Frame *nextFrame)
{
_node->setRotation(_rotation);
if(_tween)
{
_betwennRotation = static_cast<RotationFrame*>(nextFrame)->_rotation - _rotation;
}
}
void RotationFrame::apply(float percent)
{
if (_tween && percent != 0 || _betwennRotation != 0)
{
float rotation = _rotation + percent * _betwennRotation;
_node->setRotation(rotation);
}
}
Frame* RotationFrame::clone()
{
RotationFrame* frame = RotationFrame::create();
frame->setRotation(_rotation);
frame->cloneProperty(this);
return frame;
}
// SkewFrame
SkewFrame* SkewFrame::create()
{
SkewFrame* frame = new SkewFrame();
if (frame)
{
frame->autorelease();
return frame;
}
CC_SAFE_DELETE(frame);
return NULL;
}
SkewFrame::SkewFrame()
: _skewX(0)
, _skewY(0)
{
}
void SkewFrame::onEnter(Frame *nextFrame)
{
_node->setSkewX(_skewX);
_node->setSkewY(_skewY);
if(_tween)
{
_betweenSkewX = static_cast<SkewFrame*>(nextFrame)->_skewX - _skewX;
_betweenSkewY = static_cast<SkewFrame*>(nextFrame)->_skewY - _skewY;
}
}
void SkewFrame::apply(float percent)
{
if (_tween && percent != 0 || (_betweenSkewX != 0 || _betweenSkewY != 0))
{
float skewx = _skewX + percent * _betweenSkewX;
float skewy = _skewY + percent * _betweenSkewY;
_node->setSkewX(skewx);
_node->setSkewY(skewy);
}
}
Frame* SkewFrame::clone()
{
SkewFrame* frame = SkewFrame::create();
frame->setSkewX(_skewX);
frame->setSkewY(_skewY);
frame->cloneProperty(this);
return frame;
}
// RotationSkewFrame
RotationSkewFrame* RotationSkewFrame::create()
{
RotationSkewFrame* frame = new RotationSkewFrame();
if (frame)
{
frame->autorelease();
return frame;
}
CC_SAFE_DELETE(frame);
return NULL;
}
RotationSkewFrame::RotationSkewFrame()
{
}
void RotationSkewFrame::onEnter(Frame *nextFrame)
{
_node->setRotationSkewX(_skewX);
_node->setRotationSkewY(_skewY);
if (_tween)
{
_betweenSkewX = static_cast<RotationSkewFrame*>(nextFrame)->_skewX - _skewX;
_betweenSkewY = static_cast<RotationSkewFrame*>(nextFrame)->_skewY - _skewY;
}
}
void RotationSkewFrame::apply(float percent)
{
if (_tween && percent != 0 || (_betweenSkewX != 0 || _betweenSkewY != 0))
{
float skewx = _skewX + percent * _betweenSkewX;
float skewy = _skewY + percent * _betweenSkewY;
_node->setRotationSkewX(skewx);
_node->setRotationSkewY(skewy);
}
}
Frame* RotationSkewFrame::clone()
{
RotationSkewFrame* frame = RotationSkewFrame::create();
frame->setSkewX(_skewX);
frame->setSkewY(_skewY);
frame->cloneProperty(this);
return frame;
}
// PositionFrame
PositionFrame* PositionFrame::create()
{
PositionFrame* frame = new PositionFrame();
if (frame)
{
frame->autorelease();
return frame;
}
CC_SAFE_DELETE(frame);
return NULL;
}
PositionFrame::PositionFrame()
: _position(0,0)
{
}
void PositionFrame::onEnter(Frame *nextFrame)
{
_node->setPosition(_position);
if(_tween)
{
_betweenX = static_cast<PositionFrame*>(nextFrame)->_position.x - _position.x;
_betweenY = static_cast<PositionFrame*>(nextFrame)->_position.y - _position.y;
}
}
void PositionFrame::apply(float percent)
{
if (_tween && percent != 0 || (_betweenX != 0 || _betweenY != 0))
{
Point p;
p.x = _position.x + _betweenX * percent;
p.y = _position.y + _betweenY * percent;
_node->setPosition(p);
}
}
Frame* PositionFrame::clone()
{
PositionFrame* frame = PositionFrame::create();
frame->setPosition(_position);
frame->cloneProperty(this);
return frame;
}
// ScaleFrame
ScaleFrame* ScaleFrame::create()
{
ScaleFrame* frame = new ScaleFrame();
if (frame)
{
frame->autorelease();
return frame;
}
CC_SAFE_DELETE(frame);
return NULL;
}
ScaleFrame::ScaleFrame()
: _scaleX(1)
, _scaleY(1)
{
}
void ScaleFrame::onEnter(Frame *nextFrame)
{
_node->setScaleX(_scaleX);
_node->setScaleY(_scaleY);
if(_tween)
{
_betweenScaleX = static_cast<ScaleFrame*>(nextFrame)->_scaleX - _scaleX;
_betweenScaleY = static_cast<ScaleFrame*>(nextFrame)->_scaleY - _scaleY;
}
}
void ScaleFrame::apply(float percent)
{
if (_tween && percent != 0 || (_betweenScaleX != 0 || _betweenScaleY != 0))
{
float scaleX = _scaleX + _betweenScaleX * percent;
float scaleY = _scaleY + _betweenScaleY * percent;
_node->setScaleX(scaleX);
_node->setScaleY(scaleY);
}
}
Frame* ScaleFrame::clone()
{
ScaleFrame* frame = ScaleFrame::create();
frame->setScaleX(_scaleX);
frame->setScaleY(_scaleY);
frame->cloneProperty(this);
return frame;
}
// AnchorPointFrame
AnchorPointFrame* AnchorPointFrame::create()
{
AnchorPointFrame* frame = new AnchorPointFrame();
if (frame)
{
frame->autorelease();
return frame;
}
CC_SAFE_DELETE(frame);
return NULL;
}
AnchorPointFrame::AnchorPointFrame()
: _anchorPoint(0.5f,0.5f)
{
}
void AnchorPointFrame::onEnter(Frame *nextFrame)
{
_node->setAnchorPoint(_anchorPoint);
}
Frame* AnchorPointFrame::clone()
{
AnchorPointFrame* frame = AnchorPointFrame::create();
frame->setAnchorPoint(_anchorPoint);
frame->cloneProperty(this);
return frame;
}
// InnerActionFrame
InnerActionFrame* InnerActionFrame::create()
{
InnerActionFrame* frame = new InnerActionFrame();
if (frame)
{
frame->autorelease();
return frame;
}
CC_SAFE_DELETE(frame);
return NULL;
}
InnerActionFrame::InnerActionFrame()
: _innerActionType(LoopAction)
, _startFrameIndex(0)
{
}
void InnerActionFrame::onEnter(Frame *nextFrame)
{
}
Frame* InnerActionFrame::clone()
{
InnerActionFrame* frame = InnerActionFrame::create();
frame->setInnerActionType(_innerActionType);
frame->setStartFrameIndex(_startFrameIndex);
frame->cloneProperty(this);
return frame;
}
// ColorFrame
ColorFrame* ColorFrame::create()
{
ColorFrame* frame = new ColorFrame();
if (frame)
{
frame->autorelease();
return frame;
}
CC_SAFE_DELETE(frame);
return NULL;
}
ColorFrame::ColorFrame()
: _alpha(255)
, _color(Color3B(255, 255, 255))
{
}
void ColorFrame::onEnter(Frame *nextFrame)
{
_node->setOpacity(_alpha);
_node->setColor(_color);
if(_tween)
{
_betweenAlpha = static_cast<ColorFrame*>(nextFrame)->_alpha - _alpha;
const Color3B& color = static_cast<ColorFrame*>(nextFrame)->_color;
_betweenRed = color.r - _color.r;
_betweenGreen = color.g - _color.g;
_betweenBlue = color.b - _color.b;
}
_node->setCascadeColorEnabled(true);
_node->setCascadeOpacityEnabled(true);
}
void ColorFrame::apply(float percent)
{
if (_tween && percent != 0 || (_betweenAlpha !=0 || _betweenRed != 0 || _betweenGreen != 0 || _betweenBlue != 0))
{
GLubyte alpha = _alpha + _betweenAlpha * percent;
Color3B color;
color.r = _color.r+ _betweenRed * percent;
color.g = _color.g+ _betweenGreen * percent;
color.b = _color.b+ _betweenBlue * percent;
_node->setOpacity(alpha);
_node->setColor(color);
}
}
Frame* ColorFrame::clone()
{
ColorFrame* frame = ColorFrame::create();
frame->setAlpha(_alpha);
frame->setColor(_color);
frame->cloneProperty(this);
return frame;
}
// EventFrame
EventFrame* EventFrame::create()
{
EventFrame* frame = new EventFrame();
if (frame)
{
frame->autorelease();
return frame;
}
CC_SAFE_DELETE(frame);
return NULL;
}
EventFrame::EventFrame()
: _event("")
{
}
void EventFrame::onEnter(Frame *nextFrame)
{
emitEvent();
}
Frame* EventFrame::clone()
{
EventFrame* frame = EventFrame::create();
frame->setEvent(_event);
frame->cloneProperty(this);
return frame;
}
// ZOrderFrame
ZOrderFrame* ZOrderFrame::create()
{
ZOrderFrame* frame = new ZOrderFrame();
if (frame)
{
frame->autorelease();
return frame;
}
CC_SAFE_DELETE(frame);
return NULL;
}
ZOrderFrame::ZOrderFrame()
: _zorder(0)
{
}
void ZOrderFrame::onEnter(Frame *nextFrame)
{
if(_node)
_node->setZOrder(_zorder);
}
Frame* ZOrderFrame::clone()
{
ZOrderFrame* frame = ZOrderFrame::create();
frame->setZOrder(_zorder);
frame->cloneProperty(this);
return frame;
}
NS_TIMELINE_END

View File

@ -0,0 +1,330 @@
/****************************************************************************
Copyright (c) 2013 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 __CCFRAME_H__
#define __CCFRAME_H__
#include "cocos2d.h"
#include "CCTimelineMacro.h"
NS_TIMELINE_BEGIN
class Timeline;
class Frame : public cocos2d::Ref
{
public:
virtual void setFrameIndex(unsigned int frameIndex) { _frameIndex = frameIndex; }
virtual unsigned int getFrameIndex() const { return _frameIndex; }
virtual void setTimeline(Timeline* timeline) { _timeline = timeline; }
virtual Timeline* getTimeline() const { return _timeline; }
virtual void setNode(cocos2d::Node* node) { _node = node; }
virtual cocos2d::Node* getNode() const { return _node; }
virtual void setTween(bool tween) { _tween = tween; }
virtual bool isTween() const { return _tween; }
virtual void onEnter(Frame *nextFrame) = 0;
virtual void apply(float percent) {}
virtual Frame* clone() = 0;
protected:
Frame();
virtual ~Frame();
virtual void emitEvent();
virtual void cloneProperty(Frame* frame);
protected:
unsigned int _frameIndex;
bool _tween;
Timeline* _timeline;
cocos2d::Node* _node;
};
class VisibleFrame : public Frame
{
public:
static VisibleFrame* create();
VisibleFrame();
virtual void onEnter(Frame *nextFrame) override;
virtual Frame* clone() override;
inline void setVisible(bool visible) { _visible = visible;}
inline bool isVisible() const { return _visible; }
protected:
bool _visible;
};
class TextureFrame : public Frame
{
public:
static TextureFrame* create();
TextureFrame();
virtual void setNode(cocos2d::Node* node);
virtual void onEnter(Frame *nextFrame) override;
virtual Frame* clone() override;
inline void setTextureName(std::string textureName) { _textureName = textureName;}
inline std::string getTextureName() const { return _textureName; }
protected:
cocos2d::Sprite* _sprite;
std::string _textureName;
};
class RotationFrame : public Frame
{
public:
static RotationFrame* create();
RotationFrame();
virtual void onEnter(Frame *nextFrame) override;
virtual void apply(float percent) override;
virtual Frame* clone() override;
inline void setRotation(float rotation) { _rotation = rotation; }
inline float getRotation() const { return _rotation; }
protected:
float _rotation;
float _betwennRotation;
};
class SkewFrame : public Frame
{
public:
static SkewFrame* create();
SkewFrame();
virtual void onEnter(Frame *nextFrame) override;
virtual void apply(float percent) override;
virtual Frame* clone() override;
inline void setSkewX(float skewx) { _skewX = skewx; }
inline float getSkewX() const { return _skewX; }
inline void setSkewY(float skewy) { _skewY = skewy; }
inline float getSkewY() const { return _skewY; }
protected:
float _skewX;
float _skewY;
float _betweenSkewX;
float _betweenSkewY;
};
class RotationSkewFrame : public SkewFrame
{
public:
static RotationSkewFrame* create();
RotationSkewFrame();
virtual void onEnter(Frame *nextFrame) override;
virtual void apply(float percent) override;
virtual Frame* clone() override;
};
class PositionFrame : public Frame
{
public:
static PositionFrame* create();
PositionFrame();
virtual void onEnter(Frame *nextFrame) override;
virtual void apply(float percent) override;
virtual Frame* clone() override;
inline void setPosition(const cocos2d::Point& position) { _position = position; }
inline cocos2d::Point getPosition() const { return _position; }
inline void setX(float x) { _position.x = x; }
inline void setY(float y) { _position.y = y; }
inline float getX() const { return _position.x; }
inline float getY() const { return _position.y; }
protected:
cocos2d::Point _position;
float _betweenX;
float _betweenY;
};
class ScaleFrame : public Frame
{
public:
static ScaleFrame* create();
ScaleFrame();
virtual void onEnter(Frame *nextFrame) override;
virtual void apply(float percent) override;
virtual Frame* clone() override;
inline void setScale(float scale) { _scaleX = scale; _scaleY = scale; }
inline void setScaleX(float scaleX) { _scaleX = scaleX; }
inline float getScaleX() const { return _scaleX; }
inline void setScaleY(float scaleY) { _scaleY = scaleY;}
inline float getScaleY() const { return _scaleY; }
protected:
float _scaleX;
float _scaleY;
float _betweenScaleX;
float _betweenScaleY;
};
class AnchorPointFrame : public Frame
{
public:
static AnchorPointFrame* create();
AnchorPointFrame();
virtual void onEnter(Frame *nextFrame) override;
virtual Frame* clone() override;
inline void setAnchorPoint(const cocos2d::Point& point) { _anchorPoint = point; }
inline cocos2d::Point getAnchorPoint() const { return _anchorPoint; }
protected:
cocos2d::Point _anchorPoint;
};
enum InnerActionType
{
LoopAction,
NoLoopAction,
SingleFrame
};
class InnerActionFrame : public Frame
{
public:
static InnerActionFrame* create();
InnerActionFrame();
virtual void onEnter(Frame *nextFrame) override;
virtual Frame* clone() override;
inline void setInnerActionType(InnerActionType type) { _innerActionType = type; }
inline InnerActionType getInnerActionType() const { return _innerActionType; }
inline void setStartFrameIndex(int frameIndex) { _startFrameIndex = frameIndex; }
inline int getStartFrameIndex() const { return _startFrameIndex; }
protected:
InnerActionType _innerActionType;
int _startFrameIndex;
};
class ColorFrame : public Frame
{
public:
static ColorFrame* create();
ColorFrame();
virtual void onEnter(Frame *nextFrame) override;
virtual void apply(float percent) override;
virtual Frame* clone() override;
inline void setAlpha(GLubyte alpha) { _alpha = alpha; }
inline GLubyte getAlpha() const { return _alpha; }
inline void setColor(const cocos2d::Color3B& color) { _color = color; }
inline cocos2d::Color3B getColor() const { return _color; }
protected:
GLubyte _alpha;
cocos2d::Color3B _color;
int _betweenAlpha;
int _betweenRed;
int _betweenGreen;
int _betweenBlue;
};
class EventFrame : public Frame
{
public:
static EventFrame* create();
EventFrame();
virtual void onEnter(Frame *nextFrame) override;
virtual Frame* clone() override;
inline void setEvent(std::string event) { _event = event;}
inline std::string getEvent() const { return _event; }
protected:
std::string _event;
};
class ZOrderFrame : public Frame
{
public:
static ZOrderFrame* create();
ZOrderFrame();
virtual void onEnter(Frame *nextFrame) override;
virtual Frame* clone() override;
inline void setZOrder(int zorder) { _zorder = zorder;}
inline int getZOrder() const { return _zorder; }
protected:
int _zorder;
};
NS_TIMELINE_END
#endif /*__CCFRAME_H__*/

View File

@ -0,0 +1,457 @@
/****************************************************************************
Copyright (c) 2013 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.
****************************************************************************/
#include "CCNodeReader.h"
#include "CCActionTimelineCache.h"
#include "CCActionTimeline.h"
#include "../CCSGUIReader.h"
using namespace cocos2d;
using namespace ui;
namespace cocostudio {
namespace timeline{
static const char* ClassName_Node = "Node";
static const char* ClassName_SubGraph = "SubGraph";
static const char* ClassName_Sprite = "Sprite";
static const char* ClassName_Particle = "Particle";
static const char* ClassName_Panel = "Panel";
static const char* ClassName_Button = "Button";
static const char* ClassName_CheckBox = "CheckBox";
static const char* ClassName_ImageView = "ImageView";
static const char* ClassName_TextAtlas = "TextAtlas";
static const char* ClassName_TextBMFont = "TextBMFont";
static const char* ClassName_Text = "Text";
static const char* ClassName_LoadingBar = "LoadingBar";
static const char* ClassName_TextField = "TextField";
static const char* ClassName_Slider = "Slider";
static const char* ClassName_Layout = "Layout";
static const char* ClassName_ScrollView = "ScrollView";
static const char* ClassName_ListView = "ListView";
static const char* ClassName_PageView = "PageView";
static const char* ClassName_Widget = "Widget";
static const char* ClassName_Label = "Label";
static const char* NODE = "nodeTree";
static const char* CHILDREN = "children";
static const char* CLASSNAME = "classname";
static const char* FILE_PATH = "fileName";
static const char* PLIST_FILE = "plistFile";
static const char* TAG = "tag";
static const char* ACTION_TAG = "actionTag";
static const char* OPTIONS = "options";
static const char* WIDTH = "width";
static const char* HEIGHT = "height";
static const char* X = "x";
static const char* Y = "y";
static const char* SCALE_X = "scaleX";
static const char* SCALE_Y = "scaleY";
static const char* SKEW_X = "skewX";
static const char* SKEW_Y = "skewY";
static const char* ROTATION = "rotation";
static const char* ROTATION_SKEW_X = "rotationSkewX";
static const char* ROTATION_SKEW_Y = "rotationSkewY";
static const char* ANCHOR_X = "anchorPointX";
static const char* ANCHOR_Y = "anchorPointY";
static const char* ALPHA = "opacity";
static const char* RED = "colorR";
static const char* GREEN = "colorG";
static const char* BLUE = "colorB";
static const char* ZORDER = "ZOrder";
static const char* PARTICLE_NUM = "particleNum";
static const char* FLIPX = "flipX";
static const char* FLIPY = "flipY";
static const char* VISIBLE = "visible";
static const char* TEXTURES = "textures";
static const char* TEXTURES_PNG = "texturesPng";
// NodeReader
static NodeReader* _sharedNodeReader = nullptr;
NodeReader* NodeReader::getInstance()
{
if (! _sharedNodeReader)
{
_sharedNodeReader = new NodeReader();
_sharedNodeReader->init();
}
return _sharedNodeReader;
}
void NodeReader::destroyInstance()
{
CC_SAFE_DELETE(_sharedNodeReader);
}
NodeReader::NodeReader()
: _recordJsonPath(true)
, _jsonPath("")
{
}
void NodeReader::purge()
{
}
void NodeReader::init()
{
using namespace std::placeholders;
_funcs.insert(Pair(ClassName_Node, std::bind(&NodeReader::loadSimpleNode, this, _1)));
_funcs.insert(Pair(ClassName_SubGraph, std::bind(&NodeReader::loadSubGraph, this, _1)));
_funcs.insert(Pair(ClassName_Sprite, std::bind(&NodeReader::loadSprite, this, _1)));
_funcs.insert(Pair(ClassName_Particle, std::bind(&NodeReader::loadParticle, this, _1)));
_funcs.insert(Pair(ClassName_Panel, std::bind(&NodeReader::loadWidget, this, _1)));
_funcs.insert(Pair(ClassName_Button, std::bind(&NodeReader::loadWidget, this, _1)));
_funcs.insert(Pair(ClassName_CheckBox, std::bind(&NodeReader::loadWidget, this, _1)));
_funcs.insert(Pair(ClassName_ImageView, std::bind(&NodeReader::loadWidget, this, _1)));
_funcs.insert(Pair(ClassName_TextAtlas, std::bind(&NodeReader::loadWidget, this, _1)));
_funcs.insert(Pair(ClassName_TextBMFont,std::bind(&NodeReader::loadWidget, this, _1)));
_funcs.insert(Pair(ClassName_Text, std::bind(&NodeReader::loadWidget, this, _1)));
_funcs.insert(Pair(ClassName_LoadingBar,std::bind(&NodeReader::loadWidget, this, _1)));
_funcs.insert(Pair(ClassName_TextField, std::bind(&NodeReader::loadWidget, this, _1)));
_funcs.insert(Pair(ClassName_Slider, std::bind(&NodeReader::loadWidget, this, _1)));
_funcs.insert(Pair(ClassName_Layout, std::bind(&NodeReader::loadWidget, this, _1)));
_funcs.insert(Pair(ClassName_ScrollView,std::bind(&NodeReader::loadWidget, this, _1)));
_funcs.insert(Pair(ClassName_ListView, std::bind(&NodeReader::loadWidget, this, _1)));
_funcs.insert(Pair(ClassName_PageView, std::bind(&NodeReader::loadWidget, this, _1)));
_funcs.insert(Pair(ClassName_Widget, std::bind(&NodeReader::loadWidget, this, _1)));
_funcs.insert(Pair(ClassName_Label, std::bind(&NodeReader::loadWidget, this, _1)));
_guiReader = new WidgetPropertiesReader0300();
}
Node* NodeReader::createNode(const std::string& filename)
{
if(_recordJsonPath)
{
std::string jsonPath = filename.substr(0, filename.find_last_of('/') + 1);
GUIReader::getInstance()->setFilePath(jsonPath);
_jsonPath = jsonPath;
}
else
{
GUIReader::getInstance()->setFilePath("");
_jsonPath = "";
}
Node* node = loadNodeWithFile(filename);
return node;
}
Node* NodeReader::loadNodeWithFile(const std::string& fileName)
{
// Read content from file
std::string contentStr = FileUtils::getInstance()->getStringFromFile(fileName);
Node* node = loadNodeWithContent(contentStr);
// Load animation data from file
ActionTimelineCache::getInstance()->loadAnimationActionWithContent(fileName, contentStr);
return node;
}
Node* NodeReader::loadNodeWithContent(const std::string& content)
{
rapidjson::Document doc;
doc.Parse<0>(content.c_str());
if (doc.HasParseError())
{
CCLOG("GetParseError %s\n", doc.GetParseError());
}
// decode plist
int length = DICTOOL->getArrayCount_json(doc, TEXTURES);
for(int i=0; i<length; i++)
{
std::string plist = DICTOOL->getStringValueFromArray_json(doc, TEXTURES, i);
std::string png = DICTOOL->getStringValueFromArray_json(doc, TEXTURES_PNG, i);
plist = _jsonPath + plist;
png = _jsonPath + png;
SpriteFrameCache::getInstance()->addSpriteFramesWithFile(plist, png);
}
// decode node tree
const rapidjson::Value& subJson = DICTOOL->getSubDictionary_json(doc, NODE);
Node* root = loadNode(subJson);
root->release();
return root;
}
Node* NodeReader::loadNode(const rapidjson::Value& json)
{
Node* node = nullptr;
std::string nodeType = DICTOOL->getStringValue_json(json, CLASSNAME);
NodeCreateFunc func = _funcs.at(nodeType);
if (func != nullptr)
{
const rapidjson::Value& options = DICTOOL->getSubDictionary_json(json, OPTIONS);
node = func(options);
}
if(node)
{
int length = DICTOOL->getArrayCount_json(json, CHILDREN, 0);
for (int i = 0; i<length; i++)
{
const rapidjson::Value &dic = DICTOOL->getSubDictionary_json(json, CHILDREN, i);
Node* child = loadNode(dic);
if (child)
{
node->addChild(child);
child->release();
}
}
}
else
{
CCLOG("Not supported NodeType: %s", nodeType.c_str());
}
return node;
}
void NodeReader::initNode(Node* node, const rapidjson::Value& json)
{
float width = DICTOOL->getFloatValue_json(json, WIDTH);
float height = DICTOOL->getFloatValue_json(json, HEIGHT);
float x = DICTOOL->getFloatValue_json(json, X);
float y = DICTOOL->getFloatValue_json(json, Y);
float scalex = DICTOOL->getFloatValue_json(json, SCALE_X, 1);
float scaley = DICTOOL->getFloatValue_json(json, SCALE_Y, 1);
float rotation = DICTOOL->getFloatValue_json(json, ROTATION);
float rotationSkewX = DICTOOL->getFloatValue_json(json, ROTATION_SKEW_X);
float rotationSkewY = DICTOOL->getFloatValue_json(json, ROTATION_SKEW_Y);
float skewx = DICTOOL->getFloatValue_json(json, SKEW_X);
float skewy = DICTOOL->getFloatValue_json(json, SKEW_Y);
float anchorx = DICTOOL->getFloatValue_json(json, ANCHOR_X, 0.5f);
float anchory = DICTOOL->getFloatValue_json(json, ANCHOR_Y, 0.5f);
GLubyte alpha = (GLubyte)DICTOOL->getIntValue_json(json, ALPHA, 255);
GLubyte red = (GLubyte)DICTOOL->getIntValue_json(json, RED, 255);
GLubyte green = (GLubyte)DICTOOL->getIntValue_json(json, GREEN, 255);
GLubyte blue = (GLubyte)DICTOOL->getIntValue_json(json, BLUE, 255);
int zorder = DICTOOL->getIntValue_json(json, ZORDER);
int tag = DICTOOL->getIntValue_json(json, TAG);
int actionTag = DICTOOL->getIntValue_json(json, ACTION_TAG);
bool visible = DICTOOL->getBooleanValue_json(json, VISIBLE);
if(x != 0 || y != 0)
node->setPosition(Point(x, y));
if(scalex != 1)
node->setScaleX(scalex);
if(scaley != 1)
node->setScaleY(scaley);
if (rotation != 0)
node->setRotation(rotation);
if(rotationSkewX != 0)
node->setRotationX(rotationSkewX);
if(rotationSkewY != 0)
node->setRotationY(rotationSkewY);
if(skewx != 0)
node->setSkewX(skewx);
if(skewy != 0)
node->setSkewY(skewy);
if(anchorx != 0.5f || anchory != 0.5f)
node->setAnchorPoint(Point(anchorx, anchory));
if(width != 0 || height != 0)
node->setContentSize(Size(width, height));
if(zorder != 0)
node->setZOrder(zorder);
if(visible != true)
node->setVisible(visible);
if(alpha != 255)
{
node->setOpacity(alpha);
node->setCascadeOpacityEnabled(true);
}
if(red != 255 || green != 255 || blue != 255)
{
node->setColor(Color3B(red, green, blue));
node->setCascadeColorEnabled(true);
}
node->setTag(tag);
node->setUserObject(ActionTimelineData::create(actionTag));
}
Node* NodeReader::loadSimpleNode(const rapidjson::Value& json)
{
Node* node = Node::create();
node->retain();
initNode(node, json);
return node;
}
Node* NodeReader::loadSubGraph(const rapidjson::Value& json)
{
const char* filePath = DICTOOL->getStringValue_json(json, FILE_PATH);
Node* node = nullptr;
if (filePath && strcmp("", filePath) != 0)
{
node = createNode(filePath);
}
else
{
node = Node::create();
}
node->retain();
initNode(node, json);
return node;
}
Node* NodeReader::loadSprite(const rapidjson::Value& json)
{
const char* filePath = DICTOOL->getStringValue_json(json, FILE_PATH);
Sprite *sprite = nullptr;
if(filePath != nullptr)
{
std::string path = filePath;
SpriteFrame* spriteFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName(path);
if(!spriteFrame)
{
path = _jsonPath + path;
sprite = Sprite::create(path);
}
else
{
sprite = Sprite::createWithSpriteFrame(spriteFrame);
}
if(!sprite)
{
sprite = CCSprite::create();
CCLOG("filePath is empty. Create a sprite with no texture");
}
}
else
{
sprite = Sprite::create();
}
sprite->retain();
initNode(sprite, json);
bool flipX = DICTOOL->getBooleanValue_json(json, FLIPX);
bool flipY = DICTOOL->getBooleanValue_json(json, FLIPY);
if(flipX != false)
sprite->setFlipX(flipX);
if(flipY != false)
sprite->setFlipY(flipY);
return sprite;
}
Node* NodeReader::loadParticle(const rapidjson::Value& json)
{
const char* filePath = DICTOOL->getStringValue_json(json, PLIST_FILE);
int num = DICTOOL->getIntValue_json(json, PARTICLE_NUM);
ParticleSystemQuad* particle = ParticleSystemQuad::create(filePath);
particle->setTotalParticles(num);
particle->retain();
initNode(particle, json);
return particle;
}
Node* NodeReader::loadWidget(const rapidjson::Value& json)
{
const char* str = DICTOOL->getStringValue_json(json, CLASSNAME);
if(str == nullptr)
return nullptr;
std::string classname = str;
if (classname == "Panel")
{
classname = "Layout";
}
else if (classname == "TextArea")
{
classname = "Text";
}
else if (classname == "TextButton")
{
classname = "Button";
}
else if (classname == "Label")
{
classname = "Text";
}
else if (classname == "LabelAtlas")
{
classname = "TextAtlas";
}
else if (classname == "LabelBMFont")
{
classname = "TextBMFont";
}
std::string readerName = classname;
readerName.append("Reader");
Widget* widget = dynamic_cast<Widget*>(ObjectFactory::getInstance()->createObject(classname));
widget->retain();
WidgetReaderProtocol* reader = dynamic_cast<WidgetReaderProtocol*>(ObjectFactory::getInstance()->createObject(readerName));
_guiReader->setPropsForAllWidgetFromJsonDictionary(reader, widget, json);
int actionTag = DICTOOL->getIntValue_json(json, ACTION_TAG);
widget->setUserObject(ActionTimelineData::create(actionTag));
return widget;
}
}
}

View File

@ -0,0 +1,91 @@
/****************************************************************************
Copyright (c) 2013 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 __CC_NODE_CACHE_H__
#define __CC_NODE_CACHE_H__
#include "cocostudio/DictionaryHelper.h"
#include "cocos2d.h"
namespace cocostudio {
class WidgetPropertiesReader0300;
namespace timeline{
class NodeReader
{
public:
static NodeReader* getInstance();
static void destroyInstance();
NodeReader();
void purge();
void init();
cocos2d::Node* createNode(const std::string& filename);
cocos2d::Node* loadNodeWithFile(const std::string& fileName);
cocos2d::Node* loadNodeWithContent(const std::string& content);
void setRecordJsonPath(bool record) { _recordJsonPath = record; }
bool isRecordJsonPath() const { return _recordJsonPath; }
void setJsonPath(std::string jsonPath) { _jsonPath = jsonPath; }
std::string getJsonPath() const { return _jsonPath; }
protected:
cocos2d::Node* loadNode(const rapidjson::Value& json);
void locateNodeWithMulresPosition(cocos2d::Node* node, const rapidjson::Value& json);
void initNode(cocos2d::Node* node, const rapidjson::Value& json);
// load nodes
cocos2d::Node* loadSimpleNode(const rapidjson::Value& json);
cocos2d::Node* loadSubGraph (const rapidjson::Value& json);
cocos2d::Node* loadSprite (const rapidjson::Value& json);
cocos2d::Node* loadParticle (const rapidjson::Value& json);
// load gui
cocos2d::Node* loadWidget(const rapidjson::Value& json);
typedef std::function<cocos2d::Node*(const rapidjson::Value& json)> NodeCreateFunc;
typedef std::pair<std::string, NodeCreateFunc> Pair;
std::unordered_map<std::string, NodeCreateFunc> _funcs;
WidgetPropertiesReader0300* _guiReader;
bool _recordJsonPath;
std::string _jsonPath;
};
}
}
#endif /*__CC_NODE_CACHE_H__*/

View File

@ -0,0 +1,249 @@
/****************************************************************************
Copyright (c) 2013 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.
****************************************************************************/
#include "CCTimeLine.h"
#include "CCActionTimeline.h"
USING_NS_CC;
NS_TIMELINE_BEGIN
Timeline* Timeline::create()
{
Timeline* object = new Timeline();
if (object)
{
object->autorelease();
return object;
}
CC_SAFE_DELETE(object);
return nullptr;
}
Timeline::Timeline()
: _currentKeyFrame(nullptr)
, _currentKeyFrameIndex(0)
, _fromIndex(0)
, _toIndex(0)
, _betweenDuration(0)
, _actionTag(0)
, _ActionTimeline(nullptr)
, _node(nullptr)
{
}
Timeline::~Timeline()
{
}
void Timeline::gotoFrame(int frameIndex)
{
if(_frames.size() == 0)
return;
binarySearchKeyFrame(frameIndex);
apply(frameIndex);
}
void Timeline::stepToFrame(int frameIndex)
{
if(_frames.size() == 0)
return;
updateCurrentKeyFrame(frameIndex);
apply(frameIndex);
}
Timeline* Timeline::clone()
{
Timeline* timeline = Timeline::create();
timeline->_actionTag = _actionTag;
for (auto frame : _frames)
{
Frame* newFrame = frame->clone();
timeline->addFrame(newFrame);
}
return timeline;
}
void Timeline::addFrame(Frame* frame)
{
_frames.pushBack(frame);
frame->setTimeline(this);
}
void Timeline::insertFrame(Frame* frame, int index)
{
_frames.insert(index, frame);
frame->setTimeline(this);
}
void Timeline::removeFrame(Frame* frame)
{
_frames.eraseObject(frame);
frame->setTimeline(NULL);
}
void Timeline::setNode(Node* node)
{
for (auto frame : _frames)
{
frame->setNode(node);
}
}
Node* Timeline::getNode() const
{
return _node;
}
void Timeline::apply(int frameIndex)
{
if (_currentKeyFrame)
{
float currentPercent = _betweenDuration == 0 ? 0 : (frameIndex - _currentKeyFrameIndex) / (float)_betweenDuration;
_currentKeyFrame->apply(currentPercent);
}
}
void Timeline::binarySearchKeyFrame(int frameIndex)
{
Frame *from = NULL;
Frame *to = NULL;
long length = _frames.size();
bool needEnterFrame = false;
do
{
if (frameIndex < _frames.at(0)->getFrameIndex())
{
if(_currentKeyFrameIndex >= _frames.at(0)->getFrameIndex())
needEnterFrame = true;
from = to = _frames.at(0);
_currentKeyFrameIndex = 0;
_betweenDuration = _frames.at(0)->getFrameIndex();
break;
}
else if(frameIndex >= _frames.at(length - 1)->getFrameIndex())
{
from = to = _frames.at(length - 1);
_currentKeyFrameIndex = _frames.at(length - 1)->getFrameIndex();
_betweenDuration = 0;
break;
}
int target = -1;
int low=0,high=length-1,mid;
while(low<=high){
mid=(low+high)/2;
if(frameIndex >= _frames.at(mid)->getFrameIndex() && frameIndex < _frames.at(mid+1)->getFrameIndex())
{
target = mid;
break;
}
if(_frames.at(mid)->getFrameIndex()>frameIndex)
high=mid-1;
else
low=mid+1;
}
from = _frames.at(target);
to = _frames.at(target+1);
if(target == 0 && _currentKeyFrameIndex<from->getFrameIndex())
needEnterFrame = true;
_currentKeyFrameIndex = from->getFrameIndex();
_betweenDuration = to->getFrameIndex() - from->getFrameIndex();
} while (0);
if(needEnterFrame || _currentKeyFrame != from)
{
_currentKeyFrame = from;
_currentKeyFrame->onEnter(to);
}
}
void Timeline::updateCurrentKeyFrame(int frameIndex)
{
//! If play to current frame's front or back, then find current frame again
if (frameIndex < _currentKeyFrameIndex || frameIndex >= _currentKeyFrameIndex + _betweenDuration)
{
Frame *from = nullptr;
Frame *to = nullptr;
do
{
long length = _frames.size();
if (frameIndex < _frames.at(0)->getFrameIndex())
{
from = to = _frames.at(0);
_currentKeyFrameIndex = 0;
_betweenDuration = _frames.at(0)->getFrameIndex();
break;
}
else if(frameIndex >= _frames.at(length - 1)->getFrameIndex())
{
from = to = _frames.at(length - 1);
_currentKeyFrameIndex = _frames.at(length - 1)->getFrameIndex();
_betweenDuration = 0;
break;
}
do
{
_fromIndex = _toIndex;
from = _frames.at(_fromIndex);
_currentKeyFrameIndex = from->getFrameIndex();
_toIndex = _fromIndex + 1;
if (_toIndex >= length)
{
_toIndex = 0;
}
to = _frames.at(_toIndex);
if (frameIndex == from->getFrameIndex())
{
break;
}
}
while (frameIndex < from->getFrameIndex() || frameIndex >= to->getFrameIndex());
_betweenDuration = to->getFrameIndex() - from->getFrameIndex();
} while (0);
_currentKeyFrame = from;
_currentKeyFrame->onEnter(to);
}
}
NS_TIMELINE_END

View File

@ -0,0 +1,85 @@
/****************************************************************************
Copyright (c) 2013 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 __CCTIMELINE_H__
#define __CCTIMELINE_H__
#include "CCFrame.h"
#include "CCTimelineMacro.h"
NS_TIMELINE_BEGIN
class ActionTimeline;
class Timeline : public cocos2d::Ref
{
public:
static Timeline* create();
Timeline();
virtual ~Timeline();
virtual void gotoFrame(int frameIndex);
virtual void stepToFrame(int frameIndex);
virtual const cocos2d::Vector<Frame*>& getFrames() const { return _frames; }
virtual void addFrame(Frame* frame);
virtual void insertFrame(Frame* frame, int index);
virtual void removeFrame(Frame* frame);
virtual void setActionTag(int tag) { _actionTag = tag; }
virtual int getActionTag() const { return _actionTag; }
virtual void setNode(cocos2d::Node* node);
virtual cocos2d::Node* getNode() const;
virtual void setActionTimeline(ActionTimeline* action) { _ActionTimeline = action; }
virtual ActionTimeline* getActionTimeline() const { return _ActionTimeline; }
virtual Timeline* clone();
protected:
virtual void apply(int frameIndex);
virtual void binarySearchKeyFrame (int frameIndex);
virtual void updateCurrentKeyFrame(int frameIndex);
cocos2d::Vector<Frame*> _frames;
Frame* _currentKeyFrame;
int _currentKeyFrameIndex;
int _fromIndex;
int _toIndex;
int _betweenDuration;
int _actionTag;
ActionTimeline* _ActionTimeline;
cocos2d::Node* _node;
};
NS_TIMELINE_END
#endif /*__CCTIMELINE_H__*/

View File

@ -0,0 +1,38 @@
/****************************************************************************
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __CC_TIMELINE_MACROS_H__
#define __CC_TIMELINE_MACROS_H__
#ifdef __cplusplus
#define NS_TIMELINE_BEGIN namespace cocostudio { namespace timeline{
#define NS_TIMELINE_END }}
#define USING_NS_TIMELINE using namespace cocostudio::timeline;
#else
#define NS_TIMELINE_BEGIN
#define NS_TIMELINE_END
#define USING_NS_TIMELINE
#endif
#endif

View File

@ -53,6 +53,11 @@ WidgetReader/TextAtlasReader/TextAtlasReader.cpp \
WidgetReader/TextBMFontReader/TextBMFontReader.cpp \
WidgetReader/TextFieldReader/TextFieldReader.cpp \
WidgetReader/TextReader/TextReader.cpp \
ActionTimeline/CCNodeReader.cpp \
ActionTimeline/CCActionTimelineCache.cpp \
ActionTimeline/CCFrame.cpp \
ActionTimeline/CCTimeline.cpp \
ActionTimeline/CCActionTimeline.cpp \
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/.. \
$(LOCAL_PATH)/../../../external

View File

@ -373,4 +373,4 @@ ActionInterval* ActionTintFrame::getAction(float fDuration)
}
}
}

View File

@ -188,4 +188,4 @@ float ActionFrameEasing::easeValue(float t)
return 0;
}
}
}

View File

@ -222,4 +222,4 @@ void ActionObject::simulationActionUpdate(float dt)
}
}
}
}
}

View File

@ -494,6 +494,8 @@ Rect Armature::getBoundingBox() const
if (Bone *bone = dynamic_cast<Bone *>(object))
{
Rect r = bone->getDisplayManager()->getBoundingBox();
if (r.equals(Rect::ZERO))
continue;
if(first)
{

View File

@ -1185,8 +1185,22 @@ ContourData *DataReaderHelper::decodeContour(tinyxml2::XMLElement *contourXML, D
void DataReaderHelper::addDataFromJsonCache(const std::string& fileContent, DataInfo *dataInfo)
{
rapidjson::Document json;
json.Parse<0>(fileContent.c_str());
rapidjson::StringStream stream(fileContent.c_str());
if (fileContent.size() >= 3) {
// Skip BOM if exists
const unsigned char* c = (const unsigned char *)fileContent.c_str();
unsigned bom = c[0] | (c[1] << 8) | (c[2] << 16);
if (bom == 0xBFBBEF) // UTF8 BOM
{
stream.Take();
stream.Take();
stream.Take();
}
}
json.ParseStream<0>(stream);
if (json.HasParseError()) {
CCLOG("GetParseError %s\n",json.GetParseError());
}

View File

@ -181,7 +181,8 @@ Widget* GUIReader::widgetFromJsonFile(const char *fileName)
{
std::string jsonpath;
rapidjson::Document jsonDict;
jsonpath = CCFileUtils::getInstance()->fullPathForFilename(fileName);
jsonpath = fileName;
// jsonpath = CCFileUtils::getInstance()->fullPathForFilename(fileName);
size_t pos = jsonpath.find_last_of('/');
m_strFilePath = jsonpath.substr(0,pos+1);
std::string contentStr = FileUtils::getInstance()->getStringFromFile(jsonpath);

View File

@ -59,13 +59,14 @@ public:
*/
const cocos2d::Size getFileDesignSize(const char* fileName) const;
const std::string& getFilePath() const { return m_strFilePath; };
void setFilePath(const std::string& strFilePath) { m_strFilePath = strFilePath; }
const std::string& getFilePath() const { return m_strFilePath; }
void registerTypeAndCallBack(const std::string& classType,
cocos2d::ObjectFactory::Instance ins,
Ref* object,
SEL_ParseEvent callBack);
protected:
GUIReader();
~GUIReader();

View File

@ -47,6 +47,11 @@ set(CS_SRC
WidgetReader/TextBMFontReader/TextBMFontReader.cpp
WidgetReader/TextFieldReader/TextFieldReader.cpp
WidgetReader/TextReader/TextReader.cpp
ActionTimeline/CCActionTimeline.cpp
ActionTimeline/CCActionTimelineCache.cpp
ActionTimeline/CCFrame.cpp
ActionTimeline/CCNodeReader.cpp
ActionTimeline/CCTimeLine.cpp
)
include_directories(

View File

@ -58,5 +58,10 @@ THE SOFTWARE.
#include "cocostudio/CCSGUIReader.h"
#include "cocostudio/CCSSceneReader.h"
#include "cocostudio/TriggerBase.h"
#include "cocostudio/ActionTimeline/CCNodeReader.h"
#include "cocostudio/ActionTimeline/CCActionTimelineCache.h"
#include "cocostudio/ActionTimeline/CCFrame.h"
#include "cocostudio/ActionTimeline/CCTimeLine.h"
#include "cocostudio/ActionTimeline/CCActionTimeline.h"
#endif

View File

@ -224,4 +224,4 @@ bool DictionaryHelper::checkObjectExist_json(const rapidjson::Value &root, int i
return bRet;
}
}
}

View File

@ -11,6 +11,11 @@
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\ActionTimeline\CCActionTimeline.cpp" />
<ClCompile Include="..\ActionTimeline\CCFrame.cpp" />
<ClCompile Include="..\ActionTimeline\CCNodeReader.cpp" />
<ClCompile Include="..\ActionTimeline\CCActionTimelineCache.cpp" />
<ClCompile Include="..\ActionTimeline\CCTimeLine.cpp" />
<ClCompile Include="..\CCActionFrame.cpp" />
<ClCompile Include="..\CCActionFrameEasing.cpp" />
<ClCompile Include="..\CCActionManagerEx.cpp" />
@ -71,6 +76,12 @@
<ClInclude Include="..\..\..\..\external\json\reader.h" />
<ClInclude Include="..\..\..\..\external\json\stringbuffer.h" />
<ClInclude Include="..\..\..\..\external\json\writer.h" />
<ClInclude Include="..\ActionTimeline\CCActionTimeline.h" />
<ClInclude Include="..\ActionTimeline\CCFrame.h" />
<ClInclude Include="..\ActionTimeline\CCNodeReader.h" />
<ClInclude Include="..\ActionTimeline\CCActionTimelineCache.h" />
<ClInclude Include="..\ActionTimeline\CCTimeLine.h" />
<ClInclude Include="..\ActionTimeline\CCTimelineMacro.h" />
<ClInclude Include="..\CCActionFrame.h" />
<ClInclude Include="..\CCActionFrameEasing.h" />
<ClInclude Include="..\CCActionManagerEx.h" />
@ -103,7 +114,6 @@
<ClInclude Include="..\CCTween.h" />
<ClInclude Include="..\CCUtilMath.h" />
<ClInclude Include="..\DictionaryHelper.h" />
<ClInclude Include="..\ObjectFactory.h" />
<ClInclude Include="..\TriggerBase.h" />
<ClInclude Include="..\TriggerMng.h" />
<ClInclude Include="..\TriggerObj.h" />
@ -189,13 +199,15 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<Optimization>MinSpace</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>
</SDLCheck>
<PreprocessorDefinitions>WIN32;_WINDOWS;_LIB;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support;$(EngineRoot)external;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)extensions;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DebugInformationFormat>None</DebugInformationFormat>
<WholeProgramOptimization>false</WholeProgramOptimization>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>

View File

@ -82,6 +82,9 @@
<Filter Include="reader\WidgetReader\TextReader">
<UniqueIdentifier>{bc251d28-036e-4272-852b-bd25fd110b33}</UniqueIdentifier>
</Filter>
<Filter Include="TimelineAction">
<UniqueIdentifier>{2d371825-3c46-4901-850c-3bccf6b49efc}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\CCComAttribute.cpp">
@ -228,6 +231,21 @@
<ClCompile Include="..\WidgetReader\PageViewReader\PageViewReader.cpp">
<Filter>reader\WidgetReader\PageViewReader</Filter>
</ClCompile>
<ClCompile Include="..\ActionTimeline\CCNodeReader.cpp">
<Filter>TimelineAction</Filter>
</ClCompile>
<ClCompile Include="..\ActionTimeline\CCActionTimelineCache.cpp">
<Filter>TimelineAction</Filter>
</ClCompile>
<ClCompile Include="..\ActionTimeline\CCActionTimeline.cpp">
<Filter>TimelineAction</Filter>
</ClCompile>
<ClCompile Include="..\ActionTimeline\CCFrame.cpp">
<Filter>TimelineAction</Filter>
</ClCompile>
<ClCompile Include="..\ActionTimeline\CCTimeLine.cpp">
<Filter>TimelineAction</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\CCComAttribute.h">
@ -353,9 +371,6 @@
<ClInclude Include="..\CCActionObject.h">
<Filter>action</Filter>
</ClInclude>
<ClInclude Include="..\ObjectFactory.h">
<Filter>trigger</Filter>
</ClInclude>
<ClInclude Include="..\TriggerBase.h">
<Filter>trigger</Filter>
</ClInclude>
@ -413,5 +428,23 @@
<ClInclude Include="..\WidgetReader\PageViewReader\PageViewReader.h">
<Filter>reader\WidgetReader\PageViewReader</Filter>
</ClInclude>
<ClInclude Include="..\ActionTimeline\CCNodeReader.h">
<Filter>TimelineAction</Filter>
</ClInclude>
<ClInclude Include="..\ActionTimeline\CCActionTimelineCache.h">
<Filter>TimelineAction</Filter>
</ClInclude>
<ClInclude Include="..\ActionTimeline\CCActionTimeline.h">
<Filter>TimelineAction</Filter>
</ClInclude>
<ClInclude Include="..\ActionTimeline\CCFrame.h">
<Filter>TimelineAction</Filter>
</ClInclude>
<ClInclude Include="..\ActionTimeline\CCTimeLine.h">
<Filter>TimelineAction</Filter>
</ClInclude>
<ClInclude Include="..\ActionTimeline\CCTimelineMacro.h">
<Filter>TimelineAction</Filter>
</ClInclude>
</ItemGroup>
</Project>
</Project>

View File

@ -163,6 +163,11 @@
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
<ItemGroup>
<ClCompile Include="..\ActionTimeline\CCActionTimeline.cpp" />
<ClCompile Include="..\ActionTimeline\CCActionTimelineCache.cpp" />
<ClCompile Include="..\ActionTimeline\CCFrame.cpp" />
<ClCompile Include="..\ActionTimeline\CCNodeReader.cpp" />
<ClCompile Include="..\ActionTimeline\CCTimeLine.cpp" />
<ClCompile Include="..\CCActionFrame.cpp" />
<ClCompile Include="..\CCActionFrameEasing.cpp" />
<ClCompile Include="..\CCActionManagerEx.cpp" />
@ -229,6 +234,12 @@
<ClInclude Include="..\..\..\..\external\json\reader.h" />
<ClInclude Include="..\..\..\..\external\json\stringbuffer.h" />
<ClInclude Include="..\..\..\..\external\json\writer.h" />
<ClInclude Include="..\ActionTimeline\CCActionTimeline.h" />
<ClInclude Include="..\ActionTimeline\CCActionTimelineCache.h" />
<ClInclude Include="..\ActionTimeline\CCFrame.h" />
<ClInclude Include="..\ActionTimeline\CCNodeReader.h" />
<ClInclude Include="..\ActionTimeline\CCTimeLine.h" />
<ClInclude Include="..\ActionTimeline\CCTimelineMacro.h" />
<ClInclude Include="..\CCActionFrame.h" />
<ClInclude Include="..\CCActionFrameEasing.h" />
<ClInclude Include="..\CCActionManagerEx.h" />
@ -282,4 +293,4 @@
<ClInclude Include="..\WidgetReader\WidgetReaderProtocol.h" />
<ClInclude Include="pch.h" />
</ItemGroup>
</Project>
</Project>

View File

@ -82,6 +82,9 @@
<Filter Include="reader\WidgetReader\TextReader">
<UniqueIdentifier>{695e45cf-2af5-4bdb-84a2-f0e9f3d77f11}</UniqueIdentifier>
</Filter>
<Filter Include="TimelineAction">
<UniqueIdentifier>{5f5a98dd-657c-4a9b-8862-c11555ad1293}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\CCComAttribute.cpp">
@ -229,6 +232,21 @@
<Filter>reader\WidgetReader\PageViewReader</Filter>
</ClCompile>
<ClCompile Include="pch.cpp" />
<ClCompile Include="..\ActionTimeline\CCActionTimeline.cpp">
<Filter>TimelineAction</Filter>
</ClCompile>
<ClCompile Include="..\ActionTimeline\CCActionTimelineCache.cpp">
<Filter>TimelineAction</Filter>
</ClCompile>
<ClCompile Include="..\ActionTimeline\CCFrame.cpp">
<Filter>TimelineAction</Filter>
</ClCompile>
<ClCompile Include="..\ActionTimeline\CCNodeReader.cpp">
<Filter>TimelineAction</Filter>
</ClCompile>
<ClCompile Include="..\ActionTimeline\CCTimeLine.cpp">
<Filter>TimelineAction</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\CCComAttribute.h">
@ -415,5 +433,23 @@
<Filter>reader\WidgetReader\PageViewReader</Filter>
</ClInclude>
<ClInclude Include="pch.h" />
<ClInclude Include="..\ActionTimeline\CCActionTimeline.h">
<Filter>TimelineAction</Filter>
</ClInclude>
<ClInclude Include="..\ActionTimeline\CCActionTimelineCache.h">
<Filter>TimelineAction</Filter>
</ClInclude>
<ClInclude Include="..\ActionTimeline\CCFrame.h">
<Filter>TimelineAction</Filter>
</ClInclude>
<ClInclude Include="..\ActionTimeline\CCNodeReader.h">
<Filter>TimelineAction</Filter>
</ClInclude>
<ClInclude Include="..\ActionTimeline\CCTimeLine.h">
<Filter>TimelineAction</Filter>
</ClInclude>
<ClInclude Include="..\ActionTimeline\CCTimelineMacro.h">
<Filter>TimelineAction</Filter>
</ClInclude>
</ItemGroup>
</Project>
</Project>

View File

@ -76,8 +76,8 @@
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v120_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v120_xp</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
@ -86,8 +86,8 @@
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v120_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v120_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
@ -130,13 +130,15 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<Optimization>MinSpace</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>
</SDLCheck>
<PreprocessorDefinitions>WIN32;_WINDOWS;_LIB;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DebugInformationFormat>None</DebugInformationFormat>
<WholeProgramOptimization>false</WholeProgramOptimization>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>

View File

@ -7,4 +7,4 @@
#include "Mat4.h"
#include "Quaternion.h"
#endif
#endif

View File

@ -33,4 +33,4 @@
#endif
#endif // __CCMATHBASE_H__
#endif // __CCMATHBASE_H__

View File

@ -24,14 +24,14 @@ set(COCOS_NETWORK_SRC
${PLATFORM_SRC}
)
IF ( WIN32 )
set(COCOS_NETWORK_LINK
libcurl_imp
${PLATFORM_LINK}
)
IF (WIN32 AND NOT MINGW)
set(COCOS_NETWORK_LINK
libcurl_imp
${PLATFORM_LINK}
)
ELSE()
set(COCOS_NETWORK_LINK
curl
${PLATFORM_LINK}
)
set(COCOS_NETWORK_LINK
curl
${PLATFORM_LINK}
)
ENDIF()

View File

@ -35,8 +35,8 @@
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v120_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v120_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
@ -44,8 +44,8 @@
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v120_xp</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v120_xp</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
@ -113,9 +113,11 @@
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DebugInformationFormat>None</DebugInformationFormat>
<DisableSpecificWarnings>4251</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<Optimization>MinSpace</Optimization>
<WholeProgramOptimization>false</WholeProgramOptimization>
</ClCompile>
<Link>
<AdditionalDependencies>winmm.lib;libcocos2d.lib;%(AdditionalDependencies)</AdditionalDependencies>

View File

@ -512,6 +512,7 @@ static Data getData(const std::string& filename, bool forString)
Data ret;
unsigned char* buffer = nullptr;
ssize_t size = 0;
size_t readsize;
const char* mode = nullptr;
if (forString)
mode = "rt";
@ -538,11 +539,16 @@ static Data getData(const std::string& filename, bool forString)
buffer = (unsigned char*)malloc(sizeof(unsigned char) * size);
}
size = fread(buffer, sizeof(unsigned char), size, fp);
readsize = fread(buffer, sizeof(unsigned char), size, fp);
fclose(fp);
if (forString && readsize < size)
{
buffer[readsize] = '\0';
}
} while (0);
if (nullptr == buffer || 0 == size)
if (nullptr == buffer || 0 == readsize)
{
std::string msg = "Get data from file(";
msg.append(filename).append(") failed!");
@ -550,7 +556,7 @@ static Data getData(const std::string& filename, bool forString)
}
else
{
ret.fastSet(buffer, size);
ret.fastSet(buffer, readsize);
}
return ret;

View File

@ -265,7 +265,7 @@ void GLViewProtocol::handleTouchesBegin(int num, intptr_t ids[], float xs[], flo
touch->setTouchInfo(unusedIndex, (x - _viewPortRect.origin.x) / _scaleX,
(y - _viewPortRect.origin.y) / _scaleY);
CCLOGINFO("x = %f y = %f", pTouch->getLocationInView().x, pTouch->getLocationInView().y);
CCLOGINFO("x = %f y = %f", touch->getLocationInView().x, touch->getLocationInView().y);
g_touchIdReorderMap.insert(std::make_pair(id, unusedIndex));
touchEvent._touches.push_back(touch);

View File

@ -16,4 +16,4 @@ int getDPIJNI()
return ret;
}
} // extern "C"
} // extern "C"

View File

@ -58,4 +58,4 @@ void LuaLog(const char * format)
NS_CC_END
#endif // CC_PLATFORM_IOS
#endif // CC_PLATFORM_IOS

View File

@ -136,4 +136,4 @@ private:
NS_CC_END
#endif
#endif

View File

@ -1,3 +1,3 @@
#pragma once
#include "cocos2d.h"
#include "cocos2d.h"

View File

@ -419,4 +419,4 @@ void SHA1ConvertMessageToString(uint8_t *hash_binary, char* hash_string)
hash_string[2*i + 1] = alphabet[hash_binary[i] % 16];
}
hash_string[SHA1HashSize * 2] = '\0';
}
}

View File

@ -90,4 +90,4 @@ int SHA1Result( SHA1Context *,
void SHA1ConvertMessageToString(uint8_t *hash_binary, char* hash_string);
#endif
#endif

View File

@ -62,4 +62,4 @@ HRESULT Direct3DContentProvider::PrepareResources(_In_ const LARGE_INTEGER* pres
HRESULT Direct3DContentProvider::Draw(_In_ ID3D11Device1* device, _In_ ID3D11DeviceContext1* context, _In_ ID3D11RenderTargetView* renderTargetView)
{
return m_controller->Draw(device, context, renderTargetView);
}
}

View File

@ -49,4 +49,4 @@ public:
private:
PhoneDirect3DXamlAppComponent::Direct3DInterop^ m_controller;
Microsoft::WRL::ComPtr<IDrawingSurfaceRuntimeHostNative> m_host;
};
};

View File

@ -185,4 +185,4 @@ bool Direct3DInterop::SendCocos2dEvent(Cocos2dEvent event)
return false;
}
}
}

View File

@ -81,4 +81,4 @@ protected private:
Microsoft::WRL::ComPtr<IWinPhone8XamlD3DWindow> m_eglPhoneWindow;
DirectX::XMMATRIX m_orientationMatrix;
float m_aspectRatio;
};
};

View File

@ -45,4 +45,4 @@ namespace PhoneDirect3DXamlAppComponent
};
}
#endif
#endif

View File

@ -43,4 +43,4 @@ protected private:
};
#endif // 0
#endif // 0

View File

@ -1,3 +1,3 @@
#pragma once
#include "cocos2d.h"
#include "cocos2d.h"

File diff suppressed because it is too large Load Diff

View File

@ -70,4 +70,4 @@ void BatchCommand::execute()
_textureAtlas->drawQuads();
}
NS_CC_END
NS_CC_END

View File

@ -50,4 +50,4 @@ void CustomCommand::execute()
}
}
NS_CC_END
NS_CC_END

View File

@ -177,4 +177,4 @@ void MeshCommand::execute()
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
NS_CC_END
NS_CC_END

View File

@ -34,7 +34,7 @@ NS_CC_BEGIN
class GLProgramState;
class GLProgram;
class Uniform;
struct Uniform;
//it is a common mesh
class MeshCommand : public RenderCommand

View File

@ -97,4 +97,4 @@ void QuadCommand::useMaterial() const
_glProgramState->apply(_mv);
}
NS_CC_END
NS_CC_END

View File

@ -60,4 +60,4 @@ void RenderCommand::printID()
printf("Command Depth: %f\n", _globalOrder);
}
NS_CC_END
NS_CC_END

View File

@ -0,0 +1,22 @@
--------------------------------
-- @module ActionTimelineData
-- @extend Ref
--------------------------------
-- @function [parent=#ActionTimelineData] setActionTag
-- @param self
-- @param #int int
--------------------------------
-- @function [parent=#ActionTimelineData] getActionTag
-- @param self
-- @return int#int ret (return value: int)
--------------------------------
-- @function [parent=#ActionTimelineData] create
-- @param self
-- @param #int int
-- @return timeline::ActionTimelineData#timeline::ActionTimelineData ret (return value: ccs.timeline::ActionTimelineData)
return nil

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