    001    package net.minecraft.src;
    002
    003    import cpw.mods.fml.common.Side;
    004    import cpw.mods.fml.common.asm.SideOnly;
    005
    006    @SideOnly(Side.CLIENT)
    007    public class ScaledResolution
    008    {
    009        private int scaledWidth;
    010        private int scaledHeight;
    011        private double scaledWidthD;
    012        private double scaledHeightD;
    013        private int scaleFactor;
    014
    015        public ScaledResolution(GameSettings par1GameSettings, int par2, int par3)
    016        {
    017            this.scaledWidth = par2;
    018            this.scaledHeight = par3;
    019            this.scaleFactor = 1;
    020            int var4 = par1GameSettings.guiScale;
    021
    022            if (var4 == 0)
    023            {
    024                var4 = 1000;
    025            }
    026
    027            while (this.scaleFactor < var4 && this.scaledWidth / (this.scaleFactor + 1) >= 320 && this.scaledHeight / (this.scaleFactor + 1) >= 240)
    028            {
    029                ++this.scaleFactor;
    030            }
    031
    032            this.scaledWidthD = (double)this.scaledWidth / (double)this.scaleFactor;
    033            this.scaledHeightD = (double)this.scaledHeight / (double)this.scaleFactor;
    034            this.scaledWidth = MathHelper.ceiling_double_int(this.scaledWidthD);
    035            this.scaledHeight = MathHelper.ceiling_double_int(this.scaledHeightD);
    036        }
    037
    038        public int getScaledWidth()
    039        {
    040            return this.scaledWidth;
    041        }
    042
    043        public int getScaledHeight()
    044        {
    045            return this.scaledHeight;
    046        }
    047
    048        public double getScaledWidth_double()
    049        {
    050            return this.scaledWidthD;
    051        }
    052
    053        public double getScaledHeight_double()
    054        {
    055            return this.scaledHeightD;
    056        }
    057
    058        public int getScaleFactor()
    059        {
    060            return this.scaleFactor;
    061        }
    062    }