online multiplayer chess game (note server currently down)
Diffstat (limited to 'ui/gridmenu/GridMenu.gd')
| -rw-r--r-- | ui/gridmenu/GridMenu.gd | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/ui/gridmenu/GridMenu.gd b/ui/gridmenu/GridMenu.gd index 34bd846..815fc7b 100644 --- a/ui/gridmenu/GridMenu.gd +++ b/ui/gridmenu/GridMenu.gd @@ -10,8 +10,8 @@ func open(): show() -func add_item(icon: Texture, tooltip: String, size: Vector2) -> void: - var tex := texture_button.instance() +func add_icon_item(icon: Texture, tooltip: String, size: Vector2) -> BarTextureButton: + var tex: BarTextureButton = texture_button.instance() tex.connect("pressed", self, "_pressed", [get_child_count()]) tex.expand = true tex.texture_normal = icon @@ -19,15 +19,20 @@ func add_item(icon: Texture, tooltip: String, size: Vector2) -> void: tex.rect_min_size = size tex.hint_tooltip = tooltip tex.stretch_mode = tex.STRETCH_KEEP_ASPECT_CENTERED - tex.set_anchors_preset(PRESET_WIDE) - var back: ColorRect = tex.get_node("Background") - back.margin_left = -5 - back.margin_right = 5 - back.margin_top = -5 - back.margin_bottom = 5 add_child(tex) + return tex + + +func add_text_item(text: String, tooltip: String, size: Vector2) -> Button: + var b := Button.new() + b.hint_tooltip = tooltip + b.name = tooltip + b.rect_min_size = size + b.text = text + b.connect("pressed", self, "_pressed", [get_child_count()]) + add_child(b) + return b func _pressed(index: int): - get_children()[index]._focused(false) emit_signal("pressed", index) |