MonoGameで解像度を設定する
2017年3月9日 (木) 04:58時点におけるimported>Administratorによる版
実装例
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();
}
}