Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void MCategory::Draw()
- {
- if (gControls.OnClick(this->posX, this->posY, this->sizeW, this->sizeH))
- {
- if (gCurrentMCategory)
- gCurrentMCategory->active = false;
- this->active = true;
- gCurrentMCategory = this;
- }
- if (this->active)
- {
- //gPaint.DrawFilledRectWithBorder(this->posX, this->posY, this->sizeW, this->sizeH, this->borderSize, this->color, this->borderColorU, this->borderColorR, this->borderColorB, this->borderColorL);
- gPaint.DrawFilledRect(this->posX, this->posY, this->sizeW, this->sizeH, this->color);
- gPaint.DrawFilledRect(this->posX + this->borderSize, this->posY - this->borderSize, this->sizeW, this->borderSize, this->borderColorU);
- gPaint.DrawFilledRect(this->posX + this->sizeW, this->posY, this->borderSize, this->sizeH, this->borderColorR);
- gPaint.DrawFilledRect(this->posX + this->borderSize, this->posY + this->sizeH, this->sizeW, this->borderSize, this->borderColorB);
- gPaint.DrawFilledRect(this->posX, this->posY, this->borderSize, this->sizeH, this->borderColorL);
- gPaint.DrawString(this->posX + this->sizeW / 2, this->posY + this->sizeH / 2, 'c', this->name, this->font, this->textColor);
- for (const auto &child : this->children)
- child->Draw();
- }
- else
- gPaint.DrawString(this->posX + this->sizeW / 2, this->posY + this->sizeH / 2, 'c', this->name, this->font, this->nonActiveTextColor);
- }
- void MCheckBox::Draw()
- {
- if (!this->variable)
- return;
- if (gControls.OnClick(this->posX, this->posY, this->sizeW, this->sizeH))
- *this->variable = !*this->variable;
- if (*this->variable)
- gPaint.DrawFilledRect(this->posX, this->posY, this->sizeW, this->sizeH, this->color);
- else
- gPaint.DrawFilledRect(this->posX, this->posY, this->sizeW, this->sizeH, this->nonActiveColor);
- gPaint.DrawString(this->posX - this->sizeW, this->posY + this->sizeH / 2, 'r', this->name, this->font, this->textColor);
- }
- inline virtual void Draw() override
- {
- if (!this->variable)
- return;
- gPaint.DrawFilledRect(this->posX, this->posY, this->sizeW, this->sizeH, this->nonActiveColor);
- gPaint.DrawFilledRect(this->posX, this->posY, (int)(this->sizeW * (*this->variable - this->minValue) / (this->maxValue - this->minValue)), this->sizeH, this->color);
- if (gControls.DraggingSlider(this->posX, this->posY, this->sizeW, this->sizeH))
- {
- int cursorPosX;
- int cursorPosY;
- INTERFACES::Surface->SurfaceGetCursorPos(cursorPosX, cursorPosY);
- float difference = (float)(cursorPosX - this->posX);
- float percent = difference / this->sizeW;
- float range = (this->maxValue - this->minValue) * percent;
- *this->variable = UTILS::ClampValue<T>(this->minValue + (T)range, this->minValue, this->maxValue);
- }
- gPaint.DrawString(this->posX - this->sizeH, this->posY + this->sizeH / 2, 'r', this->name, this->font, this->textColor);
- gPaint.DrawString(this->posX + this->sizeW + this->sizeH, this->posY + this->sizeH / 2, 'l', UTILS::ToStringWithPrecision(*variable, this->precision), this->font, this->textColor);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement