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 {
5656
5757+(void )initialize
5858{
59+ // +initialize may be called due to loading a subclass.
60+ if (self != [CCDrawNode class ]) return ;
61+
5962 SHADER = [[CCShader alloc ] initWithFragmentShaderSource: FRAGMENT_SHADER_SOURCE];
6063}
6164
Original file line number Diff line number Diff line change @@ -170,6 +170,9 @@ -(instancetype)initWithOptions:(NSDictionary *)options
170170
171171+(void )initialize
172172{
173+ // +initialize may be called due to loading a subclass.
174+ if (self != [CCBlendMode class ]) return ;
175+
173176 CCBLENDMODE_CACHE = [[CCBlendModeCache alloc ] init ];
174177
175178 // Add the default modes
@@ -276,6 +279,9 @@ @implementation CCRenderState {
276279
277280+(void )initialize
278281{
282+ // +initialize may be called due to loading a subclass.
283+ if (self != [CCRenderState class ]) return ;
284+
279285 CCRENDERSTATE_CACHE = [[CCRenderStateCache alloc ] init ];
280286 CCRENDERSTATE_DEBUGCOLOR = [[self alloc ] initWithBlendMode: CCBLEND_DISABLED shader: [CCShader positionColorShader ] shaderUniforms: @{}];
281287}
Original file line number Diff line number Diff line change @@ -449,6 +449,9 @@ -(instancetype)copyWithZone:(NSZone *)zone
449449
450450+(void )initialize
451451{
452+ // +initialize may be called due to loading a subclass.
453+ if (self != [CCShader class ]) return ;
454+
452455 CC_SHADER_CACHE = [[CCShaderCache alloc ] init ];
453456
454457 // Setup the builtin shaders.
Original file line number Diff line number Diff line change @@ -163,6 +163,9 @@ @implementation CCTexture
163163
164164+(void )initialize
165165{
166+ // +initialize may be called due to loading a subclass.
167+ if (self != [CCTexture class ]) return ;
168+
166169 CCTextureNone = [self alloc ];
167170 CCTextureNone->_name = 0 ;
168171 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
237237
238238+(void )initialize
239239{
240+ // +initialize may be called due to loading a subclass.
241+ if (self != [CCColor class ]) return ;
242+
240243 BLACK_COLOR = [CCColor colorWithRed: 0 green: 0 blue: 0 alpha: 1 ];
241244 DARK_GRAY_COLOR = [CCColor colorWithWhite: 1.0 /3.0 alpha: 1 ];
242245 LIGHT_GRAY_COLOR = [CCColor colorWithWhite: 2.0 /3.0 alpha: 1 ];
You can’t perform that action at this time.
0 commit comments