This commit is contained in:
dvaer 2024-08-15 11:15:02 +03:00
parent a21e97c342
commit 59b04ce7f1
4 changed files with 27 additions and 8 deletions

View file

@ -9,6 +9,7 @@ using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using MonogameLibrary.UI.Base;
using MonogameLibrary.UI.Elements;
using ZoFo.GameCore.GameManagers;
namespace ZoFo.GameCore.GUI;
@ -29,13 +30,13 @@ public abstract class AbstractGUI
private GraphicsDevice graphicsDevice;
public virtual void Initialize()
{
// Manager.Initialize(AppManager.Instance.GraphicsDevice);
Manager.Initialize(AppManager.Instance.GraphicsDevice);
CreateUI();
}
public virtual void LoadContent()
{
Manager.LoadContent(AppManager.Instance.Content, "Font");
}
public virtual void Update(GameTime gameTime)
@ -47,4 +48,9 @@ public abstract class AbstractGUI
{
Manager.Draw(spriteBatch);
}
public virtual void ResolutioChenges()
{
}
}

View file

@ -0,0 +1,6 @@
namespace ZoFo.GameCore.GUI;
public class DebugHUD
{
}

View file

@ -9,15 +9,21 @@ using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using MonogameLibrary.UI.Base;
using MonogameLibrary.UI.Elements;
using ZoFo.GameCore.GameManagers;
namespace ZoFo.GameCore.GUI;
public class MainMenuGUI : AbstractGUI
{
DrawableUIElement menuBackground;
protected override void CreateUI()
{
// int width = AppManager.Instance.inGameHUDHelperResolution.X;
// int height = AppManager.Instance.inGameHUDHelperResolution.Y;
int width = AppManager.Instance.CurentScreenResolution.X;
int height = AppManager.Instance.CurentScreenResolution.Y;
menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, width, height), textureName = "Texture\\GUI\\MenuBackground" };
Elements.Add(menuBackground);
menuBackground.LoadTexture(AppManager.Instance.Content);
}
public override void Update(GameTime gameTime)

View file

@ -22,6 +22,7 @@ namespace ZoFo.GameCore.GameManagers
public static AppManager Instance { get; private set; }
public GameState gamestate;
public AbstractGUI currentGUI;
public Point CurentScreenResolution = new Point(1920, 1080);
//public Client client;
//public Server server;
@ -41,14 +42,14 @@ namespace ZoFo.GameCore.GameManagers
Instance = this;
InputManager = new InputManager();
currentGUI = new MainMenuGUI();
}
protected override void Initialize()
{
currentGUI.Initialize();
base.Initialize();
@ -94,7 +95,7 @@ namespace ZoFo.GameCore.GameManagers
GraphicsDevice.Clear(Color.CornflowerBlue);
//currentGUI.Draw(_spriteBatch);
currentGUI.Draw(_spriteBatch);
switch (gamestate)
{
case GameState.ClientPlaying: