Beispiel #1
0
	void UIDropDown::Draw(Render& p) {
		p.Box(0, 0, this->W, this->H, this->BorderColor);
		p.Box(1, 1, this->W - 2, this->H - 2, this->BackColor);

		Vector2 apos = this->GetAbsoluteLocation();
		p.SetDrawingOffset((int)apos.X + 2, (int)apos.Y);
		UILabel::Draw(p);
	}
Beispiel #2
0
	void UIGraph::Draw(Render& p) {
		p.Box(0, 0, this->W, this->H, Color(50, 50, 50, 220));
		p.Box(70, 16, 310, this->H - 16, Color(20, 20, 20, 220));
		p.Box(71, 17, 308, this->H - 18, Color(50, 100, 50, 220));

		unsigned int cats = this->CatNames.size();

		for (unsigned int i = 0; i < cats; i++) {
			if (this->CatNames[i].size() == 0) continue;
			p.Text(this->CatNames[i], 5, 20 + i * 16, this->CatColors[i]);
		}

		p.Text(std::string("Main calls: ") + Utilities::GetNumberPadded((int)Async::CallsToDoOnMainThread.size(), 4, '0'), 75, -2, Color(150, 150, 150, 255));
		p.Text(std::string("Async calls: ") + Utilities::GetNumberPadded((int)Async::CallsToDoOnAsyncThread.size() - (int)Async::CallsToDoOnAsyncThreadIndex, 4, '0'), 240, -2, Color(150, 150, 150, 255));

		p.Text(">15 ms", this->W - 60, 20, Color::White);
		p.Text("8 ms", this->W - 60, 75, Color::White);
		p.Text("<1 ms", this->W - 60, 130, Color::White);

		if (this->Lines.size() >= 308) {
			this->Lines.erase(this->Lines.begin());
		}
		this->Lines.push_back(this->TempData);

		for (unsigned int i = 0; i < cats; i++) {
			this->TempData[i].MS = 0;
		}

		unsigned int linecount = this->Lines.size();
		for (unsigned int line = 0; line < linecount; line++) {
			std::vector<UIGraphLineData>& CatData = this->Lines[line];
			int height = 0;

			unsigned int catcount = CatData.size();
			for (unsigned int cat = 0; cat < catcount; cat++) {
				if (this->CatNames[cat].size() == 0) continue;

				UIGraphLineData& ld = CatData[cat];

				int h = (int)(ld.MS * 8);
				if (height + h > this->H - 18) h = this->H - 18 - height;
				if (h <= 0) continue;

				height += h;
				p.Box(71 + line, this->H - height - 1, 1, h, this->CatColors[ld.Category]);
			}
		}

		for (int i = 0; i < 17; i++) {
			p.Box(71, 20 + 8 * i, 308, 1, i == 0 ? Color(255, 0, 0, 200) : i == 8 ? Color(255, 153, 0, 200) : Color(50, 50, 50, 220));
		}
	}
Beispiel #3
0
	void UITexture::Draw(Render& p) {
		p.Box(0, 0, this->W, this->H, this->BackgroundColor);

		if (this->TextureHandle == 0) return;
		p.SetTexture(this->TextureHandle);
		p.PutTexture(0, 0, (float)this->W, (float)this->H, this->TextureStart.X, this->TextureStart.Y, this->TextureEnd.X, this->TextureEnd.Y, this->DrawColor);
	}
Beispiel #4
0
	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);
			}
		}
	}
Beispiel #5
0
	void UIPanel::Draw(Render& p) {
		p.Box(0, 0, this->W, this->H, this->BorderColor);
		p.Box(1, 1, this->W - 2, this->H - 2, this->BackgroundColor);
	}