アットウィキロゴ

cしゃrp07

using System;
using System.Collections.Generic;
using System.Linq;
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.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace game07
{
    /// <summary>
    /// This is the main type for your game
    using System;
    using System.Collections.Generic;
    using System.Linq;
    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.Media;
    using Microsoft.Xna.Framework.Net;
    using Microsoft.Xna.Framework.Storage;

        public class Game1 : Microsoft.Xna.Framework.Game
        {
            GraphicsDeviceManager gr;
            SpriteBatch sp;
            Texture2D om1, om2;
            int gtime;


            public Game1()
            {
                gr = new GraphicsDeviceManager(this);
                Content.RootDirectory = "Content";

                gr.PreferredBackBufferHeight = 500;
                gr.PreferredBackBufferWidth = 500;

                gtime = 0;




            }

            protected override void Initialize()
            {

                base.Initialize();
            }

            protected override void LoadContent()
            {
                sp = new SpriteBatch(GraphicsDevice);


                om1 = Content.Load<Texture2D>("11");
                om2 = Content.Load<Texture2D>("12");
            }

            protected override void UnloadContent()
            {

            }


            protected override void Update(GameTime gameTime)
            {
                if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                    this.Exit();


                gtime = gtime + 1;
                if (gtime > 400) gtime = 0;
                base.Update(gameTime);
            }


            protected override void Draw(GameTime gameTime)
            {
                GraphicsDevice.Clear(Color.CornflowerBlue);



                sp.Begin();
                if (gtime > 200) sp.Draw(om1, new Vector2(100, gtime), Color.White);
                if (gtime < 200) sp.Draw(om2, new Vector2(100, gtime), Color.White);
                sp.End();



                base.Draw(gameTime);
            }
        }
    }
最終更新:2011年02月02日 14:09