-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDisplayButton.cs
More file actions
35 lines (28 loc) · 840 Bytes
/
DisplayButton.cs
File metadata and controls
35 lines (28 loc) · 840 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using Godot;
/**
* <summary>Generic button for holding and handling displayable objects.</summary>
*/
public partial class DisplayButton : Button
{
//TODO: Make various menus change descriptions when focus changes, instead of on click.
public static readonly string LoadPath = "res://Scenes/UI/DisplayButton.tscn";
[Export]
public Texture2D Texture;
[Export]
public string Description;
[Export]
public string DisplayName;
public void Display(Texture2D texture, string description, string name)
{
Texture = texture;
Description = description;
DisplayName = name;
Icon = Texture;
FocusEntered += Selected;
}
private void Selected() //TODO: Button groups
{
EmitSignal(BaseButton.SignalName.Pressed);
SetPressed(true);
}
}