SKView 和 SKScene 有什么区别 [英] What's the difference between SKView and SKScene

查看:19
本文介绍了SKView 和 SKScene 有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

来自 Apple 文档..

From the Apple Docs..

SK查看:SKView 对象是显示 Sprite Kit 内容的视图.此内容由 SKScene 对象提供."

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

SKSCene:SKScene 对象表示 Sprite Kit 中的内容场景."

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

有什么区别?SKScene 类似于视图控制器,SKView 类似于 UIView?

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

推荐答案

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

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.

场景是场景图的根对象.它提供了实现游戏所需的回调(物理、场景更改、更新).它不关心任何与 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.

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

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.

这篇关于SKView 和 SKScene 有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆