I made this thing as a part of my program. Language is C++, with Allegro libraries. I want to make it do the next: when clicking, a border appears around one of the two rectangulars.
It happens, but only once, at the beginning. After that, the border disappears all the time when I move the mouse away. Also, anywhere I click, the border appears on the proper place.
mouseX and mouseY works perfectly, even the numbers are the same. But the action happens only once on the way I want. How to expand it to every cases when I'm clicking?
if(asd.type == ALLEGRO_EVENT_MOUSE_AXES)
{
mouseX = asd.mouse.x;
mouseY = asd.mouse.y;
}
if(asd.type == ALLEGRO_EVENT_MOUSE_BUTTON_DOWN)
{
if(asd.mouse.button & 1)
{
if (mouseX > 592 && mouseX < 608 && mouseY > 540 && mouseY < 556)
{
Chosen_Cell = 1;
borderX = 592;
borderY = 540;
}
if (mouseX > 592 && mouseX < 608 && mouseY > 556 && mouseY < 562)
{
Chosen_Cell = 2;
borderX = 592;
borderY = 556;
}
al_draw_rectangle(borderX, borderY, borderX + 16, borderY + 16, al_map_rgb(255, 255, 0),2);
if (16 < mouseX && mouseX < 528 && 16 < mouseY &&mouseY < 736)
{
switch (Chosen_Cell)
{
//blahblah, not important
}
}
}
}