File tree Expand file tree Collapse file tree 5 files changed +18
-0
lines changed Expand file tree Collapse file tree 5 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,9 @@ @implementation CCDrawNode {
56
56
57
57
+(void )initialize
58
58
{
59
+ // +initialize may be called due to loading a subclass.
60
+ if (self != [CCDrawNode class ]) return ;
61
+
59
62
SHADER = [[CCShader alloc ] initWithFragmentShaderSource: FRAGMENT_SHADER_SOURCE];
60
63
}
61
64
Original file line number Diff line number Diff line change @@ -170,6 +170,9 @@ -(instancetype)initWithOptions:(NSDictionary *)options
170
170
171
171
+(void )initialize
172
172
{
173
+ // +initialize may be called due to loading a subclass.
174
+ if (self != [CCBlendMode class ]) return ;
175
+
173
176
CCBLENDMODE_CACHE = [[CCBlendModeCache alloc ] init ];
174
177
175
178
// Add the default modes
@@ -276,6 +279,9 @@ @implementation CCRenderState {
276
279
277
280
+(void )initialize
278
281
{
282
+ // +initialize may be called due to loading a subclass.
283
+ if (self != [CCRenderState class ]) return ;
284
+
279
285
CCRENDERSTATE_CACHE = [[CCRenderStateCache alloc ] init ];
280
286
CCRENDERSTATE_DEBUGCOLOR = [[self alloc ] initWithBlendMode: CCBLEND_DISABLED shader: [CCShader positionColorShader ] shaderUniforms: @{}];
281
287
}
Original file line number Diff line number Diff line change @@ -449,6 +449,9 @@ -(instancetype)copyWithZone:(NSZone *)zone
449
449
450
450
+(void )initialize
451
451
{
452
+ // +initialize may be called due to loading a subclass.
453
+ if (self != [CCShader class ]) return ;
454
+
452
455
CC_SHADER_CACHE = [[CCShaderCache alloc ] init ];
453
456
454
457
// Setup the builtin shaders.
Original file line number Diff line number Diff line change @@ -163,6 +163,9 @@ @implementation CCTexture
163
163
164
164
+(void )initialize
165
165
{
166
+ // +initialize may be called due to loading a subclass.
167
+ if (self != [CCTexture class ]) return ;
168
+
166
169
CCTextureNone = [self alloc ];
167
170
CCTextureNone->_name = 0 ;
168
171
CCTextureNone->_format = CCTexturePixelFormat_RGBA8888;
Original file line number Diff line number Diff line change @@ -237,6 +237,9 @@ - (CCColor*) interpolateTo:(CCColor *) toColor alpha:(float) t
237
237
238
238
+(void )initialize
239
239
{
240
+ // +initialize may be called due to loading a subclass.
241
+ if (self != [CCColor class ]) return ;
242
+
240
243
BLACK_COLOR = [CCColor colorWithRed: 0 green: 0 blue: 0 alpha: 1 ];
241
244
DARK_GRAY_COLOR = [CCColor colorWithWhite: 1.0 /3.0 alpha: 1 ];
242
245
LIGHT_GRAY_COLOR = [CCColor colorWithWhite: 2.0 /3.0 alpha: 1 ];
You can’t perform that action at this time.
0 commit comments