SKView和SKScene有什么区别

时间:2022-06-01 19:17:06

From the Apple Docs..

来自Apple Docs ..

SKView: "An SKView object is a view that displays Sprite Kit content. This content is provided by an SKScene object."

SKView:“SKView对象是一个显示Sprite Kit内容的视图。此内容由SKScene对象提供。”

SKSCene: "An SKScene object represents a scene of content in Sprite Kit."

SKSCene:“SKScene对象表示Sprite Kit中的内容场景。”

What's the difference? Is an SKScene similar to a view controller and an SKView like a UIView?

有什么不同? SKScene是一个类似于视图控制器和SKView的UIView吗?

1 个解决方案

#1


8  

The SKView is a UIView subclass. It wraps up Sprite Kit content in a view that can be used like any other Cocoa view. It usually has an associated view controller. That's Sprite Kit's connection with the Cocoa world.

SKView是一个UIView子类。它在一个可以像任何其他Cocoa视图一样使用的视图中包装Sprite Kit内容。它通常有一个关联的视图控制器。那是Sprite Kit与Cocoa世界的联系。

The scene is the root object of the scene graph. It provides callbacks (physics, scene change, update) needed to implement a game. It does not concern itself with anything Cocoa related.

场景是场景图的根对象。它提供了实现游戏所需的回调(物理,场景变化,更新)。它与Cocoa相关的任何事情都不关心。

Normally the view remains as is while you can present scenes to swap out game content, for example moving from the menu to the game scene. Internally the view also caches resource files in memory, so as you switch scenes they don't have to reload the same textures.

通常视图保持不变,而您可以呈现场景以换出游戏内容,例如从菜单移动到游戏场景。在视图内部,视图还会将资源文件缓存在内存中,因此当您切换场景时,他们不必重新加载相同的纹理。

#1


8  

The SKView is a UIView subclass. It wraps up Sprite Kit content in a view that can be used like any other Cocoa view. It usually has an associated view controller. That's Sprite Kit's connection with the Cocoa world.

SKView是一个UIView子类。它在一个可以像任何其他Cocoa视图一样使用的视图中包装Sprite Kit内容。它通常有一个关联的视图控制器。那是Sprite Kit与Cocoa世界的联系。

The scene is the root object of the scene graph. It provides callbacks (physics, scene change, update) needed to implement a game. It does not concern itself with anything Cocoa related.

场景是场景图的根对象。它提供了实现游戏所需的回调(物理,场景变化,更新)。它与Cocoa相关的任何事情都不关心。

Normally the view remains as is while you can present scenes to swap out game content, for example moving from the menu to the game scene. Internally the view also caches resource files in memory, so as you switch scenes they don't have to reload the same textures.

通常视图保持不变,而您可以呈现场景以换出游戏内容,例如从菜单移动到游戏场景。在视图内部,视图还会将资源文件缓存在内存中,因此当您切换场景时,他们不必重新加载相同的纹理。