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.
		
		
		
		
		
			
		
			
				
	
	
		
			120 lines
		
	
	
		
			4.8 KiB
		
	
	
	
		
			Java
		
	
			
		
		
	
	
			120 lines
		
	
	
		
			4.8 KiB
		
	
	
	
		
			Java
		
	
package net.minecraft.client.gui;
 | 
						|
 | 
						|
import cpw.mods.fml.relauncher.Side;
 | 
						|
import cpw.mods.fml.relauncher.SideOnly;
 | 
						|
import net.minecraft.client.renderer.OpenGlHelper;
 | 
						|
import net.minecraft.client.resources.I18n;
 | 
						|
import net.minecraft.client.settings.GameSettings;
 | 
						|
 | 
						|
@SideOnly(Side.CLIENT)
 | 
						|
public class GuiVideoSettings extends GuiScreen
 | 
						|
{
 | 
						|
    private GuiScreen parentGuiScreen;
 | 
						|
    protected String screenTitle = "Video Settings";
 | 
						|
    private GameSettings guiGameSettings;
 | 
						|
    private GuiListExtended optionsRowList;
 | 
						|
    /** An array of all of GameSettings.Options's video options. */
 | 
						|
    private static final GameSettings.Options[] videoOptions = new GameSettings.Options[] {GameSettings.Options.GRAPHICS, GameSettings.Options.RENDER_DISTANCE, GameSettings.Options.AMBIENT_OCCLUSION, GameSettings.Options.FRAMERATE_LIMIT, GameSettings.Options.ANAGLYPH, GameSettings.Options.VIEW_BOBBING, GameSettings.Options.GUI_SCALE, GameSettings.Options.ADVANCED_OPENGL, GameSettings.Options.GAMMA, GameSettings.Options.RENDER_CLOUDS, GameSettings.Options.PARTICLES, GameSettings.Options.USE_FULLSCREEN, GameSettings.Options.ENABLE_VSYNC, GameSettings.Options.MIPMAP_LEVELS, GameSettings.Options.ANISOTROPIC_FILTERING};
 | 
						|
    private static final String __OBFID = "CL_00000718";
 | 
						|
 | 
						|
    public GuiVideoSettings(GuiScreen p_i1062_1_, GameSettings p_i1062_2_)
 | 
						|
    {
 | 
						|
        this.parentGuiScreen = p_i1062_1_;
 | 
						|
        this.guiGameSettings = p_i1062_2_;
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * Adds the buttons (and other controls) to the screen in question.
 | 
						|
     */
 | 
						|
    public void initGui()
 | 
						|
    {
 | 
						|
        this.screenTitle = I18n.format("options.videoTitle", new Object[0]);
 | 
						|
        this.buttonList.clear();
 | 
						|
        this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height - 27, I18n.format("gui.done", new Object[0])));
 | 
						|
 | 
						|
        if (OpenGlHelper.field_153197_d)
 | 
						|
        {
 | 
						|
            this.optionsRowList = new GuiOptionsRowList(this.mc, this.width, this.height, 32, this.height - 32, 25, videoOptions);
 | 
						|
        }
 | 
						|
        else
 | 
						|
        {
 | 
						|
            GameSettings.Options[] aoptions = new GameSettings.Options[videoOptions.length - 1];
 | 
						|
            int i = 0;
 | 
						|
            GameSettings.Options[] aoptions1 = videoOptions;
 | 
						|
            int j = aoptions1.length;
 | 
						|
 | 
						|
            for (int k = 0; k < j; ++k)
 | 
						|
            {
 | 
						|
                GameSettings.Options options = aoptions1[k];
 | 
						|
 | 
						|
                if (options != GameSettings.Options.ADVANCED_OPENGL)
 | 
						|
                {
 | 
						|
                    aoptions[i] = options;
 | 
						|
                    ++i;
 | 
						|
                }
 | 
						|
            }
 | 
						|
 | 
						|
            this.optionsRowList = new GuiOptionsRowList(this.mc, this.width, this.height, 32, this.height - 32, 25, aoptions);
 | 
						|
        }
 | 
						|
    }
 | 
						|
 | 
						|
    protected void actionPerformed(GuiButton button)
 | 
						|
    {
 | 
						|
        if (button.enabled)
 | 
						|
        {
 | 
						|
            if (button.id == 200)
 | 
						|
            {
 | 
						|
                this.mc.gameSettings.saveOptions();
 | 
						|
                this.mc.displayGuiScreen(this.parentGuiScreen);
 | 
						|
            }
 | 
						|
        }
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * Called when the mouse is clicked.
 | 
						|
     */
 | 
						|
    protected void mouseClicked(int mouseX, int mouseY, int mouseButton)
 | 
						|
    {
 | 
						|
        int l = this.guiGameSettings.guiScale;
 | 
						|
        super.mouseClicked(mouseX, mouseY, mouseButton);
 | 
						|
        this.optionsRowList.func_148179_a(mouseX, mouseY, mouseButton);
 | 
						|
 | 
						|
        if (this.guiGameSettings.guiScale != l)
 | 
						|
        {
 | 
						|
            ScaledResolution scaledresolution = new ScaledResolution(this.mc, this.mc.displayWidth, this.mc.displayHeight);
 | 
						|
            int i1 = scaledresolution.getScaledWidth();
 | 
						|
            int j1 = scaledresolution.getScaledHeight();
 | 
						|
            this.setWorldAndResolution(this.mc, i1, j1);
 | 
						|
        }
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * Called when the mouse is moved or a mouse button is released.  Signature: (mouseX, mouseY, which) which==-1 is
 | 
						|
     * mouseMove, which==0 or which==1 is mouseUp
 | 
						|
     */
 | 
						|
    protected void mouseMovedOrUp(int mouseX, int mouseY, int state)
 | 
						|
    {
 | 
						|
        int l = this.guiGameSettings.guiScale;
 | 
						|
        super.mouseMovedOrUp(mouseX, mouseY, state);
 | 
						|
        this.optionsRowList.func_148181_b(mouseX, mouseY, state);
 | 
						|
 | 
						|
        if (this.guiGameSettings.guiScale != l)
 | 
						|
        {
 | 
						|
            ScaledResolution scaledresolution = new ScaledResolution(this.mc, this.mc.displayWidth, this.mc.displayHeight);
 | 
						|
            int i1 = scaledresolution.getScaledWidth();
 | 
						|
            int j1 = scaledresolution.getScaledHeight();
 | 
						|
            this.setWorldAndResolution(this.mc, i1, j1);
 | 
						|
        }
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * Draws the screen and all the components in it.
 | 
						|
     */
 | 
						|
    public void drawScreen(int mouseX, int mouseY, float partialTicks)
 | 
						|
    {
 | 
						|
        this.drawDefaultBackground();
 | 
						|
        this.optionsRowList.drawScreen(mouseX, mouseY, partialTicks);
 | 
						|
        this.drawCenteredString(this.fontRendererObj, this.screenTitle, this.width / 2, 5, 16777215);
 | 
						|
        super.drawScreen(mouseX, mouseY, partialTicks);
 | 
						|
    }
 | 
						|
} |