Skip to content

Commit 38c563d

Browse files
Added cc.config. Useful for runtime detection
it is compatible with native bindings
1 parent bcc1213 commit 38c563d

File tree

2 files changed

+19
-103
lines changed

2 files changed

+19
-103
lines changed

cocos2d/platform/CCConfig.js

Lines changed: 19 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
*/
3636
cc.ENGINE_VERSION = "Cocos2d-html5-v0.5.0-beta";
3737

38-
3938
/**
4039
* <p>
4140
* If enabled, the texture coordinates will be calculated by using this formula: <br/>
@@ -67,33 +66,6 @@ cc.FIX_ARTIFACTS_BY_STRECHING_TEXEL = 0;
6766
*/
6867
cc.DIRECTOR_STATS_POSITION = cc.p(0, 0);
6968

70-
/**
71-
* <p>
72-
* If enabled, FontLabel will be used to render .ttf files.<br/>
73-
* If the .ttf file is not found, then it will use the standard UIFont class<br/>
74-
* If disabled, the standard UIFont class will be used.<br/>
75-
* <br/>
76-
* To disable set it to 0. Enabled by default.<br/>
77-
* Only valid for cocos2d-ios. Not supported on cocos2d-mac<br/>
78-
* </p>
79-
* @constant
80-
* @type Number
81-
*/
82-
cc.FONT_LABEL_SUPPORT = 1;
83-
84-
/**
85-
* <p>
86-
* If enabled, then the FPS will be drawn using cc.LabelAtlas (fast rendering).<br/>
87-
* You will need to add the fps_images.png to your project.<br/>
88-
* If disabled, the FPS will be rendered using cc.Label (slow rendering)<br/>
89-
* <br/>
90-
* To enable set it to a value different than 0. Enabled by default.<br/>
91-
* </p>
92-
* @constant
93-
* @type Number
94-
*/
95-
cc.DIRECTOR_FAST_FPS = 1;
96-
9769
/**
9870
* <p>
9971
* Senconds between FPS updates.<br/>
@@ -107,36 +79,6 @@ cc.DIRECTOR_FAST_FPS = 1;
10779
*/
10880
cc.DIRECTOR_FPS_INTERVAL = 0.5;
10981

110-
/**
111-
* <p>
112-
* If enabled, and only when it is used with cc.FastDirector, the main loop will wait 0.04 seconds to<br/>
113-
* dispatch all the events, even if there are not events to dispatch.<br/>
114-
* If your game uses lot's of events (eg: touches) it might be a good idea to enable this feature.<br/>
115-
* Otherwise, it is safe to leave it disabled.<br/>
116-
* <br/>
117-
* To enable set it to 1. Disabled by default.<br/>
118-
* </p>
119-
* @warning This feature is experimental
120-
* @constant
121-
* @type Number
122-
*/
123-
cc.DIRECTOR_DISPATCH_FAST_EVENTS = 0;
124-
125-
/**
126-
* <p>
127-
* If enabled, cocos2d-mac will run on the Display Link thread. If disabled cocos2d-mac will run in its own thread.<br/>
128-
* <br/>
129-
* If enabled, the images will be drawn at the "correct" time, but the events might not be very responsive.<br/>
130-
* If disabled, some frames might be skipped, but the events will be dispatched as they arrived.<br/>
131-
* To enable set it to a 1, to disable it set to 0. Enabled by default.<br/>
132-
* <br/>
133-
* Only valid for cocos2d-mac. Not supported on cocos2d-ios.
134-
* </p>
135-
* @constant
136-
* @type Number
137-
*/
138-
cc.DIRECTOR_MAC_USE_DISPLAY_LINK_THREAD = 1;
139-
14082
/**
14183
* <p>
14284
* If enabled, the cc.Node objects (cc.Sprite, cc.Label,etc) will be able to render in subpixels.<br/>
@@ -161,19 +103,6 @@ cc.COCOSNODE_RENDER_SUBPIXEL = 1;
161103
*/
162104
cc.SPRITEBATCHNODE_RENDER_SUBPIXEL = 1;
163105

164-
/**
165-
* <p>
166-
* If enabled, batch nodes (texture atlas and particle system) will use VBO instead of vertex list (VBO is recommended by Apple)<br/>
167-
* <br/>
168-
* To enable set it to 1.<br/>
169-
* Enabled by default on iPhone with ARMv7 processors, iPhone Simulator and Mac<br/>
170-
* Disabled by default on iPhone with ARMv6 processors.
171-
* </p>
172-
* @constant
173-
* @type Number
174-
*/
175-
cc.USES_VBO = 1;
176-
177106
/**
178107
* <p>
179108
* If enabled, cc.Node will transform the nodes using a cached Affine matrix.<br/>
@@ -276,21 +205,6 @@ cc.RETINA_DISPLAY_SUPPORT = 1;
276205
*/
277206
cc.RETINA_DISPLAY_FILENAME_SUFFIX = "-hd";
278207

279-
/**
280-
* <p>
281-
* If enabled, it will use LA88 (16-bit textures) on Neon devices for cc.LabelTTF objects.<br/>
282-
* If it is disabled, or if it is used on another architecture it will use A8 (8-bit textures).<br/>
283-
* On Neon devices, LA88 textures are 6% faster than A8 textures, but then will consume 2x memory.<br/>
284-
* <br/>
285-
* This feature is disabled by default.<br/>
286-
* <br/>
287-
* Platforms: Only used on ARM Neon architectures like iPhone 3GS or newer and iPad.
288-
* </p>
289-
* @constant
290-
* @type Number
291-
*/
292-
cc.USE_LA88_LABELS_ON_NEON_ARCH = 0;
293-
294208
/**
295209
* <p>
296210
* If enabled, all subclasses of cc.Sprite will draw a bounding box<br/>
@@ -342,19 +256,6 @@ cc.LABELBMFONT_DEBUG_DRAW = 0;
342256
*/
343257
cc.LABELATLAS_DEBUG_DRAW = 0;
344258

345-
/**
346-
* <p>
347-
* If enabled, will activate various profilers withing cocos2d. This statistical data will be output to the console<br/>
348-
* once per second showing average time (in milliseconds) required to execute the specific routine(s).<br/>
349-
* Useful for debugging purposes only. It is recommened to leave it disabled.<br/>
350-
* <br/>
351-
* To enable set it to a value different than 0. Disabled by default.
352-
* </p>
353-
* @constant
354-
* @type Number
355-
*/
356-
cc.ENABLE_PROFILERS = 0;
357-
358259
/**
359260
* whether or not support retina display
360261
* @constant
@@ -369,3 +270,22 @@ cc.IS_RETINA_DISPLAY_SUPPORTED = 1;
369270
*/
370271
cc.DEFAULT_ENGINE = cc.ENGINE_VERSION + "-canvas";
371272

273+
274+
/* Runtime information */
275+
cc.config = {
276+
'os' : navigator.appVersion,
277+
'deviceType' : 'browser',
278+
'engine' : 'cocos2d-html5/canvas',
279+
'arch' : 'web',
280+
'version' : cc.ENGINE_VERSION,
281+
'debug' : false,
282+
};
283+
284+
/**
285+
* dump config info, but only in debug mode
286+
*/
287+
cc.dumpConfig = function()
288+
{
289+
for( i in cc.config )
290+
cc.log( i + " = " + cc.config[i] );
291+
}

cocos2d/textures/CCTexture2D.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,6 @@ cc.TEXTURE_2D_PIXEL_FORMAT_RGBA4444 = cc.TEXTURE_2D_PIXEL_FORMAT_RGBA4444;
6969
cc.TEXTURE_2D_PIXEL_FORMAT_RGB5A1 = cc.TEXTURE_2D_PIXEL_FORMAT_RGB5A1;
7070
cc.TEXTURE_2D_PIXEL_FORMAT_DEFAULT = cc.TEXTURE_2D_PIXEL_FORMAT_DEFAULT;
7171

72-
if (cc.FONT_LABEL_SUPPORT) {
73-
//TODO
74-
// FontLabel support
75-
}// CC_FONT_LABEL_SUPPORT
7672

7773
if (cc.ENABLE_CACHE_TEXTTURE_DATA) {
7874
//TODO include CCTextureCache.h

0 commit comments

Comments
 (0)