Skip to content

Commit 488417c

Browse files
committed
Merge branch 'develop' into effects
2 parents 5f8b175 + dc6d8ce commit 488417c

22 files changed

+501
-250
lines changed

CCRendererGLSupport.m

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -237,25 +237,3 @@ -(void)bind:(BOOL)bind
237237
}
238238

239239
@end
240-
241-
242-
@interface CCRenderCommandDrawGL : CCRenderCommandDraw @end
243-
@implementation CCRenderCommandDrawGL
244-
245-
static const CCRenderCommandDrawMode GLDrawModes[] = {
246-
GL_TRIANGLES,
247-
GL_LINES,
248-
};
249-
250-
-(void)invokeOnRenderer:(CCRenderer *)renderer
251-
{
252-
CCGL_DEBUG_PUSH_GROUP_MARKER("CCRendererCommandDraw: Invoke");
253-
254-
[renderer setRenderState:_renderState];
255-
glDrawElements(GLDrawModes[_mode], (GLsizei)_count, GL_UNSIGNED_SHORT, (GLvoid *)(_first*sizeof(GLushort)));
256-
CC_INCREMENT_GL_DRAWS(1);
257-
258-
CCGL_DEBUG_POP_GROUP_MARKER();
259-
}
260-
261-
@end

cocos2d-ui/CCBReader/CCBReader.m

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,6 +1251,14 @@ - (CCNode*) readNodeGraphParent:(CCNode*)parent
12511251

12521252
Class class = NSClassFromString(className);
12531253
if (!class)
1254+
{
1255+
// Class was not found. Maybe it's a Swift class?
1256+
// See http://stackoverflow.com/questions/24030814/swift-language-nsclassfromstring
1257+
NSString *appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"];
1258+
NSString *classStringName = [NSString stringWithFormat:@"_TtC%d%@%d%@", appName.length, appName, className.length, className];
1259+
class = NSClassFromString(classStringName);
1260+
}
1261+
if (!class)
12541262
{
12551263
#if DEBUG
12561264
NSLog(@"*** [CLASS] ERROR HINT: Did you set a custom class for a CCNode? Please check if the specified class name is spelled correctly and available in your project.");

cocos2d/CCConfiguration.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#define CC_MINIMUM_TABLET_SCREEN_DIAGONAL 6.0
3232
extern Class CCGraphicsBufferClass;
3333
extern Class CCGraphicsBufferBindingsClass;
34+
extern Class CCRenderStateClass;
3435
extern Class CCRenderCommandDrawClass;
3536

3637
extern NSString* const CCSetupPixelFormat;

cocos2d/CCConfiguration.m

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141

4242
Class CCGraphicsBufferClass;
4343
Class CCGraphicsBufferBindingsClass;
44+
Class CCRenderStateClass;
4445
Class CCRenderCommandDrawClass;
4546

4647
NSString* const CCSetupPixelFormat = @"CCSetupPixelFormat";
@@ -130,23 +131,23 @@ -(id) init
130131
}
131132
}
132133

133-
CC_CHECK_GL_ERROR_DEBUG();
134-
135134
return self;
136135
}
137136

138137
-(CCGraphicsAPI)graphicsAPI
139138
{
140139
if(_graphicsAPI == CCGraphicsAPIInvalid){
141-
if(__CC_METAL_SUPPORTED_AND_ENABLED && NSProtocolFromString(@"MTLDevice")){
140+
if(__CC_METAL_SUPPORTED_AND_ENABLED && NSProtocolFromString(@"MTLDevice") && !getenv("CC_FORCE_GL")){
142141
CCGraphicsBufferClass = NSClassFromString(@"CCGraphicsBufferMetal");
143142
CCGraphicsBufferBindingsClass = NSClassFromString(@"CCGraphicsBufferBindingsMetal");
143+
CCRenderStateClass = NSClassFromString(@"CCRenderStateMetal");
144144
CCRenderCommandDrawClass = NSClassFromString(@"CCRenderCommandDrawMetal");
145145

146146
_graphicsAPI = CCGraphicsAPIMetal;
147147
} else {
148148
CCGraphicsBufferClass = NSClassFromString(@"CCGraphicsBufferGLBasic");
149149
CCGraphicsBufferBindingsClass = NSClassFromString(@"CCGraphicsBufferBindingsGL");
150+
CCRenderStateClass = NSClassFromString(@"CCRenderStateGL");
150151
CCRenderCommandDrawClass = NSClassFromString(@"CCRenderCommandDrawGL");
151152

152153
_graphicsAPI = CCGraphicsAPIGL;

cocos2d/CCEffect.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ -(void)end
256256

257257
-(void)enqueueTriangles
258258
{
259-
CCRenderState *renderState = [[CCRenderState alloc] initWithBlendMode:_blendMode shader:_shader shaderUniforms:_shaderUniforms copyUniforms:YES];
259+
CCRenderState *renderState = [CCRenderState renderStateWithBlendMode:_blendMode shader:_shader shaderUniforms:_shaderUniforms copyUniforms:YES];
260260

261261
CCRenderBuffer buffer = [_renderer enqueueTriangles:2 andVertexes:4 withState:renderState globalSortOrder:0];
262262
CCRenderBufferSetVertex(buffer, 0, CCVertexApplyTransform(_verts.bl, &_transform));

cocos2d/CCEffectRenderer.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ - (BOOL)setupGLResourcesWithSize:(CGSize)size
7373
// Create a new texture object for use as the color attachment of the new
7474
// FBO.
7575
_texture = [[CCTexture alloc] initWithData:nil pixelFormat:kRenderTargetDefaultPixelFormat pixelsWide:powW pixelsHigh:powH contentSizeInPixels:size contentScale:[CCDirector sharedDirector].contentScaleFactor];
76-
[_texture setAliasTexParameters];
76+
_texture.antialiased = NO;
7777

7878
// Save the old FBO binding so it can be restored after we create the new
7979
// one.

cocos2d/CCLabelTTF.m

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#import "CCConfiguration.h"
3838
#import "CCNode_Private.h"
3939
#import "CCDirector.h"
40+
#import "CCTexture_Private.h"
4041
#import <Foundation/Foundation.h>
4142

4243
#if __CC_PLATFORM_IOS
@@ -54,15 +55,6 @@
5455
static __strong NSMutableDictionary* ccLabelTTF_registeredFonts;
5556

5657

57-
@implementation CCTexture (CCLabelTTF)
58-
59-
- (void) setPremultipliedAlpha:(BOOL)flag
60-
{
61-
_premultipliedAlpha = flag;
62-
}
63-
64-
@end
65-
6658
#pragma mark CCLabelTTF
6759

6860

0 commit comments

Comments
 (0)