Space Fighter
A "shmup" game for Computer Programming C++
Loading...
Searching...
No Matches
MenuScreen.h
Go to the documentation of this file.
1
2/*
3 ██╗ ██╗ █████╗ ████████╗ █████╗ ███╗ ██╗ █████╗
4 ██║ ██╔╝ ██╔══██╗ ╚══██╔══╝ ██╔══██╗ ████╗ ██║ ██╔══██╗
5 █████╔╝ ███████║ ██║ ███████║ ██╔██╗ ██║ ███████║
6 ██╔═██╗ ██╔══██║ ██║ ██╔══██║ ██║╚██╗██║ ██╔══██║
7 ██║ ██╗ ██║ ██║ ██║ ██║ ██║ ██║ ╚████║ ██║ ██║
8 ╚═╝ ╚═╝ ╚═╝ ╚═╝/\ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝
9 /vvvvvvvvvvvvvvvvvvv \=========================================,
10 `^^^^^^^^^^^^^^^^^^^ /---------------------------------------"
11 Katana Engine \/ © 2012 - Shuriken Studios LLC
12 http://www.shurikenstudios.com
13*/
14
15#pragma once
16
17namespace 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& input);
33
36 virtual void Update(const GameTime& gameTime);
37
40 virtual void Draw(SpriteBatch& spriteBatch);
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 size_t GetCount() const { return m_menuItems.size(); }
77
80 virtual int GetDisplayStartIndex() const { return m_displayStartIndex; }
81
82
83 private:
84
85 std::vector<MenuItem *> m_menuItems;
86
87 unsigned int m_selectedItemIndex = 0;
88
89 unsigned int m_displayCount = 0;
90
91 unsigned int m_displayStartIndex = 0;
92
93 bool m_itemListWraps = false;
94
95 };
96}
Contains timing values for game updates and rendering.
Definition GameTime.h:21
Handles the state of multiple player input devices.
Definition InputState.h:22
Class for menu items contained in a MenuScreen.
Definition MenuItem.h:28
Base class for all game menu screens.
Definition MenuScreen.h:23
virtual int GetDisplayStartIndex() const
Get the index corresponding to the first displayed menu item.
Definition MenuScreen.h:80
virtual void SetSelectedItem(const int itemIndex)
Set the selected menu item by providing it'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
virtual MenuItem * GetSelectedItem() const
Get the currently selected menu item.
Definition MenuScreen.h:56
virtual void Draw(SpriteBatch &spriteBatch)
Called when the game determines it is time to draw a frame.
virtual void SetDisplayCount(const unsigned int count)
Set how many menu items to display.
Definition MenuScreen.h:68
virtual void HandleInput(const InputState &input)
Called when the game has determined that player input needs to be processed.
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
virtual void Update(const GameTime &gameTime)
Called when the game has determined that screen logic needs to be processed.
virtual void AddMenuItem(MenuItem *pItem)
Adds a menu item to the screen.
virtual MenuItem * GetMenuItem(const int itemIndex) const
Get a menu item by providing it's index.
Definition MenuScreen.h:60
virtual size_t GetCount() const
Get the total number of menu items.
Definition MenuScreen.h:76
Base class for all game screens and menus.
Definition Screen.h:40
Enables a group of sprites to be drawn using the same settings.
Definition SpriteBatch.h:48
Katana Engine is a library of classes, interfaces, and value types that provides a foundation for dev...
Definition Animation.cpp:18