Revert "beginnings of UI???"

This reverts commit df370d1142.
This commit is contained in:
Royce551 2022-09-11 19:38:23 -05:00
parent df370d1142
commit f8a3b38352
6 changed files with 1 additions and 117 deletions

View file

@ -11,7 +11,6 @@ using Water.Audio;
using Water.Graphics;
using Water.Graphics.Containers;
using Water.Graphics.Controls;
using Water.Graphics.Controls.UI;
using Water.Graphics.Screens;
namespace TestGame.Screens
@ -68,8 +67,6 @@ namespace TestGame.Screens
}));
AddChild(rc);
AddChild(Game.AddObject(new UIElement()));
}
public override void Deinitialize()

View file

@ -59,7 +59,6 @@ namespace Water.Graphics
{
child.Parent = this;
Children.Add(child);
child.OnAddedToScreen();
CalculateChildrenPositions();
}
/// <summary>
@ -70,20 +69,9 @@ namespace Water.Graphics
{
child.Parent = null;
Children.Remove(child);
child.OnRemovedFromScreen();
CalculateChildrenPositions();
}
public virtual void OnAddedToScreen()
{
}
public virtual void OnRemovedFromScreen()
{
}
/// <summary>
/// Calculates the ActualPositions of this container's children. Override if you are a special kind of container
/// </summary>

View file

@ -1,33 +0,0 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Water.Graphics.Controls.UI
{
public class UIContextContainer : GameObject
{
public override void Deinitialize()
{
}
public override void Draw(GameTime gameTime, SpriteBatch spriteBatch, GraphicsDevice graphicsDevice)
{
}
public override void Initialize()
{
}
public override void Update(GameTime gameTime)
{
}
}
}

View file

@ -1,64 +0,0 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Water.Graphics.Controls.UI
{
public class UIElement : GameObject
{
public bool Index { get; set; }
public bool IsFocused { get; set; }
private UIContextContainer uiContext;
public override void OnAddedToScreen()
{
IContainer container = Parent;
while (true)
{
if (container is UIContextContainer x)
{
uiContext = container as UIContextContainer;
break;
}
else if (container.Parent is null)
throw new Exception("Kyaa! There are no screens or other UI Context containers up the hierarchy from this control >.<");
else
container = container.Parent;
}
base.OnAddedToScreen();
}
public override void OnRemovedFromScreen()
{
base.OnRemovedFromScreen();
}
public override void Deinitialize()
{
}
public override void Draw(GameTime gameTime, SpriteBatch spriteBatch, GraphicsDevice graphicsDevice)
{
}
public override void Initialize()
{
}
public override void Update(GameTime gameTime)
{
}
}
}

View file

@ -23,9 +23,6 @@ namespace Water.Graphics
public void AddChild(IContainer child);
public void RemoveChild(IContainer child);
public void OnAddedToScreen();
public void OnRemovedFromScreen();
public void CalculateChildrenPositions();
public void DrawChildren(GameTime gameTime, SpriteBatch spriteBatch, GraphicsDevice graphicsDevice);

View file

@ -5,11 +5,10 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Water.Graphics.Controls.UI;
namespace Water.Graphics.Screens
{
public abstract class Screen : UIContextContainer
public abstract class Screen : GameObject
{
public virtual ScreenManager ScreenManager { get; set; }