How to make Sprite Kit display @2x images from atlas at correct size?

前端 未结 3 640
眼角桃花
眼角桃花 2021-02-05 14:00

When a project only has @2x images because it only targets retina display devices, atlas Sprite Kit atlas gets the scale wrong with the RGBA8888_COMPRESSED setting to use with P

3条回答
  •  南笙
    南笙 (楼主)
    2021-02-05 14:31

    Disclaimer: I have only tested this in XCode 6.

    I open the Images.xcassets folder in the file system. Inside it are one folder for each image and inside each image folder there are the image files plus a json filed called Contents.json. It looks something like this:

        {
      "images" : [
        {
          "idiom" : "universal",
          "scale" : "1x",
          "filename" : "btn_orange.png"
        }
      ],
      "info" : {
        "version" : 1,
        "author" : "xcode"
      }
    }
    

    If I change the scale row to 2x, i.e.:

    "scale" : "2x",
    

    the image will be displayed as a retina image (and don't use the @2x suffix).

提交回复
热议问题