예제 #1
0
        /// <summary>
        /// Start the main application loop. This method should be called from the entry point of the application
        /// </summary>
        public void Run()
        {
            if (xnaLogic != null)
            {
                throw new InvalidOperationException("Application is already initalised");
            }

            xnaLogic = new XNALogic(this, IntPtr.Zero, out gamerServicesComponent);

            xnaLogic.Services.AddService(typeof(ApplicationProviderService), new ApplicationProviderService(this));
            xnaLogic.Exiting += new EventHandler(ShutdownThreadPool);
            xnaLogic.Content.RootDirectory += @"\Content";

            content = new ContentRegister(this, xnaLogic.Content);
            content.Add(this);

            xnaLogic.Run();
        }
예제 #2
0
        internal void Run(GameComponentHost host)
        {
            if (host == null)
            {
                throw new ArgumentNullException();
            }
            if (xnaLogic != null)
            {
                throw new InvalidOperationException("Application is already initalised");
            }

            xnaLogic = new XNALogic(this, host, out this.gamerServicesComponent);
            xnaLogic.Services.AddService(typeof(ApplicationProviderService), new ApplicationProviderService(this));
            xnaLogic.Exiting += new EventHandler(ShutdownThreadPool);
            xnaLogic.Content.RootDirectory += @"\Content";

            content = new ContentRegister(this, xnaLogic.Content);
            content.Add(this);

            xnaLogic.Run();
        }
		internal void Run(GameComponentHost host)
		{
			if (host == null)
				throw new ArgumentNullException();
			if (xnaLogic != null)
				throw new InvalidOperationException("Application is already initalised");

			xnaLogic = new XNALogic(this, host, out this.gamerServicesComponent);
			xnaLogic.Services.AddService(typeof(ApplicationProviderService), new ApplicationProviderService(this));
			xnaLogic.Exiting += new EventHandler(ShutdownThreadPool);
			xnaLogic.Content.RootDirectory += "Content";

			content = new ContentRegister(this, xnaLogic.Content);
			content.Add(this);

			xnaLogic.Run();
		}
		/// <summary>
		/// Start the main application loop. This method should be called from the entry point of the application
		/// </summary>
		public void Run()
		{
			if (xnaLogic != null)
				throw new InvalidOperationException("Application is already initalised");

			xnaLogic = new XNALogic(this, null, out gamerServicesComponent);

			this.XnaComponents.ComponentAdded += delegate(object sender, GameComponentCollectionEventArgs e) { if (e.GameComponent is DrawableGameComponent) drawableComponents++; };
			this.XnaComponents.ComponentRemoved += delegate(object sender,GameComponentCollectionEventArgs e) { if (e.GameComponent is DrawableGameComponent) drawableComponents--; };

			xnaLogic.Services.AddService(typeof(ApplicationProviderService), new ApplicationProviderService(this));
			xnaLogic.Exiting += new EventHandler(ShutdownThreadPool);
			xnaLogic.Content.RootDirectory += "Content";

			content = new ContentRegister(this, xnaLogic.Content);
			content.Add(this);

			xnaLogic.Run();
		}