forked from cocos/cocos-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
112 lines (99 loc) · 3.64 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/****************************************************************************
Copyright (c) 2013-2016 Chukong Technologies Inc.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Chukong Aipu reserves all rights not expressly granted to you.
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.
****************************************************************************/
'use strict';
// Check version
var _engineNumberVersion = (function () {
var result = /Cocos2d\-JS\sv([\d]+)\.([\d]+)/.exec(cc.ENGINE_VERSION);
if (result && result[1]) {
return {
major: parseInt(result[1]),
minor: parseInt(result[2])
};
}
else {
return null;
}
})();
// Version polyfills
if (_engineNumberVersion) {
if (_engineNumberVersion.major === 3) {
if (_engineNumberVersion.minor < 6) {
require('./versions/jsb-polyfill-v3.5');
}
if (_engineNumberVersion.minor < 9) {
require('./versions/jsb-polyfill-v3.8');
}
if (_engineNumberVersion.minor < 10) {
require('./versions/jsb-polyfill-v3.9');
}
}
}
var originLog = console.log;
// cc.initEngine
cc.initEngine = function (config, cb) {
require('script/jsb.js');
cc._renderType = cc.game.RENDER_TYPE_OPENGL;
cc._engineLoaded = true;
originLog(cc.ENGINE_VERSION);
if (cb) cb();
};
// overwrite original console.log
try {
console.log = function () {
originLog.call(console, cc.js.formatStr.apply(null, arguments));
};
}
catch (e) {
}
// Macros, if "global_defs" not preprocessed by uglify, just declare them globally
Function(
/* use evaled code to prevent the uglify from renaming symbols */
'if(typeof CC_TEST=="undefined")' +
'window.CC_TEST=typeof describe!="undefined"||typeof QUnit=="object";' +
'if(typeof CC_EDITOR=="undefined")' +
'window.CC_EDITOR=typeof Editor=="object"&&typeof process=="object"&&"electron" in process.versions;' +
'if(typeof CC_DEV=="undefined")' +
'window.CC_DEV=CC_EDITOR||CC_TEST;' +
'if(typeof CC_JSB=="undefined")' +
'window.CC_JSB=true;'
)();
require('./jsb-predefine');
require('./jsb-loader');
require('./jsb-game');
require('./jsb-director');
require('./jsb-tex-sprite-frame');
require('./jsb-scale9sprite');
require('./jsb-label');
require('./jsb-editbox');
require('./jsb-videoplayer');
require('./jsb-webview.js');
require('./jsb-particle');
require('./jsb-spine');
require('./jsb-enums');
require('./jsb-event');
require('./jsb-action');
require('./jsb-etc');
require('./jsb-audio');
require('./jsb-tiledmap');
require('./jsb-dragonbones');
if (cc.runtime) {
require('./versions/jsb-polyfill-runtime');
}