Modules made more useable by improving or fixing some of the drawing position logic. Variable names refactored as well.

This commit is contained in:
2019-03-09 00:57:29 -06:00
parent 782ca31f15
commit ed11d31100
6 changed files with 54 additions and 50 deletions

View File

@@ -69,12 +69,12 @@ namespace RecrownedAthenaeum.UI.Modular.Modules.Interactive
/// </summary>
/// <param name="skin">The skin the definition is defined in.</param>
/// <param name="skinDefinition">The definition itself.</param>
public Button(ISkin skin, ButtonSkinDefinition skinDefinition) :
this(skin.GetTextureAtlasRegion(skinDefinition.downRegion, true),
skin.GetTextureAtlasRegion(skinDefinition.upRegion, true),
skin.GetTextureAtlasRegion(skinDefinition.disabledRegion),
public Button(ISkin skin, ButtonSkinDefinition skinDefinition) :
this(skin.GetTextureAtlasRegion(skinDefinition.downRegion, true),
skin.GetTextureAtlasRegion(skinDefinition.upRegion, true),
skin.GetTextureAtlasRegion(skinDefinition.disabledRegion),
skin.GetTextureAtlasRegion(skinDefinition.selectedRegion))
{}
{ }
/// <summary>
/// Draws the button.
@@ -84,17 +84,21 @@ namespace RecrownedAthenaeum.UI.Modular.Modules.Interactive
{
if (disabled)
{
disabledTexture?.Draw(batch, bounds, color);
disabledTexture?.Draw(batch, Boundaries, color);
}
else
{
if (pressed)
{
downTexture.Draw(batch, bounds, color);
downTexture.Draw(batch, Boundaries, color);
}
else if (Highlighted)
{
highlightedTexture?.Draw(batch, Boundaries, color);
}
else
{
upTexture.Draw(batch, bounds, color);
upTexture.Draw(batch, Boundaries, color);
}
}
@@ -108,7 +112,7 @@ namespace RecrownedAthenaeum.UI.Modular.Modules.Interactive
/// <returns>Whether or not to continue calling the next mouse change listener.</returns>
public sealed override bool MouseStateChanged(MouseState state)
{
if (InputUtilities.MouseWithinBoundries(bounds))
if (InputUtilities.MouseWithinBoundries(Boundaries))
{
if (state.LeftButton == ButtonState.Pressed)
{

View File

@@ -76,7 +76,7 @@ namespace RecrownedAthenaeum.UI.Modular.Modules.Interactive
/// <param name="gameTime">Snapshot of information about time for game.</param>
public override void Update(GameTime gameTime)
{
text.bounds = bounds;
text.situation = Boundaries;
text.Update(gameTime);
base.Update(gameTime);
}