ページ「タックスヘイブン」と「MonoGameで解像度を設定する」の間の差分
(ページ間の差分)
ナビゲーションに移動
検索に移動
imported>Administrator |
(ページの作成:「== 実装例 == GraphicsDeviceManagerインスタンスのPreferredBackBufferWidthプロパティおよびPreferredBackBufferHeightプロパティで画面解像度を設...」) |
||
1行目: | 1行目: | ||
− | + | == 実装例 == | |
+ | 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> | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== 関連項目 == | == 関連項目 == | ||
− | |||
− | |||
== 参考文献 == | == 参考文献 == | ||
35行目: | 30行目: | ||
{{stub}} | {{stub}} | ||
+ | |||
+ | [[category: MonoGame]] |
2016年12月5日 (月) 02:54時点における版
実装例
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();
}
}