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

Author Topic: Drawing Inside Containers  (Read 1429 times)

0 Members and 1 Guest are viewing this topic.

TheUnliked

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • Email
Drawing Inside Containers
« on: September 15, 2018, 08:33:32 am »
Hi there,

I'm pretty new to SFML so bear with me.
Is it possible to split the areas of the window into containers?

I'm making a Tetris game and I want to separate the GUI from the game itself by placing the game objects (e.g. the grid and tetris blocks) inside a container which can then be moved around.
This would really help in organizing the window as the positions of the objects inside the container would be relative to the position of the container.

I've tried using a view but have run into scaling problems. I'm guessing it's not designed for grouping objects and is meant to be used as a camera.

What other options are there for achieving this? Any help would be highly appreciated.

fallahn

  • Hero Member
  • *****
  • Posts: 505
  • Buns.
    • View Profile
    • Trederia
Re: Drawing Inside Containers
« Reply #1 on: September 15, 2018, 10:03:17 am »
To move objects relative to each other you probably want a Scene Graph. There's an example of one on the tutorials page: https://www.sfml-dev.org/tutorials/2.5/graphics-transform.php#object-hierarchies-scene-graph