How do I draw video frames onto the screen permanently using XNA?
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 videoT开发者_开发百科exture = 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?
I think the video moves horizontal because in the new Rectangle( declaration u have "x++" and is incrementing over the draws cicles the position on x os the rectangle. to make trails behind or dont clean previus draws u need to implement the back buffer whith render targets, to make a copy of the previus buffer and draw over it again. that how i would try for.
精彩评论