Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

eagleboy

Message loops 'n stuff

This topic is 5144 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, When I execute the following code a strange thing happens; The window appears and behaves as expected, however nothing is drawn, despite the window seeming to recieve and process windows messages. If the window looses focus the client rect exposes what appears to be the drawn surface! It reminds me of the time I forgot to set the parent property of a control... All source code can be found here


		public void q8Main()
		{
			
			loadingform = new LoadingForm();
			Q8Window GameWindow = new Q8Window();
			
			// initialisation thread
			Thread InitialisationThread = new Thread(new ThreadStart(Initialise));
			InitialisationThread.Name = "Q8 Initialisation Thread";			
			InitialisationThread.Start();
			
			// this will happily sit here waiting for the end
			Application.Run(loadingform);

			// did we load our settings?
			if (!Loaded) return;

			// lets create a new window
			GameWindow = new Q8Window();
			GameWindow.Activated += new EventHandler(GameWindow_Activated);
			GameWindow.Closing += new System.ComponentModel.CancelEventHandler(GameWindow_Closing);
			GameWindow.Closed += new EventHandler(GameWindow_Closed);	

			engine.Console.Print("I have no idea why it won''t work straight up");
			engine.Console.Print("I guess I''ll find out soon enough");

			GameWindow.ClientSize = new Size(640, 480);
			engine.Init(GameWindow);


			engine.SetViewPort(640, 480);

			GameWindow.Show();

			while(Running)
			{				
				engine.BeginScene();				
				// guts goes here
				engine.EndScene();

				Application.DoEvents();	
				
				Thread.Sleep(50);			
			}

			Application.Exit();

		
			
			
		}

		/// 
		/// The main entry point for the application.
		/// 
		[STAThread]
		static void Main() 
		{			
			q8 Game = new q8();
			// logic goes in a different thread
			Thread GameMainThread = new Thread(new ThreadStart(Game.q8Main));
			GameMainThread.Name = "Q8 Main Thread";
			GameMainThread.Start();

			Thread.CurrentThread.Name = "Main";

			// new message pump please
			//Application.Run();
		}

[/CODE]

   

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!