Convert UIKit coordinates to SpriteKit coordinates

风格不统一 提交于 2019-12-12 10:47:12

问题


I am trying to convert normal uikit coordinates (top left origin, width and height go right and down) to Sprite Kit coordinates (origin is at center of node, left and down are negative, right and up are positive).

Does anyone know how to do this? Unfortunately I can't work around this to my knowledge because I am using QuartzCore for drawing on a SKNode. Without converting, I am getting really off drawings.


回答1:


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.



来源:https://stackoverflow.com/questions/27158591/convert-uikit-coordinates-to-spritekit-coordinates

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!