windows - If Rectangle doesn't Contains Mouse Position -
i have rectangle can touch command below.
if ((mouse.leftbutton == buttonstate.pressed )&& texturerectangle.contains((int)mousepos.x,(int)mousepos.y)) { // action; } but there command "not contains", wanna else if user touch out of "texturerectangle" area?
when click rectangle both actions starts. dont know problem is.
if (mouse.leftbutton == buttonstate.pressed){ if(texturerectangle.contains((int)mousepos.x, (int)mousepos.y)) { music1.play(); } else{ music2.play(); } } my problem music1 , music2 plays @ same time if click on rectangle, want when click on rectangle music1 plays (here problem , both starts play)and when click out of rectangle should start music2 play ( case ok)
i recommend programming book / ebook , start reading it. basic computer logic stuff.
if (mouse.leftbutton == buttonstate.pressed) { if (texturerectangle.contains((int)mousepos.x, (int)mousepos.y)) { // inside } else { // outside } } or
if (mouse.leftbutton == buttonstate.pressed) { if (!texturerectangle.contains((int)mousepos.x, (int)mousepos.y)) { // outside } else { // inside } }
Comments
Post a Comment