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

Author Topic: Object containers  (Read 1129 times)

0 Members and 1 Guest are viewing this topic.

glad

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • Email
Object containers
« on: May 16, 2022, 04:44:43 pm »
I'm looking for a container for sprites which could be placed inside a window and has it's own local coordinate system, and if sprites inside the container are not in it's bounds they won't be rendered.

Is there a way to achive this?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11029
    • View Profile
    • development blog
    • Email
Re: Object containers
« Reply #1 on: May 17, 2022, 09:03:00 am »
You can use a view and limit it to a certain area (see the view tutorial).
Or you could use a RenderTexture that matches the area's size and render into it. If it doesn't fall onto the render texture itself, it wouldn't be shown.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/