add crosshair customization
This commit is contained in:
parent
9cefe7602b
commit
e78bd9cce6
5 changed files with 32 additions and 8 deletions
|
@ -481,6 +481,12 @@ public class Client implements IThreadListener {
|
|||
public int downfallRange = 4;
|
||||
@Variable(name = "draw_rain_particle_range", category = CVarCategory.RENDER, min = 0, max = 25, display = "Regen-Partikel-Radius")
|
||||
public int rainParticleRange = 10;
|
||||
@Variable(name = "crosshair_size", category = CVarCategory.GUI, min = 0, max = 32, display = "Größe des Fadenkreuzes")
|
||||
public int crosshairSize = 10;
|
||||
@Variable(name = "crosshair_color_notarget", type = IntType.COLOR, category = CVarCategory.GUI, display = "Fadenkreuz-Farbe (ohne Ziel)")
|
||||
public int crosshairColorBase = 0xffcfcfcf;
|
||||
@Variable(name = "crosshair_color_target", type = IntType.COLOR, category = CVarCategory.GUI, display = "Fadenkreuz-Farbe (mit Ziel)")
|
||||
public int crosshairColorTarget = 0xffffffff;
|
||||
|
||||
@Variable(name = "tic_target", category = CVarCategory.SYSTEM, min = 1.0f, max = 1200.0f, callback = TickFunction.class, display = "Tickrate")
|
||||
public float tpsTarget = 20.0f;
|
||||
|
@ -942,9 +948,9 @@ public class Client implements IThreadListener {
|
|||
if(this.drawDebug) {
|
||||
this.renderWorldDirections((float)this.tick_fraction);
|
||||
}
|
||||
else {
|
||||
Drawing.drawRect(this.fb_x / 2 - 1, this.fb_y / 2 - 16, 2, 32, this.pointed != null && this.pointed.type != ObjectType.MISS ? 0xffffffff : 0xffcfcfcf);
|
||||
Drawing.drawRect(this.fb_x / 2 - 16, this.fb_y / 2 - 1, 32, 2, this.pointed != null && this.pointed.type != ObjectType.MISS ? 0xffffffff : 0xffcfcfcf);
|
||||
else if(this.crosshairSize > 0) {
|
||||
Drawing.drawRect(this.fb_x / 2 - 1, this.fb_y / 2 - this.crosshairSize, 2, this.crosshairSize * 2, this.pointed != null && this.pointed.type != ObjectType.MISS ? this.crosshairColorTarget : this.crosshairColorBase);
|
||||
Drawing.drawRect(this.fb_x / 2 - this.crosshairSize, this.fb_y / 2 - 1, this.crosshairSize * 2, 2, this.pointed != null && this.pointed.type != ObjectType.MISS ? this.crosshairColorTarget : this.crosshairColorBase);
|
||||
}
|
||||
}
|
||||
if(this.world != null && this.open == null) {
|
||||
|
|
|
@ -8,8 +8,11 @@ import client.Client;
|
|||
import client.gui.element.Dropdown;
|
||||
import client.gui.element.Dropdown.Handle;
|
||||
import client.gui.element.Element;
|
||||
import client.gui.element.Field;
|
||||
import client.renderer.Drawing;
|
||||
import client.renderer.GlState;
|
||||
import client.vars.CVar;
|
||||
import client.vars.ColorVar;
|
||||
import client.window.Bind;
|
||||
import client.window.Button;
|
||||
import client.window.Keysym;
|
||||
|
@ -182,7 +185,12 @@ public abstract class Gui {
|
|||
}
|
||||
|
||||
protected Element addSelector(String cvar, int x, int y, int w, int h) {
|
||||
return this.add(this.gm.getVar(cvar).selector(x, y, w, h));
|
||||
CVar cv = this.gm.getVar(cvar);
|
||||
if(cv instanceof ColorVar color) {
|
||||
this.add(color.label(x, y, w));
|
||||
return this.add(color.editor(x, y, w, h));
|
||||
}
|
||||
return this.add(cv.selector(x, y, w, h));
|
||||
}
|
||||
|
||||
public void draw() {
|
||||
|
|
|
@ -7,6 +7,11 @@ public class GuiGraphics extends GuiOptions {
|
|||
public void init(int width, int height) {
|
||||
this.addSelector("draw_downfall_range", 0, 0, 240, 0);
|
||||
this.addSelector("draw_rain_particle_range", 242, 0, 240, 0);
|
||||
|
||||
this.addSelector("crosshair_size", 0, 20, 240, 0);
|
||||
|
||||
this.addSelector("crosshair_color_notarget", 0, 70, 240, 0);
|
||||
this.addSelector("crosshair_color_target", 242, 70, 240, 0);
|
||||
|
||||
super.init(width, height);
|
||||
}
|
||||
|
|
|
@ -41,8 +41,7 @@ public class GuiStyle extends GuiOptions implements DropdownCallback<String>, Bu
|
|||
protected Element addSelector(String cvar, int x, int y, int w, int h) {
|
||||
CVar cv = this.gm.getVar(cvar);
|
||||
if(cv instanceof ColorVar color) {
|
||||
if(!color.getDisplay().isEmpty())
|
||||
this.add(color.label(x, y, w));
|
||||
this.add(color.label(x, y, w));
|
||||
if(this.gm.style != Style.CUSTOM)
|
||||
return this.add(new Field(x, y, w, h, color.getFieldValue(this.gm.style)));
|
||||
else
|
||||
|
|
|
@ -46,8 +46,14 @@ public class ColorVar extends IntVar {
|
|||
public client.gui.element.Field editor(int x, int y, int w, int h) {
|
||||
return new client.gui.element.Field(x, y, w, h, this.alpha ? 8 : 6, new FieldCallback() {
|
||||
public void use(client.gui.element.Field elem, FieldAction value) {
|
||||
if(value == FieldAction.SEND || value == FieldAction.UNFOCUS)
|
||||
ColorVar.this.parse(elem.getText());
|
||||
if(value == FieldAction.SEND || value == FieldAction.UNFOCUS) {
|
||||
if(!ColorVar.this.parse(elem.getText()))
|
||||
elem.setText(ColorVar.this.format());
|
||||
}
|
||||
else if(value == FieldAction.FUNCTION) {
|
||||
ColorVar.this.parse(ColorVar.this.getDefault());
|
||||
elem.setText(ColorVar.this.format());
|
||||
}
|
||||
}
|
||||
}, this.format());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue