This commit is contained in:
dvaer 2024-08-16 09:30:27 +03:00
parent 4207258d15
commit a9e5cc9a2e
9 changed files with 124 additions and 10 deletions

View file

@ -49,9 +49,9 @@ namespace MonogameLibrary.UI.Elements
public override void LoadTexture(ContentManager content)
{
texture1 = content.Load<Texture2D>("textures\\ui\\checkboxs_off");
texture2 = content.Load<Texture2D>("textures\\ui\\checkboxs_off-on");
texture3 = content.Load<Texture2D>("textures\\ui\\checkboxs_on");
texture1 = content.Load<Texture2D>("Textures\\GUI\\checkboxs_off");
texture2 = content.Load<Texture2D>("Textures\\GUI\\checkboxs_off-on");
texture3 = content.Load<Texture2D>("Textures\\GUI\\checkboxs_on");
base.LoadTexture(content);
}
public override void Draw(SpriteBatch _spriteBatch)

View file

@ -56,7 +56,7 @@ namespace MonogameLibrary.UI.Elements
public override void LoadTexture(ContentManager content)
{
texture2 = content.Load<Texture2D>("textures\\ui\\slider");
texture2 = content.Load<Texture2D>("Textures\\GUI\\checkboxs_off");
base.LoadTexture(content);
}

View file

@ -27,6 +27,42 @@
/processorParam:TextureFormat=Compressed
/build:Fonts/Font2.spritefont
#begin Textures/GUI/checkboxs_off-on.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Textures/GUI/checkboxs_off-on.png
#begin Textures/GUI/checkboxs_off.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Textures/GUI/checkboxs_off.png
#begin Textures/GUI/checkboxs_on.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Textures/GUI/checkboxs_on.png
#begin Textures/GUI/MenuBackground.jpg
/importer:TextureImporter
/processor:TextureProcessor

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

View file

@ -16,13 +16,12 @@ namespace ZoFo.GameCore.GUI;
public class MainMenuGUI : AbstractGUI
{
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), mainColor = mainBackgroundColor, textureName = "Textures\\GUI\\MenuBackground" };
menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, width, height), mainColor = Color.White, textureName = "Textures\\GUI\\MenuBackground" };
Elements.Add(menuBackground);
menuBackground.LoadTexture(AppManager.Instance.Content);
@ -54,7 +53,7 @@ public class MainMenuGUI : AbstractGUI
};
optionButton.LeftButtonPressed += () =>
{
AppManager.Instance.SetGUI(new OptionsGUI());
};
Elements.Add(optionButton);
Button exitButton = new Button(Manager)

View file

@ -9,19 +9,96 @@ 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 OptionsGUI : AbstractGUI
{
private 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), mainColor = Color.White, 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 = "Options", fontColor = Color.White, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts\\Font"});
Label label_OverallVolume = new Label(Manager)
{ fontName = "Fonts\\Font", scale = 0.2f, text = "All Volume", fontColor = Color.White, rectangle = new Rectangle(width / 3, height / 3, 50, 50), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left };
Elements.Add(label_OverallVolume);
var slider_OverallVolume = new Slider(Manager)
{ rectangle = new Rectangle(width / 2, height / 3, width / 10, height / 20), indentation = 4, textureName = "Textures\\GUI\\checkbox_on", MinValue = 0, MaxValue = 1 };
slider_OverallVolume.SliderChanged += (newVal) =>
{
};
Elements.Add(slider_OverallVolume);
Label label_MusicVolume = new Label(Manager)
{ fontName = "Fonts\\Font", scale = 0.2f, text = "Music Volume", fontColor = Color.White, rectangle = new Rectangle(width / 3, height / 3 + (height / 20 + height / 40) * 1, 50, 50), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left };
Elements.Add(label_MusicVolume);
var slider_MusicVolume = new Slider(Manager)
{ rectangle = new Rectangle(width / 2, height / 3 + (height / 20 + height / 40) * 1, width / 10, height / 20), indentation = 4, textureName = "Textures\\GUI\\checkboxs_on", MinValue = 0, MaxValue = 1 };
slider_MusicVolume.SliderChanged += (newVal) =>
{
};
Elements.Add(slider_MusicVolume);
Label label_EffectsVolume = new Label(Manager)
{ fontName = "Fonts\\Font", scale = 0.2f, text = "Effects Volume", fontColor = Color.White, rectangle = new Rectangle(width / 3, height / 3 + (height / 20 + height / 40) * 2, 50, 50), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left };
Elements.Add(label_EffectsVolume);
var slider_EffectsVolume = new Slider(Manager)
{ rectangle = new Rectangle(width / 2, height / 3 + (height / 20 + height / 40) * 2, width / 10, height / 20), indentation = 4, textureName = "Textures\\GUI\\checkboxs_on", MinValue = 0, MaxValue = 1 };
slider_EffectsVolume.SliderChanged += (newVal) =>
{
};
Elements.Add(slider_EffectsVolume);
Label lblSwitchMode = new Label(Manager)
{ fontName = "Fonts\\Font", scale = 0.2f, text = "Left/Right Mode", fontColor = Color.White, rectangle = new Rectangle(width / 3, height / 3 + (height / 20 + height / 40) * 3, 50, 50), mainColor = Color.Transparent};
Elements.Add(lblSwitchMode);
//var button_left_right_mode = new CheckBox(Manager) { rectangle = new Rectangle(rightBorder - checkboxlength, lblSwitchMode.rectangle.Y - 12, checkboxlength, checkboxlength) };
//button_left_right_mode.Checked += (newCheckState) => { };
//Elements.Add(button_left_right_mode);
Label label_IsFullScreen = new Label(Manager)
{ fontName = "Fonts\\Font", scale = 0.2f, text = "Full Screen", fontColor = Color.White, rectangle = new Rectangle(width / 3, height / 3 + (height / 20 + height / 40) * 4, 50, 50), mainColor = Color.Transparent};
Elements.Add(label_IsFullScreen);
var button_FullScreen = new CheckBox(Manager) { rectangle = new Rectangle(width / 2, height / 3 + (height / 20 + height / 40) * 4, width / 30, width / 30) };
button_FullScreen.Checked += (newCheckState) =>
{
};
Elements.Add(button_FullScreen);
Button bTExit = new Button(Manager)
{ fontName = "Fonts\\Font", scale = 0.2f, text = "<-", rectangle = new Rectangle(width / 30, height / 30, 40, 40), textureName = "Textures\\GUI\\checkboxs_off" };
Elements.Add(bTExit);
bTExit.LeftButtonPressed += () =>
{
};
}
public override void Update(GameTime gameTime)
{
base.Update(gameTime);
}
}

View file

@ -132,6 +132,8 @@ namespace ZoFo.GameCore.GameManagers
public void SetGUI(AbstractGUI gui)
{
currentGUI = gui;
currentGUI.Initialize();
currentGUI.LoadContent();
//TODO
}