remove non-Rect versions of Draw{Texture,Box}
This commit is contained in:
parent
cb3994a378
commit
ca4ea40916
20
Program.cs
20
Program.cs
@ -305,7 +305,7 @@ public class Game : GameWindow {
|
|||||||
int photoWidth = (int) (1.0 * windowHeight / active.Height * active.Width);
|
int photoWidth = (int) (1.0 * windowHeight / active.Height * active.Width);
|
||||||
int letterboxWidth = (maxPhotoWidth - photoWidth) / 2;
|
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++) {
|
for (int i = 0; i < textures.Count; i++) {
|
||||||
Rectangle box = new Rectangle(windowWidth - thumbnailWidth, i * thumbnailHeight, thumbnailWidth, thumbnailHeight);
|
Rectangle box = new Rectangle(windowWidth - thumbnailWidth, i * thumbnailHeight, thumbnailWidth, thumbnailHeight);
|
||||||
DrawTexture(textures[i], box);
|
DrawTexture(textures[i], box);
|
||||||
@ -318,25 +318,17 @@ public class Game : GameWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DrawTexture(Texture texture, Rectangle box) {
|
void DrawTexture(Texture texture, Rectangle box) {
|
||||||
DrawTexture(texture, box.Left, box.Top, box.Width, box.Height);
|
SetVertices(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);
|
GL.BufferData(BufferTarget.ArrayBuffer, vertices.Length * sizeof(float), vertices, BufferUsageHint.DynamicDraw);
|
||||||
GL.BindTexture(TextureTarget.Texture2D, texture.Handle);
|
GL.BindTexture(TextureTarget.Texture2D, texture.Handle);
|
||||||
GL.DrawElements(PrimitiveType.Triangles, indices.Length, DrawElementsType.UnsignedInt, 0);
|
GL.DrawElements(PrimitiveType.Triangles, indices.Length, DrawElementsType.UnsignedInt, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawBox(Rectangle box, int thickness) {
|
void DrawBox(Rectangle box, int thickness) {
|
||||||
DrawBox(box.Left, box.Top, box.Width, box.Height, thickness);
|
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));
|
||||||
void DrawBox(int left, int top, int width, int height, int thickness) {
|
DrawTexture(TEXTURE_WHITE, new Rectangle(box.Left + box.Width - thickness, box.Top, thickness, box.Height));
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnResize(ResizeEventArgs e) {
|
protected override void OnResize(ResizeEventArgs e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user