Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Drawing to a window with SFML that you only have the handle  (Read 3730 times)

0 Members and 1 Guest are viewing this topic.

zill

  • Newbie
  • *
  • Posts: 12
    • View Profile
Drawing to a window with SFML that you only have the handle
« 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?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Drawing to a window with SFML that you only have the handle
« Reply #1 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.
Laurent Gomila - SFML developer

zill

  • Newbie
  • *
  • Posts: 12
    • View Profile
Drawing to a window with SFML that you only have the handle
« Reply #2 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.