Arcade Shooter
MenuScreen.h
1 /* --------------------------------------------------------------- /
2 
3  ██╗ ██╗ █████╗ ████████╗ █████╗ ███╗ ██╗ █████╗
4  ██║ ██╔╝ ██╔══██╗ ╚══██╔══╝ ██╔══██╗ ████╗ ██║ ██╔══██╗
5  █████╔╝ ███████║ ██║ ███████║ ██╔██╗ ██║ ███████║
6  ██╔═██╗ ██╔══██║ ██║ ██╔══██║ ██║╚██╗██║ ██╔══██║
7  ██║ ██╗ ██║ ██║ ██║ ██║ ██║ ██║ ╚████║ ██║ ██║
8  ╚═╝ ╚═╝ ╚═╝ ╚═╝/\ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝
9  /vvvvvvvvvvvvvvvvvvv \=========================================,
10  `^^^^^^^^^^^^^^^^^^^ /---------------------------------------"
11  Katana Engine \/ © 2012 - Shuriken Studios LLC
12 
13 / --------------------------------------------------------------- */
14 
15 #pragma once
16 
17 namespace KatanaEngine
18 {
19  class SpriteBatch;
20 
22  class MenuScreen : public Screen
23  {
24 
25  public:
26 
27  MenuScreen();
28  virtual ~MenuScreen();
29 
32  virtual void HandleInput(const InputState *pInput);
33 
36  virtual void Update(const GameTime *pGameTime);
37 
40  virtual void Draw(SpriteBatch *pSpriteBatch);
41 
45  virtual void SetItemListWrapping(const bool wraps) { m_itemListWraps = wraps; }
46 
47 
48  protected:
49 
52  virtual void AddMenuItem(MenuItem *pItem);
53 
56  virtual MenuItem *GetSelectedItem() const { return m_menuItems[m_selectedItemIndex]; }
57 
60  virtual MenuItem *GetMenuItem(const int itemIndex) const { return m_menuItems[itemIndex]; }
61 
64  virtual void SetSelectedItem(const int itemIndex) { m_selectedItemIndex = itemIndex; }
65 
68  virtual void SetDisplayCount(const unsigned int count) { m_displayCount = count; }
69 
72  virtual int GetDisplayCount() const { return m_displayCount; }
73 
76  virtual int GetDisplayStartIndex() const { return m_displayStartIndex; }
77 
78 
79  private:
80 
81  std::vector<MenuItem *> m_menuItems;
82 
83  unsigned int m_selectedItemIndex;
84 
85  unsigned int m_displayCount;
86 
87  unsigned int m_displayStartIndex;
88 
89  bool m_itemListWraps;
90 
91  };
92 }
virtual void Update(const GameTime *pGameTime)
Called when the game has determined that screen logic needs to be processed.
Definition: MenuScreen.cpp:89
virtual void AddMenuItem(MenuItem *pItem)
Adds a menu item to the screen.
Definition: MenuScreen.cpp:126
virtual void SetDisplayCount(const unsigned int count)
Set how many menu items to display.
Definition: MenuScreen.h:68
Base class for all game screens and menus.
Definition: Screen.h:39
Contains timing values for game updates and rendering.
Definition: GameTime.h:17
virtual int GetDisplayStartIndex() const
Get the index corresponding to the first displayed menu item.
Definition: MenuScreen.h:76
Handles the state of multiple player input devices.
Definition: InputState.h:18
virtual void Draw(SpriteBatch *pSpriteBatch)
Called when the game determines it is time to draw a frame.
Definition: MenuScreen.cpp:110
Base class for all game menu screens.
Definition: MenuScreen.h:22
virtual MenuItem * GetSelectedItem() const
Get the currently selected menu item.
Definition: MenuScreen.h:56
Class for menu items contained in a MenuScreen.
Definition: MenuItem.h:27
virtual void SetItemListWrapping(const bool wraps)
Sets whether scrolling past the end of the menu returns the selection back to the first item...
Definition: MenuScreen.h:45
Enables a group of sprites to be drawn using the same settings.
Definition: SpriteBatch.h:44
virtual void HandleInput(const InputState *pInput)
Called when the game has determined that player input needs to be processed.
Definition: MenuScreen.cpp:38
virtual MenuItem * GetMenuItem(const int itemIndex) const
Get a menu item by providing it&#39;s index.
Definition: MenuScreen.h:60
virtual void SetSelectedItem(const int itemIndex)
Set the selected menu item by providing it&#39;s index.
Definition: MenuScreen.h:64
virtual int GetDisplayCount() const
Get the number of menu items that are set to display.
Definition: MenuScreen.h:72
Katana Engine is a library of classes, interfaces, and value types that provides a foundation for dev...
Definition: Animation.cpp:14