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

Are you writing your own components and need help with how to set them up or have questions about the components you are deriving from ? Ask them here.
Post Reply
User avatar
Parduz
Experienced Solver
Experienced Solver
Posts: 79
Joined: Fri Jan 30, 2015 1:48 pm
Location: Bologna, Italy

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

Post by Parduz » Tue Mar 10, 2020 10:47 am

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?

PB
Part Of The Furniture
Part Of The Furniture
Posts: 2434
Joined: Sun Jan 03, 2010 5:45 pm

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

Post by PB » Tue Mar 10, 2020 11:18 am

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.

Post Reply