blob: a2e5740a4c57083c4702373058eb728de251ecf5 (
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
33
34
35
|
package me.shedaniel.gui;
import me.shedaniel.api.IDrawable;
import me.shedaniel.gui.widget.Control;
import java.awt.*;
/**
* Created by James on 7/28/2018.
*/
public abstract class Drawable implements IDrawable {
protected Rectangle rect;
public Drawable(int x, int y, int width, int height) {
rect = new Rectangle(x, y, width, height);
}
public Drawable(Rectangle rect) {
this.rect = rect;
}
public abstract void draw();
public boolean isHighlighted() {
Point mousePoint = REIRenderHelper.getMouseLoc();
if (rect.contains(mousePoint.x, mousePoint.y)) {
if (this instanceof Control)
REIRenderHelper.reiGui.setLastHovered((Control) this);
return true;
}
return false;
}
}
|