ページ「AptX HD」と「MonoGameで解像度を設定する」の間の差分
(ページ間の差分)
ナビゲーションに移動
検索に移動
imported>Administrator |
|||
1行目: | 1行目: | ||
− | + | == 実装例 == | |
− | + | MonoGameで画面解像度を変更するにはGraphicsDeviceManagerインスタンスのPreferredBackBufferWidthプロパティおよびPreferredBackBufferHeightプロパティで設定を行う。 | |
− | |||
− | = | + | なお、[[Xamarin.Mac]]などでウインドウ表示であれば設定値がそのまま使われるが、[[Xamarin.Android]]などでフルスクリーン環境の場合はディスプレイ側が対応するもっとも近い解像度に自動変更されるので注意すること。 |
− | + | <source lang="csharp"> | |
− | + | 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(); | ||
+ | } | ||
+ | } | ||
+ | </source> | ||
== 関連項目 == | == 関連項目 == | ||
− | |||
− | |||
− | |||
− | |||
== 参考文献 == | == 参考文献 == | ||
20行目: | 32行目: | ||
{{stub}} | {{stub}} | ||
+ | |||
+ | [[category: MonoGame]] |
2017年3月9日 (木) 04:52時点における版
実装例
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();
}
}