rename textureIndex -> photoIndex
This commit is contained in:
parent
75e186c392
commit
e58f717ffe
16
Program.cs
16
Program.cs
@ -257,7 +257,7 @@ public class Game : GameWindow {
|
|||||||
int ElementBufferObject;
|
int ElementBufferObject;
|
||||||
int VertexArrayObject;
|
int VertexArrayObject;
|
||||||
List<Photo> photos = new();
|
List<Photo> photos = new();
|
||||||
int textureIndex = 0; // FIXME: rename to photoIndex
|
int photoIndex = 0;
|
||||||
Shader shader = new();
|
Shader shader = new();
|
||||||
Matrix4 projection;
|
Matrix4 projection;
|
||||||
|
|
||||||
@ -278,7 +278,7 @@ public class Game : GameWindow {
|
|||||||
Box2i box = geometry.ThumbnailBoxes[i];
|
Box2i box = geometry.ThumbnailBoxes[i];
|
||||||
if (box.ContainsInclusive((Vector2i) MouseState.Position)) {
|
if (box.ContainsInclusive((Vector2i) MouseState.Position)) {
|
||||||
if (0 <= i && i < photos.Count) {
|
if (0 <= i && i < photos.Count) {
|
||||||
textureIndex = i;
|
photoIndex = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -296,15 +296,15 @@ public class Game : GameWindow {
|
|||||||
|
|
||||||
// FIXME: make a proper Model class for tracking the state of the controls?
|
// FIXME: make a proper Model class for tracking the state of the controls?
|
||||||
if (input.IsKeyPressed(Keys.Down) || now > downTimer) {
|
if (input.IsKeyPressed(Keys.Down) || now > downTimer) {
|
||||||
if (textureIndex < photos.Count - 1) {
|
if (photoIndex < photos.Count - 1) {
|
||||||
downTimer = now + 10000 * 200;
|
downTimer = now + 10000 * 200;
|
||||||
textureIndex++;
|
photoIndex++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (input.IsKeyPressed(Keys.Up) || now > upTimer) {
|
if (input.IsKeyPressed(Keys.Up) || now > upTimer) {
|
||||||
if (textureIndex > 0) {
|
if (photoIndex > 0) {
|
||||||
upTimer = now + 10000 * 200;
|
upTimer = now + 10000 * 200;
|
||||||
textureIndex--;
|
photoIndex--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -365,7 +365,7 @@ public class Game : GameWindow {
|
|||||||
GL.BindBuffer(BufferTarget.ArrayBuffer, VertexBufferObject);
|
GL.BindBuffer(BufferTarget.ArrayBuffer, VertexBufferObject);
|
||||||
GL.ActiveTexture(TextureUnit.Texture0);
|
GL.ActiveTexture(TextureUnit.Texture0);
|
||||||
|
|
||||||
Texture active = photos[textureIndex].Texture;
|
Texture active = photos[photoIndex].Texture;
|
||||||
|
|
||||||
// FIXME: make a function for scaling & centering one box on another.
|
// FIXME: make a function for scaling & centering one box on another.
|
||||||
float scaleX = 1f * geometry.PhotoBox.Size.X / active.Size.X;
|
float scaleX = 1f * geometry.PhotoBox.Size.X / active.Size.X;
|
||||||
@ -379,7 +379,7 @@ public class Game : GameWindow {
|
|||||||
for (int i = 0; i < photos.Count; i++) {
|
for (int i = 0; i < photos.Count; i++) {
|
||||||
Box2i box = geometry.ThumbnailBoxes[i];
|
Box2i box = geometry.ThumbnailBoxes[i];
|
||||||
DrawTexture(photos[i].Texture, box);
|
DrawTexture(photos[i].Texture, box);
|
||||||
if (i == textureIndex) {
|
if (i == photoIndex) {
|
||||||
DrawBox(box, 5, Color4.Black);
|
DrawBox(box, 5, Color4.Black);
|
||||||
DrawBox(box, 3, Color4.White);
|
DrawBox(box, 3, Color4.White);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user