You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			71 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Java
		
	
			
		
		
	
	
			71 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Java
		
	
package net.minecraft.client.gui;
 | 
						|
 | 
						|
import cpw.mods.fml.relauncher.Side;
 | 
						|
import cpw.mods.fml.relauncher.SideOnly;
 | 
						|
import net.minecraft.client.Minecraft;
 | 
						|
import net.minecraft.util.MathHelper;
 | 
						|
 | 
						|
@SideOnly(Side.CLIENT)
 | 
						|
public class ScaledResolution
 | 
						|
{
 | 
						|
    private int scaledWidth;
 | 
						|
    private int scaledHeight;
 | 
						|
    private double scaledWidthD;
 | 
						|
    private double scaledHeightD;
 | 
						|
    private int scaleFactor;
 | 
						|
    private static final String __OBFID = "CL_00000666";
 | 
						|
 | 
						|
    public ScaledResolution(Minecraft p_i1094_1_, int p_i1094_2_, int p_i1094_3_)
 | 
						|
    {
 | 
						|
        this.scaledWidth = p_i1094_2_;
 | 
						|
        this.scaledHeight = p_i1094_3_;
 | 
						|
        this.scaleFactor = 1;
 | 
						|
        boolean flag = p_i1094_1_.func_152349_b();
 | 
						|
        int k = p_i1094_1_.gameSettings.guiScale;
 | 
						|
 | 
						|
        if (k == 0)
 | 
						|
        {
 | 
						|
            k = 1000;
 | 
						|
        }
 | 
						|
 | 
						|
        while (this.scaleFactor < k && this.scaledWidth / (this.scaleFactor + 1) >= 320 && this.scaledHeight / (this.scaleFactor + 1) >= 240)
 | 
						|
        {
 | 
						|
            ++this.scaleFactor;
 | 
						|
        }
 | 
						|
 | 
						|
        if (flag && this.scaleFactor % 2 != 0 && this.scaleFactor != 1)
 | 
						|
        {
 | 
						|
            --this.scaleFactor;
 | 
						|
        }
 | 
						|
 | 
						|
        this.scaledWidthD = (double)this.scaledWidth / (double)this.scaleFactor;
 | 
						|
        this.scaledHeightD = (double)this.scaledHeight / (double)this.scaleFactor;
 | 
						|
        this.scaledWidth = MathHelper.ceiling_double_int(this.scaledWidthD);
 | 
						|
        this.scaledHeight = MathHelper.ceiling_double_int(this.scaledHeightD);
 | 
						|
    }
 | 
						|
 | 
						|
    public int getScaledWidth()
 | 
						|
    {
 | 
						|
        return this.scaledWidth;
 | 
						|
    }
 | 
						|
 | 
						|
    public int getScaledHeight()
 | 
						|
    {
 | 
						|
        return this.scaledHeight;
 | 
						|
    }
 | 
						|
 | 
						|
    public double getScaledWidth_double()
 | 
						|
    {
 | 
						|
        return this.scaledWidthD;
 | 
						|
    }
 | 
						|
 | 
						|
    public double getScaledHeight_double()
 | 
						|
    {
 | 
						|
        return this.scaledHeightD;
 | 
						|
    }
 | 
						|
 | 
						|
    public int getScaleFactor()
 | 
						|
    {
 | 
						|
        return this.scaleFactor;
 | 
						|
    }
 | 
						|
} |