Compare commits
No commits in common. "e98b19d87be36e2a91a2c64c63d18fa42430ce06" and "77b0f2b19120c6e716ddca04c603c88a0a2f127f" have entirely different histories.
e98b19d87b
...
77b0f2b191
22
Program.cs
22
Program.cs
@ -518,10 +518,7 @@ public static class Util {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Texture RenderStar(float radius, bool filled) {
|
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);
|
IPath path = new Star(x: radius, y: radius, prongs: 5, innerRadii: radius * 0.4f, 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);
|
Image<Rgba32> image = MakeImage(path.Bounds.Width + 2, path.Bounds.Height + 2);
|
||||||
IBrush brush = Brushes.Solid(Color.White);
|
IBrush brush = Brushes.Solid(Color.White);
|
||||||
IPen pen = Pens.Solid(Color.White, 1.5f);
|
IPen pen = Pens.Solid(Color.White, 1.5f);
|
||||||
@ -541,8 +538,7 @@ public class Game : GameWindow {
|
|||||||
private static Texture TEXTURE_WHITE = new(new Image<Rgba32>(1, 1, new Rgba32(255, 255, 255)));
|
private static Texture TEXTURE_WHITE = new(new Image<Rgba32>(1, 1, new Rgba32(255, 255, 255)));
|
||||||
private static Texture TEXTURE_BLACK = new(new Image<Rgba32>(1, 1, new Rgba32(0, 0, 0)));
|
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_FILLED = Util.RenderStar(20, true);
|
||||||
private static Texture STAR_EMPTY = Util.RenderStar(20, false);
|
private static Texture STAR_EMPTY= Util.RenderStar(20, false);
|
||||||
private static Texture STAR_SMALL = Util.RenderStar(6, true);
|
|
||||||
|
|
||||||
UiGeometry geometry = new();
|
UiGeometry geometry = new();
|
||||||
FpsCounter fpsCounter = new();
|
FpsCounter fpsCounter = new();
|
||||||
@ -798,7 +794,7 @@ public class Game : GameWindow {
|
|||||||
DrawTexture(active, photoBox);
|
DrawTexture(active, photoBox);
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
Texture star = (activePhoto.Rating > i) ? STAR_FILLED : STAR_EMPTY;
|
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.
|
// Draw thumbnail boxes.
|
||||||
@ -808,12 +804,8 @@ public class Game : GameWindow {
|
|||||||
if (ribbonIndex + i >= photos.Count) {
|
if (ribbonIndex + i >= photos.Count) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Photo photo = photos[ribbonIndex + i];
|
|
||||||
Box2i box = geometry.ThumbnailBoxes[i];
|
Box2i box = geometry.ThumbnailBoxes[i];
|
||||||
DrawTexture(photo.Texture(), box);
|
DrawTexture(photos[ribbonIndex + i].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);
|
|
||||||
}
|
|
||||||
if (ribbonIndex + i == photoIndex) {
|
if (ribbonIndex + i == photoIndex) {
|
||||||
DrawBox(box, 5, Color4.Black);
|
DrawBox(box, 5, Color4.Black);
|
||||||
DrawBox(box, 3, Color4.White);
|
DrawBox(box, 3, Color4.White);
|
||||||
@ -833,10 +825,6 @@ public class Game : GameWindow {
|
|||||||
SwapBuffers();
|
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) {
|
void DrawTexture(Texture texture, Box2i box) {
|
||||||
DrawTexture(texture, box, Color4.White);
|
DrawTexture(texture, box, Color4.White);
|
||||||
}
|
}
|
||||||
@ -862,7 +850,7 @@ public class Game : GameWindow {
|
|||||||
|
|
||||||
void DrawText(string text, int x, int y) {
|
void DrawText(string text, int x, int y) {
|
||||||
Texture label = Util.RenderText(text);
|
Texture label = Util.RenderText(text);
|
||||||
DrawTexture(label, x, y);
|
DrawTexture(label, Util.MakeBox(x, y, label.Size.X, label.Size.Y));
|
||||||
label.Dispose();
|
label.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user