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

Author Topic: Combining multiple windows  (Read 1534 times)

0 Members and 1 Guest are viewing this topic.


  • Newbie
  • *
  • Posts: 14
    • View Profile
    • Email
Combining multiple windows
« on: May 29, 2019, 11:33:14 am »
Hello, I am making a program which is a physical simulation. I would like to have big lattice with atoms, next to it, on right - plots and charts and on left - sliders and buttons with options. I am wondering if I can make 3 different classes, which contains separate windows and than just combine them with single, one, big window? Or maybe there is a better solution for that?

EDIT: Just found views tutorial - is it a correct way to do that?
« Last Edit: May 29, 2019, 11:49:39 am by mickes27 »


  • Hero Member
  • *****
  • Posts: 3054
  • My number of posts is shown in hexadecimal.
    • View Profile
Re: Combining multiple windows
« Reply #1 on: September 21, 2019, 05:21:33 pm »
You can simply just draw the parts where you want them. You can, of course, also group together those things that go together.

Using views to separate the window into partitions would likely be better done using the views' viewports although that can be tricky to understand at first. Viewports allow you to define rectangular regions of the window of which cannot be drawn outside; things are clipped to them. Definitely useful if you need things clipping to a hard border. They can (sort of) be considered separate windows (in the way you describe) so if that's what you need, views with custom viewports are the way to go.

View tutorial:
Viewport part of the above tutorial:

More in-depth tutorial about views (that help with understanding how they work and how to use them properly) on the SFML Wiki:
Selba Ward - SFML drawables
Kairos - Timing Library
Rectangular Boundary Collision - Rectangular SAT Collision

@Hapaxiation - Hapaxia on Twitter