Compare commits
No commits in common. "22aa1e0d88ea898cdabde9d6eccc6dce2ed3560f" and "95397087d243d31d265941bb2446f7b30389fb30" have entirely different histories.
22aa1e0d88
...
95397087d2
15
Program.cs
15
Program.cs
@ -217,7 +217,7 @@ public static class Util {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class Game : GameWindow {
|
public class Game : GameWindow {
|
||||||
public Game(GameWindowSettings gwSettings, NativeWindowSettings nwSettings) : base(gwSettings, nwSettings) {}
|
public Game(GameWindowSettings gwSettings, NativeWindowSettings nwSettings) : base(gwSettings, nwSettings) { }
|
||||||
|
|
||||||
private static Texture TEXTURE_WHITE = new Texture(new Image<Rgba32>(1, 1, new Rgba32(255, 255, 255)));
|
private static Texture TEXTURE_WHITE = new Texture(new Image<Rgba32>(1, 1, new Rgba32(255, 255, 255)));
|
||||||
|
|
||||||
@ -328,13 +328,12 @@ public class Game : GameWindow {
|
|||||||
Texture active = textures[textureIndex];
|
Texture active = textures[textureIndex];
|
||||||
|
|
||||||
// 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;
|
double scaleX = 1.0 * geometry.PhotoBox.Size.X / active.Size.X;
|
||||||
float scaleY = 1f * geometry.PhotoBox.Size.Y / active.Size.Y;
|
double scaleY = 1.0 * geometry.PhotoBox.Size.Y / active.Size.Y;
|
||||||
float scale = Math.Min(scaleX, scaleY);
|
double scale = Math.Min(scaleX, scaleY);
|
||||||
|
int renderWidth = (int) (active.Size.X * scale);
|
||||||
Vector2i renderSize = (Vector2i) (((Vector2) active.Size) * scale);
|
int renderHeight = (int) (active.Size.Y * scale);
|
||||||
Vector2i center = (Vector2i) geometry.PhotoBox.Center;
|
Box2i photoBox = Util.makeBox((int) geometry.PhotoBox.Center.X - renderWidth / 2, (int) geometry.PhotoBox.Center.Y - renderHeight / 2, renderWidth, renderHeight);
|
||||||
Box2i photoBox = Util.makeBox(center.X - renderSize.X / 2, center.Y - renderSize.Y / 2, renderSize.X, renderSize.Y);
|
|
||||||
DrawTexture(active, photoBox);
|
DrawTexture(active, photoBox);
|
||||||
for (int i = 0; i < textures.Count; i++) {
|
for (int i = 0; i < textures.Count; i++) {
|
||||||
Box2i box = geometry.ThumbnailBoxes[i];
|
Box2i box = geometry.ThumbnailBoxes[i];
|
||||||
|
Loading…
Reference in New Issue
Block a user