GenuineSounds

ScaledResolution better.

Jun 19th, 2012
173
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.07 KB | None | 0 0
  1. package net.minecraft.src;
  2.  
  3. public class ScaledResolution {
  4.  
  5.     private GameSettings gameSettings;
  6.  
  7.     private int scaledWidth;
  8.  
  9.     private int scaledHeight;
  10.  
  11.     public double scaledWidthD;
  12.  
  13.     public double scaledHeightD;
  14.  
  15.     public int scaleFactor;
  16.  
  17.     public ScaledResolution(GameSettings gameSettings, int width, int height) {
  18.         this.gameSettings = par1GameSettings;
  19.         changeResolution(width, height);
  20.     }
  21.  
  22.     public void changeResolution(int width, int height) {
  23.         scaledWidth = width;
  24.         scaledHeight = height;
  25.         scaleFactor = 1;
  26.         int i = gameSettings.guiScale;
  27.         if (i == 0)
  28.             i = 1000;
  29.         for (; scaleFactor < i && scaledWidth / (scaleFactor + 1) >= 320 && scaledHeight / (scaleFactor + 1) >= 240; scaleFactor++) {}
  30.         scaledWidthD = (double) scaledWidth / (double) scaleFactor;
  31.         scaledHeightD = (double) scaledHeight / (double) scaleFactor;
  32.         scaledWidth = (int) Math.ceil(scaledWidthD);
  33.         scaledHeight = (int) Math.ceil(scaledHeightD);
  34.     }
  35.  
  36.     public int getScaledWidth() {
  37.         return scaledWidth;
  38.     }
  39.  
  40.     public int getScaledHeight() {
  41.         return scaledHeight;
  42.     }
  43. }
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment