Clean up and progress on buttons.

This commit is contained in:
Harrison Deng 2019-03-05 21:42:28 -06:00
parent d346f7c729
commit e19f6be719
5 changed files with 9 additions and 10 deletions

View File

@ -97,6 +97,7 @@ namespace RecrownedAthenaeum.UI.Modular.Modules.Interactive
upTexture.Draw(batch, bounds, color); upTexture.Draw(batch, bounds, color);
} }
} }
base.Draw(batch); base.Draw(batch);
} }

View File

@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics;
using RecrownedAthenaeum.SpecialTypes; using RecrownedAthenaeum.SpecialTypes;
using RecrownedAthenaeum.UI.SkinSystem; using RecrownedAthenaeum.UI.SkinSystem;
using RecrownedAthenaeum.UI.SkinSystem.Definitions; using RecrownedAthenaeum.UI.SkinSystem.Definitions;
using System;
namespace RecrownedAthenaeum.UI.Modular.Modules.Interactive namespace RecrownedAthenaeum.UI.Modular.Modules.Interactive
{ {
@ -47,6 +48,7 @@ namespace RecrownedAthenaeum.UI.Modular.Modules.Interactive
{ {
TextButtonSkinDefinition skinDefinition = skin.ObtainDefinition<TextButtonSkinDefinition>(definitionName); TextButtonSkinDefinition skinDefinition = skin.ObtainDefinition<TextButtonSkinDefinition>(definitionName);
this.text = new Text(font, text); this.text = new Text(font, text);
this.text.autoScale = true;
FontColor = skin.GetColor(skinDefinition.fontColor); FontColor = skin.GetColor(skinDefinition.fontColor);
} }
@ -74,6 +76,7 @@ namespace RecrownedAthenaeum.UI.Modular.Modules.Interactive
{ {
text.bounds = bounds; text.bounds = bounds;
text.Update(gameTime); text.Update(gameTime);
text.CenterIn(TrueBounds);
base.Update(gameTime); base.Update(gameTime);
} }
@ -83,8 +86,8 @@ namespace RecrownedAthenaeum.UI.Modular.Modules.Interactive
/// <param name="batch">Batch to use. Batch should already be started.</param> /// <param name="batch">Batch to use. Batch should already be started.</param>
public override void Draw(SpriteBatch batch) public override void Draw(SpriteBatch batch)
{ {
text.Draw(batch);
base.Draw(batch); base.Draw(batch);
text.Draw(batch);
} }
} }
} }

View File

@ -28,7 +28,7 @@ namespace RecrownedAthenaeum.UI.Modular
/// <summary> /// <summary>
/// Bounds of this module (after factoring in the origin). /// Bounds of this module (after factoring in the origin).
/// </summary> /// </summary>
public Rectangle ActualBounds public Rectangle TrueBounds
{ {
get get
{ {
@ -74,7 +74,7 @@ namespace RecrownedAthenaeum.UI.Modular
if (Debugging) if (Debugging)
{ {
rectangleRenderer.Begin(); rectangleRenderer.Begin();
rectangleRenderer.Draw(ActualBounds.X, ActualBounds.Y, ActualBounds.Width, ActualBounds.Height, Color.Red); rectangleRenderer.Draw(TrueBounds.X, TrueBounds.Y, TrueBounds.Width, TrueBounds.Height, Color.Red);
rectangleRenderer.End(); rectangleRenderer.End();
} }
} }

View File

@ -5,7 +5,7 @@ namespace RecrownedAthenaeum.UI.SkinSystem.Definitions
/// <summary> /// <summary>
/// A definition containing the data for the skin system. Needs to follow data transfer object model. /// A definition containing the data for the skin system. Needs to follow data transfer object model.
/// </summary> /// </summary>
public class SkinDefinitionData public abstract class SkinDefinitionData
{ {
/// <summary> /// <summary>
/// The full name of the UI module this definition defines. /// The full name of the UI module this definition defines.

View File

@ -43,11 +43,6 @@ namespace RecrownedAthenaeum.Camera
/// </summary> /// </summary>
public Matrix projectionMatrix; public Matrix projectionMatrix;
/// <summary>
/// The final transformation matrix.
/// </summary>
public Matrix TransformationMatrix { get; private set; }
/// <summary> /// <summary>
/// The graphics device used /// The graphics device used
/// </summary> /// </summary>
@ -74,6 +69,7 @@ namespace RecrownedAthenaeum.Camera
BasicEffect = new BasicEffect(graphicsDevice); BasicEffect = new BasicEffect(graphicsDevice);
BasicEffect.TextureEnabled = true; BasicEffect.TextureEnabled = true;
BasicEffect.VertexColorEnabled = true;
Apply(); Apply();
} }
@ -83,7 +79,6 @@ namespace RecrownedAthenaeum.Camera
public virtual void Apply() public virtual void Apply()
{ {
ViewMatrix = Matrix.CreateLookAt(position, lookAt, upDirection); ViewMatrix = Matrix.CreateLookAt(position, lookAt, upDirection);
TransformationMatrix = projectionMatrix * ViewMatrix * worldMatrix;
BasicEffect.World = worldMatrix; BasicEffect.World = worldMatrix;
BasicEffect.View = ViewMatrix; BasicEffect.View = ViewMatrix;