mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-14 08:04:40 +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
1 changed files with 24 additions and 4 deletions
|
|
@ -50,11 +50,15 @@ class GuiShapeNameHud : public GuiControl {
|
||||||
ColorF mFillColor;
|
ColorF mFillColor;
|
||||||
ColorF mFrameColor;
|
ColorF mFrameColor;
|
||||||
ColorF mTextColor;
|
ColorF mTextColor;
|
||||||
|
ColorF mLabelFillColor;
|
||||||
|
ColorF mLabelFrameColor;
|
||||||
|
|
||||||
F32 mVerticalOffset;
|
F32 mVerticalOffset;
|
||||||
F32 mDistanceFade;
|
F32 mDistanceFade;
|
||||||
bool mShowFrame;
|
bool mShowFrame;
|
||||||
bool mShowFill;
|
bool mShowFill;
|
||||||
|
bool mShowLabelFrame;
|
||||||
|
bool mShowLabelFill;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void drawName( Point2I offset, const char *buf, F32 opacity);
|
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"
|
" textColor = \"1.0 1.0 1.0 1.0\"; // Solid white text Color\n"
|
||||||
" showFill = \"true\";\n"
|
" showFill = \"true\";\n"
|
||||||
" showFrame = \"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"
|
" verticalOffset = \"0.15\";\n"
|
||||||
" distanceFade = \"15.0\";\n"
|
" distanceFade = \"15.0\";\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
|
|
@ -119,11 +127,15 @@ void GuiShapeNameHud::initPersistFields()
|
||||||
addField( "fillColor", TypeColorF, Offset( mFillColor, GuiShapeNameHud ), "Standard color for the background of the control." );
|
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( "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( "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");
|
endGroup("Colors");
|
||||||
|
|
||||||
addGroup("Misc");
|
addGroup("Misc");
|
||||||
addField( "showFill", TypeBool, Offset( mShowFill, GuiShapeNameHud ), "If true, we draw the background color of the control." );
|
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( "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( "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." );
|
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");
|
endGroup("Misc");
|
||||||
|
|
@ -144,6 +156,10 @@ void GuiShapeNameHud::initPersistFields()
|
||||||
/// @param updateRect Extents of control.
|
/// @param updateRect Extents of control.
|
||||||
void GuiShapeNameHud::onRender( Point2I, const RectI &updateRect)
|
void GuiShapeNameHud::onRender( Point2I, const RectI &updateRect)
|
||||||
{
|
{
|
||||||
|
// Background fill first
|
||||||
|
if (mShowFill)
|
||||||
|
GFX->getDrawUtil()->drawRectFill(updateRect, mFillColor);
|
||||||
|
|
||||||
// Must be in a TS Control
|
// Must be in a TS Control
|
||||||
GuiTSCtrl *parent = dynamic_cast<GuiTSCtrl*>(getParent());
|
GuiTSCtrl *parent = dynamic_cast<GuiTSCtrl*>(getParent());
|
||||||
if (!parent) return;
|
if (!parent) return;
|
||||||
|
|
@ -251,6 +267,10 @@ void GuiShapeNameHud::onRender( Point2I, const RectI &updateRect)
|
||||||
|
|
||||||
// Restore control object collision
|
// Restore control object collision
|
||||||
control->enableCollision();
|
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;
|
offset.y -= height;
|
||||||
|
|
||||||
// Background fill first
|
// Background fill first
|
||||||
if (mShowFill)
|
if (mShowLabelFill)
|
||||||
GFX->getDrawUtil()->drawRectFill(RectI(offset, extent), mFillColor);
|
GFX->getDrawUtil()->drawRectFill(RectI(offset, extent), mLabelFillColor);
|
||||||
|
|
||||||
// Deal with opacity and draw.
|
// Deal with opacity and draw.
|
||||||
mTextColor.alpha = opacity;
|
mTextColor.alpha = opacity;
|
||||||
|
|
@ -285,7 +305,7 @@ void GuiShapeNameHud::drawName(Point2I offset, const char *name, F32 opacity)
|
||||||
GFX->getDrawUtil()->clearBitmapModulation();
|
GFX->getDrawUtil()->clearBitmapModulation();
|
||||||
|
|
||||||
// Border last
|
// Border last
|
||||||
if (mShowFrame)
|
if (mShowLabelFrame)
|
||||||
GFX->getDrawUtil()->drawRect(RectI(offset, extent), mFrameColor);
|
GFX->getDrawUtil()->drawRect(RectI(offset, extent), mLabelFrameColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue