Game Development Community

Load a video in T2D

by Matthew Shrewsbury · in General Discussion · 04/02/2011 (6:43 am) · 3 replies

Hello everyone,
I'm trying to figure out how to load a video clip into my torque 2D project. Does anyone here know who to accomplish this? Here is the logic flow for what I'm trying to do in regards to the video.

1. Start game
2. Intro.t2d plays 5 sec .MOV file
3. After video has played move to next .t2d screen

I'm having a hard time figuring out how to get a video to play.

#1
04/02/2011 (7:14 am)
Look into playing ogg theora movies.

There was support for it in the past with TGE, etc. It should still be in T2D.
#2
04/07/2011 (5:23 pm)
Hi Matthew, Chris is correct: you can play theora files using the GuiTheoraCtrl component.

Create a gui and put inside it something like this:

new GuiTheoraCtrl(myMovie) {
         canSaveDynamicFields = "0";
         isContainer = "0";
         Profile = "GuiDefaultProfile";
         HorizSizing = "relative";
         VertSizing = "relative";
         Position = "0 0";
         Extent = "1024 768";
         MinExtent = "8 2";
         canSave = "1";
         Visible = "1";
         hovertime = "1000";
         stopOnSleep = true;
         done = false;
      };

Now you can use commands like these to set and start your movie:

myMovie.setFile(expandFilename("~/data/video/intro.ogv"), false);
myMovie.play();

You can find more info about ogv playing in previous forum posts like this.
#3
04/10/2011 (9:16 am)
I have one other question about this. After the video plays what is the best way to delete the current .t2d scene and load another one?


video.t2d (Play video) -> title.t2d ( main menu of the game)