add min window size & use some constants for computing draw positions

This commit is contained in:
Colin McMillen 2023-06-29 22:31:14 -04:00
parent f822a07602
commit a3360b1420

View File

@ -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 = ...