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
48
49
50
51
52
53
54
55
56
57
|
package io.polyfrost.oneconfig.renderer;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.ResourceLocation;
import java.awt.*;
public class Renderer extends Gui {
private static final Minecraft mc = Minecraft.getMinecraft();
private static final FontRenderer fr = mc.fontRendererObj;
public static void drawRectangle(int left, int top, int right, int bottom, int color) {
Gui.drawRect(left, top, right, bottom, color);
}
public static void drawTextScale(String text, float x, float y, int color, boolean shadow, float scale) {
GlStateManager.pushMatrix();
GlStateManager.scale(scale, scale, 1);
mc.fontRendererObj.drawString(text, x * (1 / scale), y * (1 / scale), color, shadow);
GlStateManager.popMatrix();
}
public static void drawScaledImage(ResourceLocation location, int x, int y, int targetX, int targetY) {
GlStateManager.enableBlend();
GlStateManager.color(1f, 1f, 1f, 1f);
mc.getTextureManager().bindTexture(location);
Gui.drawScaledCustomSizeModalRect(x, y, 0, 0, targetX, targetY, targetX, targetY, targetX, targetY);
}
public static void drawRoundRectangle(int left, int top, int right, int bottom, int cornerRadius, int color) {
}
public static float clamp(float number) {
return number < (float) 0.0 ? (float) 0.0 : Math.min(number, (float) 1.0);
}
public static float easeOut(float current, float goal) {
if (Math.floor(Math.abs(goal - current) / (float) 0.01) > 0) {
return current + (goal - current) / (float) 20.0;
} else {
return goal;
}
}
public static Color getColorFromInt(int color) {
float f = (float)(color >> 16 & 255) / 255.0F;
float f1 = (float)(color >> 8 & 255) / 255.0F;
float f2 = (float)(color & 255) / 255.0F;
float f3 = (float)(color >> 24 & 255) / 255.0F;
return new Color(f, f1, f2, f3);
}
}
|