1
General / [WIN7] Odd problem with std::cout
« on: January 26, 2013, 12:47:29 am »
I'm in an odd situation right now:
Thanks in advance.
//point playerRect at mouse pos
std::cout << mouseX << "\n";
dx = mouseX - playerX;
dy = mouseY - playerY;
trigresult = atan2(dy,dx) * 180/PI;
playerRect.setRotation(trigresult + 90);
For some reason, whenever I comment out the "std::cout << mouseX << "\n"", the trigresult only outputs 90 or -90 degrees with cout(so playerRect is either pointing straight up or straight down). And whenever it is there/isn't commented out, it works correctly and trigresult prints out correct results. Anyone know why this is?std::cout << mouseX << "\n";
dx = mouseX - playerX;
dy = mouseY - playerY;
trigresult = atan2(dy,dx) * 180/PI;
playerRect.setRotation(trigresult + 90);
Thanks in advance.