aboutsummaryrefslogtreecommitdiff
path: root/game/src/OptionMenu/ResolutionSelector.gd
blob: ef1a0ff025111e74552d508426bb5fbd250f203d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
extends SettingOptionButton

func _ready():
   print("Resolution selector ready")

   clear()
   var resolution_index := 0
   for resolution in Resolution.get_resolution_name_list():
      add_item(resolution)

      if Vector2(Resolution.get_resolution(resolution)) == Resolution.get_current_resolution():
         if default_value == -1:
            default_value = resolution_index
         _select_int(resolution_index)
         print(resolution)

      resolution_index += 1


func _on_item_selected(index):
   print("Selected index: %d" % index)

   var resolution_size : Vector2i = Resolution.get_resolution(get_item_text(index))
   Resolution.set_resolution(resolution_size)