Saturday, June 13, 2009

Wilton Piano Cake Pan

Video playback XNA Game Studio 3.1 XNA

With the release of XNA GS 3.1 (Link HERE ) could not miss an example to test the implementation of video. As is quite simple (I admit, surprised me. I expected something more complex) do not need a video tutorial. So let's begin.

The first thing we do is create a new XNA project (NOTE, the 3.1 has to be. To download click HERE ). Well, once established we will declare the variables that we need to implement the video as seen in the image below.

image

VideoPlayer, this instance of the class will allow us to run, stop, pause, get a specific texture, etc.

Video, will allow us to load our video content. properties such as duration, frames per second, height, width, type of sound,.

and finally the texture that we use to obtain the video image to display.
Well, once we declared the variables VideoPlayer initialize and load the content. (TEST is the name of example, it would be replaced with the name of the video you want to load)

image

Una vez que hicimos esto, vamos a hacer la lógica que va a manejar la ejecución del video. Por ej.: cuando presionemos la tecla A que ejecute el video y cuando pulsemos la tecla SPACE se pare la ejecución.
Luego lo que tendríamos que hacer es verificar si se esta ejecutando el video. si es así, obtener la textura a mostrar.
Entonces el código quedaría así.

image

Como verán el código es bastante simple y no exige demasiado, solo plantear la lógica correcta.
Espero que haya helpful and to download the full code can download it HERE

0 comments:

Post a Comment