SFML community forums

Help => Window => Topic started by: zill on October 19, 2008, 07:34:43 pm

Title: Drawing to a window with SFML that you only have the handle
Post by: zill on October 19, 2008, 07:34:43 pm
Is it possible to use SFML to draw to a window in which I only have the window handle?  For example, a function creates a window and returns the window handle.  The window handle is the only bit of information I have about that window.  Can I use that handle and draw directly to that window?
Title: Drawing to a window with SFML that you only have the handle
Post by: Laurent on October 19, 2008, 07:53:13 pm
Of course ;)
Code: [Select]
sf::Window window(handle);

// Or

sf::Window window;
window.Create(handle);


But be careful, if the window is handled externally there might be some conflicts about events or painting. You'll probably have to setup some parameters (on your external window API's side, not SFML) to ensure the painting is done exclusively by SFML.
Title: Drawing to a window with SFML that you only have the handle
Post by: zill on October 21, 2008, 02:53:44 am
I figured there was a way to do this.  I just didn't see that function in the documentation.  Thank you.