Game Development Community

Animated Bitmap Control Templates (guiAnimBitmapCtrl)

by Jason Bakker · in Torque Game Engine · 08/11/2006 (8:47 am) · 1 replies

Hey,

At the moment I've got Bryan Ross's guiAnimBitmapCtrl implemented heavily within the GUI for our game - it works great, except...

Because of the nature of our GUI we have quite a bit of animation happening on each GUI object over the life of that object - explosions and so forth - meaning that each object has about six animations, each with anywhere between five to fifteen frames. Here's a screenshot of an early form of the GUI:

www.duowildfire.com/misc/mainmenuscreenie.png
And so, there's a lot of data that each object has to load - if I count correctly - 87 images; 3.4 mb (the frames for the "ripple" that you can see is a large chunk of that). The problem is that I have four buttons on each of three different menus (twelve in total), which all have the same animations and functions, but just head to different places - however, because of the way that guiAnimBitmapCtrl functions, we've got to define these animations seperately for each button. This is (we think) causing the fairly significant preload lag that we're getting particularly on lower-end machines.

What would be ideal is to have an animation object that you could then add onto as many buttons as you'd like, or perhaps to be able to "clone" a button, without loading in duplicates of all of the images. I've had a look at the guiAnimBitmapCtrl code and mucked around a bit with making my own control, but I'm not the deftest hand at C++ and was wondering whether anyone could give me some pointers as to what would be the best way to go about solving this problem. Also, I may be wrong about the preloading and so forth, I'm not that clued in about the render pipeline, so if I need to be set straight feel free ;)

Thanks,
Jason

About the author

Recent Threads


#1
08/12/2006 (7:02 pm)
Okay, I've gone through the engine and found that to draw you simply create a rectangle of the bitmap as a texture in the onRender function - however, I'm still not sure how to let the engine know that these twelve textures in twelve different objects are the same texture - I tried (and failed) to get control inheritance happening last semester, but it might have been something wrong with my implementation as opposed to it just not working ;) If anyone could point me in the right direction re: gui control inheritance (ideally both function and variable inheritance) I'd be much obliged.

On a side-note, I've started to create a GuiEmitterCtrl to handle the explosions, and if I can somehow get a radioactive wave working as an emitter, I won't really need to inherit those tricky engine-only objects like Frames and Animations - I'll still need function and variable though.