本文整理汇总了C++中window::GetColor方法的典型用法代码示例。如果您正苦于以下问题:C++ window::GetColor方法的具体用法?C++ window::GetColor怎么用?C++ window::GetColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类window
的用法示例。
在下文中一共展示了window::GetColor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bullet
color bullet(window &w, color skycolor, tank &left, tank &right, bool &leftTurn) { // goes through bullets path. returns color of what is hit.
setBrushAndPenColor(w, skycolor); // erasing up top to make sure it doesnt count hitting the text
w.DrawRectangle(0, 0, w.GetWidth(), 200, FILLED);
double dtime = 0.007;
int bulletRadius = 4;
int bulletX, bulletY;
double radianAngle;
tank ¤tTank = leftTurn ? left : right;
int angle = currentTank.getAngle();
if (leftTurn) {
radianAngle = angle * cdPi / 180;
bulletX = currentTank.getXend() + 3;
} else {
radianAngle = ((180 - angle) * cdPi / 180);
bulletX = currentTank.getXend() - 3;
}
int velocity = currentTank.getSpeed();
bulletY = currentTank.getYend() - 3;
leftTurn = !leftTurn;
double xVel = cos(radianAngle) * velocity;
double yVel = sin(radianAngle) * velocity;
double time = 0;
while (w.GetColor(bulletX, bulletY) == skycolor) {
setBrushAndPenColor(w, BLACK);
w.DrawCircle(bulletX, bulletY, bulletRadius, FILLED);
w.UpdateBuffer();
Sleep(1);
setBrushAndPenColor(w, skycolor);
w.DrawCircle(bulletX, bulletY, bulletRadius + 1, FILLED);
time += dtime;
bulletX += xVel * time;
bulletY += -yVel * time + 40 * time * time;
}
return w.GetColor(bulletX, bulletY);
}