Skip to content

Commit

Permalink
Merge pull request #130 from Tryibion/slider-docs
Browse files Browse the repository at this point in the history
Add slider docs
  • Loading branch information
mafiesto4 authored Dec 6, 2023
2 parents fc122e7 + 772b5d0 commit d3a5030
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 0 deletions.
1 change: 1 addition & 0 deletions manual/toc.md
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@
## [Controls](ui/controls/index.md)
### [Button](ui/controls/button.md)
### [CheckBox](ui/controls/checkbox.md)
### [Slider](ui/controls/slider.md)
### [Image](ui/controls/image.md)
### [Label](ui/controls/label.md)
### [Dropdown](ui/controls/dropdown.md)
Expand Down
1 change: 1 addition & 0 deletions manual/ui/controls/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Games created with Flax build UI using **controls**. Each control is an independ

* [Button](button.md)
* [CheckBox](checkbox.md)
* [Slider](slider.md)
* [Image](image.md)
* [Label](label.md)
* [Dropdown](dropdown.md)
Expand Down
Binary file added manual/ui/controls/media/slider.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions manual/ui/controls/slider.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Slider

![Slider](media/slider.png)

The **Slider** responds to a value changed event from the user to change a value.

# Usage

Here is a c# example of how to get and use a slider's `ValueChanged` event in a script:

```cs
public UIControl SliderUIControl;
private Slider _slider;

public override void OnStart()
{
if (SliderUIControl)
_slider = SliderUIControl.Get<Slider>();
if (_slider != null)
_slider.ValueChanged += OnValueChanged;
}

private void OnValueChanged()
{
Debug.Log($"Slider Value changed to {_slider.Value}");
}

public override void OnDestroy()
{
if (_slider != null)
_slider.ValueChanged -= OnValueChanged;
}
```
1 change: 1 addition & 0 deletions manual/ui/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ The **UI** is one of the most important components of a game. The UI system in F
* [Controls](controls/index.md)
* [Button](controls/button.md)
* [CheckBox](controls/checkbox.md)
* [Slider](controls/slider.md)
* [Image](controls/image.md)
* [Label](controls/label.md)
* [Dropdown](controls/dropdown.md)
Expand Down

0 comments on commit d3a5030

Please sign in to comment.