</p><div>#include "MenuButton.h"</div>
<div>#include "Shapes.h"</div>
<div>#include "VotePage.h"</div>
<div> </div>
<div>#include <iostream></div>
<div> </div>
<div> </div>
<div>MenuButton::MenuButton()</div>
<div>{</div>
<div> //ctor</div>
<div>}</div>
<div> </div>
<div>MenuButton::~MenuButton()</div>
<div>{</div>
<div> //dtor</div>
<div>}</div>
<div> </div>
<div>bool MenuButton::checkMouseCoordinate(float bClickX, float bClickY, sf::RenderWindow &VoteApp, int &buttonSwitch, int &buttonNum , bool is_votePage)</div>
<div>{</div>
<div> </div>
<div> if( bClickX > 25 && bClickX < 222 && bClickY > 642 && bClickY < 721) //button 1, authorized info</div>
<div> {</div>
<div> buttonNum = 1;</div>
<div> buttonSwitch = 1;</div>
<div> shapes_changeColor.ChangeButtonColor(VoteApp,buttonNum);</div>
<div> // shapes_changeColor.setButtonColor(VoteApp,button);</div>
<div> // shapes_changeColor.Draw( VoteApp , button);</div>
<div> }</div>
<div> else if ( bClickX > 228 && bClickX < 429 && bClickY > 642 && bClickY < 721) // button 2, vote candidates</div>
<div> {</div>
<div> buttonNum = 2;</div>
<div> buttonSwitch = 2;</div>
<div> shapes_changeColor.ChangeButtonColor(VoteApp,buttonNum);</div>
<div> // shapes_changeColor.setButtonColor(VoteApp,button);</div>
<div> //shapes_changeColor.Draw( VoteApp, button );</div>
<div> }</div>
<div> else if ( bClickX > 20 && bClickX < 210 && bClickY > 701 && bClickY < 744 && is_votePage == true) //button 3, in vote page when b_votePage == true, back to main button</div>
<div> {</div>
<div> buttonNum = 3;</div>
<div> buttonSwitch = 3;</div>
<div> }</div>
<div> else if ( bClickX > 368 && bClickX < 446 && bClickY > 703 && bClickY < 748 && is_votePage == true) //this in vote page, voteNums</div>
<div> {</div>
<div> buttonNum = 4; </div>
<div> buttonSwitch = 4;</div>
<div> vPage_changeColor.Draw(VoteApp,buttonNum); //if i set the bClicks at any other coordiates on the window than what's stated above, this function can take effect.</div>
<div> </div>
<div> }</div>
<div> else</div>
<div> {</div>
<div> buttonNum = 0;</div>
<div> buttonSwitch = 0;</div>
<div> shapes_changeColor.ChangeButtonColor(VoteApp,buttonNum);</div>
<div> // shapes_changeColor.setButtonColor(VoteApp,button);</div>
<div> // shapes_changeColor.Draw(VoteApp , button);</div>
<div> }</div>
<div>}</div>
<div>Certain mouse position isn't responding to effect.
Started by Meerul264, Jan 16 2013 04:43 AM
2 replies to this topic
#1 Members - Reputation: 121
Posted 16 January 2013 - 04:43 AM
So it only respond to the function effect if it is outside certain coordinate. What's happening?
Others works fine except the range of coordinates I've set here:
</div>
<div>
<div> else if ( bClickX > 368 && bClickX < 446 && bClickY > 703 && bClickY < 748 && is_votePage == true) //this in vote page, voteNums</div>
<div> {</div>
<div> buttonNum = 4; </div>
<div> buttonSwitch = 4;</div>
<div> vPage_changeColor.Draw(VoteApp,buttonNum); //if i set the bClicks at any other coordiates on the window than what's stated above, this function can take effect.</div>
<div> </div>
<div> }</div>
<div>
Ad:







