Page 1 of 1

Making a PNG animation control: what's the best approach?

Posted: Tue Mar 10, 2020 10:47 am
by Parduz
I want to make a control that works with PNGs but looks like the wxAnimation (same exposed functions, so i can replace it with mine); so basically the animation is a single long PNG "strip" of frames, and the control show a portion of it as a "frame".

What should be the best approach? Should i start for the wxAnimation sources and change them to build my own, or should writing everything from scratch? Deriving from a wxImage, a wxPanel, a wxBitmap?

What would you suggest?

Re: Making a PNG animation control: what's the best approach?

Posted: Tue Mar 10, 2020 11:18 am
by PB
I have just took a cursory look at wxAnimationCtrl API. Wouldn't it be possible to derive a wxAnimation class and use wxAnimationCtrl::SetAnimation()? wxAnimation expects only a single string for a file name but that could be worked around...

EDIT
It seems the above may unfortunately be impossible, as wxAnimationCtrl takes a reference (and not a pointer) to wxAnimation, so the derived wxAnimation gets sliced to wxAnimation.