mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-06 05:25:54 +00:00
Volume Sliders
This commit is contained in:
parent
bc2c3de525
commit
c75d9d226f
19 changed files with 257 additions and 49 deletions
|
|
@ -1,9 +1,38 @@
|
|||
namespace Cirno.Scripts.UI;
|
||||
using Godot;
|
||||
using Godot.Collections;
|
||||
|
||||
namespace Cirno.Scripts.UI;
|
||||
|
||||
public partial class OptionsMenu : MenuBase
|
||||
{
|
||||
[Export] public Array<Vector2I> Resolutions =
|
||||
[
|
||||
new(320, 160),
|
||||
new(512, 256),
|
||||
new(640, 320),
|
||||
new(1024, 512),
|
||||
new(1280, 640),
|
||||
new(1920, 1080),
|
||||
];
|
||||
|
||||
[Export] public OptionButton ResolutionsList { get; private set; }
|
||||
|
||||
//[Export] public HSlider MusicVolumeSlider { get; private set; }
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
|
||||
foreach (var resolution in Resolutions)
|
||||
{
|
||||
ResolutionsList.AddItem($"{resolution.X}x{resolution.Y}");
|
||||
}
|
||||
|
||||
ResolutionsList.ItemSelected += ResolutionsListOnItemSelected;
|
||||
|
||||
}
|
||||
|
||||
private void ResolutionsListOnItemSelected(long index)
|
||||
{
|
||||
GD.Print($"Selected index: {index} {Resolutions[(int)index]}");
|
||||
DisplayServer.WindowSetSize(Resolutions[(int)index]);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue