在Cocos2d项目中获取不自动旋转的方向

发布于 2024-12-21 23:44:29 字数 404 浏览 5 评论 0原文

我有一个小问题,我找不到任何解决方案。如何关闭视图和 ogl 的自动旋转并仍然获得方向?

例如,如果我将 GAME_AUTOROTATION 设置为 kGameAutorotationNone,通知中心 UIApplicationDidChangeStatusBarOrientationNotification 将不起作用。 如果我允许 shouldAutorotateToInterfaceOrientation 两个方向自动旋转再次出现。如果我实现一个空白的 willRotateToInterfaceOrientation 则不会发生任何变化。

那么,如何在不实际旋转任何东西的情况下改变方向呢?

提前致谢。

I have a small issue and I can't find any solution. How can I turn off autorotation for views and ogl and still get Orientation?

For example if I set GAME_AUTOROTATION to kGameAutorotationNone the notification center UIApplicationDidChangeStatusBarOrientationNotification doesn't work.
If I allow in shouldAutorotateToInterfaceOrientation two orientations autorotation appear again. If I implement a blank willRotateToInterfaceOrientation nothing change.

So, how can I get orientations change without actually rotate anything?

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

听,心雨的声音 2024-12-28 23:44:29

您可以通过旋转当前的CCLayer/CCScene来管理自己的方向方法。在 willRotateToInterfaceOrientation 方法上。但请确保,您将在所有 3 个触摸事件中获得错误的触摸像素......!在进行计算之前,您必须根据您的方向修改触摸坐标。

You can manage your own orientation method by rotating your Current CCLayer/CCScene. on willRotateToInterfaceOrientation method. But make sure, you will get WRONG touch pixels on all 3 touch events..! You have to modify the touch-cordinates according to your orientation them before taking them in calculations.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文