Package org.spoutcraft.api.gui

Examples of org.spoutcraft.api.gui.Control


    this.parent = parent;
  }

  @Override
  public void initGui() {
    Control control;

    GenericScrollArea screen = new GenericScrollArea();
    scroll = screen;
    screen.setHeight(height - 24 - 30).setWidth(width).setY(24).setX(0);
    getScreen().attachWidget("Spoutcraft", screen);

    GenericLabel label = new GenericLabel("Game Settings");
    int size = Spoutcraft.getMinecraftFont().getTextWidth(label.getText());
    label.setX((int) (width / 2 - size / 2)).setY(10);
    label.setFixed(true).setPriority(RenderPriority.Lowest);
    getScreen().attachWidget("Spoutcraft", label);

    int left = (int)(width / - 155);
    int right = (int)(width / 2 + 5);
    int center = (int)(width / 2 - 75);

    control = new ResetButton(parent).setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(height - 25);
    getScreen().attachWidget("Spoutcraft", control);

    switchToAdvancedCheck = new GenericCheckBox("Advanced");
    switchToAdvancedCheck.setChecked(false);
    switchToAdvancedCheck.setX(5).setY(3).setWidth(100).setHeight(20);
    switchToAdvancedCheck.setPriority(RenderPriority.Low);
    getScreen().attachWidget("Spoutcraft", switchToAdvancedCheck);

    doneButton = new GenericButton("Done");
    doneButton.setAlign(WidgetAnchor.CENTER_CENTER);
    doneButton.setX(right).setY(height - 25);
    doneButton.setHeight(20).setWidth(150);
    getScreen().attachWidget("Spoutcraft", doneButton);

    int top = 5;

    Color grey = new Color(0.80F, 0.80F, 0.80F, 0.65F);

    label = new GenericLabel("Controls and Audio Settings");
    size = Spoutcraft.getMinecraftFont().getTextWidth(label.getText());
    label.setX((int) (width / 2 - size / 2)).setY(top);
    label.setTextColor(grey);
    screen.attachWidget("Spoutcraft", label);
    top += 11;

    Gradient linebreak = new GenericGradient();
    linebreak.setBottomColor(grey);
    linebreak.setTopColor(grey);
    linebreak.setX(width/2 - 318 / 2).setY(top).setHeight(3).setWidth(318);
    screen.attachWidget("Spoutcraft", linebreak);
    top += 6;

    control = new MusicSlider().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);

    control = new SoundEffectsSlider().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);
    top += 22;

    control = new FieldOfViewSlider().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);

    control = new DifficultyButton().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);
    top += 22;
   
    control = new TexturesButton(this).setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(center).setY(top);
    screen.attachWidget("Spoutcraft", control);
    top += 22;

    control = new ControlsButton(this).setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);

    control = new LanguagesButton(this).setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);
    top += 22;

    control = new ChatButton(this).setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);

    control = new MinimapButton(this).setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);

    top += 22;

    // Graphics
View Full Code Here


    super.setWorldAndResolution(mc, width, height);
    scrollArea.setScrollPosition(Orientation.VERTICAL, scroll);
  }

  public void initGui() {
    Control control;

    GenericScrollArea screen = new GenericScrollArea();
    scrollArea = screen;
    screen.setHeight(height - 24 - 30).setWidth(width).setY(24).setX(0);
    getScreen().attachWidget("Spoutcraft", screen);

    GenericLabel label = new GenericLabel("Game Settings");
    int size = Spoutcraft.getMinecraftFont().getTextWidth(label.getText());
    label.setX((int) (width / 2 - size / 2)).setY(10);
    label.setFixed(true).setPriority(RenderPriority.Lowest);
    getScreen().attachWidget("Spoutcraft", label);

    int left = (int)(width / - 155);
    int right = (int)(width / 2 + 5);
    int center = (int)(width / 2 - 75);

    control = new ResetButton(parent).setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(height - 25);
    getScreen().attachWidget("Spoutcraft", control);

    switchToSimpleCheck = new GenericCheckBox("Advanced");
    switchToSimpleCheck.setChecked(true);
    switchToSimpleCheck.setAlign(WidgetAnchor.CENTER_CENTER);
    switchToSimpleCheck.setX(5).setY(3).setWidth(100).setHeight(20);
    switchToSimpleCheck.setPriority(RenderPriority.Low);
    getScreen().attachWidget("Spoutcraft", switchToSimpleCheck);

    doneButton = new GenericButton("Done");
    doneButton.setAlign(WidgetAnchor.CENTER_CENTER);
    doneButton.setX(right).setY(height - 25);
    doneButton.setHeight(20).setWidth(150);
    getScreen().attachWidget("Spoutcraft", doneButton);

    int top = 5;

    Color grey = new Color(0.80F, 0.80F, 0.80F, 0.65F);

    // Controls and audio
    label = new GenericLabel("Controls and Audio Settings");
    size = Spoutcraft.getMinecraftFont().getTextWidth(label.getText());
    label.setX((int) (width / 2 - size / 2)).setY(top);
    label.setTextColor(grey);
    screen.attachWidget("Spoutcraft", label);
    top += 11;

    Gradient linebreak = new GenericGradient();
    linebreak.setBottomColor(grey);
    linebreak.setTopColor(grey);
    linebreak.setX(width/2 - 318 / 2).setY(top).setHeight(3).setWidth(318);
    screen.attachWidget("Spoutcraft", linebreak);
    top += 6;

    control = new MusicSlider().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);

    control = new SoundEffectsSlider().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);
    top += 22;

    control = new FieldOfViewSlider().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);

    control = new SensitivitySlider().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);
    top += 22;

    control = new InvertMouseButton().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);

    control = new DifficultyButton().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);
    top += 22;

    control = new TexturesButton(this).setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(center).setY(top);
    screen.attachWidget("Spoutcraft", control);
    top += 22;

    control = new ControlsButton(this).setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);

    control = new LanguagesButton(this).setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);
    top += 22;

    control = new ChatButton(this).setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);

    control = new MinimapButton(this).setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);

    top += 22;

    // Graphics
    label = new GenericLabel("Graphical Settings");
    size = Spoutcraft.getMinecraftFont().getTextWidth(label.getText());
    label.setX((int) (width / 2 - size / 2)).setY(top);
    label.setTextColor(grey);
    screen.attachWidget("Spoutcraft", label);
    top += 11;

    linebreak = new GenericGradient();
    linebreak.setBottomColor(grey);
    linebreak.setTopColor(grey);
    linebreak.setX(width/2 - 318 / 2).setY(top).setHeight(3).setWidth(318);
    screen.attachWidget("Spoutcraft", linebreak);
    top += 6;

    // TODO Clean up references to Spoutworth and remove message
    Label message = new GenericLabel("");
    message.setWidth(150).setHeight(20).setX(left).setY(top);

    if (Configuration.isAutomatePerformance()) {
      screen.attachWidget("Spoutcraft", message);

      //top += 47;
    }

    RadioButton button;
    button = (RadioButton) new FavorPerformanceButton("Favor Performance", message).setGroup(1).setAlign(WidgetAnchor.TOP_CENTER);
    button.setWidth(150).setHeight(20).setX(left).setY(top);
    button.setTooltip("Spoutcraft will attempt to provide smooth framerates, potentially at the cost of appearance.");
    screen.attachWidget("Spoutcraft", button);
    button.setSelected(Configuration.isAutomatePerformance() && Configuration.getAutomateMode() == 0);

    button = (RadioButton) new OptimalGameplayButton("Balanced Gameplay", message).setGroup(1).setAlign(WidgetAnchor.TOP_CENTER);
    button.setWidth(150).setHeight(20).setX(right).setY(top);
    button.setTooltip("Spoutcraft will attempt to provide reasonable framerates and appearance.");
    screen.attachWidget("Spoutcraft", button);
    button.setSelected(Configuration.isAutomatePerformance() && Configuration.getAutomateMode() == 1);

    top += 22;

    button = (RadioButton) new FavorAppearanceButton("Favor Appearance", message).setGroup(1).setAlign(WidgetAnchor.TOP_CENTER);
    button.setWidth(150).setHeight(20).setX(left).setY(top);
    button.setTooltip("Spoutcraft will attempt to provide the best appearance, but potentially at the cost of framerates.");
    screen.attachWidget("Spoutcraft", button);
    button.setSelected(Configuration.isAutomatePerformance() && Configuration.getAutomateMode() == 2);

    button = (RadioButton) new ManualSelectionButton("Manual Selection", message, parent).setGroup(1).setAlign(WidgetAnchor.TOP_CENTER);
    button.setWidth(150).setHeight(20).setX(right).setY(top);
    button.setTooltip("Disable automatic performance settings and adjust the settings manually.");
    screen.attachWidget("Spoutcraft", button);
    button.setSelected(!Configuration.isAutomatePerformance());

    top += 22;

    linebreak = new GenericGradient();
    linebreak.setBottomColor(grey);
    linebreak.setTopColor(grey);
    linebreak.setX(width/2 - 318 / 2).setY(top).setHeight(3).setWidth(318);
    screen.attachWidget("Spoutcraft", linebreak);
    top += 6;

    ArrayList<CheckBox> graphicCheckboxes = new ArrayList<CheckBox>();

    control = new FancyGraphicsButton().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX((int) (width / 2 - size / 2) - 75/2).setY(top);
    screen.attachWidget("Spoutcraft", control);
    UUID fancyGraphics = control.getId();
    top+=20;

    control = new FancyGrassButton(fancyGraphics).setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);
    graphicCheckboxes.add((CheckBox) control);

    control = new FancyCloudsButton(fancyGraphics).setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);
    graphicCheckboxes.add((CheckBox) control);

    top += 22;

    control = new BiomeColorsButton(fancyGraphics).setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);
    graphicCheckboxes.add((CheckBox) control);

    control = new FancyFogButton(fancyGraphics).setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);
    graphicCheckboxes.add((CheckBox) control);

    top += 22;

    control = new FancyWaterButton(fancyGraphics).setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);
    graphicCheckboxes.add((CheckBox) control);

    control = new FancyTreesButton(fancyGraphics).setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);
    graphicCheckboxes.add((CheckBox) control);

    top += 22;

    control = new FancyLightingButton(fancyGraphics).setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);
    graphicCheckboxes.add((CheckBox) control);

    control = new FancyWeatherButton(fancyGraphics).setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);
    graphicCheckboxes.add((CheckBox) control);

    top += 22;

    control = new SmoothFPSButton().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);

    control = new FancyParticlesButton(fancyGraphics).setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);
    graphicCheckboxes.add((CheckBox) control);

    ((FancyGraphicsButton)screen.getWidget(fancyGraphics)).setLinkedButtons(graphicCheckboxes);

    top += 22;

    control = new ConnectedTexturesButton().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);

    control = new FancyItemsButton(fancyGraphics).setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);
    graphicCheckboxes.add((CheckBox) control);

    top += 22;

    control = new RandomMobTextureButton().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);
   
    control = new DisplayAnimalHeatinColorButton().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);

    top += 22;

    control = new OptimizedLightingUpdatesButton().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);
   
    control = new DisplayCustomParticlesButton().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);

    top += 22;
    control = new ServerLightButton().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);
   
    control = new DisplayEntityNamesinRangeButton().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);

    top += 22;
    control = new AmbientOcclusionButton().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);
   
    control = new DisplayPlayerNames3rdPersonButton().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);

    top += 22;
   
    control = new RenderDistanceButton().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);

    control = new BetterGrassButton().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);
    top += 22;

    top += 5;

    // Performance
    label = new GenericLabel("Performance Settings");
    size = Spoutcraft.getMinecraftFont().getTextWidth(label.getText());
    label.setX((int) (width / 2 - size / 2)).setY(top);
    label.setTextColor(grey);
    screen.attachWidget("Spoutcraft", label);
    top += 11;

    linebreak = new GenericGradient();
    linebreak.setBottomColor(grey);
    linebreak.setTopColor(grey);
    linebreak.setX(width/2 - 318 / 2).setY(top).setHeight(3).setWidth(318);
    screen.attachWidget("Spoutcraft", linebreak);
    top += 6;

    control = new ChunkRenderSpeed().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);

    control = new FarViewButton().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);

    top += 22;

    control = new PerformanceButton().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);

    control = new AutosaveButton().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);
    top += 22;

    control = new AdvancedOpenGLButton().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);

    control = new SignDistanceButton().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);
   
    top +=22;
    control = new AntiAliasingButton().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(center).setY(top);
    screen.attachWidget("Spoutcraft", control);

    top += 22;

    top += 5;

    // Appearance
    label = new GenericLabel("Appearance Settings");
    size = Spoutcraft.getMinecraftFont().getTextWidth(label.getText());
    label.setX((int) (width / 2 - size / 2)).setY(top);
    label.setTextColor(grey);
    screen.attachWidget("Spoutcraft", label);
    top += 11;

    linebreak = new GenericGradient();
    linebreak.setBottomColor(grey);
    linebreak.setTopColor(grey);
    linebreak.setX(width/2 - 318 / 2).setY(top).setHeight(3).setWidth(318);
    screen.attachWidget("Spoutcraft", linebreak);
    top += 6;

    control = new TimeButton().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);

    control = new FastDebugInfoButton().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);
    top += 22;

    control = new SkyToggleButton().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);

    control = new WeatherToggleButton().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);
    top += 22;

    control = new StarsToggleButton().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);

    control = new ClearWaterToggleButton().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);
    top += 22;

    control = new ViewBobbingButton().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);

    control = new VoidFogButton().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);
    top += 22;

    control = new DelayedTooltipCheckbox().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);

    control = new WaterBiomeColorsButton().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);

    top += 22;

    control = new Anaglyph3DButton().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);

    control = new ServerTexturesButton().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);
   
    top +=22;
   
    control = new HotbarTextButton().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);
   
    control = new ChatColorAssistButton().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);

    top += 22;

    control = new SmoothLightingSlider().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);

    control = new BrightnessSlider().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);

    top += 22;

    control = new MipMapSlider().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);

    control = new FlightSpeedSlider().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);

    top += 22;

    control = new HotbarQuickKeysButton().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);

    control = new GuiScaleButton(this).setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);

    top += 22;

    top += 5;

    // Inventory
    label = new GenericLabel("Inventory Settings");
    size = Spoutcraft.getMinecraftFont().getTextWidth(label.getText());
    label.setX((int) (width / 2 - size / 2)).setY(top);
    label.setTextColor(grey);
    screen.attachWidget("Spoutcraft", label);
    top += 11;

    linebreak = new GenericGradient();
    linebreak.setBottomColor(grey);
    linebreak.setTopColor(grey);
    linebreak.setX(width/2 - 318 / 2).setY(top).setHeight(3).setWidth(318);
    screen.attachWidget("Spoutcraft", linebreak);
    top += 6;

    control = new ReplaceToolsButton().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);

    control = new ReplaceBlocksButton().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);
    top += 22;

    top += 5;

    // Miscellaneous
    label = new GenericLabel("Miscellaneous Settings");
    size = Spoutcraft.getMinecraftFont().getTextWidth(label.getText());
    label.setX((int) (width / 2 - size / 2)).setY(top);
    label.setTextColor(grey);
    screen.attachWidget("Spoutcraft", label);
    top += 11;

    linebreak = new GenericGradient();
    linebreak.setBottomColor(grey);
    linebreak.setTopColor(grey);
    linebreak.setX(width/2 - 318 / 2).setY(top).setHeight(3).setWidth(318);
    screen.attachWidget("Spoutcraft", linebreak);
    top += 6;

    control = new SnooperButton(this).setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(center).setY(top);
    screen.attachWidget("Spoutcraft", control);
    top += 22;
    top += 5;
  }
View Full Code Here

    }
  }

  public void initGui() {
    hideable = new ArrayList<Control>();
    Control control;

    GenericScrollArea screen = new GenericScrollArea();
    screen.setHeight(height - 24 - 30).setWidth(width).setY(24).setX(0);
    getScreen().attachWidget("Spoutcraft", screen);

    GenericLabel label = new GenericLabel("Minimap Settings");
    int size = Spoutcraft.getMinecraftFont().getTextWidth(label.getText());
    label.setX((int) (width / 2 - size / 2)).setY(10);
    label.setFixed(true).setPriority(RenderPriority.Lowest);
    getScreen().attachWidget("Spoutcraft", label);

    int left = (int)(width / - 155);
    int right = (int)(width / 2 + 5);

    control = new ResetButton(this).setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(height - 25);
    getScreen().attachWidget("Spoutcraft", control);

    doneButton = new GenericButton("Done");
    doneButton.setAlign(WidgetAnchor.CENTER_CENTER);
    doneButton.setX(right).setY(height - 25);
    doneButton.setHeight(20).setWidth(150);
    getScreen().attachWidget("Spoutcraft", doneButton);

    int top = 5;
    final Color grey = new Color(0.80F, 0.80F, 0.80F, 0.65F);

    label = new GenericLabel("Minimap Position");
    size = Spoutcraft.getMinecraftFont().getTextWidth(label.getText());
    label.setX((int) (width / 2 - size / 2)).setY(top);
    label.setTextColor(grey);
    screen.attachWidget("Spoutcraft", label);

    top += 11;

    Gradient linebreak = new GenericGradient();
    linebreak.setBottomColor(grey);
    linebreak.setTopColor(grey);
    linebreak.setX(width/2 - 318 / 2).setY(top).setHeight(3).setWidth(318);
    screen.attachWidget("Spoutcraft", linebreak);

    top += 6;

    positionButton = new GenericButton("Move Minimap");
    positionButton.setGeometry(width / 2 - 75, top, 150, 20);
    screen.attachWidget("Spoutcraft", positionButton);

    top += 27;

    label = new GenericLabel("Minimap Configuration");
    size = Spoutcraft.getMinecraftFont().getTextWidth(label.getText());
    label.setX((int) (width / 2 - size / 2)).setY(top);
    label.setTextColor(grey);
    screen.attachWidget("Spoutcraft", label);

    top += 11;

    linebreak = new GenericGradient();
    linebreak.setBottomColor(grey);
    linebreak.setTopColor(grey);
    linebreak.setX(width/2 - 318 / 2).setY(top).setHeight(3).setWidth(318);
    screen.attachWidget("Spoutcraft", linebreak);

    top += 6;

    toggleCheckBox = new MinimapToggleCheckBox().setAlign(WidgetAnchor.TOP_CENTER);
    toggleCheckBox.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", toggleCheckBox);

    control = new ColorToggleCheckBox().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);

    control.setEnabled(false);
    control.setTooltip("Feature broken.");

    top += 22;

    control = new CoordsToggleCheckBox().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);

    hideable.add(control);

    control = new SquareToggleCheckBox().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);

    top += 22;

    hideable.add(control);

    control = new ScaleToggleCheckBox().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);

    hideable.add(control);

    control = new DirectionsToggleCheckBox().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);

    top += 22;

    hideable.add(control);

    control = new MinimapModeButton().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);

    control.setEnabled(false);
    control.setTooltip("Feature broken.");

    control = new ZoomModeButton().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);

    top += 22;

    hideable.add(control);

    control = new DeathpointsCheckBox().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);

    hideable.add(control);

    control = new BackgroundCheckBox().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);

    top += 22;

    hideable.add(control);

    control = new HeightMapCheckBox().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);

    hideable.add(control);

    control = new ScanRadiusSlider().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);

    top += 22;

    hideable.add(control);

    control = new ShowEntitiesCheckbox().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);

    hideable.add(control);

    advancedMobsButton = new GenericButton("Filter Mobs").setAlign(WidgetAnchor.TOP_CENTER);
View Full Code Here

          lastWidget = widget;
          if (widget.getPriority().getId() != i) {
            continue;
          }
          if (widget instanceof Control) {
            Control control = (Control) widget;
            if (control.isEnabled() && control.isVisible() && isInBoundingRect(control, mouseX, mouseY)) {
              if (control.getScreen() instanceof Scrollable) {
                if (!isInBoundingRect(control.getScreen(), mouseX, mouseY)) {
                  continue;
                }
              }
              control.setFocus(true);
              if (control instanceof Scrollable) {
                handled = handled || handleClickOnScrollable((Scrollable) control, mouseX, mouseY);
                if (!handled && control instanceof ListWidget) {
                  handled = handled || handleClickOnListWidget((ListWidget) control, mouseX, mouseY);
                }
              }
              if (!handled) {
                if (control instanceof Button) {
                  handleButtonClick((Button) control);
                  handled = true;
                } else if (control instanceof Slider) {
                  ((Slider) control).setDragging(true);
                  handled = true;
                } else if (control instanceof TextField) {
                  ((TextField) control).setCursorPosition(((TextField) control).getText().length());
                  handled = true;
                } else if (control instanceof Slot) {
                  handleClickOnSlot((Slot) control, 0);
                }
              }
            }
          }

          if (lastWidget instanceof ComboBox) {
            ComboBox box = (ComboBox) lastWidget;
            if (box.isOpen()) {
              openCombobox = box;
            }
          }
          if (handled) {
            break;
          }
        }
        if (handled) {
          if (lastWidget == openCombobox) {
            openCombobox = null;
          }
          playSoundFX("random.click", 1.0F, 1.0F);
          break;
        }
      }
    } else if (eventButton == 1) {
      for (Widget widget : screen.getAttachedWidgets(true)) {
        if (widget instanceof Control) {
          Control c = (Control) widget;
          if (c.isEnabled() && c.isVisible() && isInBoundingRect(widget, mouseX, mouseY)) {
            if (widget instanceof Slot) {
              handleClickOnSlot((Slot) widget, 1);
              break;
            }
          }
View Full Code Here

    }
    screen.setMouseX(mouseX);
    screen.setMouseY(mouseY);
    for (Widget widget : screen.getAttachedWidgets(true)) {
      if (widget instanceof Control) {
        Control control = (Control) widget;
        if (control.isEnabled() && control.isVisible()) {
          if (eventButton == 0) {
            if (control.isFocus() && !isInBoundingRect(control, mouseX, mouseY)) { // released control
              control.setFocus(false);
            }
            if (control instanceof Slider && ((Slider) control).isDragging()) {
              ((Slider) control).setDragging(false);
              SpoutClient.getInstance().getPacketManager().sendSpoutPacket(new PacketControlAction(screen, control, ((Slider) control).getSliderPosition()));
              ((Slider) control).onSliderDrag(((Slider) control).getSliderPosition(), ((Slider) control).getSliderPosition());
View Full Code Here

      TextField focusedTF = null;
      ConcurrentSkipListMap<Integer, TextField> tabIndexMap = tab ? new ConcurrentSkipListMap<Integer, TextField>() : null;

      for (Widget widget : screen.getAttachedWidgets(true)) {
        if (widget instanceof Control) {
          Control control = (Control) widget;
          if (control.isFocus()) {
            if (Keyboard.getEventKeyState()) {
              handled = control.onKeyPressed(org.spoutcraft.api.gui.Keyboard.getKey(Keyboard.getEventKey()));
            } else {
              handled = control.onKeyReleased(org.spoutcraft.api.gui.Keyboard.getKey(Keyboard.getEventKey()));
            }
          }
          if (handled) {
            break;
          }
View Full Code Here

TOP

Related Classes of org.spoutcraft.api.gui.Control

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.