multiple sprites for one character

January 31, 2009 by admin · Comment
Filed under: Xbox360 News 

I will try and explain this the best i can.  But basically i have a sprite which puts a fighter on my screen, and when the forward and back keys are pushed, it walks.  Now i want to make this same character jump.  This is where i load in my sprite and get the values of each specific sprite

        protected override void Initialize()  
        {  
            spriteBatch = new SpriteBatch(graphics.GraphicsDevice);  
            graphics.PreferredBackBufferWidth = GameConstants.ScreenWidth;  
            graphics.PreferredBackBufferHeight = GameConstants.ScreenHeight;  
            graphics.IsFullScreen = false;  
            graphics.ApplyChanges();  
            Window.Title = "UltimateFighter — Coursework 3";  
 
            walking.Initialize(0, 450, 6f, 130);  
            walking.Add(3, 10, 134, 212);  
            walking.Add(132, 10, 148, 212);  
            walking.Add(280, 10, 141, 212);  
            walking.Add(420, 10, 120, 212);  
            walking.Add(543, 10, 118, 212);  
            walking.Add(660, 10, 124, 212);  
 
            graphics.SynchronizeWithVerticalRetrace = false;  
            IsFixedTimeStep = false;  
 
            base.Initialize();  
            this.IsFixedTimeStep = false;   
        }  
 
        protected override void LoadContent()  
        {  
            spriteSheet = content.Load<Texture2D>("Content/sprites/kenWalk");  
            backgroundTexture = Content.Load<Texture2D>("Content/background");  
        } 

 

Now the problem is, if i now load in the jumping sprite, and find the location of each induvidual sprite, that would just put 2 characters on my screen.  One which walks and one which jumps.  This is the code i use to make it walk

#region Using Statements  
using System;  
using System.Collections;  
using System.Collections.Generic;  
using Microsoft.Xna.Framework;  
using Microsoft.Xna.Framework.Audio;  
using Microsoft.Xna.Framework.Content;  
using Microsoft.Xna.Framework.Graphics;  
using Microsoft.Xna.Framework.Input;  
using Microsoft.Xna.Framework.Storage;  
using UltimateFighter;
#endregion  
 
 
namespace Ultimate_Fighter  
{  
 
    
    class AnimatedSprite  
    {  
         
        public ArrayList sprites = new ArrayList();  
        public int counter = 0;  
        public float frameTimer = 0f;  
        protected float width;  
        protected float speed = 6;  
        protected Vector2 direction;  
        protected Vector2 origin;  
        protected Vector2 position = Vector2.Zero;  
        protected SpriteEffects effects;  
 
    
        public void Initialize(int x, int y, float Speed, float Width)  
        {  
            direction.X = -1f;  
            direction.Y = 0f;  
            origin.X = 0;  
            origin.Y = 0;  
            position.X = x;  
            position.Y = y;  
            speed = Speed;  
            width = Width;  
 
        }  
 
        float frameDistance = 0;  
        public void Update(GameTime gameTime)  
        {  
            // Get the game pad state.  
            GamePadState joyState = GamePad.GetState(PlayerIndex.One);  
            // get keyboard state  
            KeyboardState keyState = Keyboard.GetState();  
            float timeDelta = (float)gameTime.ElapsedGameTime.TotalSeconds;  
              
            if (joyState.DPad.Right == ButtonState.Pressed || keyState.IsKeyDown(Keys.Right))  
            {     
               // if (effects == SpriteEffects.None) effects = SpriteEffects.FlipHorizontally;  
                 
                if (direction.X == -1) direction.X = 1;  
                Walk();  
            }  
            if (joyState.DPad.Left == ButtonState.Pressed || keyState.IsKeyDown(Keys.Left))  
            {  
               // if (effects == SpriteEffects.FlipHorizontally) effects = SpriteEffects.None;  
                 
                if (direction.X == 1) direction.X = -1;  
                Walk();  
 
            }  
        }  
 
         
        public void Add(int x, int y, int width, int height)  
        {  
            sprites.Add(new Rectangle(x, y, width, height));  
        }  
         
        public void Walk()  
        {    
            position.X += direction.X * speed;  
            position.Y += direction.Y * speed;  
            // if sprite goes off left, keep it on screen  
            if (position.X < 0) position.X = 0;  
            // if sprite goes off right, keep it on screen  
            if (position.X > GameConstants.ScreenWidth - width)  
                position.X = GameConstants.ScreenWidth - width;  
            // increment frame distance  
            frameDistance += GameConstants.frameInc;  
            // if its over threshold  
            if (frameDistance >= GameConstants.frameThreshold)  
            { // reset to 0  
                frameDistance = 0f;  
                // increment the sprite counter  
                counter++;  
                // keep the counter in the range 0 - sprites.Count  
                counter = counter % sprites.Count;  
            }  
        }  
 
        public void Draw(SpriteBatch spriteBatch, Texture2D spriteSheet)  
        {  
            spriteBatch.Draw(spriteSheet, position, ((Rectangle)sprites[counter]), Color.White, 0f, origin, 1f,  
                    effects, 0f);  
        }  
 
    }  

Now that is what my instance is too when i do walking.Add in the first code snipplet.  For my jumping, i have created a class exactly the same as the one above, but am doing it for the up key pushed instead.  But how would i get all the sprites to be on just one character, rather than having several characters on my screen each performing a different action.  I cannot find any tutorials on this at all.  They all show how to perform one animation on one sprite.  Any advise at all would be great.  I am trying my hardest to work on this as i am now extremely addicted and cannot put it down!
cheers

ObjectDisposedException, but IsDisposed = false?

January 31, 2009 by admin · Comment
Filed under: Xbox360 News 

Hello,

I wrote a class which inherits from WPF's Window and uses some of the classes from this sample: http://creators.xna.com/en-US/sample/winforms_series1

In the OnRendering(object, EventArgs) method, this.graphics.GraphicsDevice.SetRenderTarget(0, this.renderTarget); throws an ObjectDisposedException if this.graphics.ResetDevice((int)this.Width, (int)this.Height); is previously called in HandleDeviceReset(), even though this.renderTarget.IsDisposed is false, as seen in the debugger.

What is going on?

namespace ————
    using System; 
    using System.Reflection; 
    using System.Windows; 
    using System.Windows.Interop; 
    using System.Windows.Media; 
    using Microsoft.Xna.Framework; 
    using Microsoft.Xna.Framework.Content; 
    using Microsoft.Xna.Framework.Graphics; 
    using Microsoft.Xna.Framework.Input; 
    using System.Windows.Controls; 
 
    /// <summary> 
    /// Defines a window whose background is rendered using XNA. 
    /// </summary> 
    public class XnaWindow : System.Windows.Window 
    { 
        /// <summary> 
        /// Direct3D image surface. 
        /// </summary> 
        private D3DImage d3dImage = new D3DImage(); 
 
        /// <summary> 
        /// The texture that will be written to. 
        /// </summary> 
        private RenderTarget2D renderTarget; 
 
        /// <summary> 
        /// Handles the configuration and management of the graphics device. 
        /// </summary> 
        private GraphicsDeviceService graphics; 
 
        /// <summary> 
        /// Initializes a new instance of the XnaWindow class. 
        /// </summary> 
        public XnaWindow() 
        { 
            this.Width = 800f; 
            this.Height = 600f; 
            this.Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded); 
        } 
 
        /// <summary> 
        /// Gets the width of the window's client area. 
        /// </summary> 
        /// <value>See summary.</value> 
        public int ClientWidth 
        { 
            get { return (int)((FrameworkElement)this.Content).ActualWidth; } 
        } 
 
        /// <summary> 
        /// Gets the height of the window's client area. 
        /// </summary> 
        /// <value>See summary.</value> 
        public int ClientHeight 
        { 
            get { return (int)((FrameworkElement)this.Content).ActualHeight; } 
        } 
 
        /// <summary> 
        /// Gets a GraphicsDevice that can be used to draw onto this control. 
        /// </summary> 
        /// <value>See summary.</value> 
        public GraphicsDevice GraphicsDevice 
        { 
            get { return this.graphics.GraphicsDevice; } 
        } 
 
        /// <summary> 
        /// Gets an IServiceProvider containing our IGraphicsDeviceService. 
        /// This can be used with components such as the ContentManager, 
        /// which use this service to look up the GraphicsDevice. 
        /// </summary> 
        /// <value>See summary.</value> 
        public ServiceContainer Services 
        { 
            get
            private set
        } 
 
        /// <summary> 
        /// Gets the content manager for the control. 
        /// </summary> 
        /// <value>See summary.</value> 
        public ContentManager ContentManager 
        { 
            get
            private set
        } 
 
        /// <summary> 
        /// Initializes the XNA content. 
        /// </summary> 
        protected virtual void Initialize() 
        { 
        } 
 
        /// <summary> 
        /// Draws the XNA content. Override to draw your own content. 
        /// </summary> 
        protected virtual void Draw() 
        { 
            this.GraphicsDevice.Clear(Microsoft.Xna.Framework.Graphics.Color.SkyBlue); 
        } 
 
        /// <summary> 
        /// Initializes the XNA graphics device when the window is reset. 
        /// </summary> 
        /// <param name="sender">The object that raised the event.</param> 
        /// <param name="e">The event arguments.</param> 
        private void Window_Loaded(object sender, RoutedEventArgs e) 
        { 
            this.InitializeGraphics(); 
        } 
 
        /// <summary> 
        /// Renders the XNA content. 
        /// </summary> 
        /// <param name="sender">The object that raised the event.</param> 
        /// <param name="e">The event arguments.</param> 
        private void OnRendering(object sender, EventArgs e) 
        { 
            this.HandleDeviceReset(); 
 
            // Many GraphicsDeviceControl instances can be sharing the same 
            // GraphicsDevice. The device backbuffer will be resized to fit the 
            // largest of these controls. But what if we are currently drawing 
            // a smaller control? To avoid unwanted stretching, we set the 
            // viewport to only use the top left portion of the full backbuffer. 
            Viewport viewport = new Viewport(); 
 
            viewport.X = 0; 
            viewport.Y = 0; 
 
            viewport.Width = this.renderTarget.Width; 
            viewport.Height = this.renderTarget.Height; 
 
            viewport.MinDepth = 0; 
            viewport.MaxDepth = 1; 
 
            this.GraphicsDevice.Viewport = viewport; 
 
            this.d3dImage.Lock(); 
            this.graphics.GraphicsDevice.SetRenderTarget(0, this.renderTarget); 
 
            this.Draw(); 
 
            this.d3dImage.AddDirtyRect(new System.Windows.Int32Rect(0, 0, this.renderTarget.Width, this.renderTarget.Height)); 
            this.d3dImage.Unlock(); 
        } 
 
        /// <summary> 
        /// Helper used by BeginDraw. This checks the graphics device status, 
        /// making sure it is big enough for drawing the current control, and 
        /// that the device is not lost. Returns an error string if the device 
        /// could not be reset. 
        /// </summary> 
        /// <returns>An error string if the device could not be reset.</returns> 
        private string HandleDeviceReset() 
        { 
            bool deviceNeedsReset = false
 
            switch (this.GraphicsDevice.GraphicsDeviceStatus) 
            { 
                case GraphicsDeviceStatus.Lost: 
                    // If the graphics device is lost, we cannot use it at all. 
                    return "Graphics device lost"
                case GraphicsDeviceStatus.NotReset: 
                    // If device is in the not-reset state, we should try to reset it. 
                    deviceNeedsReset = true
                    break
                default
                    // If the device state is ok, check whether it is big enough. 
                    PresentationParameters pp = this.GraphicsDevice.PresentationParameters; 
                    deviceNeedsReset = (this.ClientWidth > pp.BackBufferWidth) || (this.ClientHeight > pp.BackBufferHeight); 
                    break
            } 
 
            // Do we need to reset the device? 
            if (deviceNeedsReset) 
            { 
                try 
                { 
                    this.graphics.ResetDevice(this.ClientWidth, this.ClientHeight); 
                    this.renderTarget = new RenderTarget2D(this.graphics.GraphicsDevice, this.ClientWidth, this.ClientHeight, 1, SurfaceFormat.Color); 
                } 
                catch (Exception e) 
                { 
                    return "Graphics device reset failed\n\n" + e; 
                } 
            } 
 
            return null
        } 
 
        /// <summary> 
        /// Initializes the graphics device and render target. 
        /// </summary> 
        private void InitializeGraphics() 
        { 
            WindowInteropHelper wih = new WindowInteropHelper(this); 
 
            this.Services = new ServiceContainer(); 
            this.ContentManager = new ContentManager(this.Services, "Content"); 
 
            this.graphics = GraphicsDeviceService.AddRef(wih.Handle, this.ClientWidth, this.ClientHeight); 
            this.renderTarget = new RenderTarget2D(this.graphics.GraphicsDevice, this.ClientWidth, this.ClientHeight, 1, SurfaceFormat.Color); 
 
            // Register the service, so components like ContentManager can find it. 
            this.Services.AddService<IGraphicsDeviceService>(this.graphics); 
 
            // Set XNA mouse input to be relative to this window rather than the desktop 
            Mouse.WindowHandle = wih.Handle; 
 
            this.d3dImage.Lock(); 
            this.d3dImage.SetBackBuffer(D3DResourceType.IDirect3DSurface9, this.GetSurface(this.renderTarget)); 
            this.d3dImage.Unlock(); 
 
            CompositionTarget.Rendering += this.OnRendering; 
 
            this.Background = new ImageBrush(this.d3dImage); 
 
            this.Initialize(); 
        } 
 
        /// <summary> 
        /// Gets the surface pointer of a render target. 
        /// </summary> 
        /// <param name="renderTarget">The render target to get the surface pointer of.</param> 
        /// <returns>See summary.</returns> 
        private unsafe IntPtr GetSurface(RenderTarget renderTarget) 
        { 
            return new IntPtr(Pointer.Unbox(typeof(RenderTarget).GetField("pRenderTargetSurface", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(renderTarget))); 
        } 
    } 
 

multiple sprites for one character

January 31, 2009 by admin · Comment
Filed under: Xbox360 News 

I will try and explain this the best i can.  But basically i have a sprite which puts a fighter on my screen, and when the forward and back keys are pushed, it walks.  Now i want to make this same character jump.  This is where i load in my sprite and get the values of each specific sprite

        protected override void Initialize()  
        {  
            spriteBatch = new SpriteBatch(graphics.GraphicsDevice);  
            graphics.PreferredBackBufferWidth = GameConstants.ScreenWidth;  
            graphics.PreferredBackBufferHeight = GameConstants.ScreenHeight;  
            graphics.IsFullScreen = false;  
            graphics.ApplyChanges();  
            Window.Title = "UltimateFighter — Coursework 3";  
 
            walking.Initialize(0, 450, 6f, 130);  
            walking.Add(3, 10, 134, 212);  
            walking.Add(132, 10, 148, 212);  
            walking.Add(280, 10, 141, 212);  
            walking.Add(420, 10, 120, 212);  
            walking.Add(543, 10, 118, 212);  
            walking.Add(660, 10, 124, 212);  
 
            graphics.SynchronizeWithVerticalRetrace = false;  
            IsFixedTimeStep = false;  
 
            base.Initialize();  
            this.IsFixedTimeStep = false;   
        }  
 
        protected override void LoadContent()  
        {  
            spriteSheet = content.Load<Texture2D>("Content/sprites/kenWalk");  
            backgroundTexture = Content.Load<Texture2D>("Content/background");  
        } 

 

Now the problem is, if i now load in the jumping sprite, and find the location of each induvidual sprite, that would just put 2 characters on my screen.  One which walks and one which jumps.  This is the code i use to make it walk

#region Using Statements  
using System;  
using System.Collections;  
using System.Collections.Generic;  
using Microsoft.Xna.Framework;  
using Microsoft.Xna.Framework.Audio;  
using Microsoft.Xna.Framework.Content;  
using Microsoft.Xna.Framework.Graphics;  
using Microsoft.Xna.Framework.Input;  
using Microsoft.Xna.Framework.Storage;  
using UltimateFighter;
#endregion  
 
 
namespace Ultimate_Fighter  
{  
 
    
    class AnimatedSprite  
    {  
         
        public ArrayList sprites = new ArrayList();  
        public int counter = 0;  
        public float frameTimer = 0f;  
        protected float width;  
        protected float speed = 6;  
        protected Vector2 direction;  
        protected Vector2 origin;  
        protected Vector2 position = Vector2.Zero;  
        protected SpriteEffects effects;  
 
    
        public void Initialize(int x, int y, float Speed, float Width)  
        {  
            direction.X = -1f;  
            direction.Y = 0f;  
            origin.X = 0;  
            origin.Y = 0;  
            position.X = x;  
            position.Y = y;  
            speed = Speed;  
            width = Width;  
 
        }  
 
        float frameDistance = 0;  
        public void Update(GameTime gameTime)  
        {  
            // Get the game pad state.  
            GamePadState joyState = GamePad.GetState(PlayerIndex.One);  
            // get keyboard state  
            KeyboardState keyState = Keyboard.GetState();  
            float timeDelta = (float)gameTime.ElapsedGameTime.TotalSeconds;  
              
            if (joyState.DPad.Right == ButtonState.Pressed || keyState.IsKeyDown(Keys.Right))  
            {     
               // if (effects == SpriteEffects.None) effects = SpriteEffects.FlipHorizontally;  
                 
                if (direction.X == -1) direction.X = 1;  
                Walk();  
            }  
            if (joyState.DPad.Left == ButtonState.Pressed || keyState.IsKeyDown(Keys.Left))  
            {  
               // if (effects == SpriteEffects.FlipHorizontally) effects = SpriteEffects.None;  
                 
                if (direction.X == 1) direction.X = -1;  
                Walk();  
 
            }  
        }  
 
         
        public void Add(int x, int y, int width, int height)  
        {  
            sprites.Add(new Rectangle(x, y, width, height));  
        }  
         
        public void Walk()  
        {    
            position.X += direction.X * speed;  
            position.Y += direction.Y * speed;  
            // if sprite goes off left, keep it on screen  
            if (position.X < 0) position.X = 0;  
            // if sprite goes off right, keep it on screen  
            if (position.X > GameConstants.ScreenWidth - width)  
                position.X = GameConstants.ScreenWidth - width;  
            // increment frame distance  
            frameDistance += GameConstants.frameInc;  
            // if its over threshold  
            if (frameDistance >= GameConstants.frameThreshold)  
            { // reset to 0  
                frameDistance = 0f;  
                // increment the sprite counter  
                counter++;  
                // keep the counter in the range 0 - sprites.Count  
                counter = counter % sprites.Count;  
            }  
        }  
 
        public void Draw(SpriteBatch spriteBatch, Texture2D spriteSheet)  
        {  
            spriteBatch.Draw(spriteSheet, position, ((Rectangle)sprites[counter]), Color.White, 0f, origin, 1f,  
                    effects, 0f);  
        }  
 
    }  

Now that is what my instance is too when i do walking.Add in the first code snipplet.  For my jumping, i have created a class exactly the same as the one above, but am doing it for the up key pushed instead.  But how would i get all the sprites to be on just one character, rather than having several characters on my screen each performing a different action.  I cannot find any tutorials on this at all.  They all show how to perform one animation on one sprite.  Any advise at all would be great.  I am trying my hardest to work on this as i am now extremely addicted and cannot put it down!
cheers

ObjectDisposedException, but IsDisposed = false?

January 31, 2009 by admin · Comment
Filed under: Xbox360 News 

Hello,

I wrote a class which inherits from WPF's Window and uses some of the classes from this sample: http://creators.xna.com/en-US/sample/winforms_series1

In the OnRendering(object, EventArgs) method, this.graphics.GraphicsDevice.SetRenderTarget(0, this.renderTarget); throws an ObjectDisposedException if this.graphics.ResetDevice((int)this.Width, (int)this.Height); is previously called in HandleDeviceReset(), even though this.renderTarget.IsDisposed is false, as seen in the debugger.

What is going on?

namespace ————
    using System; 
    using System.Reflection; 
    using System.Windows; 
    using System.Windows.Interop; 
    using System.Windows.Media; 
    using Microsoft.Xna.Framework; 
    using Microsoft.Xna.Framework.Content; 
    using Microsoft.Xna.Framework.Graphics; 
    using Microsoft.Xna.Framework.Input; 
    using System.Windows.Controls; 
 
    /// <summary> 
    /// Defines a window whose background is rendered using XNA. 
    /// </summary> 
    public class XnaWindow : System.Windows.Window 
    { 
        /// <summary> 
        /// Direct3D image surface. 
        /// </summary> 
        private D3DImage d3dImage = new D3DImage(); 
 
        /// <summary> 
        /// The texture that will be written to. 
        /// </summary> 
        private RenderTarget2D renderTarget; 
 
        /// <summary> 
        /// Handles the configuration and management of the graphics device. 
        /// </summary> 
        private GraphicsDeviceService graphics; 
 
        /// <summary> 
        /// Initializes a new instance of the XnaWindow class. 
        /// </summary> 
        public XnaWindow() 
        { 
            this.Width = 800f; 
            this.Height = 600f; 
            this.Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded); 
        } 
 
        /// <summary> 
        /// Gets the width of the window's client area. 
        /// </summary> 
        /// <value>See summary.</value> 
        public int ClientWidth 
        { 
            get { return (int)((FrameworkElement)this.Content).ActualWidth; } 
        } 
 
        /// <summary> 
        /// Gets the height of the window's client area. 
        /// </summary> 
        /// <value>See summary.</value> 
        public int ClientHeight 
        { 
            get { return (int)((FrameworkElement)this.Content).ActualHeight; } 
        } 
 
        /// <summary> 
        /// Gets a GraphicsDevice that can be used to draw onto this control. 
        /// </summary> 
        /// <value>See summary.</value> 
        public GraphicsDevice GraphicsDevice 
        { 
            get { return this.graphics.GraphicsDevice; } 
        } 
 
        /// <summary> 
        /// Gets an IServiceProvider containing our IGraphicsDeviceService. 
        /// This can be used with components such as the ContentManager, 
        /// which use this service to look up the GraphicsDevice. 
        /// </summary> 
        /// <value>See summary.</value> 
        public ServiceContainer Services 
        { 
            get
            private set
        } 
 
        /// <summary> 
        /// Gets the content manager for the control. 
        /// </summary> 
        /// <value>See summary.</value> 
        public ContentManager ContentManager 
        { 
            get
            private set
        } 
 
        /// <summary> 
        /// Initializes the XNA content. 
        /// </summary> 
        protected virtual void Initialize() 
        { 
        } 
 
        /// <summary> 
        /// Draws the XNA content. Override to draw your own content. 
        /// </summary> 
        protected virtual void Draw() 
        { 
            this.GraphicsDevice.Clear(Microsoft.Xna.Framework.Graphics.Color.SkyBlue); 
        } 
 
        /// <summary> 
        /// Initializes the XNA graphics device when the window is reset. 
        /// </summary> 
        /// <param name="sender">The object that raised the event.</param> 
        /// <param name="e">The event arguments.</param> 
        private void Window_Loaded(object sender, RoutedEventArgs e) 
        { 
            this.InitializeGraphics(); 
        } 
 
        /// <summary> 
        /// Renders the XNA content. 
        /// </summary> 
        /// <param name="sender">The object that raised the event.</param> 
        /// <param name="e">The event arguments.</param> 
        private void OnRendering(object sender, EventArgs e) 
        { 
            this.HandleDeviceReset(); 
 
            // Many GraphicsDeviceControl instances can be sharing the same 
            // GraphicsDevice. The device backbuffer will be resized to fit the 
            // largest of these controls. But what if we are currently drawing 
            // a smaller control? To avoid unwanted stretching, we set the 
            // viewport to only use the top left portion of the full backbuffer. 
            Viewport viewport = new Viewport(); 
 
            viewport.X = 0; 
            viewport.Y = 0; 
 
            viewport.Width = this.renderTarget.Width; 
            viewport.Height = this.renderTarget.Height; 
 
            viewport.MinDepth = 0; 
            viewport.MaxDepth = 1; 
 
            this.GraphicsDevice.Viewport = viewport; 
 
            this.d3dImage.Lock(); 
            this.graphics.GraphicsDevice.SetRenderTarget(0, this.renderTarget); 
 
            this.Draw(); 
 
            this.d3dImage.AddDirtyRect(new System.Windows.Int32Rect(0, 0, this.renderTarget.Width, this.renderTarget.Height)); 
            this.d3dImage.Unlock(); 
        } 
 
        /// <summary> 
        /// Helper used by BeginDraw. This checks the graphics device status, 
        /// making sure it is big enough for drawing the current control, and 
        /// that the device is not lost. Returns an error string if the device 
        /// could not be reset. 
        /// </summary> 
        /// <returns>An error string if the device could not be reset.</returns> 
        private string HandleDeviceReset() 
        { 
            bool deviceNeedsReset = false
 
            switch (this.GraphicsDevice.GraphicsDeviceStatus) 
            { 
                case GraphicsDeviceStatus.Lost: 
                    // If the graphics device is lost, we cannot use it at all. 
                    return "Graphics device lost"
                case GraphicsDeviceStatus.NotReset: 
                    // If device is in the not-reset state, we should try to reset it. 
                    deviceNeedsReset = true
                    break
                default
                    // If the device state is ok, check whether it is big enough. 
                    PresentationParameters pp = this.GraphicsDevice.PresentationParameters; 
                    deviceNeedsReset = (this.ClientWidth > pp.BackBufferWidth) || (this.ClientHeight > pp.BackBufferHeight); 
                    break
            } 
 
            // Do we need to reset the device? 
            if (deviceNeedsReset) 
            { 
                try 
                { 
                    this.graphics.ResetDevice(this.ClientWidth, this.ClientHeight); 
                    this.renderTarget = new RenderTarget2D(this.graphics.GraphicsDevice, this.ClientWidth, this.ClientHeight, 1, SurfaceFormat.Color); 
                } 
                catch (Exception e) 
                { 
                    return "Graphics device reset failed\n\n" + e; 
                } 
            } 
 
            return null
        } 
 
        /// <summary> 
        /// Initializes the graphics device and render target. 
        /// </summary> 
        private void InitializeGraphics() 
        { 
            WindowInteropHelper wih = new WindowInteropHelper(this); 
 
            this.Services = new ServiceContainer(); 
            this.ContentManager = new ContentManager(this.Services, "Content"); 
 
            this.graphics = GraphicsDeviceService.AddRef(wih.Handle, this.ClientWidth, this.ClientHeight); 
            this.renderTarget = new RenderTarget2D(this.graphics.GraphicsDevice, this.ClientWidth, this.ClientHeight, 1, SurfaceFormat.Color); 
 
            // Register the service, so components like ContentManager can find it. 
            this.Services.AddService<IGraphicsDeviceService>(this.graphics); 
 
            // Set XNA mouse input to be relative to this window rather than the desktop 
            Mouse.WindowHandle = wih.Handle; 
 
            this.d3dImage.Lock(); 
            this.d3dImage.SetBackBuffer(D3DResourceType.IDirect3DSurface9, this.GetSurface(this.renderTarget)); 
            this.d3dImage.Unlock(); 
 
            CompositionTarget.Rendering += this.OnRendering; 
 
            this.Background = new ImageBrush(this.d3dImage); 
 
            this.Initialize(); 
        } 
 
        /// <summary> 
        /// Gets the surface pointer of a render target. 
        /// </summary> 
        /// <param name="renderTarget">The render target to get the surface pointer of.</param> 
        /// <returns>See summary.</returns> 
        private unsafe IntPtr GetSurface(RenderTarget renderTarget) 
        { 
            return new IntPtr(Pointer.Unbox(typeof(RenderTarget).GetField("pRenderTargetSurface", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(renderTarget))); 
        } 
    } 
 

Kane and Lynch Dead Men USA XBOX360-PROTOCOL (-1S/-1L)

January 31, 2009 by admin · Comment
Filed under: Xbox360 News 

REGISTRATIONS are INVITE ONLY at www.thetorrentsource.org
However inactive acconts are purged all the time. Stop in sometime, we may have an opening for YOU .

Tired of public trackers full of fake torrents/malware?

Want faster speeds, from members who share?

Spending hours downloading a torrent, to find that there are no seeders!

Tired of people that “Hit & Run” destroying the whole P2P process!

Come and join us at www.TheTorrentSource.org !

TTS is a new Private Torrent Site, with emphasis on Scene Release’s, and uploaders whom are more than happy to fill requests for instant access to TV episodes, Scene Releases, they can!

We are an amazing new site that is growing very quickly. We specialize in almost instant releases from the scene, including a variety of Games, Movies, TV, Apps,

plus all of your favorite requests and releases.

We have several dedicated 100mbit/1Gbit seedboxes, a knowlegeable and friendly support staff available in irc 24/7, and a whole crew of uploaders with scene access, and seedbox access.

Other things available to our members:

Faster overall download speeds, as our uploaders either have access to a seedbox, or have a minimum 1MB Upload Connection

Idle IRC credit (15 mb upload for every 15 minutes that you idle in our irc channel, which sums up to over 1GB upload every 72hrs!)

Occasional free leech events

New Forums, which are both informative, interactive, and entertaining!

Seeding bonus (even when no one is leeching, you receive credit for being available to seed)

Seeding shells are available for VIP members at no charge!

Registrations are CLOSED,

If you Want to be part of our site at TheTorrentSource.org

You are welcome to stop by our IRC channel,irc.thetorrentsource.org and join #help

If Lucky then you can join us at the link below:)

Use this link: I need faster downloads.

See you at TTS!

Don’t forget to join our IRC network after registering your free account, and meet other members from TheTorrentSource.org, we look forward to meeting you!

Our irc is: irc.thetorrentsource.org port 6667 (+6697 for SSL)

A Better Tomorrow (DVD) newly tagged "blu-ray"

January 31, 2009 by admin · Comment
Filed under: Xbox360 News 
A Better Tomorrow

A Better Tomorrow (DVD)
By Leslie Cheung

27 used and new from $10.49
Customer Rating: 1eef9_stars-4-0._V47081936_ A Better Tomorrow (DVD) newly tagged "blu-ray"

First tagged “blu-ray” by Stefanie Irani
Customer tags: john woo(4), excellent chinese movies(4), asian action(3), brotherhood(2), action(2), betrayal(2), criterion collection, buddy film, adventure, detectives, china, blu-ray

Three Complete Novels: Patriot Games, Clear and Present Danger, The Sum of All Fears (Hardcover) newly tagged "blu-ray"

January 31, 2009 by admin · Comment
Filed under: Xbox360 News 
Patriot Games, Clear and Present Danger, The Sum of All Fears

Three Complete Novels: Patriot Games, Clear and Present Danger, The Sum of All Fears (Hardcover)
By Tom Clancy

42 used and new from $0.49
Customer Rating: 2fa8e_stars-5-0._V47081849_ Three Complete Novels: Patriot Games, Clear and Present Danger, The Sum of All Fears (Hardcover) newly tagged "blu-ray"

First tagged “blu-ray” by Stefanie Irani
Customer tags: tom clancy(6), military thriller(3), jack ryan(3), technothrillers(2), suspense(2), blu-ray

Depeche Mode - Devotional (DVD) newly tagged "blu-ray"

January 31, 2009 by admin · Comment
Filed under: Xbox360 News 
Depeche Mode - Devotional

Depeche Mode - Devotional (DVD)
By David Gahan

Buy new: $22.49
33 used and new from $12.25
Customer Rating: 20fea_stars-4-5._V47081564_ Depeche Mode - Devotional (DVD) newly tagged "blu-ray"

First tagged “blu-ray” by Stefanie Irani
Customer tags: concert dvd(7), depeche mode(3), dvd(3), anton corbijn(2), devotional(2), alternative(2), dm, concerts, 93, dm tour, devotion, blu-ray

Diapers, Depends, Ed McMahon And Air Wars!

January 31, 2009 by admin · Comment
Filed under: Xbox360 News 
Posted By: Jane Wells

524b7_liquidity.thumb Diapers, Depends, Ed McMahon And Air Wars!

Word for the day: Liquidity. Definition: When you look at your investments and wet your pants. And, everything you need to know to make chit-chat during this weekend’s Super Bowl parties.   151d0_more-bullet Diapers, Depends, Ed McMahon And Air Wars! Read More

Lego Indiana Jones Xbox360 RF[www.ilovetorrents.com] (1S/15L)

January 31, 2009 by admin · Comment
Filed under: Xbox360 News 

*******************************************************************************
Lego Indiana Jones.Xbox360.RF
*******************************************************************************

——————————————————————————-
General Information
——————————————————————————-
Type……………..: Game
Platform………….: Xbox 360
Part Size…………: 100,000,000 bytes
Number of Parts……: 78
Compression Format…: RAR
File Validation……: SFV
Image Format………: .iso+.mds
Image Created with…: Imgburn
Burn Tested……….: Yes

——————————————————————————-
Post Information
——————————————————————————-
Posted by…………: gballer22
Posted on…………: 1/30/2009

——————————————————————————-
Release Notes
——————————————————————————-
Lego Indiana Jones.Xbox360.RF

Enjoy this Region Free Copy..gballer22

Published by: LucasArts
Developed by: Traveller’s Tales
Release Date: June 3, 2008
Genre: Adventure

Once again rendering a beloved George Lucas creation in LEGOs, LEGO Indiana
Jones features the intrepid explorer in an epic adventure based on the film
series. Developed by the same team that created the LEGO Star Wars series, LEGO
Indiana Jones presents a tongue-in-cheek take on the first three cinematic
adventures of pop culture’s most iconic archaeologist, including Indiana Jones
and the Raiders of the Lost Ark, Indiana Jones and the Temple of Doom and
Indiana Jones and the Last Crusade.

Genre: Adventure

Link: http://xbox360.ign.com/objects/953/953315.html

Next Page »