This commit is contained in:
gravity 2023-08-17 20:51:51 +03:00
parent d8acf7104a
commit 0f62ed8b33
6 changed files with 74 additions and 62 deletions

View file

@ -14,30 +14,6 @@
#---------------------------------- Content ---------------------------------#
#begin MonstersAnimations.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:MonstersAnimations.png
#begin deathAnimation.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:deathAnimation.png
#begin ButtonFont.spritefont
/importer:FontDescriptionImporter
/processor:FontDescriptionProcessor
@ -45,13 +21,6 @@
/processorParam:TextureFormat=Compressed
/build:ButtonFont.spritefont
#begin DoomTestSong.mp3
/importer:Mp3Importer
/processor:SoundEffectProcessor
/processorParam:Quality=Best
/build:DoomTestSong.mp3
#begin checkboxs_off-on.png
/importer:TextureImporter
/processor:TextureProcessor
@ -88,6 +57,18 @@
/processorParam:TextureFormat=Color
/build:checkboxs_on.png
#begin deathAnimation.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:deathAnimation.png
#begin deathBackground.jpg
/importer:TextureImporter
/processor:TextureProcessor
@ -100,6 +81,12 @@
/processorParam:TextureFormat=Color
/build:deathBackground.jpg
#begin DoomTestSong.mp3
/importer:Mp3Importer
/processor:SoundEffectProcessor
/processorParam:Quality=Best
/build:DoomTestSong.mp3
#begin Font_25.spritefont
/importer:FontDescriptionImporter
/processor:FontDescriptionProcessor
@ -133,18 +120,6 @@
/processorParam:TextureFormat=Color
/build:menuFon.jpg
#begin menuFon.jpg
/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:menuFon.jpg
#begin MenuFon2.jpg
/importer:TextureImporter
/processor:TextureProcessor
@ -169,18 +144,6 @@
/processorParam:TextureFormat=Color
/build:menuFon3.jpg
#begin tiles.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:tiles.png
#begin MonstersAnimations.png
/importer:TextureImporter
/processor:TextureProcessor
@ -217,6 +180,30 @@
/processorParam:TextureFormat=Color
/build:PC_Computer_Dangerous_Dave_In_The_Haunted_Mansion_Death_Sequences.png
#begin slider.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:slider.png
#begin sliderBackground.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:sliderBackground.png
#begin textboxbackground1-1.png
/importer:TextureImporter
/processor:TextureProcessor
@ -265,6 +252,18 @@
/processorParam:TextureFormat=Color
/build:textboxbackground6-1.png
#begin tiles.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:tiles.png
#begin wall.jpg
/importer:TextureImporter
/processor:TextureProcessor

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -45,9 +45,10 @@ namespace DangerousD.GameCore.GUI
screenWidth / 30 * 10, screenHeight / 30 * 3),
text = "ip",
scale = 0.16f,
fontColor = Color.Gray,
fontColor = Color.Black,
fontName = "font2",
textAligment = TextAligment.Left
textAligment = TextAligment.Left,
textureName = "textboxbackground6-1"
};
searchBarTextBox.TextChanged += input => {

View file

@ -23,7 +23,9 @@ namespace DangerousD.GameCore.GUI
{
MinValue = 0,
MaxValue = 1,
rectangle = new Rectangle(wigth / 2 + 220, 275, (int)(100 * 2.4), 40)
rectangle = new Rectangle(wigth / 2 + 220, 275, (int)(100 * 2.4), 40),
indentation = 5,
textureName = "sliderBackground"
};
var cB = new CheckBox(Manager);

View file

@ -1,4 +1,5 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using MonogameLibrary.UI.Base;
@ -17,7 +18,9 @@ namespace MonogameLibrary.UI.Elements
}
public delegate void OnSliderChanges(float value);
public event OnSliderChanges? SliderChanged;
public int indentation = 5;
Texture2D texture2;
public Rectangle sliderRect = new Rectangle(0, 0, 30, 30);
private float sliderValue = 0;
private float minValue = 0, maxValue = 1;
@ -50,6 +53,13 @@ namespace MonogameLibrary.UI.Elements
sliderState = SliderState.None;
return false;
}
public override void LoadTexture(ContentManager content)
{
texture2 = content.Load<Texture2D>("slider");
base.LoadTexture(content);
}
public void SetValue(float setvalue)
{
sliderValue = setvalue;
@ -60,14 +70,14 @@ namespace MonogameLibrary.UI.Elements
{
base.Draw(_spriteBatch);
sliderRect.Location = rectangle.Location;
sliderRect.X += (int)(sliderValue * (rectangle.Width - sliderRect.Width));
sliderRect.X += (int)(sliderValue * (rectangle.Width - sliderRect.Width - indentation * 2) + indentation);
sliderRect.Y -= sliderRect.Height / 2 - rectangle.Height / 2;
if (sliderState == SliderState.Moving)
_spriteBatch.Draw(texture, sliderRect, Color.DarkRed);
_spriteBatch.Draw(texture2, sliderRect, Color.DarkRed);
else if(sliderState == SliderState.HoveringOverSliderButton)
_spriteBatch.Draw(texture, sliderRect, new Color(200,0,0));
_spriteBatch.Draw(texture2, sliderRect, new Color(200,0 ,0));
else
_spriteBatch.Draw(texture, sliderRect, Color.Red);
_spriteBatch.Draw(texture2, sliderRect, Color.Red);
DrawText(_spriteBatch);
}
}