将UIKit坐标转换为SpriteKit坐标 [英] Convert UIKit coordinates to SpriteKit coordinates

查看:63
本文介绍了将UIKit坐标转换为SpriteKit坐标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将普通uikit坐标(左上角的原点,宽度和高度向右和向下)转换为Sprite Kit坐标(原点位于节点的中心,左和下为负,右和上为正)./p>

有人知道该怎么做吗?不幸的是,我无法解决此问题,因为我正在使用QuartzCore在SKNode上进行绘制.如果不进行转换,我将真正摆脱图纸.

解决方案

根据文档, SKView 具有用于 解决方案

According to the docs, SKView has methods for Converting Between View and Scene Coordinates.

Remember the scene is itself an SKNode, so if you need to get from scene coordinates to a particular node coordinate system there's also the methods in Converting to and from the Node’s Coordinate System.

这篇关于将UIKit坐标转换为SpriteKit坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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