GuiTheoraCtrl - TGB
by Norv Brooks · in Technical Issues · 02/23/2009 (6:40 am) · 16 replies
In setting up a GuiTheoraCtrl to play a video in TGB I'm having difficulty in finding any documentation on looping the video. In setting up the gui I see "done = "0"; "stopOnSleep = "1" & "loop = "1" which I'm assuming are booleans. I don't know what values they should be set to. Anybody had experience with looping a Theora video?
#2
//--- OBJECT WRITE BEGIN ---
new GuiFadeinBitmapCtrl(StartupGui) {
Profile = "GuiInputCtrlProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "0 0";
Extent = "800 600";
MinExtent = "8 8";
Visible = "1";
bitmap = "";
wrap = "0";
fadeinTime = "125";
waitTime = "10000";
fadeoutTime = "125";
done = "1";
helpTag = "0";
new GuiTheoraCtrl(openingLogo) {
Profile = "GuiDefaultProfile";
HorizSizing = "relative";
VertSizing = "relative";
position = "0 0";
Extent = "800 600";
MinExtent = "8 2";
Visible = "1";
theoraFile = "./Intro.avi.ogg";
done = "0";
stopOnSleep = "1";
backgroundColor = "0 0 0 0";
};
};
//--- OBJECT WRITE END ---
Since it's a child of StartUp.gui the Theora control is automatically called when "Canvas.setContent( StartupGui );" is called in main.cs
(see next post)
02/26/2009 (7:47 am)
I'm using GuiTheoraCtrl in 2 place currently in my game. I use it as an opening title and the following code is put in a gui file called StartUpGui.gui//--- OBJECT WRITE BEGIN ---
new GuiFadeinBitmapCtrl(StartupGui) {
Profile = "GuiInputCtrlProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "0 0";
Extent = "800 600";
MinExtent = "8 8";
Visible = "1";
bitmap = "";
wrap = "0";
fadeinTime = "125";
waitTime = "10000";
fadeoutTime = "125";
done = "1";
helpTag = "0";
new GuiTheoraCtrl(openingLogo) {
Profile = "GuiDefaultProfile";
HorizSizing = "relative";
VertSizing = "relative";
position = "0 0";
Extent = "800 600";
MinExtent = "8 2";
Visible = "1";
theoraFile = "./Intro.avi.ogg";
done = "0";
stopOnSleep = "1";
backgroundColor = "0 0 0 0";
};
};
//--- OBJECT WRITE END ---
Since it's a child of StartUp.gui the Theora control is automatically called when "Canvas.setContent( StartupGui );" is called in main.cs
(see next post)
#3
//--- OBJECT WRITE BEGIN ---
new GuiChunkedBitmapCtrl(wfAlertBriefingGui) {
Profile = "GuiDefaultProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "0 0";
Extent = "800 600";
MinExtent = "8 2";
Visible = "1";
bitmap = "./wfAlertBG.png";
useVariable = "0";
tile = "0";
new GuiTheoraCtrl(wfAlertBriefingVideo) {
Profile = "GuiDefaultProfile";
HorizSizing = "relative";
VertSizing = "relative";
position = "190 94";
Extent = "240 180";
MinExtent = "8 2";
Visible = "1";
theoraFile = "./media/SWL1_01.ogg";
done = "0";
stopOnSleep = "1";
backgroundColor = "0 0 0 0";
loop = "1";
};
(concluded in next post)
02/26/2009 (7:48 am)
The other use of the GuiTheoraCtrl is by a random choice of wildfire assignments. Setting up the control is done in a file called wfAlertBriefingGui.gui//--- OBJECT WRITE BEGIN ---
new GuiChunkedBitmapCtrl(wfAlertBriefingGui) {
Profile = "GuiDefaultProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "0 0";
Extent = "800 600";
MinExtent = "8 2";
Visible = "1";
bitmap = "./wfAlertBG.png";
useVariable = "0";
tile = "0";
new GuiTheoraCtrl(wfAlertBriefingVideo) {
Profile = "GuiDefaultProfile";
HorizSizing = "relative";
VertSizing = "relative";
position = "190 94";
Extent = "240 180";
MinExtent = "8 2";
Visible = "1";
theoraFile = "./media/SWL1_01.ogg";
done = "0";
stopOnSleep = "1";
backgroundColor = "0 0 0 0";
loop = "1";
};
(concluded in next post)
#4
function Wildfires::displayWFAlerts()
{
// sound klaxon
$klaxonSnd = alxPlay(klaxonAudio);
// display WFBriefing gui
canvas.pushDialog(wfAlertBriefingGui);
wfAlertBriefing();
}
//---------------------------------------------
function wfAlertBriefing(){
wfAlertBriefingVideo.mloop = "1";
if(strcmp($pref::Player::campaignRegion,"SW")==0){
setSJTheorafileSW();
canvas.popDialog(campHUB_SWGui);
}
else{
setSJTheorafileNW();
canvas.popDialog(campHUB_NWGui);
}
turnOnWFAlertBriefing();
Canvas.pushDialog(wfAlertBriefingGui);
}
(unfortunately did not fit in this post - see next post)
02/26/2009 (7:51 am)
Again it's a child of the wfAlertBriefingGui which is called after a varible is set up for which wildfire Theora control is to be used.function Wildfires::displayWFAlerts()
{
// sound klaxon
$klaxonSnd = alxPlay(klaxonAudio);
// display WFBriefing gui
canvas.pushDialog(wfAlertBriefingGui);
wfAlertBriefing();
}
//---------------------------------------------
function wfAlertBriefing(){
wfAlertBriefingVideo.mloop = "1";
if(strcmp($pref::Player::campaignRegion,"SW")==0){
setSJTheorafileSW();
canvas.popDialog(campHUB_SWGui);
}
else{
setSJTheorafileNW();
canvas.popDialog(campHUB_NWGui);
}
turnOnWFAlertBriefing();
Canvas.pushDialog(wfAlertBriefingGui);
}
(unfortunately did not fit in this post - see next post)
#5
{
switch(Wildfires.currentWildfireID)
{
case 1 :
wfAlertBriefingVideo.setFile("SJGame/gameScripts/
client/clientGui/media/SWL1_01.ogg");
wfAlertBriefIncidentTitle.setText("c9Chilao Flat Incident");
wfAlertBriefSituationText.setText("c9Isolated fire with
potential of becomingnc9a rapid moving fire.");
wfAlertBriefObjectiveText.setText("c9Stop fire from
reaching any tent structurenc9in the Chilao Flat
campground.");
wfAlertBriefSupportText.setText("c9Fixed Wing Tanker.");
wfAlertBriefAvailableText.setText("c9Delayed Arrival.");
wfAlertBriefCostsText.setText("c92 PR pts Fixed
Wingnc9Tanker service.");
echo("inside case 1");
case 2 :
wfAlertBriefingVideo.setFile("SJGame/gameScripts/client/
clientGui/media/SWL1_02.ogg");
wfAlertBriefIncidentTitle.setText("c9Dunsmuir Mobile
Park Incident");
wfAlertBriefSituationText.setText("c9Moderate moving
fire with one legnc9moving towards a mobile home park.");
wfAlertBriefObjectiveText.setText("c9Stop fire from
reaching any of thenc9mobile homes.");
wfAlertBriefSupportText.setText("c9Helicopter and Fixed
Wing Tanker.");
wfAlertBriefAvailableText.setText("c9Delayed Arrival.");
wfAlertBriefCostsText.setText("c91 PR pt Helicopter
servicenc92 PR pts Fixed Wingnc9Tanker service.");
echo("inside case 2");
case 3 :
A random value is given to "Wildfires.currentWildfireID" and then at a random time a call to "displayWFAlerts()" is made which then triggers the displaying of the parent gui & the Theora control within.
This is what works for me and I hope will help you.
Norv
02/26/2009 (7:53 am)
function setSJTheorafileSW(){
switch(Wildfires.currentWildfireID)
{
case 1 :
wfAlertBriefingVideo.setFile("SJGame/gameScripts/
client/clientGui/media/SWL1_01.ogg");
wfAlertBriefIncidentTitle.setText("c9Chilao Flat Incident");
wfAlertBriefSituationText.setText("c9Isolated fire with
potential of becomingnc9a rapid moving fire.");
wfAlertBriefObjectiveText.setText("c9Stop fire from
reaching any tent structurenc9in the Chilao Flat
campground.");
wfAlertBriefSupportText.setText("c9Fixed Wing Tanker.");
wfAlertBriefAvailableText.setText("c9Delayed Arrival.");
wfAlertBriefCostsText.setText("c92 PR pts Fixed
Wingnc9Tanker service.");
echo("inside case 1");
case 2 :
wfAlertBriefingVideo.setFile("SJGame/gameScripts/client/
clientGui/media/SWL1_02.ogg");
wfAlertBriefIncidentTitle.setText("c9Dunsmuir Mobile
Park Incident");
wfAlertBriefSituationText.setText("c9Moderate moving
fire with one legnc9moving towards a mobile home park.");
wfAlertBriefObjectiveText.setText("c9Stop fire from
reaching any of thenc9mobile homes.");
wfAlertBriefSupportText.setText("c9Helicopter and Fixed
Wing Tanker.");
wfAlertBriefAvailableText.setText("c9Delayed Arrival.");
wfAlertBriefCostsText.setText("c91 PR pt Helicopter
servicenc92 PR pts Fixed Wingnc9Tanker service.");
echo("inside case 2");
case 3 :
A random value is given to "Wildfires.currentWildfireID" and then at a random time a call to "displayWFAlerts()" is made which then triggers the displaying of the parent gui & the Theora control within.
This is what works for me and I hope will help you.
Norv
#6
The last three threads were too much for me to attempt this early on, BUT your first script FINALLY did the trick after all my searching.
Thank you much for that.
1) I got the first script to work with the StartUp.gui method, but I'm trying to figure out how and where to put a
I'd rename the StartUp.gui "Level1.gui" & "Level2.gui" with the two different files referenced, but I don't know if I need to put it in gameScripts or somewhere else.
And if I find the right spot, is the following function correct for Level1?
with the script name for the project>edit of Level1 written as "Level1"
2) For my ogm encoder I'm using HandBreak, do you recommend any other free software?
[I put up a post on the other three forums I post questions about ogg/theora and mentioned you were looking for suggestions on how to loop, so hopefully someone will respond]
02/26/2009 (10:20 pm)
Wow!The last three threads were too much for me to attempt this early on, BUT your first script FINALLY did the trick after all my searching.
Thank you much for that.
1) I got the first script to work with the StartUp.gui method, but I'm trying to figure out how and where to put a
exec("~/gui/StartUp.gui") for two different cut scenes in two different levels.I'd rename the StartUp.gui "Level1.gui" & "Level2.gui" with the two different files referenced, but I don't know if I need to put it in gameScripts or somewhere else.
And if I find the right spot, is the following function correct for Level1?
function Level1::onLevelLoaded(%this, %scenegraph)
with the script name for the project>edit of Level1 written as "Level1"
2) For my ogm encoder I'm using HandBreak, do you recommend any other free software?
[I put up a post on the other three forums I post questions about ogg/theora and mentioned you were looking for suggestions on how to loop, so hopefully someone will respond]
#7
i am playing a video at the start of game
i want to load my new level after video completed.
03/09/2009 (5:08 am)
some buddy help me out i am playing a video at the start of game
i want to load my new level after video completed.
#8
I've successfully used your code to get a video playing in a scene, but I can't seem to figure out how to get it to unload/delete when it's done and go to the next level.
Could you tell how to close out the theora video?
Here's the code I've got so far:
==============GUI=====================
=============onLevelLoaded function====================
=================================
03/11/2009 (8:20 pm)
Norv,I've successfully used your code to get a video playing in a scene, but I can't seem to figure out how to get it to unload/delete when it's done and go to the next level.
Could you tell how to close out the theora video?
Here's the code I've got so far:
==============GUI=====================
new GuiTheoraCtrl(MyVideo) {
profile = "GuiDefaultProfile";
horizSizing = "relative";
vertSizing = "relative";
position = "0 0";
extent = "720 486";
minExtent = "8 2";
visible = "1";
done = "0";
stopOnSleep = "1";
backgroundColor = "0 0 0 255";
}; =============onLevelLoaded function====================
function MyVideoBehavior::onLevelLoaded(%this, %scenegraph)
{
exec("~/gui/THEORATEST.gui");
if ($playingVideo != 1)
{
canvas.getContent().add(MyVideo);
Canvas.hideCursor();
MyVideo.setFile("./game/data/images/TEST3.ogm");
}
else
{
Canvas.showCursor();
MyVideo.stop();
canvas.getContent().remove(MyVideo);
Schedule(10, 0, loadLevel, expandFilename("~/data/levels/level1.t2d"));
sceneWindow2d.endlevel();
}
} =================================
#9
Norv
03/11/2009 (10:37 pm)
Path - you're using some commands that I am not familiar with. I'm not saying they're wrong. I'm just not familiar with "canvas.getContent().add(MyVideo);" and "canvas.getContent().remove(MyVideo);" As I said in my original post that finding documentation on the GuiTheoraCtrl is difficult. I don't think I know enough about it to help you. I guess my only suggestion is make sure the two commands that you're using are being used correctly.Norv
#10
Thanks for the help you've been able to provide up to this point. You're code has gotten me half way there.
03/12/2009 (7:24 am)
Norv,Thanks for the help you've been able to provide up to this point. You're code has gotten me half way there.
#11
MyVideo.stop();
///===== make the gui cntrl not visible setting visible to 0 here also might do the trick
canvas.remove(MyVideo);
//change >>>>> Schedule(2000, 0, loadLevel, expandFilename("~/data/levels/level1.t2d"));
//==> commment this out to test u are calling it after you schedule to load your main level. // sceneWindow2d.endlevel();
this is off the top of my head but should work. and you shouldnt need the expandfilename. just the realative path to your level. let me know if this helps if not ill set up a video and post the code.
03/12/2009 (8:50 am)
Canvas.showCursor();MyVideo.stop();
///===== make the gui cntrl not visible setting visible to 0 here also might do the trick
canvas.remove(MyVideo);
//change >>>>> Schedule(2000, 0, loadLevel, expandFilename("~/data/levels/level1.t2d"));
//==> commment this out to test u are calling it after you schedule to load your main level. // sceneWindow2d.endlevel();
this is off the top of my head but should work. and you shouldnt need the expandfilename. just the realative path to your level. let me know if this helps if not ill set up a video and post the code.
#12
03/12/2009 (8:53 am)
oh AND add in some echos and watch the console while it is doing its thing, that always helps..... like echo("enter Myfunctionnamehere"); "doing this now" etc
#13
Thanks! I'll definitely try this when I get to my cpu.
I'm sure this will do the trick, but it would be great if you went ahead and setup a video and posted the code.
Probably as a new thread which you could submit as a resource to cover creating/scripting Theora to add it to a scene and then remove it when it's done playing and load the next scene.
This is something that's desperately needed on the forum. This is too important a component of a game that has gone without significant technical guidance.
03/12/2009 (11:18 am)
Michael,Thanks! I'll definitely try this when I get to my cpu.
I'm sure this will do the trick, but it would be great if you went ahead and setup a video and posted the code.
Probably as a new thread which you could submit as a resource to cover creating/scripting Theora to add it to a scene and then remove it when it's done playing and load the next scene.
This is something that's desperately needed on the forum. This is too important a component of a game that has gone without significant technical guidance.
#14
03/12/2009 (2:14 pm)
working on it now, for my video productions i use a combo of poser, 3ds, flash, and adobe after effects. sound is sony and fruit loops. im goin to use your free converter. so basically any avi to ogg will work with my example expect it up later tonight or tomorrow morning.
#16
03/12/2009 (10:25 pm)
resource is up check it out.
Torque Owner Path
I'm assuming your using the TDN script for GuiTheoraCtrl. Where does the following code actually go? (What Path, Saved as what file?):
new GuiTheoraCtrl(MyVideo) {
profile = "GuiDefaultProfile";
horizSizing = "relative";
vertSizing = "relative";
position = "40 25";
extent = "320 240";
minExtent = "8 2";
visible = "1";
done = "0";
stopOnSleep = "1";
backgroundColor = "0 0 0 255";
};
For the script call:
MyVideo.setFile("starter.fps/data/video/menuvideo.ogg");
Do I simply reference it in normal scripts like say a MouseDown function in a behavior?