From fb2b6851360d3ca8366aefc80b0ea38432930e94 Mon Sep 17 00:00:00 2001 From: dvaer Date: Thu, 15 Aug 2024 11:36:04 +0300 Subject: [PATCH 1/2] addDebugHUD --- ZoFo/Content/Content.mgcb | 8 +- .../{Font => Fonts}/Debrosee-ALPnL.ttf | Bin ZoFo/Content/{Font => Fonts}/Font.spritefont | 0 .../GUI/MenuBackground.jpg | Bin ZoFo/GameCore/GUI/DebugHUD.cs | 70 +++++++++++++++++- ZoFo/GameCore/GUI/MainMenuGUI.cs | 2 +- ZoFo/GameCore/GameManagers/AppManager.cs | 7 +- ZoFo/ZoFo.csproj | 2 +- 8 files changed, 80 insertions(+), 9 deletions(-) rename ZoFo/Content/{Font => Fonts}/Debrosee-ALPnL.ttf (100%) rename ZoFo/Content/{Font => Fonts}/Font.spritefont (100%) rename ZoFo/Content/{Texture => Textures}/GUI/MenuBackground.jpg (100%) diff --git a/ZoFo/Content/Content.mgcb b/ZoFo/Content/Content.mgcb index 44c7f84..a19860f 100644 --- a/ZoFo/Content/Content.mgcb +++ b/ZoFo/Content/Content.mgcb @@ -13,14 +13,14 @@ #---------------------------------- Content ---------------------------------# -#begin Font/Font.spritefont +#begin Fonts/Font.spritefont /importer:FontDescriptionImporter /processor:FontDescriptionProcessor /processorParam:PremultiplyAlpha=True /processorParam:TextureFormat=Compressed -/build:Font/Font.spritefont +/build:Fonts/Font.spritefont -#begin Texture/GUI/MenuBackground.jpg +#begin Textures/GUI/MenuBackground.jpg /importer:TextureImporter /processor:TextureProcessor /processorParam:ColorKeyColor=255,0,255,255 @@ -30,5 +30,5 @@ /processorParam:ResizeToPowerOfTwo=False /processorParam:MakeSquare=False /processorParam:TextureFormat=Color -/build:Texture/GUI/MenuBackground.jpg +/build:Textures/GUI/MenuBackground.jpg diff --git a/ZoFo/Content/Font/Debrosee-ALPnL.ttf b/ZoFo/Content/Fonts/Debrosee-ALPnL.ttf similarity index 100% rename from ZoFo/Content/Font/Debrosee-ALPnL.ttf rename to ZoFo/Content/Fonts/Debrosee-ALPnL.ttf diff --git a/ZoFo/Content/Font/Font.spritefont b/ZoFo/Content/Fonts/Font.spritefont similarity index 100% rename from ZoFo/Content/Font/Font.spritefont rename to ZoFo/Content/Fonts/Font.spritefont diff --git a/ZoFo/Content/Texture/GUI/MenuBackground.jpg b/ZoFo/Content/Textures/GUI/MenuBackground.jpg similarity index 100% rename from ZoFo/Content/Texture/GUI/MenuBackground.jpg rename to ZoFo/Content/Textures/GUI/MenuBackground.jpg diff --git a/ZoFo/GameCore/GUI/DebugHUD.cs b/ZoFo/GameCore/GUI/DebugHUD.cs index f735f7e..db583c4 100644 --- a/ZoFo/GameCore/GUI/DebugHUD.cs +++ b/ZoFo/GameCore/GUI/DebugHUD.cs @@ -1,6 +1,72 @@ -namespace ZoFo.GameCore.GUI; +using System.Collections.Generic; +using System.Linq; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using MonogameLibrary.UI.Elements; +using static System.String; +using ZoFo.GameCore.GameManagers; + +namespace ZoFo.GameCore.GUI; public class DebugHUD { - + private SpriteFont _spriteFont; + private Dictionary _text = new(); + private List _log = new(); + + public void Initialize() + { + } + + public void LoadContent() + { + _spriteFont = AppManager.Instance.Content.Load("Fonts\\Font"); + } + + public void Update(GameTime gameTime) + { + } + + public void Draw(SpriteBatch spriteBatch) + { + var keysString = Join("\n", _text.Select(el => el.Key + ": " + el.Value).ToList()); + spriteBatch.Begin(); + spriteBatch.DrawString( + _spriteFont, + keysString, + new Vector2(10, 10), + Color.Cyan, + 0, + Vector2.Zero, + 1, + SpriteEffects.None, + 0 + ); + spriteBatch.DrawString( + _spriteFont, + Join("\n", _log), + new Vector2(10, 10 + _spriteFont.MeasureString(keysString).Y), + Color.Green, + 0, + Vector2.Zero, + 1, + SpriteEffects.None, + 0 + ); + spriteBatch.End(); + } + + public void Set(string key, string value) + { + _text[key] = value; + } + + public void Log(string value) + { + _log.Add(value); + if (_log.Count > 30) + { + _log.RemoveAt(0); + } + } } \ No newline at end of file diff --git a/ZoFo/GameCore/GUI/MainMenuGUI.cs b/ZoFo/GameCore/GUI/MainMenuGUI.cs index 98b0640..c47e284 100644 --- a/ZoFo/GameCore/GUI/MainMenuGUI.cs +++ b/ZoFo/GameCore/GUI/MainMenuGUI.cs @@ -21,7 +21,7 @@ public class MainMenuGUI : AbstractGUI 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" }; + menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, width, height), textureName = "Textures\\GUI\\MenuBackground" }; Elements.Add(menuBackground); menuBackground.LoadTexture(AppManager.Instance.Content); } diff --git a/ZoFo/GameCore/GameManagers/AppManager.cs b/ZoFo/GameCore/GameManagers/AppManager.cs index 77df726..4e5fe1d 100644 --- a/ZoFo/GameCore/GameManagers/AppManager.cs +++ b/ZoFo/GameCore/GameManagers/AppManager.cs @@ -22,6 +22,7 @@ namespace ZoFo.GameCore.GameManagers public static AppManager Instance { get; private set; } public GameState gamestate; public AbstractGUI currentGUI; + public DebugHUD debugHud; public Point CurentScreenResolution = new Point(1920, 1080); //public Client client; //public Server server; @@ -43,12 +44,14 @@ namespace ZoFo.GameCore.GameManagers InputManager = new InputManager(); currentGUI = new MainMenuGUI(); + debugHud = new DebugHUD(); } protected override void Initialize() { currentGUI.Initialize(); + debugHud.Initialize(); @@ -58,7 +61,8 @@ namespace ZoFo.GameCore.GameManagers protected override void LoadContent() { _spriteBatch = new SpriteBatch(GraphicsDevice); - + debugHud.LoadContent(); + currentGUI.LoadContent(); @@ -96,6 +100,7 @@ namespace ZoFo.GameCore.GameManagers currentGUI.Draw(_spriteBatch); + debugHud.Draw(_spriteBatch); switch (gamestate) { case GameState.ClientPlaying: diff --git a/ZoFo/ZoFo.csproj b/ZoFo/ZoFo.csproj index 70c8cbc..be7977b 100644 --- a/ZoFo/ZoFo.csproj +++ b/ZoFo/ZoFo.csproj @@ -27,7 +27,7 @@ - + From 4207258d15222d511c34b1f58cfa28f4931e3110 Mon Sep 17 00:00:00 2001 From: dvaer Date: Thu, 15 Aug 2024 16:21:40 +0300 Subject: [PATCH 2/2] mainMenu --- MonogameLibrary/UI/Base/UIManager.cs | 4 +- ZoFo/Content/Content.mgcb | 7 +++ ZoFo/Content/Fonts/CarltineRegular-K7z5l.ttf | Bin 0 -> 22936 bytes ZoFo/Content/Fonts/Font.spritefont | 2 +- ZoFo/Content/Fonts/Font2.spritefont | 60 +++++++++++++++++++ ZoFo/GameCore/GUI/AbstractGUI.cs | 2 +- ZoFo/GameCore/GUI/DebugHUD.cs | 2 +- ZoFo/GameCore/GUI/MainMenuGUI.cs | 55 ++++++++++++++++- ZoFo/GameCore/GameManagers/AppManager.cs | 30 ++++++++-- 9 files changed, 150 insertions(+), 12 deletions(-) create mode 100644 ZoFo/Content/Fonts/CarltineRegular-K7z5l.ttf create mode 100644 ZoFo/Content/Fonts/Font2.spritefont diff --git a/MonogameLibrary/UI/Base/UIManager.cs b/MonogameLibrary/UI/Base/UIManager.cs index 826a0a1..125df25 100644 --- a/MonogameLibrary/UI/Base/UIManager.cs +++ b/MonogameLibrary/UI/Base/UIManager.cs @@ -59,8 +59,8 @@ namespace MonogameLibrary.UI.Base { keyboardState = Keyboard.GetState(); mouseState = Mouse.GetState(); - mouseState = new MouseState((int)(mouseState.X*(float)resolutionInGame.X/resolution.X), - (int)(mouseState.Y * (float)resolutionInGame.Y / resolution.Y), mouseState.ScrollWheelValue, mouseState.LeftButton, mouseState.MiddleButton, mouseState.RightButton, mouseState.XButton1, mouseState.XButton2); + //mouseState = new MouseState((int)(mouseState.X*(float)resolutionInGame.X/resolution.X), + // (int)(mouseState.Y * (float)resolutionInGame.Y / resolution.Y), mouseState.ScrollWheelValue, mouseState.LeftButton, mouseState.MiddleButton, mouseState.RightButton, mouseState.XButton1, mouseState.XButton2); } catch { diff --git a/ZoFo/Content/Content.mgcb b/ZoFo/Content/Content.mgcb index a19860f..4390819 100644 --- a/ZoFo/Content/Content.mgcb +++ b/ZoFo/Content/Content.mgcb @@ -20,6 +20,13 @@ /processorParam:TextureFormat=Compressed /build:Fonts/Font.spritefont +#begin Fonts/Font2.spritefont +/importer:FontDescriptionImporter +/processor:FontDescriptionProcessor +/processorParam:PremultiplyAlpha=True +/processorParam:TextureFormat=Compressed +/build:Fonts/Font2.spritefont + #begin Textures/GUI/MenuBackground.jpg /importer:TextureImporter /processor:TextureProcessor diff --git a/ZoFo/Content/Fonts/CarltineRegular-K7z5l.ttf b/ZoFo/Content/Fonts/CarltineRegular-K7z5l.ttf new file mode 100644 index 0000000000000000000000000000000000000000..1496983ef245bf8d21b515eca03e7b7165892f97 GIT binary patch literal 22936 zcmeI43z%G0mGAdC_3Br3b#+yBS9Nt)cXf4lRlgtAUHwcylJ2|{1Hn``nwKOb2!xOz z4-w6PBH=^ydKH3#cLpCMsB<%3uZ9e0oROEzcq0SoK=d0ia0l{T$3YZyCRO*h&N*DE!3+s^G7;~|1|e@a6Pq?6V6-o`#IjmansH#uett~ijr}f zP{g^4E3Ud^tIPGqVx^XIS>1l+*6Vlc7wR6a-NtdluB}&YeItbd$0NO z0~4<*welF(zp;DI_TA$TKE0ayIaFJe@CtCDIw%4~%`g_PX{dcgr{_j9chP$nE`)qBl- zuC=Orxc^@`o@M)-xz*pTnzU=#@8R69xaX^EKManT_1Xr_^ZL82`{mii?CWelW?iE$ z{Tbi@Hr1|Q%(D-$zme_F*-9CoXL}zQ0_yhRE-L&T2*&O3H9`TR5hxYYEsRrMa5MD4z;Ov)uB37 zm+DqMs#o=?r0Q1#Dy0V15Vk@ju#!4#hK#!@ql0^g)y3+A*{o51?pzO4Z{?hp{Y~~4 z%ANg{D#`wJ_B-d|+!3WZRvl5r>t_E#)9#!*qGdmJL`~N{M9XZOH+3FC?Hd|qE}K5A zZQ(%g;6z)LJzGb^(!;jqr5Db|<{EBqxP8U8+Z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c4f#n_Cl*N}F+R;DS?{;GUWxx?MsM2x1)7H7tN;K2 literal 0 HcmV?d00001 diff --git a/ZoFo/Content/Fonts/Font.spritefont b/ZoFo/Content/Fonts/Font.spritefont index e6b9115..754d1ee 100644 --- a/ZoFo/Content/Fonts/Font.spritefont +++ b/ZoFo/Content/Fonts/Font.spritefont @@ -17,7 +17,7 @@ with. Size is a float value, measured in points. Modify this value to change the size of the font. --> - 12 + 100 + + + + + CarltineRegular-K7z5l.ttf + + + 15 + + + 0 + + + true + + + + + + + + + + + + ~ + + + + diff --git a/ZoFo/GameCore/GUI/AbstractGUI.cs b/ZoFo/GameCore/GUI/AbstractGUI.cs index 95ec020..2c2d7f6 100644 --- a/ZoFo/GameCore/GUI/AbstractGUI.cs +++ b/ZoFo/GameCore/GUI/AbstractGUI.cs @@ -41,7 +41,7 @@ public abstract class AbstractGUI public virtual void Update(GameTime gameTime) { - + Manager.Update(gameTime); } public virtual void Draw(SpriteBatch spriteBatch) diff --git a/ZoFo/GameCore/GUI/DebugHUD.cs b/ZoFo/GameCore/GUI/DebugHUD.cs index db583c4..de4a587 100644 --- a/ZoFo/GameCore/GUI/DebugHUD.cs +++ b/ZoFo/GameCore/GUI/DebugHUD.cs @@ -20,7 +20,7 @@ public class DebugHUD public void LoadContent() { - _spriteFont = AppManager.Instance.Content.Load("Fonts\\Font"); + _spriteFont = AppManager.Instance.Content.Load("Fonts\\Font2"); } public void Update(GameTime gameTime) diff --git a/ZoFo/GameCore/GUI/MainMenuGUI.cs b/ZoFo/GameCore/GUI/MainMenuGUI.cs index c47e284..cb259c7 100644 --- a/ZoFo/GameCore/GUI/MainMenuGUI.cs +++ b/ZoFo/GameCore/GUI/MainMenuGUI.cs @@ -15,19 +15,68 @@ namespace ZoFo.GameCore.GUI; public class MainMenuGUI : AbstractGUI { - DrawableUIElement menuBackground; + private DrawableUIElement menuBackground; + Color mainBackgroundColor = Color.White; protected override void CreateUI() { int width = AppManager.Instance.CurentScreenResolution.X; int height = AppManager.Instance.CurentScreenResolution.Y; - menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, width, height), textureName = "Textures\\GUI\\MenuBackground" }; + menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, width, height), mainColor = mainBackgroundColor, textureName = "Textures\\GUI\\MenuBackground" }; Elements.Add(menuBackground); menuBackground.LoadTexture(AppManager.Instance.Content); + + Elements.Add(new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 5, (int)(width / 4), (int)(height / 20)), text = "ZoFo", fontColor = Color.White, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts\\Font"}); + + + Button playButton = new Button(Manager) + { + rectangle = new Rectangle(width / 2 - (int)(width / 10), height / 3 + height / 20 + height / 40, (int)(width / 5), (int)(height / 20)), + text = "Play", + scale = 0.2f, + fontColor = Color.White, + mainColor = Color.Gray, + fontName = "Fonts\\Font" + }; + playButton.LeftButtonPressed += () => + { + + }; + Elements.Add(playButton); + Button optionButton = new Button(Manager) + { + rectangle = new Rectangle(width / 2 - (int)(width / 10), height / 3 + (height / 20 + height / 40) * 2, (int)(width / 5), (int)(height / 20)), + text = "Options", + scale = 0.2f, + fontColor = Color.White, + mainColor = Color.Gray, + fontName = "Fonts\\Font" + }; + optionButton.LeftButtonPressed += () => + { + + }; + Elements.Add(optionButton); + Button exitButton = new Button(Manager) + { + rectangle = new Rectangle(width / 2 - (int)(width / 10), height / 3 + (height / 20 + height / 40) * 3, (int)(width / 5), (int)(height / 20)), + text = "Exit", + scale = 0.2f, + fontColor = Color.White, + mainColor = Color.Gray, + fontName = "Fonts\\Font" + }; + exitButton.LeftButtonPressed += () => + { + AppManager.Instance.Exit(); + }; + Elements.Add(exitButton); + + } public override void Update(GameTime gameTime) { - + base.Update(gameTime); } } \ No newline at end of file diff --git a/ZoFo/GameCore/GameManagers/AppManager.cs b/ZoFo/GameCore/GameManagers/AppManager.cs index 4e5fe1d..5605d02 100644 --- a/ZoFo/GameCore/GameManagers/AppManager.cs +++ b/ZoFo/GameCore/GameManagers/AppManager.cs @@ -9,6 +9,7 @@ using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using ZoFo.GameCore.GUI; using static System.Collections.Specialized.BitVector32; +using MonogameLibrary.UI.Base; namespace ZoFo.GameCore.GameManagers { @@ -17,7 +18,8 @@ namespace ZoFo.GameCore.GameManagers { private GraphicsDeviceManager _graphics; private SpriteBatch _spriteBatch; - + + public static AppManager Instance { get; private set; } public GameState gamestate; @@ -37,11 +39,17 @@ namespace ZoFo.GameCore.GameManagers public AppManager() { _graphics = new GraphicsDeviceManager(this); + SetResolution(CurentScreenResolution.X, CurentScreenResolution.Y); + FulscrreenSwitch(); + + Content.RootDirectory = "Content"; IsMouseVisible = true; Instance = this; InputManager = new InputManager(); + + currentGUI = new MainMenuGUI(); debugHud = new DebugHUD(); @@ -73,9 +81,11 @@ namespace ZoFo.GameCore.GameManagers if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) Exit(); - + + debugHud.Set("key", "value"); + InputManager.Update(); - //currentGUI.Update(); + currentGUI.Update(gameTime); switch (gamestate) { case GameState.NotPlaying: @@ -98,9 +108,10 @@ namespace ZoFo.GameCore.GameManagers { GraphicsDevice.Clear(Color.CornflowerBlue); + - currentGUI.Draw(_spriteBatch); debugHud.Draw(_spriteBatch); + currentGUI.Draw(_spriteBatch); switch (gamestate) { case GameState.ClientPlaying: @@ -129,5 +140,16 @@ namespace ZoFo.GameCore.GameManagers { //TODO } + + public void SetResolution(int x, int y) + { + _graphics.PreferredBackBufferWidth = x; + _graphics.PreferredBackBufferHeight = y; + } + + public void FulscrreenSwitch() + { + _graphics.IsFullScreen = !_graphics.IsFullScreen; + } } }