Permalink
Browse files

Updated the Windows Project to use the Unified Content Manager

Added Windows/Media/Video.cs
Changed the SpriteBatcher.cs to use Constants for the Array and Batch queue Sizes to make it easier to tweak
Added a change to the Matrix class to return a static array for the ToFixedArray method rather than creating a new one each time. Needs testing on all platforms to make sure it doesn't break anything
  • Loading branch information...
1 parent 6fde740 commit bdbda4c69622a322b68ed4639128855dd5104597 @dellis1972 dellis1972 committed Sep 20, 2011
@@ -1,36 +1,10 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual C# Express 2010
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{2362889B-880E-4EBA-AA76-3E1D27158F55}"
- ProjectSection(SolutionItems) = postProject
- EndProjectSection
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetRumble", "Samples\Windows\NetRumble\NetRumble.csproj", "{36CDED1D-BE90-4C12-BC0A-F923AB92B98D}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Peer2PeerSample", "Samples\Windows\Peer2PeerSample\Peer2PeerSample.csproj", "{5FAEAF4E-75EC-41E4-8D01-EF1CBB9EEAB6}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoGame.Samples.Draw2D.Windows", "Samples\Windows\Draw2D\MonoGame.Samples.Draw2D.Windows.csproj", "{8CFEF1FE-9E32-43EB-A730-EB3AACDC77B1}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "StarterKits", "StarterKits", "{E186B87F-A589-42E5-9106-484545FCA486}"
- ProjectSection(SolutionItems) = postProject
- EndProjectSection
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Cards", "Cards", "{B117412F-9538-4CE0-B8F1-B279561AF17E}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlackJack.Windows", "StarterKits\Windows\Cards\BlackJack.Windows.csproj", "{E31D6E96-3539-4EB7-9529-34A59EF03DDA}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CardsFramework.Windows", "StarterKits\Windows\Cards\CardsFramework.Windows.csproj", "{6DE82385-D762-4275-9185-F42995282478}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoGame.Framework.Windows", "MonoGame.Framework\MonoGame.Framework.Windows.csproj", "{7DE47032-A904-4C29-BD22-2D235E8D91BA}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Peer2PeerMasterServer", "Samples\Peer2PeerMasterServer\Peer2PeerMasterServer.csproj", "{8C393C18-2351-44DD-9FF9-B79691A9A5F5}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetworkStateManagement", "Samples\Windows\NetworkStateManagement\NetworkStateManagement.csproj", "{D0E05092-60B2-47FF-B924-D5CDED0C0DD1}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lidgren.Network.Windows", "ThirdParty\Lidgren.Network\Lidgren.Network.Windows.csproj", "{AE483C29-042E-4226-BA52-D247CE7676DA}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetworkPrediction", "Samples\Windows\NetworkPrediction\NetworkPrediction.csproj", "{A0EBAD2F-0DB1-4C42-B855-5B9BBDDD3512}"
-EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -41,64 +15,6 @@ Global
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {36CDED1D-BE90-4C12-BC0A-F923AB92B98D}.Debug|Any CPU.ActiveCfg = Debug|x86
- {36CDED1D-BE90-4C12-BC0A-F923AB92B98D}.Debug|Any CPU.Build.0 = Debug|x86
- {36CDED1D-BE90-4C12-BC0A-F923AB92B98D}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
- {36CDED1D-BE90-4C12-BC0A-F923AB92B98D}.Debug|Mixed Platforms.Build.0 = Debug|x86
- {36CDED1D-BE90-4C12-BC0A-F923AB92B98D}.Debug|x86.ActiveCfg = Debug|x86
- {36CDED1D-BE90-4C12-BC0A-F923AB92B98D}.Debug|x86.Build.0 = Debug|x86
- {36CDED1D-BE90-4C12-BC0A-F923AB92B98D}.Release|Any CPU.ActiveCfg = Release|x86
- {36CDED1D-BE90-4C12-BC0A-F923AB92B98D}.Release|Any CPU.Build.0 = Release|x86
- {36CDED1D-BE90-4C12-BC0A-F923AB92B98D}.Release|Mixed Platforms.ActiveCfg = Release|x86
- {36CDED1D-BE90-4C12-BC0A-F923AB92B98D}.Release|Mixed Platforms.Build.0 = Release|x86
- {36CDED1D-BE90-4C12-BC0A-F923AB92B98D}.Release|x86.ActiveCfg = Release|x86
- {36CDED1D-BE90-4C12-BC0A-F923AB92B98D}.Release|x86.Build.0 = Release|x86
- {5FAEAF4E-75EC-41E4-8D01-EF1CBB9EEAB6}.Debug|Any CPU.ActiveCfg = Debug|x86
- {5FAEAF4E-75EC-41E4-8D01-EF1CBB9EEAB6}.Debug|Any CPU.Build.0 = Debug|x86
- {5FAEAF4E-75EC-41E4-8D01-EF1CBB9EEAB6}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
- {5FAEAF4E-75EC-41E4-8D01-EF1CBB9EEAB6}.Debug|Mixed Platforms.Build.0 = Debug|x86
- {5FAEAF4E-75EC-41E4-8D01-EF1CBB9EEAB6}.Debug|x86.ActiveCfg = Debug|x86
- {5FAEAF4E-75EC-41E4-8D01-EF1CBB9EEAB6}.Debug|x86.Build.0 = Debug|x86
- {5FAEAF4E-75EC-41E4-8D01-EF1CBB9EEAB6}.Release|Any CPU.ActiveCfg = Release|x86
- {5FAEAF4E-75EC-41E4-8D01-EF1CBB9EEAB6}.Release|Any CPU.Build.0 = Release|x86
- {5FAEAF4E-75EC-41E4-8D01-EF1CBB9EEAB6}.Release|Mixed Platforms.ActiveCfg = Release|x86
- {5FAEAF4E-75EC-41E4-8D01-EF1CBB9EEAB6}.Release|Mixed Platforms.Build.0 = Release|x86
- {5FAEAF4E-75EC-41E4-8D01-EF1CBB9EEAB6}.Release|x86.ActiveCfg = Release|x86
- {5FAEAF4E-75EC-41E4-8D01-EF1CBB9EEAB6}.Release|x86.Build.0 = Release|x86
- {8CFEF1FE-9E32-43EB-A730-EB3AACDC77B1}.Debug|Any CPU.ActiveCfg = Debug|x86
- {8CFEF1FE-9E32-43EB-A730-EB3AACDC77B1}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
- {8CFEF1FE-9E32-43EB-A730-EB3AACDC77B1}.Debug|Mixed Platforms.Build.0 = Debug|x86
- {8CFEF1FE-9E32-43EB-A730-EB3AACDC77B1}.Debug|x86.ActiveCfg = Debug|x86
- {8CFEF1FE-9E32-43EB-A730-EB3AACDC77B1}.Debug|x86.Build.0 = Debug|x86
- {8CFEF1FE-9E32-43EB-A730-EB3AACDC77B1}.Release|Any CPU.ActiveCfg = Release|x86
- {8CFEF1FE-9E32-43EB-A730-EB3AACDC77B1}.Release|Mixed Platforms.ActiveCfg = Release|x86
- {8CFEF1FE-9E32-43EB-A730-EB3AACDC77B1}.Release|Mixed Platforms.Build.0 = Release|x86
- {8CFEF1FE-9E32-43EB-A730-EB3AACDC77B1}.Release|x86.ActiveCfg = Release|x86
- {8CFEF1FE-9E32-43EB-A730-EB3AACDC77B1}.Release|x86.Build.0 = Release|x86
- {E31D6E96-3539-4EB7-9529-34A59EF03DDA}.Debug|Any CPU.ActiveCfg = Debug|x86
- {E31D6E96-3539-4EB7-9529-34A59EF03DDA}.Debug|Any CPU.Build.0 = Debug|x86
- {E31D6E96-3539-4EB7-9529-34A59EF03DDA}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
- {E31D6E96-3539-4EB7-9529-34A59EF03DDA}.Debug|Mixed Platforms.Build.0 = Debug|x86
- {E31D6E96-3539-4EB7-9529-34A59EF03DDA}.Debug|x86.ActiveCfg = Debug|x86
- {E31D6E96-3539-4EB7-9529-34A59EF03DDA}.Debug|x86.Build.0 = Debug|x86
- {E31D6E96-3539-4EB7-9529-34A59EF03DDA}.Release|Any CPU.ActiveCfg = Release|x86
- {E31D6E96-3539-4EB7-9529-34A59EF03DDA}.Release|Any CPU.Build.0 = Release|x86
- {E31D6E96-3539-4EB7-9529-34A59EF03DDA}.Release|Mixed Platforms.ActiveCfg = Release|x86
- {E31D6E96-3539-4EB7-9529-34A59EF03DDA}.Release|Mixed Platforms.Build.0 = Release|x86
- {E31D6E96-3539-4EB7-9529-34A59EF03DDA}.Release|x86.ActiveCfg = Release|x86
- {E31D6E96-3539-4EB7-9529-34A59EF03DDA}.Release|x86.Build.0 = Release|x86
- {6DE82385-D762-4275-9185-F42995282478}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {6DE82385-D762-4275-9185-F42995282478}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {6DE82385-D762-4275-9185-F42995282478}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {6DE82385-D762-4275-9185-F42995282478}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
- {6DE82385-D762-4275-9185-F42995282478}.Debug|x86.ActiveCfg = Debug|Any CPU
- {6DE82385-D762-4275-9185-F42995282478}.Debug|x86.Build.0 = Debug|Any CPU
- {6DE82385-D762-4275-9185-F42995282478}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {6DE82385-D762-4275-9185-F42995282478}.Release|Any CPU.Build.0 = Release|Any CPU
- {6DE82385-D762-4275-9185-F42995282478}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
- {6DE82385-D762-4275-9185-F42995282478}.Release|Mixed Platforms.Build.0 = Release|Any CPU
- {6DE82385-D762-4275-9185-F42995282478}.Release|x86.ActiveCfg = Release|Any CPU
- {6DE82385-D762-4275-9185-F42995282478}.Release|x86.Build.0 = Release|Any CPU
{7DE47032-A904-4C29-BD22-2D235E8D91BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7DE47032-A904-4C29-BD22-2D235E8D91BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7DE47032-A904-4C29-BD22-2D235E8D91BA}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
@@ -111,26 +27,6 @@ Global
{7DE47032-A904-4C29-BD22-2D235E8D91BA}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{7DE47032-A904-4C29-BD22-2D235E8D91BA}.Release|x86.ActiveCfg = Release|x86
{7DE47032-A904-4C29-BD22-2D235E8D91BA}.Release|x86.Build.0 = Release|x86
- {8C393C18-2351-44DD-9FF9-B79691A9A5F5}.Debug|Any CPU.ActiveCfg = Debug|x86
- {8C393C18-2351-44DD-9FF9-B79691A9A5F5}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
- {8C393C18-2351-44DD-9FF9-B79691A9A5F5}.Debug|Mixed Platforms.Build.0 = Debug|x86
- {8C393C18-2351-44DD-9FF9-B79691A9A5F5}.Debug|x86.ActiveCfg = Debug|x86
- {8C393C18-2351-44DD-9FF9-B79691A9A5F5}.Debug|x86.Build.0 = Debug|x86
- {8C393C18-2351-44DD-9FF9-B79691A9A5F5}.Release|Any CPU.ActiveCfg = Release|x86
- {8C393C18-2351-44DD-9FF9-B79691A9A5F5}.Release|Mixed Platforms.ActiveCfg = Release|x86
- {8C393C18-2351-44DD-9FF9-B79691A9A5F5}.Release|Mixed Platforms.Build.0 = Release|x86
- {8C393C18-2351-44DD-9FF9-B79691A9A5F5}.Release|x86.ActiveCfg = Release|x86
- {8C393C18-2351-44DD-9FF9-B79691A9A5F5}.Release|x86.Build.0 = Release|x86
- {D0E05092-60B2-47FF-B924-D5CDED0C0DD1}.Debug|Any CPU.ActiveCfg = Debug|x86
- {D0E05092-60B2-47FF-B924-D5CDED0C0DD1}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
- {D0E05092-60B2-47FF-B924-D5CDED0C0DD1}.Debug|Mixed Platforms.Build.0 = Debug|x86
- {D0E05092-60B2-47FF-B924-D5CDED0C0DD1}.Debug|x86.ActiveCfg = Debug|x86
- {D0E05092-60B2-47FF-B924-D5CDED0C0DD1}.Debug|x86.Build.0 = Debug|x86
- {D0E05092-60B2-47FF-B924-D5CDED0C0DD1}.Release|Any CPU.ActiveCfg = Release|x86
- {D0E05092-60B2-47FF-B924-D5CDED0C0DD1}.Release|Mixed Platforms.ActiveCfg = Release|x86
- {D0E05092-60B2-47FF-B924-D5CDED0C0DD1}.Release|Mixed Platforms.Build.0 = Release|x86
- {D0E05092-60B2-47FF-B924-D5CDED0C0DD1}.Release|x86.ActiveCfg = Release|x86
- {D0E05092-60B2-47FF-B924-D5CDED0C0DD1}.Release|x86.Build.0 = Release|x86
{AE483C29-042E-4226-BA52-D247CE7676DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AE483C29-042E-4226-BA52-D247CE7676DA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AE483C29-042E-4226-BA52-D247CE7676DA}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
@@ -143,16 +39,6 @@ Global
{AE483C29-042E-4226-BA52-D247CE7676DA}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{AE483C29-042E-4226-BA52-D247CE7676DA}.Release|x86.ActiveCfg = Release|Any CPU
{AE483C29-042E-4226-BA52-D247CE7676DA}.Release|x86.Build.0 = Release|Any CPU
- {A0EBAD2F-0DB1-4C42-B855-5B9BBDDD3512}.Debug|Any CPU.ActiveCfg = Debug|x86
- {A0EBAD2F-0DB1-4C42-B855-5B9BBDDD3512}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
- {A0EBAD2F-0DB1-4C42-B855-5B9BBDDD3512}.Debug|Mixed Platforms.Build.0 = Debug|x86
- {A0EBAD2F-0DB1-4C42-B855-5B9BBDDD3512}.Debug|x86.ActiveCfg = Debug|x86
- {A0EBAD2F-0DB1-4C42-B855-5B9BBDDD3512}.Debug|x86.Build.0 = Debug|x86
- {A0EBAD2F-0DB1-4C42-B855-5B9BBDDD3512}.Release|Any CPU.ActiveCfg = Release|x86
- {A0EBAD2F-0DB1-4C42-B855-5B9BBDDD3512}.Release|Mixed Platforms.ActiveCfg = Release|x86
- {A0EBAD2F-0DB1-4C42-B855-5B9BBDDD3512}.Release|Mixed Platforms.Build.0 = Release|x86
- {A0EBAD2F-0DB1-4C42-B855-5B9BBDDD3512}.Release|x86.ActiveCfg = Release|x86
- {A0EBAD2F-0DB1-4C42-B855-5B9BBDDD3512}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -48,7 +48,9 @@
namespace Microsoft.Xna.Framework.Graphics
{
internal class SpriteBatcher
- {
+ {
+ private const int InitialBatchSize = 256;
+ private const int InitialVertexArraySize = 256;
List<SpriteBatchItem> _batchItemList;
Queue<SpriteBatchItem> _freeBatchItemQueue;
VertexPosition2ColorTexture[] _vertexArray;
@@ -58,15 +60,15 @@ internal class SpriteBatcher
public SpriteBatcher ()
{
- _batchItemList = new List<SpriteBatchItem>(256);
- _freeBatchItemQueue = new Queue<SpriteBatchItem>(256);
+ _batchItemList = new List<SpriteBatchItem>(InitialBatchSize);
+ _freeBatchItemQueue = new Queue<SpriteBatchItem>(InitialBatchSize);
- _vertexArray = new VertexPosition2ColorTexture[4*256];
- _index = new ushort[6*256];
+ _vertexArray = new VertexPosition2ColorTexture[4*InitialVertexArraySize];
+ _index = new ushort[6*InitialVertexArraySize];
_vertexHandle = GCHandle.Alloc(_vertexArray,GCHandleType.Pinned);
_indexHandle = GCHandle.Alloc(_index,GCHandleType.Pinned);
- for ( int i = 0; i < 256; i++ )
+ for ( int i = 0; i < InitialVertexArraySize; i++ )
{
_index[i*6+0] = (ushort)(i*4);
_index[i*6+1] = (ushort)(i*4+1);
@@ -167,8 +169,8 @@ void ExpandVertexArray( int batchSize )
while ( batchSize*4 > newCount )
newCount += 128;
- _vertexHandle.Free();
- _indexHandle.Free();
+ _vertexHandle.Free();
+ _indexHandle.Free();
_vertexArray = new VertexPosition2ColorTexture[4*newCount];
_index = new ushort[6*newCount];
@@ -139,17 +139,23 @@ public static Matrix Identity
get { return identity; }
}
+ // made this static so we dont create a new
+ // float array each time we use the matrix
+ private static float[] openglMatrix = { 1f, 0f, 0f, 0f,
+ 0f, 1f, 0f, 0f,
+ 0f, 0f, 1f, 0f,
+ 0f, 0f, 0f, 1f};
+
+
// required for OpenGL 2.0 projection matrix stuff
public static float[] ToFloatArray(Matrix mat)
{
- float [] matarray = {
- mat.M11, mat.M12, mat.M13, mat.M14,
- mat.M21, mat.M22, mat.M23, mat.M24,
- mat.M31, mat.M32, mat.M33, mat.M34,
- mat.M41, mat.M42, mat.M43, mat.M44
- };
- return matarray;
+ openglMatrix[0] = mat.M11; openglMatrix[1] = mat.M12; openglMatrix[2] = mat.M13; openglMatrix[3] = mat.M14;
+ openglMatrix[4] = mat.M21; openglMatrix[5] = mat.M22; openglMatrix[6] = mat.M23; openglMatrix[7] = mat.M24;
+ openglMatrix[8] = mat.M31; openglMatrix[9] = mat.M32; openglMatrix[10] = mat.M33; openglMatrix[11] = mat.M34;
+ openglMatrix[12] = mat.M41; openglMatrix[13] = mat.M42; openglMatrix[14] = mat.M43; openglMatrix[15] = mat.M44;
+ return openglMatrix;
}
public Vector3 Left
@@ -116,6 +116,7 @@
<Compile Include="Audio\SoundEffectInstance.cs" />
<Compile Include="Audio\SoundState.cs" />
<Compile Include="Audio\WaveBank.cs" />
+ <Compile Include="Content\ContentManager.cs" />
<Compile Include="Content\ContentReaders\ArrayReader.cs" />
<Compile Include="Content\ContentReaders\BooleanReader.cs" />
<Compile Include="Content\ContentReaders\ColorReader.cs" />
@@ -137,6 +138,7 @@
<Compile Include="Content\ContentReaders\Vector2Reader.cs" />
<Compile Include="Content\ContentSerializerAttribute.cs" />
<Compile Include="Content\ContentSerializerIgnoreAttribute.cs" />
+ <Compile Include="Content\LzxDecoder.cs" />
<Compile Include="GamerServices\Achievement.cs" />
<Compile Include="GamerServices\AchievementCollection.cs" />
<Compile Include="GamerServices\FriendCollection.cs" />
@@ -248,7 +250,6 @@
<Compile Include="TitleContainer.cs" />
<Compile Include="Windows\Audio\AudioLoader.cs" />
<Compile Include="Windows\Audio\Sound.cs" />
- <Compile Include="Windows\Content\ContentManager.cs" />
<Compile Include="Windows\Content\ContentReaders\SongReader.cs" />
<Compile Include="Windows\Content\ContentReaders\SoundEffectReader.cs" />
<Compile Include="Windows\Content\ContentReaders\SpriteFontReader.cs" />
@@ -271,6 +272,7 @@
<Compile Include="Windows\Graphics\Texture2D.cs" />
<Compile Include="Windows\Input\GamePad.cs" />
<Compile Include="Windows\Input\Keyboard.cs" />
+ <Compile Include="Windows\Media\Video.cs" />
<Compile Include="Windows\WindowsGameWindow.cs" />
<Compile Include="Windows\Game.cs" />
<Compile Include="BatteryChargeStatus.cs" />
@@ -123,14 +123,14 @@ public T Load<T>(string assetName)
else if ((typeof(T) == typeof(SoundEffect)))
{
assetName = SoundEffectReader.Normalize(assetName);
- }/*
+ }
else if ((typeof(T) == typeof(Video)))
{
assetName = Video.Normalize(assetName);
}
else {
throw new NotSupportedException("Format not supported");
- }*/
+ }
if (string.IsNullOrEmpty(assetName))
{
@@ -165,8 +165,8 @@ public T Load<T>(string assetName)
result = new Song(assetName);
if ((typeof(T) == typeof(SoundEffect)))
result = new SoundEffect(assetName);
- /*if ((typeof(T) == typeof(Video)))
- result = new Video(assetName);*/
+ if ((typeof(T) == typeof(Video)))
+ result = new Video(assetName);
}
else
Oops, something went wrong.

0 comments on commit bdbda4c

Please sign in to comment.