Game Development Community

Fix for GuiBitmapButtonTextCtrl

by John Vanderbeck · in Torque Game Engine · 05/12/2004 (5:16 am) · 6 replies

This control is in the latest HEAD that I have, but i'm not sure if its always been there or not since I got a lot og blank stares when I first started looking to get this working :)

In any case this control is in Torque and is basically a GuiBitmapButton that also allows you to set text that gets rendered on it.

There is just one small bug in the engine that needs to be fixed in order to make it useable.

In guiCanvas.cc somewhere around line 55 is a huge block of IMPLEMENT_CONOBJECT) macros. These are part of the console system that allow objects to be scrpited. An entry is missing for this control.

Simply add one in, I did it after the BitmapButton
// JWV ADDED bug fix for GuiBitmapButtonTextCtrl
IMPLEMENT_CONOBJECT(GuiBitmapButtonTextCtrl);

#1
05/12/2004 (5:40 am)
Also this control wasn't properly using the textOffset value in the GuiProfile. So I fixed that.

Point2I textPos = offset;
      if(mDepressed)
         textPos += Point2I(1,1);
      // JWV BEGIN ADDED
      // Added so that the text is drawn according to the mTextOffset profile member
      textPos += mProfile->mTextOffset;
      // JWV END ADDED
      dglSetBitmapModulation( mProfile->mFontColor );
      renderJustifiedText(textPos, mBounds.extent, mButtonText);
#2
11/19/2004 (10:48 am)
Thanks John, I've fixed this.
#3
11/19/2004 (11:18 am)
We just changed the Button Profile to GuiButtonProfile instead of GuiDefaultProfile and that worked as well...
#4
11/19/2004 (11:22 am)
And the reason that worked for you is because the Button profile actually forces the text to center on every button using it. This enabled the flaw to be overridden, but if you have a specific offset need then ButtonProfile will work against you just as quickly as it worked for you.


What's up Joe? Haven't heard from since, what? Yesterday? lol.

;-)
#5
11/19/2004 (11:33 am)
Ah Ha! Thanks, Gonzo. And yes we have to stop meeting like this... ;)
#6
11/19/2004 (10:06 pm)
I cannot get the text to properly move in the correct location when I use "relative" in the horizSizing/vertSizing. Is it just me?

I also try using "autoSizeWidth = true;" / "autoSizeHeight = true;" but that don't do anything either.

I have a button where a number must be displayed on the lower right corner.

Any help would be appreciated,
Nick