Ripper Bars and Stealth Bar scale with UI and can now be properly moused over

This commit is contained in:
termigator1359 authored and Cameron Ewell committed 2020-12-12 02:13:42 -05:00
1 parent ce92919714
commit 0b7807c630
2 files changed
+8 -6

No files matched your search

+2 -2
View File
@@ -175,8 +175,8 @@ namespace CalamityMod.UI
{
float uiScale = Main.UIScale;
Rectangle mouse = new Rectangle((int)Main.MouseScreen.X, (int)Main.MouseScreen.Y, 8, 8);
Rectangle rageBar = new Rectangle((int)rageDrawPos.X, (int)rageDrawPos.Y, (int)rageBarSize.X, (int)rageBarSize.Y);
Rectangle adrenBar = new Rectangle((int)adrenDrawPos.X, (int)adrenDrawPos.Y, (int)adrenBarSize.X, (int)adrenBarSize.Y);
Rectangle rageBar = Utils.CenteredRectangle(rageDrawPos, rageBarSize * uiScale);
Rectangle adrenBar = Utils.CenteredRectangle(adrenDrawPos, adrenBarSize * uiScale);
bool rageHover = mouse.Intersects(rageBar);
bool adrenHover = mouse.Intersects(adrenBar);
+6 -4
View File
@@ -49,8 +49,11 @@ namespace CalamityMod.UI
Rectangle barRectangle = new Rectangle(0, 0, (int)(barTexture.Width * completionRatio), barTexture.Width);
bool full = modPlayer.rogueStealth >= modPlayer.rogueStealthMax;
spriteBatch.Draw(full ? fullBarTexture : barTexture, DrawPosition, barRectangle, Color.White * modPlayer.stealthUIAlpha, 0f, indicatorTexture.Size() * 0.5f, uiScale, SpriteEffects.None, 0);
if (new Rectangle((int)(DrawPosition.X + Main.screenPosition.X - player.width / 2), (int)(DrawPosition.Y + Main.screenPosition.Y), barTexture.Width, barTexture.Height).Intersects(
new Rectangle((int)Main.MouseWorld.X, (int)Main.MouseWorld.Y, 8, 8)))
Rectangle mouse = new Rectangle((int)Main.MouseScreen.X, (int)Main.MouseScreen.Y, 8, 8);
Rectangle stealthBar = Utils.CenteredRectangle(DrawPosition, barTexture.Size() * uiScale);
if (stealthBar.Intersects(mouse))
{
if (modPlayer.rogueStealthMax > 0f && modPlayer.stealthUIAlpha >= 0.5f)
{
@@ -64,8 +67,7 @@ namespace CalamityMod.UI
}
if (!CalamityConfig.Instance.MeterPosLock)
{
if (new Rectangle((int)(DrawPosition.X + Main.screenPosition.X - 26), (int)(DrawPosition.Y + Main.screenPosition.Y - 9), 52, 18).Intersects(
new Rectangle((int)Main.MouseWorld.X, (int)Main.MouseWorld.Y, 8, 8)))
if (stealthBar.Intersects(mouse))
{
if (Mouse.GetState().LeftButton == ButtonState.Pressed)
{