[SDL] How to put SDL window into an application on Windows

Alvin alvinbeach at gmail.com
Fri Aug 17 07:37:57 PDT 2007


On Friday 17 August 2007 11:27:50 Bryan Arant wrote:
> I still think, that in situations like this (just speculating) that it is
> letting SDL still create the window and setting the environment variable
> (HWND) and then GTK or Ogre (in my experience) will pick it up via that.

I believe the OP is looking for: SDL_WINDOWID


To OP (sorry I do not have the original email):

	char sdl_var[64];

	sprintf(sdl_var, "SDL_WINDOWID=0x%lx", window_id);

	putenv(sdl_var);

	SDL_Surface *surface = SDL_SetVideoMode(xres, yres, bpp, mode);


Where,
	window_id: The Window ID of the widget you want to place the SDL Surface 
into.

	xres, yres: Typically the dimensions of the widget

	bpp: i.e. 32 as in 32 bpp

	mode: All the SDL flags for creating the SDL surface

Hope this helps to point you onto the right track.

Here's some the link to the docs:
http://www.libsdl.org/cgi/docwiki.cgi/SDL_5fenvvars

Good luck,

Alvin


More information about the SDL mailing list