Added a WIP "Calamity Style" main menu (thanks Nycro)
This commit is contained in:
1 parent
15f1caddf7
commit
9d1e35eab0
5 files changed
+68
No files matched your search
Binary file not shown.
|
After Width: | Height: | Size: 118 B |
@@ -0,0 +1,30 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.MainMenu
|
||||
{
|
||||
public class CalamityMainMenu : ModMenu
|
||||
{
|
||||
public override string DisplayName => "Calamity Style";
|
||||
|
||||
public override Asset<Texture2D> Logo => ModContent.Request<Texture2D>("CalamityMod/MainMenu/Logo");
|
||||
public override Asset<Texture2D> SunTexture => ModContent.Request<Texture2D>("CalamityMod/Backgrounds/BlankPixel");
|
||||
public override Asset<Texture2D> MoonTexture => ModContent.Request<Texture2D>("CalamityMod/Backgrounds/BlankPixel");
|
||||
|
||||
public override ModSurfaceBackgroundStyle MenuBackgroundStyle => ModContent.GetInstance<NullSurfaceBackground>();
|
||||
|
||||
// Before drawing the logo, draw the entire Calamity background. This way, the typical parallax background is skipped entirely.
|
||||
public override bool PreDrawLogo(SpriteBatch spriteBatch, ref Vector2 logoDrawCenter, ref float logoRotation, ref float logoScale, ref Color drawColor)
|
||||
{
|
||||
Texture2D texture = ModContent.Request<Texture2D>("CalamityMod/MainMenu/MenuBackground").Value;
|
||||
spriteBatch.Draw(texture, new Vector2(0f, 0f), null, Color.White, 0f, Vector2.Zero, (float)Main.screenWidth / texture.Width, SpriteEffects.None, 0f);
|
||||
|
||||
// TODO -- Draw plenty of cinders!
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 149 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.1 MiB |
@@ -0,0 +1,38 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user