Game Development Community

dev|Pro Game Development Curriculum

guiAnimBitmapCtrl

by Bryan "daerid" Ross · 03/04/2003 (9:20 am) · 16 comments

Download Code File

Readme.txt:

[code]GuiAnimBitmapCtrl
==========================================
Instructions

About the author

Recent Blogs


#1
03/04/2003 (10:17 am)
Slick, Gui candy thank you!
#2
03/05/2003 (6:33 am)
Works great! Thanks - was just what I needed.
#3
03/06/2003 (8:07 am)
Although it works in a very straigthforward manner, I think that it would be useful to have some example files and scripts.

By the way, this is very cool buddy! =)
#4
03/09/2003 (9:44 am)
I have downloaded the script and compiled, free of error, however can you please provide some example files and scripts.
#5
05/01/2003 (3:26 pm)
Example Scripts would be greatly appreciated!!!
#6
07/03/2003 (11:34 pm)
Ok guys- this resource could really use some examples- so ive volunteered :) ...

b4 the examples- I had to patch something in the .cc ( which [HOW]-Ed from #gg so kindly gave the resolution for )--

change:
ConsoleMethod(GuiAnimBitmapCtrl,startAnimation,void,2,4,"obj.startAnimation([loop = false][, reset = false][, frame = 0])")
to:
ConsoleMethod(GuiAnimBitmapCtrl,startAnimation,void,2,5,"obj.startAnimation([loop = false][, reset = false][, frame = 0])")

Only difference is the Arg definition, from 4 to 5...

---

Heres an example of what ive done---

function callme(%obj)
{
%animID = %obj.addAnimation();

%frameID = %obj.addFrame(%animID,"common/ui/ask1.png");
%frameID = %obj.addFrame(%animID,"common/ui/ask2.png");
%frameID = %obj.addFrame(%animID,"common/ui/ask3.png");
%frameID = %obj.addFrame(%animID,"common/ui/ask4.png");
%frameID = %obj.addFrame(%animID,"common/ui/ask5.png");
%frameID = %obj.addFrame(%animID,"common/ui/ask6.png");
%frameID = %obj.addFrame(%animID,"common/ui/ask7.png");

%newFPS = 120;
%obj.setFrameRate(%newFPS);

%loop = FALSE;
%reset = FALSE;
%frame = 0;
%obj.startAnimation(%loop, %reset, %frame);

}


that simply plays the animation once, and stops...

Hope this helps guys..

-IsAmused
#7
07/04/2003 (12:54 am)
Oh, also...

The credit for this addition goes entirely to Labrat (#gg)..


****

To detect and Call a function when an animation is complete...

Add the following in the .cc:

Con::executef(this, 1, "animationDone");

after line 495 ( mCurrentState = Stopped; )
--

This will call a function within script called: GuiAnimBitmapCtrl::animationDone ...

****


Good Stuff-- Thanks alot Lab
#8
02/10/2004 (2:30 pm)
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=5196

This URL will give you a very good example, thanks for James Yong!
#10
03/17/2005 (12:53 pm)
Help, I don't see any way to use transparancies.
#11
03/29/2005 (5:31 am)
Help , I want to display two sets of animation in two different GuiAnimBitmapCtrl control one after the other. When one animation is playing the other animation should not play.

while(%obj.isPlaying() )
{

}
//Second animation

But my system Hangs.
#12
08/11/2005 (7:23 pm)
Jatinder: That's because execution is stopped in your while loop. You can't do scripting that way, it'll hang the system as you described. Instead, use the suggestion a few lines up regarding calling a function then the animation is done.

For example:

new GuiAnimBitmapCtrl(Animation1)
{
  // Define the ctrl
};

new GuiAnimBitmapCtrl(Animation2)
{
  // Define the ctrl
};

Animation1::animationDone(%this)
{
  Animation2.startAnimation();
}

Animation2::animationDone(%this)
{
  Animation1.startAnimation();
}
#13
03/25/2009 (3:55 am)
Is this only for TGE or TGB?
#14
07/27/2009 (9:12 am)
Just for TGE, as I only have access to TGE.
#15
02/25/2010 (7:13 pm)
I find a bug that there this a texture object leak. I want know how to manually retrieve these memery.thanks in advance.