I’m trying to resize a graphics device buffer when the window is resized, but I have no luck in detecting the event.
This is C++ Windows programming. I tried:
while(WM_QUIT != msg.message){
if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)){
switch(msg.message){
case WM_SIZE:
return; //<-- If the program closes because of this return, then I know I found the right statements.
}
//TranslateMessage(&msg);
//DispatchMessage(&msg);
}else{
poly.setConstantBuffer(space.getCamera());
poly.draw(iSize);
graphics.render();
}
}
It is not returning, so that means that is not correct. What is the right way to catch the resize event?
You should be handling messages in your window procedure, not in the message loop.
PeekMessagedoes not return sent messages, andWM_SIZEis a sent message.