本文整理汇总了C++中Objects::Color方法的典型用法代码示例。如果您正苦于以下问题:C++ Objects::Color方法的具体用法?C++ Objects::Color怎么用?C++ Objects::Color使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Objects
的用法示例。
在下文中一共展示了Objects::Color方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Interaction
//Function that checks if there was a interaction between 2 rect
bool Interaction(Objects &alfa, Objects &beta) {
float distance;
POINT totalSpeed;
//Checks the distance between the rect
distance = sqrt( pow(alfa.center.x-beta.center.x,2) + pow(alfa.center.y-beta.center.y,2) );
if ( distance < 45 )
{
//Calculates total speed and divides it equaly between the rect
totalSpeed.x = (abs(alfa.xSpeed) + abs(beta.xSpeed))/2;
totalSpeed.y = (abs(alfa.ySpeed) + abs(beta.ySpeed))/2;
//Gives the rect a new direction and rect
alfa.Accelerate(-alfa.xSpeed*totalSpeed.x/abs(alfa.xSpeed), -alfa.ySpeed*totalSpeed.y/abs(alfa.ySpeed));
beta.Accelerate(-beta.xSpeed*totalSpeed.x/abs(beta.xSpeed), -beta.ySpeed*totalSpeed.y/abs(beta.ySpeed));
//Changes the color of one of the rect on interaction in light green
alfa.Color(RGB(15,255,50));
}
return TRUE;
}