0

iPad では正しくスケーリングされているスプライト アニメーションがありますが、iPad の網膜では半分のサイズで表示されます (画像は幅 1024 ピクセル、高さ 20 ピクセルで、網膜上かどうかにかかわらず画面全体に広がるはずです)。ファイル サイズが大きすぎるため、このアニメーション用に -ipadhd スプライト シートを作成したくありません。解像度が高くなくても問題ありません。では、Retina デバイスのサイズを 2 倍に拡大して、画面全体に拡大するにはどうすればよいでしょうか?

[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:@"zapperAnim.plist"];
CCSpriteBatchNode *spriteSheet = [CCSpriteBatchNode batchNodeWithFile:@"zapperAnim.png"];

NSMutableArray *walkAnimFrames = [NSMutableArray array];
NSString *frameName = @"length_0000";

        for (int i=0; i<=6; i++) {
            [walkAnimFrames addObject:
             [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:[NSString stringWithFormat:@"%@%d.png", frameName, i]]];
        }

        CCAnimation *zapAnim = [CCAnimation animationWithSpriteFrames:walkAnimFrames delay:0.05f];

        self.zapper = [CCPhysicsSprite spriteWithSpriteFrameName:[NSString stringWithFormat:@"%@0.png", frameName]];
        self.zapAction = [CCRepeatForever actionWithAction:[CCAnimate actionWithAnimation:zapAnim]];
        [self.zapper runAction:self.zapAction];
4

3 に答える 3

0

you can check if screen is retina or not if it then set scale 2

if((([[UIScreen mainScreen] respondsToSelector:@selector(scale)] &&
[UIScreen mainScreen].scale > 1))) spr.scale = 2;
于 2014-02-01T06:41:14.010 に答える
0

Ipad Retina を使用している場合は、次のようにします。

    self.zapper.scale = 2.0;
于 2013-08-12T20:17:08.757 に答える