Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add slider docs #130

Merged
merged 2 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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