本文整理汇总了C++中core::Graphics类的典型用法代码示例。如果您正苦于以下问题:C++ Graphics类的具体用法?C++ Graphics怎么用?C++ Graphics使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Graphics类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
}
示例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);
}
}
}
示例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);
}
示例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());
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
}
示例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);
}
示例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));
}
示例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());
}
}
}