예제 #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);
	}
예제 #2
0
	void UIManager::Draw(Render& r) {
		this->ShowCursor = this->OverrideShowCursor;

		r.SetDrawingOffset(0, 0);

		for (unsigned int i = 0; i < this->Children.size(); i++) {
			this->Children[i]->_InternalDraw(r);
		}
	}
예제 #3
0
파일: UIBase.cpp 프로젝트: edunad/TomatoLib
	void UIBase::_InternalDraw(Render& drawer) {
		if (!this->ShouldRender) return;

		Vector2 oldoffset = drawer.GetDrawingOffset();
		Vector2 pos = this->GetAbsoluteLocation();

		drawer.SetDrawingOffset((int)pos.X, (int)pos.Y);
		drawer.EnableClipping((int)pos.X, (int)pos.Y, this->W, this->H);

		bool recorderstarted = false;
		if (this->ShouldRedraw) {
			drawer.RecorderStart();
			recorderstarted = true;
		}
		
		if (!this->Frozen && (this->ShouldRedraw || this->AlwaysRedraw)) {
			this->OnDraw(drawer);
		} else if(this->Buffer != nullptr) {
			drawer.Buffer(this->Buffer);
		}

		if (recorderstarted) {
			if (this->Buffer != nullptr) delete this->Buffer;
			this->Buffer = drawer.RecorderStop();
			this->ShouldRedraw = false;
		}

		for (unsigned int i = 0; i < this->Children.size(); i++) {
			UIBase* p = this->Children[i];
			Vector2 pos2 = p->GetAbsoluteLocation();
			if (pos2.X + p->W < drawer._ClippingPos.X) continue;
			if (pos2.Y + p->H < drawer._ClippingPos.Y) continue;

			if (pos2.X > drawer._ClippingPos.X + drawer._ClippingSize.X) continue;
			if (pos2.Y > drawer._ClippingPos.Y + drawer._ClippingSize.Y) continue;

			p->_InternalDraw(drawer);
		}

		drawer.SetDrawingOffset((int)oldoffset.X, (int)oldoffset.Y);
		drawer.DisableClipping();
	}