Permalink
Browse files

Revert "Revert "Merge branch 'develop3d' of https://github.com/Sickhe…

…adGames/MonoGame into develop3d""

This reverts commit 075a3c9.
  • Loading branch information...
1 parent 075a3c9 commit 7c2fa0f1eefd3b09a57e0c53aae8889dfc4ea212 @tomspilman tomspilman committed Mar 21, 2012
View
@@ -58,5 +58,30 @@ Global
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = MonoGame.Framework\MonoGame.Framework.iOS.csproj
+ Policies = $0
+ $0.TextStylePolicy = $1
+ $1.inheritsSet = null
+ $1.scope = text/x-csharp
+ $0.CSharpFormattingPolicy = $2
+ $2.NamespaceBraceStyle = EndOfLine
+ $2.ClassBraceStyle = EndOfLine
+ $2.InterfaceBraceStyle = EndOfLine
+ $2.StructBraceStyle = EndOfLine
+ $2.EnumBraceStyle = EndOfLine
+ $2.AfterDelegateDeclarationParameterComma = True
+ $2.BeforeSizeOfParentheses = True
+ $2.BeforeTypeOfParentheses = True
+ $2.SpacesAfterTypecast = True
+ $2.SpacesBeforeArrayDeclarationBrackets = True
+ $2.inheritsSet = Mono
+ $2.inheritsScope = text/x-csharp
+ $2.scope = text/x-csharp
+ $0.TextStylePolicy = $3
+ $3.FileWidth = 120
+ $3.RemoveTrailingWhitespace = True
+ $3.EolMarker = Unix
+ $3.inheritsSet = Mono
+ $3.inheritsScope = text/plain
+ $3.scope = text/plain
EndGlobalSection
EndGlobal
@@ -45,14 +45,6 @@ public override Rectangle ClientBounds
public override DisplayOrientation CurrentOrientation
{
get { return nativeWindow.CurrentOrientation; }
- internal set
- {
- if (nativeWindow.CurrentOrientation != value)
- {
- //nativeWindow.CurrentOrientation = value;
- OnOrientationChanged();
- }
- }
}
public override IntPtr Handle
@@ -69,5 +61,11 @@ protected override void SetTitle(string title)
{
nativeWindow.Title = title;
}
+
+ // FIXME: Implement SetSupportedOrientations
+ protected internal override void SetSupportedOrientations(DisplayOrientation orientations)
+ {
+ Console.WriteLine("Android needs to implement GameWindow.SetSupportedOrientations!");
+ }
}
-}
+}
@@ -87,12 +87,6 @@ public class OpenTKGameWindow : GameWindow
public override Rectangle ClientBounds { get { return clientBounds; } }
- public override string Title
- {
- get { return window.Title; }
- set { SetTitle(value); }
- }
-
// TODO: this is buggy on linux - report to opentk team
public override bool AllowUserResizing
{
@@ -109,18 +103,12 @@ public override bool AllowUserResizing
public override DisplayOrientation CurrentOrientation
{
- get
- {
- return _currentOrientation;
- }
- internal set
- {
- if (value != _currentOrientation)
- {
- _currentOrientation = value;
- OnOrientationChanged();
- }
- }
+ get { return DisplayOrientation.LandscapeLeft; }
+ }
+
+ protected internal override void SetSupportedOrientations(DisplayOrientation orientations)
+ {
+ // Do nothing. Desktop platforms don't do orientation.
}
#endregion
@@ -314,8 +302,6 @@ public override void EndScreenDeviceChange(string screenDeviceName, int clientWi
}
- public override void EndScreenDeviceChange(string screenDeviceName) { }
-
#endregion
#region Events
View
@@ -128,7 +128,6 @@ public Game()
{
_instance = this;
LaunchParameters = new LaunchParameters();
- Exiting += OnExiting;
_services = new GameServiceContainer();
_components = new GameComponentCollection();
Content = new ContentManager(_services);
@@ -337,20 +336,13 @@ internal bool Initialized
public void Exit()
{
- Raise(Exiting, EventArgs.Empty);
_platform.Exit();
}
public void ResetElapsedTime()
{
- // FIXME: This method didn't actually do anything before. It
- // may need to call a new method in GamePlatform to allow
- // platforms to handle elapsed time in their own way.
- // Now that things are more unified, it may be possible to
- // consolidate this logic back into the Game class.
- // Regardless, an empty implementation is not correct.
_platform.ResetElapsedTime();
- _lastUpdate = DateTime.Now;
+ _lastUpdate = DateTime.Now;
}
public void Run()
@@ -377,6 +369,7 @@ public void Run(GameRunBehavior runBehavior)
case GameRunBehavior.Synchronous:
_platform.RunLoop();
EndRun();
+ OnExiting(this, EventArgs.Empty);
break;
default:
throw new NotImplementedException(string.Format(
@@ -512,6 +505,7 @@ protected virtual void Update(GameTime gameTime)
protected virtual void OnExiting(object sender, EventArgs args)
{
+ Raise(Exiting, EventArgs.Empty);
}
#endregion Protected Methods
@@ -540,6 +534,7 @@ private void Platform_AsyncRunLoopEnded(object sender, EventArgs e)
var platform = (GamePlatform)sender;
platform.AsyncRunLoopEnded -= Platform_AsyncRunLoopEnded;
EndRun();
+ OnExiting(this, EventArgs.Empty);
}
private void Platform_Activated(object sender, EventArgs e)
@@ -1,59 +1,154 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Microsoft.Xna.Framework;
-
-namespace Microsoft.Xna.Framework
-{
- public abstract class GameWindow
- {
- public event EventHandler<EventArgs> ClientSizeChanged;
- public event EventHandler<EventArgs> OrientationChanged;
- public event EventHandler<EventArgs> ScreenDeviceNameChanged;
-
- public abstract void BeginScreenDeviceChange(bool willBeFullScreen);
- public abstract void EndScreenDeviceChange(string screenDeviceName, int clientWidth, int clientHeight);
-
- public virtual void EndScreenDeviceChange(string screenDeviceName) { }
-
- protected void OnActivated(){}
-
- protected void OnClientSizeChanged()
- {
- if (ClientSizeChanged != null)
- {
- ClientSizeChanged(this, EventArgs.Empty);
- }
- }
-
- protected void OnDeactivated(){}
-
- protected void OnOrientationChanged()
- {
- if (OrientationChanged != null)
- {
- OrientationChanged(this, EventArgs.Empty);
- }
- }
-
- protected void OnPaint(){}
-
- protected void OnScreenDeviceNameChanged()
- {
- if (ScreenDeviceNameChanged != null)
- {
- ScreenDeviceNameChanged(this, EventArgs.Empty);
- }
- }
-
- public abstract bool AllowUserResizing { get; set; }
- public abstract Rectangle ClientBounds { get; }
- public abstract DisplayOrientation CurrentOrientation { get; internal set; }
- public abstract IntPtr Handle { get; }
- public abstract string ScreenDeviceName { get; }
-
- public virtual string Title { get; set; }
- protected abstract void SetTitle(string title);
- }
-}
+#region License
+/*
+Microsoft Public License (Ms-PL)
+MonoGame - Copyright © 2009-2012 The MonoGame Team
+
+All rights reserved.
+
+This license governs use of the accompanying software. If you use the software,
+you accept this license. If you do not accept the license, do not use the
+software.
+
+1. Definitions
+
+The terms "reproduce," "reproduction," "derivative works," and "distribution"
+have the same meaning here as under U.S. copyright law.
+
+A "contribution" is the original software, or any additions or changes to the
+software.
+
+A "contributor" is any person that distributes its contribution under this
+license.
+
+"Licensed patents" are a contributor's patent claims that read directly on its
+contribution.
+
+2. Grant of Rights
+
+(A) Copyright Grant- Subject to the terms of this license, including the
+license conditions and limitations in section 3, 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.
+
+(B) Patent Grant- Subject to the terms of this license, including the license
+conditions and limitations in section 3, 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.
+
+3. Conditions and Limitations
+
+(A) No Trademark License- This license does not grant you rights to use any
+contributors' name, logo, or trademarks.
+
+(B) If you bring a patent claim against any contributor over patents that you
+claim are infringed by the software, your patent license from such contributor
+to the software ends automatically.
+
+(C) If you distribute any portion of the software, you must retain all
+copyright, patent, trademark, and attribution notices that are present in the
+software.
+
+(D) If you distribute any portion of the software in source code form, you may
+do so only under this license by including a complete copy of this license with
+your distribution. If you distribute any portion of the software in compiled or
+object code form, you may only do so under a license that complies with this
+license.
+
+(E) The software is licensed "as-is." You bear the risk of using it. The
+contributors give no express warranties, guarantees or conditions. You may have
+additional consumer rights under your local laws which this license cannot
+change. To the extent permitted under your local laws, the contributors exclude
+the implied warranties of merchantability, fitness for a particular purpose and
+non-infringement.
+*/
+#endregion License
+
+using System;
+using System.ComponentModel;
+
+namespace Microsoft.Xna.Framework {
+ public abstract class GameWindow {
+ #region Properties
+
+ [DefaultValue(false)]
+ public abstract bool AllowUserResizing { get; set; }
+
+ public abstract Rectangle ClientBounds { get; }
+
+ public abstract DisplayOrientation CurrentOrientation { get; }
+
+ public abstract IntPtr Handle { get; }
+
+ public abstract string ScreenDeviceName { get; }
+
+ private string _title;
+ public string Title {
+ get { return _title; }
+ set {
+ if (_title != value) {
+ SetTitle(value);
+ _title = value;
+ }
+ }
+ }
+
+ #endregion Properties
+
+ #region Events
+
+ public event EventHandler<EventArgs> ClientSizeChanged;
+ public event EventHandler<EventArgs> OrientationChanged;
+ public event EventHandler<EventArgs> ScreenDeviceNameChanged;
+
+ #endregion Events
+
+ public abstract void BeginScreenDeviceChange (bool willBeFullScreen);
+
+ public abstract void EndScreenDeviceChange (
+ string screenDeviceName, int clientWidth, int clientHeight);
+
+ public void EndScreenDeviceChange (string screenDeviceName)
+ {
+ EndScreenDeviceChange(screenDeviceName, ClientBounds.Width, ClientBounds.Height);
+ }
+
+ protected void OnActivated ()
+ {
+ }
+
+ protected void OnClientSizeChanged ()
+ {
+ var handler = ClientSizeChanged;
+ if (handler != null)
+ handler (this, EventArgs.Empty);
+ }
+
+ protected void OnDeactivated ()
+ {
+ }
+
+ protected void OnOrientationChanged ()
+ {
+ var handler = OrientationChanged;
+ if (handler != null)
+ OrientationChanged (this, EventArgs.Empty);
+ }
+
+ protected void OnPaint ()
+ {
+ }
+
+ protected void OnScreenDeviceNameChanged ()
+ {
+ var handler = ScreenDeviceNameChanged;
+ if (handler != null)
+ handler (this, EventArgs.Empty);
+ }
+
+ protected internal abstract void SetSupportedOrientations (DisplayOrientation orientations);
+ protected abstract void SetTitle (string title);
+ }
+}
@@ -39,7 +39,7 @@ 1. Definitions
#endregion License
#region Using Statements
-using System;
+using System;
using Microsoft.Xna.Framework.Net;
#endregion Statements
@@ -55,7 +55,6 @@ public class GamerServicesComponent : GameComponent
public GamerServicesComponent(Game game) : base(game)
{
lng = new LocalNetworkGamer();
- Guide.Window = game.Window;
Guide.Initialise(game);
}
Oops, something went wrong.

0 comments on commit 7c2fa0f

Please sign in to comment.