This example demonstrates how to start a game in full screen.
この作例では、ゲームをフルスクリーンモードで開始させる方法を説明します。
この作例では、ゲームをフルスクリーンモードで開始させる方法を説明します。
フルスクリーンでゲームを開始する方法
1. Microsoft.Xna.Framework.Gameクラスを継承する。
2. GraphicsDeviceManagerを作成したら、PreferredBackBufferWidthとPreferredBackBufferHeightに画面の幅と高さを入れる。
3. IsFullScreenをtrueにする。
C#
+ ...
public class Game1 : Microsoft.Xna.Framework.Game
{GraphicsDeviceManager graphics; ContentManager content;
public Game1() { graphics = new GraphicsDeviceManager(this); content = new ContentManager(Services);
graphics.PreferredBackBufferWidth = 800; graphics.PreferredBackBufferHeight = 600; graphics.PreferMultiSampling = false; graphics.IsFullScreen = true; }
protected override void Initialize() { // TODO: Add your initialization logic here
base.Initialize(); }
protected override void LoadGraphicsContent(bool loadAllContent) { if (loadAllContent) { // TODO: Load any ResourceManagementMode.Automatic content }
// TODO: Load any ResourceManagementMode.Manual content }
protected override void UnloadGraphicsContent(bool unloadAllContent) { if (unloadAllContent == true) { content.Unload(); } }
protected override void Update(GameTime gameTime) { // Allows the default game to exit on Xbox 360 and Windows if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) { this.Exit(); }
// TODO: Add your update logic here
base.Update(gameTime); }
protected override void Draw(GameTime gameTime) { graphics.GraphicsDevice.Clear(Color.CornflowerBlue);
// TODO: Add your drawing code here
base.Draw(gameTime); }}
affillogo.gif