1
0
Fork 0

fix fonts

This commit is contained in:
Sen 2025-06-11 18:42:53 +02:00
parent cd7a739c5d
commit 6114da126a
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
14 changed files with 124 additions and 81 deletions

View file

@ -241,8 +241,8 @@ public class Client implements IThreadListener {
}
}
public static class RedrawFunction implements FloatFunction {
public void apply(FloatVar cv, float value) {
public static class RedrawFunction implements IntFunction {
public void apply(IntVar cv, int value) {
Client.CLIENT.rescale();
}
}
@ -253,6 +253,13 @@ public class Client implements IThreadListener {
}
}
public static class FontFunction implements BoolFunction {
public void apply(BoolVar cv, boolean value) {
Font.load(value);
Client.CLIENT.rescale();
}
}
private interface DebugRunner {
void execute(Keysym key);
}
@ -420,8 +427,8 @@ public class Client implements IThreadListener {
public int mouse_x;
public int mouse_y;
@Variable(name = "gui_scale", category = CVarCategory.GUI, min = 1.0f, max = 5.0f, display = "Skalierung der Benutzeroberfläche", precision = 1, unit = "%", callback = RedrawFunction.class)
private float scale = 1.0f;
@Variable(name = "gui_scale", category = CVarCategory.GUI, min = 1, max = 5, display = "Skalierung der Benutzeroberfläche", unit = "x", callback = RedrawFunction.class)
private int scale = 1;
@Variable(name = "phy_sensitivity", category = CVarCategory.INPUT, min = 0.01f, max = 10.0f, display = "Mausempfindlichkeit", precision = 2, unit = "%")
public float sensitivity = 1.0f;
@ -463,6 +470,8 @@ public class Client implements IThreadListener {
public Style style = Style.DEFAULT;
@Variable(name = "gui_scroll_lines", category = CVarCategory.GUI, min = 1, max = 10, display = "Scrollbreite", unit = "Zeilen")
public int scrollLines = 3;
@Variable(name = "gui_font_tiny", category = CVarCategory.GUI, display = "Kleine Schriftart", callback = FontFunction.class)
public boolean tinyFont = false;
@ -978,10 +987,10 @@ public class Client implements IThreadListener {
String name = (potion.isBadEffect() ? TextColor.ORANGE : TextColor.ACID) + effect.getEffectName();
String desc = TextColor.NEON + effect.getDurationString();
// Drawing.drawRectColor(x, y, 250, Font.DEFAULT.yglyph + 2, color | 0xff000000);
Drawing.drawRectBorder(x, y, 250, Font.YGLYPH + 4, 0xff000000, 0xff202020, 0xffcfcfcf, 0xff6f6f6f);
Drawing.drawGradient(x + 2, y + 2, effect.isInfinite() ? 246 : ((int)(246.0f * ((float)effect.getRemaining() / (float)effect.getDuration()))), Font.YGLYPH, color | 0xff000000, Util.mixColor(color | 0xff000000, 0xff000000));
Drawing.drawText(name, x + 4, y + 2, 0xffffffff);
Drawing.drawTextRight(desc, x + 250 - 4, y + 2, 0xffffffff);
Drawing.drawRectBorder(x, y, 250, Font.YGLYPH + 6, 0xff000000, 0xff202020, 0xffcfcfcf, 0xff6f6f6f);
Drawing.drawGradient(x + 2, y + 2, effect.isInfinite() ? 246 : ((int)(246.0f * ((float)effect.getRemaining() / (float)effect.getDuration()))), Font.YGLYPH + 2, color | 0xff000000, Util.mixColor(color | 0xff000000, 0xff000000));
Drawing.drawText(name, x + 4, y + 3, 0xffffffff);
Drawing.drawTextRight(desc, x + 250 - 4, y + 3, 0xffffffff);
y += 24;
}
}
@ -1990,8 +1999,8 @@ public class Client implements IThreadListener {
GL11.glViewport(0, 0, x, y);
fb_raw_x = x;
fb_raw_y = y;
fb_x = Math.max((int)((float)x / this.scale), 1);
fb_y = Math.max((int)((float)y / this.scale), 1);
fb_x = Math.max(x / this.scale, 1);
fb_y = Math.max(y / this.scale, 1);
if(this.open != null) {
this.refreshing = true;
this.displayGuiScreen(this.open);
@ -2015,8 +2024,8 @@ public class Client implements IThreadListener {
this.moveCamera((float)(x - mouse_raw_x) * sensitivity, (float)(mouse_raw_y - y) * sensitivity);
mouse_raw_x = x;
mouse_raw_y = y;
mouse_x = (int)((float)x / this.scale);
mouse_y = (int)((float)y / this.scale);
mouse_x = x / this.scale;
mouse_y = y / this.scale;
mouseFirst = false;
if(open != null && Bind.isInputEnabled() && Button.isMouseDown() /* && !(win->mouse & 0xfc) */ && !ctrl()) {
// if(mouse_clickx < 0 || mouse_clicky < 0) {
@ -2100,9 +2109,8 @@ public class Client implements IThreadListener {
}
private void rescale() {
Font.setScale(this.scale);
this.fb_x = Math.max((int)((float)this.fb_raw_x / this.scale), 1);
this.fb_y = Math.max((int)((float)this.fb_raw_y / this.scale), 1);
this.fb_x = Math.max(this.fb_raw_x / this.scale, 1);
this.fb_y = Math.max(this.fb_raw_y / this.scale, 1);
if(this.open != null) {
this.refreshing = true;
this.displayGuiScreen(this.open);
@ -2200,12 +2208,12 @@ public class Client implements IThreadListener {
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glLoadIdentity();
GL11.glTranslatef(0.0F, 0.0F, -2000.0F);
if(this.scale != 1.0f)
GL11.glScalef(this.scale, this.scale, 1.0f);
if(this.scale != 1)
GL11.glScalef((float)this.scale, (float)this.scale, 1.0f);
}
public void scissor(int x, int y, int width, int height) {
GL11.glScissor((int)((float)x * this.scale), (int)((float)y * this.scale), (int)((float)width * this.scale), (int)((float)height * this.scale));
GL11.glScissor(x * this.scale, y * this.scale, width * this.scale, height * this.scale);
}
private void addFrame(long runningTime)
@ -2255,7 +2263,7 @@ public class Client implements IThreadListener {
this.registerDebug();
System.gc();
System.gc();
Font.load();
Font.load(false);
GlState.enableBlend();
GlState.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
this.initConsole();
@ -3226,10 +3234,10 @@ public class Client implements IThreadListener {
int by = 0;
for(Entry<String, Integer> elem : this.playerList.entrySet()) {
int x = this.fb_x / 2 - (w * 300) / 2 + bx * 300;
int y = 10 + by * Font.YGLYPH;
Drawing.drawGradient(x, y, 300, Font.YGLYPH, 0x7f404040, 0x7f000000);
Drawing.drawText(elem.getKey(), x + 4, y, 0xffffffff);
Drawing.drawTextRight(formatPing(elem.getValue()), x + 300 - 4, y, 0xffffffff);
int y = 10 + by * (Font.YGLYPH + 2);
Drawing.drawGradient(x, y, 300, Font.YGLYPH + 2, 0x7f404040, 0x7f000000);
Drawing.drawText(elem.getKey(), x + 4, y + 1, 0xffffffff);
Drawing.drawTextRight(formatPing(elem.getValue()), x + 300 - 4, y + 1, 0xffffffff);
if(++bx >= w) {
bx = 0;
++by;