add stars to the thumbnail view
This commit is contained in:
parent
77b0f2b191
commit
7ce97438ae
12
Program.cs
12
Program.cs
@ -518,7 +518,10 @@ public static class Util {
|
||||
}
|
||||
|
||||
public static Texture RenderStar(float radius, bool filled) {
|
||||
IPath path = new Star(x: radius, y: radius, prongs: 5, innerRadii: radius * 0.4f, outerRadii: radius, angle: Util.PI);
|
||||
IPath path = new Star(x: radius, y: radius, prongs: 5, innerRadii: radius * 0.45f, outerRadii: radius, angle: Util.PI);
|
||||
// We add a little bit to the width & height because the reported
|
||||
// path.Bounds are often a little tighter than they should be & a couple
|
||||
// pixels end up obviously missing...
|
||||
Image<Rgba32> image = MakeImage(path.Bounds.Width + 2, path.Bounds.Height + 2);
|
||||
IBrush brush = Brushes.Solid(Color.White);
|
||||
IPen pen = Pens.Solid(Color.White, 1.5f);
|
||||
@ -539,6 +542,7 @@ public class Game : GameWindow {
|
||||
private static Texture TEXTURE_BLACK = new(new Image<Rgba32>(1, 1, new Rgba32(0, 0, 0)));
|
||||
private static Texture STAR_FILLED = Util.RenderStar(20, true);
|
||||
private static Texture STAR_EMPTY = Util.RenderStar(20, false);
|
||||
private static Texture STAR_SMALL = Util.RenderStar(6, true);
|
||||
|
||||
UiGeometry geometry = new();
|
||||
FpsCounter fpsCounter = new();
|
||||
@ -804,8 +808,12 @@ public class Game : GameWindow {
|
||||
if (ribbonIndex + i >= photos.Count) {
|
||||
break;
|
||||
}
|
||||
Photo photo = photos[ribbonIndex + i];
|
||||
Box2i box = geometry.ThumbnailBoxes[i];
|
||||
DrawTexture(photos[ribbonIndex + i].Texture(), box);
|
||||
DrawTexture(photo.Texture(), box);
|
||||
for (int j = 0; j < photo.Rating; j++) {
|
||||
DrawTexture(STAR_SMALL, Util.MakeBox(box.Min.X + 8 + ((STAR_SMALL.Size.X + 2) * j), box.Min.Y + 8, STAR_SMALL.Size.X, STAR_SMALL.Size.Y));
|
||||
}
|
||||
if (ribbonIndex + i == photoIndex) {
|
||||
DrawBox(box, 5, Color4.Black);
|
||||
DrawBox(box, 3, Color4.White);
|
||||
|
Loading…
Reference in New Issue
Block a user