This project is read-only.

Render 2d Texture

Nov 11, 2011 at 12:54 AM

Hi, I would like to render 2d texture on my screen (not associate with the marker) but I can't see it:

 

        public void Draw(SpriteBatch spriteBatch)
        {
            // If ground marker array is detected
            if (groundMarker.MarkerFound)
            {
                transNodeRock.Translation = bulletPosition;
                transNodeRock.Rotation = bulletRotation;

                
                //Draw the negative space for the health bar
                spriteBatch.Draw(mHealthBar, new Rectangle(game.Window.ClientBounds.Width / 2 - mHealthBar.Width / 2,

                     30, mHealthBar.Width, 44), new Rectangle(0, 45, mHealthBar.Width, 44), Color.Gray);


                //Draw the current health level based on the current Health
                spriteBatch.Draw(mHealthBar, new Rectangle(game.Window.ClientBounds.Width / 2 - mHealthBar.Width / 2,
                     30, (int)(mHealthBar.Width * ((double)mCurrentHealth / 100)), 44),
                     new Rectangle(0, 45, mHealthBar.Width, 44), Color.Red);

                //Draw the box around the health bar
                spriteBatch.Draw(mHealthBar, new Rectangle(game.Window.ClientBounds.Width / 2 - mHealthBar.Width / 2,

                    30, mHealthBar.Width, 44), new Rectangle(0, 0, mHealthBar.Width, 44), Color.White);
            }


           
        }

I don't know if we can do that with UI2DRenderer...

Thanks

Nov 11, 2011 at 12:57 AM

Oh haha, got it in 5 second.. just call that code, after the Base.Draw