mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 20:24:49 +00:00
Reinstate entire-control fill and frame.
The settings for fill and frame around names are now called labelFill and labelFrame.
This commit is contained in:
parent
d80679fbf8
commit
4d3851c3cb
|
|
@ -50,11 +50,15 @@ class GuiShapeNameHud : public GuiControl {
|
|||
ColorF mFillColor;
|
||||
ColorF mFrameColor;
|
||||
ColorF mTextColor;
|
||||
ColorF mLabelFillColor;
|
||||
ColorF mLabelFrameColor;
|
||||
|
||||
F32 mVerticalOffset;
|
||||
F32 mDistanceFade;
|
||||
bool mShowFrame;
|
||||
bool mShowFill;
|
||||
bool mShowLabelFrame;
|
||||
bool mShowLabelFill;
|
||||
|
||||
protected:
|
||||
void drawName( Point2I offset, const char *buf, F32 opacity);
|
||||
|
|
@ -92,6 +96,10 @@ ConsoleDocClass( GuiShapeNameHud,
|
|||
" textColor = \"1.0 1.0 1.0 1.0\"; // Solid white text Color\n"
|
||||
" showFill = \"true\";\n"
|
||||
" showFrame = \"true\";\n"
|
||||
" labelFillColor = \"0.0 1.0 0.0 1.0\"; // Fills with a solid green color\n"
|
||||
" labelFrameColor = \"1.0 1.0 1.0 1.0\"; // Solid white frame color\n"
|
||||
" showLabelFill = \"true\";\n"
|
||||
" showLabelFrame = \"true\";\n"
|
||||
" verticalOffset = \"0.15\";\n"
|
||||
" distanceFade = \"15.0\";\n"
|
||||
"};\n"
|
||||
|
|
@ -119,11 +127,15 @@ void GuiShapeNameHud::initPersistFields()
|
|||
addField( "fillColor", TypeColorF, Offset( mFillColor, GuiShapeNameHud ), "Standard color for the background of the control." );
|
||||
addField( "frameColor", TypeColorF, Offset( mFrameColor, GuiShapeNameHud ), "Color for the control's frame." );
|
||||
addField( "textColor", TypeColorF, Offset( mTextColor, GuiShapeNameHud ), "Color for the text on this control." );
|
||||
addField( "labelFillColor", TypeColorF, Offset( mLabelFillColor, GuiShapeNameHud ), "Color for the background of each shape name label." );
|
||||
addField( "labelFrameColor", TypeColorF, Offset( mLabelFrameColor, GuiShapeNameHud ), "Color for the frames around each shape name label." );
|
||||
endGroup("Colors");
|
||||
|
||||
addGroup("Misc");
|
||||
addField( "showFill", TypeBool, Offset( mShowFill, GuiShapeNameHud ), "If true, we draw the background color of the control." );
|
||||
addField( "showFrame", TypeBool, Offset( mShowFrame, GuiShapeNameHud ), "If true, we draw the frame of the control." );
|
||||
addField( "showLabelFill", TypeBool, Offset( mShowLabelFill, GuiShapeNameHud ), "If true, we draw a background for each shape name label." );
|
||||
addField( "showLabelFrame", TypeBool, Offset( mShowLabelFrame, GuiShapeNameHud ), "If true, we draw a frame around each shape name label." );
|
||||
addField( "verticalOffset", TypeF32, Offset( mVerticalOffset, GuiShapeNameHud ), "Amount to vertically offset the control in relation to the ShapeBase object in focus." );
|
||||
addField( "distanceFade", TypeF32, Offset( mDistanceFade, GuiShapeNameHud ), "Visibility distance (how far the player must be from the ShapeBase object in focus) for this control to render." );
|
||||
endGroup("Misc");
|
||||
|
|
@ -144,6 +156,10 @@ void GuiShapeNameHud::initPersistFields()
|
|||
/// @param updateRect Extents of control.
|
||||
void GuiShapeNameHud::onRender( Point2I, const RectI &updateRect)
|
||||
{
|
||||
// Background fill first
|
||||
if (mShowFill)
|
||||
GFX->getDrawUtil()->drawRectFill(updateRect, mFillColor);
|
||||
|
||||
// Must be in a TS Control
|
||||
GuiTSCtrl *parent = dynamic_cast<GuiTSCtrl*>(getParent());
|
||||
if (!parent) return;
|
||||
|
|
@ -251,6 +267,10 @@ void GuiShapeNameHud::onRender( Point2I, const RectI &updateRect)
|
|||
|
||||
// Restore control object collision
|
||||
control->enableCollision();
|
||||
|
||||
// Border last
|
||||
if (mShowFrame)
|
||||
GFX->getDrawUtil()->drawRect(updateRect, mFrameColor);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -275,8 +295,8 @@ void GuiShapeNameHud::drawName(Point2I offset, const char *name, F32 opacity)
|
|||
offset.y -= height;
|
||||
|
||||
// Background fill first
|
||||
if (mShowFill)
|
||||
GFX->getDrawUtil()->drawRectFill(RectI(offset, extent), mFillColor);
|
||||
if (mShowLabelFill)
|
||||
GFX->getDrawUtil()->drawRectFill(RectI(offset, extent), mLabelFillColor);
|
||||
|
||||
// Deal with opacity and draw.
|
||||
mTextColor.alpha = opacity;
|
||||
|
|
@ -285,7 +305,7 @@ void GuiShapeNameHud::drawName(Point2I offset, const char *name, F32 opacity)
|
|||
GFX->getDrawUtil()->clearBitmapModulation();
|
||||
|
||||
// Border last
|
||||
if (mShowFrame)
|
||||
GFX->getDrawUtil()->drawRect(RectI(offset, extent), mFrameColor);
|
||||
if (mShowLabelFrame)
|
||||
GFX->getDrawUtil()->drawRect(RectI(offset, extent), mLabelFrameColor);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue