Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'develop' into reorderSprite

  • Loading branch information...
commit a97ec2f89bb00afc79a76207a9f920b8a9c48c9f 2 parents 1faec20 + b02562e
@ricardoquesada ricardoquesada authored
View
5 CHANGELOG
@@ -1,4 +1,4 @@
-version 1.0-rc - 28-Mar-2011
+version 1.0-rc - 29-Mar-2011
. [NEW] Actions: Added the possibility to create a CCSpawn and CCSequence with an NSArray
. [NEW] CCArray: Added exchangeObject & exchangeObjectAtIndex (issue #1085)
. [NEW] Templates: Added Xcode4 templates for cocos2d, cocos2d+box2d, cocos2d+chipmunk both for iOS and Mac OS X
@@ -14,7 +14,8 @@ version 1.0-rc - 28-Mar-2011
. [FIX] Documentation: onExit doxystring improved (issue #1135)
. [FIX] MenuItemToggle: Don't scale up if it is pressed several times (issue #948)
. [FIX] ProgressTimer: fixed underflow in setPercentage() (issue #1123)
-. [FIX] RenderTexture: Enable default GL states (but not disable them) (mitigated issue #1145)
+. [FIX] RenderTexture: Only enable default GL states, without disabling them (mitigated issue #1145)
+. [FIX] StreakMotion: fixed flicker introduced in v0.99.x (issue #1075)
. [FIX] Templates: Don't generate analyze warnings in Xcode4 (issue #1142)
. [FIX] Xcode: TexturePVR compiles when using cocos2d as an external library (issue #1132)
. [FIX] Xcode: Added SKIP_INSTALL=YES in libraries for Xcode4 (issue #1137)
View
0  RELEASE_NOTES 100755 → 100644
File mode changed
View
0  Resources/Default.png 100755 → 100644
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  Resources/Icon.png 100755 → 100644
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  Resources/Info.plist 100755 → 100644
File mode changed
View
0  Resources/InfoWithStatusBar.plist 100755 → 100644
File mode changed
View
0  Resources/iTunesArtwork 100755 → 100644
File mode changed
View
78 cocos2d-mac.xcodeproj/project.pbxproj
@@ -1624,6 +1624,8 @@
E08AA22C12C27DEA000341BD /* MainMenu-NoWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = E08AA22A12C27DEA000341BD /* MainMenu-NoWindow.xib */; };
E08AA22D12C27DEA000341BD /* MainMenu-NoWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = E08AA22A12C27DEA000341BD /* MainMenu-NoWindow.xib */; };
E08AA22F12C27E2F000341BD /* MainMenu-NoWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = E08AA22A12C27DEA000341BD /* MainMenu-NoWindow.xib */; };
+ E098B329134004F400FD53A3 /* test_image-bad_encoding.pvr in Resources */ = {isa = PBXBuildFile; fileRef = E098B328134004F400FD53A3 /* test_image-bad_encoding.pvr */; };
+ E098B32B1340068600FD53A3 /* MarkerFelt.ttc in Resources */ = {isa = PBXBuildFile; fileRef = E098B32A1340068600FD53A3 /* MarkerFelt.ttc */; };
E0AC05D81228021600EFA814 /* A Damn Mess.ttf in Resources */ = {isa = PBXBuildFile; fileRef = E076E7A21225EDD000DE0DA2 /* A Damn Mess.ttf */; };
E0AC05D91228021600EFA814 /* Abberancy.ttf in Resources */ = {isa = PBXBuildFile; fileRef = E076E7A31225EDD000DE0DA2 /* Abberancy.ttf */; };
E0AC05DA1228021600EFA814 /* Abduction.ttf in Resources */ = {isa = PBXBuildFile; fileRef = E076E7A41225EDD000DE0DA2 /* Abduction.ttf */; };
@@ -3957,6 +3959,8 @@
E08AA19A12C262B3000341BD /* MacWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MacWindow.m; sourceTree = "<group>"; };
E08AA22B12C27DEA000341BD /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = "Resources-Mac/English.lproj/MainMenu-NoWindow.xib"; sourceTree = "<group>"; };
E08AA23512C27E7D000341BD /* cocos2d_mac-no-window-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "cocos2d_mac-no-window-Info.plist"; path = "Resources-Mac/cocos2d_mac-no-window-Info.plist"; sourceTree = "<group>"; };
+ E098B328134004F400FD53A3 /* test_image-bad_encoding.pvr */ = {isa = PBXFileReference; lastKnownFileType = file; path = "test_image-bad_encoding.pvr"; sourceTree = "<group>"; };
+ E098B32A1340068600FD53A3 /* MarkerFelt.ttc */ = {isa = PBXFileReference; lastKnownFileType = file; path = MarkerFelt.ttc; sourceTree = "<group>"; };
E0AC06A51228021600EFA814 /* ActionTest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ActionTest.app; sourceTree = BUILT_PRODUCTS_DIR; };
E0AC06A81228027D00EFA814 /* ActionsTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ActionsTest.h; path = tests/ActionsTest.h; sourceTree = "<group>"; };
E0AC06A91228027D00EFA814 /* ActionsTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ActionsTest.m; path = tests/ActionsTest.m; sourceTree = "<group>"; };
@@ -4650,6 +4654,7 @@
E076E7A11225EDD000DE0DA2 /* Fonts */ = {
isa = PBXGroup;
children = (
+ E098B32A1340068600FD53A3 /* MarkerFelt.ttc */,
E0796B5612DF8A8C002442F5 /* futura-48.fnt */,
E0796B5712DF8A8C002442F5 /* futura-48.png */,
E0C60677128ECC110099367C /* konqa32-hd.fnt */,
@@ -4686,8 +4691,6 @@
E076E7B71225EDD000DE0DA2 /* Images */ = {
isa = PBXGroup;
children = (
- E0D44F381291BFFB0094708A /* test_image_rgba4444.pvr.ccz */,
- E0D44F391291BFFB0094708A /* test_image_rgba4444.pvr.gz */,
E0D2D55F128CB06A00F78C63 /* piece.png */,
E076E7B81225EDD000DE0DA2 /* atlastest.png */,
E076E7B91225EDD000DE0DA2 /* b1.png */,
@@ -4761,34 +4764,7 @@
E076E8421225EDD000DE0DA2 /* stars2.png */,
E076E8431225EDD000DE0DA2 /* stars2_mini.png */,
E076E8441225EDD000DE0DA2 /* streak.png */,
- E076E8451225EDD000DE0DA2 /* test-rgba1.png */,
- E076E8461225EDD000DE0DA2 /* test_blend.bmp */,
- E076E8471225EDD000DE0DA2 /* test_blend.png */,
- E076E8481225EDD000DE0DA2 /* test_image.bmp */,
- E076E8491225EDD000DE0DA2 /* test_image.gif */,
- E076E84A1225EDD000DE0DA2 /* test_image.jpeg */,
- E076E84B1225EDD000DE0DA2 /* test_image.png */,
- E076E84C1225EDD000DE0DA2 /* test_image.pvr */,
- E076E84D1225EDD000DE0DA2 /* test_image.pvrraw */,
- E076E84E1225EDD000DE0DA2 /* test_image.tiff */,
- E076E84F1225EDD000DE0DA2 /* test_image_a8.pvr */,
- E076E8501225EDD000DE0DA2 /* test_image_ai88.pvr */,
- E076E8511225EDD000DE0DA2 /* test_image_bgra8888.pvr */,
- E076E8521225EDD000DE0DA2 /* test_image_i8.pvr */,
- E076E8531225EDD000DE0DA2 /* test_image_pvrtc2bpp.pvr */,
- E076E8541225EDD000DE0DA2 /* test_image_pvrtc4bpp.pvr */,
- E076E8551225EDD000DE0DA2 /* test_image_rgb565.pvr */,
- E076E8561225EDD000DE0DA2 /* test_image_rgba4444.pvr */,
- E076E8571225EDD000DE0DA2 /* test_image_rgba4444_mipmap.pvr */,
- E076E8581225EDD000DE0DA2 /* test_image_rgba5551.pvr */,
- E076E8591225EDD000DE0DA2 /* test_image_rgba8888.pvr */,
- E076E85A1225EDD000DE0DA2 /* texture1024x1024.png */,
- E076E85B1225EDD000DE0DA2 /* texture1024x1024_rgba4444.pvr */,
- E076E85C1225EDD000DE0DA2 /* texture2048x2048.png */,
- E076E85D1225EDD000DE0DA2 /* texture2048x2048_rgba4444.pvr */,
- E076E85E1225EDD000DE0DA2 /* texture4096x4096.png */,
- E076E85F1225EDD000DE0DA2 /* texture512x512.png */,
- E076E8601225EDD000DE0DA2 /* texture512x512_rgba4444.pvr */,
+ E098B3271340049A00FD53A3 /* PVR Test Images */,
);
name = Images;
path = Resources/Images;
@@ -4916,6 +4892,44 @@
name = external;
sourceTree = "<group>";
};
+ E098B3271340049A00FD53A3 /* PVR Test Images */ = {
+ isa = PBXGroup;
+ children = (
+ E098B328134004F400FD53A3 /* test_image-bad_encoding.pvr */,
+ E0D44F381291BFFB0094708A /* test_image_rgba4444.pvr.ccz */,
+ E0D44F391291BFFB0094708A /* test_image_rgba4444.pvr.gz */,
+ E076E8451225EDD000DE0DA2 /* test-rgba1.png */,
+ E076E8461225EDD000DE0DA2 /* test_blend.bmp */,
+ E076E8471225EDD000DE0DA2 /* test_blend.png */,
+ E076E8481225EDD000DE0DA2 /* test_image.bmp */,
+ E076E8491225EDD000DE0DA2 /* test_image.gif */,
+ E076E84A1225EDD000DE0DA2 /* test_image.jpeg */,
+ E076E84B1225EDD000DE0DA2 /* test_image.png */,
+ E076E84C1225EDD000DE0DA2 /* test_image.pvr */,
+ E076E84D1225EDD000DE0DA2 /* test_image.pvrraw */,
+ E076E84E1225EDD000DE0DA2 /* test_image.tiff */,
+ E076E84F1225EDD000DE0DA2 /* test_image_a8.pvr */,
+ E076E8501225EDD000DE0DA2 /* test_image_ai88.pvr */,
+ E076E8511225EDD000DE0DA2 /* test_image_bgra8888.pvr */,
+ E076E8521225EDD000DE0DA2 /* test_image_i8.pvr */,
+ E076E8531225EDD000DE0DA2 /* test_image_pvrtc2bpp.pvr */,
+ E076E8541225EDD000DE0DA2 /* test_image_pvrtc4bpp.pvr */,
+ E076E8551225EDD000DE0DA2 /* test_image_rgb565.pvr */,
+ E076E8561225EDD000DE0DA2 /* test_image_rgba4444.pvr */,
+ E076E8571225EDD000DE0DA2 /* test_image_rgba4444_mipmap.pvr */,
+ E076E8581225EDD000DE0DA2 /* test_image_rgba5551.pvr */,
+ E076E8591225EDD000DE0DA2 /* test_image_rgba8888.pvr */,
+ E076E85A1225EDD000DE0DA2 /* texture1024x1024.png */,
+ E076E85B1225EDD000DE0DA2 /* texture1024x1024_rgba4444.pvr */,
+ E076E85C1225EDD000DE0DA2 /* texture2048x2048.png */,
+ E076E85D1225EDD000DE0DA2 /* texture2048x2048_rgba4444.pvr */,
+ E076E85E1225EDD000DE0DA2 /* texture4096x4096.png */,
+ E076E85F1225EDD000DE0DA2 /* texture512x512.png */,
+ E076E8601225EDD000DE0DA2 /* texture512x512_rgba4444.pvr */,
+ );
+ name = "PVR Test Images";
+ sourceTree = "<group>";
+ };
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
@@ -6588,6 +6602,7 @@
E0D44F3B1291BFFB0094708A /* test_image_rgba4444.pvr.gz in Resources */,
E02A8538129F11BF00341C97 /* icon.icns in Resources */,
E08AA22D12C27DEA000341BD /* MainMenu-NoWindow.xib in Resources */,
+ E098B329134004F400FD53A3 /* test_image-bad_encoding.pvr in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -7397,6 +7412,7 @@
E02A853E129F11BF00341C97 /* icon.icns in Resources */,
E0796B5812DF8A8C002442F5 /* futura-48.fnt in Resources */,
E0796B5912DF8A8C002442F5 /* futura-48.png in Resources */,
+ E098B32B1340068600FD53A3 /* MarkerFelt.ttc in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -8880,6 +8896,7 @@
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_SHADOW = NO;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.6;
ONLY_ACTIVE_ARCH = YES;
@@ -8897,6 +8914,7 @@
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_SHADOW = NO;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.6;
PREBINDING = NO;
View
4 cocos2d/CCMotionStreak.m
@@ -54,8 +54,8 @@ -(id)initWithFade:(float)fade minSeg:(float)seg image:(NSString*)path width:(flo
ribbon_ = [CCRibbon ribbonWithWidth:width_ image:path length:length color:color fade:fade];
[self addChild:ribbon_];
- // update ribbon position
- [self scheduleUpdate];
+ // update ribbon position. Use schedule:interval and not scheduleUpdated. issue #1075
+ [self schedule:@selector(update:) interval:0];
}
return self;
}
View
13 cocos2d/CCProgressTimer.m
@@ -358,6 +358,7 @@ -(void)updateBar
CGPoint tMax = ccp(sprite_.texture.maxS,sprite_.texture.maxT);
unsigned char vIndexes[2] = {0,0};
+ unsigned char index = 0;
// We know vertex data is always equal to the 4 corners
// If we don't have vertex data then we create it here and populate
@@ -381,7 +382,7 @@ -(void)updateBar
vertexData_[vIndexes[1] = 2].texCoords = (ccTex2F){tMax.x, 0};
}
- unsigned char index = vIndexes[0];
+ index = vIndexes[0];
vertexData_[index].vertices = [self vertexFromTexCoord:ccp(vertexData_[index].texCoords.u, vertexData_[index].texCoords.v)];
index = vIndexes[1];
@@ -389,13 +390,13 @@ -(void)updateBar
if (sprite_.flipY || sprite_.flipX) {
if (sprite_.flipX) {
- unsigned char index = vIndexes[0];
+ index = vIndexes[0];
vertexData_[index].texCoords.u = tMax.x - vertexData_[index].texCoords.u;
index = vIndexes[1];
vertexData_[index].texCoords.u = tMax.x - vertexData_[index].texCoords.u;
}
if(sprite_.flipY){
- unsigned char index = vIndexes[0];
+ index = vIndexes[0];
vertexData_[index].texCoords.v = tMax.y - vertexData_[index].texCoords.v;
index = vIndexes[1];
vertexData_[index].texCoords.v = tMax.y - vertexData_[index].texCoords.v;
@@ -419,20 +420,20 @@ -(void)updateBar
vertexData_[vIndexes[1] = 3].texCoords = (ccTex2F){tMax.x, tMax.y*alpha};
}
- unsigned char index = vIndexes[0];
+ index = vIndexes[0];
vertexData_[index].vertices = [self vertexFromTexCoord:ccp(vertexData_[index].texCoords.u, vertexData_[index].texCoords.v)];
index = vIndexes[1];
vertexData_[index].vertices = [self vertexFromTexCoord:ccp(vertexData_[index].texCoords.u, vertexData_[index].texCoords.v)];
if (sprite_.flipY || sprite_.flipX) {
if (sprite_.flipX) {
- unsigned char index = vIndexes[0];
+ index = vIndexes[0];
vertexData_[index].texCoords.u = tMax.x - vertexData_[index].texCoords.u;
index = vIndexes[1];
vertexData_[index].texCoords.u = tMax.x - vertexData_[index].texCoords.u;
}
if(sprite_.flipY){
- unsigned char index = vIndexes[0];
+ index = vIndexes[0];
vertexData_[index].texCoords.v = tMax.y - vertexData_[index].texCoords.v;
index = vIndexes[1];
vertexData_[index].texCoords.v = tMax.y - vertexData_[index].texCoords.v;
View
3  cocos2d/CCRenderTexture.h
@@ -59,9 +59,6 @@ enum
CCSprite* sprite_;
GLenum pixelFormat_;
- GLfloat clearColor_[4];
- BOOL restoreColor_;
-
}
/** The CCSprite being used.
View
64 cocos2d/CCRenderTexture.m
@@ -30,11 +30,6 @@
#import "Support/ccUtils.h"
#import "Support/CCFileUtils.h"
-@interface CCRenderTexture ()
-- (void) saveGLColor;
-- (void) restoreGLColor;
-@end
-
@implementation CCRenderTexture
@synthesize sprite=sprite_;
@@ -115,44 +110,25 @@ -(void)dealloc
-(void)begin
{
- // don't clear the frame buffer
- [self beginWithClear:-1 g:-1 b:-1 a:-1];
-}
-
--(void)beginWithClear:(float)r g:(float)g b:(float)b a:(float)a
-{
- if( a != -1 ) {
- [self saveGLColor];
- restoreColor_ = YES;
- } else
- restoreColor_ = NO;
-
-
// Save the current matrix
glPushMatrix();
CGSize texSize = [texture_ contentSizeInPixels];
-
-
+
+
// Calculate the adjustment ratios based on the old and new projections
CGSize size = [[CCDirector sharedDirector] displaySizeInPixels];
float widthRatio = size.width / texSize.width;
float heightRatio = size.height / texSize.height;
-
-
+
+
// Adjust the orthographic propjection and viewport
ccglOrtho((float)-1.0 / widthRatio, (float)1.0 / widthRatio, (float)-1.0 / heightRatio, (float)1.0 / heightRatio, -1,1);
glViewport(0, 0, texSize.width, texSize.height);
-
-
+
+
glGetIntegerv(CC_GL_FRAMEBUFFER_BINDING, &oldFBO_);
ccglBindFramebuffer(CC_GL_FRAMEBUFFER, fbo_);//Will direct drawing to the frame buffer created above
-
-
- if( a != -1 ) {
- glClearColor(r, g, b, a);
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- }
// Issue #1145
// There is no need to enable the default GL states here
@@ -166,6 +142,21 @@ -(void)beginWithClear:(float)r g:(float)g b:(float)b a:(float)a
CC_ENABLE_DEFAULT_GL_STATES();
}
+-(void)beginWithClear:(float)r g:(float)g b:(float)b a:(float)a
+{
+ [self begin];
+
+ // save clear color
+ GLfloat clearColor[4];
+ glGetFloatv(GL_COLOR_CLEAR_VALUE,clearColor);
+
+ glClearColor(r, g, b, a);
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+ // restore clear color
+ glClearColor(clearColor[0], clearColor[1], clearColor[2], clearColor[3]);
+}
+
-(void)end
{
ccglBindFramebuffer(CC_GL_FRAMEBUFFER, oldFBO_);
@@ -173,9 +164,6 @@ -(void)end
glPopMatrix();
CGSize size = [[CCDirector sharedDirector] displaySizeInPixels];
glViewport(0, 0, size.width, size.height);
-
- if( restoreColor_ )
- [self restoreGLColor];
}
-(void)clear:(float)r g:(float)g b:(float)b a:(float)a
@@ -184,16 +172,6 @@ -(void)clear:(float)r g:(float)g b:(float)b a:(float)a
[self end];
}
--(void) saveGLColor
-{
- glGetFloatv(GL_COLOR_CLEAR_VALUE,clearColor_);
-}
-
-- (void) restoreGLColor
-{
- glClearColor(clearColor_[0], clearColor_[1], clearColor_[2], clearColor_[3]);
-}
-
#pragma mark RenderTexture - Save Image
#ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
View
4 cocos2d/CCSpriteBatchNode.m
@@ -570,8 +570,8 @@ -(void) insertChild:(CCSprite*)sprite inAtlasAtIndex:(NSUInteger)index
// add children recursively
CCARRAY_FOREACH(sprite.children, child){
- NSUInteger index = [self atlasIndexForChild:child atZ: child.zOrder];
- [self insertChild:child inAtlasAtIndex:index];
+ NSUInteger idx = [self atlasIndexForChild:child atZ: child.zOrder];
+ [self insertChild:child inAtlasAtIndex:idx];
}
}
View
1  cocos2d/CCTMXLayer.m
@@ -545,7 +545,6 @@ -(void) removeTileAt:(CGPoint)pos
[textureAtlas_ removeQuadAtIndex:atlasIndex];
// update possible children
- CCSprite *sprite;
CCARRAY_FOREACH(children_, sprite) {
NSUInteger ai = [sprite atlasIndex];
if( ai >= atlasIndex) {
View
3  cocos2d/CCTMXTiledMap.m
@@ -122,7 +122,6 @@ -(id) parseLayer:(CCTMXLayerInfo*)layerInfo map:(CCTMXMapInfo*)mapInfo
-(CCTMXTilesetInfo*) tilesetForLayer:(CCTMXLayerInfo*)layerInfo map:(CCTMXMapInfo*)mapInfo
{
- CCTMXTilesetInfo *tileset = nil;
CFByteOrder o = CFByteOrderGetCurrent();
CGSize size = layerInfo.layerSize;
@@ -154,7 +153,7 @@ -(CCTMXTilesetInfo*) tilesetForLayer:(CCTMXLayerInfo*)layerInfo map:(CCTMXMapInf
// If all the tiles are 0, return empty tileset
CCLOG(@"cocos2d: Warning: TMX Layer '%@' has no tiles", layerInfo.name);
- return tileset;
+ return nil;
}
View
3  cocos2d/CCTextureAtlas.m
@@ -80,6 +80,9 @@ -(id) initWithTexture:(CCTexture2D*)tex capacity:(NSUInteger)n
// retained in property
self.texture = tex;
+ // Re-initialization is not allowed
+ NSAssert(quads_==nil && indices_==nil, @"CCTextureAtlas re-initialization is not allowed");
+
quads_ = calloc( sizeof(quads_[0]) * capacity_, 1 );
indices_ = calloc( sizeof(indices_[0]) * capacity_ * 6, 1 );
View
6 tests/LabelTest.m
@@ -988,6 +988,7 @@ -(id) init
{
if( (self=[super init]) ) {
+#ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
CGSize s = [[CCDirector sharedDirector] winSize];
// CCLabelBMFont
@@ -997,6 +998,7 @@ -(id) init
center.position = ccp(s.width/2,150);
[self addChild:center];
+#endif // __IPHONE_OS_VERSION_MAX_ALLOWED
}
return self;
@@ -1009,7 +1011,11 @@ -(NSString*) title
-(NSString *) subtitle
{
+#ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
return @"Word wrap using CCLabelTTF";
+#elif defined(__MAC_OS_X_VERSION_MAX_ALLOWED)
+ return @"Custom TTF are not supported in Mac OS X";
+#endif
}
@end
View
3  tests/RenderTextureTest.h
@@ -44,8 +44,7 @@
@end
@interface RenderTextureIssue937 : RenderTextureTest
-{
-}
+{}
@end
View
33 tests/RenderTextureTest.m
@@ -138,7 +138,7 @@ -(id) init
// note that the render texture is a CCNode, and contains a sprite of its texture for convience,
// so we can just parent it to the scene like any other CCNode
- [self addChild:target z:1];
+ [self addChild:target z:-1];
// create a brush image to draw into the texture with
brush = [[CCSprite spriteWithFile:@"fire.png"] retain];
@@ -152,9 +152,11 @@ -(id) init
// Save Image menu
[CCMenuItemFont setFontSize:16];
- CCMenuItem *item = [CCMenuItemFont itemFromString:@"Save Image" target:self selector:@selector(saveImage:)];
- CCMenu *menu = [CCMenu menuWithItems:item, nil];
+ CCMenuItem *item1 = [CCMenuItemFont itemFromString:@"Save Image" target:self selector:@selector(saveImage:)];
+ CCMenuItem *item2 = [CCMenuItemFont itemFromString:@"Clear" target:self selector:@selector(clearImage:)];
+ CCMenu *menu = [CCMenu menuWithItems:item1, item2, nil];
[self addChild:menu];
+ [menu alignItemsVertically];
[menu setPosition:ccp(s.width-80, s.height-30)];
}
return self;
@@ -170,6 +172,11 @@ -(NSString*) subtitle
return @"Press 'Save Image' to create an snapshot of the render texture";
}
+-(void) clearImage:(id)sender
+{
+ [target clear:CCRANDOM_0_1() g:CCRANDOM_0_1() b:CCRANDOM_0_1() a:CCRANDOM_0_1()];
+}
+
-(void) saveImage:(id)sender
{
#ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
@@ -222,15 +229,13 @@ -(void)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
[brush setRotation:rand()%360];
float r = ((float)(rand()%50)/50.f) + 0.25f;
[brush setScale:r];
+ [brush setColor:ccc3(CCRANDOM_0_1()*127+128, 255, 255) ];
// Call visit to draw the brush, don't call draw..
[brush visit];
}
}
// finish drawing and return context back to the screen
- [target end];
-
- // Disable the states, that were turned on manually
- CC_DISABLE_DEFAULT_GL_STATES();
+ [target end];
}
#elif defined(__MAC_OS_X_VERSION_MAX_ALLOWED)
@@ -280,7 +285,6 @@ -(BOOL) ccMouseDragged:(NSEvent *)event
return YES;
}
-
#endif // __MAC_OS_X_VERSION_MAX_ALLOWED
@end
@@ -308,9 +312,11 @@ -(id) init
CCLayerColor *background = [CCLayerColor layerWithColor:ccc4(200,200,200,255)];
[self addChild:background];
+ // A1
CCSprite *spr_premulti = [CCSprite spriteWithFile:@"fire.png"];
[spr_premulti setPosition:ccp(16,48)];
+ // B1
CCSprite *spr_nonpremulti = [CCSprite spriteWithFile:@"fire_rgba8888.pvr"];
[spr_nonpremulti setPosition:ccp(16,16)];
@@ -321,12 +327,12 @@ -(id) init
// It's possible to modify the RenderTexture blending function by
// [[rend sprite] setBlendFunc:(ccBlendFunc) {GL_ONE, GL_ONE_MINUS_SRC_ALPHA}];
- // All cocos2d nodes assumes that these states are enabled.
- // Since we are drawing outside the "draw" event, we need to turn them on manually
- CC_ENABLE_DEFAULT_GL_STATES();
-
[rend begin];
+
+ // A2
[spr_premulti visit];
+
+ // B2
[spr_nonpremulti visit];
[rend end];
@@ -355,7 +361,6 @@ -(NSString*) subtitle
{
return @"All images should be equal...";
}
-
@end
#pragma mark -
@@ -388,7 +393,7 @@ - (void) applicationDidFinishLaunching:(UIApplication*)application
// Create an EAGLView with a RGB8 color buffer, and a depth buffer of 24-bits
EAGLView *glView = [EAGLView viewWithFrame:[window bounds]
- pixelFormat:kEAGLColorFormatRGB565
+ pixelFormat:kEAGLColorFormatRGBA8
depthFormat:GL_DEPTH_COMPONENT24_OES];
// attach the openglView to the director
View
3  tests/Texture2dTest.m
@@ -1759,6 +1759,9 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
CCDirectorMac *director = (CCDirectorMac*) [CCDirector sharedDirector];
[director setResizeMode:kCCDirectorResize_AutoScale];
+ // Turn on display FPS
+ [director setDisplayFPS:YES];
+
CCScene *scene = [CCScene node];
[scene addChild: [nextAction() node]];
Please sign in to comment.
Something went wrong with that request. Please try again.