1 /**************************************************************************** 2 Copyright (c) 2010-2012 cocos2d-x.org 3 Copyright (c) 2008-2010 Ricardo Quesada 4 Copyright (c) 2011 Zynga Inc. 5 6 http://www.cocos2d-x.org 7 8 9 Permission is hereby granted, free of charge, to any person obtaining a copy 10 of this software and associated documentation files (the "Software"), to deal 11 in the Software without restriction, including without limitation the rights 12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 copies of the Software, and to permit persons to whom the Software is 14 furnished to do so, subject to the following conditions: 15 16 The above copyright notice and this permission notice shall be included in 17 all copies or substantial portions of the Software. 18 19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 THE SOFTWARE. 26 ****************************************************************************/ 27 (function () { 28 var engine = [ 29 'platform/CCClass.js', 30 'platform/miniFramework.js', 31 'platform/CCCommon.js', 32 'platform/platform.js', 33 'platform/ZipUtils.js', 34 'platform/base64.js', 35 'platform/gzip.js', 36 'platform/CCMacro.js', 37 'platform/CCFileUtils.js', 38 'platform/CCTypes.js', 39 'platform/zlib.min.js', 40 'cocoa/CCGeometry.js', 41 'platform/Sys.js', 42 'platform/CCConfig.js', 43 'cocoa/CCSet.js', 44 'cocoa/CCNS.js', 45 'cocoa/CCAffineTransform.js', 46 'support/CCPointExtension.js', 47 'support/CCUserDefault.js', 48 'base_nodes/CCNode.js', 49 'base_nodes/CCAtlasNode.js', 50 'textures/CCTexture2D.js', 51 'textures/CCTextureCache.js', 52 'textures/CCTextureAtlas.js', 53 'misc_nodes/CCRenderTexture.js', 54 'misc_nodes/CCProgressTimer.js', 55 'effects/CCGrid.js', 56 'effects/CCGrabber.js', 57 'actions/CCAction.js', 58 'actions/CCActionInterval.js', 59 'actions/CCActionInstant.js', 60 'actions/CCActionManager.js', 61 'actions/CCActionProgressTimer.js', 62 'actions/CCActionCamera.js', 63 'actions/CCActionEase.js', 64 'actions/CCActionGrid.js', 65 'actions/CCActionTiledGrid.js', 66 'actions/CCActionCatmullRom.js', 67 'layers_scenes_transitions_nodes/CCScene.js', 68 'layers_scenes_transitions_nodes/CCLayer.js', 69 'layers_scenes_transitions_nodes/CCTransition.js', 70 'layers_scenes_transitions_nodes/CCTransitionProgress.js', 71 'layers_scenes_transitions_nodes/CCTransitionPageTurn.js', 72 'sprite_nodes/CCSprite.js', 73 'sprite_nodes/CCAnimation.js', 74 'sprite_nodes/CCAnimationCache.js', 75 'sprite_nodes/CCSpriteFrame.js', 76 'sprite_nodes/CCSpriteFrameCache.js', 77 'sprite_nodes/CCSpriteBatchNode.js', 78 'label_nodes/CCLabelAtlas.js', 79 'label_nodes/CCLabelTTF.js', 80 'label_nodes/CCLabelBMFont.js', 81 'particle_nodes/CCParticleSystem.js', 82 'particle_nodes/CCParticleSystemQuad.js', 83 'particle_nodes/CCParticleExamples.js', 84 'particle_nodes/CCParticleBatchNode.js', 85 'touch_dispatcher/CCTouchDelegateProtocol.js', 86 'touch_dispatcher/CCTouchHandler.js', 87 'touch_dispatcher/CCTouchDispatcher.js', 88 'touch_dispatcher/CCMouseDispatcher.js', 89 'keyboard_dispatcher/CCKeyboardDelegate.js', 90 'keyboard_dispatcher/CCKeyboardDispatcher.js', 91 'text_input_node/CCIMEDispatcher.js', 92 'text_input_node/CCTextFieldTTF.js', 93 'CCDirector.js', 94 'CCCamera.js', 95 'CCScheduler.js', 96 'CCLoader.js', 97 'CCDrawingPrimitives.js', 98 'platform/CCApplication.js', 99 'platform/CCSAXParser.js', 100 'platform/AppControl.js', 101 'menu_nodes/CCMenuItem.js', 102 'menu_nodes/CCMenu.js', 103 'tileMap_parallax_nodes/CCTMXTiledMap.js', 104 'tileMap_parallax_nodes/CCTMXXMLParser.js', 105 'tileMap_parallax_nodes/CCTMXObjectGroup.js', 106 'tileMap_parallax_nodes/CCTMXLayer.js', 107 'tileMap_parallax_nodes/CCParallaxNode.js', 108 'menu_nodes/CCMenuItem.js', 109 'menu_nodes/CCMenu.js', 110 'base_nodes/CCdomNode.js', 111 '../CocosDenshion/SimpleAudioEngine.js' 112 113 ]; 114 115 var d = document; 116 var c = d.ccConfig; 117 118 if (c.loadExtension != null && c.loadExtension == true) { 119 engine = engine.concat([ 120 '../extensions/GUI/CCControlExtension/CCControl.js', 121 '../extensions/GUI/CCControlExtension/CCControlButton.js', 122 '../extensions/GUI/CCControlExtension/CCControlUtils.js', 123 '../extensions/GUI/CCControlExtension/CCInvocation.js', 124 '../extensions/GUI/CCControlExtension/CCScale9Sprite.js', 125 '../extensions/GUI/CCControlExtension/CCMenuPassive.js', 126 '../extensions/GUI/CCControlExtension/CCControlSaturationBrightnessPicker.js', 127 '../extensions/GUI/CCControlExtension/CCControlHuePicker.js', 128 '../extensions/GUI/CCControlExtension/CCControlColourPicker.js', 129 '../extensions/GUI/CCControlExtension/CCControlSlider.js', 130 '../extensions/GUI/CCControlExtension/CCControlSwitch.js', 131 '../extensions/GUI/CCScrollView/CCScrollView.js', 132 '../extensions/GUI/CCScrollView/CCSorting.js', 133 '../extensions/GUI/CCScrollView/CCTableView.js', 134 '../extensions/CCBReader/CCNodeLoader.js', 135 '../extensions/CCBReader/CCBReaderUtil.js', 136 '../extensions/CCBReader/CCControlLoader.js', 137 '../extensions/CCBReader/CCSpriteLoader.js', 138 '../extensions/CCBReader/CCNodeLoaderLibrary.js', 139 '../extensions/CCBReader/CCBReader.js', 140 '../extensions/CCBReader/CCBValue.js', 141 '../extensions/CCBReader/CCBKeyframe.js', 142 '../extensions/CCBReader/CCBSequence.js', 143 '../extensions/CCBReader/CCBRelativePositioning.js', 144 '../extensions/CCBReader/CCBAnimationManager.js', 145 '../extensions/CCControlEditBox.js' 146 ]); 147 } 148 149 if (!c.engineDir) { 150 engine = []; 151 } 152 else { 153 if(c.box2d || c.chipmunk){ 154 engine.push('Draw_Nodes/CCDrawNode.js'); 155 engine.push('physics_nodes/CCPhysicsSprite.js'); 156 engine.push('physics_nodes/CCPhysicsDebugNode.js'); 157 if (c.box2d) 158 engine.push('../box2d/box2d.js'); 159 if (c.chipmunk) 160 engine.push('../chipmunk/chipmunk.js'); 161 } 162 engine.forEach(function (e, i) { 163 engine[i] = c.engineDir + e; 164 }); 165 } 166 167 var loaded = 0; 168 var que = engine.concat(c.appFiles); 169 que.push('main.js'); 170 if (navigator.userAgent.indexOf("Trident/5") > -1) { 171 //ie9 172 this.serial = -1; 173 var loadNext = function () { 174 var s = this.serial + 1; 175 if (s < que.length) { 176 var f = d.createElement('script'); 177 f.src = que[s]; 178 f.serial = s; 179 f.onload = loadNext; 180 d.body.appendChild(f); 181 p = s / (que.length - 1); 182 //TODO: code for updating progress bar 183 } 184 }; 185 loadNext(); 186 } 187 else { 188 que.forEach(function (f, i) { 189 var s = d.createElement('script'); 190 s.async = false; 191 s.src = f; 192 s.onload = function () { 193 loaded++; 194 p = loaded / que.length; 195 //TODO: code for updating progress bar 196 }; 197 d.body.appendChild(s); 198 que[i] = s; 199 200 }); 201 } 202 })(); 203