[英]How can I check the current orientation of my windows phone device?
I need to know when the player is switching the orientation of the device. 我需要知道播放器何时切换设备的方向。 Therefore, I use this event, but I always this error message.
因此,我使用此事件,但我总是此错误消息。 What is wrong?
怎么了?
this.OrientationChanged += OrientationChanged();
this.OrientationChanged + = OrientationChanged();
No overload for method 'OrientationChanged' takes 0 arguments
方法'OrientationChanged'的重载不包含0个参数
How can I use this event in a MonoGame Windows Phone 8 game? 如何在MonoGame Windows Phone 8游戏中使用此事件?
I use the following code in Game1.cs: 我在Game1.cs中使用以下代码:
this.OrientationChanged += OrientationChanged();
void OrientationChanged(object sender, OrientationChangedEventArgs e)
{
if (e.Orientation == PageOrientation.LandscapeLeft)
{
}
}
My project: https://www.dropbox.com/s/qa1ty2ydo1hqfwn/MonogameFarseerDemo.rar 我的项目: https : //www.dropbox.com/s/qa1ty2ydo1hqfwn/MonogameFarseerDemo.rar
change the following line: 更改以下行:
this.OrientationChanged += OrientationChanged();
with this: 有了这个:
this.OrientationChanged += OnOrientationChanged;
void OnOrientationChanged(object sender, OrientationChangedEventArgs e)
{
if (e.Orientation == PageOrientation.LandscapeLeft)
{
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.