Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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;
- namespace WindowsGame1
- {
- public class Game1 : Microsoft.Xna.Framework.Game
- {
- GraphicsDeviceManager graphics;
- SpriteBatch spriteBatch;
- KeyboardState oldstate;
- Texture2D whatever;
- Vector2 whatpos = Vector2.Zero;
- public Game1()
- {
- graphics = new GraphicsDeviceManager(this);
- Content.RootDirectory = "Content";
- }
- protected override void Initialize()
- {
- // TODO: Add your initialization logic here
- base.Initialize();
- oldstate = Keyboard.GetState();
- }
- protected override void LoadContent()
- {
- // Create a new SpriteBatch, which can be used to draw textures.
- spriteBatch = new SpriteBatch(GraphicsDevice);
- whatever = Content.Load<Texture2D>("whatever");
- KeyboardState newstate = Keyboard.GetState();
- }
- protected override void UnloadContent()
- {
- }
- protected override void Update(GameTime gameTime)
- {
- if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
- this.Exit();
- base.Update(gameTime);
- }
- private void updateInput()
- {
- KeyboardState newstate = Keyboard.GetState();
- if (newstate.IsKeyDown(Keys.D))
- {
- if (oldstate.IsKeyDown(Keys.D))
- {
- whatpos.X += 1;
- }
- else if (oldstate.IsKeyDown(Keys.D))
- {
- }
- oldstate = newstate;
- }
- }
- protected override void Draw(GameTime gameTime)
- {
- GraphicsDevice.Clear(Color.CornflowerBlue);
- spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);
- spriteBatch.Draw(whatever, whatpos, Color.White);
- spriteBatch.End();
- base.Draw(gameTime);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement