Jump to content
  • Advertisement
Sign in to follow this  
Meerul264

Certain mouse position isn't responding to effect.

This topic is 2078 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

 

#include "MenuButton.h"
#include "Shapes.h"
#include "VotePage.h"
 
#include <iostream>
 
 
MenuButton::MenuButton()
{
    //ctor
}
 
MenuButton::~MenuButton()
{
    //dtor
}
 
bool MenuButton::checkMouseCoordinate(float bClickX, float bClickY, sf::RenderWindow &VoteApp, int &buttonSwitch, int &buttonNum , bool is_votePage)
{
 
    if( bClickX > 25 && bClickX < 222 && bClickY > 642 && bClickY < 721)  //button 1, authorized info
    {
        buttonNum = 1;
        buttonSwitch = 1;
        shapes_changeColor.ChangeButtonColor(VoteApp,buttonNum);
       // shapes_changeColor.setButtonColor(VoteApp,button);
       // shapes_changeColor.Draw( VoteApp , button);
    }
    else if ( bClickX > 228 && bClickX < 429 && bClickY > 642 && bClickY < 721)  // button 2, vote candidates
    {
        buttonNum = 2;
        buttonSwitch = 2;
        shapes_changeColor.ChangeButtonColor(VoteApp,buttonNum);
       // shapes_changeColor.setButtonColor(VoteApp,button);
        //shapes_changeColor.Draw( VoteApp, button );
    }
    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
    {
        buttonNum = 3;
        buttonSwitch = 3;
    }
    else if ( bClickX > 368 && bClickX < 446 && bClickY > 703 && bClickY < 748 && is_votePage == true) //this in vote page, voteNums
    {
        buttonNum = 4; 
        buttonSwitch = 4;
        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.
 
    }
    else
    {
        buttonNum = 0;
        buttonSwitch = 0;
        shapes_changeColor.ChangeButtonColor(VoteApp,buttonNum);
       // shapes_changeColor.setButtonColor(VoteApp,button);
       // shapes_changeColor.Draw(VoteApp , button);
    }
}
 
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:
    else if ( bClickX > 368 && bClickX < 446 && bClickY > 703 && bClickY < 748 && is_votePage == true) //this in vote page, voteNums
    {
        buttonNum = 4; 
        buttonSwitch = 4;
        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.
 
    }
 

 

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!