Skip to content

Commit

Permalink
fix collisions
Browse files Browse the repository at this point in the history
  • Loading branch information
asterd-og authored May 30, 2022
1 parent 5e2d294 commit ab25e8f
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions PrismOS/Libraries/Runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,20 @@ public static void Update()
#region Calculations

E.OnUpdate.Invoke();
if (E.Clicked && Mouse.MouseState != Cosmos.System.MouseState.Left && !Dragging)
{
E.Clicked = false;
E.OnClick.Invoke();

if (IsMouseWithin(Window.X+E.X, Window.Y+E.Y, E.Width, E.Height)) {
E.Hovering=true;
if (Cosmos.System.MouseManager.MouseState==Cosmos.System.MouseState.Left) {
E.Clicked=true;
} else {
if (E.Clicked) {
E.Clicked=false;
E.OnClick();
}
}
} else {
E.Hovering=false;
}
E.Hovering = Mouse.X >= E.X && Mouse.IsMouseWithin(E.X, E.Y, E.Width, E.Height);
E.Clicked = E.Hovering && Mouse.MouseState == Cosmos.System.MouseState.Left;

#endregion

Expand Down Expand Up @@ -100,4 +107,4 @@ public static void Stop()
Cosmos.System.Power.Shutdown();
}
}
}
}

0 comments on commit ab25e8f

Please sign in to comment.