簡體   English   中英

如何檢查Windows Phone設備的當前方向?

[英]How can I check the current orientation of my windows phone device?

我需要知道播放器何時切換設備的方向。 因此,我使用此事件,但我總是此錯誤消息。 怎么了?

this.OrientationChanged + = OrientationChanged();

方法'OrientationChanged'的重載不包含0個參數

如何在MonoGame Windows Phone 8游戲中使用此事件?

我在Game1.cs中使用以下代碼:

this.OrientationChanged += OrientationChanged();

void OrientationChanged(object sender, OrientationChangedEventArgs e)
{
    if (e.Orientation == PageOrientation.LandscapeLeft)
    {

    }
}

我的項目: https : //www.dropbox.com/s/qa1ty2ydo1hqfwn/MonogameFarseerDemo.rar

更改以下行:

this.OrientationChanged += OrientationChanged();

有了這個:

this.OrientationChanged += OnOrientationChanged;

void OnOrientationChanged(object sender, OrientationChangedEventArgs e)
{
    if (e.Orientation == PageOrientation.LandscapeLeft)
    {

    }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM