本文整理汇总了C++中Vector2::RotateAround方法的典型用法代码示例。如果您正苦于以下问题:C++ Vector2::RotateAround方法的具体用法?C++ Vector2::RotateAround怎么用?C++ Vector2::RotateAround使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vector2
的用法示例。
在下文中一共展示了Vector2::RotateAround方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
sprite->Fade(lyricInfos[i].timing - mspb * 1.5, lyricInfos[i].timing, 0.0, 1.0);
}
// Ignore calculations for first lyric
if (i == 0) {
continue;
}
bool foundMatch = false;
while (!foundMatch) {
// First rotation to decide where to place
degrees = rand() % 360;
double radians = degrees * M_PI / 180.0;
Vector2 move(cos(radians), sin(radians));
// Second rotation that rotates everything around center
degrees = rand() % 90 - 45;
double rotation = degrees * M_PI / 180.0;
// Find distance to move previous sprite, push out
// Set distance as minimum of width and height
double distance = fmin(fmin(sprite->size.x, sprite->size.y),
fmin(previous->size.x, previous->size.y));
Sprite s1 = *sprite;
// Copy
Sprite s2 = *previous;
while (collision(s1, s2)) {
++distance;
s2 = *previous;
s2.position += move * distance;
s2.position.RotateAround(mid, rotation);
s2.rotation += rotation;
}
move *= distance;
// Check if all previous collisions are fine
for (int j = i - 1; j >= 0; --j) {
// Copy since there could be errors here
// and we don't want to make lasting changes
Sprite old = *lyrics[j];
old.position += move;
old.position.RotateAround(mid, rotation);
old.rotation += rotation;
if (collision(s1, old)) {
break;
}
else if (j == 0) {
foundMatch = true;
}
}
// If collisions are fine, then move everything
if (foundMatch) {
std::wcout << "Found Match" << std::endl;
int lyricTime = lyricInfos[i].timing;
int startTime = lyricTime - mspb * 1.5;
int endTime;
if (i < lyricInfos.size() - 1) {
endTime = lyricInfos[i + 1].timing - mspb * 1.5;