Compare commits
No commits in common. "e98b19d87be36e2a91a2c64c63d18fa42430ce06" and "77b0f2b19120c6e716ddca04c603c88a0a2f127f" have entirely different histories.
e98b19d87b
...
77b0f2b191
20
Program.cs
20
Program.cs
@ -518,10 +518,7 @@ 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.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...
|
||||
IPath path = new Star(x: radius, y: radius, prongs: 5, innerRadii: radius * 0.4f, outerRadii: radius, angle: Util.PI);
|
||||
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);
|
||||
@ -542,7 +539,6 @@ 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();
|
||||
@ -798,7 +794,7 @@ public class Game : GameWindow {
|
||||
DrawTexture(active, photoBox);
|
||||
for (int i = 0; i < 5; i++) {
|
||||
Texture star = (activePhoto.Rating > i) ? STAR_FILLED : STAR_EMPTY;
|
||||
DrawTexture(star, (star.Size.X + 10) * i + 10, 10);
|
||||
DrawTexture(star, Util.MakeBox((star.Size.X + 10) * i + 10, 10, star.Size.X, star.Size.Y));
|
||||
}
|
||||
|
||||
// Draw thumbnail boxes.
|
||||
@ -808,12 +804,8 @@ public class Game : GameWindow {
|
||||
if (ribbonIndex + i >= photos.Count) {
|
||||
break;
|
||||
}
|
||||
Photo photo = photos[ribbonIndex + i];
|
||||
Box2i box = geometry.ThumbnailBoxes[i];
|
||||
DrawTexture(photo.Texture(), box);
|
||||
for (int j = 0; j < photo.Rating; j++) {
|
||||
DrawTexture(STAR_SMALL, box.Min.X + 8 + ((STAR_SMALL.Size.X + 2) * j), box.Min.Y + 8);
|
||||
}
|
||||
DrawTexture(photos[ribbonIndex + i].Texture(), box);
|
||||
if (ribbonIndex + i == photoIndex) {
|
||||
DrawBox(box, 5, Color4.Black);
|
||||
DrawBox(box, 3, Color4.White);
|
||||
@ -833,10 +825,6 @@ public class Game : GameWindow {
|
||||
SwapBuffers();
|
||||
}
|
||||
|
||||
void DrawTexture(Texture texture, int x, int y) {
|
||||
DrawTexture(texture, Util.MakeBox(x, y, texture.Size.X, texture.Size.Y));
|
||||
}
|
||||
|
||||
void DrawTexture(Texture texture, Box2i box) {
|
||||
DrawTexture(texture, box, Color4.White);
|
||||
}
|
||||
@ -862,7 +850,7 @@ public class Game : GameWindow {
|
||||
|
||||
void DrawText(string text, int x, int y) {
|
||||
Texture label = Util.RenderText(text);
|
||||
DrawTexture(label, x, y);
|
||||
DrawTexture(label, Util.MakeBox(x, y, label.Size.X, label.Size.Y));
|
||||
label.Dispose();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user