2 * Decompiled with CFR 0.151.
4 * Could not load the following classes:
5 * com.wurmonline.client.renderer.Matrix
6 * com.wurmonline.client.renderer.PickData
7 * com.wurmonline.client.renderer.backend.Primitive
8 * com.wurmonline.client.renderer.backend.Primitive$TexEnv
9 * com.wurmonline.client.renderer.backend.Primitive$Type
10 * com.wurmonline.client.renderer.backend.Queue
11 * com.wurmonline.client.renderer.backend.VertexBuffer
12 * com.wurmonline.client.renderer.backend.VertexBuffer$Usage
13 * com.wurmonline.client.renderer.gui.ConfirmListener
14 * com.wurmonline.client.renderer.gui.ConfirmWindow
15 * com.wurmonline.client.renderer.gui.FlexComponent
16 * com.wurmonline.client.renderer.gui.HeadsUpDisplay
18 package com
.wurmonline
.client
.renderer
.gui
;
20 import com
.wurmonline
.client
.renderer
.Matrix
;
21 import com
.wurmonline
.client
.renderer
.PickData
;
22 import com
.wurmonline
.client
.renderer
.backend
.Primitive
;
23 import com
.wurmonline
.client
.renderer
.backend
.Queue
;
24 import com
.wurmonline
.client
.renderer
.backend
.VertexBuffer
;
25 import java
.nio
.FloatBuffer
;
27 final class EspWCheckBox
29 implements ConfirmListener
{
31 boolean checked
= false;
32 boolean enabled
= true;
33 private boolean needsConfirmOnTick
= false;
34 private String confirmMessageOnTick
;
35 private String confirmQuestionOnTick
;
36 private boolean needsConfirmUnTick
= false;
37 private String confirmMessageUnTick
;
38 private String confirmQuestionUnTick
;
39 private ConfirmWindow confirmWindow
= null;
40 private String hoverString
;
41 private float customR
= 1.0f;
42 private float customG
= 1.0f;
43 private float customB
= 1.0f;
44 private static final VertexBuffer vbo
= VertexBuffer
.create((VertexBuffer
.Usage
)VertexBuffer
.Usage
.GUI
, (int)12, (boolean)true, (boolean)false, (boolean)false, (boolean)false, (boolean)false, (int)0, (int)0, (boolean)false, (boolean)true);
45 private final Matrix modelMatrix
;
46 private CheckBoxListener checkboxListener
;
48 EspWCheckBox(String label
, CheckBoxListener checkboxListener
) {
49 super("Checkbox " + label
);
50 this.height
= this.text
.getHeight() + 1;
52 this.modelMatrix
= Matrix
.createIdentity();
53 this.checkboxListener
= checkboxListener
;
56 public void setLabel(String newLabel
) {
57 this.label
= newLabel
;
58 this.setSize(this.text
.getWidth(this.label
) + 16, this.height
);
61 protected void renderComponent(Queue queue
, float alpha
) {
70 Primitive prim
= queue
.reservePrimitive();
71 prim
.type
= Primitive
.Type
.LINES
;
72 prim
.num
= this.checked ?
6 : 4;
77 prim
.texture
[1] = null;
78 prim
.texture
[0] = null;
79 prim
.texenv
[0] = Primitive
.TexEnv
.MODULATE
;
82 prim
.clipRect
= HeadsUpDisplay
.scissor
.getCurrent();
83 int dy
= (this.height
- 8) / 2;
84 this.modelMatrix
.setTranslation((float)this.x
, (float)(this.y
+ dy
), 0.0f);
85 queue
.queue(prim
, this.modelMatrix
);
86 this.text
.moveTo(this.x
+ this.height
, this.y
+ this.text
.getHeight());
87 this.text
.paint(queue
, this.label
, colR
, colG
, colB
, 1.0f);
90 protected void leftPressed(int xMouse
, int yMouse
, int clickCount
) {
91 if (this.enabled
&& xMouse
<= this.x
+ 16 && xMouse
>= this.x
&& yMouse
>= this.y
&& yMouse
<= this.y
+ this.height
) {
92 if (this.needsConfirmOnTick
&& !this.checked
) {
93 this.confirmWindow
= new ConfirmWindow((ConfirmListener
)this, this.getConfirmMessageOnTick(), this.getConfirmQuestionOnTick());
94 } else if (this.needsConfirmUnTick
&& this.checked
) {
95 this.confirmWindow
= new ConfirmWindow((ConfirmListener
)this, this.getConfirmMessageUnTick(), this.getConfirmQuestionUnTick());
97 this.checked
= !this.checked
;
99 this.checkboxListener
.checkboxClicked(this);
103 protected int getMouseCursor(int x
, int y
) {
104 if (this.enabled
&& x
<= this.x
+ 16 && x
>= this.x
&& y
>= this.y
&& y
<= this.y
+ this.height
) {
107 return super.getMouseCursor(x
, y
);
110 public void pick(PickData pickData
, int xMouse
, int yMouse
) {
111 if (this.hoverString
!= null) {
112 pickData
.addText(this.hoverString
);
116 void setCustomColor(float r
, float g
, float b
) {
122 public void setHoverString(String description
) {
123 this.hoverString
= description
;
126 final void setConfirmOnTickMessage(String message
) {
127 this.confirmMessageOnTick
= message
;
130 final void setConfirmOnTickQuestion(String question
) {
131 this.confirmQuestionOnTick
= question
;
132 this.needsConfirmOnTick
= true;
135 final void setConfirm(String messageOnTick
, String questionOnTick
, String messageUnTick
, String questionUnTick
) {
136 this.confirmMessageOnTick
= messageOnTick
;
137 this.confirmQuestionOnTick
= questionOnTick
;
138 this.confirmMessageUnTick
= messageUnTick
;
139 this.confirmQuestionUnTick
= questionUnTick
;
140 this.needsConfirmOnTick
= questionOnTick
.length() > 0;
141 this.needsConfirmUnTick
= questionUnTick
.length() > 0;
144 public String
getConfirmMessageOnTick() {
145 return this.confirmMessageOnTick
;
148 public String
getConfirmQuestionOnTick() {
149 return this.confirmQuestionOnTick
;
152 public String
getConfirmMessageUnTick() {
153 return this.confirmMessageUnTick
;
156 public String
getConfirmQuestionUnTick() {
157 return this.confirmQuestionUnTick
;
160 public void closeConfirmWindow() {
161 if (this.confirmWindow
!= null) {
162 this.confirmWindow
.close();
163 this.confirmWindow
= null;
167 public void confirmed() {
168 this.closeConfirmWindow();
169 this.checked
= !this.checked
;
172 public void cancelled() {
173 this.closeConfirmWindow();
177 FloatBuffer vertex
= vbo
.lock();