Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void MultiBox::Render()
- {
- std::string format;
- for (int i = 0; i < vecSelectables.size(); i++)
- {
- auto formatLen = format.length() < 20;
- auto first = format.length() <= 0;
- if ((bEnabled[i]) && formatLen)
- {
- if (!first) {
- format.append(", ");
- }
- format.append(vecSelectables.at(i));
- }
- else if (!formatLen) {
- format.append("...");
- break;
- }
- }
- if (format.length() <= 0) {
- format += "";
- }
- /* Render the selectable with the value in the middle */
- g_Render.RectFilled(this->rcBoundingBox, Color(39, 39, 39, settings.iAlpha));
- g_Render.String(this->rcBoundingBox.Button(), CD3DFONT_CENTERED_Y | CD3DFONT_DROPSHADOW, Color(160, 160, 160, settings.iAlpha), pFont.get(), format.c_str());
- /* Render the selectable with the value in the middle and highlight if hovered */
- if (this->bIsHovered) {
- g_Render.RectFilled(this->rcBoundingBox, style.colHover);
- }
- /* Render the small triangle */
- {
- SPoint ptPosMid, ptPosLeft, ptPosRight;
- /* Draw two different versions (top-down, down-top) depending on activation */
- if (!this->bIsActive)
- {
- ptPosMid.x = this->rcBoundingBox.right - 8;
- ptPosRight.x = this->rcBoundingBox.right - 5;
- ptPosLeft.x = this->rcBoundingBox.right - 10;
- ptPosRight.y = ptPosLeft.y = this->rcBoundingBox.top + 8;
- ptPosMid.y = this->rcBoundingBox.bottom - 7;
- }
- else
- {
- ptPosMid.x = this->rcBoundingBox.right - 8;
- ptPosRight.x = this->rcBoundingBox.right - 5;
- ptPosLeft.x = this->rcBoundingBox.right - 11;
- ptPosRight.y = ptPosLeft.y = this->rcBoundingBox.bottom - 7;
- ptPosMid.y = this->rcBoundingBox.top + 7;
- }
- g_Render.TriangleFilled(ptPosLeft, ptPosRight, ptPosMid, Color(162, 162, 162, settings.iAlpha));
- }/*-------------------------*/
- /* Rectangle of the combo selectables, for scissorrect */
- const SRect vpCombo =
- {
- rcBoundingBox.left,
- rcBoundingBox.bottom,
- rcBoundingBox.right,
- rcBoundingBox.bottom + rcBoundingBox.Height() * int(vecSelectables.size())
- };
- /* Render selectables only within the rect, useful for scroll usage (if implemented later on) */
- g_Render.SetCustomScissorRect(vpCombo);
- if (this->bIsActive)
- RenderSelectables();
- g_Render.RestoreOriginalScissorRect();
- g_Render.Rect(this->rcBoundingBox, style.colSectionOutl(settings.iAlpha));
- if (bIsActive) {
- g_Render.Rect({ this->rcBoundingBox.left, this->rcBoundingBox.bottom + 3 },
- { this->rcBoundingBox.right, this->rcBoundingBox.bottom + this->rcBoundingBox.Height() * int(this->vecSelectables.size()) },
- style.colSectionOutl(settings.iAlpha));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement