Game Development Community

dev|Pro Game Development Curriculum

GuiBitmapButtonCtrl - Add modulationColor.

by Orion Elenzil · 05/14/2008 (8:25 am) · 1 comments

Add modulationColor to guiBitmapButtonCtrl.
This is most useful for adjusting the overall transparency of a button.

This is based on a TGE 1.3.5 codebase, but probably applies to TGE 1.X.

Familiarity w/ C++ is assumed.

guiBitmapCtrl.h
right before this stuff:
[i]
public:   
   DECLARE_CONOBJECT(GuiBitmapButtonCtrl);
[/i]
add this:
public:
   ColorI  mModulationColor;

GuiBitmapButtonCtrl.cc
in the constructor, GuiBitmapButtonCtrl::GuiBitmapButtonCtrl(),
add:
mModulationColor     = ColorI(255, 255, 255, 255);

in GuiBitmapButtonCtrl::initPersistFields(),
add:
addField("modulationColor", TypeColorI  , Offset(mModulationColor, GuiBitmapButtonCtrl));

in GuiBitmapButtonCtrl::renderButton(),
change this:
dglClearBitmapModulation();
to this:
dglSetBitmapModulation(mModulationColor);

okay!
easy i know!
okay!

#1
05/14/2008 (12:45 pm)
Coolness. (Easy is good!)