use fancy new type-inferring new()

This commit is contained in:
Colin McMillen 2023-07-08 00:33:15 -04:00
parent 22aa1e0d88
commit b3e3d3d11a

View File

@ -16,8 +16,8 @@ public class CameraInfo {
Resolution = resolution;
}
public static readonly CameraInfo NIKON_D7000 = new CameraInfo(new Vector2i(4928, 3264));
public static readonly CameraInfo IPHONE_12_MINI = new CameraInfo(new Vector2i(4032, 3024));
public static readonly CameraInfo NIKON_D7000 = new(new Vector2i(4928, 3264));
public static readonly CameraInfo IPHONE_12_MINI = new(new Vector2i(4032, 3024));
}
public class Shader : IDisposable {
@ -186,7 +186,7 @@ public class Texture : IDisposable {
}
public class UiGeometry {
public static Vector2i MIN_WINDOW_SIZE = new Vector2i(640, 480);
public static Vector2i MIN_WINDOW_SIZE = new(640, 480);
private static CameraInfo activeCamera = CameraInfo.NIKON_D7000;
public readonly Vector2i WindowSize;
@ -206,7 +206,7 @@ public class UiGeometry {
ThumbnailBoxes.Add(box);
}
PhotoBox = new(0, 0, WindowSize.X - thumbnailWidth, WindowSize.Y);
PhotoBox = new Box2i(0, 0, WindowSize.X - thumbnailWidth, WindowSize.Y);
}
}
@ -219,7 +219,7 @@ public static class Util {
public class Game : GameWindow {
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(new Image<Rgba32>(1, 1, new Rgba32(255, 255, 255)));
UiGeometry geometry = new();
@ -237,7 +237,7 @@ public class Game : GameWindow {
int VertexArrayObject;
List<Texture> textures = new();
int textureIndex = 0;
Shader shader = new Shader();
Shader shader = new();
Matrix4 projection;
protected override void OnUpdateFrame(FrameEventArgs e) {
@ -435,7 +435,7 @@ static class Program {
nwSettings.Title = "Totte";
// FIXME: nwSettings.Icon = ...
using (Game game = new Game(gwSettings, nwSettings)) {
using (Game game = new(gwSettings, nwSettings)) {
game.Run();
}
}