2025-03-17 11:43:11 +01:00
|
|
|
|
using Godot;
|
|
|
|
|
|
using Godot.Collections;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Cirno.Scripts.UI;
|
2025-03-09 17:14:06 +01:00
|
|
|
|
|
|
|
|
|
|
public partial class OptionsMenu : MenuBase
|
|
|
|
|
|
{
|
2025-03-17 11:43:11 +01:00
|
|
|
|
[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; }
|
|
|
|
|
|
|
2025-03-09 17:14:06 +01:00
|
|
|
|
public override void _Ready()
|
|
|
|
|
|
{
|
2025-03-17 11:43:11 +01:00
|
|
|
|
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]);
|
2025-03-09 17:14:06 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|