0
MouseState에서 한 번의 클릭 응답을 얻으려면이 줄을 사용합니다.XNA : mouseState의 위치가 중요합니까?
currentMouseState.LeftButton == ButtonState.Pressed && oldMouseState.LeftButton == ButtonState.Released)
그리고 끝 부분에서 마우스 상태를 설정하는이 줄이 있습니다.
oldMouseState = currentMouseState;
위의 줄의 위치는 다중 루프가있는 메서드에서 중요합니까? 이건 :
foreach (blah blah in blahs)
{
if (something is something)
{
if (currentMouseState.LeftButton == ButtonState.Pressed && oldMouseState.LeftButton == ButtonState.Released)
{
do something
}
}
}oldMouseState = currentMouseState;
다른가?
foreach (blah blah in blahs)
{
if (something is something)
{
if (currentMouseState.LeftButton == ButtonState.Pressed && oldMouseState.LeftButton == ButtonState.Released)
{
do something
}
}oldMouseState = currentMouseState;
}
물론 코드를 실행하여 질문의 결과를 조사 할 수는 있습니다. 나에게 아주 분명해 보인다. – MickyD