iOS 上的 MonoGame 和 MonoTouch - 横向
我们正在使用 MonoGame 为 iOS 和 Windows Phone 7(最终是 Android)进行开发。
我们的游戏只能横向运行。
如果在 Windows 上的 WP7 模拟器中运行,我们的图形设备设置如下所示,在游戏中的 Initialize() 中:
graphics = new GraphicsManager(this);
graphics.PreferredBackBufferWidth = 480;
graphics.PreferredBackBufferHeight = 320;
graphics.SupportedOrientations = DisplayOrientation.LandscapeLeft | DisplayOrientation.LandscapeRight;
这不是 WP7 的确切屏幕尺寸(我们现在右侧有一个黑条,这不是我们的主要问题),但为我们提供了在 iPhone 上运行的正确屏幕尺寸。为了让所有内容在 iPhone 上看起来正确,我们必须反转后缓冲区的宽度和高度,这看起来很奇怪。
我们还发现我们必须在整个游戏中反转任何 X/Y 坐标和宽度/高度。
处理起来很麻烦。 MonoGame 到底在做什么?
对于我们处理这两个平台之间的明显大小调整的建议是什么?如果可能的话,我们希望以某种方式全面使用相同的坐标。
编辑: GitHub 上最新的 2.0 版本的 MonoGame 不再存在方向问题。
TouchPanel 手势尚未完全实现,因此我们只是避免这种情况。
We are using MonoGame to develop for iOS and Windows Phone 7 (and then eventually Android).
Our game runs only in landscape orientation.
If running in the WP7 emulator on windows, our graphics device setup like so, in Initialize() in our Game:
graphics = new GraphicsManager(this);
graphics.PreferredBackBufferWidth = 480;
graphics.PreferredBackBufferHeight = 320;
graphics.SupportedOrientations = DisplayOrientation.LandscapeLeft | DisplayOrientation.LandscapeRight;
This isn't the exact screen size for WP7 (we have a black bar on the right for now, which is not our primary concern), but gives us the right screen size that will run on an iPhone. For everything to look correctly on the iPhone, we have to reverse the Width and Height of the backbuffer, which seems very strange.
We also find we have to reverse any X/Y coordinates and Widths/Heights throughout our game.
This is a lot of trouble to deal with. What exactly is MonoGame doing here?
What is the recommended for us to handle the apparent resizing between these 2 platforms? We would like to somehow use the same coordinates across the board if possible.
EDIT:
The latest 2.0 version of MonoGame on GitHub no longer has the orientation issues.
TouchPanel gestures are not quite implemented yet, so we are just avoiding that.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您似乎正在使用 codeplex 上旧的 MonoGame 源代码,ExEn 实际上是从该源代码中分叉出来并用于商业化的。最新的开源 MonoGame 源代码和正确的主页是 https://github.com/mono/MonoGame。
您能否尝试一下那里的源版本,并让我知道这是否仍然是一个问题。我们正在准备发布 MonoGame v1.6,如果这仍然是一个问题,我希望解决这个问题。
You seem to be using to the old MonoGame sources on codeplex, that ExEn actually forked from and went commercial with. The latest OpenSource MonoGame source and proper home page is https://github.com/mono/MonoGame.
Could you please try the source version from there, and let me know if this is still an issue. We are gearing up for release v1.6 of MonoGame and I'd like to have this fixed, if it is still an issue.