SFML community forums

Help => Graphics => Topic started by: glad on May 16, 2022, 04:44:43 pm

Title: Object containers
Post by: glad 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?
Title: Re: Object containers
Post by: eXpl0it3r on May 17, 2022, 09:03:00 am
You can use a view and limit it to a certain area (see the view tutorial (https://www.sfml-dev.org/tutorials/2.5/graphics-view.php#defining-how-the-view-is-viewed)).
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.