This commit is contained in:
Ray 2022-03-24 11:44:52 +01:00
parent 65f28460a1
commit ca12ef48e9

View File

@ -41,8 +41,7 @@ int main(void)
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
mousePosition = GetMousePosition(); mousePosition = GetMousePosition();
if (CheckCollisionPointRec(mousePosition, rec) && if (CheckCollisionPointRec(mousePosition, (Rectangle){ rec.x + rec.width - MOUSE_SCALE_MARK_SIZE, rec.y + rec.height - MOUSE_SCALE_MARK_SIZE, MOUSE_SCALE_MARK_SIZE, MOUSE_SCALE_MARK_SIZE }))
CheckCollisionPointRec(mousePosition, (Rectangle){ rec.x + rec.width - MOUSE_SCALE_MARK_SIZE, rec.y + rec.height - MOUSE_SCALE_MARK_SIZE, MOUSE_SCALE_MARK_SIZE, MOUSE_SCALE_MARK_SIZE }))
{ {
mouseScaleReady = true; mouseScaleReady = true;
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) mouseScaleMode = true; if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) mouseScaleMode = true;
@ -56,8 +55,13 @@ int main(void)
rec.width = (mousePosition.x - rec.x); rec.width = (mousePosition.x - rec.x);
rec.height = (mousePosition.y - rec.y); rec.height = (mousePosition.y - rec.y);
// Check minimum rec size
if (rec.width < MOUSE_SCALE_MARK_SIZE) rec.width = MOUSE_SCALE_MARK_SIZE; if (rec.width < MOUSE_SCALE_MARK_SIZE) rec.width = MOUSE_SCALE_MARK_SIZE;
if (rec.height < MOUSE_SCALE_MARK_SIZE) rec.height = MOUSE_SCALE_MARK_SIZE; if (rec.height < MOUSE_SCALE_MARK_SIZE) rec.height = MOUSE_SCALE_MARK_SIZE;
// Check maximum rec size
if (rec.width > (GetScreenWidth() - rec.x)) rec.width = GetScreenWidth() - rec.x;
if (rec.height > (GetScreenHeight() - rec.y)) rec.height = GetScreenHeight() - rec.y;
if (IsMouseButtonReleased(MOUSE_BUTTON_LEFT)) mouseScaleMode = false; if (IsMouseButtonReleased(MOUSE_BUTTON_LEFT)) mouseScaleMode = false;
} }