Restructured Solution Layout
Moved several enums and helper classes into the QURO library for flexibility and potential reuse. Also solved desync in animations by making AnimatedSprites reset their timer every time a new animation is loaded.
This commit is contained in:
@@ -56,10 +56,14 @@
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\AnimationLibrary\QURO.AnimationLibrary.csproj">
|
||||
<ProjectReference Include="..\QURO.AnimationLibrary\QURO.AnimationLibrary.csproj">
|
||||
<Project>{69dadc27-fbeb-4625-9212-6eb5bed5102a}</Project>
|
||||
<Name>QURO.AnimationLibrary</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\QURO\QURO.csproj">
|
||||
<Project>{4581e0c8-b14a-454d-9a7b-52d37535e7e9}</Project>
|
||||
<Name>QURO</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Content\boardMap.xml">
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
using QURO;
|
||||
using QURO.AnimationLibrary;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Content.Pipeline.Serialization.Intermediate;
|
||||
@@ -26,15 +27,15 @@ namespace AnimationGenerator
|
||||
|
||||
Frame[] soloCursor_pulse_frames = new Frame[]
|
||||
{
|
||||
new Frame(loadedFrames["soloCursor"], 20f / 60f),
|
||||
new Frame(loadedFrames["soloCursor_pulse"], 20f / 60f),
|
||||
new Frame(loadedFrames["soloCursor"], FrameTime.FramesToSeconds(20)),
|
||||
new Frame(loadedFrames["soloCursor_pulse"], FrameTime.FramesToSeconds(20)),
|
||||
};
|
||||
output.Add(new Animation("soloCursor_pulse", soloCursor_pulse_frames, true));
|
||||
|
||||
Frame[] twinCursor_pulse_frames = new Frame[]
|
||||
{
|
||||
new Frame(loadedFrames["twinCursor"], 20f / 60f),
|
||||
new Frame(loadedFrames["twinCursor_pulse"], 20f / 60f),
|
||||
new Frame(loadedFrames["twinCursor"], FrameTime.FramesToSeconds(20)),
|
||||
new Frame(loadedFrames["twinCursor_pulse"], FrameTime.FramesToSeconds(20)),
|
||||
};
|
||||
output.Add(new Animation("twinCursor_pulse", twinCursor_pulse_frames, true));
|
||||
|
||||
@@ -73,12 +74,12 @@ namespace AnimationGenerator
|
||||
|
||||
Frame[] block_bounce_frames = new Frame[]
|
||||
{
|
||||
new Frame(loadedFrames["block0_bounce2"], 1f / 60f),
|
||||
new Frame(loadedFrames["block0"], 1f / 60f),
|
||||
new Frame(loadedFrames["block0_squish"], 1f / 60f),
|
||||
new Frame(loadedFrames["block0"], 1f / 60f),
|
||||
new Frame(loadedFrames["block0_bounce1"], 2f / 60f),
|
||||
new Frame(loadedFrames["block0"], 1f / 60f),
|
||||
new Frame(loadedFrames["block0_bounce2"], FrameTime.FramesToSeconds(1)),
|
||||
new Frame(loadedFrames["block0"], FrameTime.FramesToSeconds(1)),
|
||||
new Frame(loadedFrames["block0_squish"], FrameTime.FramesToSeconds(1)),
|
||||
new Frame(loadedFrames["block0"], FrameTime.FramesToSeconds(1)),
|
||||
new Frame(loadedFrames["block0_bounce1"], FrameTime.FramesToSeconds(2)),
|
||||
new Frame(loadedFrames["block0"], FrameTime.FramesToSeconds(0)),
|
||||
};
|
||||
output.Add(new Animation("block_bounce", block_bounce_frames, false));
|
||||
|
||||
|
||||
+7
-1
@@ -5,10 +5,12 @@ VisualStudioVersion = 15.0.27703.2047
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PuzzSwap", "PuzzSwap\PuzzSwap.csproj", "{CD753795-0CB4-4F05-A0E7-2D2EFC968D82}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QURO.AnimationLibrary", "AnimationLibrary\QURO.AnimationLibrary.csproj", "{69DADC27-FBEB-4625-9212-6EB5BED5102A}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QURO.AnimationLibrary", "QURO.AnimationLibrary\QURO.AnimationLibrary.csproj", "{69DADC27-FBEB-4625-9212-6EB5BED5102A}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AnimationGenerator", "AnimationGenerator\AnimationGenerator.csproj", "{B1938BD7-A474-427F-91F1-F8A1875B28CE}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QURO", "QURO\QURO.csproj", "{4581E0C8-B14A-454D-9A7B-52D37535E7E9}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -27,6 +29,10 @@ Global
|
||||
{B1938BD7-A474-427F-91F1-F8A1875B28CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B1938BD7-A474-427F-91F1-F8A1875B28CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B1938BD7-A474-427F-91F1-F8A1875B28CE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4581E0C8-B14A-454D-9A7B-52D37535E7E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4581E0C8-B14A-454D-9A7B-52D37535E7E9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4581E0C8-B14A-454D-9A7B-52D37535E7E9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4581E0C8-B14A-454D-9A7B-52D37535E7E9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using QURO;
|
||||
|
||||
namespace QURO.AnimationLibrary
|
||||
{
|
||||
@@ -13,13 +14,16 @@ namespace QURO.AnimationLibrary
|
||||
set
|
||||
{
|
||||
currentAnimation = value;
|
||||
finishedPlaying = false;
|
||||
CurrentFrameIndex = 0;
|
||||
timer = CurrentFrame.Delay;
|
||||
}
|
||||
}
|
||||
public int CurrentFrameIndex { get; set; }
|
||||
public Frame CurrentFrame => CurrentAnimation.Frames[CurrentFrameIndex];
|
||||
|
||||
private float timer;
|
||||
private bool finishedPlaying;
|
||||
|
||||
public AnimatedSprite() { }
|
||||
|
||||
@@ -28,17 +32,19 @@ namespace QURO.AnimationLibrary
|
||||
SpriteSheet = spriteSheet;
|
||||
CurrentAnimation = startingAnimation;
|
||||
timer = CurrentFrame.Delay;
|
||||
finishedPlaying = false;
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
CurrentFrameIndex = 0;
|
||||
finishedPlaying = false;
|
||||
timer = CurrentFrame.Delay;
|
||||
}
|
||||
|
||||
public void Update(GameTime gameTime)
|
||||
{
|
||||
if (!CurrentAnimation.IsStillImage)
|
||||
if (!CurrentAnimation.IsStillImage && !finishedPlaying)
|
||||
{
|
||||
if (timer <= 0)
|
||||
{
|
||||
@@ -52,6 +58,10 @@ namespace QURO.AnimationLibrary
|
||||
{
|
||||
CurrentFrameIndex = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
finishedPlaying = true;
|
||||
}
|
||||
}
|
||||
timer = CurrentFrame.Delay;
|
||||
}
|
||||
+6
@@ -51,5 +51,11 @@
|
||||
<Compile Include="Frame.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\QURO\QURO.csproj">
|
||||
<Project>{4581e0c8-b14a-454d-9a7b-52d37535e7e9}</Project>
|
||||
<Name>QURO</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
Reference in New Issue
Block a user