How do I draw video frames onto the screen permanently using XNA?

Posted by izb on Game Development See other posts from Game Development or by izb
Published on 2011-02-10T07:07:46Z Indexed on 2011/02/10 7:34 UTC
Read the original article Hit count: 303

Filed under:
|
|

I have an app that plays back a video and draws the video onto the screen at a moving position. When I run the app, the video moves around the screen as it plays. Here is my Draw method...

    protected override void Draw(GameTime gameTime)
    {
        Texture2D videoTexture = null;

        if (player.State != MediaState.Stopped)
            videoTexture = player.GetTexture();

        if (videoTexture != null)
        {
            spriteBatch.Begin();
            spriteBatch.Draw(
                    videoTexture,
                    new Rectangle(x++, 0, 400, 300),  /* Where X is a class member */
                    Color.White);
            spriteBatch.End();
        }

        base.Draw(gameTime);
    }

The video moves horizontally acros the screen. This is not exactly as I expected since I have no lines of code that clear the screen. My question is why does it not leave a trail behind?

Also, how would I make it leave a trail behind?

© Game Development or respective owner

Related posts about XNA

Related posts about Windows