gui
This commit is contained in:
parent
d8acf7104a
commit
0f62ed8b33
6 changed files with 74 additions and 62 deletions
|
@ -14,30 +14,6 @@
|
||||||
|
|
||||||
#---------------------------------- Content ---------------------------------#
|
#---------------------------------- 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
|
#begin ButtonFont.spritefont
|
||||||
/importer:FontDescriptionImporter
|
/importer:FontDescriptionImporter
|
||||||
/processor:FontDescriptionProcessor
|
/processor:FontDescriptionProcessor
|
||||||
|
@ -45,13 +21,6 @@
|
||||||
/processorParam:TextureFormat=Compressed
|
/processorParam:TextureFormat=Compressed
|
||||||
/build:ButtonFont.spritefont
|
/build:ButtonFont.spritefont
|
||||||
|
|
||||||
|
|
||||||
#begin DoomTestSong.mp3
|
|
||||||
/importer:Mp3Importer
|
|
||||||
/processor:SoundEffectProcessor
|
|
||||||
/processorParam:Quality=Best
|
|
||||||
/build:DoomTestSong.mp3
|
|
||||||
|
|
||||||
#begin checkboxs_off-on.png
|
#begin checkboxs_off-on.png
|
||||||
/importer:TextureImporter
|
/importer:TextureImporter
|
||||||
/processor:TextureProcessor
|
/processor:TextureProcessor
|
||||||
|
@ -88,6 +57,18 @@
|
||||||
/processorParam:TextureFormat=Color
|
/processorParam:TextureFormat=Color
|
||||||
/build:checkboxs_on.png
|
/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
|
#begin deathBackground.jpg
|
||||||
/importer:TextureImporter
|
/importer:TextureImporter
|
||||||
/processor:TextureProcessor
|
/processor:TextureProcessor
|
||||||
|
@ -100,6 +81,12 @@
|
||||||
/processorParam:TextureFormat=Color
|
/processorParam:TextureFormat=Color
|
||||||
/build:deathBackground.jpg
|
/build:deathBackground.jpg
|
||||||
|
|
||||||
|
#begin DoomTestSong.mp3
|
||||||
|
/importer:Mp3Importer
|
||||||
|
/processor:SoundEffectProcessor
|
||||||
|
/processorParam:Quality=Best
|
||||||
|
/build:DoomTestSong.mp3
|
||||||
|
|
||||||
#begin Font_25.spritefont
|
#begin Font_25.spritefont
|
||||||
/importer:FontDescriptionImporter
|
/importer:FontDescriptionImporter
|
||||||
/processor:FontDescriptionProcessor
|
/processor:FontDescriptionProcessor
|
||||||
|
@ -133,18 +120,6 @@
|
||||||
/processorParam:TextureFormat=Color
|
/processorParam:TextureFormat=Color
|
||||||
/build:menuFon.jpg
|
/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
|
#begin MenuFon2.jpg
|
||||||
/importer:TextureImporter
|
/importer:TextureImporter
|
||||||
/processor:TextureProcessor
|
/processor:TextureProcessor
|
||||||
|
@ -169,18 +144,6 @@
|
||||||
/processorParam:TextureFormat=Color
|
/processorParam:TextureFormat=Color
|
||||||
/build:menuFon3.jpg
|
/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
|
#begin MonstersAnimations.png
|
||||||
/importer:TextureImporter
|
/importer:TextureImporter
|
||||||
/processor:TextureProcessor
|
/processor:TextureProcessor
|
||||||
|
@ -217,6 +180,30 @@
|
||||||
/processorParam:TextureFormat=Color
|
/processorParam:TextureFormat=Color
|
||||||
/build:PC_Computer_Dangerous_Dave_In_The_Haunted_Mansion_Death_Sequences.png
|
/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
|
#begin textboxbackground1-1.png
|
||||||
/importer:TextureImporter
|
/importer:TextureImporter
|
||||||
/processor:TextureProcessor
|
/processor:TextureProcessor
|
||||||
|
@ -265,6 +252,18 @@
|
||||||
/processorParam:TextureFormat=Color
|
/processorParam:TextureFormat=Color
|
||||||
/build:textboxbackground6-1.png
|
/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
|
#begin wall.jpg
|
||||||
/importer:TextureImporter
|
/importer:TextureImporter
|
||||||
/processor:TextureProcessor
|
/processor:TextureProcessor
|
||||||
|
|
BIN
DangerousD/Content/slider.png
Normal file
BIN
DangerousD/Content/slider.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
BIN
DangerousD/Content/sliderBackground.png
Normal file
BIN
DangerousD/Content/sliderBackground.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
|
@ -45,9 +45,10 @@ namespace DangerousD.GameCore.GUI
|
||||||
screenWidth / 30 * 10, screenHeight / 30 * 3),
|
screenWidth / 30 * 10, screenHeight / 30 * 3),
|
||||||
text = "ip",
|
text = "ip",
|
||||||
scale = 0.16f,
|
scale = 0.16f,
|
||||||
fontColor = Color.Gray,
|
fontColor = Color.Black,
|
||||||
fontName = "font2",
|
fontName = "font2",
|
||||||
textAligment = TextAligment.Left
|
textAligment = TextAligment.Left,
|
||||||
|
textureName = "textboxbackground6-1"
|
||||||
|
|
||||||
};
|
};
|
||||||
searchBarTextBox.TextChanged += input => {
|
searchBarTextBox.TextChanged += input => {
|
||||||
|
|
|
@ -23,7 +23,9 @@ namespace DangerousD.GameCore.GUI
|
||||||
{
|
{
|
||||||
MinValue = 0,
|
MinValue = 0,
|
||||||
MaxValue = 1,
|
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);
|
var cB = new CheckBox(Manager);
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
|
using Microsoft.Xna.Framework.Content;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using Microsoft.Xna.Framework.Input;
|
using Microsoft.Xna.Framework.Input;
|
||||||
using MonogameLibrary.UI.Base;
|
using MonogameLibrary.UI.Base;
|
||||||
|
@ -17,7 +18,9 @@ namespace MonogameLibrary.UI.Elements
|
||||||
}
|
}
|
||||||
public delegate void OnSliderChanges(float value);
|
public delegate void OnSliderChanges(float value);
|
||||||
public event OnSliderChanges? SliderChanged;
|
public event OnSliderChanges? SliderChanged;
|
||||||
|
public int indentation = 5;
|
||||||
|
|
||||||
|
Texture2D texture2;
|
||||||
public Rectangle sliderRect = new Rectangle(0, 0, 30, 30);
|
public Rectangle sliderRect = new Rectangle(0, 0, 30, 30);
|
||||||
private float sliderValue = 0;
|
private float sliderValue = 0;
|
||||||
private float minValue = 0, maxValue = 1;
|
private float minValue = 0, maxValue = 1;
|
||||||
|
@ -50,6 +53,13 @@ namespace MonogameLibrary.UI.Elements
|
||||||
sliderState = SliderState.None;
|
sliderState = SliderState.None;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void LoadTexture(ContentManager content)
|
||||||
|
{
|
||||||
|
texture2 = content.Load<Texture2D>("slider");
|
||||||
|
base.LoadTexture(content);
|
||||||
|
}
|
||||||
|
|
||||||
public void SetValue(float setvalue)
|
public void SetValue(float setvalue)
|
||||||
{
|
{
|
||||||
sliderValue = setvalue;
|
sliderValue = setvalue;
|
||||||
|
@ -60,14 +70,14 @@ namespace MonogameLibrary.UI.Elements
|
||||||
{
|
{
|
||||||
base.Draw(_spriteBatch);
|
base.Draw(_spriteBatch);
|
||||||
sliderRect.Location = rectangle.Location;
|
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;
|
sliderRect.Y -= sliderRect.Height / 2 - rectangle.Height / 2;
|
||||||
if (sliderState == SliderState.Moving)
|
if (sliderState == SliderState.Moving)
|
||||||
_spriteBatch.Draw(texture, sliderRect, Color.DarkRed);
|
_spriteBatch.Draw(texture2, sliderRect, Color.DarkRed);
|
||||||
else if(sliderState == SliderState.HoveringOverSliderButton)
|
else if(sliderState == SliderState.HoveringOverSliderButton)
|
||||||
_spriteBatch.Draw(texture, sliderRect, new Color(200,0,0));
|
_spriteBatch.Draw(texture2, sliderRect, new Color(200,0 ,0));
|
||||||
else
|
else
|
||||||
_spriteBatch.Draw(texture, sliderRect, Color.Red);
|
_spriteBatch.Draw(texture2, sliderRect, Color.Red);
|
||||||
DrawText(_spriteBatch);
|
DrawText(_spriteBatch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue