ios - Basic Questions about Create Texture Atlas in Xcode -
i think might using texture atlases incorrectly, , wanted ask advice.
i found few sites online suggested create folder, let's ball.atlas, , in there, add animation frames (ball1, ball2, ball3).
then drag , drop ball.atlas actual xcode content tree, , reference atlas in code this:
self.ballatlas = sktextureatlas(named: "ball") self.ballimages.append(self.ballatlas.texturenamed("ball1")); self.ballimages.append(self.ballatlas.texturenamed("ball2")); self.ballimages.append(self.ballatlas.texturenamed("ball3")); self.ballimages.append(self.ballatlas.texturenamed("ball4")); self.ballimages.append(self.ballatlas.texturenamed("ball5"));
and can reference self.ballimages display animation, etc.
i saw guide, however, said go xcassets folder, , click '+', , hit 'new texture atlas', , creates folder. drag ball images in there.
there 1 fundamental difference here, however: in second approach, can specify @1x, @2x, @3x, whereas in first example (dragging folder) there no way specify.
what should doing? should not dragging anything, , instead put atlases inside xcassets collection?
thanks!
Comments
Post a Comment