BARE2D
ScreenList.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <vector>
4 
5 namespace BARE2D
6 {
7  class Screen;
8 
9  /**
10  * @class ScreenList
11  * @brief Holds and connects all of the screens used in the program in a list. Keeps track of the previous screen. Contains functions to move to the next or previous screens.
12  */
13  class ScreenList
14  {
15  public:
16  ScreenList();
17 
18  /**
19  * @brief Destroys the screen list, "taking care" of the screen pointers it owns.
20  * @param screen
21  */
22  ~ScreenList();
23 
24  /**
25  * @brief Adds a screen to the list of screens, AKA the screen list. Requires non-nullptr. Also, calls the screen's initScreen function
26  * @param screen A pointer to the screen to be added.
27  */
28  void addScreen(Screen* screen);
29 
30  /**
31  * @brief Adds a screen, and sets the current screen to this one.
32  * @param screen A pointer to the entry screen.
33  */
34  void addEntryScreen(Screen* screen);
35 
36  /**
37  * @brief Moves to the next screen, updates needed variables. Also, exits old screen and enters new one.
38  */
39  void moveToNextScreen();
40 
41  /**
42  * @brief Moves to the previous screen. Similar to moveToNextScreen, in that it makes sure everything's good!
43  */
44  void moveToPreviousScreen();
45 
46  /**
47  * @return The current screen.
48  */
50 
51  private:
52  std::vector<Screen*> m_screens;
54  Screen* m_currentScreen = nullptr;
55 
56  };
57 
58 }
59 
BARE2D::Screen
This is meant to be a parent for other, app-specific, screen classes, which is essentially where all ...
Definition: Screen.hpp:16
BARE2D::ScreenList::~ScreenList
~ScreenList()
Destroys the screen list, "taking care" of the screen pointers it owns.
Definition: ScreenList.cpp:11
BARE2D
Definition: App.cpp:13
BARE2D::ScreenList::moveToPreviousScreen
void moveToPreviousScreen()
Moves to the previous screen. Similar to moveToNextScreen, in that it makes sure everything's good!
Definition: ScreenList.cpp:50
BARE2D::ScreenList::m_screens
std::vector< Screen * > m_screens
Definition: ScreenList.hpp:52
BARE2D::ScreenList::m_currentScreen
Screen * m_currentScreen
Definition: ScreenList.hpp:54
BARE2D::ScreenList::addScreen
void addScreen(Screen *screen)
Adds a screen to the list of screens, AKA the screen list. Requires non-nullptr. Also,...
Definition: ScreenList.cpp:21
BARE2D::ScreenList::m_previousScreen
Screen * m_previousScreen
Definition: ScreenList.hpp:53
BARE2D::ScreenList::addEntryScreen
void addEntryScreen(Screen *screen)
Adds a screen, and sets the current screen to this one.
Definition: ScreenList.cpp:27
BARE2D::ScreenList::ScreenList
ScreenList()
Definition: ScreenList.cpp:7
BARE2D::ScreenList
Holds and connects all of the screens used in the program in a list. Keeps track of the previous scre...
Definition: ScreenList.hpp:13
BARE2D::ScreenList::moveToNextScreen
void moveToNextScreen()
Moves to the next screen, updates needed variables. Also, exits old screen and enters new one.
Definition: ScreenList.cpp:33
BARE2D::ScreenList::getCurrentScreen
Screen * getCurrentScreen()
Definition: ScreenList.cpp:69