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

Author Topic: Query about data structure for stateManager  (Read 1728 times)

0 Members and 1 Guest are viewing this topic.

smilesprower

  • Newbie
  • *
  • Posts: 25
    • View Profile
    • Email
Query about data structure for stateManager
« on: October 14, 2016, 11:42:20 pm »
Just inquiring what would be considered a good data structure to use for a manager of states ?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
AW: Query about data structure for stateManager
« Reply #1 on: October 15, 2016, 12:20:07 am »
A class? And to hold the states you could use a vector/stack/deqeue of unique_ptrs.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

smilesprower

  • Newbie
  • *
  • Posts: 25
    • View Profile
    • Email
Re: Query about data structure for stateManager
« Reply #2 on: October 15, 2016, 02:28:32 am »
Yes of course there will be a class lol.

What I mean is, whats the best solution for changing scenes, deleting, checking if scene exists before creating a new one etc. Apologies  if my questions wasn't clear.

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: Query about data structure for stateManager
« Reply #3 on: October 15, 2016, 10:09:30 am »
There's no best. There are different approaches depending on what you have in mind or what you need. Some might fit for project B but could be bad for project C.

 

anything