UPDATED
I forgor 💀 to change the tabs to spaces.
This commit is contained in:
parent
09e717f0f3
commit
19da1b4430
|
|
@ -36,7 +36,7 @@ int main(void)
|
||||||
|
|
||||||
int btnState = 0; // Button state: 0-NORMAL, 1-MOUSE_HOVER, 2-PRESSED
|
int btnState = 0; // Button state: 0-NORMAL, 1-MOUSE_HOVER, 2-PRESSED
|
||||||
bool btnAction = false; // Button action should be activated
|
bool btnAction = false; // Button action should be activated
|
||||||
bool btnPressed = false; // Check if button has been actually pressed
|
bool btnPressed = false; // Check if button has been actually pressed
|
||||||
|
|
||||||
Vector2 mousePoint = { 0.0f, 0.0f };
|
Vector2 mousePoint = { 0.0f, 0.0f };
|
||||||
|
|
||||||
|
|
@ -50,7 +50,7 @@ int main(void)
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
mousePoint = GetMousePosition();
|
mousePoint = GetMousePosition();
|
||||||
btnAction = false;
|
btnAction = false;
|
||||||
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT) && CheckCollisionPointRec(mousePoint, btnBounds)) btnPressed = true;
|
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT) && CheckCollisionPointRec(mousePoint, btnBounds)) btnPressed = true;
|
||||||
|
|
||||||
// Check button state
|
// Check button state
|
||||||
if (CheckCollisionPointRec(mousePoint, btnBounds))
|
if (CheckCollisionPointRec(mousePoint, btnBounds))
|
||||||
|
|
@ -59,18 +59,18 @@ int main(void)
|
||||||
else btnState = 1;
|
else btnState = 1;
|
||||||
|
|
||||||
if (btnPressed && IsMouseButtonReleased(MOUSE_BUTTON_LEFT))
|
if (btnPressed && IsMouseButtonReleased(MOUSE_BUTTON_LEFT))
|
||||||
{
|
{
|
||||||
btnAction = true;
|
btnAction = true;
|
||||||
btnPressed = false;
|
btnPressed = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (btnPressed)
|
else if (btnPressed)
|
||||||
{
|
{
|
||||||
btnAction = true;
|
btnAction = true;
|
||||||
btnState = 0;
|
btnState = 0;
|
||||||
btnPressed = false;
|
btnPressed = false;
|
||||||
}
|
}
|
||||||
else btnState = 0;
|
else btnState = 0;
|
||||||
|
|
||||||
if (btnAction)
|
if (btnAction)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user