public class UISlider<T> extends UIComponent<UISlider<T>> implements IGuiText<UISlider<T>>
ITransformable.Alpha, ITransformable.Brightness, ITransformable.Color, ITransformable.Position<T>, ITransformable.Rotate, ITransformable.Scale, ITransformable.Size<T>, ITransformable.Translate| Modifier and Type | Field and Description |
|---|---|
protected com.google.common.base.Converter<java.lang.Float,T> |
converter
Converter from float (0-1 offset) to the value.
|
protected MalisisFont |
font
The
MalisisFont to use for this UISlider. |
protected FontOptions |
fontOptions
The
FontOptions to use for this UISlider. |
protected FontOptions |
hoveredFontOptions
The
FontOptions to use for this UISlider when hovered. |
protected float |
offset
Position offset of the slider.
|
protected float |
scrollStep
Amount of offset scrolled by when using the scroll wheel.
|
static int |
SLIDER_WIDTH |
protected GuiIconProvider |
sliderIcon |
protected GuiShape |
sliderShape |
protected java.lang.String |
text
Text to display over the slider.
|
protected T |
value
Current value.
|
| Constructor and Description |
|---|
UISlider(MalisisGui gui,
int width,
com.google.common.base.Converter<java.lang.Float,T> converter,
java.lang.String text) |
| Modifier and Type | Method and Description |
|---|---|
void |
drawBackground(GuiRenderer renderer,
int mouseX,
int mouseY,
float partialTick)
Called first when drawing this
UIComponent. |
void |
drawForeground(GuiRenderer renderer,
int mouseX,
int mouseY,
float partialTick)
Called last when drawing this
UIComponent. |
MalisisFont |
getFont()
Gets the
MalisisFont. |
FontOptions |
getFontOptions()
Gets the
FontOptions. |
T |
getValue()
Gets the value for this
UISlider. |
boolean |
onClick(int x,
int y)
On click.
|
boolean |
onDrag(int lastX,
int lastY,
int x,
int y,
MouseButton button)
On drag.
|
boolean |
onScrollWheel(int x,
int y,
int delta)
On scroll wheel.
|
UISlider<T> |
setFont(MalisisFont font)
Sets the
MalisisFont. |
UISlider<T> |
setFontOptions(FontOptions fro)
Sets the
FontOptions. |
UISlider<T> |
setScrollStep(float scrollStep)
Sets the amount of offset to scroll with the wheel.
|
UISlider<T> |
setValue(T value)
Sets the value for this
UISlider. |
void |
slideTo(float offset)
Slides the slider to the specified offset between 0 and 1.
|
void |
slideTo(int x)
Slides the slider to the specified pixel position.
|
addControlComponent, attachData, componentX, componentY, draw, fireEvent, getAlpha, getAnchor, getComponentAt, getData, getGui, getHeight, getIconProvider, getName, getParent, getPropertyString, getRawHeight, getRawWidth, getRenderer, getTooltip, getWidth, getX, getY, getZIndex, isDisabled, isFocused, isHovered, isInsideBounds, isRelativeHeight, isRelativeWidth, isVisible, onAddedToScreen, onButtonPress, onButtonRelease, onDoubleClick, onKeyTyped, onMouseMove, onRightClick, parentX, parentY, register, relativeX, relativeY, removeAllControlComponents, removeControlComponent, screenX, screenY, self, setAlpha, setAnchor, setDisabled, setFocused, setHovered, setName, setParent, setPosition, setPosition, setSize, setTooltip, setTooltip, setVisible, setZIndex, toString, unregisterpublic static int SLIDER_WIDTH
protected GuiIconProvider sliderIcon
protected MalisisFont font
MalisisFont to use for this UISlider.protected FontOptions fontOptions
FontOptions to use for this UISlider.protected FontOptions hoveredFontOptions
FontOptions to use for this UISlider when hovered.protected java.lang.String text
protected T value
protected float offset
protected float scrollStep
protected com.google.common.base.Converter<java.lang.Float,T> converter
protected GuiShape sliderShape
public UISlider(MalisisGui gui, int width, com.google.common.base.Converter<java.lang.Float,T> converter, java.lang.String text)
public MalisisFont getFont()
IGuiTextMalisisFont.public UISlider<T> setFont(MalisisFont font)
IGuiTextMalisisFont.public FontOptions getFontOptions()
IGuiTextFontOptions.getFontOptions in interface IGuiText<UISlider<T>>public UISlider<T> setFontOptions(FontOptions fro)
IGuiTextFontOptions.setFontOptions in interface IGuiText<UISlider<T>>fro - the font optionspublic UISlider<T> setValue(T value)
UISlider.value - the valuepublic UISlider<T> setScrollStep(float scrollStep)
scrollStep - the scroll steppublic boolean onClick(int x,
int y)
UIComponentonClick in class UIComponent<UISlider<T>>x - the xy - the ypublic boolean onScrollWheel(int x,
int y,
int delta)
UIComponentonScrollWheel in class UIComponent<UISlider<T>>x - the xy - the ydelta - the deltapublic boolean onDrag(int lastX,
int lastY,
int x,
int y,
MouseButton button)
UIComponentonDrag in class UIComponent<UISlider<T>>lastX - the last xlastY - the last yx - the xy - the ybutton - the buttonpublic void slideTo(int x)
x - the xpublic void slideTo(float offset)
offset - the offsetpublic void drawBackground(GuiRenderer renderer, int mouseX, int mouseY, float partialTick)
UIComponentUIComponent.drawBackground in class UIComponent<UISlider<T>>renderer - the renderermouseX - the mouse xmouseY - the mouse ypartialTick - the partial tickpublic void drawForeground(GuiRenderer renderer, int mouseX, int mouseY, float partialTick)
UIComponentUIComponent.drawForeground in class UIComponent<UISlider<T>>renderer - the renderermouseX - the mouse xmouseY - the mouse ypartialTick - the partial tick