「MonoGameで解像度を設定する」の版間の差分
ナビゲーションに移動
検索に移動
imported>Administrator |
imported>Administrator |
||
27行目: | 27行目: | ||
== 関連項目 == | == 関連項目 == | ||
+ | [[:category: MonoGame]] | ||
== 参考文献 == | == 参考文献 == |
2017年3月9日 (木) 04:58時点における版
実装例
MonoGameで画面解像度を変更するにはGraphicsDeviceManagerインスタンスのPreferredBackBufferWidthプロパティおよびPreferredBackBufferHeightプロパティで設定を行う。
なお、Xamarin.Macなどでウインドウ表示であれば設定値がそのまま使われるが、Xamarin.Androidなどでフルスクリーン環境の場合はディスプレイ側が対応するもっとも近い解像度に自動変更されるので注意すること。
public class Game1 : Game
{
GraphicsDeviceManager graphics;
public Game1()
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
}
protected override void Initialize()
{
// TODO: Add your initialization logic here
graphics.PreferredBackBufferWidth = 360;
graphics.PreferredBackBufferHeight = 240;
graphics.ApplyChanges();
base.Initialize();
}
}