不能谷歌任何东西.实际上,关于这个新框架的信息很少.我唯一能找到的就是将Core Image滤镜应用于纹理.但我想在图像上方绘制一个简单的矩形,我需要编写自己的CI过滤器..
有人对主题有所了解吗?
如果您只需要一个矩形,请使用@Kex的解决方案.
通常,您可以从任何UIImage或CGImage创建纹理.[SKTexture textureWithImageNamed:@"Spaceship.png"]真的只是一个方便[SKTexture textureWithImage:[UIImage imageNamed:@"Spaceship.png"]]
因此,要对纹理进行一些自定义绘制,您可以使用,例如:
UIGraphicsBeginImageContext(CGSizeMake(256, 256));
CGContextRef ctx = UIGraphicsGetCurrentContext();
[[SKColor yellowColor] setFill];
CGContextFillEllipseInRect(ctx, CGRectMake(64, 64, 128, 128));
UIImage *textureImage = UIGraphicsGetImageFromCurrentImageContext();
SKTexture *texture = [SKTexture textureWithImage:textureImage];
SKSpriteNode *sprite = [SKSpriteNode spriteNodeWithTexture:texture];
[self addChild:sprite];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5240 次 |
| 最近记录: |