diff --git a/GeneralMods/StardustCore/UIUtilities/MenuComponents/SliderButton.cs b/GeneralMods/StardustCore/UIUtilities/MenuComponents/SliderButton.cs
index dafca71e..86586400 100644
--- a/GeneralMods/StardustCore/UIUtilities/MenuComponents/SliderButton.cs
+++ b/GeneralMods/StardustCore/UIUtilities/MenuComponents/SliderButton.cs
@@ -65,7 +65,7 @@ namespace StardustCore.UIUtilities.MenuComponents
///
/// Enum dealing with what kind of slider this is.
///
- SliderStyle sliderStyle;
+ public SliderStyle sliderStyle;
///
/// Constructor.
@@ -297,29 +297,66 @@ namespace StardustCore.UIUtilities.MenuComponents
///
public void offset(int x, int y)
{
- int xOffset = x - (this.bounds.X+this.bounds.Width/2);
- int yOffset = y - (this.bounds.Y+this.bounds.Height/2);
+
+ if (x < sliderBar.bounds.X)
+ {
+ x = sliderBar.bounds.X;
+ }
+ if (y < sliderBar.bounds.Y)
+ {
+ y = sliderBar.bounds.Y;
+ }
+ if (x > (sliderBar.bounds.X) + (sliderBar.bounds.Width))
+ {
+ x = (sliderBar.bounds.X) + (sliderBar.bounds.Width);
+ }
+ if (y > (sliderBar.bounds.Y) + (sliderBar.bounds.Height))
+ {
+ y = (sliderBar.bounds.Y) + (sliderBar.bounds.Height);
+ }
+
+ //Get offset from button.
+ int xOffset = (bounds.X - x); //267-300
+ int yOffset = (bounds.Y - y);
- this.sliderInformation.offset(xOffset, yOffset);
- offsetBounds();
+ if (sliderInformation.sliderStyle == SliderStyle.Horizontal || sliderInformation.sliderStyle== SliderStyle.Square)
+ {
+
+ this.sliderInformation.xPos = (x - sliderBar.bounds.X) / (int)scale;
+ this.bounds.X = this.sliderBar.bounds.X + this.sliderInformation.xPos*(int)scale;
+ if (this.bounds.X > this.sliderBar.bounds.X + this.sliderBar.bounds.Width)
+ {
+ this.bounds.X = this.sliderBar.bounds.X + this.sliderBar.bounds.Width;
+ }
+ }
+
+ if (sliderInformation.sliderStyle == SliderStyle.Vertical || sliderInformation.sliderStyle == SliderStyle.Square)
+ {
+ this.sliderInformation.yPos = (y - sliderBar.bounds.Y) / (int)scale;
+ this.bounds.Y = this.sliderBar.bounds.Y + this.sliderInformation.yPos*(int)scale;
+
+ if (this.bounds.Y > this.sliderBar.bounds.Y + this.sliderBar.bounds.Height)
+ {
+ this.bounds.Y = this.sliderBar.bounds.Y + this.sliderBar.bounds.Height;
+ }
+ }
+
+
+
+
+
+ //this.sliderInformation.offset(xOffset, yOffset);
}
- public void offsetBounds()
- {
- //EX: 200+(200+(3-200)) = (200)+(200-197)= 200+3 =203;
- //EX: 200+(200+(-3-200)) = (200)+(200-203)= 200-3 =197;
- this.bounds.X =this.bounds.X+(this.bounds.X + (this.sliderInformation.xPos-bounds.X));
- this.bounds.Y =this.bounds.Y+(this.bounds.Y + (this.sliderInformation.yPos-bounds.Y));
- }
///
/// Sets the initial position for the button at sliderPosition.x=0;
///
public void initializeBounds()
{
- this.bounds.X +=this.sliderInformation.xPos;
- this.bounds.Y +=this.sliderInformation.yPos;
+ this.bounds.X +=this.sliderInformation.xPos*(int)scale;
+ this.bounds.Y +=this.sliderInformation.yPos*(int)scale;
}
///
@@ -329,8 +366,7 @@ namespace StardustCore.UIUtilities.MenuComponents
///
public void movementOffset(int x, int y)
{
- this.sliderInformation.movementOffset(x, y);
- offsetBounds();
+ offset(x, y);
}
///
@@ -381,16 +417,14 @@ namespace StardustCore.UIUtilities.MenuComponents
{
if (this.containsPoint(x, y))
{
- int xPos = x - this.sliderBar.bounds.X;
- int yPos = y - this.sliderBar.bounds.Y;
- this.movementOffset(xPos, yPos);
+ this.movementOffset(x, y);
}
}
///
- /// Draws the slider.
+ /// D raws the slider.
///
///
///
@@ -428,7 +462,7 @@ namespace StardustCore.UIUtilities.MenuComponents
if (string.IsNullOrEmpty(this.label))
return;
- b.DrawString(Game1.smallFont, this.label+this.sliderInformation.getLabelInformation(this.getLabelXYPos), new Vector2((float)(this.bounds.X + this.bounds.Width+offset.X+this.sliderInformation.xPos), (float)this.bounds.Y + ((float)(this.bounds.Height / 2) - Game1.smallFont.MeasureString(this.label).Y / 2f)+offset.X+this.sliderInformation.yPos), textColor);
+ b.DrawString(Game1.smallFont, this.label+this.sliderInformation.getLabelInformation(this.getLabelXYPos), new Vector2((float)((this.bounds.X + this.bounds.Width+offset.X)*this.scale), (float)this.bounds.Y + ((float)(this.bounds.Height / 2) - Game1.smallFont.MeasureString(this.label).Y / 2f)+offset.X+this.sliderInformation.yPos), textColor);
}
diff --git a/GeneralMods/Vocalization/Vocalization/Content/Graphics/SliderButton.png b/GeneralMods/Vocalization/Vocalization/Content/Graphics/SliderButton.png
index e78ef468..3edbb849 100644
Binary files a/GeneralMods/Vocalization/Vocalization/Content/Graphics/SliderButton.png and b/GeneralMods/Vocalization/Vocalization/Content/Graphics/SliderButton.png differ
diff --git a/GeneralMods/Vocalization/Vocalization/Framework/Menus/VocalizationMenu.cs b/GeneralMods/Vocalization/Vocalization/Framework/Menus/VocalizationMenu.cs
index e463bb95..60a534bf 100644
--- a/GeneralMods/Vocalization/Vocalization/Framework/Menus/VocalizationMenu.cs
+++ b/GeneralMods/Vocalization/Vocalization/Framework/Menus/VocalizationMenu.cs
@@ -30,10 +30,10 @@ namespace Vocalization.Framework.Menus
public void setUpButtons()
{
Texture2DExtended buttonTexture = new Texture2DExtended(Vocalization.ModHelper, Vocalization.Manifest, Path.Combine("Content", "Graphics", "SliderButton.png"));
- Button bar = new Button(new Rectangle(this.xPositionOnScreen + 100, this.yPositionOnScreen + 220, 100, 20), new Texture2DExtended(Vocalization.ModHelper, Vocalization.Manifest, Path.Combine("Content", "Graphics", "SliderBar.png")),new Rectangle(0,0,100,10),2f);
+ Button bar = new Button(new Rectangle(this.xPositionOnScreen + 100, this.yPositionOnScreen + 220, 200, 40), new Texture2DExtended(Vocalization.ModHelper, Vocalization.Manifest, Path.Combine("Content", "Graphics", "SliderBar.png")),new Rectangle(0,0,100,10),2f);
//Texture2DExtended barTexture = new Texture2DExtended(Vocalization.ModHelper, Vocalization.Manifest, Path.Combine("Content", "Graphics", "SliderBar.png"));
- Rectangle sourceRect = new Rectangle(0, 0, 8, 16);
- this.sliderButton = new SliderButton("Slider", "Volume", new Rectangle(this.xPositionOnScreen+100, this.yPositionOnScreen+220, 8, 16), buttonTexture, bar, sourceRect, 2f, new SliderInformation(SliderStyle.Horizontal, 100, 1), new StardustCore.Animations.Animation(sourceRect), Color.White, Color.Black, new StardustCore.UIUtilities.MenuComponents.Delegates.Functionality.ButtonFunctionality(null, null, null), false, null, true);
+ Rectangle sourceRect = new Rectangle(0, 0, 4, 16);
+ this.sliderButton = new SliderButton("Slider", "Volume", new Rectangle(this.xPositionOnScreen+100, this.yPositionOnScreen+220, 4, 16), buttonTexture, bar, sourceRect, 2f, new SliderInformation(SliderStyle.Horizontal, 100, 1), new StardustCore.Animations.Animation(sourceRect), Color.White, Color.Black, new StardustCore.UIUtilities.MenuComponents.Delegates.Functionality.ButtonFunctionality(null, null, null), false, null, true);
}
@@ -57,6 +57,7 @@ namespace Vocalization.Framework.Menus
public override void draw(SpriteBatch b)
{
+ //INCLUDE A COLOR FOR THE MENU!!!!!
this.drawDialogueBoxBackground(this.xPositionOnScreen,this.yPositionOnScreen,this.width,this.height);
sliderButton.draw(b,Color.White,Vector2.Zero,0.5f);