如何在spritekit场景编辑器中设置纹理过滤模式?

时间:2023-01-23 00:03:55

I'm writing pixelart game with SpriteKit and I have a problem with setting texture filtering mode in scene editor in xcode. While I was setting my textures programmatically I used constructions like this:

我正在用SpriteKit编写pixelart游戏,我在xcode的场景编辑器中设置纹理过滤模式时遇到了问题。当我以编程方式设置纹理时,我使用了这样的结构:

texture.filteringMode = SKTextureFilteringMode.Nearest 

for correct pixel display.

用于正确的像素显示。

But in scene editor I have only one property for texture

但在场景编辑器中,我只有一个纹理属性

如何在spritekit场景编辑器中设置纹理过滤模式?

and I dont know how to set SKTextureFilteringMode parameter in this case

我不知道在这种情况下如何设置SKTextureFilteringMode参数

1 个解决方案

#1


1  

This is not doable in interface builder. You have to either set it programmatically or subclass SKTexure and make the new property "@IBInspectable" that will set SKTextureFilteringMode.

这在界面构建器中是不可行的。您必须以编程方式设置它或者将SKTexure子类化,并使新属性“@IBInspectable”设置为SKTextureFilteringMode。

#1


1  

This is not doable in interface builder. You have to either set it programmatically or subclass SKTexure and make the new property "@IBInspectable" that will set SKTextureFilteringMode.

这在界面构建器中是不可行的。您必须以编程方式设置它或者将SKTexure子类化,并使新属性“@IBInspectable”设置为SKTextureFilteringMode。