diff --git a/Program.cs b/Program.cs index a674b05..5158b59 100644 --- a/Program.cs +++ b/Program.cs @@ -308,16 +308,20 @@ public class Game : GameWindow { DrawTexture(active, letterboxWidth, 0, photoWidth, windowHeight); for (int i = 0; i < textures.Count; i++) { - // FIXME: make this a rect or something - DrawTexture(textures[i], windowWidth - thumbnailWidth, i * thumbnailHeight, thumbnailWidth, thumbnailHeight - borderWidth); + Rectangle box = new Rectangle(windowWidth - thumbnailWidth, i * thumbnailHeight, thumbnailWidth, thumbnailHeight - borderWidth); + DrawTexture(textures[i], box); if (i == textureIndex) { - DrawBox(windowWidth - thumbnailWidth, i * thumbnailHeight, thumbnailWidth, thumbnailHeight - borderWidth, 2); + DrawBox(box, 2); } } SwapBuffers(); } + void DrawTexture(Texture texture, Rectangle box) { + DrawTexture(texture, box.Left, box.Top, box.Width, box.Height); + } + void DrawTexture(Texture texture, int left, int top, int width, int height) { SetVertices(left, top, width, height); GL.BufferData(BufferTarget.ArrayBuffer, vertices.Length * sizeof(float), vertices, BufferUsageHint.DynamicDraw); @@ -325,6 +329,10 @@ public class Game : GameWindow { GL.DrawElements(PrimitiveType.Triangles, indices.Length, DrawElementsType.UnsignedInt, 0); } + void DrawBox(Rectangle box, int thickness) { + DrawBox(box.Left, box.Top, box.Width, box.Height, thickness); + } + void DrawBox(int left, int top, int width, int height, int thickness) { DrawTexture(TEXTURE_WHITE, left, top, width, thickness); DrawTexture(TEXTURE_WHITE, left, top, thickness, height);