Skip to content

Commit

Permalink
Merge pull request #1452 from mono/hotfix-3.0.1
Browse files Browse the repository at this point in the history
[TEST ME] Hotfix 3.0.1
  • Loading branch information
dellis1972 committed Mar 5, 2013
2 parents 5952e64 + a292a68 commit 759f782
Show file tree
Hide file tree
Showing 19 changed files with 226 additions and 138 deletions.
42 changes: 42 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
Guidelines
==========

When contributing to the MonoGame project, please follow the [MonoGame Coding Guidelines][]. We are working to introduce this coding style to the project. Please make your pull requests conform to these guidelines.

[MonoGame Coding Guidelines]: https://github.com/mono/MonoGame/wiki/Coding-Guidelines

Etiquette
=========

In general, we do not accept pull requests that merely shuffle code around, split classes in multiple files, reindent the code or are the result of running a refactoring tool on the source code. This is done for three reasons:

* We have our own coding guidelines
* Some modules are imported from upstream sources and we want to respect their coding guidelines
* It destroys valuable history that is often used to investigate bugs, regressions and problems

License
=======

The MonoGame project uses the Microsoft Public License. See `LICENSE.txt` for more details. Some third-party libraries used by MonoGame may be under a different license. Please refer to those libraries for details on the license they use.

Submitting Patches
==================

MonoGame consists of two primary branches:

* `master` is the stable branch from which releases are made. Pull requests direct to the master branch will not be accepted.
* `develop` is the unstable development branch. Pull requests must be made against the develop branch.

The process for making a pull request is generally as follows:

1. Make a feature branch from `develop` for the change.
2. Edit, build and test the feature.
3. Commit to your local repository.
4. Push the feature branch to your GitHub fork.
5. Create the pull request.

If you need to make changes to the pull request, simply repeat steps 2-4. Adding commits to that feature branch in your fork will automatically add the change to the pull request.

The majority of code in MonoGame is cross-platform and must build and behave correctly on all supported platforms. All pull requests to MonoGame are built using an automated system that compiles the pull request on all supported platforms and will report any build errors.

Once a pull request has been accepted, your feature branch can be deleted if desired.
61 changes: 11 additions & 50 deletions Installers/Windows/MonoGame.nsi
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
SetCompressor /SOLID /FINAL lzma

!define FrameworkPath "C:\Users\Dean\Desktop\MonoGameMaster\"
!define VERSION "3.0"
!define REVISION "0.0"
!define REVISION "1"
!define BUILD "0"
!define INSTALLERFILENAME "MonoGame"
!define APPNAME "MonoGame"

Expand All @@ -12,18 +12,18 @@ SetCompressor /SOLID /FINAL lzma
!include "MUI2.nsh"
!include "InstallOptions.nsh"

!define MUI_ICON "${FrameworkPath}Installers\monogame.ico"
!define MUI_ICON "..\monogame.ico"

!define MUI_UNICON "${FrameworkPath}Installers\monogame.ico"
!define MUI_UNICON "..\monogame.ico"

Name '${APPNAME} ${VERSION}'
OutFile '${INSTALLERFILENAME}Installer-${VERSION}.exe'
Name '${APPNAME} ${VERSION}.${REVISION}'
OutFile '${INSTALLERFILENAME}Installer-${VERSION}.${REVISION}.exe'
InstallDir '$PROGRAMFILES\${APPNAME}\v${VERSION}'
VIProductVersion "${VERSION}.${REVISION}"
VIProductVersion "${VERSION}.${REVISION}.${BUILD}"
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} "FileVersion" "${VERSION}.${REVISION}.${BUILD}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductVersion" "${VERSION}.${REVISION}.${BUILD}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "${APPNAME} Installer"
VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "© Copyright MonoGame 2013"

Expand All @@ -33,10 +33,10 @@ RequestExecutionLevel admin
;Interface Configuration

!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "${FrameworkPath}Installers\monogame.bmp"
!define MUI_HEADERIMAGE_BITMAP "..\monogame.bmp"
!define MUI_ABORTWARNING

!define MUI_WELCOMEFINISHPAGE_BITMAP "${FrameworkPath}Installers\panel.bmp"
!define MUI_WELCOMEFINISHPAGE_BITMAP "..\panel.bmp"
;Languages

!insertmacro MUI_PAGE_WELCOME
Expand Down Expand Up @@ -191,45 +191,6 @@ Section "OpenAL" OpenAL
ExecWait '"$INSTDIR\oalinst.exe /S"'
SectionEnd

Section "MonoDevelop Templates" MonoDevelop

; Set output path to the installation directory.
SetOutPath $INSTDIR
; check pre-requsites
ReadRegStr $0 HKLM 'SOFTWARE\Wow6432Node\Xamarin\MonoDevelop' "Path"
${If} $0 == "" ; check on 32 bit machines just in case
ReadRegStr $0 HKLM 'SOFTWARE\Xamarin\MonoDevelop' "Path"
${EndIf}

${If} $0 == ""
DetailPrint "MonoDevelop Not Found."
${Else}
DetailPrint "MonoDevelop Found at $0"
SetOutPath "$0AddIns\MonoDevelop.MonoGame"
; install the Templates for MonoDevelop
; File '..\..\ProjectTemplates\MonoDevelop.MonoGame.${VERSION}\*.*'
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\OUYA"
File /nonfatal '..\..\MonoGame.Framework\bin\OUYA\Release\*.dll'
File /nonfatal '..\..\ThirdParty\Libs\OUYA\*.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


Section "Visual Studio 2010 Templates" VS2010

IfFileExists `$DOCUMENTS\Visual Studio 2010\Templates\ProjectTemplates\Visual C#\*.*` InstallTemplates CannotInstallTemplates
Expand Down
2 changes: 2 additions & 0 deletions MonoGame.Framework/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,8 @@ public void Tick()
_gameTime.ElapsedGameTime = _accumulatedElapsedTime;
_gameTime.TotalGameTime += _accumulatedElapsedTime;
_accumulatedElapsedTime = TimeSpan.Zero;
// Always set the RunningSlowly flag to false here when we are in fast-as-possible mode.
_gameTime.IsRunningSlowly = false;

DoUpdate(_gameTime);
}
Expand Down
27 changes: 22 additions & 5 deletions MonoGame.Framework/Graphics/GraphicsDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1839,13 +1839,26 @@ private int SetUserIndexBuffer<T>(T[] indexData, int indexOffset, int indexCount
}
#endif

public void DrawIndexedPrimitives(PrimitiveType primitiveType, int baseVertex, int minVertexIndex, int numbVertices, int startIndex, int primitiveCount)
/// <summary>
/// Draw geometry by indexing into the vertex buffer.
/// </summary>
/// <param name="primitiveType">The type of primitives in the index buffer.</param>
/// <param name="baseVertex">Used to offset the vertex range indexed from the vertex buffer.</param>
/// <param name="minVertexIndex">A hint of the lowest vertex indexed relative to baseVertex.</param>
/// <param name="numVertices">An hint of the maximum vertex indexed.</param>
/// <param name="startIndex">The index within the index buffer to start drawing from.</param>
/// <param name="primitiveCount">The number of primitives to render from the index buffer.</param>
/// <remarks>Note that minVertexIndex and numVertices are unused in MonoGame and will be ignored.</remarks>
public void DrawIndexedPrimitives(PrimitiveType primitiveType, int baseVertex, int minVertexIndex, int numVertices, int startIndex, int primitiveCount)
{
Debug.Assert(_vertexBuffer != null, "The vertex buffer is null!");
Debug.Assert(_indexBuffer != null, "The index buffer is null!");

if (minVertexIndex > 0)
throw new NotImplementedException ("minVertexIndex > 0 is supported");
// NOTE: minVertexIndex and numVertices are only hints of the
// range of vertex data which will be indexed.
//
// They will only be used if the graphics API can use
// this range hint to optimize rendering.

#if DIRECTX

Expand Down Expand Up @@ -2008,9 +2021,11 @@ public void DrawPrimitives(PrimitiveType primitiveType, int vertexStart, int pri
var vbHandle = GCHandle.Alloc(vertexData, GCHandleType.Pinned);
var ibHandle = GCHandle.Alloc(indexData, GCHandleType.Pinned);

var vertexAddr = (IntPtr)(vbHandle.AddrOfPinnedObject().ToInt64() + vertexDeclaration.VertexStride * vertexOffset);

// Setup the vertex declaration to point at the VB data.
vertexDeclaration.GraphicsDevice = this;
vertexDeclaration.Apply(_vertexShader, vbHandle.AddrOfPinnedObject());
vertexDeclaration.Apply(_vertexShader, vertexAddr);

//Draw
GL.DrawElements( PrimitiveTypeGL(primitiveType),
Expand Down Expand Up @@ -2064,9 +2079,11 @@ public void DrawPrimitives(PrimitiveType primitiveType, int vertexStart, int pri
var vbHandle = GCHandle.Alloc(vertexData, GCHandleType.Pinned);
var ibHandle = GCHandle.Alloc(indexData, GCHandleType.Pinned);

var vertexAddr = (IntPtr)(vbHandle.AddrOfPinnedObject().ToInt64() + vertexDeclaration.VertexStride * vertexOffset);

// Setup the vertex declaration to point at the VB data.
vertexDeclaration.GraphicsDevice = this;
vertexDeclaration.Apply(_vertexShader, vbHandle.AddrOfPinnedObject());
vertexDeclaration.Apply(_vertexShader, vertexAddr);

//Draw
GL.DrawElements( PrimitiveTypeGL(primitiveType),
Expand Down
2 changes: 1 addition & 1 deletion MonoGame.Framework/Graphics/Shader/ShaderProgramCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ internal class ShaderProgramCache : IDisposable

~ShaderProgramCache()
{
Dispose(true);
Dispose(false);
}

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions MonoGame.Framework/Graphics/SpriteBatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ void CheckValid(SpriteFont spriteFont, StringBuilder text)
sourceRectangle,
color,
rotation,
new Vector2(origin.X * ((float)destinationRectangle.Width / (float)texture.Width),
origin.Y * ((float)destinationRectangle.Height / (float)texture.Height)),
new Vector2(origin.X * ((float)destinationRectangle.Width / (float)( (sourceRectangle.HasValue && sourceRectangle.Value.Width != 0) ? sourceRectangle.Value.Width : texture.Width)),
origin.Y * ((float)destinationRectangle.Height) / (float)( (sourceRectangle.HasValue && sourceRectangle.Value.Height != 0) ? sourceRectangle.Value.Height : texture.Height)),
effect,
depth);
}
Expand Down
6 changes: 3 additions & 3 deletions MonoGame.Framework/Graphics/Vertices/IndexBuffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -261,17 +261,17 @@ void GenerateIfRequired()

public void SetData<T>(int offsetInBytes, T[] data, int startIndex, int elementCount) where T : struct
{
SetDataInternal<T>(0, data, startIndex, elementCount, SetDataOptions.Discard);
SetDataInternal<T>(offsetInBytes, data, startIndex, elementCount, SetDataOptions.None);
}

public void SetData<T>(T[] data, int startIndex, int elementCount) where T : struct
{
SetDataInternal<T>(0, data, startIndex, elementCount, SetDataOptions.Discard);
SetDataInternal<T>(0, data, startIndex, elementCount, SetDataOptions.None);
}

public void SetData<T>(T[] data) where T : struct
{
SetDataInternal<T>(0, data, 0, data.Length, SetDataOptions.Discard);
SetDataInternal<T>(0, data, 0, data.Length, SetDataOptions.None);
}

protected void SetDataInternal<T>(int offsetInBytes, T[] data, int startIndex, int elementCount, SetDataOptions options) where T : struct
Expand Down
15 changes: 10 additions & 5 deletions MonoGame.Framework/Graphics/Vertices/VertexBuffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -271,17 +271,17 @@ void GenerateIfRequired()

public void SetData<T>(int offsetInBytes, T[] data, int startIndex, int elementCount, int vertexStride) where T : struct
{
SetDataInternal<T>(0, data, startIndex, elementCount, VertexDeclaration.VertexStride, SetDataOptions.Discard);
SetDataInternal<T>(offsetInBytes, data, startIndex, elementCount, VertexDeclaration.VertexStride, SetDataOptions.None);
}

public void SetData<T>(T[] data, int startIndex, int elementCount) where T : struct
{
SetDataInternal<T>(0, data, startIndex, elementCount, VertexDeclaration.VertexStride, SetDataOptions.Discard);
SetDataInternal<T>(0, data, startIndex, elementCount, VertexDeclaration.VertexStride, SetDataOptions.None);
}

public void SetData<T>(T[] data) where T : struct
{
SetDataInternal<T>(0, data, 0, data.Length, VertexDeclaration.VertexStride, SetDataOptions.Discard);
SetDataInternal<T>(0, data, 0, data.Length, VertexDeclaration.VertexStride, SetDataOptions.None);
}

protected void SetDataInternal<T>(int offsetInBytes, T[] data, int startIndex, int elementCount, int vertexStride, SetDataOptions options) where T : struct
Expand Down Expand Up @@ -383,9 +383,14 @@ void GenerateIfRequired()
_isDynamic ? BufferUsageHint.StreamDraw : BufferUsageHint.StaticDraw);
GraphicsExtensions.CheckGLError();
}

GL.BufferSubData(BufferTarget.ArrayBuffer, (IntPtr)offsetInBytes, (IntPtr)sizeInBytes, data);

var dataHandle = GCHandle.Alloc(data, GCHandleType.Pinned);
var dataPtr = (IntPtr)(dataHandle.AddrOfPinnedObject().ToInt64() + startIndex * elementSizeInBytes);

GL.BufferSubData(BufferTarget.ArrayBuffer, (IntPtr)offsetInBytes, (IntPtr)sizeInBytes, dataPtr);
GraphicsExtensions.CheckGLError();

dataHandle.Free();
}

#endif
Expand Down
44 changes: 24 additions & 20 deletions MonoGame.Framework/Matrix.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2130,25 +2130,29 @@ public static Matrix Transpose(Matrix matrix)

public static void Transpose(ref Matrix matrix, out Matrix result)
{
result.M11 = matrix.M11;
result.M12 = matrix.M21;
result.M13 = matrix.M31;
result.M14 = matrix.M41;

result.M21 = matrix.M12;
result.M22 = matrix.M22;
result.M23 = matrix.M32;
result.M24 = matrix.M42;

result.M31 = matrix.M13;
result.M32 = matrix.M23;
result.M33 = matrix.M33;
result.M34 = matrix.M43;

result.M41 = matrix.M14;
result.M42 = matrix.M24;
result.M43 = matrix.M34;
result.M44 = matrix.M44;
Matrix ret;

ret.M11 = matrix.M11;
ret.M12 = matrix.M21;
ret.M13 = matrix.M31;
ret.M14 = matrix.M41;

ret.M21 = matrix.M12;
ret.M22 = matrix.M22;
ret.M23 = matrix.M32;
ret.M24 = matrix.M42;

ret.M31 = matrix.M13;
ret.M32 = matrix.M23;
ret.M33 = matrix.M33;
ret.M34 = matrix.M43;

ret.M41 = matrix.M14;
ret.M42 = matrix.M24;
ret.M43 = matrix.M34;
ret.M44 = matrix.M44;

result = ret;
}
#endregion Public Methods

Expand Down Expand Up @@ -2221,4 +2225,4 @@ public bool Decompose(out Vector3 scale, out Quaternion rotation, out Vector3 tr
return true;
}
}
}
}
4 changes: 2 additions & 2 deletions MonoGame.Framework/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,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("3.0.0.0")]
[assembly: AssemblyFileVersion("3.0.0.0")]
[assembly: AssemblyVersion("3.0.1.0")]
[assembly: AssemblyFileVersion("3.0.1.0")]
[assembly: NeutralResourcesLanguageAttribute("en-US")]
22 changes: 14 additions & 8 deletions MonoGame.Framework/Windows8/InputEvents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,35 +227,41 @@ public void UpdateState()
Keyboard.SetKeys(_keys);
}

private static Keys KeyTranslate(Windows.System.VirtualKey inkey)
private static Keys KeyTranslate(Windows.System.VirtualKey inkey, CorePhysicalKeyStatus keyStatus)
{
switch (inkey)
{
// XNA does not have have 'handless' key values.
// So, we arebitrarily map those to the 'Left' version.
// WinRT does not distinguish between left/right keys
// We have to check for special keys such as control/shift/alt/ etc
case Windows.System.VirtualKey.Control:
return Keys.LeftControl;
// we can detect right Control by checking the IsExtendedKey value.
return (keyStatus.IsExtendedKey) ? Keys.RightControl : Keys.LeftControl;
case Windows.System.VirtualKey.Shift:
return Keys.LeftShift;
// we can detect right shift by checking the scancode value.
// left shift is 0x2A, right shift is 0x36. IsExtendedKey is always false.
return (keyStatus.ScanCode==0x36) ? Keys.RightShift : Keys.LeftShift;
// Note that the Alt key is now refered to as Menu.
case Windows.System.VirtualKey.Menu:
// ALT key doesn't get fired by KeyUp/KeyDown events.
// One solution could be to check CoreWindow.GetKeyState(...) on every tick.
case Windows.System.VirtualKey.Menu:
return Keys.LeftAlt;

default:
return (Keys)inkey;
}
}

private void CoreWindow_KeyUp(object sender, KeyEventArgs args)
{
var xnaKey = KeyTranslate(args.VirtualKey);
var xnaKey = KeyTranslate(args.VirtualKey, args.KeyStatus);

if (_keys.Contains(xnaKey))
_keys.Remove(xnaKey);
}

private void CoreWindow_KeyDown(object sender, KeyEventArgs args)
{
var xnaKey = KeyTranslate(args.VirtualKey);
var xnaKey = KeyTranslate(args.VirtualKey, args.KeyStatus);

if (!_keys.Contains(xnaKey))
_keys.Add(xnaKey);
Expand Down

0 comments on commit 759f782

Please sign in to comment.