Exemple #1
0
void renderDemo(struct NVGcontext* vg, float mx, float my, float width, float height,
				float t, int blowup, struct DemoData* data)
{
	float x,y,popy;

	drawEyes(vg, width - 250, 50, 150, 100, mx, my, t);
	drawParagraph(vg, width - 450, 50, 150, 100, mx, my);
	drawGraph(vg, 0, height/2, width, height/2, t);
	drawColorwheel(vg, width - 300, height - 300, 250.0f, 250.0f, t);

	// Line joints
	drawLines(vg, 50, height-50, 600, 50, t);

	// Line caps
	drawWidths(vg, 10, 50, 30);

	// Line caps
	drawCaps(vg, 10, 300, 30);

	nvgSave(vg);
	if (blowup) {
		nvgRotate(vg, sinf(t*0.3f)*5.0f/180.0f*NVG_PI);
		nvgScale(vg, 2.0f, 2.0f);
	}

	// Widgets
	drawWindow(vg, "Widgets `n Stuff", 50, 50, 300, 400);
	x = 60; y = 95;
	drawSearchBox(vg, "Search", x,y,280,25);
	y += 40;
	drawDropDown(vg, "Effects", x,y,280,28);
	popy = y + 14;
	y += 45;

	// Form
	drawLabel(vg, "Login", x,y, 280,20);
	y += 25;
	drawEditBox(vg, "Email",  x,y, 280,28);
	y += 35;
	drawEditBox(vg, "Password", x,y, 280,28);
	y += 38;
	drawCheckBox(vg, "Remember me", x,y, 140,28);
	drawButton(vg, ICON_LOGIN, "Sign in", x+138, y, 140, 28, nvgRGBA(0,96,128,255));
	y += 45;

	// Slider
	drawLabel(vg, "Diameter", x,y, 280,20);
	y += 25;
	drawEditBoxNum(vg, "123.00", "px", x+180,y, 100,28);
	drawSlider(vg, 0.4f, x,y, 170,28);
	y += 55;

	drawButton(vg, ICON_TRASH, "Delete", x, y, 160, 28, nvgRGBA(128,16,8,255));
	drawButton(vg, 0, "Cancel", x+170, y, 110, 28, nvgRGBA(0,0,0,0));

	// Thumbnails box
	drawThumbnails(vg, 365, popy-30, 160, 300, data->images, 12, t);

	nvgRestore(vg);
}
Exemple #2
0
static void draw_it_core(EyesWidget w)
{
    Window		rep_root, rep_child;
    int			rep_rootx, rep_rooty;
    unsigned int	rep_mask;
    int			dx, dy;
    TPoint		mouse;
    Display		*dpy = XtDisplay (w);
    Window		win = XtWindow (w);

    XQueryPointer (dpy, win, &rep_root, &rep_child,
	    &rep_rootx, &rep_rooty, &dx, &dy, &rep_mask);
    mouse.x = Tx(dx, dy, &w->eyes.t);
    mouse.y = Ty(dx, dy, &w->eyes.t);

    drawEyes(w, mouse);
}
Exemple #3
0
void Enemy::draw(){
	if (life == 3){
		setYellowRubber();
	}
	else if (life == 2){
		setCyanPlastic();
	}
	else if (life == 1){
		setRedPlastic();
	}
	else if (life == 0){
		setObsidian();
	}
	
	glutSolidSphere(1, 15, 13);
	drawEyes();
	drawWings();
}
Exemple #4
0
void App::Draw() {
	SetProjection(fieldWidth, fieldHeight);

	SetTranslate(0, 0);
	progress.Draw();

	if (!progress.IsPaused()) {

		// background

		SetTranslate(0, 0);
		shaker.ApplyMatrix();

		drawTexture(texture, backPos, 0, 100, fieldHeight, 1.0f / 100, 1.0f);
		drawTexture(texture, backPos + 100, 0, 100, fieldHeight, 1.0f / 100, 1.0f);

		// debug data

		SetTranslate(25 - camPos, 0);
		shaker.ApplyMatrix();

		world.DrawDebugData();

		// platforms

		drawTexture(bottom,
					borderBodies[0]->GetPosition().x - 100,
					0,
					200,
					8,
					1.0f / fieldWidth * 3.0f,
					1.0f);
		drawTexture(top,
					borderBodies[1]->GetPosition().x - 100,
					fieldHeight - 13,
					200,
					13,
					1 / fieldWidth * 2.0f,
					1.0f);
		drawTexture(bottom,
					borderBodies[2]->GetPosition().x - 100,
					0,
					200,
					8,
					1.0f / fieldWidth * 3.0f,
					1.0f);
		drawTexture(top,
					borderBodies[3]->GetPosition().x - 100,
					fieldHeight - 13,
					200,
					13,
					1 / fieldWidth * 2.0f,
					1.0f);

		// creature

		drawCreature(playerBodiesPoints, b2Color(playerColorRState, playerColorGState, playerColorBState), 1, playerStatePoint);
		drawEyes(playerEyesBodiesPoints, playerBodiesPoints);

		// numbers

		SetTranslate(0, 0);
		shaker.ApplyMatrix();

		DrawNumber(false,
				   fieldWidth - 5.0f,
				   fieldHeight - 10.0f,
				   1,
				   1.5,
				   progress.GetLevel());
	}
}