diff --git a/RecrownedAthenaeum/UI/Modular/Modules/Interactive/Button.cs b/RecrownedAthenaeum/UI/Modular/Modules/Interactive/Button.cs index 2260141..5449c4c 100644 --- a/RecrownedAthenaeum/UI/Modular/Modules/Interactive/Button.cs +++ b/RecrownedAthenaeum/UI/Modular/Modules/Interactive/Button.cs @@ -64,6 +64,18 @@ namespace RecrownedAthenaeum.UI.Modular.Modules.Interactive highlightedTexture = skin.GetTextureAtlasRegion(skinDefinition.selectedRegion); } + /// + /// Instantiates a button using a definition. + /// + /// The skin the definition is defined in. + /// The definition itself. + public Button(ISkin skin, ButtonSkinDefinition skinDefinition) : + this(skin.GetTextureAtlasRegion(skinDefinition.downRegion), + skin.GetTextureAtlasRegion(skinDefinition.upRegion), + skin.GetTextureAtlasRegion(skinDefinition.disabledRegion), + skin.GetTextureAtlasRegion(skinDefinition.selectedRegion)) + {} + /// /// Draws the button. /// diff --git a/RecrownedAthenaeum/UI/Modular/Modules/Interactive/TextButton.cs b/RecrownedAthenaeum/UI/Modular/Modules/Interactive/TextButton.cs index 627cf1c..5478e70 100644 --- a/RecrownedAthenaeum/UI/Modular/Modules/Interactive/TextButton.cs +++ b/RecrownedAthenaeum/UI/Modular/Modules/Interactive/TextButton.cs @@ -43,13 +43,29 @@ namespace RecrownedAthenaeum.UI.Modular.Modules.Interactive /// The font to be used. /// The skin to use. /// Name of the definition for this type in the skin given. - public TextButton(string text, SpriteFont font, ISkin skin, string definitionName = null) : base(skin, definitionName) + public TextButton(string text, SpriteFont font, ISkin skin, string definitionName = null) : base(skin, skin.ObtainDefinition(definitionName)) { TextButtonSkinDefinition skinDefinition = skin.ObtainDefinition(definitionName); this.text = new Text(font, text); FontColor = skin.GetColor(skinDefinition.fontColor); } + /// + /// Creates a text button with a given definition. + /// + /// The text to be displayed on this button. + /// The font to use for this button. + /// The skin the definition is from. + /// The definition to use. + public TextButton(string text, SpriteFont font, ISkin skin, TextButtonSkinDefinition skinDefinition) : + this(text, + font, + skin.GetTextureAtlasRegion(skinDefinition.downRegion), + skin.GetTextureAtlasRegion(skinDefinition.upRegion), + skin.GetTextureAtlasRegion(skinDefinition.disabledRegion), + skin.GetTextureAtlasRegion(skinDefinition.selectedRegion)) + { } + /// /// Updates the text button. ///