GUI elements on top of video?

Started by Darjanator, Sun 30/06/2019 01:43:49

Previous topic - Next topic

Crimson Wizard

Quote from: Darjanator on Tue 09/07/2019 14:20:41
Using video with this plugin, it is non-blocking. I wouldn't have this issue if PlayVideo had a zorder property so I could put it below my inventory GUI. :D

Unfortunately PlayVideo cannot have a Z order property because it simply renders on screen disregarding any game objects.
The aproximate solution would be to provide render target for the video, such as DrawingSurface or DynamicSprite, which may then be assigned to any game object with Z property, but that's a matter of future development.

Quote from: Darjanator on Tue 09/07/2019 14:20:41
It is a global thing, because I'm calling the function from a dialog and I haven't been able to figure out how to call a function from a room or inject the theora plugin straight into the dialog.

There's a function called CallRoomScript which calls a predefined function in room if it exists, passing 1 integer data. You could use this to signal some simple events, like video ending, to let room readjust itself.

Darjanator

Quote from: Crimson Wizard on Tue 09/07/2019 14:40:38There's a function called CallRoomScript which calls a predefined function in room if it exists, passing 1 integer data. You could use this to signal some simple events, like video ending, to let room readjust itself.

Ooh! Great, I got it to play via the room script and now I sorta hacked it by starting a timer with the number of frames that the video plays for and putting the object.visible into the room_repexec(). Doing this in global was an option, but I plan on having a lot more than 20 videos in the whole game, but far less than 20 per room. The timers do reset for each room, right?

Crimson Wizard

Quote from: Darjanator on Tue 09/07/2019 15:00:41The timers do reset for each room, right?

No, builtin AGS timers are all in same "namespace", they don't reset on their own and they share same ID numbers throughout the game.

I wrote a Timer module to counter these problems some time ago (people were suggesting to replace builtin timers with similar thing, but it's was not done yet):
https://www.adventuregamestudio.co.uk/forums/index.php?topic=55545.0

Vincent

#23
Quote from: Darjanator on Tue 09/07/2019 13:22:35
It seems to me that if (video.ended == true) has to be the repeatedly_execute(), but how do I specify which video is playing there?

I showed you how to do that before.

Darjanator

Quote from: Vincent on Tue 09/07/2019 20:34:22
Quote from: Darjanator on Tue 09/07/2019 13:22:35
It seems to me that if (video.ended == true) has to be the repeatedly_execute(), but how do I specify which video is playing there?

I showed you how to do that before.
Oh, crap, you did...

Now I have to figure out which is the more elegant solution. A timer that countsdown the frames has less code, but knowing which video has ended is less of a hassle.

Crimson Wizard

#25
Quote from: Darjanator on Tue 09/07/2019 22:17:03
Now I have to figure out which is the more elegant solution. A timer that countsdown the frames has less code, but knowing which video has ended is less of a hassle.

TBH I would not be relying on timer in this case, if there's a desync between timer and plugin's video playback for any reason, there will be mistakes. If video plugin can reliably report when playback ends that sounds like a working solution already.

Also, maybe I missed something, but it was not clear to me why the timer is alternative to knowing video ID? Is not knowing video ID useful in any case?

Darjanator

Quote from: Crimson Wizard on Tue 09/07/2019 22:41:20
Quote from: Darjanator on Tue 09/07/2019 22:17:03
Now I have to figure out which is the more elegant solution. A timer that countsdown the frames has less code, but knowing which video has ended is less of a hassle.

TBH I would not be relying on timer in this case, if there's a desync between timer and plugin's video playback for any reason, there will be mistakes. If video plugin can reliably report when playback ends that sounds like a working solution already.

Also, maybe I missed something, but it was not clear to me why the timer is alternative to knowing video ID? Is not knowing video ID useful in any case?

No, of course it is, I just forgot about it. That post came about when I had much less experience with programming and AGS and I must have just glossed over it looking a bit like: :confused:

But I looked at it again now and I think I can make it work. I'll get on it tomorrow.

SMF spam blocked by CleanTalk