make DrawTexture(texture, x, y) function

This commit is contained in:
Colin McMillen 2023-07-26 13:49:48 -04:00
parent 7ce97438ae
commit e98b19d87b

View File

@ -798,7 +798,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, Util.MakeBox((star.Size.X + 10) * i + 10, 10, star.Size.X, star.Size.Y));
DrawTexture(star, (star.Size.X + 10) * i + 10, 10);
}
// Draw thumbnail boxes.
@ -812,7 +812,7 @@ public class Game : GameWindow {
Box2i box = geometry.ThumbnailBoxes[i];
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));
DrawTexture(STAR_SMALL, box.Min.X + 8 + ((STAR_SMALL.Size.X + 2) * j), box.Min.Y + 8);
}
if (ribbonIndex + i == photoIndex) {
DrawBox(box, 5, Color4.Black);
@ -833,6 +833,10 @@ 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);
}
@ -858,7 +862,7 @@ public class Game : GameWindow {
void DrawText(string text, int x, int y) {
Texture label = Util.RenderText(text);
DrawTexture(label, Util.MakeBox(x, y, label.Size.X, label.Size.Y));
DrawTexture(label, x, y);
label.Dispose();
}