Author: antti
Date: 2007-01-03 14:06:12 -0500 (Wed, 03 Jan 2007)
New Revision: 70432

Modified:
   trunk/Mono.Xna/src/Microsoft.Xna.Framework.Game/Game.cs
Log:
Re-stubbed the class to make it conform the latest spec. I also thrashed 
useless imports.


Modified: trunk/Mono.Xna/src/Microsoft.Xna.Framework.Game/Game.cs
===================================================================
--- trunk/Mono.Xna/src/Microsoft.Xna.Framework.Game/Game.cs     2007-01-03 
17:26:12 UTC (rev 70431)
+++ trunk/Mono.Xna/src/Microsoft.Xna.Framework.Game/Game.cs     2007-01-03 
19:06:12 UTC (rev 70432)
@@ -26,9 +26,6 @@
 #endregion License
 
 using System;
-using System.Reflection;
-using System.ComponentModel;
-using System.Collections.Generic;
 
 using Tao.OpenGl;
 using SdlDotNet.Graphics;
@@ -36,385 +33,202 @@
 
 namespace Microsoft.Xna.Framework
 {
-    /// <summary>The main game component which will contain a game's logic and 
rendering code.</summary>
-    //[Designer("Microsoft.Xna.Framework.Design.GameDesigner, 
Microsoft.Xna.Framework.Design, Version=1.0.0.0, Culture=neutral, 
PublicKeyToken=f48fa5f25d27e8ff", "System.ComponentModel.Design.IRootDesigner, 
System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"), 
ToolboxItem(false), ToolboxItemFilter("Microsoft.Xna.Framework", 
ToolboxItemFilterType.Require), 
DesignerSerializer("Microsoft.Xna.Framework.Design.GameCodeDomSerializer, 
Microsoft.Xna.Framework.Design, Version=1.0.0.0, Culture=neutral, 
PublicKeyToken=f48fa5f25d27e8ff", 
"System.ComponentModel.Design.Serialization.CodeDomSerializer, System.Design, 
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), 
ToolboxItemFilter("Microsoft.Xna.Framework", ToolboxItemFilterType.Prevent), 
DefaultEvent("Draw"), DesignerCategory("Component"), DesignTimeVisible(false)]
-    public class Game : IComponent, IDisposable
-    {
-        /// <summary>Raised when the game gains focus.</summary>
-        public event EventHandler Activated;
-        /// <summary>Raised when the game loses focus.</summary>
-        public event EventHandler Deactivated;
-        /// <summary>Raised when the game is being disposed.</summary>
-        [Browsable(false)]
-        public event EventHandler Disposed;
-        /// <summary>Raised when the game is exiting.</summary>
-        public event EventHandler Exiting;
-        /// <summary>Raised after the game is initialized but before the first 
frame.</summary>
-        public event EventHandler Starting;
-        /// <summary>Raised when an unhandled exception reaches the main loop 
of the game.</summary>
-        [Browsable(false)]
-        public event EventHandler<UnhandledExceptionEventArgs> 
UnhandledException;
+       public class Game : IDisposable
+       {
+               #region Public Constructors
 
-        /// <summary>Initializes a new instance of this class.</summary>
-        public Game()
-        {
-            m_GameComponents = new GameComponentCollection(this);
-           
-            //Glut.glutInit();
-            //Glut.glutInitDisplayMode(Glut.GLUT_RGBA | Glut.GLUT_DOUBLE);
+               public Game()
+               {
+               }
 
-            //Glut.glutIdleFunc(new Glut.IdleCallback(Tick));
-        }
+               #endregion Public Constructors
 
-        /// <summary>Immediately releases the unmanaged resources used by this 
object.</summary>
-        public void Dispose()
-        {
-            this.Dispose(true);
-            GC.SuppressFinalize(this);
-        }
-        /// <summary>
-        /// Releases all resources used by the Game class.
-        /// </summary>
-        /// <param name="disposing">true to release both managed and unmanaged 
resources; false to release only unmanaged resources.
-        /// </param>
-        protected virtual void Dispose(bool disposing)
-        {
-            if (disposing)
-            {
-                foreach (GameComponent component in m_GameComponents)
-                    component.Dispose();
-                if (this.Disposed != null)
-                    this.Disposed(this, EventArgs.Empty);
-            }
+               #region Private Fields
 
-        }
-        /// <summary>
-        /// 
-        /// </summary>
-        protected virtual void Initialize()
-        {
-        }
+               private GameWindow window;
+               private GameServiceContainer gameServices;
+               private GameComponentCollection gameComponents;
 
-        /// <summary>
-        /// 
-        /// </summary>
-        /// <param name="loadAllContent"></param>
-        protected virtual void LoadGraphicsContent(bool loadAllContent)
-        {
-        }
+               #endregion Private Fields
 
-        /// <summary>
-        /// 
-        /// </summary>
-        /// <param name="unloadAllContent"></param>
-        protected virtual void UnloadGraphicsContent(bool unloadAllContent)
-        {
-        }
+               #region Public Properties
 
-        /// <summary>
-        /// 
-        /// </summary>
-        /// <param name="gameTime"></param>
-        protected virtual void Update(GameTime gameTime)
-        {
-        }
+               public GameComponentCollection Components
+               {
+                       get {
+                               return gameComponents;
+                       }
+               }
 
-        /// <summary>Called when the game determines it is time to draw a 
frame.  Override this method with game-specific rendering code.</summary>
-        protected virtual void Draw()
-        {
-        }
+               public TimeSpan InactiveSleepTime
+               {
+                       get {
+                               throw new NotImplementedException();
+                       }
+                       set {
+                               throw new NotImplementedException();
+                       }
+               }
 
-        /// <summary>
-        /// 
-        /// </summary>
-        /// <param name="gameTime"></param>
-        protected virtual void Draw(GameTime gameTime)
-        {
-        }
-        /// <summary>Calls the GameComponent.Draw method of each registered 
GameComponent.</summary>
-        protected virtual void DrawComponents()
-        {
-            foreach (GameComponent component in m_GameComponents)
-            {
-                component.Draw();
-            }
-        }
+               public bool IsActive
+               {
+                       get {
+                               throw new NotImplementedException();
+                       }
+               }
 
-        private GameServiceContainer m_GameServices = new 
GameServiceContainer();
-        private GameComponentCollection m_GameComponents;
-        
-        /// <summary>Exits the game.</summary>
-        public void Exit()
-        {
-            
-           // Glut.glutLeaveMainLoop();
-        }
+               public bool IsFixedTimeStep
+               {
+                       get {
+                               throw new NotImplementedException();
+                       }
+                       set {
+                               throw new NotImplementedException();
+                       }
+               }
 
-        /// <summary>
-        /// Allows a Game to attempt to free resources and perform other 
cleanup operations before garbage collection reclaims the Game.
-        /// </summary>
-        ~Game()
-        {
-            this.Dispose(false);
-        }
+               public bool IsMouseVisible
+               {
+                       get {
+                               throw new NotImplementedException();
+                       }
+                       set {
+                               throw new NotImplementedException();
+                       }
+               }
 
-        /// <summary>Raises the Game.Activated event.  Override to add code to 
handle when the game gains focus.</summary>
-        protected virtual void OnActivated()
-        {
-        }
-        /// <summary>Raises the Game.Deactivated event.  Override to add code 
to handle when the game loses focus.</summary>
-        protected virtual void OnDeactivated()
-        {
-        }
-        /// <summary>Raises an Game.Exiting event.  Override to add code to 
handle when the game is exiting.</summary>
-        protected virtual void OnExiting()
-        {
-        }
-        /// <summary>Raises the Game.Starting event.  Override to add code to 
setup the game before the first frame.</summary>
-        protected virtual void OnStarting()
-        {
-            Assembly assembly = Assembly.GetEntryAssembly();
-            object[] obj = 
assembly.GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
+               public GameServiceContainer Services
+               {
+                       get {
+                               return gameServices;
+                       }
+               }
 
-            Video.WindowCaption = ((AssemblyTitleAttribute)obj[0]).Title;
-            Video.SetVideoModeWindowOpenGL(GameWindow.DefaultClientWidth, 
GameWindow.DefaultClientHeight);
-            //Video.SetVideoModeWindowOpenGL(640, 480);
-            // Enable Smooth Shading
-            Gl.glShadeModel(Gl.GL_SMOOTH);
-            // Black Background
-            Gl.glClearColor(0.0F, 0.0F, 0.0F, 0.5F);
-            // Depth Buffer Setup
-            Gl.glClearDepth(1.0F);
-            // Enables Depth Testing
-            Gl.glEnable(Gl.GL_DEPTH_TEST);
-            // The Type Of Depth Testing To Do
-            Gl.glDepthFunc(Gl.GL_LEQUAL);
-            // Really Nice Perspective Calculations
-            Gl.glHint(Gl.GL_PERSPECTIVE_CORRECTION_HINT, Gl.GL_NICEST);
-        }
-        /// <summary>Raises an Game.UnhandledException event.  Override to add 
code to handle when an unhandled exception reaches the main loop of the game.
-        /// </summary>
-        /// <param name="e">Arguments to pass to the Game.UnhandledException 
event.
-        /// </param>
-        protected virtual void 
OnUnhandledException(UnhandledExceptionEventArgs e)
-        {
-            if (this.UnhandledException != null)
-            {
-                this.UnhandledException(this, e);
-            }
-        }
-        private void OnTick(object sender, TickEventArgs args)
-        {
-            this.Tick();
-        }
+               public TimeSpan TargetElapsedTime
+               {
+                       get {
+                               throw new NotImplementedException();
+                       }
+                       set {
+                               throw new NotImplementedException();
+                       }
+               }
 
-        private void Quit(object sender, QuitEventArgs e)
-        {
-            Events.QuitApplication();
-        }
+               public GameWindow Window
+               {
+                       get {
+                               return window;
+                       }
+               }
 
-        /// <summary>Starts the game.</summary>
-        public void Run()
-        {
-            foreach (GameComponent component in m_GameComponents)
-                component.Start();
-            this.OnStarting();
-            Events.Quit += new QuitEventHandler(this.Quit);
-            Events.Tick += new TickEventHandler(this.OnTick);
-            Events.Run();
-            //Glut.glutMainLoop();
-        }
-        /// <summary>Updates the game's clock and calls Game.Update and 
Game.Draw.</summary>
-        public void Tick()
-        {
-            this.Draw();
-            Video.GLSwapBuffers();
-        }
+               #endregion Public Properties
 
-        /// <summary>Called when the game has determined that game logic needs 
to be processed.  Override this method with game specific logic.</summary>
-        protected virtual void Update()
-        {
-        }
-        /// <summary>
-        /// Calls the GameComponent.Update method of each registered 
GameComponent.
-        /// </summary>
-        protected virtual void UpdateComponents()
-        {
-            foreach (GameComponent component in m_GameComponents)
-                component.Update();
-        }
+               #region Public Methods
 
-        /// <summary>Specifies whether to allow the user to resize the game 
window.</summary>
-        /// <returns>true if user resizing is allowed; false otherwise.
-        /// </returns>
-        public bool AllowUserResizing
-        {
-            get
-            {
-                return m_Window.AllowUserResizing;
-            }
-            set
-            {
-                m_Window.AllowUserResizing = value;
-            }
-        }
-        /// <summary>Gets the amount of clock time passed since the last 
frame.</summary>
-        /// <returns>Amount of clock time passed since the last 
frame.</returns>
-        
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), 
Browsable(false)]
-        public TimeSpan ElapsedRealTime
-        {
-            get
-            {
-                throw new NotImplementedException();
-            }
-        }
+               public void Dispose()
+               {
+                       this.Dispose(true);
+                       GC.SuppressFinalize(this);
+               }
 
-        /// <summary>Gets the amount of time that has passed since the last 
call to Game.Update.</summary>
-        /// <returns>The amount of time passed.</returns>
-        
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), 
Browsable(false)]
-        public TimeSpan ElapsedTime
-        {
-            get
-            {
-                throw new NotImplementedException();
-            }
-        }
+               public void Exit()
+               {
+                       throw new NotImplementedException();
+               }
 
-        /// <summary>Gets the collection of GameComponents owned by the 
game.</summary>
-        /// <returns>The collection of game GameComponents.</returns>
-        [Browsable(false), 
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
-        public GameComponentCollection GameComponents
-        {
-            get
-            {
-                return m_GameComponents;
-            }
-        }
-        /// <summary>Gets the GameServiceContainer holding all the services 
attached to the Game.</summary>
-        /// <returns>
-        /// The GameServiceContainer holding all the services attached to the 
Game.
-        /// </returns>
-        
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), 
Browsable(false)]
-        public GameServiceContainer Services
-        {
-            get
-            {
-                return m_GameServices;
-            }
-        }
+               public void Run()
+               {
+                       throw new NotImplementedException();
+               }
 
-        /// <summary>Gets the current game time, taking into account the type 
of game loop (fixed or variable).
-        /// </summary>
-        /// <returns>The current game time.</returns>
-        
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), 
Browsable(false)]
-        public TimeSpan GameTime
-        {
-            get
-            {
-                throw new NotImplementedException("GameTime");
-            }
-        }
-        /// <summary>Gets or sets the time to sleep when the game is 
inactive.</summary>
-        /// <returns>The time to sleep when the game is inactive.</returns>
-        //[TypeConverter(typeof(MillisecondsTimeSpanConverter)), 
ResourceDescription("DescInactiveSleepTime"), 
ResourceCategory("CategoryApplication")]
-        public TimeSpan InactiveSleepTime
-        {
-            get
-            {
-                throw new NotImplementedException("InactiveSleepTime");
-            }
-            set
-            {
-                throw new NotImplementedException("InactiveSleepTime");
-            }
-        }
-        /// <summary>Indicates whether the game is currently the active 
application.</summary>
-        /// <returns>true if the game is active; false otherwise.
-        /// </returns>
-        [Browsable(false), 
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
-        public bool IsActive
-        {
-            get
-            {
-                throw new NotImplementedException();
-            }
-        }
-        /// <summary>Gets or sets a value indicating whether to use fixed time 
steps.</summary>
-        /// <returns>true if using fixed time steps; false otherwise.
-        /// </returns>
-        public bool IsFixedTimeStep
-        {
-            get
-            {
-                throw new NotImplementedException();
-            }
-            set
-            {
-                throw new NotImplementedException();
-            }
-        }
-        /// <summary>
-        /// Gets or sets a value that indicating whether the mouse cursor 
should be visible.
-        /// </summary>
-        /// <returns>true if the mouse cursor should be visible; false 
otherwise.</returns>
-        public bool IsMouseVisible
-        {
-            get
-            {
-                return m_Window.IsMouseVisible;
-            }
-            set
-            {
-                m_Window.IsMouseVisible = value;
-            }
-        }
-        /// <summary>
-        /// Gets a value indicating that the game loop is taking longer than 
its Game.TargetElapsedTime.
-        /// In this case, the game loop can be considered to be running too 
slowly and should do something to "catch up."
-        /// </summary>
-        /// <returns>true if the game loop is taking longer than 
Game.TargetElapsedTime; false otherwise.
-        /// </returns>
-        [Browsable(false), 
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
-        public bool IsRunningSlowly
-        {
-            get
-            {
-                throw new NotImplementedException();
-            }
-        }
-        /// <summary>
-        /// Gets or sets the designer host's site.
-        /// </summary>
-        /// <returns>
-        /// Designer host's site.
-        /// </returns>
-        
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), 
Browsable(false)]
-        public ISite Site { get { throw new NotImplementedException(); } set { 
throw new NotImplementedException(); } }
-        /// <summary>Gets or sets the target time between calls to Game.Update 
when Game.IsFixedTimeStep is true.</summary>
-        /// <returns>The target time period for the game loop.</returns>
-        //[TypeConverter(typeof(MillisecondsTimeSpanConverter)), 
ResourceCategory("CategoryGameTiming"), 
ResourceDescription("DescTargetElapsedTime")]
-        public TimeSpan TargetElapsedTime
-        {
-            get
-            {
-                throw new NotImplementedException();
-            }
-            set
-            {
-                throw new NotImplementedException();
-            }
-        }
-        /// <summary>Gets the underlying operating system window.</summary>
-        /// <returns>The underlying operating system window.</returns>
-        [Browsable(false), 
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
-        public GameWindow Window
-        {
-            get
-            {
-                return m_Window;
-            }
-        }
+               public void Tick()
+               {
+                       throw new NotImplementedException();
+               }
 
-        private GameWindow m_Window;
-    }
+               #endregion Public methods
+
+               #region Protected Methods
+
+               protected virtual void Dispose(bool disposing)
+               {
+                       throw new NotImplementedException();
+               }
+
+               protected virtual bool BeginDraw()
+               {
+                       throw new NotImplementedException();
+               }
+
+               protected virtual void BeginRun()
+               {
+                       throw new NotImplementedException();
+               }
+
+               protected virtual void Draw(GameTime gameTime)
+               {
+                       throw new NotImplementedException();
+               }
+
+               protected virtual void EndDraw()
+               {
+                       throw new NotImplementedException();
+               }
+
+               protected virtual void EndRun()
+               {
+                       throw new NotImplementedException();
+               }
+
+               protected override void Finalize()
+               {
+                       throw new NotImplementedException();
+               }
+
+               protected virtual void Initialize()
+               {
+                       throw new NotImplementedException();
+               }
+
+               protected virtual void LoadGraphicsContent(bool loadAllContent)
+               {
+                       throw new NotImplementedException();
+               }
+
+               protected virtual void OnActivated(object sender, EventArgs 
args)
+               {
+                       throw new NotImplementedException();
+               }
+
+               protected virtual void OnDeactivated(object sender, EventArgs 
args)
+               {
+                       throw new NotImplementedException();
+               }
+
+               protected virtual void OnExiting(object sender, EventArgs args)
+               {
+                       throw new NotImplementedException();
+               }
+
+               protected virtual void UnloadGraphicsContent(bool 
unloadAllContent)
+               {
+                       throw new NotImplementedException();
+               }
+
+               protected virtual void Update(GameTime gameTime)
+               {
+                       throw new NotImplementedException();
+               }
+
+               #endregion Protected Methods
+
+               #region Public Events
+
+               public event EventHandler Activated;
+               public event EventHandler Deactivated;
+               public event EventHandler Disposed;
+               public event EventHandler Exiting;
+
+               #endregion Public Events
+       }
 }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to