ccb 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +20 -0
- data/README.md +31 -0
- data/bin/ccb +4 -0
- data/lib/ccb/builder/project_builder.rb +14 -0
- data/lib/ccb/builder/scene_builder.rb +9 -0
- data/lib/ccb/builder/templates/project/GameConfig.js.tt +21 -0
- data/lib/ccb/builder/templates/project/_cocos-project.json +4 -0
- data/lib/ccb/builder/templates/project/folder/CMakeLists.txt +295 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/Base64Images.js +32 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/CCBoot.js +2271 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/CCDebugger.js +336 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/actions/CCAction.js +694 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/actions/CCActionCamera.js +293 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/actions/CCActionCatmullRom.js +605 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/actions/CCActionEase.js +3681 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/actions/CCActionInstant.js +757 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/actions/CCActionInterval.js +3554 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/actions/CCActionTween.js +166 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/actions3d/CCActionGrid.js +372 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/actions3d/CCActionGrid3D.js +1257 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/actions3d/CCActionPageTurn3D.js +113 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/actions3d/CCActionTiledGrid.js +1289 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/audio/CCAudio.js +1024 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/clipping-nodes/CCClippingNode.js +224 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/clipping-nodes/CCClippingNodeCanvasRenderCmd.js +227 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/clipping-nodes/CCClippingNodeWebGLRenderCmd.js +226 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/compression/ZipUtils.js +82 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/compression/base64.js +95 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/compression/gzip.js +731 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/compression/zlib.min.js +55 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/CCActionManager.js +378 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/CCCamera.js +290 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/CCConfiguration.js +294 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/CCDirector.js +1019 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/CCDirectorWebGL.js +329 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/CCDrawingPrimitivesCanvas.js +438 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/CCDrawingPrimitivesWebGL.js +464 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/CCScheduler.js +744 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/base-nodes/BaseNodesPropertyDefine.js +127 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/base-nodes/CCAtlasNode.js +294 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/base-nodes/CCAtlasNodeCanvasRenderCmd.js +138 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/base-nodes/CCAtlasNodeWebGLRenderCmd.js +145 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/base-nodes/CCNode.js +2386 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/base-nodes/CCNodeCanvasRenderCmd.js +504 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/base-nodes/CCNodeWebGLRenderCmd.js +254 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/cocoa/CCAffineTransform.js +259 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/cocoa/CCGeometry.js +327 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/event-manager/CCEvent.js +449 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/event-manager/CCEventExtension.js +126 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/event-manager/CCEventListener.js +519 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/event-manager/CCEventManager.js +1025 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/event-manager/CCTouch.js +175 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/labelttf/CCLabelTTF.js +829 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/labelttf/CCLabelTTFCanvasRenderCmd.js +420 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/labelttf/CCLabelTTFWebGLRenderCmd.js +101 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/labelttf/LabelTTFPropertyDefine.js +88 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/layers/CCLayer.js +642 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/layers/CCLayerCanvasRenderCmd.js +434 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/layers/CCLayerWebGLRenderCmd.js +248 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/CCClass.js +333 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/CCCommon.js +303 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/CCConfig.js +303 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/CCEGLView.js +1245 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/CCInputExtension.js +135 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/CCInputManager.js +616 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/CCLoaders.js +142 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/CCMacro.js +830 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/CCSAXParser.js +160 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/CCScreen.js +155 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/CCTypes.js +374 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/CCTypesPropertyDefine.js +165 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/CCTypesWebGL.js +689 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/CCVisibleRect.js +100 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/platform/miniFramework.js +264 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/renderer/RendererCanvas.js +274 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/renderer/RendererWebGL.js +137 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/scenes/CCLoaderScene.js +149 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/scenes/CCScene.js +62 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/sprites/CCAnimation.js +477 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/sprites/CCAnimationCache.js +213 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/sprites/CCBakeSprite.js +71 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/sprites/CCSprite.js +1014 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/sprites/CCSpriteBatchNode.js +676 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/sprites/CCSpriteBatchNodeCanvasRenderCmd.js +101 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/sprites/CCSpriteBatchNodeWebGLRenderCmd.js +243 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/sprites/CCSpriteCanvasRenderCmd.js +518 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/sprites/CCSpriteFrame.js +420 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/sprites/CCSpriteFrameCache.js +341 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/sprites/CCSpriteWebGLRenderCmd.js +493 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/sprites/SpritesPropertyDefine.js +67 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/support/CCPointExtension.js +515 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/support/CCVertex.js +170 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/support/TransformUtils.js +62 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/textures/CCTexture2D.js +455 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/textures/CCTextureAtlas.js +653 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/textures/CCTextureCache.js +371 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/textures/TexturesPropertyDefine.js +221 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/textures/TexturesWebGL.js +899 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/core/utils/BinaryLoader.js +151 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/effects/CCGrabber.js +110 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/effects/CCGrid.js +737 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/kazmath/aabb.js +68 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/kazmath/gl/mat4stack.js +59 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/kazmath/gl/matrix.js +169 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/kazmath/mat3.js +329 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/kazmath/mat4.js +810 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/kazmath/plane.js +184 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/kazmath/quaternion.js +497 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/kazmath/ray2.js +163 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/kazmath/utility.js +76 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/kazmath/vec2.js +107 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/kazmath/vec3.js +205 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/kazmath/vec4.js +158 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/labels/CCLabelAtlas.js +239 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/labels/CCLabelAtlasCanvasRenderCmd.js +95 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/labels/CCLabelAtlasWebGLRenderCmd.js +132 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/labels/CCLabelBMFont.js +958 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/labels/CCLabelBMFontCanvasRenderCmd.js +142 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/labels/CCLabelBMFontWebGLRenderCmd.js +87 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/menus/CCMenu.js +600 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/menus/CCMenuItem.js +1422 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/motion-streak/CCMotionStreak.js +517 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/motion-streak/CCMotionStreakWebGLRenderCmd.js +66 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/node-grid/CCNodeGrid.js +129 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/node-grid/CCNodeGridWebGLRenderCmd.js +98 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/parallax/CCParallaxNode.js +252 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/parallax/CCParallaxNodeRenderCmd.js +69 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/particle/CCPNGReader.js +330 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/particle/CCParticleBatchNode.js +527 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/particle/CCParticleBatchNodeCanvasRenderCmd.js +38 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/particle/CCParticleBatchNodeWebGLRenderCmd.js +74 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/particle/CCParticleExamples.js +1006 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/particle/CCParticleSystem.js +2294 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/particle/CCParticleSystemCanvasRenderCmd.js +217 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/particle/CCParticleSystemWebGLRenderCmd.js +402 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/particle/CCTIFFReader.js +692 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/physics/CCPhysicsDebugNode.js +212 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/physics/CCPhysicsDebugNodeCanvasRenderCmd.js +52 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/physics/CCPhysicsDebugNodeWebGLRenderCmd.js +53 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/physics/CCPhysicsSprite.js +447 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/physics/CCPhysicsSpriteCanvasRenderCmd.js +93 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/physics/CCPhysicsSpriteWebGLRenderCmd.js +87 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/progress-timer/CCActionProgressTimer.js +227 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/progress-timer/CCProgressTimer.js +345 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/progress-timer/CCProgressTimerCanvasRenderCmd.js +270 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/progress-timer/CCProgressTimerWebGLRenderCmd.js +486 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/render-texture/CCRenderTexture.js +395 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/render-texture/CCRenderTextureCanvasRenderCmd.js +105 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/render-texture/CCRenderTextureWebGLRenderCmd.js +367 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/shaders/CCGLProgram.js +767 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/shaders/CCGLStateCache.js +340 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/shaders/CCShaderCache.js +301 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/shaders/CCShaders.js +280 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/shape-nodes/CCDrawNode.js +940 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/shape-nodes/CCDrawNodeCanvasRenderCmd.js +129 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/shape-nodes/CCDrawNodeWebGLRenderCmd.js +41 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/text-input/CCIMEDispatcher.js +526 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/text-input/CCTextFieldTTF.js +472 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/tilemap/CCTGAlib.js +437 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/tilemap/CCTMXLayer.js +914 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/tilemap/CCTMXLayerCanvasRenderCmd.js +232 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/tilemap/CCTMXLayerWebGLRenderCmd.js +67 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/tilemap/CCTMXObjectGroup.js +146 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/tilemap/CCTMXTiledMap.js +479 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/tilemap/CCTMXXMLParser.js +950 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/transitions/CCTransition.js +1971 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/transitions/CCTransitionPageTurn.js +152 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/cocos2d/transitions/CCTransitionProgress.js +458 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccb-reader/CCBAnimationManager.js +770 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccb-reader/CCBKeyframe.js +60 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccb-reader/CCBReader.js +1129 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccb-reader/CCBReaderUtil.js +61 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccb-reader/CCBRelativePositioning.js +90 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccb-reader/CCBSequence.js +114 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccb-reader/CCBValue.js +81 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccb-reader/CCControlLoader.js +318 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccb-reader/CCNodeLoader.js +905 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccb-reader/CCNodeLoaderLibrary.js +101 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccb-reader/CCSpriteLoader.js +544 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccpool/CCPool.js +146 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/base-classes/CCProtectedNode.js +305 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/base-classes/CCProtectedNodeCanvasRenderCmd.js +246 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/base-classes/CCProtectedNodeWebGLRenderCmd.js +159 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/base-classes/UIScale9Sprite.js +1105 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/base-classes/UIScale9SpriteCanvasRenderCmd.js +142 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/base-classes/UIScale9SpriteWebGLRenderCmd.js +129 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/base-classes/UIWidget.js +2059 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/base-classes/UIWidgetRenderCmd.js +100 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/layouts/UIHBox.js +80 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/layouts/UILayout.js +1558 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/layouts/UILayoutCanvasRenderCmd.js +179 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/layouts/UILayoutComponent.js +585 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/layouts/UILayoutManager.js +457 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/layouts/UILayoutParameter.js +576 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/layouts/UILayoutWebGLRenderCmd.js +240 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/layouts/UIRelativeBox.js +79 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/layouts/UIVBox.js +79 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/system/CocosGUI.js +62 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/system/UIHelper.js +164 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/uiwidgets/UIButton.js +987 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/uiwidgets/UICheckBox.js +737 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/uiwidgets/UIImageView.js +337 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/uiwidgets/UILoadingBar.js +432 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/uiwidgets/UIRichText.js +579 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/uiwidgets/UISlider.js +762 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/uiwidgets/UIText.js +512 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/uiwidgets/UITextAtlas.js +229 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/uiwidgets/UITextBMFont.js +216 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/uiwidgets/UITextField.js +915 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/uiwidgets/scroll-widget/UIListView.js +602 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/uiwidgets/scroll-widget/UIPageView.js +657 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/ccui/uiwidgets/scroll-widget/UIScrollView.js +1884 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/CocoStudio.js +68 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/action/CCActionFrame.js +528 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/action/CCActionManager.js +112 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/action/CCActionNode.js +417 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/action/CCActionObject.js +263 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/CCArmature.js +579 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/CCArmatureCanvasRenderCmd.js +190 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/CCArmatureWebGLRenderCmd.js +167 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/CCBone.js +711 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/animation/CCArmatureAnimation.js +669 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/animation/CCProcessBase.js +365 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/animation/CCTween.js +448 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/datas/CCDatas.js +807 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/display/CCDecorativeDisplay.js +118 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/display/CCDisplayFactory.js +220 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/display/CCDisplayManager.js +465 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/display/CCSkin.js +215 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/display/CCSkinCanvasRenderCmd.js +58 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/display/CCSkinWebGLRenderCmd.js +146 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/physics/CCColliderDetector.js +397 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/utils/CCArmatureDataManager.js +325 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/utils/CCArmatureDefine.js +45 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/utils/CCDataReaderHelper.js +1223 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/utils/CCSpriteFrameCacheHelper.js +68 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/utils/CCTransformHelp.js +183 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/utils/CCTweenFunction.js +501 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/armature/utils/CCUtilMath.js +69 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/components/CCComAttribute.js +210 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/components/CCComAudio.js +285 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/components/CCComController.js +76 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/components/CCComRender.js +91 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/components/CCComponent.js +136 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/components/CCComponentContainer.js +159 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/loader/load.js +221 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/loader/parsers/action-1.x.js +238 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/loader/parsers/action-2.x.js +266 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/loader/parsers/compatible.js +251 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/loader/parsers/scene-1.x.js +262 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/loader/parsers/timelineParser-1.x.js +292 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/loader/parsers/timelineParser-2.x.js +1288 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/loader/parsers/uiParser-1.x.js +680 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/timeline/ActionTimeline.js +448 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/timeline/Frame.js +1268 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/timeline/Timeline.js +321 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/trigger/ObjectFactory.js +99 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/trigger/TriggerBase.js +49 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/trigger/TriggerMng.js +301 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/cocostudio/trigger/TriggerObj.js +263 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/editbox/CCEditBox.js +716 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/editbox/CCdomNode.js +657 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCControl.js +381 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCControlButton.js +688 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCControlColourPicker.js +187 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCControlHuePicker.js +218 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCControlPotentiometer.js +300 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCControlSaturationBrightnessPicker.js +257 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCControlSlider.js +308 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCControlStepper.js +390 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCControlSwitch.js +425 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCControlUtils.js +177 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCInvocation.js +65 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCMenuPassive.js +415 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCScale9Sprite.js +1099 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCScale9SpriteCanvasRenderCmd.js +142 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/control-extension/CCScale9SpriteWebGLRenderCmd.js +129 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/scrollview/CCScrollView.js +827 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/scrollview/CCScrollViewCanvasRenderCmd.js +79 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/scrollview/CCScrollViewWebGLRenderCmd.js +108 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/scrollview/CCSorting.js +239 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/gui/scrollview/CCTableView.js +718 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/spine/CCSkeleton.js +357 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/spine/CCSkeletonAnimation.js +340 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/spine/CCSkeletonCanvasRenderCmd.js +165 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/spine/CCSkeletonWebGLRenderCmd.js +165 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/extensions/spine/Spine.js +2239 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/external/box2d/box2d.js +10882 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/external/chipmunk/chipmunk.js +6196 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/external/pluginx/Plugin.js +254 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/external/pluginx/platform/facebook.js +557 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/external/pluginx/platform/facebook_sdk.js +151 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/external/socketio/socket.io.min.js +2 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/jsb_apis.js +618 -0
- data/lib/ccb/builder/templates/project/folder/frameworks/cocos2d-html5/moduleConfig.json +453 -0
- data/lib/ccb/builder/templates/project/folder/project.json +42 -0
- data/lib/ccb/builder/templates/project/folder/res/CloseNormal.png +0 -0
- data/lib/ccb/builder/templates/project/folder/res/CloseSelected.png +0 -0
- data/lib/ccb/builder/templates/project/folder/res/HelloWorld.png +0 -0
- data/lib/ccb/builder/templates/project/folder/res/favicon.ico +0 -0
- data/lib/ccb/builder/templates/project/folder/res/gameOver/cocos2d-html5.png +0 -0
- data/lib/ccb/builder/templates/project/folder/res/gameOver/gameOver.png +0 -0
- data/lib/ccb/builder/templates/project/folder/res/mainMenu/bg.png +0 -0
- data/lib/ccb/builder/templates/project/folder/res/mainMenu/menu.png +0 -0
- data/lib/ccb/builder/templates/project/folder/res/setting/menuTitle.png +0 -0
- data/lib/ccb/builder/templates/project/folder/res/shared/arial-14.fnt +182 -0
- data/lib/ccb/builder/templates/project/folder/res/shared/arial-14.png +0 -0
- data/lib/ccb/builder/templates/project/folder/res/sound/music/bgMusic.mp3 +0 -0
- data/lib/ccb/builder/templates/project/folder/src/about/layer/ABBackgroundLayer.js +23 -0
- data/lib/ccb/builder/templates/project/folder/src/about/layer/ABTouchLayer.js +51 -0
- data/lib/ccb/builder/templates/project/folder/src/about/scene/About.js +36 -0
- data/lib/ccb/builder/templates/project/folder/src/config/Level.js +7 -0
- data/lib/ccb/builder/templates/project/folder/src/gameOver/layer/GOBackgroundLayer.js +50 -0
- data/lib/ccb/builder/templates/project/folder/src/gameOver/layer/GOTouchLayer.js +51 -0
- data/lib/ccb/builder/templates/project/folder/src/gameOver/scene/GameOver.js +38 -0
- data/lib/ccb/builder/templates/project/folder/src/gamePlay/classes/LevelManager.js +21 -0
- data/lib/ccb/builder/templates/project/folder/src/gamePlay/layer/GPBackgroundLayer.js +25 -0
- data/lib/ccb/builder/templates/project/folder/src/gamePlay/layer/GPTouchLayer.js +51 -0
- data/lib/ccb/builder/templates/project/folder/src/gamePlay/scene/GamePlay.js +44 -0
- data/lib/ccb/builder/templates/project/folder/src/mainMenu/layer/MMBackgroundLayer.js +43 -0
- data/lib/ccb/builder/templates/project/folder/src/mainMenu/layer/MMMainMenuLayer.js +38 -0
- data/lib/ccb/builder/templates/project/folder/src/mainMenu/layer/MMTouchLayer.js +96 -0
- data/lib/ccb/builder/templates/project/folder/src/mainMenu/scene/MainMenu.js +45 -0
- data/lib/ccb/builder/templates/project/folder/src/resource.js +29 -0
- data/lib/ccb/builder/templates/project/folder/src/setting/layer/STBackgroundLayer.js +25 -0
- data/lib/ccb/builder/templates/project/folder/src/setting/layer/STTouchLayer.js +89 -0
- data/lib/ccb/builder/templates/project/folder/src/setting/scene/Setting.js +40 -0
- data/lib/ccb/builder/templates/project/index.html.tt +27 -0
- data/lib/ccb/builder/templates/project/main.js.tt +62 -0
- data/lib/ccb/cli.rb +32 -0
- data/lib/ccb/ext/method_hooker.rb +68 -0
- data/lib/ccb/ext/string_extention.rb +7 -0
- data/lib/ccb.rb +1 -0
- metadata +449 -0
@@ -0,0 +1,129 @@
|
|
1
|
+
/****************************************************************************
|
2
|
+
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
3
|
+
|
4
|
+
http://www.cocos2d-x.org
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
8
|
+
in the Software without restriction, including without limitation the rights
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
11
|
+
furnished to do so, subject to the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
14
|
+
all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
THE SOFTWARE.
|
23
|
+
****************************************************************************/
|
24
|
+
|
25
|
+
(function(){
|
26
|
+
|
27
|
+
cc.DrawNode.CanvasRenderCmd = function(renderableObject){
|
28
|
+
cc.Node.CanvasRenderCmd.call(this, renderableObject);
|
29
|
+
this._needDraw = true;
|
30
|
+
this._buffer = null;
|
31
|
+
this._drawColor = null;
|
32
|
+
this._blendFunc = null;
|
33
|
+
};
|
34
|
+
|
35
|
+
cc.DrawNode.CanvasRenderCmd.prototype = Object.create(cc.Node.CanvasRenderCmd.prototype);
|
36
|
+
cc.DrawNode.CanvasRenderCmd.prototype.constructor = cc.DrawNode.CanvasRenderCmd;
|
37
|
+
|
38
|
+
cc.DrawNode.CanvasRenderCmd.prototype.rendering = function (ctx, scaleX, scaleY) {
|
39
|
+
var wrapper = ctx || cc._renderContext, context = wrapper.getContext(), node = this._node;
|
40
|
+
var alpha = node._displayedOpacity / 255;
|
41
|
+
if (alpha === 0)
|
42
|
+
return;
|
43
|
+
|
44
|
+
wrapper.setTransform(this._worldTransform, scaleX, scaleY);
|
45
|
+
|
46
|
+
//context.save();
|
47
|
+
wrapper.setGlobalAlpha(alpha);
|
48
|
+
if ((this._blendFunc && (this._blendFunc.src == cc.SRC_ALPHA) && (this._blendFunc.dst == cc.ONE)))
|
49
|
+
wrapper.setCompositeOperation('lighter'); //todo: need refactor
|
50
|
+
var locBuffer = this._buffer;
|
51
|
+
for (var i = 0, len = locBuffer.length; i < len; i++) {
|
52
|
+
var element = locBuffer[i];
|
53
|
+
switch (element.type) {
|
54
|
+
case cc.DrawNode.TYPE_DOT:
|
55
|
+
this._drawDot(wrapper, element, scaleX, scaleY);
|
56
|
+
break;
|
57
|
+
case cc.DrawNode.TYPE_SEGMENT:
|
58
|
+
this._drawSegment(wrapper, element, scaleX, scaleY);
|
59
|
+
break;
|
60
|
+
case cc.DrawNode.TYPE_POLY:
|
61
|
+
this._drawPoly(wrapper, element, scaleX, scaleY);
|
62
|
+
break;
|
63
|
+
}
|
64
|
+
}
|
65
|
+
//context.restore(); //todo It can be reserve
|
66
|
+
};
|
67
|
+
|
68
|
+
cc.DrawNode.CanvasRenderCmd.prototype._drawDot = function (wrapper, element, scaleX, scaleY) {
|
69
|
+
var locColor = element.fillColor, locPos = element.verts[0], locRadius = element.lineWidth;
|
70
|
+
|
71
|
+
var ctx = wrapper.getContext();
|
72
|
+
wrapper.setFillStyle("rgba(" + (0 | locColor.r) + "," + (0 | locColor.g) + "," + (0 | locColor.b) + "," + locColor.a / 255 + ")");
|
73
|
+
|
74
|
+
ctx.beginPath();
|
75
|
+
ctx.arc(locPos.x * scaleX, -locPos.y * scaleY, locRadius * scaleX, 0, Math.PI * 2, false);
|
76
|
+
ctx.closePath();
|
77
|
+
ctx.fill();
|
78
|
+
};
|
79
|
+
|
80
|
+
cc.DrawNode.CanvasRenderCmd.prototype._drawSegment = function (wrapper, element, scaleX, scaleY) {
|
81
|
+
var locColor = element.lineColor;
|
82
|
+
var locFrom = element.verts[0], locTo = element.verts[1];
|
83
|
+
var locLineWidth = element.lineWidth, locLineCap = element.lineCap;
|
84
|
+
|
85
|
+
var ctx = wrapper.getContext();
|
86
|
+
wrapper.setStrokeStyle("rgba(" + (0 | locColor.r) + "," + (0 | locColor.g) + "," + (0 | locColor.b) + "," + locColor.a / 255 + ")");
|
87
|
+
|
88
|
+
ctx.lineWidth = locLineWidth * scaleX;
|
89
|
+
ctx.beginPath();
|
90
|
+
ctx.lineCap = locLineCap;
|
91
|
+
ctx.moveTo(locFrom.x * scaleX, -locFrom.y * scaleY);
|
92
|
+
ctx.lineTo(locTo.x * scaleX, -locTo.y * scaleY);
|
93
|
+
ctx.stroke();
|
94
|
+
};
|
95
|
+
|
96
|
+
cc.DrawNode.CanvasRenderCmd.prototype._drawPoly = function (wrapper, element, scaleX, scaleY) {
|
97
|
+
var locVertices = element.verts, locLineCap = element.lineCap;
|
98
|
+
if (locVertices == null)
|
99
|
+
return;
|
100
|
+
|
101
|
+
var locFillColor = element.fillColor, locLineWidth = element.lineWidth;
|
102
|
+
var locLineColor = element.lineColor, locIsClosePolygon = element.isClosePolygon;
|
103
|
+
var locIsFill = element.isFill, locIsStroke = element.isStroke;
|
104
|
+
|
105
|
+
var ctx = wrapper.getContext();
|
106
|
+
var firstPoint = locVertices[0];
|
107
|
+
ctx.lineCap = locLineCap;
|
108
|
+
if (locFillColor)
|
109
|
+
wrapper.setFillStyle("rgba(" + (0 | locFillColor.r) + "," + (0 | locFillColor.g) + ","
|
110
|
+
+ (0 | locFillColor.b) + "," + locFillColor.a / 255 + ")");
|
111
|
+
if (locLineWidth)
|
112
|
+
ctx.lineWidth = locLineWidth * scaleX;
|
113
|
+
if (locLineColor)
|
114
|
+
wrapper.setStrokeStyle("rgba(" + (0 | locLineColor.r) + "," + (0 | locLineColor.g) + ","
|
115
|
+
+ (0 | locLineColor.b) + "," + locLineColor.a / 255 + ")");
|
116
|
+
|
117
|
+
ctx.beginPath();
|
118
|
+
ctx.moveTo(firstPoint.x * scaleX, -firstPoint.y * scaleY);
|
119
|
+
for (var i = 1, len = locVertices.length; i < len; i++)
|
120
|
+
ctx.lineTo(locVertices[i].x * scaleX, -locVertices[i].y * scaleY);
|
121
|
+
|
122
|
+
if (locIsClosePolygon)
|
123
|
+
ctx.closePath();
|
124
|
+
if (locIsFill)
|
125
|
+
ctx.fill();
|
126
|
+
if (locIsStroke)
|
127
|
+
ctx.stroke();
|
128
|
+
};
|
129
|
+
})();
|
@@ -0,0 +1,41 @@
|
|
1
|
+
/****************************************************************************
|
2
|
+
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
3
|
+
|
4
|
+
http://www.cocos2d-x.org
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
8
|
+
in the Software without restriction, including without limitation the rights
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
11
|
+
furnished to do so, subject to the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
14
|
+
all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
THE SOFTWARE.
|
23
|
+
****************************************************************************/
|
24
|
+
|
25
|
+
(function(){
|
26
|
+
cc.DrawNode.WebGLRenderCmd = function (renderableObject) {
|
27
|
+
cc.Node.WebGLRenderCmd.call(this, renderableObject);
|
28
|
+
this._needDraw = true;
|
29
|
+
};
|
30
|
+
|
31
|
+
cc.DrawNode.WebGLRenderCmd.prototype = Object.create(cc.Node.WebGLRenderCmd.prototype);
|
32
|
+
cc.DrawNode.WebGLRenderCmd.prototype.constructor = cc.DrawNode.WebGLRenderCmd;
|
33
|
+
|
34
|
+
cc.DrawNode.WebGLRenderCmd.prototype.rendering = function (ctx) {
|
35
|
+
var node = this._node;
|
36
|
+
cc.glBlendFunc(node._blendFunc.src, node._blendFunc.dst);
|
37
|
+
this._shaderProgram.use();
|
38
|
+
this._shaderProgram._setUniformForMVPMatrixWithMat4(this._stackMatrix);
|
39
|
+
node._render();
|
40
|
+
};
|
41
|
+
})();
|
@@ -0,0 +1,526 @@
|
|
1
|
+
/****************************************************************************
|
2
|
+
Copyright (c) 2008-2010 Ricardo Quesada
|
3
|
+
Copyright (c) 2011-2012 cocos2d-x.org
|
4
|
+
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
5
|
+
|
6
|
+
http://www.cocos2d-x.org
|
7
|
+
|
8
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
9
|
+
of this software and associated documentation files (the "Software"), to deal
|
10
|
+
in the Software without restriction, including without limitation the rights
|
11
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
12
|
+
copies of the Software, and to permit persons to whom the Software is
|
13
|
+
furnished to do so, subject to the following conditions:
|
14
|
+
|
15
|
+
The above copyright notice and this permission notice shall be included in
|
16
|
+
all copies or substantial portions of the Software.
|
17
|
+
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
21
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24
|
+
THE SOFTWARE.
|
25
|
+
****************************************************************************/
|
26
|
+
|
27
|
+
/**
|
28
|
+
* IME Keyboard Notification Info structure
|
29
|
+
* @param {cc.Rect} begin the soft keyboard rectangle when animatin begin
|
30
|
+
* @param {cc.Rect} end the soft keyboard rectangle when animatin end
|
31
|
+
* @param {Number} duration the soft keyboard animation duration
|
32
|
+
*/
|
33
|
+
cc.IMEKeyboardNotificationInfo = function (begin, end, duration) {
|
34
|
+
this.begin = begin || cc.rect(0, 0, 0, 0);
|
35
|
+
this.end = end || cc.rect(0, 0, 0, 0);
|
36
|
+
this.duration = duration || 0;
|
37
|
+
};
|
38
|
+
|
39
|
+
/**
|
40
|
+
* Input method editor delegate.
|
41
|
+
* @class
|
42
|
+
* @extends cc.Class
|
43
|
+
*/
|
44
|
+
cc.IMEDelegate = cc.Class.extend(/** @lends cc.IMEDelegate# */{
|
45
|
+
/**
|
46
|
+
* Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
|
47
|
+
*/
|
48
|
+
ctor:function () {
|
49
|
+
cc.imeDispatcher.addDelegate(this);
|
50
|
+
},
|
51
|
+
/**
|
52
|
+
* Remove delegate
|
53
|
+
*/
|
54
|
+
removeDelegate:function () {
|
55
|
+
cc.imeDispatcher.removeDelegate(this);
|
56
|
+
},
|
57
|
+
/**
|
58
|
+
* Remove delegate
|
59
|
+
* @return {Boolean}
|
60
|
+
*/
|
61
|
+
attachWithIME:function () {
|
62
|
+
return cc.imeDispatcher.attachDelegateWithIME(this);
|
63
|
+
},
|
64
|
+
/**
|
65
|
+
* Detach with IME
|
66
|
+
* @return {Boolean}
|
67
|
+
*/
|
68
|
+
detachWithIME:function () {
|
69
|
+
return cc.imeDispatcher.detachDelegateWithIME(this);
|
70
|
+
},
|
71
|
+
|
72
|
+
/**
|
73
|
+
* Decide the delegate instance is ready for receive ime message or not.<br />
|
74
|
+
* Called by CCIMEDispatcher.
|
75
|
+
* @return {Boolean}
|
76
|
+
*/
|
77
|
+
canAttachWithIME:function () {
|
78
|
+
return false;
|
79
|
+
},
|
80
|
+
|
81
|
+
/**
|
82
|
+
* When the delegate detach with IME, this method call by CCIMEDispatcher.
|
83
|
+
*/
|
84
|
+
didAttachWithIME:function () {
|
85
|
+
},
|
86
|
+
|
87
|
+
/**
|
88
|
+
* Decide the delegate instance can stop receive ime message or not.
|
89
|
+
* @return {Boolean}
|
90
|
+
*/
|
91
|
+
canDetachWithIME:function () {
|
92
|
+
return false;
|
93
|
+
},
|
94
|
+
|
95
|
+
/**
|
96
|
+
* When the delegate detach with IME, this method call by CCIMEDispatcher.
|
97
|
+
*/
|
98
|
+
didDetachWithIME:function () {
|
99
|
+
},
|
100
|
+
|
101
|
+
/**
|
102
|
+
* Called by CCIMEDispatcher when some text input from IME.
|
103
|
+
*/
|
104
|
+
insertText:function (text, len) {
|
105
|
+
},
|
106
|
+
|
107
|
+
/**
|
108
|
+
* Called by CCIMEDispatcher when user clicked the backward key.
|
109
|
+
*/
|
110
|
+
deleteBackward:function () {
|
111
|
+
},
|
112
|
+
|
113
|
+
/**
|
114
|
+
* Called by CCIMEDispatcher for get text which delegate already has.
|
115
|
+
* @return {String}
|
116
|
+
*/
|
117
|
+
getContentText:function () {
|
118
|
+
return "";
|
119
|
+
},
|
120
|
+
|
121
|
+
//////////////////////////////////////////////////////////////////////////
|
122
|
+
// keyboard show/hide notification
|
123
|
+
//////////////////////////////////////////////////////////////////////////
|
124
|
+
keyboardWillShow:function (info) {
|
125
|
+
},
|
126
|
+
keyboardDidShow:function (info) {
|
127
|
+
},
|
128
|
+
keyboardWillHide:function (info) {
|
129
|
+
},
|
130
|
+
keyboardDidHide:function (info) {
|
131
|
+
}
|
132
|
+
});
|
133
|
+
|
134
|
+
/**
|
135
|
+
* cc.imeDispatcher is a singleton object which manage input message dispatching.
|
136
|
+
* @class
|
137
|
+
* @name cc.imeDispatcher
|
138
|
+
*/
|
139
|
+
cc.IMEDispatcher = cc.Class.extend(/** @lends cc.imeDispatcher# */{
|
140
|
+
_domInputControl:null,
|
141
|
+
impl:null,
|
142
|
+
_currentInputString:"",
|
143
|
+
_lastClickPosition:null,
|
144
|
+
/**
|
145
|
+
* Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
|
146
|
+
*/
|
147
|
+
ctor:function () {
|
148
|
+
this.impl = new cc.IMEDispatcher.Impl();
|
149
|
+
this._lastClickPosition = cc.p(0, 0);
|
150
|
+
},
|
151
|
+
|
152
|
+
init:function () {
|
153
|
+
if (cc.sys.isMobile)
|
154
|
+
return;
|
155
|
+
this._domInputControl = cc.$("#imeDispatcherInput");
|
156
|
+
if (!this._domInputControl) {
|
157
|
+
this._domInputControl = cc.$new("input");
|
158
|
+
this._domInputControl.setAttribute("type", "text");
|
159
|
+
this._domInputControl.setAttribute("id", "imeDispatcherInput");
|
160
|
+
this._domInputControl.resize(0.0, 0.0);
|
161
|
+
this._domInputControl.translates(0, 0);
|
162
|
+
this._domInputControl.style.opacity = "0";
|
163
|
+
//this._domInputControl.style.filter = "alpha(opacity = 0)";
|
164
|
+
this._domInputControl.style.fontSize = "1px";
|
165
|
+
this._domInputControl.setAttribute('tabindex', 2);
|
166
|
+
this._domInputControl.style.position = "absolute";
|
167
|
+
this._domInputControl.style.top = 0;
|
168
|
+
this._domInputControl.style.left = 0;
|
169
|
+
document.body.appendChild(this._domInputControl);
|
170
|
+
}
|
171
|
+
var selfPointer = this;
|
172
|
+
//add event listener
|
173
|
+
cc._addEventListener(this._domInputControl, "input", function () {
|
174
|
+
selfPointer._processDomInputString(selfPointer._domInputControl.value);
|
175
|
+
}, false);
|
176
|
+
cc._addEventListener(this._domInputControl, "keydown", function (e) {
|
177
|
+
// ignore tab key
|
178
|
+
if (e.keyCode === cc.KEY.tab) {
|
179
|
+
e.stopPropagation();
|
180
|
+
e.preventDefault();
|
181
|
+
} else if (e.keyCode == cc.KEY.enter) {
|
182
|
+
selfPointer.dispatchInsertText("\n", 1);
|
183
|
+
e.stopPropagation();
|
184
|
+
e.preventDefault();
|
185
|
+
}
|
186
|
+
}, false);
|
187
|
+
|
188
|
+
if (/msie/i.test(navigator.userAgent)) {
|
189
|
+
cc._addEventListener(this._domInputControl, "keyup", function (e) {
|
190
|
+
if (e.keyCode == cc.KEY.backspace) {
|
191
|
+
selfPointer._processDomInputString(selfPointer._domInputControl.value);
|
192
|
+
}
|
193
|
+
}, false);
|
194
|
+
}
|
195
|
+
|
196
|
+
cc._addEventListener(window, 'mousedown', function (event) {
|
197
|
+
var tx = event.pageX || 0;
|
198
|
+
var ty = event.pageY || 0;
|
199
|
+
|
200
|
+
selfPointer._lastClickPosition.x = tx;
|
201
|
+
selfPointer._lastClickPosition.y = ty;
|
202
|
+
}, false);
|
203
|
+
},
|
204
|
+
|
205
|
+
_processDomInputString:function (text) {
|
206
|
+
var i, startPos;
|
207
|
+
var len = this._currentInputString.length < text.length ? this._currentInputString.length : text.length;
|
208
|
+
for (startPos = 0; startPos < len; startPos++) {
|
209
|
+
if (text[startPos] !== this._currentInputString[startPos])
|
210
|
+
break;
|
211
|
+
}
|
212
|
+
var delTimes = this._currentInputString.length - startPos;
|
213
|
+
var insTimes = text.length - startPos;
|
214
|
+
for (i = 0; i < delTimes; i++)
|
215
|
+
this.dispatchDeleteBackward();
|
216
|
+
|
217
|
+
for (i = 0; i < insTimes; i++)
|
218
|
+
this.dispatchInsertText(text[startPos + i], 1);
|
219
|
+
|
220
|
+
this._currentInputString = text;
|
221
|
+
},
|
222
|
+
|
223
|
+
/**
|
224
|
+
* Dispatch the input text from ime
|
225
|
+
* @param {String} text
|
226
|
+
* @param {Number} len
|
227
|
+
*/
|
228
|
+
dispatchInsertText:function (text, len) {
|
229
|
+
if (!this.impl || !text || len <= 0)
|
230
|
+
return;
|
231
|
+
|
232
|
+
// there is no delegate attach with ime
|
233
|
+
if (!this.impl._delegateWithIme)
|
234
|
+
return;
|
235
|
+
|
236
|
+
this.impl._delegateWithIme.insertText(text, len);
|
237
|
+
},
|
238
|
+
|
239
|
+
/**
|
240
|
+
* Dispatch the delete backward operation
|
241
|
+
*/
|
242
|
+
dispatchDeleteBackward:function () {
|
243
|
+
if (!this.impl) {
|
244
|
+
return;
|
245
|
+
}
|
246
|
+
|
247
|
+
// there is no delegate attach with ime
|
248
|
+
if (!this.impl._delegateWithIme)
|
249
|
+
return;
|
250
|
+
|
251
|
+
this.impl._delegateWithIme.deleteBackward();
|
252
|
+
},
|
253
|
+
|
254
|
+
/**
|
255
|
+
* Get the content text, which current CCIMEDelegate which attached with IME has.
|
256
|
+
* @return {String}
|
257
|
+
*/
|
258
|
+
getContentText:function () {
|
259
|
+
if (this.impl && this.impl._delegateWithIme) {
|
260
|
+
var pszContentText = this.impl._delegateWithIme.getContentText();
|
261
|
+
return (pszContentText) ? pszContentText : "";
|
262
|
+
}
|
263
|
+
return "";
|
264
|
+
},
|
265
|
+
|
266
|
+
/**
|
267
|
+
* Dispatch keyboard notification
|
268
|
+
* @param {cc.IMEKeyboardNotificationInfo} info
|
269
|
+
*/
|
270
|
+
dispatchKeyboardWillShow:function (info) {
|
271
|
+
if (this.impl) {
|
272
|
+
for (var i = 0; i < this.impl._delegateList.length; i++) {
|
273
|
+
var delegate = this.impl._delegateList[i];
|
274
|
+
if (delegate) {
|
275
|
+
delegate.keyboardWillShow(info);
|
276
|
+
}
|
277
|
+
}
|
278
|
+
}
|
279
|
+
},
|
280
|
+
|
281
|
+
/**
|
282
|
+
* Dispatch keyboard notification
|
283
|
+
* @param {cc.IMEKeyboardNotificationInfo} info
|
284
|
+
*/
|
285
|
+
dispatchKeyboardDidShow:function (info) {
|
286
|
+
if (this.impl) {
|
287
|
+
for (var i = 0; i < this.impl._delegateList.length; i++) {
|
288
|
+
var delegate = this.impl._delegateList[i];
|
289
|
+
if (delegate)
|
290
|
+
delegate.keyboardDidShow(info);
|
291
|
+
}
|
292
|
+
}
|
293
|
+
},
|
294
|
+
|
295
|
+
/**
|
296
|
+
* Dispatch keyboard notification
|
297
|
+
* @param {cc.IMEKeyboardNotificationInfo} info
|
298
|
+
*/
|
299
|
+
dispatchKeyboardWillHide:function (info) {
|
300
|
+
if (this.impl) {
|
301
|
+
for (var i = 0; i < this.impl._delegateList.length; i++) {
|
302
|
+
var delegate = this.impl._delegateList[i];
|
303
|
+
if (delegate) {
|
304
|
+
delegate.keyboardWillHide(info);
|
305
|
+
}
|
306
|
+
}
|
307
|
+
}
|
308
|
+
},
|
309
|
+
|
310
|
+
/**
|
311
|
+
* Dispatch keyboard notification
|
312
|
+
* @param {cc.IMEKeyboardNotificationInfo} info
|
313
|
+
*/
|
314
|
+
dispatchKeyboardDidHide:function (info) {
|
315
|
+
if (this.impl) {
|
316
|
+
for (var i = 0; i < this.impl._delegateList.length; i++) {
|
317
|
+
var delegate = this.impl._delegateList[i];
|
318
|
+
if (delegate) {
|
319
|
+
delegate.keyboardDidHide(info);
|
320
|
+
}
|
321
|
+
}
|
322
|
+
}
|
323
|
+
},
|
324
|
+
|
325
|
+
/**
|
326
|
+
* Add delegate to concern ime msg
|
327
|
+
* @param {cc.IMEDelegate} delegate
|
328
|
+
* @example
|
329
|
+
* //example
|
330
|
+
* cc.imeDispatcher.addDelegate(this);
|
331
|
+
*/
|
332
|
+
addDelegate:function (delegate) {
|
333
|
+
if (!delegate || !this.impl)
|
334
|
+
return;
|
335
|
+
|
336
|
+
if (this.impl._delegateList.indexOf(delegate) > -1) {
|
337
|
+
// delegate already in list
|
338
|
+
return;
|
339
|
+
}
|
340
|
+
this.impl._delegateList.splice(0, 0, delegate);
|
341
|
+
},
|
342
|
+
|
343
|
+
/**
|
344
|
+
* Attach the pDeleate with ime.
|
345
|
+
* @param {cc.IMEDelegate} delegate
|
346
|
+
* @return {Boolean} If the old delegate can detattach with ime and the new delegate can attach with ime, return true, otherwise return false.
|
347
|
+
* @example
|
348
|
+
* //example
|
349
|
+
* var ret = cc.imeDispatcher.attachDelegateWithIME(this);
|
350
|
+
*/
|
351
|
+
attachDelegateWithIME:function (delegate) {
|
352
|
+
if (!this.impl || !delegate)
|
353
|
+
return false;
|
354
|
+
|
355
|
+
// if delegate is not in delegate list, return
|
356
|
+
if (this.impl._delegateList.indexOf(delegate) == -1)
|
357
|
+
return false;
|
358
|
+
|
359
|
+
if (this.impl._delegateWithIme) {
|
360
|
+
// if old delegate canDetachWithIME return false
|
361
|
+
// or delegate canAttachWithIME return false,
|
362
|
+
// do nothing.
|
363
|
+
if (!this.impl._delegateWithIme.canDetachWithIME()
|
364
|
+
|| !delegate.canAttachWithIME())
|
365
|
+
return false;
|
366
|
+
|
367
|
+
// detach first
|
368
|
+
var pOldDelegate = this.impl._delegateWithIme;
|
369
|
+
this.impl._delegateWithIme = null;
|
370
|
+
pOldDelegate.didDetachWithIME();
|
371
|
+
|
372
|
+
this._focusDomInput(delegate);
|
373
|
+
return true;
|
374
|
+
}
|
375
|
+
|
376
|
+
// havn't delegate attached with IME yet
|
377
|
+
if (!delegate.canAttachWithIME())
|
378
|
+
return false;
|
379
|
+
|
380
|
+
this._focusDomInput(delegate);
|
381
|
+
return true;
|
382
|
+
},
|
383
|
+
|
384
|
+
_focusDomInput:function (delegate) {
|
385
|
+
if(cc.sys.isMobile){
|
386
|
+
this.impl._delegateWithIme = delegate;
|
387
|
+
delegate.didAttachWithIME();
|
388
|
+
//prompt
|
389
|
+
this._currentInputString = delegate.string || "";
|
390
|
+
var userInput = prompt("please enter your word:", this._currentInputString);
|
391
|
+
if(userInput != null)
|
392
|
+
this._processDomInputString(userInput);
|
393
|
+
this.dispatchInsertText("\n", 1);
|
394
|
+
}else{
|
395
|
+
this.impl._delegateWithIme = delegate;
|
396
|
+
this._currentInputString = delegate.string || "";
|
397
|
+
delegate.didAttachWithIME();
|
398
|
+
this._domInputControl.focus();
|
399
|
+
this._domInputControl.value = this._currentInputString;
|
400
|
+
this._domInputControlTranslate();
|
401
|
+
}
|
402
|
+
},
|
403
|
+
|
404
|
+
_domInputControlTranslate:function () {
|
405
|
+
if (/msie/i.test(navigator.userAgent)) {
|
406
|
+
this._domInputControl.style.left = this._lastClickPosition.x + "px";
|
407
|
+
this._domInputControl.style.top = this._lastClickPosition.y + "px";
|
408
|
+
} else {
|
409
|
+
this._domInputControl.translates(this._lastClickPosition.x, this._lastClickPosition.y);
|
410
|
+
}
|
411
|
+
},
|
412
|
+
|
413
|
+
/**
|
414
|
+
* Detach the pDeleate with ime.
|
415
|
+
* @param {cc.IMEDelegate} delegate
|
416
|
+
* @return {Boolean} If the old delegate can detattach with ime and the new delegate can attach with ime, return true, otherwise return false.
|
417
|
+
* @example
|
418
|
+
* //example
|
419
|
+
* var ret = cc.imeDispatcher.detachDelegateWithIME(this);
|
420
|
+
*/
|
421
|
+
detachDelegateWithIME:function (delegate) {
|
422
|
+
if (!this.impl || !delegate)
|
423
|
+
return false;
|
424
|
+
|
425
|
+
// if delegate is not the current delegate attached with ime, return
|
426
|
+
if (this.impl._delegateWithIme != delegate)
|
427
|
+
return false;
|
428
|
+
|
429
|
+
if (!delegate.canDetachWithIME())
|
430
|
+
return false;
|
431
|
+
|
432
|
+
this.impl._delegateWithIme = null;
|
433
|
+
delegate.didDetachWithIME();
|
434
|
+
cc._canvas.focus();
|
435
|
+
return true;
|
436
|
+
},
|
437
|
+
|
438
|
+
/**
|
439
|
+
* Remove the delegate from the delegates who concern ime msg
|
440
|
+
* @param {cc.IMEDelegate} delegate
|
441
|
+
* @example
|
442
|
+
* //example
|
443
|
+
* cc.imeDispatcher.removeDelegate(this);
|
444
|
+
*/
|
445
|
+
removeDelegate:function (delegate) {
|
446
|
+
if (!this.impl || !delegate)
|
447
|
+
return;
|
448
|
+
|
449
|
+
// if delegate is not in delegate list, return
|
450
|
+
if (this.impl._delegateList.indexOf(delegate) == -1)
|
451
|
+
return;
|
452
|
+
|
453
|
+
if (this.impl._delegateWithIme) {
|
454
|
+
if (delegate == this.impl._delegateWithIme) {
|
455
|
+
this.impl._delegateWithIme = null;
|
456
|
+
}
|
457
|
+
}
|
458
|
+
cc.arrayRemoveObject(this.impl._delegateList, delegate);
|
459
|
+
},
|
460
|
+
|
461
|
+
/**
|
462
|
+
* Process keydown's keycode
|
463
|
+
* @param {Number} keyCode
|
464
|
+
* @example
|
465
|
+
* //example
|
466
|
+
* document.addEventListener("keydown", function (e) {
|
467
|
+
* cc.imeDispatcher.processKeycode(e.keyCode);
|
468
|
+
* });
|
469
|
+
*/
|
470
|
+
processKeycode:function (keyCode) {
|
471
|
+
if (keyCode < 32) {
|
472
|
+
if (keyCode == cc.KEY.backspace) {
|
473
|
+
this.dispatchDeleteBackward();
|
474
|
+
} else if (keyCode == cc.KEY.enter) {
|
475
|
+
this.dispatchInsertText("\n", 1);
|
476
|
+
} else if (keyCode == cc.KEY.tab) {
|
477
|
+
//tab input
|
478
|
+
} else if (keyCode == cc.KEY.escape) {
|
479
|
+
//ESC input
|
480
|
+
}
|
481
|
+
} else if (keyCode < 255) {
|
482
|
+
this.dispatchInsertText(String.fromCharCode(keyCode), 1);
|
483
|
+
} else {
|
484
|
+
//
|
485
|
+
}
|
486
|
+
}
|
487
|
+
});
|
488
|
+
|
489
|
+
/**
|
490
|
+
* Create the cc.IMEDispatcher.Imp Object. <br />
|
491
|
+
* This is the inner class...
|
492
|
+
* @class
|
493
|
+
* @extends cc.Class
|
494
|
+
* @name cc.IMEDispatcher.Impl
|
495
|
+
*/
|
496
|
+
cc.IMEDispatcher.Impl = cc.Class.extend(/** @lends cc.IMEDispatcher.Impl# */{
|
497
|
+
_delegateWithIme:null,
|
498
|
+
_delegateList:null,
|
499
|
+
/**
|
500
|
+
* Constructor function, override it to extend the construction behavior, remember to call "this._super()" in the extended "ctor" function.
|
501
|
+
*/
|
502
|
+
ctor:function () {
|
503
|
+
this._delegateList = [];
|
504
|
+
},
|
505
|
+
/**
|
506
|
+
* Find delegate
|
507
|
+
* @param {cc.IMEDelegate} delegate
|
508
|
+
* @return {Number|Null}
|
509
|
+
*/
|
510
|
+
findDelegate:function (delegate) {
|
511
|
+
for (var i = 0; i < this._delegateList.length; i++) {
|
512
|
+
if (this._delegateList[i] == delegate)
|
513
|
+
return i;
|
514
|
+
}
|
515
|
+
return null;
|
516
|
+
}
|
517
|
+
});
|
518
|
+
|
519
|
+
// Initialize imeDispatcher singleton
|
520
|
+
cc.imeDispatcher = new cc.IMEDispatcher();
|
521
|
+
|
522
|
+
document.body ?
|
523
|
+
cc.imeDispatcher.init() :
|
524
|
+
cc._addEventListener(window, 'load', function () {
|
525
|
+
cc.imeDispatcher.init();
|
526
|
+
}, false);
|