Jump to content

  • Log In with Google      Sign In   
  • Create Account


Certain mouse position isn't responding to effect.


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Meerul264   Members   -  Reputation: 130

Like
0Likes
Like

Posted 16 January 2013 - 04:43 AM

 
</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>
 
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>
 

 



Sponsor:

#2 MarkS   Prime Members   -  Reputation: 878

Like
1Likes
Like

Posted 16 January 2013 - 09:28 AM

Buttons 3 and 4 overlap buttons 1 and 2.

 

See pic...

Attached Thumbnails

  • Buttons.jpg


#3 Meerul264   Members   -  Reputation: 130

Like
0Likes
Like

Posted 16 January 2013 - 10:40 AM

I see... thanks!






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS