aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/polyfrost/oneconfig/renderer/Renderer.java
blob: 19d8710de7d2c408531472cfd969ca55dfe4b8f3 (plain)
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
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.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 drawString(String text, int x, int y, int color, boolean shadow) {
        fr.drawString(text, x, y, color, shadow);
    }

    public static void drawScaledImage(ResourceLocation location, int x, int y, int targetX, int targetY) {
        //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 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);
    }

}