Search in sources :

Example 1 with UISlider

use of org.terasology.nui.widgets.UISlider in project Terasology by MovingBlocks.

the class InputSettingsScreen method addInputSection.

private void addInputSection(ColumnLayout layout, String name, ControllerInfo info) {
    UILabel categoryHeader = new UILabel(name);
    categoryHeader.setFamily("subheading");
    layout.addWidget(categoryHeader);
    float columnRatio = 0.4f;
    UICheckbox invertX = new UICheckbox();
    invertX.bindChecked(BindHelper.bindBeanProperty("invertX", info, Boolean.TYPE));
    layout.addWidget(new RowLayout(new UILabel(translationSystem.translate("${engine:menu#invert-x}")), invertX).setColumnRatios(columnRatio).setHorizontalSpacing(horizontalSpacing));
    UICheckbox invertY = new UICheckbox();
    invertY.bindChecked(BindHelper.bindBeanProperty("invertY", info, Boolean.TYPE));
    layout.addWidget(new RowLayout(new UILabel(translationSystem.translate("${engine:menu#invert-y}")), invertY).setColumnRatios(columnRatio).setHorizontalSpacing(horizontalSpacing));
    UICheckbox invertZ = new UICheckbox();
    invertZ.bindChecked(BindHelper.bindBeanProperty("invertZ", info, Boolean.TYPE));
    layout.addWidget(new RowLayout(new UILabel(translationSystem.translate("${engine:menu#invert-z}")), invertZ).setColumnRatios(columnRatio).setHorizontalSpacing(horizontalSpacing));
    UISlider mvmtDeadZone = new UISlider();
    mvmtDeadZone.setIncrement(0.01f);
    mvmtDeadZone.setMinimum(0);
    mvmtDeadZone.setRange(1);
    mvmtDeadZone.setPrecision(2);
    mvmtDeadZone.bindValue(BindHelper.bindBeanProperty("movementDeadZone", info, Float.TYPE));
    layout.addWidget(new RowLayout(new UILabel(translationSystem.translate("${engine:menu#movement-dead-zone}")), mvmtDeadZone).setColumnRatios(columnRatio).setHorizontalSpacing(horizontalSpacing));
    UISlider rotDeadZone = new UISlider();
    rotDeadZone.setIncrement(0.01f);
    rotDeadZone.setMinimum(0);
    rotDeadZone.setRange(1);
    rotDeadZone.setPrecision(2);
    rotDeadZone.bindValue(BindHelper.bindBeanProperty("rotationDeadZone", info, Float.TYPE));
    layout.addWidget(new RowLayout(new UILabel(translationSystem.translate("${engine:menu#rotation-dead-zone}")), rotDeadZone).setColumnRatios(columnRatio).setHorizontalSpacing(horizontalSpacing));
    layout.addWidget(new UISpace(new Vector2i(0, 16)));
}
Also used : UILabel(org.terasology.nui.widgets.UILabel) UISlider(org.terasology.nui.widgets.UISlider) RowLayout(org.terasology.nui.layouts.RowLayout) UISpace(org.terasology.nui.widgets.UISpace) Vector2i(org.joml.Vector2i) UICheckbox(org.terasology.nui.widgets.UICheckbox)

Example 2 with UISlider

use of org.terasology.nui.widgets.UISlider in project Terasology by MovingBlocks.

the class InputSettingsScreen method initialise.

@Override
public void initialise() {
    setAnimationSystem(MenuAnimationSystems.createDefaultSwipeAnimation());
    ColumnLayout mainLayout = find("main", ColumnLayout.class);
    UIButton azerty = find("azerty", UIButton.class);
    if (azerty != null) {
        azerty.subscribe(event -> {
            BindCommands.AZERTY.forEach(this::setPrimaryBind);
            bindsManager.registerBinds();
        });
    }
    UIButton dvorak = find("dvorak", UIButton.class);
    if (dvorak != null) {
        dvorak.subscribe(event -> {
            BindCommands.DVORAK.forEach(this::setPrimaryBind);
            bindsManager.registerBinds();
        });
    }
    UIButton neo = find("neo", UIButton.class);
    if (neo != null) {
        neo.subscribe(event -> {
            BindCommands.NEO.forEach(this::setPrimaryBind);
            bindsManager.registerBinds();
        });
    }
    UISlider mouseSensitivity = new UISlider("mouseSensitivity");
    mouseSensitivity.bindValue(BindHelper.bindBeanProperty("mouseSensitivity", inputDeviceConfiguration, Float.TYPE));
    mouseSensitivity.setIncrement(0.025f);
    mouseSensitivity.setPrecision(3);
    UICheckbox mouseInverted = new UICheckbox("mouseYAxisInverted");
    mouseInverted.bindChecked(BindHelper.bindBeanProperty("mouseYAxisInverted", inputDeviceConfiguration, Boolean.TYPE));
    if (mainLayout != null) {
        mainLayout.addWidget(new UILabel("mouseLabel", "subheading", translationSystem.translate("${engine:menu" + "#category-mouse}")));
        mainLayout.addWidget(new RowLayout(new UILabel(translationSystem.translate("${engine:menu#mouse" + "-sensitivity}") + ":"), mouseSensitivity).setColumnRatios(0.4f).setHorizontalSpacing(horizontalSpacing));
        mainLayout.addWidget(new RowLayout(new UILabel(translationSystem.translate("${engine:menu#invert-mouse}") + ":"), mouseInverted).setColumnRatios(0.4f).setHorizontalSpacing(horizontalSpacing));
    }
    Map<String, InputCategory> inputCategories = Maps.newHashMap();
    Map<SimpleUri, RegisterBindButton> inputsById = Maps.newHashMap();
    DependencyResolver resolver = new DependencyResolver(moduleManager.getRegistry());
    for (Name moduleId : moduleManager.getRegistry().getModuleIds()) {
        Module module = moduleManager.getRegistry().getLatestModuleVersion(moduleId);
        ResolutionResult result = resolver.resolve(moduleId);
        if (result.isSuccess()) {
            try (ModuleEnvironment environment = moduleManager.loadEnvironment(result.getModules(), false)) {
                for (Class<?> holdingType : environment.getTypesAnnotatedWith(InputCategory.class, new FromModule(environment, moduleId))) {
                    InputCategory inputCategory = holdingType.getAnnotation(InputCategory.class);
                    inputCategories.put(module.getId() + ":" + inputCategory.id(), inputCategory);
                }
                for (Class<?> bindEvent : environment.getTypesAnnotatedWith(RegisterBindButton.class, new FromModule(environment, moduleId))) {
                    if (BindButtonEvent.class.isAssignableFrom(bindEvent)) {
                        RegisterBindButton bindRegister = bindEvent.getAnnotation(RegisterBindButton.class);
                        inputsById.put(new SimpleUri(module.getId(), bindRegister.id()), bindRegister);
                    }
                }
            }
        }
    }
    if (mainLayout != null) {
        addInputSection(inputCategories.remove("engine:movement"), mainLayout, inputsById);
        addInputSection(inputCategories.remove("engine:interaction"), mainLayout, inputsById);
        addInputSection(inputCategories.remove("engine:inventory"), mainLayout, inputsById);
        addInputSection(inputCategories.remove("engine:general"), mainLayout, inputsById);
        for (InputCategory category : inputCategories.values()) {
            addInputSection(category, mainLayout, inputsById);
        }
        mainLayout.addWidget(new UISpace(new Vector2i(1, 16)));
        List<String> controllers = inputSystem.getControllerDevice().getControllers();
        for (String name : controllers) {
            ControllerInfo cfg = inputDeviceConfiguration.getController(name);
            addInputSection(mainLayout, name, cfg);
        }
    }
    WidgetUtil.trySubscribe(this, "reset", button -> {
        inputDeviceConfiguration.reset();
        bindsManager.getBindsConfig().setBinds(bindsManager.getDefaultBindsConfig());
    });
    WidgetUtil.trySubscribe(this, "back", button -> triggerBackAnimation());
}
Also used : UILabel(org.terasology.nui.widgets.UILabel) UISlider(org.terasology.nui.widgets.UISlider) RegisterBindButton(org.terasology.engine.input.RegisterBindButton) ResolutionResult(org.terasology.gestalt.module.dependencyresolution.ResolutionResult) SimpleUri(org.terasology.engine.core.SimpleUri) UICheckbox(org.terasology.nui.widgets.UICheckbox) DependencyResolver(org.terasology.gestalt.module.dependencyresolution.DependencyResolver) Name(org.terasology.gestalt.naming.Name) ModuleEnvironment(org.terasology.gestalt.module.ModuleEnvironment) ColumnLayout(org.terasology.nui.layouts.ColumnLayout) UIButton(org.terasology.nui.widgets.UIButton) RowLayout(org.terasology.nui.layouts.RowLayout) InputCategory(org.terasology.input.InputCategory) UISpace(org.terasology.nui.widgets.UISpace) Vector2i(org.joml.Vector2i) FromModule(org.terasology.gestalt.module.predicates.FromModule) Module(org.terasology.gestalt.module.Module) FromModule(org.terasology.gestalt.module.predicates.FromModule) ControllerInfo(org.terasology.engine.config.ControllerConfig.ControllerInfo)

Example 3 with UISlider

use of org.terasology.nui.widgets.UISlider in project Terasology by MovingBlocks.

the class VideoSettingsScreen method initialise.

@Override
@SuppressWarnings("unchecked")
public void initialise() {
    setAnimationSystem(MenuAnimationSystems.createDefaultSwipeAnimation());
    UIDropdown<Preset> videoQuality = find("graphicsPreset", UIDropdown.class);
    if (videoQuality != null) {
        videoQuality.setOptionRenderer(new ToStringTextRenderer<>(translationSystem));
        videoQuality.setOptions(Lists.newArrayList(Preset.CUSTOM, Preset.MINIMAL, Preset.LOW, Preset.MEDIUM, Preset.HIGH, Preset.ULTRA));
        videoQuality.bindSelection(new PresetBinding(config.getRendering()));
    }
    UIDropdown<ViewDistance> viewDistance = find("viewDistance", UIDropdown.class);
    if (viewDistance != null) {
        viewDistance.setOptionRenderer(new ToStringTextRenderer<>(translationSystem));
        viewDistance.setOptions(Arrays.asList(ViewDistance.values()));
        viewDistance.bindSelection(BindHelper.bindBeanProperty("viewDistance", config.getRendering(), ViewDistance.class));
    }
    UIDropdown<WaterReflection> waterReflection = find("reflections", UIDropdown.class);
    if (waterReflection != null) {
        waterReflection.setOptionRenderer(new ToStringTextRenderer<>(translationSystem));
        waterReflection.setOptions(Lists.newArrayList(WaterReflection.SKY, WaterReflection.GLOBAL, WaterReflection.LOCAL));
        waterReflection.bindSelection(new WaterReflectionBinding(config.getRendering()));
    }
    UIDropdown<ScreenshotSize> screenshotSize = find("screenshotSize", UIDropdown.class);
    if (screenshotSize != null) {
        screenshotSize.setOptionRenderer(new ToStringTextRenderer<>(translationSystem));
        screenshotSize.setOptions(Arrays.asList(ScreenshotSize.values()));
        screenshotSize.bindSelection(BindHelper.bindBeanProperty("screenshotSize", config.getRendering(), ScreenshotSize.class));
    }
    UIDropdown<String> screenshotFormat = find("screenshotFormat", UIDropdown.class);
    if (screenshotFormat != null) {
        screenshotFormat.setOptions(Arrays.asList(ImageIO.getWriterFileSuffixes()));
        screenshotFormat.bindSelection(BindHelper.bindBeanProperty("screenshotFormat", config.getRendering(), String.class));
    }
    UIDropdown<Integer> blur = find("blur", UIDropdown.class);
    if (blur != null) {
        blur.setOptions(Lists.newArrayList(0, 1, 2, 3));
        blur.bindSelection(BindHelper.bindBeanProperty("blurIntensity", config.getRendering(), Integer.TYPE));
        blur.setOptionRenderer(new StringTextRenderer<Integer>() {

            @Override
            public String getString(Integer value) {
                switch(value) {
                    case 1:
                        return translationSystem.translate("${engine:menu#camera-blur-some}");
                    case 2:
                        return translationSystem.translate("${engine:menu#camera-blur-normal}");
                    case 3:
                        return translationSystem.translate("${engine:menu#camera-blur-max}");
                    default:
                        return translationSystem.translate("${engine:menu#camera-blur-off}");
                }
            }
        });
    }
    UIDropdown<DynamicShadows> dynamicShadows = find("shadows", UIDropdown.class);
    if (dynamicShadows != null) {
        dynamicShadows.setOptionRenderer(new ToStringTextRenderer<>(translationSystem));
        dynamicShadows.setOptions(Arrays.asList(DynamicShadows.values()));
        dynamicShadows.bindSelection(new DynamicShadowsBinding(config.getRendering()));
    }
    final UISlider fovSlider = find("fov", UISlider.class);
    if (fovSlider != null) {
        fovSlider.setIncrement(5.0f);
        fovSlider.setPrecision(0);
        fovSlider.setMinimum(70);
        fovSlider.setRange(50);
        fovSlider.bindValue(BindHelper.bindBeanProperty("fieldOfView", config.getRendering(), Float.TYPE));
    }
    final UISlider chunkLodSlider = find("chunkLods", UISlider.class);
    if (chunkLodSlider != null) {
        chunkLodSlider.setIncrement(1);
        chunkLodSlider.setPrecision(0);
        chunkLodSlider.setMinimum(0);
        chunkLodSlider.setRange(10);
        chunkLodSlider.bindValue(BindHelper.bindBeanProperty("chunkLods", config.getRendering(), Float.TYPE));
    }
    final UISlider billboardLimitSlider = find("billboardLimit", UISlider.class);
    if (billboardLimitSlider != null) {
        billboardLimitSlider.setIncrement(32);
        billboardLimitSlider.setPrecision(0);
        billboardLimitSlider.setMinimum(0);
        billboardLimitSlider.setRange(512);
        // Billboard limit == 0 means no limit
        billboardLimitSlider.setLabelFunction(input -> {
            if (input == 0) {
                return "No limit";
            } else {
                return String.valueOf(input.intValue());
            }
        });
        billboardLimitSlider.bindValue(BindHelper.bindBeanProperty("billboardLimit", config.getRendering(), Float.TYPE));
    }
    final UISlider frameLimitSlider = find("frameLimit", UISlider.class);
    if (frameLimitSlider != null) {
        frameLimitSlider.setIncrement(5.0f);
        frameLimitSlider.setPrecision(0);
        frameLimitSlider.setMinimum(30);
        // Goes up to 205 (which is off)
        frameLimitSlider.setRange(175);
        // Frame limit > 200 is just displayed and treated as "off"
        frameLimitSlider.setLabelFunction(input -> {
            if (input > 200) {
                // Spaces to get wider than "200" (otherwise the display jumps around)
                return " Off ";
            } else {
                return String.valueOf(input.intValue());
            }
        });
        frameLimitSlider.bindValue(new Binding<Float>() {

            @Override
            public Float get() {
                if (config.getRendering().getFrameLimit() == -1) {
                    return 205f;
                } else {
                    return (float) config.getRendering().getFrameLimit();
                }
            }

            @Override
            public void set(Float value) {
                int frameLimit = value.intValue();
                if (frameLimit > 200) {
                    config.getRendering().setFrameLimit(-1);
                } else {
                    config.getRendering().setFrameLimit(frameLimit);
                }
            }
        });
    }
    final UISlider particleEffectLimitSlider = find("particleEffectLimit", UISlider.class);
    if (particleEffectLimitSlider != null) {
        particleEffectLimitSlider.setIncrement(1.0f);
        particleEffectLimitSlider.setPrecision(0);
        particleEffectLimitSlider.setMinimum(0);
        particleEffectLimitSlider.setRange(50);
        particleEffectLimitSlider.setLabelFunction(input -> {
            if (input == 0) {
                return " Off ";
            } else {
                return String.valueOf(input.intValue());
            }
        });
        particleEffectLimitSlider.bindValue(new Binding<Float>() {

            @Override
            public Float get() {
                return (float) config.getRendering().getParticleEffectLimit();
            }

            @Override
            public void set(Float value) {
                int particleEffectLimit = value.intValue();
                config.getRendering().setParticleEffectLimit(particleEffectLimit);
            }
        });
    }
    final UISlider fboScaleSlider = find("fboScale", UISlider.class);
    if (fboScaleSlider != null) {
        fboScaleSlider.setIncrement(5.0f);
        fboScaleSlider.setPrecision(0);
        fboScaleSlider.setMinimum(25);
        fboScaleSlider.setRange(200);
        fboScaleSlider.setLabelFunction(input -> input.intValue() + "%");
        fboScaleSlider.bindValue(new Binding<Float>() {

            @Override
            public Float get() {
                return (float) config.getRendering().getFboScale();
            }

            @Override
            public void set(Float value) {
                config.getRendering().setFboScale(value.intValue());
            }
        });
    }
    final UILabel uiScaleLabel = find("uiScaleLabel", UILabel.class);
    uiScaleLabel.setText(" " + config.getRendering().getUiScale() + "% ");
    WidgetUtil.trySubscribe(this, "uiScaleSmaller", button -> {
        int newScale = Math.max(50, config.getRendering().getUiScale() - 25);
        config.getRendering().setUiScale(newScale);
        uiScaleLabel.setText(" " + config.getRendering().getUiScale() + "% ");
    });
    WidgetUtil.trySubscribe(this, "uiScaleLarger", button -> {
        int newScale = Math.min(250, config.getRendering().getUiScale() + 25);
        config.getRendering().setUiScale(newScale);
        uiScaleLabel.setText(" " + config.getRendering().getUiScale() + "% ");
    });
    UIDropdown<CameraSetting> cameraSetting = find("camera", UIDropdown.class);
    if (cameraSetting != null) {
        cameraSetting.setOptionRenderer(new ToStringTextRenderer<>(translationSystem));
        cameraSetting.setOptions(Arrays.asList(CameraSetting.values()));
        cameraSetting.bindSelection(new CameraSettingBinding(config.getRendering()));
    }
    UIDropdown<DisplayModeSetting> displaySetting = find("displayModeSetting", UIDropdown.class);
    if (displaySetting != null) {
        displaySetting.setOptionRenderer(new ToStringTextRenderer<>(translationSystem));
        displaySetting.setOptions(Arrays.asList(DisplayModeSetting.values()));
        displaySetting.bindSelection(BindHelper.bindBeanProperty("displayModeSetting", displayDevice, DisplayModeSetting.class));
    }
    UIDropdown<Resolution> resolution = find("resolution", UIDropdown.class);
    if (resolution != null) {
        resolution.setOptions(displayDevice.getResolutions());
        resolution.bindSelection(new Binding<Resolution>() {

            @Override
            public Resolution get() {
                return displayDevice.getResolution();
            }

            @Override
            public void set(Resolution value) {
                onResolutionChange(value);
            }
        });
    }
    WidgetUtil.tryBindCheckbox(this, "menu-animations", BindHelper.bindBeanProperty("animatedMenu", config.getRendering(), Boolean.TYPE));
    WidgetUtil.tryBindCheckbox(this, "oculusVrSupport", BindHelper.bindBeanProperty("vrSupport", config.getRendering(), Boolean.TYPE));
    WidgetUtil.tryBindCheckbox(this, "animateGrass", BindHelper.bindBeanProperty("animateGrass", config.getRendering(), Boolean.TYPE));
    WidgetUtil.tryBindCheckbox(this, "animateWater", BindHelper.bindBeanProperty("animateWater", config.getRendering(), Boolean.TYPE));
    WidgetUtil.tryBindCheckbox(this, "volumetricFog", BindHelper.bindBeanProperty("volumetricFog", config.getRendering(), Boolean.TYPE));
    WidgetUtil.tryBindCheckbox(this, "inscattering", BindHelper.bindBeanProperty("inscattering", config.getRendering(), Boolean.TYPE));
    WidgetUtil.tryBindCheckbox(this, "cloudShadow", BindHelper.bindBeanProperty("cloudShadows", config.getRendering(), Boolean.TYPE));
    WidgetUtil.tryBindCheckbox(this, "extraLighting", BindHelper.bindBeanProperty("normalMapping", config.getRendering(), Boolean.TYPE));
    WidgetUtil.tryBindCheckbox(this, "parallax", BindHelper.bindBeanProperty("parallaxMapping", config.getRendering(), Boolean.TYPE));
    WidgetUtil.tryBindCheckbox(this, "filmGrain", BindHelper.bindBeanProperty("filmGrain", config.getRendering(), Boolean.TYPE));
    WidgetUtil.tryBindCheckbox(this, "motionBlur", BindHelper.bindBeanProperty("motionBlur", config.getRendering(), Boolean.TYPE));
    WidgetUtil.tryBindCheckbox(this, "bobbing", BindHelper.bindBeanProperty("cameraBobbing", config.getRendering(), Boolean.TYPE));
    WidgetUtil.tryBindCheckbox(this, "outline", BindHelper.bindBeanProperty("outline", config.getRendering(), Boolean.TYPE));
    WidgetUtil.tryBindCheckbox(this, "vsync", BindHelper.bindBeanProperty("vSync", config.getRendering(), Boolean.TYPE));
    WidgetUtil.tryBindCheckbox(this, "eyeAdaptation", BindHelper.bindBeanProperty("eyeAdaptation", config.getRendering(), Boolean.TYPE));
    WidgetUtil.tryBindCheckbox(this, "ssao", BindHelper.bindBeanProperty("ssao", config.getRendering(), Boolean.TYPE));
    WidgetUtil.tryBindCheckbox(this, "clampLighting", BindHelper.bindBeanProperty("clampLighting", config.getRendering(), Boolean.TYPE));
    WidgetUtil.tryBindCheckbox(this, "bloom", BindHelper.bindBeanProperty("bloom", config.getRendering(), Boolean.TYPE));
    WidgetUtil.tryBindCheckbox(this, "lightShafts", BindHelper.bindBeanProperty("lightShafts", config.getRendering(), Boolean.TYPE));
    WidgetUtil.tryBindCheckbox(this, "vignette", BindHelper.bindBeanProperty("vignette", config.getRendering(), Boolean.TYPE));
    WidgetUtil.tryBindCheckbox(this, "flickeringLight", BindHelper.bindBeanProperty("flickeringLight", config.getRendering(), Boolean.TYPE));
    if (fovSlider != null) {
        WidgetUtil.trySubscribe(this, "fovReset", widget -> fovSlider.setValue(100.0f));
    }
    WidgetUtil.trySubscribe(this, "close", button -> saveSettings());
}
Also used : ViewDistance(org.terasology.engine.rendering.world.viewDistance.ViewDistance) UILabel(org.terasology.nui.widgets.UILabel) UISlider(org.terasology.nui.widgets.UISlider) Resolution(org.terasology.engine.core.subsystem.Resolution)

Example 4 with UISlider

use of org.terasology.nui.widgets.UISlider in project Terasology by MovingBlocks.

the class AudioSettingsScreen method initialise.

@Override
public void initialise() {
    setAnimationSystem(MenuAnimationSystems.createDefaultSwipeAnimation());
    // TODO: Remove this screen when AutoConfig UI is in place
    UISlider sound = find("sound", UISlider.class);
    if (sound != null) {
        sound.setIncrement(0.05f);
        sound.setPrecision(2);
        sound.setMinimum(0);
        sound.setRange(1.0f);
        sound.bindValue(new Binding<Float>() {

            @Override
            public Float get() {
                return config.soundVolume.get();
            }

            @Override
            public void set(Float value) {
                config.soundVolume.set(value);
            }
        });
    }
    UISlider music = find("music", UISlider.class);
    if (music != null) {
        music.setIncrement(0.05f);
        music.setPrecision(2);
        music.setMinimum(0);
        music.setRange(1.0f);
        music.bindValue(new Binding<Float>() {

            @Override
            public Float get() {
                return config.musicVolume.get();
            }

            @Override
            public void set(Float value) {
                config.musicVolume.set(value);
            }
        });
    }
    WidgetUtil.trySubscribe(this, "close", button -> triggerBackAnimation());
}
Also used : UISlider(org.terasology.nui.widgets.UISlider)

Example 5 with UISlider

use of org.terasology.nui.widgets.UISlider in project Terasology by MovingBlocks.

the class ColorConstraintWidgetFactory method bindWidgetToSetting.

@Override
protected void bindWidgetToSetting(UIWidget widget) {
    UIImage img = widget.find("image", UIImage.class);
    if (img != null) {
        ResourceUrn uri = TextureUtil.getTextureUriForColor(Color.WHITE);
        Texture tex = assetManager.getAsset(uri, Texture.class).get();
        img.setImage(tex);
        img.bindTint(new SettingBinding<>(getSetting()));
    }
    UISlider slider = widget.find("tone", UISlider.class);
    slider.setIncrement(0.01f);
    // ensure a certain width
    Function<Object, String> constant = Functions.constant("  ");
    slider.setLabelFunction(constant);
    slider.bindValue(new MappingBinding<>(new SettingBinding<>(getSetting()), this::findClosestColor, this::findClosestIndex));
}
Also used : UISlider(org.terasology.nui.widgets.UISlider) SettingBinding(org.terasology.engine.config.flexible.bindings.SettingBinding) UIImage(org.terasology.nui.widgets.UIImage) ResourceUrn(org.terasology.gestalt.assets.ResourceUrn) Texture(org.terasology.engine.rendering.assets.texture.Texture)

Aggregations

UISlider (org.terasology.nui.widgets.UISlider)6 UILabel (org.terasology.nui.widgets.UILabel)3 Vector2i (org.joml.Vector2i)2 RowLayout (org.terasology.nui.layouts.RowLayout)2 UICheckbox (org.terasology.nui.widgets.UICheckbox)2 UISpace (org.terasology.nui.widgets.UISpace)2 ControllerInfo (org.terasology.engine.config.ControllerConfig.ControllerInfo)1 SettingBinding (org.terasology.engine.config.flexible.bindings.SettingBinding)1 SimpleUri (org.terasology.engine.core.SimpleUri)1 Resolution (org.terasology.engine.core.subsystem.Resolution)1 RegisterBindButton (org.terasology.engine.input.RegisterBindButton)1 Texture (org.terasology.engine.rendering.assets.texture.Texture)1 ViewDistance (org.terasology.engine.rendering.world.viewDistance.ViewDistance)1 ResourceUrn (org.terasology.gestalt.assets.ResourceUrn)1 Module (org.terasology.gestalt.module.Module)1 ModuleEnvironment (org.terasology.gestalt.module.ModuleEnvironment)1 DependencyResolver (org.terasology.gestalt.module.dependencyresolution.DependencyResolver)1 ResolutionResult (org.terasology.gestalt.module.dependencyresolution.ResolutionResult)1 FromModule (org.terasology.gestalt.module.predicates.FromModule)1 Name (org.terasology.gestalt.naming.Name)1