Game Development Community

dev|Pro Game Development Curriculum

Updated GUI ex/fx bitmap control (GuiBitmapExCtrl-GuiBitmapFxCtrl)

by Sylvain Rochette · 03/25/2002 (8:55 pm) · 14 comments

Download Code File

GuiBitmapExCtrl v4

I needed a control to do rotation so I made GuiBitmapExCtrl. It provides the core GuiBitmapCtrl functionality, but adds other operation such as:

-some little bug corrected from previous version

- rotation ( from a pivot )
- scaling in x, y ( from the rotation pivot )
- flipping (x, y)
- color (with alpha as well)
- wrapping
- texture coordinate translation

GuiBitmapFxCtrl v3

derived from GuiBitmapExCtrl,
support waveform function like Quake3 for
Sin,Square,Triangle,Sawtooth,Inversesawtooth function on the following value

-some little bug corrected from previous version

- color
- alpha
- rotation (x or/and y)
- scaling (x or/and y)
- pivot (x or/and y)
- texture coordinate translation (x or/and y)

Take a try!!

hope you find this control usefull :)

#1
03/26/2002 (8:31 am)
Just one comment. In order to your source to compile under linux, take care of the letter case in the include : #include "gui/guiBitmapExCtrl.h"

BTW, useful piece of code.
#2
03/26/2002 (8:47 am)
frank:
it's true this is not a windows based project, sorry... :)
#3
03/26/2002 (10:12 am)
I think that you have a minor errors :
// get
   Con::addCommand("GuiBitmapExCtrl", "getAngle", cBitmapExGetAngle, "guiBitmapExCtrl.getAngle()", 3, 3);
   Con::addCommand("GuiBitmapExCtrl", "getFlip", cBitmapExGetFlip, "guiBitmapExCtrl.getFlip()", 3, 3);
   Con::addCommand("GuiBitmapExCtrl", "getPivot", cBitmapExGetPivot, "guiBitmapExCtrl.getPivot()", 3, 3);
   Con::addCommand("GuiBitmapExCtrl", "getScale", cBitmapExGetScale, "guiBitmapExCtrl.getScale()", 3, 3);

   // set
   Con::addCommand("GuiBitmapExCtrl", "setAngle", cBitmapExSetAngle, "guiBitmapExCtrl.setAngle(angle)", 3, 3);
   Con::addCommand("GuiBitmapExCtrl", "setFlip", cBitmapExSetFlip, "guiBitmapExCtrl.setFlip(xAxis, yAxis)", 3, 3);
   Con::addCommand("GuiBitmapExCtrl", "setPivot", cBitmapExSetPivot, "guiBitmapExCtrl.setPivot(xAxis, yAxis)", 3, 3);
   Con::addCommand("GuiBitmapExCtrl", "setScale", cBitmapExSetScale, "guiBitmapExCtrl.setScale(xAxis, yAxis)", 3, 3);

should be
// get
   Con::addCommand("GuiBitmapExCtrl", "getAngle", cBitmapExGetAngle, "guiBitmapExCtrl.getAngle()", 2, 2);
   Con::addCommand("GuiBitmapExCtrl", "getFlip", cBitmapExGetFlip, "guiBitmapExCtrl.getFlip()", 2, 2);
   Con::addCommand("GuiBitmapExCtrl", "getPivot", cBitmapExGetPivot, "guiBitmapExCtrl.getPivot()", 2, 2);
   Con::addCommand("GuiBitmapExCtrl", "getScale", cBitmapExGetScale, "guiBitmapExCtrl.getScale()", 2, 2);

   // set
   Con::addCommand("GuiBitmapExCtrl", "setAngle", cBitmapExSetAngle, "guiBitmapExCtrl.setAngle(angle)", 3, 3);
   Con::addCommand("GuiBitmapExCtrl", "setFlip", cBitmapExSetFlip, "guiBitmapExCtrl.setFlip(xAxis, yAxis)", 4, 4);
   Con::addCommand("GuiBitmapExCtrl", "setPivot", cBitmapExSetPivot, "guiBitmapExCtrl.setPivot(xAxis, yAxis)", 4, 4);
   Con::addCommand("GuiBitmapExCtrl", "setScale", cBitmapExSetScale, "guiBitmapExCtrl.setScale(xAxis, yAxis)", 4, 4);

BTW, i have added a modulation color in order to have some fx on the bitmap.
#4
03/26/2002 (10:49 am)
yes the color modulation is a good idea, i will update the zip file tonight... and correct the problem related to addCommand

thanks
#5
03/26/2002 (11:31 am)
i will add a new control tonight(guiBitmapFxCtrl)

to manage the animation of the color modulation (min to max) on a time, loop count, loop type(ping pong, forward, backward), loop function(sin, linear, etc...)

same thing for scaling and rotating, that should be really usefull for some HUD effect

another idea? :)
#6
03/26/2002 (2:37 pm)
Will be very nice.
For the sin fx, do you mean the old sin-wave image deformation ? Will remind me my old days when I coded some demo on Amiga :)
#7
03/26/2002 (3:08 pm)
Hey, I look at your corrosive engine. Very nice and great work !!
If you are still free, we will welcome you as coder for our current project. ;)
#8
03/26/2002 (3:21 pm)
i played with amiga to but with amos basic :) long time ago...

the sin thing was more todo like Q3 shader for color/alpha, rotation, scaling, but not changing the texture pixel :)

thanks, this was cool for personnel projet clone the q3, but they are no end at all, i decided to switch on torque, cool project, well good coded and structured... but with no shader :(

well i am working on a personnal project too :), we are 3 mappers, 2 programmers, no artist :P right now, but thanks anyway :)

cool your project, the only problem was the java applet jammed my netscape6 :).......
#9
03/27/2002 (12:10 am)
BTW, I have a work for you : put shaders support in torque ;) You should look at the TCP Project, and maybe ask to be in one of it.

BTW, can you tell me a little bit more on your project ? Do you have a homepage ?
#10
03/27/2002 (5:37 am)
shader shader shader :), for torque, that should be a pain in the ass, first, think like fluide most use shader, you dont need to code for each effect if the shader support it :), i never checked the texture manager, but i think that should work but the problem is not load the texture layer its the transformation on the vertices and texCoords, right now a engine that support shader most at least have a specific pipeline, where everything goes... and render per shader order!! without that the shader cannot be used, like terrain shader should not be used but everything else yes... if the objects/models is rendered in order that should be possible but imagine this situation you have 4 building like RealmWars, using 4 shaders per building, the building will render the 4 building using a total of 16 shaders or use 4 shaders? 4 shaders in quake3 style engine, but torque manage LoD, maybe this already work like that but i am not sure and its why its a pain in the ass :)... but i need to check more to make a real evaluation :P

my project is basicly a game kind of counter strike but completly different, the title and webpage is not defined yet :)
#11
03/31/2002 (10:14 pm)
i update the version today to resolve refresh problem when the ui is not update on each frame
#12
04/05/2002 (5:40 pm)
:)
#13
03/28/2006 (5:21 am)
Very nice ressource, thx!
Work perfect with 1.4
#14
06/28/2006 (6:39 am)
Hey, i've seem to run into some problems with this resource.
I'm trying to use a PNG image with an alpha layer in these GUI controls, but it seems to be wrecking the images totally.
I've tried different images, and none worked, except for a few images that came with Torque 1.4 (the terrain textures)...

I'll add a screenshot to clarify:

http://img352.imageshack.us/img352/2817/image2tx.jpg

someone ran into this same problem? Or know how to fix it...

Allso, for the rotation part of this resource, would it be possible to modify it so that it's the OBJECT that rotates, and not the bitmap which resides in the object?