예제 #1
0
파일: main.cpp 프로젝트: Fietsemaker/GuiX
void DemoWindow::Tick(float dt)
{
	GxInput* input = GxInput::Get();
	GxDraw* draw = GxDraw::Get();

	int w = mySize.x;
	int h = mySize.y;

	// Draw the background image.
	myBackground.Draw(0, 0);

	// Check if the style dialog has returned a result.
	// If so, we can move on to the next part and create the demo form.
	if(myStyleList && myStyleAccepted == true)
		CreateDemoForm();

	// Draw letterbox bars at the top and bottom of the window.
	GxColor color = GxStyle::Get()->c.bgPanel;
	GxColor outline = GxStyle::Get()->c.frameOutline;

	draw->Rect(0, 0, w, 26, outline);
	draw->Rect(0, 0, w, 25, color);

	draw->Rect(0, h - 26, w, 26, outline);
	draw->Rect(0, h - 25, w, 25, color);

	// Tick and draw the gui context.
	myContext->SetView(0, 0, w, h);
	myContext->Tick(dt);
	myContext->Draw();
	
	// Draw the instruction text.
	myText.SetColor(GxStyle::Get()->d.text[0].top);
	myText.Draw(w/2, h - 14, "GuiX gui demo");
}
예제 #2
0
파일: wDock.cpp 프로젝트: jpvanoosten/GuiX
void GxDockArea::Draw()
{
	GxDraw* draw = GxDraw::Get();

	// Draw the dock bars.
	for(int i=0; i<binCount; ++i)
	if(myBins[i])
		myBins[i]->Draw();

	// Draw the floating docks.
	for(int i=0; i<myDocks.Size(); ++i)
		if(myDocks[i]->IsFloating() && !myDocks[i]->IsHidden())
			myDocks[i]->Draw();

	// Draw docking area highlights.
	if(myDragHl > 0.01f)
	{
		GxVec2i mpos = GxInput::Get()->GetMousePos();
		int hl = myGetBinAt(mpos.x, mpos.y);
		if(myActionType != FA_DRAG) hl = -1;

		for(int i=0; i<binCount; ++i)
		if(myBins[i])
		{
			GxRecti r = myBins[i]->myRect;
			GxColor c(128, 128, (hl == i) ? 160 : 128, 0);
			draw->Rect(r.x, r.y, r.w, r.h, c.Alpha(myDragHl * 0.5f));
			r.Shrink(1);
			draw->Rect(r.x, r.y, r.w, r.h, c.Alpha(myDragHl * 0.2f));
		}
	}
}
예제 #3
0
파일: wDock.cpp 프로젝트: jpvanoosten/GuiX
void GxDockBin::Draw()
{
	GxDraw* draw = GxDraw::Get();
	GxStyle& style = *GxStyle::Get();

	bool empty = true;
	const GxWidget* const* docks = myLayout.GetWidgets().Data();
	for(int i=0; empty && i<myLayout.GetWidgets().Size(); ++i)
		if(!docks[i]->IsHidden()) empty = false;

	if(!empty)
	{
		GxRecti r(myRect);

		draw->Rect(r.x, r.y, r.w, r.h, style.c.frameOutline);
		r.Shrink(1);
		draw->Rect(r.x, r.y, r.w, r.h, style.c.bgPanel);

		if(!myScrollbar->IsHidden())
			myScrollbar->Draw();

		draw->PushScissorRect(r.x, r.y, r.w, r.h);
		myLayout.Draw();
		draw->PopScissorRect();
	}	
}
예제 #4
0
void GxSeperatorV::Draw()
{
	GxDraw* draw = GxDraw::Get();
	GxStyle& style = *GxStyle::Get();

	draw->Rect(myRect.x, myRect.y+1, 1, myRect.h-2, style.c.frameOutline, style.c.frameOutEmboss[1]);
}
예제 #5
0
void GxColorEdit::Draw()
{
	GxExpandingButton::Draw();

	GxDraw* draw = GxDraw::Get();
	GxStyle& style = *GxStyle::Get();

	GxRecti r = myRect;

	// Draw the preview color.
	r.Shrink(3, 3, myButtonW + 3, r.h - myButtonH + 3);
	draw->Rect(r.x, r.y, r.w, r.h, style.c.frameOutline);

	r.Shrink(1);
	GxVec4f colf = GetSliderColor(mySliders);
	GxColor col(colf.x, colf.y, colf.z, colf.w);
	draw->Rect(r.x, r.y, r.w, r.h, col);
	if(col.a < 255)
		draw->Rect(r.x, r.y, r.w/2, r.h, col.Alpha(255));
}
예제 #6
0
void GxSelectList::Draw()
{
	GxDraw* draw = GxDraw::Get();
	GxStyle& style = *GxStyle::Get();

	float hl = GetHighlightValue();
	bool lock = IsLockedWidget();

	// Draw the list rectangle
	GxRecti bar(myRect);
	if(!myScrollbar->IsHidden())
		bar.w -= 16;
	style.Field(bar);

	// Draw the scrollbar
	if(!myScrollbar->IsHidden())
		myScrollbar->Draw();

	// Draw the list of items
	draw->PushScissorRect(bar.x+2, bar.y+2, bar.w-4, bar.h-4);

	GxRecti viewRect = draw->GetScissorRect();
	GxRecti listR = myGetListRect();

	int ox = 2;
	GxText& settings = style.d.text[0];
	settings.maxWidth = listR.w - ox*2;
	settings.SetAlign(myAlignH, GX_TA_MIDDLE);
	if(myAlignH == GX_TA_CENTER) ox = listR.w/2;
	else if(myAlignH == GX_TA_RIGHT) ox = listR.w - ox;

	for(int i=0; i<myItems.Size(); ++i)
	{
		GxRecti r(listR.x, listR.y + i*16, listR.w, 16);
		if(r.y < viewRect.y+viewRect.h && r.y+r.h > viewRect.y)
		{
			if(i == mySelectedItem)
				draw->Rect(r.x, r.y, r.w, r.h, style.c.textSelect);
			else if(i == myMouseOverItem)
				draw->Rect(r.x, r.y, r.w, r.h, style.c.textSelect.Alpha(hl * 0.5f));
			settings.Draw(r.x + ox, r.y+r.h/2-2, myItems[i]);
		}
	}

	settings.SetMaxWidth();

	draw->PopScissorRect();
}