Documentation > GUI > Slider

Parent du composant : Panel
Version: 2.0.4

Constructor Slider.new(X, Y, Width, Height, Value, Max, SliderColor, CursorColor, Orientation, Z)

This function creates a new Slider object.

X

Position on the X axis of the slider.

Y

Position on the Y axis of the slider.

Width

Width of the space occupied by the slider.

Height

Height of the space occupied by the slider.

Value

Current value of the slider.

Max

Max value of the slider.

SliderColor

Color of the slider (bar).

CursorColor

Color of the cursor.

Orientation

Orientation of the slider : horizontal or vertical.

Z

Z-Order of the slider.

Return

Return an instance of Slider object.

Slider:changeCursorPosition()

This function change the position of the cursor on the slider based on its value.

Slider:draw()

This function draw the slider if defined as visible.

Slider:setColors(SliderColor, BorderCursorColor, BackCursorColor)

This function sets the colors for the slider and the cursor.

SliderColor

Color of the slider

BorderCursorColor

Color of the border of the cursor.

BackCursorColor

Color of the back of the cursor.

Slider:setPosition(X, Y)

This function define the new position of the slider.

X

.P Y

Slider:getMaxValue()

This function returns the maximum value of the slider.

Return

Maximum value of the slider.

Slider:getValue()

This function returns the current value of the slider.

Return

Value of the slider.

Slider:setMaxValue(Max)

This function defines the maximum value of the slider (greater or equal to 1) and change the value of the steps and the position of the cursor. The current value is updated regards of the given maximum value.

Max

Maximum value to set.

Slider:setValue(Value)

This function set the current value of the slider and change the position of the cursor.

Value

Value to set.

Slider:update(dt)

This function update the cursor position when the mouse dragged it.

dt

Delta time.

Slider:toString(NoTitle)

This function display all variables containing in the current Slider instance (tables and functions are excluded).

NoTitle

Indicates if the title must be displayed (false) or not (true).