Permalink
Browse files

Merge branch 'develop3d' of https://github.com/mono/MonoGame into pac…

…ked-vector
  • Loading branch information...
2 parents 4708c39 + 093ba6b commit 73f4af56eb6b25f429995015cc994e3ab33fb56a @KonajuGames KonajuGames committed Jan 2, 2013
@@ -2,7 +2,7 @@ SetCompressor /SOLID /FINAL lzma
!define FrameworkPath "C:\Users\Dean\Desktop\MonoGame\"
!define VERSION "3.0"
-!define REVISION "0.1"
+!define REVISION "0.0"
!define INSTALLERFILENAME "MonoGame"
!define APPNAME "MonoGame"
@@ -16,16 +16,16 @@ SetCompressor /SOLID /FINAL lzma
!define MUI_UNICON "${FrameworkPath}Installers\monogame.ico"
-Name '${APPNAME} ${VERSION} (BETA)'
+Name '${APPNAME} ${VERSION}'
OutFile '${INSTALLERFILENAME}Installer-${VERSION}.exe'
InstallDir '$PROGRAMFILES\${APPNAME}\v${VERSION}'
VIProductVersion "${VERSION}.${REVISION}"
-VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "${APPNAME} for MonoDevelop"
+VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "${APPNAME} Development Tools"
VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "MonoGame"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "${VERSION}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductVersion" "${VERSION}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "${APPNAME} Installer"
-VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "© Copyright MonoGame 2012"
+VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "© Copyright MonoGame 2013"
; Request application privileges for Windows Vista
RequestExecutionLevel admin
@@ -53,7 +53,7 @@ Section "MonoGame Core Components" ;No components page, name is not important
SectionIn RO
SetOutPath $PROGRAMFILES32\MSBuild\${APPNAME}\v${VERSION}
File '..\monogame.ico'
- File /r '..\..\MonoGame.ContentPipeline\ContentProcessors\bin\Release\*.dll'
+ File /r '..\..\MonoGame.ContentPipeline\ContentProcessors\bin\x86\Release\*.dll'
File '..\..\MonoGame.ContentPipeline\*.targets'
File '..\..\ThirdParty\Libs\NAudio\*.dll'
File '..\..\ThirdParty\Libs\SharpDX\Windows\*.*'
@@ -64,7 +64,10 @@ Section "MonoGame Core Components" ;No components page, name is not important
File '..\..\ThirdParty\Libs\PVRTexLib\Windows_x86_32\Dll\PVRTexLib.dll'
File /oname=libmojoshader.dll '..\..\ThirdParty\Libs\libmojoshader_32.dll'
File '..\..\ThirdParty\Libs\lame_enc.dll'
-
+
+ SetOutPath '$PROGRAMFILES\${APPNAME}\v${VERSION}\Assemblies\Android'
+ File /nonfatal '..\..\MonoGame.Framework\bin\Android\Release\*.dll'
+ File /nonfatal ' ..\..\MonoGame.Framework\bin\Android\Release\*.xml'
SetOutPath '$PROGRAMFILES\${APPNAME}\v${VERSION}\Assemblies\WindowsGL'
File /nonfatal '..\..\MonoGame.Framework\bin\WindowsGL\Release\*.dll'
@@ -108,13 +111,19 @@ Section "MonoGame Core Components" ;No components page, name is not important
IfFileExists $WINDIR\SYSWOW64\*.* Is64bit Is32bit
Is32bit:
WriteRegStr HKLM 'SOFTWARE\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\${APPNAME}' '' '$INSTDIR\Assemblies'
+ WriteRegStr HKLM 'SOFTWARE\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\${APPNAME}' '' '$INSTDIR\Assemblies\WindowsGL'
+ WriteRegStr HKLM 'SOFTWARE\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\${APPNAME}' '' '$INSTDIR\Assemblies\Linux'
+ WriteRegStr HKLM 'SOFTWARE\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\${APPNAME}' '' '$INSTDIR\Assemblies\Android'
WriteRegStr HKLM 'SOFTWARE\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\${APPNAME}' '' '$INSTDIR\Assemblies\Windows8'
WriteRegStr HKLM 'SOFTWARE\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\${APPNAME}' '' '$INSTDIR\Assemblies\WindowsPhone\ARM'
WriteRegStr HKLM 'SOFTWARE\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\${APPNAME}' '' '$INSTDIR\Assemblies\WindowsPhone\x86'
GOTO End32Bitvs64BitCheck
Is64bit:
WriteRegStr HKLM 'SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\${APPNAME}' '' '$INSTDIR\Assemblies'
+ WriteRegStr HKLM 'SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\${APPNAME}' '' '$INSTDIR\Assemblies\WindowsGL'
+ WriteRegStr HKLM 'SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\${APPNAME}' '' '$INSTDIR\Assemblies\Linux'
+ WriteRegStr HKLM 'SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\${APPNAME}' '' '$INSTDIR\Assemblies\Android'
WriteRegStr HKLM 'SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\${APPNAME}' '' '$INSTDIR\Assemblies\Windows8'
WriteRegStr HKLM 'SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\${APPNAME}' '' '$INSTDIR\Assemblies\WindowsPhone\ARM'
WriteRegStr HKLM 'SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\${APPNAME}' '' '$INSTDIR\Assemblies\WindowsPhone\x86'
@@ -159,11 +168,20 @@ Section "MonoDevelop Templates"
SetOutPath "$0AddIns\MonoDevelop.MonoGame"
; install the Templates for MonoDevelop
; File '..\..\ProjectTemplates\MonoDevelop.MonoGame.${VERSION}\*.*'
- File '..\..\ProjectTemplates\MonoDevelop\MonoDevelop.MonoGame\MonoDevelop.MonoGame\bin\WindowsGL\Release\MonoDevelop.MonoGame.dll'
+ File '..\..\ProjectTemplates\MonoDevelop\MonoDevelop.MonoGame\MonoDevelop.MonoGame\bin\Release\MonoDevelop.MonoGame.dll'
SetOutPath "$0AddIns\MonoDevelop.MonoGame\icons"
File /r '..\..\ProjectTemplates\MonoDevelop\MonoDevelop.MonoGame\MonoDevelop.MonoGame\icons\*.*'
SetOutPath "$0AddIns\MonoDevelop.MonoGame\templates"
File /r '..\..\ProjectTemplates\MonoDevelop\MonoDevelop.MonoGame\MonoDevelop.MonoGame\templates\*.*'
+ SetOutPath "$0AddIns\MonoDevelop.MonoGame\assemblies"
+ SetOutPath "$0AddIns\MonoDevelop.MonoGame\assemblies\WindowsGL"
+ File /nonfatal '..\..\MonoGame.Framework\bin\WindowsGL\Release\*.dll'
+ SetOutPath "$0AddIns\MonoDevelop.MonoGame\assemblies\Android"
+ File /nonfatal '..\..\MonoGame.Framework\bin\Android\Release\*.dll'
+ SetOutPath "$0AddIns\MonoDevelop.MonoGame\assemblies\Linux"
+ File /nonfatal '..\..\MonoGame.Framework\bin\Linux\Release\*.dll'
+ SetOutPath "$0AddIns\MonoDevelop.MonoGame\assemblies\MacOS"
+ SetOutPath "$0AddIns\MonoDevelop.MonoGame\assemblies\iOS"
${EndIf}
SectionEnd
@@ -162,7 +162,6 @@
<Name>MonoGame.Framework.Windows</Name>
</ProjectReference>
</ItemGroup>
- <ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
@@ -168,7 +168,42 @@ void GenerateIfRequired()
throw new NotSupportedException("This IndexBuffer was created with a usage type of BufferUsage.WriteOnly. Calling GetData on a resource that was created with BufferUsage.WriteOnly is not supported.");
#if DIRECTX
- throw new NotImplementedException();
+ if (_isDynamic)
+ {
+ throw new NotImplementedException();
+ }
+ else
+ {
+ var deviceContext = GraphicsDevice._d3dContext;
+
+ // Copy the texture to a staging resource
+ var stagingDesc = _buffer.Description;
+ stagingDesc.BindFlags = SharpDX.Direct3D11.BindFlags.None;
+ stagingDesc.CpuAccessFlags = SharpDX.Direct3D11.CpuAccessFlags.Read | SharpDX.Direct3D11.CpuAccessFlags.Write;
+ stagingDesc.Usage = SharpDX.Direct3D11.ResourceUsage.Staging;
+ stagingDesc.OptionFlags = SharpDX.Direct3D11.ResourceOptionFlags.None;
+ var stagingBuffer = new SharpDX.Direct3D11.Buffer(GraphicsDevice._d3dDevice, stagingDesc);
+
+ lock (GraphicsDevice._d3dContext)
+ deviceContext.CopyResource(_buffer, stagingBuffer);
+
+ int TsizeInBytes = SharpDX.Utilities.SizeOf<T>();
+ var dataHandle = GCHandle.Alloc(data, GCHandleType.Pinned);
+ var startBytes = startIndex * TsizeInBytes;
+ var dataPtr = (IntPtr)(dataHandle.AddrOfPinnedObject().ToInt64() + startBytes);
+ SharpDX.DataPointer DataPointer = new SharpDX.DataPointer(dataPtr, data.Length * TsizeInBytes);
+
+ lock (GraphicsDevice._d3dContext)
+ {
+ // Map the staging resource to a CPU accessible memory
+ var box = deviceContext.MapSubresource(stagingBuffer, 0, SharpDX.Direct3D11.MapMode.Read, SharpDX.Direct3D11.MapFlags.None);
+
+ SharpDX.Utilities.CopyMemory(dataPtr, box.DataPointer, TsizeInBytes * data.Length);
+
+ // Make sure that we unmap the resource in case of an exception
+ deviceContext.UnmapSubresource(stagingBuffer, 0);
+ }
+ }
#elif PSM
throw new NotImplementedException();
#else
@@ -146,7 +146,51 @@ void GenerateIfRequired()
throw new ArgumentOutOfRangeException ("The vertex stride is larger than the vertex buffer.");
#if DIRECTX
- throw new NotImplementedException();
+ if (_isDynamic)
+ {
+ throw new NotImplementedException();
+ }
+ else
+ {
+ var deviceContext = GraphicsDevice._d3dContext;
+
+ // Copy the texture to a staging resource
+ var stagingDesc = _buffer.Description;
+ stagingDesc.BindFlags = SharpDX.Direct3D11.BindFlags.None;
+ stagingDesc.CpuAccessFlags = SharpDX.Direct3D11.CpuAccessFlags.Read | SharpDX.Direct3D11.CpuAccessFlags.Write;
+ stagingDesc.Usage = SharpDX.Direct3D11.ResourceUsage.Staging;
+ stagingDesc.OptionFlags = SharpDX.Direct3D11.ResourceOptionFlags.None;
+ var stagingBuffer = new SharpDX.Direct3D11.Buffer(GraphicsDevice._d3dDevice, stagingDesc);
+
+ lock (GraphicsDevice._d3dContext)
+ deviceContext.CopyResource(_buffer, stagingBuffer);
+
+ int TsizeInBytes = SharpDX.Utilities.SizeOf<T>();
+ var dataHandle = GCHandle.Alloc(data, GCHandleType.Pinned);
+ var startBytes = startIndex * vertexStride;
+ var dataPtr = (IntPtr)(dataHandle.AddrOfPinnedObject().ToInt64() + startBytes);
+ SharpDX.DataPointer DataPointer = new SharpDX.DataPointer(dataPtr, data.Length * TsizeInBytes);
+
+ lock (GraphicsDevice._d3dContext)
+ {
+ // Map the staging resource to a CPU accessible memory
+ var box = deviceContext.MapSubresource(stagingBuffer, 0, SharpDX.Direct3D11.MapMode.Read, SharpDX.Direct3D11.MapFlags.None);
+
+ if (vertexStride == TsizeInBytes)
+ {
+ SharpDX.Utilities.CopyMemory(dataPtr, box.DataPointer, vertexStride*data.Length);
+ }
+ else
+ {
+ for (int i = 0; i < data.Length; i++)
+ SharpDX.Utilities.CopyMemory(dataPtr + i * TsizeInBytes, box.DataPointer + i * vertexStride, TsizeInBytes);
+ }
+
+ // Make sure that we unmap the resource in case of an exception
+ deviceContext.UnmapSubresource(stagingBuffer, 0);
+ }
+ stagingBuffer.Dispose();
+ }
#elif PSM
throw new NotImplementedException();
#else
@@ -7,11 +7,27 @@
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MonoGame.Framework")]
-[assembly: AssemblyDescription("")]
+#if ANDROID
+[assembly: AssemblyDescription("MonoGame for Android")]
+#elif WINDOWS
+[assembly: AssemblyDescription("MonoGame for Windows Desktop (OpenGL)")]
+#elif PSM
+[assembly: AssemblyDescription("MonoGame for Playstation Mobile")]
+#elif LINUX
+[assembly: AssemblyDescription("MonoGame for Linux")]
+#elif MAC
+[assembly: AssemblyDescription("MonoGame for MacOSX")]
+#elif IOS
+[assembly: AssemblyDescription("MonoGame for iOS")]
+#elif WINDOWS_STOREAPP
+[assembly: AssemblyDescription("MonoGame for Windows Store")]
+#elif WINDOWS_PHONE
+[assembly: AssemblyDescription("MonoGame for Windows Phone 8")]
+#endif
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MonoGame.Framework")]
-[assembly: AssemblyCopyright("Copyright © 2011-2012")]
+[assembly: AssemblyCopyright("Copyright © 2011-2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -33,6 +49,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("2.0.0.0")]
-[assembly: AssemblyFileVersion("2.0.0.0")]
+[assembly: AssemblyVersion("3.0.0.0")]
+[assembly: AssemblyFileVersion("3.0.0.0")]
[assembly: NeutralResourcesLanguageAttribute("en-US")]
@@ -190,8 +190,21 @@ private void Window_SizeChanged(CoreWindow sender, WindowSizeChangedEventArgs ar
// If we haven't calculated the back buffer scale then do it now.
if (_backBufferScale == Vector2.Zero)
{
- _backBufferScale = new Vector2( manager.PreferredBackBufferWidth/(float)_clientBounds.Width,
- manager.PreferredBackBufferHeight/(float)_clientBounds.Height);
+ // Make sure the scale is calculated in terms of the same orientation as the preferred back buffer
+ float clientWidth;
+ float clientHeight;
+ if (manager.PreferredBackBufferWidth > manager.PreferredBackBufferHeight)
+ {
+ clientWidth = (float)Math.Max(_clientBounds.Width, _clientBounds.Height);
+ clientHeight = (float)Math.Min(_clientBounds.Width, _clientBounds.Height);
+ }
+ else
+ {
+ clientWidth = (float)Math.Min(_clientBounds.Width, _clientBounds.Height);
+ clientHeight = (float)Math.Max(_clientBounds.Width, _clientBounds.Height);
+ }
+ _backBufferScale = new Vector2( manager.PreferredBackBufferWidth / clientWidth,
+ manager.PreferredBackBufferHeight / clientHeight);
}
// Set the new client bounds.
View
@@ -6,21 +6,23 @@
<target name="build" description="Build MonoGame Release">
- <call target="buildwindows"/>
- <!--
- <call target="buildlinux"/>
- <call target="buildios"/>
+ <call target="buildwindows"/>
+ <call target="buildlinux"/>
<call target="buildandroid" />
- -->
- <nant buildfile="ProjectTemplates/MonoDevelop.MonoGame.2.5/MonoDevelop.MonoGame/default.build" target="build" />
- <nant buildfile="ProjectTemplates/VisualStudio2010.MonoGame.2.5/default.build" target="build" />
+ <call target="buildwindows8" />
+ <call target="buildwindowsphone" />
+
+ <call target="buildtools"/>
+
+ <nant buildfile="ProjectTemplates/MonoDevelop/MonoDevelop.MonoGame/default.build" target="build" />
+ <nant buildfile="ProjectTemplates/VisualStudio2010/default.build" target="build" />
<nant buildfile="Installers/default.build" target="build" />
</target>
<target name="buildwindows" description="Build Windows">
- <if test="${os == 'Win32NT'}">
+ <if test="${os == 'Win32NT'}">
<exec program="msbuild " commandline="MonoGame.Framework.Windows.sln /t:Build /p:Configuration=Release" />
</if>
<if test="${os == 'Unix'}">
@@ -37,12 +39,35 @@
</if>
</target>
- <target name="buildios" description="Build Windows">
+ <target name="buildios" description="Build iOS">
</target>
- <target name="buildandroid" description="Build Windows">
+ <target name="buildandroid" description="Build Android">
+ <if test="${os == 'Win32NT'}">
+ <exec program="msbuild " commandline="MonoGame.Framework.Android.sln /t:Build /p:Configuration=Release" />
+ </if>
+ <if test="${os == 'Unix'}">
+ <exec program="xbuild" commandline="/t:Build /p:Configuration=Release MonoGame.Framework.Android.sln" />
+ </if>
</target>
-
+ <target name="buildwindows8" description="Build Windows 8">
+ <if test="${os == 'Win32NT'}">
+ <exec program="msbuild " commandline="MonoGame.Framework.Windows8.sln /t:Build /p:Configuration=Release" />
+ </if>
+ </target>
+
+ <target name="buildwindowsphone" description="Build Windows Phone">
+ <if test="${os == 'Win32NT'}">
+ <exec program="msbuild " commandline='MonoGame.Framework.WindowsPhone.sln /t:Build /p:Configuration=Release /p:Platform="ARM"' />
+ <exec program="msbuild " commandline='MonoGame.Framework.WindowsPhone.sln /t:Build /p:Configuration=Release /p:Platform="x86"' />
+ </if>
+ </target>
+
+<target name="buildtools" description="Build Tools">
+ <if test="${os == 'Win32NT'}">
+ <exec program="msbuild " commandline="Tools\2MGFX\2MGFX.sln /t:Build /p:Configuration=Release" />
+ </if>
+ </target>
</project>

0 comments on commit 73f4af5

Please sign in to comment.