T3D 1.1 Beta 3 (and earlier) - GuiButtonCtrl does not correctly render its 4 states - LOGGED
by Guy Allard · in Torque 3D Professional · 11/29/2010 (10:55 am) · 2 replies
Build: binary and pro
Platform: all platforms
Target: game
Issues: Gui buttons should display 4 states - active, mouse over, depressed and inactive. However, the depressed state of buttons created using GuiButtonCtrl does not get rendered.
Steps to repeat: Launch the game. Move your mouse over a menu button. It changes (good!). Now press the button, the button image doesn't change (bad, it should).
Suggested fix: There is a slight flaw in the button state rendering logic. This is because it checks if mMouseOver is true prior to checking for mDepressed. As mMouseOver will always be true when the button is depressed, the depressed state does not get rendered.
e.g. in GuiButtonCtrl.cpp, line 88
The code should read
Platform: all platforms
Target: game
Issues: Gui buttons should display 4 states - active, mouse over, depressed and inactive. However, the depressed state of buttons created using GuiButtonCtrl does not get rendered.
Steps to repeat: Launch the game. Move your mouse over a menu button. It changes (good!). Now press the button, the button image doesn't change (bad, it should).
Suggested fix: There is a slight flaw in the button state rendering logic. This is because it checks if mMouseOver is true prior to checking for mDepressed. As mMouseOver will always be true when the button is depressed, the depressed state does not get rendered.
e.g. in GuiButtonCtrl.cpp, line 88
if( !mActive )
indexMultiplier = 4;
else if ( mMouseOver )
indexMultiplier = 3;
else if ( mDepressed || mStateOn )
indexMultiplier = 2;The (mDepressed || mStateOn) check is never performed as mMouseOver will also be true in those situations.The code should read
if( !mActive )
indexMultiplier = 4;
else if ( mDepressed || mStateOn )
indexMultiplier = 2;
else if ( mMouseOver )
indexMultiplier = 3;and then all four button states will be rendered correctlyAbout the author
Rex Hiebert
3Dmotif LLC
if( !mActive ) indexMultiplier = 4; else if ( mMouseOver && !mDepressed) indexMultiplier = 3; else if ( mDepressed || mStateOn ) indexMultiplier = 2;It allows the depressed state to be seen during a click but also shows the highlighting of a depressed button (as in the toggle button).