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

Author Topic: Is it possible to get a ::renderTarget to point to a section of a window ?  (Read 6003 times)

0 Members and 1 Guest are viewing this topic.

SpacedCowboy

  • Newbie
  • *
  • Posts: 16
    • View Profile
    • Email
So basically I'm trying to have my cake and eat it. I'm putting together a dev-tool (on OSX) for creating maps, and I want SFML for the texture-brushing and so on - all the heavy lifting...

BUT I want a fairly complex UI for the configuration of the options for each of the layers - masks, tables, nested outline views etc. So I'm currently using it by setting up an SFML window, and then just creating another NSWindow, into which I can put my UI stuff. So far so good.

What would be *great* though, is if I could have an NSView rather than an NSWindow as the base render target. Then I could have one window, and I wouldn't "lose" a click when mousing from config-window to render-window.

One way I've though of doing it is to grab the native window handle, then add another view to its contentView and use that NSView as the base for my UI. Maybe that's the best way to go, but before I dive in, I wanted to make sure I hadn't missed some "handle" that was available or anything like that. I'm also a bit concerned that performance might drop if the window is "mixed use" like this, but maybe that's not going to be a problem.

Any info gratefully received :)

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Is it possible to get a ::renderTarget to point to a section of a window ?
« Reply #1 on: November 26, 2021, 10:30:28 am »
Not sure how well it integrates on macOS, but people have done similar things for Qt and wxWidgets, so you pretend this one area of the window is the RenderWindow. The tricky thing really is to have SFML not interfere with everything (e.g. event processing, window handling).

As you've described, your best bet is to create your own window and then pass SFML's RenderWindow the relevant window handle.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

SpacedCowboy

  • Newbie
  • *
  • Posts: 16
    • View Profile
    • Email
Re: Is it possible to get a ::renderTarget to point to a section of a window ?
« Reply #2 on: November 28, 2021, 04:03:09 am »
Thanks  :) I'll maybe give it a go once I've got past this next bit. Redoing the render-pipeline at the moment...

 

anything