【发布时间】:2016-12-15 22:38:13
【问题描述】:
我正在开发 SWIFT3/SpriteKit 屏幕保护程序,并且屏幕保护程序正常工作,但我无法加载我的纹理,因为当我执行以下操作时:
// load texture atlas
let textureAtlas = SKTextureAtlas(named: "Flyers")
SKTextureAtlas 正在寻找在 screensaverengine.app 内部运行的主包中的“传单”,这不是纹理所在的包。
在我旧的基于 obj-c 的屏幕保护程序中,我必须执行以下操作才能从包中加载图像:
thisBundle = [NSBundle bundleForClass:[self class]];
fileName=[[NSString alloc ] initWithFormat:@"flyer%d", flyNum];
picturePath = [thisBundle pathForResource:fileName ofType:@"png"];
flyerImage= [[NSImage alloc ] initWithContentsOfFile:picturePath];
在我走在运行时加载图像和创建纹理的路线之前,我想利用 Stackoverflow 系列寻求帮助......想法?
【问题讨论】:
标签: swift3 texturepacker sktexture texture-atlas sktextureatlas