2012-08-31 158 views
0
self.background = [CCSprite spriteWithFile:@"LetterBrick.png"]; 
    CCLOG(@"background contentSize: (w: %d, h: %d)", self.background.contentSize.width, self.background.contentSize.height); 
    CCLOG(@"background boundingBox: (x: %d, y: %d, w: %d, h: %d)", self.background.boundingBox.origin.x, self.background.boundingBox.origin.y, self.background.boundingBox.size.width, self.background.boundingBox.size.height); 

    /** 
    OUTPUT: 
     background contentSize: (w: 0, h: 1078984704) 
     background boundingBox: (x: 0, y: -1069547520, w: 0, h: -1069547520) 
    */ 

所以基本上我只是從文件中創建一個CCSprite,並打印出contentize和boundingbox。但是這些價值觀似乎有點奇怪。Cocos2d CCSPrite尺寸問題

你能幫助我嗎? :)

+0

oups。只是意識到它是浮動不是整數:p – chrs

+0

UIKit有幫助函數用於從CGRect和CGSize生成NSString:NSStringFromCGRect()和NSStringFromCGSize()。查看更多字符串轉換函數的UIKit函數參考。 – Kreiri

+0

好吧不是問題,但似乎是一個很好的工具:) thx共享 – chrs

回答

0

打印出來時使用浮點數代替整數