blob: 1fc118923cc0678ddea1087fbad547cb703868e7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
/*
* Roughly Enough Items by Danielshe.
* Licensed under the MIT License.
*/
package me.shedaniel.rei.gui.widget;
import me.shedaniel.math.api.Point;
import me.shedaniel.math.api.Rectangle;
public abstract class WidgetWithBounds extends Widget {
abstract public Rectangle getBounds();
public final boolean containsMouse(int mouseX, int mouseY) {
return containsMouse((double) mouseX, (double) mouseY);
}
public final boolean containsMouse(Point point) {
return containsMouse(point.x, point.y);
}
public boolean containsMouse(double mouseX, double mouseY) {
return getBounds().contains(mouseX, mouseY);
}
@Override
public boolean isMouseOver(double double_1, double double_2) {
return containsMouse(double_1, double_2);
}
}
|