• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ core::Graphics类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中core::Graphics的典型用法代码示例。如果您正苦于以下问题:C++ Graphics类的具体用法?C++ Graphics怎么用?C++ Graphics使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Graphics类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: Draw

void XWing::Draw(Core::Graphics& g)
{
	g;
	if(!isDead)
	{
		const unsigned int NUM_POINTS = sizeof(XWingPoints) / sizeof(*XWingPoints);
		for(unsigned int i = 0;i < NUM_POINTS - 1;i++)
		{
			Vector3D currentPoint = Vector3D(XWingPoints[i].x, XWingPoints[i].y) * scalar;
			Vector3D nextPoint = Vector3D(XWingPoints[(i+1) % NUM_POINTS].x, XWingPoints[(i+1) % NUM_POINTS].y) * scalar;

			const Vector3D& p1 = matrix * currentPoint + position;
			const Vector3D& p2 = matrix * nextPoint + position;

			g.DrawLine(p1.x, p1.y, p2.x, p2.y);
		}
		for(unsigned int i = NUM_POINTS - 1;i > 0;i--)
		{
			Vector3D currentPoint = Vector3D(-XWingPoints[i].x, XWingPoints[i].y) * scalar;
			Vector3D nextPoint = Vector3D(-XWingPoints[(i-1) % NUM_POINTS].x, XWingPoints[(i-1) % NUM_POINTS].y) * scalar;

			const Vector3D& p1 = matrix * currentPoint + position;
			const Vector3D& p2 = matrix * nextPoint + position;

			g.DrawLine(p1.x, p1.y, p2.x, p2.y);
		}
		if(state == GAME)
		{
			hb.Draw(g);
		}
	}
}
开发者ID:JohnR31415,项目名称:Star_Wars_Asteroid_game,代码行数:32,代码来源:XWing.cpp


示例2: Draw

void VictoryScreen::Draw(Core::Graphics& graphics)
{
	graphics.DrawString((int)SCREEN_WIDTH / 2 - 15, (int)SCREEN_HEIGHT / 2,"YOU WON");
	graphics.DrawString((int)SCREEN_WIDTH / 2 - 190, (int)SCREEN_HEIGHT / 2 + 10,"Press R To Go Back To The Intro Screen Or Escape To Quit");
	graphics.DrawString((int)SCREEN_WIDTH / 2 - 22, (int)SCREEN_HEIGHT / 2 + 20,"Score: ");
	util.DrawValue(graphics,(int)SCREEN_WIDTH / 2 + 22, (int)SCREEN_HEIGHT / 2 + 20, score);
}
开发者ID:RPMiller,项目名称:CSC190Ryan_Miller,代码行数:7,代码来源:VictoryScreen.cpp


示例3: Draw

void IntroScreen::Draw(Core::Graphics& graphics)
{
	graphics.DrawString((int)SCREEN_WIDTH / 2 - 40,(int)SCREEN_HEIGHT / 5, "Press F To Begin");
	graphics.DrawString((int)SCREEN_WIDTH / 2 - 42,(int)SCREEN_HEIGHT / 5 + 10, "Press ESC To Quit");
	graphics.DrawString((int)SCREEN_WIDTH / 2 - 30, 0,"High Score: ");
	util.DrawValue(graphics,(int)SCREEN_WIDTH / 2 + 55, 0, score);
	hero->Draw(graphics);
}
开发者ID:RPMiller,项目名称:CSC190Ryan_Miller,代码行数:8,代码来源:IntroScreen.cpp


示例4: draw

void Walls::draw(Core::Graphics& g)
{
	g.SetColor(RGB(255, 100, 255));
	for(unsigned int i = 0; i< NUM_WALL_POINTS; i++)
	{
		const Vector3D& w1 = *wallShape[i];
		const Vector3D& w2 = *wallShape[(i+1) % NUM_WALL_POINTS];
		g.DrawLine(w1.x, w1.y, w2.x, w2.y);
	}
}
开发者ID:tmgarcia,项目名称:CPPGameEngine,代码行数:10,代码来源:Walls.cpp


示例5: DebugFrameMemory

void GameplayFrame::DebugFrameMemory(Core::Graphics& graphics)
{
	graphics.SetColor(RGB(255,255,255));
	_CrtMemState myState;
	_CrtMemCheckpoint(&myState);
	myState.lCounts;
	char buf[50];
	sprintf_s(buf, "Current count: %i", myState.lCounts[_CLIENT_BLOCK]);
	graphics.DrawString(20, 870, buf);
	sprintf_s(buf, "Current size: %i", myState.lSizes[_CLIENT_BLOCK]);
	graphics.DrawString(20, 890, buf);
	sprintf_s(buf, "Current HighWaterCount: %i", myState.lHighWaterCount);
	graphics.DrawString(20, 910, buf);
}
开发者ID:david-ericson,项目名称:Portfolio,代码行数:14,代码来源:GameplayFrame.cpp


示例6: Draw

	void ParticleEffect::Draw(Core::Graphics& graphics)
	{
		graphics.SetColor(WHITE);
		for (unsigned int i = 0; i < numberofParticles; i++)
		{
			Engine::Vector2 draws[] = 
			{
				Engine::Vector2(1, 0) + particleList[i]->getPosition(),
				Engine::Vector2(0, 1) + particleList[i]->getPosition()
			};
			graphics.SetColor(particleList[i]->getColor());
			graphics.DrawLines(1, *draws);
		}
	}
开发者ID:pokelege,项目名称:GeometryWars,代码行数:14,代码来源:ParticleEffect.cpp


示例7: draw

void EnemyShip::draw(Core::Graphics& g)
{
	const int numShippoints= sizeof(lerper)/sizeof(*lerper);
	Matrix3 rotato=rotato.rotate(angle);
	g.SetColor(RGB(200,100,100));
	if(!dead)
	{
		for(int i=0;i<numShippoints;i++)
		{

			const Vector2d& s1=rotato*lerper[i]+position;
			const Vector2d& s2=rotato*lerper[(i+1)%numShippoints]+position;
			g.DrawLine(s1.x,s1.y,s2.x,s2.y);
		}
	}
}
开发者ID:tiliff,项目名称:Projectgit,代码行数:16,代码来源:EnemyShip.cpp


示例8: Draw

void Draw(Core::Graphics& graphics){
	if (isEditingSpaceship){
		editor.Draw(graphics);
	}
	else{
		graphics.SetColor(defaultColor);

		if(!isMainMenu && !isControls){
			{
				PROFILE("LevelDraw");
				lvl.Draw(graphics);
			}
			{
				PROFILE("ParticlesDraw");
				manager->Draw(graphics);
			}
		}
		else if (isControls){
			Controls::Draw(graphics);
		}
		else{
			menu.Draw(graphics);
		}
	}

	Debug::DrawMemoryState(graphics, SCREEN_HEIGHT);
}
开发者ID:nickredmond,项目名称:CSC190Nick_Redmond,代码行数:27,代码来源:main.cpp


示例9: drawValue

void DrawValue::drawValue(Core::Graphics& graphics, int x, int y, float num)
{
	stringstream ss;
	ss << num;

	graphics.DrawString(x, y, ss.str().c_str());
}
开发者ID:BrettWatson,项目名称:CSC190_bwatson,代码行数:7,代码来源:DrawValue.cpp


示例10: DrawDiagonalBar

void Upgrade::DrawDiagonalBar(Core::Graphics& graphics, float thickness, Vector2D endPosition, Vector2D startPosition)
{
	for(int i=0; i<thickness; i++)
	{
		Vector2D start(startPosition.x, startPosition.y + i);
		Vector2D end(endPosition.x, endPosition.y + i);
		graphics.DrawLine(start.x, start.y, end.x, end.y);
	}
}
开发者ID:david-ericson,项目名称:Portfolio,代码行数:9,代码来源:Upgrade.cpp


示例11: DrawVerticalBar

void Upgrade::DrawVerticalBar(Core::Graphics& graphics, float thickness, float size, Vector2D startPosition)
{
	for(int i=0; i<thickness; i++)
	{
		Vector2D start(startPosition.x + i, startPosition.y);
		Vector2D end(startPosition.x + i, startPosition.y+size);
		graphics.DrawLine(start.x, start.y, end.x, end.y);
	}
}
开发者ID:david-ericson,项目名称:Portfolio,代码行数:9,代码来源:Upgrade.cpp


示例12: DrawGraphicPoints

void Upgrade::DrawGraphicPoints(Core::Graphics& graphics, Vector2D* points, int numPoints)
{
	for(int i=0; i<numPoints; i++)
		{
			if(i+1 < numPoints)
			{
				Vector2D start =  points[i]+position;
				Vector2D end =  points[i+1]+position;
				graphics.DrawLine(start.x, start.y, end.x, end.y);
			}
			else
			{
				Vector2D start = points[i]+position;
				Vector2D end = points[0]+position;
				graphics.DrawLine(start.x, start.y, end.x, end.y);
			}
		}
}
开发者ID:david-ericson,项目名称:Portfolio,代码行数:18,代码来源:Upgrade.cpp


示例13: DrawUpgrade

void Upgrade::DrawUpgrade(Core::Graphics& graphics, Vector2D mouse, float thickness)
{
	myColor = (CheckMouse(mouse))? RGB(134, 134, 134): RGB(94,94,94);
	
	if(upgradeCooldown < .5)
	{
		upgradeCooldown += .016f;
	}
	graphics.SetColor(myColor);
	for(int i=0; i<BOX_SIZE; i++)
	{
		Vector2D start(position.x + i, position.y);
		Vector2D end(position.x + i, position.y+BOX_SIZE);
		graphics.DrawLine(start.x, start.y, end.x, end.y);
	}
	if(CheckMouse(mouse))
	{
		viewText(graphics);
		if(Core::Input::IsPressed(Core::Input::BUTTON_LEFT)&&upgradeCooldown >= .5f && myCash.getCash() >= upgradeCost && upgradeCount < 5)
		{
			upgradeCooldown = 0;
			myCash.decreaseCash(upgradeCost);
			upgradeCount++;
		}
	}
	SetUpgradeCost();
	DrawGraphic(graphics);
	graphics.SetColor(RGB(255,255,255));
	if(upgradeCount > 4)
	{
		graphics.SetColor(RGB(255,0,0));
	}
	//Draws $
	DrawHorizontalBar(graphics, thickness, Letter_Size, Vector2D(costPosition.x, costPosition.y+thickness/2));
	DrawVerticalBar(graphics, thickness, (Letter_Size-3*thickness)/2, Vector2D(costPosition.x, costPosition.y + thickness));
	DrawHorizontalBar(graphics, thickness, Letter_Size, Vector2D(costPosition.x, costPosition.y+thickness+((Letter_Size-3*thickness)/2)));
	DrawVerticalBar(graphics, thickness,(Letter_Size-3*thickness)/2, Vector2D(costPosition.x+(Letter_Size-thickness), costPosition.y + thickness*2+((Letter_Size-3*thickness)/2)));
	DrawHorizontalBar(graphics, thickness, Letter_Size, Vector2D(costPosition.x, costPosition.y+2*thickness + (2*((Letter_Size-3*thickness)/2)-thickness/2)));
	DrawVerticalBar(graphics, thickness, Letter_Size, Vector2D(costPosition.x+(Letter_Size/2.5f), costPosition.y));
	//Draws Cost
	DrawLetters(graphics, thickness);
}
开发者ID:david-ericson,项目名称:Portfolio,代码行数:42,代码来源:Upgrade.cpp


示例14: draw

void Grid::draw(Core::Graphics& g)
{
	for(int i = 0; i<numRows; i++)
	{
		for(int j = 0; j<numColumns; j++)
		{
			cells[i][j].draw(g);
		}
	}
	if(enemies.numActiveTroops==0)
	{
		g.SetColor(RGB(50,255,50));
	}
	else
	g.SetColor(RGB(200,50,50));
	g.DrawString((int)(cells[9][0].position.x+(cells[9][0].width/2))-30,(int)(cells[9][0].position.y+(cells[9][0].height/2))-10, "COMPILE");
	g.DrawLine(cells[9][0].position.x, cells[9][0].position.y, cells[9][0].position.x+cells[9][0].width, cells[9][0].position.y);
	g.DrawLine(cells[9][0].position.x+cells[9][0].width, cells[9][0].position.y, cells[9][0].position.x+cells[9][0].width, cells[9][0].position.y+cells[9][0].height);
	enemies.draw(g, Vector3D(100,100));
}
开发者ID:tmgarcia,项目名称:CPPGameEngine,代码行数:20,代码来源:Grid.cpp


示例15: DrawValue

void DrawValue(Core::Graphics& graphics, int x, int y, Matrix3 mat) {
	mat;
	for(int i = 0; i < 3; i++){
		for(int j = 0; j < 3; j++){
			stringstream ss;
			ss.precision(5);
			ss << mat.mat[j][i];
			graphics.DrawString(x + i * 75, y + j * 12, ss.str().c_str());
		}
	}
}
开发者ID:genun,项目名称:Malmrose_Vincent_LearningAI,代码行数:11,代码来源:DrawV.cpp


示例16: DrawGraphic

void Upgrade::DrawGraphic(Core::Graphics& graphics)
{
	if(type==armor)
	{
		graphics.SetColor(RGB(255,242,59));
		DrawGraphicPoints(graphics, armorGraphic, armorSize);
	}
	else if(type==fuel)
	{
		graphics.SetColor(RGB(219,65,31));
		DrawGraphicPoints(graphics, fuelGraphic, fuelSize);
	}
	else if(type == health)
	{
		graphics.SetColor(RGB(103, 219, 31));
		DrawGraphicPoints(graphics, healthGraphic, healthSize);
	}
	else if(type == bullet)
	{
		graphics.SetColor(RGB(46, 46, 46));
		DrawGraphicPoints(graphics, bulletGraphic, bulletSize);
	}
}
开发者ID:david-ericson,项目名称:Portfolio,代码行数:23,代码来源:Upgrade.cpp


示例17: Draw

void Lerper::Draw(Core::Graphics& graphics)
{
	const unsigned int NUM_LINES = sizeof(Lerp) / sizeof(*Lerp);

	graphics.SetColor(RGB(255,100,0));
	for(unsigned int i = 0; i < NUM_LINES; i++)
	{
		const Vector2D& first = Lerp[i] + position;
		const Vector2D& second = Lerp[(i+1) % NUM_LINES] + position;

		graphics.DrawLine(first.vector_x, first.vector_y, second.vector_x, second.vector_y);
	}

	const unsigned int LERP_NUM_LINES = sizeof(LerpLines) / sizeof(*LerpLines);

	graphics.SetColor(RGB(255,100,100));
	for(unsigned int i = 0; i < LERP_NUM_LINES; i++)
	{
		const Vector2D& first = LerpLines[i];
		const Vector2D& second = LerpLines[(i+1) % LERP_NUM_LINES];

		graphics.DrawLine(first.vector_x, first.vector_y, second.vector_x, second.vector_y);
	}
}
开发者ID:BrettWatson,项目名称:CSC190_bwatson,代码行数:24,代码来源:Lerper.cpp


示例18: Draw

void EnemyShip::Draw(Core::Graphics& graphics)
{
	RGB from = ALIEN;
	RGB to = BLACK;
	float percent = 1 - (life / originalLife);
	graphics.SetColor(RGB(((GetRValue(to) - GetRValue(from)) * percent) + GetRValue(from),
		((GetGValue(to) - GetGValue(from)) * percent) + GetGValue(from),
		((GetBValue(to) - GetBValue(from)) * percent) + GetBValue(from)));

	//graphics.SetColor(ALIEN);

	Engine::Matrix3 transformations = Engine::Matrix3::Translation(shipPosition) * Engine::Matrix3::rotation(shipRotation);

	frame.draw(graphics, transformations);

	turret.draw(graphics, shipPosition);
}
开发者ID:pokelege,项目名称:GeometryWars,代码行数:17,代码来源:EnemyShip.cpp


示例19: draw

void Bullet::draw(Core::Graphics& g)
{
	position = position + (velocity * Dt);
	if((position.X < 0 || position.X > 1000) && (position.Y > 1900 || position.Y < 0))
	{
		canBeDrawn = false;
	}

	if(canBeDrawn)
	{
		for(unsigned int i = 0; i < bulletShape.numOfPoints; i++)
		{
			const Vector2& first = position + (transformationMatrix * bulletShape.shapePoints[i]);
			const Vector2& second = position + (transformationMatrix *bulletShape.shapePoints[(i + 1) % bulletShape.numOfPoints]);
			g.DrawLine(first.X, first.Y, second.X, second.Y);
		}
	}
}
开发者ID:christian-lang-2012,项目名称:csc190ChristianLang,代码行数:18,代码来源:Bullet.cpp


示例20: drawAt

// Only used for tracing
void Window::drawAt(Core::Graphics& g, Vector offset)
{
	g.SetColor(RGB(255, 0, 0)); 
	box.drawAt(g, offset);
	deadzone.drawAt(g, offset);
}
开发者ID:Tahler,项目名称:DigDugPP,代码行数:7,代码来源:Window.cpp



注:本文中的core::Graphics类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ core::ICore类代码示例发布时间:2022-05-31
下一篇:
C++ core::FilePath类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap