Theora control...no click event?
by Aaron Moore · in Torque Game Engine · 06/12/2007 (10:26 am) · 4 replies
function myTheoraVideo::click()
{
...dostuff....
}This should work, should it not? It works for the fade-in bitmap control, and they derive from the same base class. So why is the function not being called? Even with nothing but an echo in the function, I get nothing.
I'm trying to use it for a splash. Instead of waiting till the video is done, it triggers the "done" bool the second the video loads, so I can't use "done" and have it hardcoded to change screens with a time (which I don't like). It works to play the video and move the player to the main menu, but the user can't click through it because it's not capturing the event.
Any clues?
About the author
#2
06/14/2007 (7:44 am)
Did you figure out your audio issue?
#3
Dumb mistake :)
Choppy video is still a problem. I've been perusing the theora code within the engine and noticing it looks nowhere near as complex as the decoding done in libtheora.
06/14/2007 (8:27 am)
Yeah, the audio is actually there...just really quiet. The audio is turned up in all my programs, and the speakers themselves are turned down...since it wasn't turned up higher than average in torque, I just wasn't hearing it.Dumb mistake :)
Choppy video is still a problem. I've been perusing the theora code within the engine and noticing it looks nowhere near as complex as the decoding done in libtheora.
#4
Basically, don't render the first bit of the movie, render a black rectangle instead.
I don't like it, but it works while I'm doing more important stuff like trying to figure out how to get the video not to skip.
I'm pretty sure it's not a problem with my comp...1 gig of Ram, a 3x 160 gig RAID stripe hard drive, a nVidia 7600GT running all the latest drivers. You'd think a machine like this could handle an 8 second video. Well, it does, just not in torque.
06/14/2007 (10:15 am)
Got an ugly hack that eliminates the big white flash at the beginning of the movie.void GuiTheoraCtrl::onRender(Point2I offset, const RectI &updateRect)
{
const RectI rect(offset, mBounds.extent);
if(mTheoraTexture.isReady() && mTheoraTexture.isPlaying() && mTheoraTexture.getCurrentTime() < .2f )
{
dglDrawRectFill(rect, mBackgroundColor); // black rect
}
else
{
if(mTheoraTexture.isReady() && mTheoraTexture.isPlaying())
{
mDone = false;
mTheoraTexture.refresh();
dglClearBitmapModulation();
dglDrawBitmapStretch(mTheoraTexture, rect);
}
else
{
if(mTheoraTexture.isReady())
{
mDone = true;
dglDrawRectFill(rect, mBackgroundColor); // black rect
}
}
}
renderChildControls(offset, updateRect);
}Basically, don't render the first bit of the movie, render a black rectangle instead.
I don't like it, but it works while I'm doing more important stuff like trying to figure out how to get the video not to skip.
I'm pretty sure it's not a problem with my comp...1 gig of Ram, a 3x 160 gig RAID stripe hard drive, a nVidia 7600GT running all the latest drivers. You'd think a machine like this could handle an 8 second video. Well, it does, just not in torque.
Torque Owner Aaron Moore
void GuiTheoraCtrl::onMouseDown(const GuiEvent &) { Con::executef(this, 1, "click"); }In addition, it was triggering done at the beginning of the movie. This seemed to be when the movie was loaded, but had not yet begun playback (race condition?). I was able to fix it by making the following change:
void GuiTheoraCtrl::onRender(Point2I offset, const RectI &updateRect) { const RectI rect(offset, mBounds.extent); if(mTheoraTexture.isReady() && mTheoraTexture.isPlaying()) { mDone = false; // <-- Aaron added this to fix marking the video as done prematurely mTheoraTexture.refresh(); dglClearBitmapModulation(); dglDrawBitmapStretch(mTheoraTexture, rect); } else { if(mTheoraTexture.isReady()) mDone = true; dglDrawRectFill(rect, mBackgroundColor); // black rect } renderChildControls(offset, updateRect); }Now to figure out why there's no audio and the video is choppy (only in game, works fine in all the other players).