Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / getting window size

Author
Message
Rainbow Evil
14
Years of Service
User Offline
Joined: 31st Mar 2010
Location:
Posted: 5th Aug 2011 16:37
hi,

I am trying to change the screen size (with dbSetDisplayMode) whenever the window size changes (ie the user drags the corners to enlarge or presses the maximize button) but I can't find a command for this - whenever dbScreenHeight/Width is used it just returns the display mode height/width which is always the same unless you've coded it to change with dbSetDisplayMode.

Thanks in advance for any help

Take a look at (and rate!) my Dark GDK/MultiSync tutorial
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 5th Aug 2011 17:05 Edited at: 6th Aug 2011 11:46
you can use GetWindowRect for the whole window size, and GetClientRect if you want the area inside the borders only (active area or client area), for the HWND parameter, you need to #include "globstruct.h" and pass g_pGlob->hWnd for it:


note that whenever you use dbSetDisplayMode, you will have to reload all your media

also, a more efficient way to do this, is to intercept the window procedure of GDK window, here is an example:

if you want to know what's going on there, you are replacing the window procedure of the DarkGDK window, and storing the old one, so that, all windows messages are sent to your new procedure, and then your new procedure does whatever it wants, and then (optionally) calls the original DarkGDK procedure

basically put your code inside the WM_SIZE case, for example, you can use LOWORD ( lParam ) for the width and HIWORD ( lParam ) as the height for the new display mode:


also, you can have this code, inside the WM_SIZE:


more info on the WM_SIZE: http://msdn.microsoft.com/en-us/library/ms632646%28v=vs.85%29.aspx

also note that you can intercept any windows message sent, for example, you can intercept WM_GETMINMAXINFO to adjust the window so that it can't be re-sized, or WM_PAINT to do something right before presenting the swap chain, or WM_CLOSE/WM_DESTROY/WM_QUIT if you want to make sure that the user wants to quit, by sending a MessageBox(...) and maybe saving the game if you want, you can do lots of things, you can see the windows messages that could be sent here: http://msdn.microsoft.com/en-us/library/ff468922%28v=VS.85%29.aspx

Login to post a reply

Server time is: 2024-11-19 08:22:32
Your offset time is: 2024-11-19 08:22:32