MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / renderGraphTooltip

Method renderGraphTooltip

Engine/source/gui/editor/guiParticleGraphCtrl.cpp:941–1005  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

939}
940
941bool GuiParticleGraphCtrl::renderGraphTooltip(Point2I cursorPos, StringTableEntry tooltip)
942{
943 // Short Circuit.
944 if (!mAwake)
945 return false;
946 if ( dStrlen( tooltip ) == 0 )
947 return false;
948
949 // Need to have root.
950 GuiCanvas *root = getRoot();
951 if ( !root )
952 return false;
953
954 if (!mTooltipProfile)
955 setTooltipProfile( mProfile );
956
957 GFont *font = mTooltipProfile->mFont;
958
959 // Fetch Canvas.
960 GuiCanvas *pCanvas = getRoot();
961
962 //Vars used:
963 //Screensize (for position check)
964 //Offset to get position of cursor
965 //textBounds for text extent.
966 Point2I screensize = pCanvas->getWindowSize();
967 Point2I offset = cursorPos;
968 Point2I textBounds;
969 S32 textWidth = font->getStrWidth(tooltip);
970
971 //Offset below cursor image
972 offset.y -= root->getCursorExtent().y;
973 //Create text bounds.
974 textBounds.x = textWidth+8;
975 textBounds.y = font->getHeight() + 4;
976
977 // Check position/width to make sure all of the tooltip will be rendered
978 // 5 is given as a buffer against the edge
979 if (screensize.x < offset.x + textBounds.x + 5)
980 offset.x = screensize.x - textBounds.x - 5;
981
982 // And ditto for the height
983 if(screensize.y < offset.y + textBounds.y + 5)
984 offset.y = cursorPos.y - textBounds.y - 5;
985
986 // Set rectangle for the box, and set the clip rectangle.
987 RectI rect(offset, textBounds);
988 GFX->setClipRect(rect);
989
990 // Fetch Draw Utility.
991 GFXDrawUtil* pDrawUtil = GFX->getDrawUtil();
992
993 // Draw Filler bit, then border on top of that
994 pDrawUtil->drawRectFill(rect, ColorI(mTooltipProfile->mFillColor.red, mTooltipProfile->mFillColor.green, mTooltipProfile->mFillColor.blue, 200) );
995 pDrawUtil->drawRect( rect, mTooltipProfile->mBorderColor );
996
997 // Draw the text centered in the tool tip box
998 pDrawUtil->setBitmapModulation( mTooltipProfile->mFontColor );

Callers

nothing calls this directly

Calls 14

getStrWidthMethod · 0.80
getCursorExtentMethod · 0.80
getDrawUtilMethod · 0.80
drawRectFillMethod · 0.80
drawRectMethod · 0.80
setBitmapModulationMethod · 0.80
clearBitmapModulationMethod · 0.80
dStrlenFunction · 0.50
ColorIClass · 0.50
getWindowSizeMethod · 0.45
getHeightMethod · 0.45
setClipRectMethod · 0.45

Tested by

no test coverage detected