Functioning state before changing to using render targets
This commit is contained in:
parent
9da8233eda
commit
44b2c74ff5
@ -688,3 +688,15 @@
|
||||
/processorParam:TextureFormat=Color
|
||||
/build:RhythmBullet.png
|
||||
|
||||
#begin loading_ring.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:loading_ring.png
|
||||
|
||||
|
BIN
RhythmBullet/Content/loading_ring.png
Normal file
BIN
RhythmBullet/Content/loading_ring.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 91 KiB |
@ -65,7 +65,10 @@ namespace RhythmBullet
|
||||
previousScreen = value;
|
||||
Screen.Hide();
|
||||
}
|
||||
|
||||
currentScreen = value;
|
||||
currentScreen.ScreenSize.Width = graphics.PreferredBackBufferWidth;
|
||||
currentScreen.ScreenSize.Height = graphics.PreferredBackBufferHeight;
|
||||
Screen.Show();
|
||||
}
|
||||
}
|
||||
@ -94,7 +97,7 @@ namespace RhythmBullet
|
||||
// Create a new SpriteBatch, which can be used to draw textures.
|
||||
spriteBatch = new SpriteBatch(GraphicsDevice);
|
||||
QueueContent();
|
||||
Screen = new LoadingScreen(Content.Load<Texture2D>("RhythmBullet"), 0.5f, new Rectangle(0, 0, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight));
|
||||
Screen = new LoadingScreen(Content.Load<Texture2D>("RhythmBullet"), 0.7f, new Rectangle(0, 0, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -130,7 +133,7 @@ namespace RhythmBullet
|
||||
case ScreenState.ExitTransition:
|
||||
if (Screen.ExitingTransition(gameTime.ElapsedGameTime.TotalSeconds, Assets.Done, ref BackgroundColor))
|
||||
{
|
||||
Screen = previousScreen != null ? previousScreen : new MainScreen(graphics.GraphicsDevice, BackgroundColor);
|
||||
Screen = previousScreen != null ? previousScreen : new MainScreen(graphics.GraphicsDevice, BackgroundColor, Assets);
|
||||
}
|
||||
break;
|
||||
case ScreenState.Normal:
|
||||
@ -166,7 +169,7 @@ namespace RhythmBullet
|
||||
Assets.UnloadAll();
|
||||
QueueContent();
|
||||
Screen.AssetLoadStateChange(true);
|
||||
Screen = new LoadingScreen(Content.Load<Texture2D>("loading_ring"), 0.4f, new Rectangle(0, 0, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight));
|
||||
Screen = new LoadingScreen(Content.Load<Texture2D>("loading_ring"), 0.3f, new Rectangle(0, 0, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight), true);
|
||||
}
|
||||
|
||||
private void PostResize()
|
||||
|
@ -2,6 +2,7 @@
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using RhythmBullet.Zer01HD.Game.Screens.Transitions;
|
||||
using RhythmBullet.Zer01HD.UI;
|
||||
using RhythmBullet.Zer01HD.Utilities.ContentSystem;
|
||||
using RhythmBullet.Zer01HD.Utilities.UI;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -13,11 +14,26 @@ namespace RhythmBullet.Zer01HD.Game.Screens
|
||||
{
|
||||
class MainScreen : Screen
|
||||
{
|
||||
Texture2D background;
|
||||
FadeInTransition fadeInTransition;
|
||||
|
||||
public MainScreen(GraphicsDevice graphicsDevice, Color transitionFromColor) : base(true)
|
||||
public MainScreen(GraphicsDevice graphicsDevice, Color transitionFromColor, ContentSystem assets) : base(true)
|
||||
{
|
||||
fadeInTransition = new FadeInTransition(graphicsDevice, transitionFromColor, ScreenSize);
|
||||
fadeInTransition = new FadeInTransition(graphicsDevice, transitionFromColor);
|
||||
background = assets.Get<Texture2D>("backgrounds/mainBG");
|
||||
}
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
fadeInTransition.Init(ScreenSize);
|
||||
base.Show();
|
||||
}
|
||||
|
||||
public override void Draw(SpriteBatch spriteBatch)
|
||||
{
|
||||
spriteBatch.Draw(background, ScreenSize, Color.White);
|
||||
fadeInTransition.Draw(spriteBatch);
|
||||
base.Draw(spriteBatch);
|
||||
}
|
||||
|
||||
public override void EnteringTransition(double delta, bool assetsLoaded, ref Color backgroundColor)
|
||||
|
@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics;
|
||||
using RhythmBullet.Zer01HD.Utilities.UI;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@ -11,36 +12,38 @@ namespace RhythmBullet.Zer01HD.Game.Screens.Transitions
|
||||
{
|
||||
internal class FadeInTransition : IDisposable
|
||||
{
|
||||
private const float RATE = 0.3f;
|
||||
public readonly Texture2D curtain;
|
||||
Rectangle curtainSize;
|
||||
Color color;
|
||||
public Rectangle curtainSize;
|
||||
private Color color;
|
||||
private float progR, progG, progB, progA;
|
||||
private float rR, rG, rB, rA;
|
||||
private bool recorded;
|
||||
|
||||
internal FadeInTransition(GraphicsDevice graphicsDevice, Color startColor, Vector2 dimensions)
|
||||
private float rR, rG, rB, rA;
|
||||
internal FadeInTransition(GraphicsDevice graphicsDevice, Color startColor)
|
||||
{
|
||||
curtain = new Texture2D(graphicsDevice, 1, 1);
|
||||
curtain.SetData(new[] { startColor });
|
||||
curtainSize.Width = (int)dimensions.X;
|
||||
curtainSize.Height = (int)dimensions.Y;
|
||||
curtain.SetData(new[] { Color.White });
|
||||
|
||||
color = startColor;
|
||||
}
|
||||
|
||||
internal void Init(Rectangle dimensions)
|
||||
{
|
||||
curtainSize = dimensions;
|
||||
rR = (0 - color.R) / RATE;
|
||||
rG = (0 - color.G) / RATE;
|
||||
rB = (0 - color.B) / RATE;
|
||||
rA = (0 - color.A) / RATE;
|
||||
|
||||
progA = color.A;
|
||||
progR = color.R;
|
||||
progG = color.G;
|
||||
progB = color.B;
|
||||
}
|
||||
|
||||
internal bool Fade(float deltaf)
|
||||
{
|
||||
if (progR > 0 || progG > 0 || progB > 0)
|
||||
{
|
||||
if (!recorded)
|
||||
{
|
||||
rR = (0 - color.R) / 1f;
|
||||
rG = (0 - color.G) / 1f;
|
||||
rB = (0 - color.B) / 1f;
|
||||
rA = (0 - color.A) / 1f;
|
||||
recorded = true;
|
||||
}
|
||||
|
||||
progR += rR * deltaf;
|
||||
progR = Math.Max(progR, 0);
|
||||
progG += rG * deltaf;
|
||||
@ -55,7 +58,7 @@ namespace RhythmBullet.Zer01HD.Game.Screens.Transitions
|
||||
color.A = (byte)progA;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
internal void Draw(SpriteBatch batch)
|
||||
|
13
RhythmBullet/Zer01HD/Utilities/UI/Interactive/BasicButton.cs
Normal file
13
RhythmBullet/Zer01HD/Utilities/UI/Interactive/BasicButton.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RhythmBullet.Zer01HD.Utilities.UI.Interactive
|
||||
{
|
||||
class BasicButton
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -9,6 +9,8 @@ namespace RhythmBullet.Zer01HD.Game
|
||||
{
|
||||
class LoadingScreen : Screen
|
||||
{
|
||||
private const float ENTER_RATE = 2f;
|
||||
private const float EXIT_RATE = 1f;
|
||||
readonly Texture2D texture;
|
||||
Color color;
|
||||
Rectangle textureBounds;
|
||||
@ -53,9 +55,9 @@ namespace RhythmBullet.Zer01HD.Game
|
||||
{
|
||||
if (!recorded)
|
||||
{
|
||||
rR = (Color.White.R - BGColor.R) / 2f;
|
||||
rG = (Color.White.G - BGColor.G) / 2f;
|
||||
rB = (Color.White.B - BGColor.B) / 2f;
|
||||
rR = (Color.White.R - BGColor.R) / ENTER_RATE;
|
||||
rG = (Color.White.G - BGColor.G) / ENTER_RATE;
|
||||
rB = (Color.White.B - BGColor.B) / ENTER_RATE;
|
||||
recorded = true;
|
||||
}
|
||||
progR += rR * deltaf;
|
||||
@ -85,7 +87,7 @@ namespace RhythmBullet.Zer01HD.Game
|
||||
}
|
||||
if (progC > 0)
|
||||
{
|
||||
float rate = deltaf * 255 / 1f;
|
||||
float rate = deltaf * 255 / EXIT_RATE;
|
||||
progC -= rate;
|
||||
progC = Math.Max(progC, 0);
|
||||
color.R = (byte)progC;
|
||||
|
@ -12,10 +12,7 @@ namespace RhythmBullet.Zer01HD.Utilities.UI
|
||||
|
||||
public class Screen
|
||||
{
|
||||
public virtual Vector2 ScreenSize
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
public Rectangle ScreenSize;
|
||||
|
||||
ScreenState state;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user