-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathExampleHudElement.java
More file actions
47 lines (38 loc) · 1.18 KB
/
ExampleHudElement.java
File metadata and controls
47 lines (38 loc) · 1.18 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
package org.example;
import org.rusherhack.client.api.feature.hud.ResizeableHudElement;
import org.rusherhack.client.api.render.RenderContext;
import org.rusherhack.client.api.render.graphic.TextureGraphic;
/**
* Example rusherhack hud element
* <p>
* There are other hud element types than ResizeableHudElement, look at the other classes in the package
*
* @author John200410
*/
public class ExampleHudElement extends ResizeableHudElement {
private TextureGraphic graphic = null;
public ExampleHudElement() {
super("ExampleHudElement");
//try loading graphic
try {
this.graphic = new TextureGraphic("exampleplugin/graphics/rh_head.png", 235, 234);
} catch (Throwable t) {
this.getLogger().error("Failed to load graphic", t);
}
}
@Override
public void renderContent(RenderContext context, double mouseX, double mouseY) {
//positions are relative to the top left corner of the hud element, so start drawing stuff from 0,0
if (this.graphic != null) {
this.getRenderer().drawGraphicRectangle(this.graphic, 0, 0, this.getWidth(), this.getHeight());
}
}
@Override
public double getWidth() {
return 200;
}
@Override
public double getHeight() {
return 200;
}
}