Background gets super blocky for some reason?

Forums Programming cocos2d support (graphics engine) Background gets super blocky for some reason?

This topic contains 3 replies, has 3 voices, and was last updated by  embero 2 years, 6 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
Author Posts
Author Posts
September 6, 2011 at 3:01 am #235025

jackrabbit
Participant
@jackrabbit

So, I am subclassing a CCLayer that will be used as a win/screen and then adding it on top of another layer. However, the background image of this win/loss screen gets quite blocky for some reason. Am I missing something?

Here is my win/loss layer:

#import "ResultsPopup.h"

@implementation ResultsPopup

+ (id) resultsPopup: (BOOL) win{
return [[[self alloc] initWithWin:win] autorelease];
}

- (id)initWithWin: (BOOL) win
{
self = [super init];

CGSize size = [[CCDirector sharedDirector] winSize];

printf("win is %d", win);

if(win==TRUE){
printf("background added/n");
background = [CCSprite spriteWithFile:@"winBackground.png"];
background.position = ccp(size.width/2,size.height/2);
[self addChild:background z:5];
}
else{
printf("background added/n");
background = [CCSprite spriteWithFile:@"loseBackground.png"];
background.position = ccp(size.width/2,size.height/2);
[self addChild:background z:5];
}

[self setContentSize:size];
self.isRelativeAnchorPoint = YES;
self.anchorPoint = ccp(0.5f,0.5f);

return self;
}

@end

and my implementation on the layer that I am adding it to-

ResultsPopup *resultsPopup = [ResultsPopup resultsPopup:(userData.currentCheckpoint.intValue!=0)];
resultsPopup.position=ccp(size.width/2, size.height/2);
[self addChild: resultsPopup z:5];

The resolution of the pics is fine. Anyone have any ideas?

September 6, 2011 at 10:51 am #346406

araker
Moderator
@araker

Can you post a image of before and after?

I’m not sure what is causing it, first thing that comes into mind are the alias settings. Try

[background.texture setAntiAliasTexParameters];

October 12, 2011 at 8:30 pm #346407

jackrabbit
Participant
@jackrabbit

Sorry to bump this up- I’ve been trying various ways to fix this but was unable to..

Here is the original image: http://imgur.com/A7XSd

And the blurry picture: http://imgur.com/QxMqd

I tried adding the background in a different layer (that didn’t “popup”) and it displayed fine. Is this something to do with adding a layer on top of another? Cheers!

October 13, 2011 at 6:23 am #346408

embero
Participant
@embero

What about texture format, did you set it to RGBA8888? It looks like the color-palette is screwed up.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.