Sign in to follow this  

Certain mouse position isn't responding to effect.

This topic is 1826 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

[CODE] 

#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);
    }
}
[/CODE]
 
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:
[CODE]
    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.
 
    }
[/CODE]
 

 

Share this post


Link to post
Share on other sites

This topic is 1826 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this