ScaledResolution .java

net.minecraft.client.gui.ScaledResolution (class): members: getScaledHeight_double, getScaledWidth_double, getScaledHeight, getScaleFactor, getScaledWidth.

net.minecraft.client.guiclass68 linesclient1.7 KB

API Surface (5)

int getScaledWidth()
int getScaledHeight()
double getScaledWidth_double()
double getScaledHeight_double()
int getScaleFactor()

Fields & Constants (5)

scaledWidthD
scaledHeightD
scaledWidth
scaledHeight
scaleFactor

Code Graph: Dependencies (2)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

ScaledResolution.java68 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.client.gui;
2
3
import net.minecraft.client.Minecraft;
4
import net.minecraft.util.MathHelper;
5
6
public class ScaledResolution
7
{
8
    private final double scaledWidthD;
9
    private final double scaledHeightD;
10
    private int scaledWidth;
11
    private int scaledHeight;
12
    private int scaleFactor;
13
14
    public ScaledResolution(Minecraft p_i46445_1_)
15
    {
16
        this.scaledWidth = p_i46445_1_.displayWidth;
17
        this.scaledHeight = p_i46445_1_.displayHeight;
18
        this.scaleFactor = 1;
19
        boolean flag = p_i46445_1_.isUnicode();
20
        int i = p_i46445_1_.gameSettings.guiScale;
21
22
        if (i == 0)
23
        {
24
            i = 1000;
25
        }
26
27
        while (this.scaleFactor < i && this.scaledWidth / (this.scaleFactor + 1) >= 320 && this.scaledHeight / (this.scaleFactor + 1) >= 240)
28
        {
29
            ++this.scaleFactor;
30
        }
31
32
        if (flag && this.scaleFactor % 2 != 0 && this.scaleFactor != 1)
33
        {
34
            --this.scaleFactor;
35
        }
36
37
        this.scaledWidthD = (double)this.scaledWidth / (double)this.scaleFactor;
38
        this.scaledHeightD = (double)this.scaledHeight / (double)this.scaleFactor;
39
        this.scaledWidth = MathHelper.ceiling_double_int(this.scaledWidthD);
40
        this.scaledHeight = MathHelper.ceiling_double_int(this.scaledHeightD);
41
    }
42
43
    public int getScaledWidth()
44
    {
45
        return this.scaledWidth;
46
    }
47
48
    public int getScaledHeight()
49
    {
50
        return this.scaledHeight;
51
    }
52
53
    public double getScaledWidth_double()
54
    {
55
        return this.scaledWidthD;
56
    }
57
58
    public double getScaledHeight_double()
59
    {
60
        return this.scaledHeightD;
61
    }
62
63
    public int getScaleFactor()
64
    {
65
        return this.scaleFactor;
66
    }
67
}
68

Deobfuscated MCP 1.8.9 source of ScaledResolution from Marcelektro/MavenMCP-1.8.9 (net/minecraft/client/gui/ScaledResolution.java), stored verbatim.