From e19f6be719f515c59c1806e44f553449a05769dc Mon Sep 17 00:00:00 2001 From: Recrown Date: Tue, 5 Mar 2019 21:42:28 -0600 Subject: [PATCH] Clean up and progress on buttons. --- .../UI/Modular/Modules/Interactive/Button.cs | 1 + .../UI/Modular/Modules/Interactive/TextButton.cs | 5 ++++- RecrownedAthenaeum/UI/Modular/UIModule.cs | 4 ++-- .../UI/SkinSystem/Definitions/SkinDefinition.cs | 2 +- RecrownedAthenaeum/View/Camera3D.cs | 7 +------ 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/RecrownedAthenaeum/UI/Modular/Modules/Interactive/Button.cs b/RecrownedAthenaeum/UI/Modular/Modules/Interactive/Button.cs index 5449c4c..fce85e2 100644 --- a/RecrownedAthenaeum/UI/Modular/Modules/Interactive/Button.cs +++ b/RecrownedAthenaeum/UI/Modular/Modules/Interactive/Button.cs @@ -97,6 +97,7 @@ namespace RecrownedAthenaeum.UI.Modular.Modules.Interactive upTexture.Draw(batch, bounds, color); } } + base.Draw(batch); } diff --git a/RecrownedAthenaeum/UI/Modular/Modules/Interactive/TextButton.cs b/RecrownedAthenaeum/UI/Modular/Modules/Interactive/TextButton.cs index 5478e70..be0d978 100644 --- a/RecrownedAthenaeum/UI/Modular/Modules/Interactive/TextButton.cs +++ b/RecrownedAthenaeum/UI/Modular/Modules/Interactive/TextButton.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using RecrownedAthenaeum.SpecialTypes; using RecrownedAthenaeum.UI.SkinSystem; using RecrownedAthenaeum.UI.SkinSystem.Definitions; +using System; namespace RecrownedAthenaeum.UI.Modular.Modules.Interactive { @@ -47,6 +48,7 @@ namespace RecrownedAthenaeum.UI.Modular.Modules.Interactive { TextButtonSkinDefinition skinDefinition = skin.ObtainDefinition(definitionName); this.text = new Text(font, text); + this.text.autoScale = true; FontColor = skin.GetColor(skinDefinition.fontColor); } @@ -74,6 +76,7 @@ namespace RecrownedAthenaeum.UI.Modular.Modules.Interactive { text.bounds = bounds; text.Update(gameTime); + text.CenterIn(TrueBounds); base.Update(gameTime); } @@ -83,8 +86,8 @@ namespace RecrownedAthenaeum.UI.Modular.Modules.Interactive /// Batch to use. Batch should already be started. public override void Draw(SpriteBatch batch) { - text.Draw(batch); base.Draw(batch); + text.Draw(batch); } } } diff --git a/RecrownedAthenaeum/UI/Modular/UIModule.cs b/RecrownedAthenaeum/UI/Modular/UIModule.cs index dba28bf..243831d 100644 --- a/RecrownedAthenaeum/UI/Modular/UIModule.cs +++ b/RecrownedAthenaeum/UI/Modular/UIModule.cs @@ -28,7 +28,7 @@ namespace RecrownedAthenaeum.UI.Modular /// /// Bounds of this module (after factoring in the origin). /// - public Rectangle ActualBounds + public Rectangle TrueBounds { get { @@ -74,7 +74,7 @@ namespace RecrownedAthenaeum.UI.Modular if (Debugging) { 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(); } } diff --git a/RecrownedAthenaeum/UI/SkinSystem/Definitions/SkinDefinition.cs b/RecrownedAthenaeum/UI/SkinSystem/Definitions/SkinDefinition.cs index 8fc115c..311e917 100644 --- a/RecrownedAthenaeum/UI/SkinSystem/Definitions/SkinDefinition.cs +++ b/RecrownedAthenaeum/UI/SkinSystem/Definitions/SkinDefinition.cs @@ -5,7 +5,7 @@ namespace RecrownedAthenaeum.UI.SkinSystem.Definitions /// /// A definition containing the data for the skin system. Needs to follow data transfer object model. /// - public class SkinDefinitionData + public abstract class SkinDefinitionData { /// /// The full name of the UI module this definition defines. diff --git a/RecrownedAthenaeum/View/Camera3D.cs b/RecrownedAthenaeum/View/Camera3D.cs index 7e4d312..88a740e 100644 --- a/RecrownedAthenaeum/View/Camera3D.cs +++ b/RecrownedAthenaeum/View/Camera3D.cs @@ -43,11 +43,6 @@ namespace RecrownedAthenaeum.Camera /// public Matrix projectionMatrix; - /// - /// The final transformation matrix. - /// - public Matrix TransformationMatrix { get; private set; } - /// /// The graphics device used /// @@ -74,6 +69,7 @@ namespace RecrownedAthenaeum.Camera BasicEffect = new BasicEffect(graphicsDevice); BasicEffect.TextureEnabled = true; + BasicEffect.VertexColorEnabled = true; Apply(); } @@ -83,7 +79,6 @@ namespace RecrownedAthenaeum.Camera public virtual void Apply() { ViewMatrix = Matrix.CreateLookAt(position, lookAt, upDirection); - TransformationMatrix = projectionMatrix * ViewMatrix * worldMatrix; BasicEffect.World = worldMatrix; BasicEffect.View = ViewMatrix;