Hi everyone,
I’m new to the list, and an SDL user for only a few months now. I think SDL
is awesome, I intend to use it a lot.
I’m developing some stuff with SDL which I want to run in a window, but I
don’t want the window itself to be visible at all (not even a frame). That
way I can put widgets of my own in the render window and allow the user to
drag it around if I want. Not sure how you’d do this on any other OS. So
here’s my code, which strips SDL of it’s frame and centers it on your
screen.
I hope some of you find this useful.
// … initialize SDL video up here…
// …
//=================================
// Strip the window of it’s border
//=================================
SDL_SysWMinfo Info;
SDL_VERSION(&Info.version);
SDL_GetWMInfo( &Info );
LONG Style = GetWindowLong( Info.window, GWL_STYLE );
Style &= (~WS_BORDER);
Style &= (~WS_DLGFRAME);
SetWindowLong( Info.window, GWL_STYLE, Style );
//=================================
// Center the window on the screen
//=================================
int Width, Height;
Width = GetSystemMetrics( SM_CXSCREEN );
Height = GetSystemMetrics( SM_CYSCREEN );
MoveWindow( Info.window, (Width - XRES)/2, (Height - YRES)/2, XRES, YRES,
TRUE );
John Nagle
President/CEO
Nagle Research
13809 Research Blvd. Suite 745
Austin, TX 78750
http://www.NagleResearch.com
512.260.9533 (office)
512.300.8906 (cell)