Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (TipmyPip, AndrewAMD), 1,151 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
how to show a series of pictures like a video stream? #416092
01/28/13 00:15
01/28/13 00:15
Joined: Jul 2011
Posts: 69
P
pjotr987 Offline OP
Junior Member
pjotr987  Offline OP
Junior Member
P

Joined: Jul 2011
Posts: 69
Hi people,
I face a problem now, that i have a sries of pictures. That ones i want to show on the screen like a video.
Has anyone a good sugestion how to solve it?

Thanks in advance

Re: how to show a series of pictures like a video stream? [Re: pjotr987] #416095
01/28/13 00:23
01/28/13 00:23
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
just play it as a video with media_play
or use an array with all pictures as a BMAP and then loop through it with a loop and wait. every cycle put the bitmap on a panel


Visit my site: www.masterq32.de
Re: how to show a series of pictures like a video stream? [Re: MasterQ32] #416098
01/28/13 00:50
01/28/13 00:50
Joined: Jul 2011
Posts: 69
P
pjotr987 Offline OP
Junior Member
pjotr987  Offline OP
Junior Member
P

Joined: Jul 2011
Posts: 69
Hi masterq32,
Can u explain exactly how the second method works. A piece of demonsrating code would be great.

In any case thanks again

Re: how to show a series of pictures like a video stream? [Re: pjotr987] #416099
01/28/13 00:58
01/28/13 00:58
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
You can also put all the images in a row and use a panel with a window element in it. You can then change the picture displayed in the window by changing the x coordinate of the window.

http://www.conitec.net/beta/apanel-window.htm


Always learn from history, to be sure you make the same mistakes again...
Re: how to show a series of pictures like a video stream? [Re: pjotr987] #416197
01/28/13 23:10
01/28/13 23:10
Joined: Jul 2002
Posts: 3,208
Germany
Error014 Offline
Expert
Error014  Offline
Expert

Joined: Jul 2002
Posts: 3,208
Germany
Originally Posted By: pjotr987
Hi masterq32,
Can u explain exactly how the second method works. A piece of demonsrating code would be great.

In any case thanks again


So, you'll need an array of bmaps, right. Let's say you have 64 bitmaps:

Code:
BMAP* myanimmaps[64];



Well, you'll have to load them all, right? Assuming you don't want to spend months typing, you should name them all with a simple namescheme, such as "myanim0.bmp", "myanim1.bmp", etc. so we only have to put the number in there.

Then, we can load them, like this (put this in a function, such as your main-function)

Code:
STRING* tmpstr=str_create("#32");
for(i=0; i < 64; i++) {
//stitch the filename together
str_cpy(tmpstr,"myanim");
str_cat(tmpstr,str_for_int(NULL,i));
str_cat(tmpstr,".bmp");
myanimmaps[i] = bmap_create(tmpstr);
}



Sweet, so now you've got it all in memory. All that's left to do is to play it back.
Assuming you're animation is to be played back with 24 frames per second, then that means we have to wait 1/24 of a second after each frame, right? 1/24 = 0.04.
So here we go:

Code:
void playanimation() {
char i; //you'll need something bigger than char if you have more than 255 frames
for(i=0; i < 64; i++) {
//Draw the bmap - for instance, via:
draw_quad(myanimmaps[i],nullvector,NULL,NULL,NULL,NULL,100,0);
wait(-0.04); //check wait in the manual to learn why I pass a negative value here
}
}



And that's about it!

You can also use a panel to display it, and set the Panel's bmap-pointer to the actual frame (myanimmaps[i]), if you can't use draw_quad for some reason.


A last word on this - be aware that this way, all your frames are uncompressed in memory at all times. This might lead to an enormous increase in memory consumption. If it is an option, consider using the media_-instruction (and make your animation an actual movie), which streams the video, possibly improving that situation.
Of course, if its a short animation with few frames, you can do it this way.
Consider at least purging the bmaps if you don't need them, though (see bmap_purge in the manual to learn how to do this)


Perhaps this post will get me points for originality at least.

Check out Dungeon Deities! It's amazing and will make you happy, successful and almost certainly more attractive! It might be true!

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1