本文整理汇总了C++中Render::Line方法的典型用法代码示例。如果您正苦于以下问题:C++ Render::Line方法的具体用法?C++ Render::Line怎么用?C++ Render::Line使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Render
的用法示例。
在下文中一共展示了Render::Line方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Draw
void UICheckBox::Draw(Render& p) {
int x = 0;
int y = -2;
Vector2 size = p.GetTextSize(this->GetText());
if (this->Align == TextAlign::MidLeft || this->Align == TextAlign::MidCenter || this->Align == TextAlign::MidRight) y = this->H / 2 - (int)size.Y / 2;
if (this->Align == TextAlign::BotLeft || this->Align == TextAlign::BotCenter || this->Align == TextAlign::BotRight) y = this->H - (int)size.Y / 2 + 2;
if (this->Align == TextAlign::TopCenter || this->Align == TextAlign::MidCenter || this->Align == TextAlign::BotCenter) x = this->W / 2 - (int)size.X / 2;
if (this->Align == TextAlign::TopRight || this->Align == TextAlign::MidRight || this->Align == TextAlign::BotRight) x = this->W - (int)size.X;
if (this->BoxOnleftSide) {
p.Box(0, 0, this->H, this->H, Color::Black);
p.Box(1, 1, this->H - 2, this->H - 2, Color(80, 80, 80, 255));
if (this->IsChecked) {
p.Line(this->Padding, this->Padding, this->H - this->Padding, this->H - this->Padding, this->LineSize, this->LineColor);
p.Line(this->H - this->Padding, this->Padding, this->Padding, this->H - this->Padding, this->LineSize, this->LineColor);
}
if (x == 0) x += this->H + (int)this->Padding;
} else {
int addx = (int)size.X;
p.Box(addx, 0, this->H, this->H, Color::Black);
p.Box(addx + 1, 1, this->H - 2, this->H - 2, Color(80, 80, 80, 255));
if (this->IsChecked) {
p.Line(addx + this->Padding, this->Padding, addx + this->H - this->Padding, this->H - this->Padding, this->LineSize, this->LineColor);
p.Line(addx + this->H - this->Padding, this->Padding, addx + this->Padding, this->H - this->Padding, this->LineSize, this->LineColor);
}
}
std::string text = this->GetText();
p.Text(text, x, y, this->TextColor);
if (this->Underline) {
if (text.find('\n')) {
int lastindex = 0;
for (unsigned int i = 0; i < text.size(); i++) {
if (text[i] == '\n') {
size = p.GetTextSize(text.substr(lastindex, i - lastindex));
p.Box(x, y, (int)size.X, 1, this->TextColor);
lastindex = i + 1;
}
}
if (lastindex < (int)text.size()) {
size = p.GetTextSize(text.substr(lastindex, (int)text.size() - lastindex));
p.Box(x, y + (int)size.Y, (int)size.X, 1, this->TextColor);
}
} else {
p.Box(x, y, (int)size.X, 1, Color::Black);
}
}
}