예제 #1
0
파일: Game.cs 프로젝트: 628426/Strive.NET
		static void Main(string[] args)	{
			// Configure Resource manager
			string path = System.Configuration.ConfigurationSettings.AppSettings["ResourcePath"];
			if ( path == null ) {
				//throw new System.Configuration.ConfigurationException( "ResourcePath" );
			}
			CurrentMessageProcessor = new MessageProcessor();

			// Initialise required objects
			CurrentServerConnection = new ServerConnection();
			CurrentServerConnection.OnConnect += new ServerConnection.OnConnectHandler( HandleConnect );
			CurrentServerConnection.OnDisconnect += new ServerConnection.OnDisconnectHandler( HandleDisconnect );

			CurrentMainWindow = new Windows.Main();
			CurrentMainWindow.Show();
			//CurrentWorld.InitialiseView( CurrentMainWindow, CurrentMainWindow.RenderTarget, CurrentMainWindow.miniMap.RenderTarget );

			Windows.ChildWindows.Connection con = new Windows.ChildWindows.Connection();
			con.Show();

			while( !CurrentMainWindow.IsDisposed ) {
				// NB: This is a tight renderloop
				// it will chew cpu
				// TODO: could be made nicer by
				// P/Invoke into the Win32 API and call PeekMessage/TranslateMessage/DispatchMessage.  (Doevents actually does something similar, but you can do this without the extra allocations). 
				Application.DoEvents();
				if ( CurrentServerConnection.isRunning ) {
					GameLoop();
				}
				System.Threading.Thread.Sleep( 0 );
			}

			// must terminate all threads to quit
			CurrentServerConnection.Stop();
		}
예제 #2
0
파일: Main.cs 프로젝트: 628426/Strive.NET
 private void ViewConnect_Click(object sender, System.EventArgs e)
 {
     // Connection
     Game.Stop();
     ChildWindows.Connection con = new ChildWindows.Connection();
     con.ShowDialog(this);
 }
예제 #3
0
        static void Main(string[] args)
        {
            // Configure Resource manager
            string path = System.Configuration.ConfigurationSettings.AppSettings["ResourcePath"];

            if (path == null)
            {
                //throw new System.Configuration.ConfigurationException( "ResourcePath" );
            }
            CurrentMessageProcessor = new MessageProcessor();

            // Initialise required objects
            CurrentServerConnection               = new ServerConnection();
            CurrentServerConnection.OnConnect    += new ServerConnection.OnConnectHandler(HandleConnect);
            CurrentServerConnection.OnDisconnect += new ServerConnection.OnDisconnectHandler(HandleDisconnect);

            CurrentMainWindow = new Windows.Main();
            CurrentMainWindow.Show();
            //CurrentWorld.InitialiseView( CurrentMainWindow, CurrentMainWindow.RenderTarget, CurrentMainWindow.miniMap.RenderTarget );

            Windows.ChildWindows.Connection con = new Windows.ChildWindows.Connection();
            con.Show();

            while (!CurrentMainWindow.IsDisposed)
            {
                // NB: This is a tight renderloop
                // it will chew cpu
                // TODO: could be made nicer by
                // P/Invoke into the Win32 API and call PeekMessage/TranslateMessage/DispatchMessage.  (Doevents actually does something similar, but you can do this without the extra allocations).
                Application.DoEvents();
                if (CurrentServerConnection.isRunning)
                {
                    GameLoop();
                }
                System.Threading.Thread.Sleep(0);
            }

            // must terminate all threads to quit
            CurrentServerConnection.Stop();
        }
예제 #4
0
		private void ViewConnect_Click(object sender, System.EventArgs e) {
			// Connection
			Game.Stop();
			ChildWindows.Connection con = new ChildWindows.Connection();
			con.ShowDialog(this);
		}