Files
imgui-java/imgui-binding/src/main/java/imgui/internal/ImRect.java
T
SpaiR 8a8cd22ed6 feat: introduce binding generator
A squash of hundreds of commits with a binding API generator.

The API generator works with a hybrid model:
1. We define methods and fields in the code.
2. Mark them with API annotations.
3. For specific use cases, we use the old approach with JNI generation comments.

There is also an API to generate an AST tree, which is saved to JSON.
This JSON can be used for full API generation by declaring only field/method names.
Currently, it is used to generate constants.

By eyeballing, 95% of the API has been converted to the new approach.
This is sufficient for the current moment. Only edge cases with specific API calls are left.

fix: ambiguous call for ImGui::GetColorU32

build: disable checkstyle for imgui-binding module

Since the module is heavily generated, checkstyle for it doesn't make sense.

build: make buildSrc to use JDK 11

build: make generateApi optional when compiling project

Initially generated module was not included to the project VCS.
Since it's now in the separate src folder, we don't need to call generator every time.
Only when a new generation result is required.
2024-08-08 14:46:23 +03:00

84 lines
1.8 KiB
Java

package imgui.internal;
import imgui.ImVec2;
import java.util.Objects;
/**
* Helper: ImRect (2D axis aligned bounding-box)
* NB: we can't rely on ImVec2 math operators being available here!
*/
public final class ImRect implements Cloneable {
/**
* Upper-left
*/
public final ImVec2 min = new ImVec2();
/**
* Lower-right
*/
public final ImVec2 max = new ImVec2();
public ImRect() {
}
public ImRect(final float minX, final float minY, final float maxX, final float maxY) {
set(minX, minY, maxX, maxY);
}
public ImRect(final ImVec2 min, final ImVec2 max) {
set(min, max);
}
public ImRect(final ImRect value) {
set(value);
}
public void set(final float minX, final float minY, final float maxX, final float maxY) {
this.min.x = minX;
this.min.y = minY;
this.max.x = maxX;
this.max.y = maxY;
}
public void set(final ImVec2 min, final ImVec2 max) {
set(min.x, min.y, max.x, max.y);
}
public void set(final ImRect value) {
set(value.min, value.max);
}
@Override
public String toString() {
return "ImRect{"
+ "min=" + min
+ ", max=" + max
+ '}';
}
@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final ImRect imRect = (ImRect) o;
return Objects.equals(min, imRect.min) && Objects.equals(max, imRect.max);
}
@Override
public int hashCode() {
return Objects.hash(min, max);
}
@Override
@SuppressWarnings("MethodDoesntCallSuperMethod")
public ImRect clone() {
return new ImRect(this);
}
}