Class for menu items contained in a MenuScreen.
More...
#include <MenuItem.h>
|
| | MenuItem () |
| | Instantiate a menu item.
|
| |
| | MenuItem (std::string text) |
| | Instantiate a menu item.
|
| |
| virtual | ~MenuItem () |
| |
| virtual void | Update (const GameTime &gameTime) |
| | Called when the game has determined that screen logic needs to be processed.
|
| |
| virtual void | Draw (SpriteBatch &spriteBatch) |
| | Called when the game determines it is time to draw a frame.
|
| |
| virtual void | Select (MenuScreen *pMenuScreen) |
| | Called when the picks this menu option.
|
| |
| virtual void | SetText (const std::string text) |
| | Sets the text of the menu item.
|
| |
| virtual void | SetTextOffset (const Vector2 offset) |
| | Sets the offset from the items normal position. Usually used to animate the currently selected menu item.
|
| |
| virtual bool | IsSelected () const |
| | Determines whether or not this menu item is the one that is currently selected.
|
| |
| virtual void | SetSelected (const bool isSelected) |
| | Sets whether or not this menu item is the one that is currently selected.
|
| |
| virtual bool | IsDisplayed () const |
| | Determines whether or not this menu item is currently displayed.
|
| |
| virtual void | SetDisplayed (const bool isDisplayed) |
| | Sets whether or not this menu item is currently displayed.
|
| |
| virtual void | SetFont (Font *pFont) |
| | Sets the font of the menu item.
|
| |
| virtual void | SetPosition (const Vector2 position) |
| | Sets the screen position of the menu item.
|
| |
| virtual void | SetColor (const Color color) |
| | Sets the color of the menu item.
|
| |
| virtual void | SetAlpha (const float alpha) |
| | Sets the alpha value (opacity) of the menu item.
|
| |
| virtual void | SetTextAlign (TextAlign textAlign) |
| | Sets the text alignment for the menu item.
|
| |
| virtual void | SetMenuScreen (MenuScreen *pMenuScreen) |
| | Sets containing menu screen.
|
| |
| virtual void | SetSelectCallback (OnSelect callback) |
| | Sets the callback function for when the menu item is selected.
|
| |
| virtual int | GetIndex () const |
| | Gets the index of the menu item.
|
| |
|
| virtual void | SetIndex (const int index) |
| | Sets the index of the menu item.
|
| |
| virtual MenuScreen * | GetMenuScreen () const |
| | Gets the menu screen that contains this item.
|
| |
| virtual Vector2 | GetPosition () const |
| | Gets the position of the menu item.
|
| |
| virtual std::string | GetText () const |
| | Gets the text of the menu item.
|
| |
Class for menu items contained in a MenuScreen.
Definition at line 27 of file MenuItem.h.
◆ MenuItem() [1/2]
| KatanaEngine::MenuItem::MenuItem |
( |
| ) |
|
◆ MenuItem() [2/2]
| KatanaEngine::MenuItem::MenuItem |
( |
std::string | text | ) |
|
Instantiate a menu item.
- Parameters
-
| text | The text that the item will display. |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 21 of file MenuItem.cpp.
◆ ~MenuItem()
| virtual KatanaEngine::MenuItem::~MenuItem |
( |
| ) |
|
|
inlinevirtual |
◆ Draw()
| void KatanaEngine::MenuItem::Draw |
( |
SpriteBatch & | spriteBatch | ) |
|
|
virtual |
Called when the game determines it is time to draw a frame.
- Parameters
-
| spriteBatch | A reference to the game's sprite batch, used for rendering. |
Definition at line 38 of file MenuItem.cpp.
◆ GetIndex()
| virtual int KatanaEngine::MenuItem::GetIndex |
( |
| ) |
const |
|
inlinevirtual |
Gets the index of the menu item.
- Returns
- Returns the menu item's index.
Definition at line 116 of file MenuItem.h.
◆ GetMenuScreen()
| virtual MenuScreen * KatanaEngine::MenuItem::GetMenuScreen |
( |
| ) |
const |
|
inlineprotectedvirtual |
Gets the menu screen that contains this item.
- Returns
- Returns a pointer to the menu screen.
Definition at line 127 of file MenuItem.h.
◆ GetPosition()
| virtual Vector2 KatanaEngine::MenuItem::GetPosition |
( |
| ) |
const |
|
inlineprotectedvirtual |
Gets the position of the menu item.
- Returns
- Returns the menu item's position on the screen.
Definition at line 131 of file MenuItem.h.
◆ GetText()
| virtual std::string KatanaEngine::MenuItem::GetText |
( |
| ) |
const |
|
inlineprotectedvirtual |
Gets the text of the menu item.
- Returns
- Returns the menu item's text.
Definition at line 135 of file MenuItem.h.
◆ IsDisplayed()
| virtual bool KatanaEngine::MenuItem::IsDisplayed |
( |
| ) |
const |
|
inlinevirtual |
Determines whether or not this menu item is currently displayed.
- Returns
- Returns true if this item is currently displayed, false otherwise.
Definition at line 77 of file MenuItem.h.
◆ IsSelected()
| virtual bool KatanaEngine::MenuItem::IsSelected |
( |
| ) |
const |
|
inlinevirtual |
Determines whether or not this menu item is the one that is currently selected.
- Returns
- Returns true if this item is the currently selected one, false otherwise.
Definition at line 68 of file MenuItem.h.
◆ Select()
| void KatanaEngine::MenuItem::Select |
( |
MenuScreen * | pMenuScreen | ) |
|
|
virtual |
Called when the picks this menu option.
- Parameters
-
| pMenuScreen | A pointer to the menu screen. |
Definition at line 46 of file MenuItem.cpp.
◆ SetAlpha()
| virtual void KatanaEngine::MenuItem::SetAlpha |
( |
const float | alpha | ) |
|
|
inlinevirtual |
Sets the alpha value (opacity) of the menu item.
- Parameters
-
Definition at line 97 of file MenuItem.h.
◆ SetColor()
| virtual void KatanaEngine::MenuItem::SetColor |
( |
const Color | color | ) |
|
|
inlinevirtual |
Sets the color of the menu item.
- Parameters
-
Definition at line 93 of file MenuItem.h.
◆ SetDisplayed()
| virtual void KatanaEngine::MenuItem::SetDisplayed |
( |
const bool | isDisplayed | ) |
|
|
inlinevirtual |
Sets whether or not this menu item is currently displayed.
- Parameters
-
| isDisplayed | Pass true to display this item, and false to hide it. |
Definition at line 81 of file MenuItem.h.
◆ SetFont()
| virtual void KatanaEngine::MenuItem::SetFont |
( |
Font * | pFont | ) |
|
|
inlinevirtual |
Sets the font of the menu item.
- Parameters
-
| pFont | A pointer to the font. |
Definition at line 85 of file MenuItem.h.
◆ SetIndex()
| virtual void KatanaEngine::MenuItem::SetIndex |
( |
const int | index | ) |
|
|
inlineprotectedvirtual |
Sets the index of the menu item.
- Parameters
-
Definition at line 123 of file MenuItem.h.
◆ SetMenuScreen()
| virtual void KatanaEngine::MenuItem::SetMenuScreen |
( |
MenuScreen * | pMenuScreen | ) |
|
|
inlinevirtual |
◆ SetPosition()
| virtual void KatanaEngine::MenuItem::SetPosition |
( |
const Vector2 | position | ) |
|
|
inlinevirtual |
Sets the screen position of the menu item.
- Parameters
-
| position | The new position. |
Definition at line 89 of file MenuItem.h.
◆ SetSelectCallback()
| virtual void KatanaEngine::MenuItem::SetSelectCallback |
( |
OnSelect | callback | ) |
|
|
inlinevirtual |
Sets the callback function for when the menu item is selected.
- Parameters
-
| callback | The callback function. |
Definition at line 112 of file MenuItem.h.
◆ SetSelected()
| virtual void KatanaEngine::MenuItem::SetSelected |
( |
const bool | isSelected | ) |
|
|
inlinevirtual |
Sets whether or not this menu item is the one that is currently selected.
- Parameters
-
| isSelected | Pass true to make this item the selected one, and false to when you no longer want it selected. |
Definition at line 73 of file MenuItem.h.
◆ SetText()
| virtual void KatanaEngine::MenuItem::SetText |
( |
const std::string | text | ) |
|
|
inlinevirtual |
Sets the text of the menu item.
- Parameters
-
Definition at line 59 of file MenuItem.h.
◆ SetTextAlign()
| virtual void KatanaEngine::MenuItem::SetTextAlign |
( |
TextAlign | textAlign | ) |
|
|
inlinevirtual |
Sets the text alignment for the menu item.
- Parameters
-
| textAlign | The text alignment. |
Definition at line 101 of file MenuItem.h.
◆ SetTextOffset()
| virtual void KatanaEngine::MenuItem::SetTextOffset |
( |
const Vector2 | offset | ) |
|
|
inlinevirtual |
Sets the offset from the items normal position. Usually used to animate the currently selected menu item.
- Parameters
-
Definition at line 64 of file MenuItem.h.
◆ Update()
| virtual void KatanaEngine::MenuItem::Update |
( |
const GameTime & | gameTime | ) |
|
|
inlinevirtual |
Called when the game has determined that screen logic needs to be processed.
- Parameters
-
| gameTime | A reference to the game time object. |
Definition at line 47 of file MenuItem.h.
◆ MenuScreen
The documentation for this class was generated from the following files: