From a3360b1420cf36dece61295734f92d1da38f988a Mon Sep 17 00:00:00 2001 From: Colin McMillen Date: Thu, 29 Jun 2023 22:31:14 -0400 Subject: [PATCH] add min window size & use some constants for computing draw positions --- Program.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Program.cs b/Program.cs index eb72f98..730bbf6 100644 --- a/Program.cs +++ b/Program.cs @@ -275,7 +275,12 @@ public class Game : GameWindow { frameCount++; GL.Clear(ClearBufferMask.ColorBufferBit); - SetVertices(0, 0, windowWidth - 152, windowHeight); + int thumbnailWidth = 150; + int thumbnailHeight = 100; + int borderWidth = 2; + int photoWidth = windowWidth - thumbnailWidth - borderWidth; + + SetVertices(0, 0, photoWidth, windowHeight); GL.BindBuffer(BufferTarget.ArrayBuffer, VertexBufferObject); GL.BufferData(BufferTarget.ArrayBuffer, vertices.Length * sizeof(float), vertices, BufferUsageHint.DynamicDraw); GL.ActiveTexture(TextureUnit.Texture0); @@ -284,7 +289,7 @@ public class Game : GameWindow { GL.DrawElements(PrimitiveType.Triangles, indices.Length, DrawElementsType.UnsignedInt, 0); for (int i = 0; i < textures.Count; i++) { - SetVertices(windowWidth - 150, i * 100, windowWidth, i * 100 + 98); + SetVertices(windowWidth - thumbnailWidth, i * thumbnailHeight, windowWidth, i * thumbnailHeight + thumbnailHeight - borderWidth); GL.BindBuffer(BufferTarget.ArrayBuffer, VertexBufferObject); GL.BufferData(BufferTarget.ArrayBuffer, vertices.Length * sizeof(float), vertices, BufferUsageHint.DynamicDraw); GL.ActiveTexture(TextureUnit.Texture0); @@ -360,6 +365,7 @@ static class Program { nwSettings.CurrentMonitor = bestMonitor.Handle; nwSettings.Location = new Vector2i(bestMonitor.WorkArea.Min.X + 1, bestMonitor.WorkArea.Min.Y + 31); nwSettings.Size = new Vector2i(bestMonitor.WorkArea.Size.X - 2, bestMonitor.WorkArea.Size.Y - 32); + nwSettings.MinimumSize = new Vector2i(640, 480); nwSettings.Title = "Totte"; // FIXME: nwSettings.Icon = ...