Nothing happens in AnimationPicture
« on: 30 October 2013, 07:37:18 »
I always see the first picture forever.
What's wrong?
Code: [Select]
   var pic = gui.Add (new AnimatedPicture ());
   pic.AddFrame ("media/Face-Ako.png", 1000);
   pic.AddFrame ("media/Face-Bko.png", 1000);
   pic.AddFrame ("media/Face-Cko.png", 1000);
   pic.SetFrame (0);
   pic.Play ();
I used TGUI.Net-Master (latest development snapshot).

*

texus

  • *****
  • 1161
    • View Profile
    • Texus's Blog
Re: Nothing happens in AnimationPicture
« Reply #1 on: 30 October 2013, 08:10:15 »
Strange, it works fine for me. The animation of course stops at the last frame because it isn't looping, but at least I have an animation.

I'll look into this later today, because I don't really know what version I tested it with, so there is always the chance that I'm not using the same version as you.

Re: Nothing happens in AnimationPicture
« Reply #2 on: 30 October 2013, 09:42:41 »
I understood what happened.
GUI.m_Focused was false when I started my application.
Thus AnimatedPicture.OnUpdate() was never called.
Next I clicked another window(lost focus) and clicked my application again (gain focus).
GUI.m_Focuesed became true and it started to animate.

I'm not sure why GUI.m_Focused was false when I started.
(Application window has focus certainly)

*

texus

  • *****
  • 1161
    • View Profile
    • Texus's Blog
Re: Nothing happens in AnimationPicture
« Reply #3 on: 30 October 2013, 11:58:36 »
Thanks for investigating on the bug.

I made the m_Focused variable default to false, because in all my tests a focused event would be send when creating the window.

Anyway, I now changed the default value to true, so it should now work with the latest version.

Re: Nothing happens in AnimationPicture
« Reply #4 on: 31 October 2013, 02:34:18 »
Thank you. It works fine.
And sorry, this question should be written in Help forum.