extra draw gui

add the extra functions for drawing gui elements
RoundedRectangle:

All draw rect functions now pass through roundedRectangle which uses a shader and can draw borders, and rounds the corners

Draw thick line:
draws a line thicker than 1 pixel, uses a geometry shader to do this

Draw Circle:
Draws a circle with a border parameter.
This commit is contained in:
marauder2k7 2024-03-06 17:27:18 +00:00
parent 39c2cc09fc
commit c9d70de609
9 changed files with 654 additions and 170 deletions

View file

@ -108,7 +108,13 @@ void GuiShaderNode::renderNode(Point2I offset, const RectI& updateRect, const S3
RectI winRect;
winRect.point = offset;
winRect.extent = getExtent();
drawer->drawRectFill(winRect, mProfile->mFillColor);
ColorI border = mProfile->mBorderColor;
if (mSelected)
border = mProfile->mBorderColorSEL;
drawer->drawRoundedRect(15.0f, winRect, mProfile->mFillColor, 3.0f, border);
// draw header
ColorI header(50, 50, 50, 128);
@ -148,7 +154,7 @@ void GuiShaderNode::renderNode(Point2I offset, const RectI& updateRect, const S3
U32 headerSize = 30;
headRect.point = offset;
headRect.extent = Point2I(getExtent().x, headerSize);
drawer->drawRectFill(headRect, header);
drawer->drawRoundedRect(15.0f, headRect, header);
// draw header text.
U32 strWidth = mProfile->mFont->getStrWidth(mTitle.c_str());
@ -157,14 +163,6 @@ void GuiShaderNode::renderNode(Point2I offset, const RectI& updateRect, const S3
drawer->drawText(mProfile->mFont, headerPos + offset, mTitle);
drawer->clearBitmapModulation();
ColorI border = mProfile->mBorderColor;
if (mSelected)
border = mProfile->mBorderColorSEL;
drawer->drawRect(winRect, border);
if (mInputNodes.size() > 0 || mOutputNodes.size() > 0)
{
U32 textPadX = nodeSize, textPadY = mProfile->mFont->getFontSize() + (nodeSize / 2);
@ -175,7 +173,7 @@ void GuiShaderNode::renderNode(Point2I offset, const RectI& updateRect, const S3
drawer->drawText(mProfile->mFont, slotPos + offset, input->name);
if (input->pos == Point2I::Zero || mPrevNodeSize != nodeSize)
input->pos = Point2I(-(nodeSize / 2), slotPos.y + ((mProfile->mFont->getFontSize() / 2) - (nodeSize / 2)));
input->pos = Point2I(-(nodeSize / 2) + 1, slotPos.y + ((mProfile->mFont->getFontSize() / 2) - (nodeSize / 2)));
slotPos.y += textPadY;
}