「MonoGameで解像度を取得する」の版間の差分
imported>Administrator 編集の要約なし |
imported>Administrator 編集の要約なし |
||
| 9行目: | 9行目: | ||
</pre> | </pre> | ||
これがWindowsやMacで実行した場合はよほどのことが無い限り要望した解像度になるだろう。しかし[[Android]]では[[カタログスペック]]の解像度ではなく、上部のステータスバーや下部のナビゲーションバーを除いた領域が実効解像度となるため、それらを考慮した「もっとも近似する解像度」が設定される(詳細は「[[MonoGameで解像度を設定する]]」を参照)。ホームボタンが物理ボタンの機種がほとんどなくなったので注意しよう。 | |||
実効解像度は以下のプロパティで取得できる。 | |||
<pre lang="csharp"> | <pre lang="csharp"> | ||
GraphicsDevice.PresentationParameters.BackBufferWidth; | GraphicsDevice.PresentationParameters.BackBufferWidth; | ||
GraphicsDevice.PresentationParameters.BackBufferHeight; | GraphicsDevice.PresentationParameters.BackBufferHeight; | ||
</pre> | </pre>ちなみにカタログスペックの解像度は以下のプロパティで取得できる。<syntaxhighlight> | ||
// | |||
GraphicsDevice.DisplayMode.Width; | |||
GraphicsDevice.DisplayMode.Height; | |||
//または | |||
GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width; | |||
GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height; | |||
</syntaxhighlight> | |||
== 注意点 == | == 注意点 == | ||