Range
Abstract base class for controls that represent a number within a range.
Range.swift:17class Range
Range is an abstract base class for controls that represent a number within a range, using a configured step
and page
size. See e.g. ScrollBar
and Slider
for examples of higher-level nodes using Range.
This object emits the following signals:
Superclasses
class Control
Base class for all GUI controls. Adapts its position and size based on its parent control.
Citizens in SwiftGodot
Conformances
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol Identifiable<ID>
A class of types whose instances hold the value of an entity with stable identity.
protocol VariantRepresentable
Types that conform to VariantRepresentable can be stored directly in
Variant
with no conversion. These include all of the Variant types from Godot (for exampleGString
,Rect
,Plane
), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.protocol VariantStorable
Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
Types
class Signal1
Signal support.
Type members
Instance members
var allowGreater: Bool
var allowLesser: Bool
var changed: SimpleSignal
var expEdit: Bool
If
true
, andminValue
is greater than 0,value
will be represented exponentially rather than linearly.var maxValue: Double
Maximum value. Range is clamped if
value
is greater thanmaxValue
.var minValue: Double
Minimum value. Range is clamped if
value
is less thanminValue
.var page: Double
Page size. Used mainly for
ScrollBar
. ScrollBar’s length is its size multiplied bypage
over the difference betweenminValue
andmaxValue
.var ratio: Double
The value mapped between 0 and 1.
var rounded: Bool
If
true
,value
will always be rounded to the nearest integer.var step: Double
If greater than 0,
value
will always be rounded to a multiple of this property’s value. Ifrounded
is alsotrue
,value
will first be rounded to a multiple of this property’s value, then rounded to the nearest integer.var value: Double
Range’s current value. Changing this property (even via code) will trigger [signal value_changed] signal. Use
setValueNoSignal(value:)
if you want to avoid it.var valueChanged: Signal1
Emitted when
value
changes. When used on aSlider
, this is called continuously while dragging (potentially every frame). If you are performing an expensive operation in a function connected to [signal value_changed], consider using a debouncingTimer
to call the function less often.func setValueNoSignal(value: Double
) Sets the
Range
’s current value to the specifiedvalue
, without emitting the [signal value_changed] signal.
Show implementation details (1)
Hide implementation details
func _valueChanged(newValue: Double
) Called when the
Range
’s value is changed (following the same conditions as [signal value_changed]).
Subclasses
class EditorSpinSlider
Godot editor’s control for editing numeric values.
class ProgressBar
A control used for visual representation of a percentage.
class ScrollBar
Abstract base class for scrollbars.
class Slider
Abstract base class for sliders.
class SpinBox
An input field for numbers.
class TextureProgressBar
Texture-based progress bar. Useful for loading screens and life or stamina bars.