ビットマップを表示して見ました

ネット上にあまりXna 2.0のサンプルがないので
1.0のサンプルを見ながら書き換えました。

ソリューション内のContentプロジェクト?にリソース保存用のResフォルダを作成し
表示用のビットマップを追加

ビットマップのプロパティのAsset Name をColorBarに変更
ビットマップの追加

ビットマップはこんなの
カラーバー

ソースはこんな感じ (変更していない箇所は省略してます)

Game1.cs
        private Texture2D _characterTexture = null; //ココを追加
 
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            //Content.RootDirectory = "Content";
            Content.RootDirectory = "Content/Res"; //フォルダを作成したので変更
        }
 
 
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
 
 
            // TODO: use this.Content to load your game content here
            _characterTexture = Content.Load<Texture2D>("ColorBar"); //ココを追加
        }
 
       ///<summary>
        /// This is called when the game should draw itself.
        ///</summary>
        ///<param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            graphics.GraphicsDevice.Clear(Color.CornflowerBlue);
 
            // TODO: Add your drawing code here
            this.spriteBatch.Begin();
 
            this.spriteBatch.Draw(this._characterTexture, new Vector2(100, 100),
                new Rectangle(0, 0, 64, 64), Color.White);         //左から1番目の絵を表示
 
            this.spriteBatch.Draw(this._characterTexture, new Vector2(200, 100),
                new Rectangle(64, 0, 64, 64), Color.White); //左から2番目の絵を表示
 
            this.spriteBatch.End();
 
            base.Draw(gameTime);
        }
実行するとビットマップが2つ表示されます
ビットマップの表示

 

テーマ:プログラミング - ジャンル:コンピュータ

【2007/12/19 00:28 】 | Game作成 | コメント(0) | トラックバック(0) | page top↑
とりあえず実行
新規プロジェクトでWindows Game (2.0) を選択し、プロジェクト名は適当につけて
OKボタンを押す。
新規プロジェクト作成


ゲーム用のテンプレートが作成されるので、そのまま実行ボタンを押すと
こんな画面がでました
そのまま実行

寂しい画面だけどコードは一行も書いてないから、こんなものかな

テーマ:プログラミング - ジャンル:コンピュータ

【2007/12/17 00:22 】 | Game作成 | コメント(0) | トラックバック(0) | page top↑
XNA Game Studio 2.0がリリースされているらしい
1.0を入れたばっかりなのに・・・
これも何かの縁なんでしょう。XNA Game Studio 2.0を
DownLoadして見ます。


GSE 1.0のプロジェクトをProject Upgrade Wizardで
2.0に移行できるみたい。
まだ何も作ってないから関係ないか


【2007/12/16 12:26 】 | Game作成 | コメント(0) | トラックバック(0) | page top↑
ゲームの開発環境を決定
とりあえず、ゲーム開発に必要なものを揃えることにしました。
Windowsでの開発なのでこれに決定!! 無料だしね

Visual C# 2005 Express Edition
XNA Game Studio Express 1.0 Refresh

【2007/12/15 20:52 】 | Game作成 | コメント(0) | トラックバック(0) | page top↑
| ホーム |