[SDL] SDL_CreateWindowFrom

Mason Wheeler masonwheeler at yahoo.com
Thu Feb 16 05:38:38 PST 2012

Yeah, SDL_CreateWindowFrom should work.  That's what I used to embed a SDL window inside a Delphi widget.

Here's the basic concept:

Create a very simple widget that does as little as possible.  What you needis a rectangular area with a handle of the sort that SDL_CreateWindowFrom expects.  (On Windows, this is a HWND handle.  Not sure about other OSes.)
Your widget should have an event or virtual method that is guaranteed to fire when the OS creates the handle because it needs to draw to the screen.  This is the place where you put the call to SDL_CreateWindowFrom: immediately after the handle has been created.  Likewise, destroy the SDL window immediately before the handle is cleaned up.
Your widget should have an event or virtual method that is guaranteed to fire when the OS needs to repaint it.  Expose this as an event handler so the developer can decide how to repaint properly.

That's the basic concept for creating it.  There's probably more you should do, adding basic texture-management and drawing capabilities into the widget object, but that's what you need to get started.  Here's my implementation, for reference:


 From: Matthias Schweinoch <matthias.schweinoch at gmx.de>
To: sdl at lists.libsdl.org 
Sent: Wednesday, February 15, 2012 11:26 PM
Subject: [SDL] SDL_CreateWindowFrom
Hi all,

I would like to create an SDL window inside a Qt widget. I think that the SDL 1.3/2.0 function SDL_CreateWindowFrom would be the way to go, but I have not found any tutorials or documentation that confirm this...

Thus, before I spend a couple of hours trying to figure it out, is there someone that's tried this before, and is SDL_CreateWindowFrom the way to go, or is it not possible to have an SDL Window inside of a Qt Widget?

Thanks in advance for the help.

Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de
SDL mailing list
SDL at lists.libsdl.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20120216/8445aa63/attachment-0008.htm>

More information about the SDL mailing list