remove non-Rect versions of Draw{Texture,Box}

This commit is contained in:
Colin McMillen 2023-07-06 22:13:26 -04:00
parent cb3994a378
commit ca4ea40916

View File

@ -305,7 +305,7 @@ public class Game : GameWindow {
int photoWidth = (int) (1.0 * windowHeight / active.Height * active.Width);
int letterboxWidth = (maxPhotoWidth - photoWidth) / 2;
DrawTexture(active, letterboxWidth, 0, photoWidth, windowHeight);
DrawTexture(active, new Rectangle(letterboxWidth, 0, photoWidth, windowHeight));
for (int i = 0; i < textures.Count; i++) {
Rectangle box = new Rectangle(windowWidth - thumbnailWidth, i * thumbnailHeight, thumbnailWidth, thumbnailHeight);
DrawTexture(textures[i], box);
@ -318,25 +318,17 @@ public class Game : GameWindow {
}
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);
SetVertices(box.Left, box.Top, box.Width, box.Height);
GL.BufferData(BufferTarget.ArrayBuffer, vertices.Length * sizeof(float), vertices, BufferUsageHint.DynamicDraw);
GL.BindTexture(TextureTarget.Texture2D, texture.Handle);
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);
DrawTexture(TEXTURE_WHITE, left, top + height - thickness, width, thickness);
DrawTexture(TEXTURE_WHITE, left + width - thickness, top, thickness, height);
DrawTexture(TEXTURE_WHITE, new Rectangle(box.Left, box.Top, box.Width, thickness));
DrawTexture(TEXTURE_WHITE, new Rectangle(box.Left, box.Top, thickness, box.Height));
DrawTexture(TEXTURE_WHITE, new Rectangle(box.Left, box.Top + box.Height - thickness, box.Width, thickness));
DrawTexture(TEXTURE_WHITE, new Rectangle(box.Left + box.Width - thickness, box.Top, thickness, box.Height));
}
protected override void OnResize(ResizeEventArgs e) {