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. PeekMessage
does not return sent messages, and WM_SIZE
is a sent message.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With