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

Author Topic: Best way to design my GUI for multiple rotations?  (Read 1252 times)

0 Members and 1 Guest are viewing this topic.

MarkJohnson94

  • Newbie
  • *
  • Posts: 20
    • View Profile
Best way to design my GUI for multiple rotations?
« on: June 30, 2014, 03:40:42 pm »
Hi everyone,

I am creating a level meter for audio samples that rises and falls based on the loudness of the audio track. I have developed it fully for a vertical layout, and I would like to create an option (such as a user pressing a keyboard key) that transforms my gui into a horizontal gui, in which the level rises and falls across the x axis instead.

What is the most modular way to create code that does this. I know it is possible to set the rectangles rotation and position in the window, but if I went on to add a range of other shapes this isn't a great approach as it would involve me having to modify all of their properties. I was thinking there must be a cleaner way?

Generally I would try to create everything on top of a pane of sorts, which when rotated would rotate all of its members. I have looked through the API and not found a solution such as this though.

Any suggestions are welcomed.
Thanks,
Mark.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Best way to design my GUI for multiple rotations?
« Reply #1 on: June 30, 2014, 03:58:57 pm »
Use a view (http://www.sfml-dev.org/tutorials/2.1/graphics-view.php) if you just want to transform everything the same way.
If everything has to move somewhere else with slightly different rotation values, etc. then you'll of course have to come up with your own system for transforming things depending on the layout the user chooses.

If you're however concerned that one view transformation would affect everything else, then you can just use another view for your new shapes, so the transformation will only be applied to these shapes that have been drawn with the transformed view.
« Last Edit: June 30, 2014, 04:05:03 pm by eXpl0it3r »
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

MarkJohnson94

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Best way to design my GUI for multiple rotations?
« Reply #2 on: June 30, 2014, 05:06:21 pm »
Thanks for that, just what I needed.