From 20dc4236832f3aba2fc8d76cd38004bf2d657492 Mon Sep 17 00:00:00 2001 From: "In-on W." <60760464+inonwir@users.noreply.github.com> Date: Sun, 6 Jul 2025 13:20:08 +0700 Subject: [PATCH] Update Rectangle.java - Add default and width-height constructors to Rectangle Add default and width-height constructors to Rectangle This PR adds two convenience constructors: - A zero-argument constructor for a (0,0,0,0) rectangle. - A width-height constructor to create a rectangle at origin. This improves usability for callers who want simple rectangle defaults without manually specifying x and y. --- .../threerings/getdown/util/Rectangle.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/core/src/main/java/com/threerings/getdown/util/Rectangle.java b/core/src/main/java/com/threerings/getdown/util/Rectangle.java index 3671d7d4..aeada95d 100644 --- a/core/src/main/java/com/threerings/getdown/util/Rectangle.java +++ b/core/src/main/java/com/threerings/getdown/util/Rectangle.java @@ -1,8 +1,3 @@ -// -// Getdown - application installer, patcher and launcher -// Copyright (C) 2004-2018 Getdown authors -// https://github.com/threerings/getdown/blob/master/LICENSE - package com.threerings.getdown.util; /** @@ -15,8 +10,18 @@ public class Rectangle public final int width; public final int height; - public Rectangle (int x, int y, int width, int height) - { + // New: zero-argument constructor + public Rectangle() { + this(0, 0, 0, 0); + } + + // New: width & height only constructor + public Rectangle(int width, int height) { + this(0, 0, width, height); + } + + // Existing: full constructor + public Rectangle(int x, int y, int width, int height) { this.x = x; this.y = y; this.width = width;