Home » Community » Forums » » Getting Rid of the Windows Message Pump & Solving the ALT-TAB Problem
  Intel sponsors gamedev.net search:   
[Control Panel] [Register] [Bookmarks] [Who's Online] [Active Topics] [Stats] [FAQ] [Search]

Add Forum to Favorites |  Send Topic To a Friend | View Forum FAQ | Track this topic


 Last Thread Next Thread 
 Getting Rid of the Windows Message Pump & Solving the ALT-TAB Problem
Post Reply 
This article is what I were looking for.

I also have a state machine with manages correctly a State Stack (push... pop...) and overlapped states in my engine, but now I'm thinking on porting to DirectGraphics I'd want to do a better aproach.

I was thinking on the multithreaded model too but I think, however, there are 2 more aproaches: one of them is to put the message loop inside the game loop. We can do this in a function and call that function from each game function, and the other is doing the same but instead of calling the function that check messages inside each game state, we put it in its normal place and make a hook from outside.

Anyway, I think I'll do the multithreaded version so I can forget the main window loop.

What do you think about?

Good article, in any case.

 User Rating: 1039   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

I've been wondering, Direct3D says that "Direct3D is designed so that the methods Reset, CreateDevice, TestCoorperativeLevel, or the final Release of IDirect3DDevice8 can only be called from the same thread that handles window messages." How then should games be written to be ALT-TAB friendly if we have one thread thats handling the message pump and another thats handling the actual game. It would seem to imply that the "message pump" thread needs to do all the handling of reseting and reinitializing all the game resources. Otherwise the game thread would have to constantly be doing checks to see if it needed to reinitialize things, and that seems almost more of a hassle than just writting the game as a state-machine.

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

also a comment on article. from MSDN Library, CreateThread function:

>A thread that uses functions from the C run-time libraries
>should use the beginthread and endthread C run-time functions
>for thread management rather than CreateThread and ExitThread.
>Failure to do so results in small memory leaks when ExitThread
>is called.

If I figured it out correctly, using CreateThread function like the article suggests, isn't proper way of making another thread.

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

I really, really didnt like the FSM model for games programming and your article really helped me alot.
But i face one problem.

I tried to do

Intro();
Sleep(5000);
Splash();
Menu();

But the intro function, has rendering, and unfortunately doesnt work when placed outside of

d3ddev->BeginScene(); // begins the 3D scene
d3ddev->EndScene(); // ends the 3D scene


so im not sure how to ger around that...
i really dont like to even go near the FSM model.

thanks in advance

 User Rating: 1005   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

All times are ET (US)

Post Reply
 Last Thread Next Thread 
Forum Rules:
You may not post new threads
You may post replies
You may not edit your posts
You may not use HTML in your posts
Jump To:
Administrative Options: