39 lines
1.5 KiB
C#
39 lines
1.5 KiB
C#
using Microsoft.Xna.Framework.Graphics;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.MainMenu
|
|
{
|
|
// Thanks to Nycro#0001 <@!262663471189983242> for this null background which cleanly ignores vanilla's parallax mechanics
|
|
internal class NullSurfaceBackground : ModSurfaceBackgroundStyle
|
|
{
|
|
public override void ModifyFarFades(float[] fades, float transitionSpeed)
|
|
{
|
|
for (int i = 0; i < fades.Length; i++)
|
|
{
|
|
if (i == Slot)
|
|
{
|
|
fades[i] += transitionSpeed;
|
|
if (fades[i] > 1f)
|
|
{
|
|
fades[i] = 1f;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
fades[i] -= transitionSpeed;
|
|
if (fades[i] < 0f)
|
|
{
|
|
fades[i] = 0f;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private static readonly string TexPath = "CalamityMod/Backgrounds/BlankPixel";
|
|
public override int ChooseCloseTexture(ref float scale, ref double parallax, ref float a, ref float b) => BackgroundTextureLoader.GetBackgroundSlot(TexPath);
|
|
public override int ChooseFarTexture() => BackgroundTextureLoader.GetBackgroundSlot(TexPath);
|
|
public override int ChooseMiddleTexture() => BackgroundTextureLoader.GetBackgroundSlot(TexPath);
|
|
public override bool PreDrawCloseBackground(SpriteBatch spriteBatch) => false;
|
|
}
|
|
}
|