Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

* MacOS/GameWindow.cs:

* Audio/SoundEffect.cs:
* Graphics/Viewport.cs:
* Graphics/Texture2D.cs:
* MonoGame.Framework.iOS.csproj:
* MonoGame.Framework.MacOS.csproj:
* Content/ContentSerializerAttribute.cs:
* Content/ContentSerializerIgnoreAttribute.cs: 

Slight code clean up and compatibility changes

git-svn-id: https://xnatouch.svn.codeplex.com/svn@58652 ffd33b8c-2492-42e0-bdc5-587b920b7d6d
  • Loading branch information...
commit f23e09e0c067034340fab1e13ac014d7ab7cee89 1 parent 054b70f
authored March 01, 2011
16  MonoGame.Framework/Audio/SoundEffect.cs
@@ -47,7 +47,7 @@ 1. Definitions
47 47
 
48 48
 namespace Microsoft.Xna.Framework.Audio
49 49
 {
50  
-    public sealed class SoundEffect
  50
+    public sealed class SoundEffect : IDisposable
51 51
     {
52 52
 		private Sound _sound;
53 53
 		private string _name = "";
@@ -100,6 +100,20 @@ public SoundEffectInstance CreateInstance ()
100 100
 				Sound = _sound,
101 101
 			};
102 102
 		}
  103
+		
  104
+		#region IDisposable Members
  105
+
  106
+        public void Dispose()
  107
+        {
  108
+        }
  109
+
  110
+        #endregion
  111
+		
  112
+		public static float MasterVolume 
  113
+		{ 
  114
+			get; 
  115
+			set;
  116
+		}
103 117
     }
104 118
 }
105 119
 
50  MonoGame.Framework/Content/ContentSerializerAttribute.cs
... ...
@@ -0,0 +1,50 @@
  1
+// #region License
  2
+// /*
  3
+// Microsoft Public License (Ms-PL)
  4
+// MonoGame - Copyright © 2009 The MonoGame Team
  5
+// 
  6
+// All rights reserved.
  7
+// 
  8
+// This license governs use of the accompanying software. If you use the software, you accept this license. If you do not
  9
+// accept the license, do not use the software.
  10
+// 
  11
+// 1. Definitions
  12
+// The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under 
  13
+// U.S. copyright law.
  14
+// 
  15
+// A "contribution" is the original software, or any additions or changes to the software.
  16
+// A "contributor" is any person that distributes its contribution under this license.
  17
+// "Licensed patents" are a contributor's patent claims that read directly on its contribution.
  18
+// 
  19
+// 2. Grant of Rights
  20
+// (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, 
  21
+// each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create.
  22
+// (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, 
  23
+// each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software.
  24
+// 
  25
+// 3. Conditions and Limitations
  26
+// (A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks.
  27
+// (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, 
  28
+// your patent license from such contributor to the software ends automatically.
  29
+// (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution 
  30
+// notices that are present in the software.
  31
+// (D) If you distribute any portion of the software in source code form, you may do so only under this license by including 
  32
+// a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object 
  33
+// code form, you may only do so under a license that complies with this license.
  34
+// (E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees
  35
+// or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent
  36
+// permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular
  37
+// purpose and non-infringement.
  38
+// */
  39
+// #endregion License
  40
+// 
  41
+using System;
  42
+
  43
+namespace Microsoft.Xna.Framework.Content
  44
+{
  45
+	public sealed class ContentSerializerAttribute : Attribute
  46
+	{
  47
+		public bool Optional { get; set; }
  48
+	}
  49
+}
  50
+
49  MonoGame.Framework/Content/ContentSerializerIgnoreAttribute.cs
... ...
@@ -0,0 +1,49 @@
  1
+// #region License
  2
+// /*
  3
+// Microsoft Public License (Ms-PL)
  4
+// MonoGame - Copyright © 2009 The MonoGame Team
  5
+// 
  6
+// All rights reserved.
  7
+// 
  8
+// This license governs use of the accompanying software. If you use the software, you accept this license. If you do not
  9
+// accept the license, do not use the software.
  10
+// 
  11
+// 1. Definitions
  12
+// The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under 
  13
+// U.S. copyright law.
  14
+// 
  15
+// A "contribution" is the original software, or any additions or changes to the software.
  16
+// A "contributor" is any person that distributes its contribution under this license.
  17
+// "Licensed patents" are a contributor's patent claims that read directly on its contribution.
  18
+// 
  19
+// 2. Grant of Rights
  20
+// (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, 
  21
+// each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create.
  22
+// (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, 
  23
+// each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software.
  24
+// 
  25
+// 3. Conditions and Limitations
  26
+// (A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks.
  27
+// (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, 
  28
+// your patent license from such contributor to the software ends automatically.
  29
+// (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution 
  30
+// notices that are present in the software.
  31
+// (D) If you distribute any portion of the software in source code form, you may do so only under this license by including 
  32
+// a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object 
  33
+// code form, you may only do so under a license that complies with this license.
  34
+// (E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees
  35
+// or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent
  36
+// permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular
  37
+// purpose and non-infringement.
  38
+// */
  39
+// #endregion License
  40
+// 
  41
+using System;
  42
+
  43
+namespace Microsoft.Xna.Framework.Content
  44
+{
  45
+	public sealed class ContentSerializerIgnoreAttribute : Attribute
  46
+	{
  47
+	}
  48
+}
  49
+
17  MonoGame.Framework/Graphics/Texture2D.cs
@@ -85,6 +85,12 @@ public Rectangle SourceRect
85 85
             }
86 86
         }
87 87
 		
  88
+		public bool IsDisposed
  89
+		{
  90
+			get;
  91
+			set;
  92
+		}
  93
+		
88 94
 		internal Texture2D(ESImage theImage)
89 95
 		{
90 96
 			texture = theImage;
@@ -297,13 +303,6 @@ public void GetData<T>(ref T[] data)
297 303
 				throw new ArgumentException("data cannot be null");
298 304
 			}
299 305
 			
300  
-			/*int mult = (this.Format == SurfaceFormat.Alpha8) ? 1 : 4;
301  
-			
302  
-			if (data.Length < Width * Height * mult)
303  
-			{
304  
-				throw new ArgumentException("data is the wrong length for Pixel Format");
305  
-			}*/
306  
-			
307 306
 			int sz = 0;
308 307
 						
309 308
 			byte[] pixel = new byte[4];
@@ -323,8 +322,8 @@ public void GetData<T>(ref T[] data)
323 322
 							case SurfaceFormat.Rgba32 /*kTexture2DPixelFormat_RGBA8888*/:
324 323
 							case SurfaceFormat.Dxt3 :
325 324
 							    sz = 4;
326  
-								pos = ( (y * Width) + x ) * sz;
327  
-								pixelOffset = new IntPtr(texture.PixelData.ToInt32() + pos);
  325
+								pos = ( (y * Width) + x ) * sz;								
  326
+								pixelOffset = new IntPtr(texture.PixelData.ToInt64() + pos);							
328 327
 								Marshal.Copy(pixelOffset, pixel, 0, 4);	
329 328
 								result.R = pixel[0];
330 329
 								result.G = pixel[1];
17  MonoGame.Framework/Graphics/Viewport.cs
@@ -43,6 +43,7 @@ 1. Definitions
43 43
 
44 44
 namespace Microsoft.Xna.Framework.Graphics
45 45
 {
  46
+	[SerializableAttribute]
46 47
     public struct Viewport
47 48
     {
48 49
 
@@ -60,6 +61,22 @@ public float AspectRatio
60 61
 			}
61 62
 		}
62 63
 		
  64
+		public Rectangle Bounds 
  65
+		{ 
  66
+			get 
  67
+			{
  68
+				return new Rectangle(X, Y, Width, Height);	
  69
+			}
  70
+				
  71
+			set
  72
+			{				
  73
+				X = value.X;
  74
+				Y = value.Y;
  75
+				Width = value.Width;
  76
+				Height = value.Height;
  77
+			}
  78
+		}
  79
+		
63 80
 		public Rectangle TitleSafeArea {get;set;}
64 81
 
65 82
         public Vector3 Project(Vector3 source, Matrix projection, Matrix view, Matrix world)
2  MonoGame.Framework/MacOS/GameWindow.cs
@@ -55,7 +55,7 @@ 1. Definitions
55 55
 
56 56
 namespace Microsoft.Xna.Framework
57 57
 {
58  
-    public class GameWindow : NSOpenGLView
  58
+    public class GameWindow : MonoMacGameView
59 59
     {
60 60
 		private readonly Rectangle clientBounds;
61 61
 		internal Game game;
1  MonoGame.Framework/MonoGame.Framework.MacOS.csproj
@@ -208,6 +208,5 @@
208 208
     <Folder Include="MacOS\Content\" />
209 209
     <Folder Include="MacOS\Graphics\" />
210 210
     <Folder Include="MacOS\Media\" />
211  
-    <Folder Include="Graphics\New Folder\" />
212 211
   </ItemGroup>
213 212
 </Project>
2  MonoGame.Framework/MonoGame.Framework.iOS.csproj
@@ -279,6 +279,8 @@
279 279
     <Compile Include="Media\PlaylistCollection.cs" />
280 280
     <Compile Include="Media\SongCollection.cs" />
281 281
     <Compile Include="Graphics\Texture.cs" />
  282
+    <Compile Include="Content\ContentSerializerIgnoreAttribute.cs" />
  283
+    <Compile Include="Content\ContentSerializerAttribute.cs" />
282 284
   </ItemGroup>
283 285
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
284 286
   <ProjectExtensions>

0 notes on commit f23e09e

Please sign in to comment.
Something went wrong with that request. Please try again.