From 247d6ac6f2358f26987e4d3d5e051ca8ece2047b Mon Sep 17 00:00:00 2001 From: Colin McMillen Date: Wed, 26 Jul 2023 15:20:20 -0400 Subject: [PATCH] click on stars to set rating --- Program.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Program.cs b/Program.cs index 14b97e0..25bcd06 100644 --- a/Program.cs +++ b/Program.cs @@ -596,14 +596,21 @@ public class Game : GameWindow { upTimer = Int64.MaxValue; } - // Look for mouse clicks on thumbnails. + // Look for mouse clicks on thumbnails or stars. // // Note that we don't bounds-check photoIndex until after all the possible // inputs that might affect it. That simplifies this logic significantly. if (MouseState.IsButtonPressed(MouseButton.Button1)) { + Vector2i click = (Vector2i) MouseState.Position; + + for (int i = 0; i < geometry.StarBoxes.Count; i++) { + if (geometry.StarBoxes[i].ContainsInclusive(click)) { + photos[photoIndex].Rating = i + 1; + } + } + for (int i = 0; i < geometry.ThumbnailBoxes.Count; i++) { - Box2i box = geometry.ThumbnailBoxes[i]; - if (box.ContainsInclusive((Vector2i) MouseState.Position)) { + if (geometry.ThumbnailBoxes[i].ContainsInclusive(click)) { photoIndex = ribbonIndex + i; } }