我用SpriteHelper创建了一个Sprite Sheet。当我在spritehelper(通用应用程序)中创建背景时,图片大小为1920 x1280。如何为所有设备和所有屏幕制作背景?

CGSize winSize = [CCDirector sharedDirector].winSize;

  CCSpriteBatchNode *sprites_for_game;
  sprites_for_game = [CCSpriteBatchNode batchNodeWithFile:@"sprite_UntitledSheet.png"];

  [[CCSpriteFrameCache sharedSpriteFrameCache]addSpriteFramesWithFile:@"sprite_UntitledSheet.plist"];
   [self addChild:sprites_for_game];
        CCSprite *sprite = [CCSprite spriteWithSpriteFrameName:@"background"];
        sprite.position = ccp(winSize.width/2,winSize.height/2);
        [sprites_for_game addChild:sprite];

iPhone视网膜3.5英寸http://pixs.ru/showimage/Snimokekra_9096412_10672667.png

iPhone Retina 4.0英寸http://pixs.ru/showimage/Snimokekra_8101239_10672678.png

谁能帮我?
谢谢

最佳答案

好吧,它归结为两个选择。

选项1 :使用sprite.scale = 1.5f;之类的scale属性缩放图像以适合屏幕。我会而不是建议这样做,因为在放大时图像看起来像垃圾。

选项2 :以更高的分辨率重新渲染图像,并在您的代码中根据屏幕大小决定使用哪个图像。这就是我建议做的更好的质量。

10-08 07:49