コード例 #1
0
void TestScreen::Draw()
{
	glColor4f(1.f,1.f,1.f,1.f);
	glPushMatrix();
	glTranslatef(10.f,(float)GameDisplay::Height() - 10.f,0.f);
	font->Render(testData.c_str());
	glTranslatef(0.f,-15.f,0.f);
	font->Render(testInfo.c_str());
	glBindTexture(GL_TEXTURE_2D, 0);
	glPopMatrix();

	glBegin(GL_LINES);
	glVertex2f(line1Start.X(),line1Start.Y());
	glVertex2f(line1End.X(), line1End.Y());

	glVertex2f(line2Start.X(),line2Start.Y());
	glVertex2f(line2End.X(), line2End.Y());
	glEnd();

	glPushMatrix();
	glTranslatef(circleCenter.X() + sin(circleMod) * 100.f, circleCenter.Y() + cos(circleMod) * 100.f, 0.f);
	glBegin(GL_LINES);
	glVertex2f(-5.f, 0.f);
	glVertex2f(+5.f, 0.f);
	glEnd();
	glPopMatrix();

	glPushMatrix();
	glTranslatef(320.f,40.f,0.f);
	particleEmitter->Draw();
	glPopMatrix();

	glPushMatrix();
	glBegin(GL_TRIANGLES);
	glColor4f(1.f,1.f,1.f,1.f);
	glVertex2f(0.f,100.f);
	glColor4f(0.f,0.f,0.f,1.f);
	glVertex2f(0.f,0.f);
	glColor4f(0.f,0.f,1.f,1.f);
	glVertex2f(100.f,50.f);

	Colour test = Colour(.7f, 1.f, .7f, 1.f);
	glColor4fv(test.RGBA());
	glVertex2f(0.f,100.f);
	glColor4fv(ColourUtils::Invert(test).RGBA());
	glVertex2f(100.f,100.f);
	glColor4fv(ColourUtils::Negative(test).RGBA());
	glVertex2f(50.f,150.f);
	glEnd();
	glPopMatrix();

	GameComponent* gameComponent = gameObject->GetComponent(GCIdType("VisualComponent"));
	VisualComponent* visualComponent = static_cast<VisualComponent*>(gameComponent);
	if (visualComponent)
	{
		visualComponent->Draw();
	}
}
コード例 #2
0
ファイル: Decorator.cpp プロジェクト: z163/GoF23
void Decorator::Draw () {
    _component->Draw();
}