アットウィキロゴ

XNA09

/************************************/
/*★ XNA Simple Source    前田 稔 ★*/
/************************************/
#region Using Statements
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;
#endregion

#region Main メソッド
static class Program
{
    static void Main(string[] args)
    {
        using (Game1 game = new Game1())
        {
            game.Run();
        }
    }
}
#endregion

#region Game1 Class
public class Game1 : Microsoft.Xna.Framework.Game
{
    GraphicsDeviceManager graphics;
    SpriteBatch spriteBatch;

    // コンストラクタ
    public Game1()
    {
        graphics = new GraphicsDeviceManager(this);
        Content.RootDirectory = "Content";
    }

    // 初期化
    protected override void Initialize()
    {
        base.Window.Title = "XNA Game Studio";
        base.Initialize();
    }

    // グラフィック読込み
    protected override void LoadContent()
    {
        spriteBatch = new SpriteBatch(GraphicsDevice);
    }

    // グラフィック破棄
    protected override void UnloadContent()
    {
    }

    // アップデート処理
    protected override void Update(GameTime gameTime)
    {
        if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed ||
            Keyboard.GetState().IsKeyDown(Keys.Escape)) this.Exit();
        base.Update(gameTime);
    }

    // 描画処理
    protected override void Draw(GameTime gameTime)
    {
        graphics.GraphicsDevice.Clear(Color.CornflowerBlue);
        base.Draw(gameTime);
    }
}
#endregion
最終更新:2011年01月30日 14:30