Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class cGame : Microsoft.Xna.Framework.Game
- {
- GraphicsDeviceManager graphics;
- SpriteBatch screen;
- RenderTarget2D rTarget;
- Texture2D surface;
- Texture2D sprite;
- public cGame()
- {
- graphics = new GraphicsDeviceManager(this);
- Content.RootDirectory = "Content";
- }
- protected override void Initialize()
- {
- }
- protected override void LoadContent()
- {
- screen = new SpriteBatch(GraphicsDevice);
- surface = new Texture2D(GraphicsDevice, 32, 32);
- rTarget = new RenderTarget2D(GraphicsDevice, 32, 32);
- surface = new Texture2D(GraphicsDevice, 32, 32);
- sprite = Content.Load<Texture2D>("Guy");
- }
- protected override void Update(GameTime gTime)
- {
- KeyboardState escKey = Keyboard.GetState();
- if (escKey.IsKeyDown(Keys.Escape)) Exit();
- }
- protected override void Draw(GameTime gTime)
- {
- GraphicsDevice.Clear(Color.Wheat);
- /*
- GraphicsDevice.SetRenderTarget(rTarget);
- screen.Begin();
- screen.Draw(sprite, Vector2.Zero, Color.White);
- screen.Draw(sprite, new Vector2(16, 0), Color.White);
- screen.Draw(sprite, new Vector2(0, 16), Color.White);
- screen.Draw(sprite, new Vector2(16, 16), Color.White);
- screen.End();
- GraphicsDevice.SetRenderTarget(null);
- */
- surface = (Texture2D)rTarget;
- screen.Begin();
- screen.Draw(surface, Vector2.Zero, Color.White);
- screen.End();
- }
- }
Add Comment
Please, Sign In to add comment