[SDL] Using MFC with an SDL window?
David MacCormack
djm at the-wall.maccormack.net
Sat Jan 11 19:38:01 PST 2003
Anatoly,
This proved to be an interesting one to track down :). In
./src/video/wincommon/SDL_systevents.c, in the code that handles
WM_GETMINMAXINFO, you'll see the following:
AdjustWindowRect(&size, GetWindowLong(hwnd, GWL_STYLE), FALSE);
That ``FALSE'' basically says "I don't have a menu" (which may or may not
be true, depending on how you create the window). The attached patch
should do the trick.
Dave
On Fri, 10 Jan 2003, Anatoly R. wrote:
>
> And a question to everybody else:
>
> This demo tries to create 640x480 window.
> It creates window with height 480 + title bar height but SDL only
> shows 480 - menu bar height. Is it possible to adjust creation
> settings in some way, so we'll see all 480 pixels on the screen
> instead of 480 - menu bar height? I'm using WinAPI in my old branch of
> game and I've started major rewrite of the code leaving old branch to
> die but I want to fix such bug since I'm initing 320x240 window and
> SDL output window (which is only 218-222 pixels instead of 240) looks
> very bad - my 18 lines are not visible!
>
> Look here:
> correct:
> http://bgs.sourceforge.net/screens-0.7-rc1/warsaw_0_0_1900_65984.png
> incorrect:
> http://bgs.sourceforge.net/screens/021218_2.png
>
> You can see bottom ~18 lines missing in 021218_2.png image.
>
> If I will initialise window in resolution like 320x260 that problem
> will be solved, but anyway, it's not the solution, since I will have
> to handle 2 different resolutions - windoed (240+~20) and
> fullscreen (240). If I'll try to make screenshots in
> windowed mode they will be 320x260... Too much problems.
>
> I need a solution, thanks.
>
>
--
David MacCormack
djm at maccormack.net
:wq
damn!
-------------- next part --------------
*** src/video/wincommon/SDL_sysevents.c 2002/08/20 05:59:31 1.22
--- src/video/wincommon/SDL_sysevents.c 2003/01/12 03:30:32
***************
*** 396,401 ****
--- 396,402 ----
MINMAXINFO *info;
RECT size;
int x, y;
+ int style;
int width;
int height;
***************
*** 424,431 ****
size.bottom = 0;
size.right = 0;
}
! AdjustWindowRect(&size, GetWindowLong(hwnd, GWL_STYLE),
! FALSE);
width = size.right - size.left;
height = size.bottom - size.top;
--- 425,443 ----
size.bottom = 0;
size.right = 0;
}
!
! /* DJM - according to the docs for GetMenu(), the
! return value is undefined if hwnd is a child window.
! Aparently it's too difficult for MS to check
! inside their function, so I have to do it here.
! */
! style = GetWindowLong(hwnd, GWL_STYLE);
! AdjustWindowRect(
! &size,
! style,
! style & WS_CHILDWINDOW ? FALSE
! : GetMenu(hwnd) != NULL);
!
width = size.right - size.left;
height = size.bottom - size.top;
More information about the SDL
mailing list