Some of these questions probably cross into general programming/c++ territory but... oh well. I've been looking at the board FAQ: http://members.gamedev.net/jhoxley/directx/DirectXForumFAQ.htm#D3D_24
So I've got my directX prog/application running, but I've got a number of bugs. not only was this my first venture into directX programming, but also into windows programming. The tutorials I followed didn't mention how to do a lot of these things.
- I seem to lose the keyboard device when I switch focus to another window, and it doesnt come back when I return it. here's what im doing at the start:
DirectInput8Create(GetModuleHandle(NULL), DIRECTINPUT_VERSION, IID_IDirectInput8, (void**)&inputObject, NULL);
inputObject->CreateDevice(GUID_SysKeyboard, &inputKeyboard, NULL);
inputKeyboard->SetDataFormat(&c_dfDIKeyboard);
inputKeyboard->SetCooperativeLevel(han_Window, DISCL_FOREGROUND|DISCL_NONEXCLUSIVE);
inputKeyboard->Acquire();
- when i switch focus, the program doesn't 'pause'. I understand i could probably halt the game loop during this time but i dont know how to catch "non focus" or whatever.
- when i hit the close button, the process doesn't stop. i assume this is wm_close?
- is it possible to lose the direct 3d device? what's this correspond to, a video card being unplugged or something?
Really, i think my problem is im not handling the messages, but i don't know how. all im doing is this:
[source while(int_AppRunning){
if(PeekMessage(&msg_Message,han_Window,0,0,PM_REMOVE)){ // check for windows messages
DispatchMessage(&msg_Message);
}
and i never do anything with the messages. If someone could give me a couple of tips or link me to a good tutorial on this that would be great; i've looked at a few and just been hopelessly confused.