GuiVideoSettings .java

net.minecraft.client.gui.GuiVideoSettings (class): members: guiGameSettings, parentGuiScreen, optionsRowList, videoOptions, screenTitle, mouseReleased.

net.minecraft.client.guiclass129 linesclientextends GuiScreen5.0 KB

API Surface (6)

void initGui()
void handleMouseInput()
void actionPerformed(GuiButton button)
void mouseClicked(int mouseX, int mouseY, int mouseButton)
void mouseReleased(int mouseX, int mouseY, int state)
void drawScreen(int mouseX, int mouseY, float partialTicks)

Fields & Constants (5)

videoOptions
parentGuiScreen
screenTitle
guiGameSettings
optionsRowList

String literals (3)

"Video Settings"
"options.videoTitle"
"gui.done"

Code Graph: Dependencies (8)

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

Full Source

GuiVideoSettings.java129 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.client.gui;
2
3
import java.io.IOException;
4
import net.minecraft.client.renderer.OpenGlHelper;
5
import net.minecraft.client.resources.I18n;
6
import net.minecraft.client.settings.GameSettings;
7
8
public class GuiVideoSettings extends GuiScreen
9
{
10
    private GuiScreen parentGuiScreen;
11
    protected String screenTitle = "Video Settings";
12
    private GameSettings guiGameSettings;
13
    private GuiListExtended optionsRowList;
14
15
    /** An array of all of GameSettings.Options's video options. */
16
    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.GAMMA, GameSettings.Options.RENDER_CLOUDS, GameSettings.Options.PARTICLES, GameSettings.Options.USE_FULLSCREEN, GameSettings.Options.ENABLE_VSYNC, GameSettings.Options.MIPMAP_LEVELS, GameSettings.Options.BLOCK_ALTERNATIVES, GameSettings.Options.USE_VBO, GameSettings.Options.ENTITY_SHADOWS};
17
18
    public GuiVideoSettings(GuiScreen parentScreenIn, GameSettings gameSettingsIn)
19
    {
20
        this.parentGuiScreen = parentScreenIn;
21
        this.guiGameSettings = gameSettingsIn;
22
    }
23
24
    /**
25
     * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
26
     * window resizes, the buttonList is cleared beforehand.
27
     */
28
    public void initGui()
29
    {
30
        this.screenTitle = I18n.format("options.videoTitle", new Object[0]);
31
        this.buttonList.clear();
32
        this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height - 27, I18n.format("gui.done", new Object[0])));
33
34
        if (!OpenGlHelper.vboSupported)
35
        {
36
            GameSettings.Options[] agamesettings$options = new GameSettings.Options[videoOptions.length - 1];
37
            int i = 0;
38
39
            for (GameSettings.Options gamesettings$options : videoOptions)
40
            {
41
                if (gamesettings$options == GameSettings.Options.USE_VBO)
42
                {
43
                    break;
44
                }
45
46
                agamesettings$options[i] = gamesettings$options;
47
                ++i;
48
            }
49
50
            this.optionsRowList = new GuiOptionsRowList(this.mc, this.width, this.height, 32, this.height - 32, 25, agamesettings$options);
51
        }
52
        else
53
        {
54
            this.optionsRowList = new GuiOptionsRowList(this.mc, this.width, this.height, 32, this.height - 32, 25, videoOptions);
55
        }
56
    }
57
58
    /**
59
     * Handles mouse input.
60
     */
61
    public void handleMouseInput() throws IOException
62
    {
63
        super.handleMouseInput();
64
        this.optionsRowList.handleMouseInput();
65
    }
66
67
    /**
68
     * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
69
     */
70
    protected void actionPerformed(GuiButton button) throws IOException
71
    {
72
        if (button.enabled)
73
        {
74
            if (button.id == 200)
75
            {
76
                this.mc.gameSettings.saveOptions();
77
                this.mc.displayGuiScreen(this.parentGuiScreen);
78
            }
79
        }
80
    }
81
82
    /**
83
     * Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton
84
     */
85
    protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException
86
    {
87
        int i = this.guiGameSettings.guiScale;
88
        super.mouseClicked(mouseX, mouseY, mouseButton);
89
        this.optionsRowList.mouseClicked(mouseX, mouseY, mouseButton);
90
91
        if (this.guiGameSettings.guiScale != i)
92
        {
93
            ScaledResolution scaledresolution = new ScaledResolution(this.mc);
94
            int j = scaledresolution.getScaledWidth();
95
            int k = scaledresolution.getScaledHeight();
96
            this.setWorldAndResolution(this.mc, j, k);
97
        }
98
    }
99
100
    /**
101
     * Called when a mouse button is released.  Args : mouseX, mouseY, releaseButton
102
     */
103
    protected void mouseReleased(int mouseX, int mouseY, int state)
104
    {
105
        int i = this.guiGameSettings.guiScale;
106
        super.mouseReleased(mouseX, mouseY, state);
107
        this.optionsRowList.mouseReleased(mouseX, mouseY, state);
108
109
        if (this.guiGameSettings.guiScale != i)
110
        {
111
            ScaledResolution scaledresolution = new ScaledResolution(this.mc);
112
            int j = scaledresolution.getScaledWidth();
113
            int k = scaledresolution.getScaledHeight();
114
            this.setWorldAndResolution(this.mc, j, k);
115
        }
116
    }
117
118
    /**
119
     * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks
120
     */
121
    public void drawScreen(int mouseX, int mouseY, float partialTicks)
122
    {
123
        this.drawDefaultBackground();
124
        this.optionsRowList.drawScreen(mouseX, mouseY, partialTicks);
125
        this.drawCenteredString(this.fontRendererObj, this.screenTitle, this.width / 2, 5, 16777215);
126
        super.drawScreen(mouseX, mouseY, partialTicks);
127
    }
128
}
129

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