Creates a menu. Just specify a font size, some dimensions, a list of options, font path and color, and a renderer. Additionally it keeps track of which option was selected.
More...
#include <BaseMenu.h>
|
| BaseMenu (int fontSize, int x, int y, int w, int h, const std::vector< std::string > &optionNames, std::string fontPath, SDL_Color fontColor, SDL_Color fontHighlightColor, SDL_Renderer *renderer) |
|
void | onInput (SDL_Event &event, Mix_Chunk *SelectMusic, std::string &optionSelected) |
|
void | render (SDL_Renderer *renderer) |
| renders the menu
|
|
void | updateHighlight (int prevIdx, int currIdx) |
| updates the highlight color of the option selected
|
|
Creates a menu. Just specify a font size, some dimensions, a list of options, font path and color, and a renderer. Additionally it keeps track of which option was selected.
◆ onInput()
void BaseMenu::onInput |
( |
SDL_Event & |
event, |
|
|
Mix_Chunk * |
SelectMusic, |
|
|
std::string & |
optionSelected |
|
) |
| |
- Parameters
-
event | reads the input event |
SelectMusic | the sound to be made when scrolling |
optionSelected | the variable that retains the option chosen by the end |
◆ render()
void BaseMenu::render |
( |
SDL_Renderer * |
renderer | ) |
|
renders the menu
- Parameters
-
◆ updateHighlight()
void BaseMenu::updateHighlight |
( |
int |
prevIdx, |
|
|
int |
currIdx |
|
) |
| |
updates the highlight color of the option selected
- Parameters
-
prevIdx | index of the previously chosen option |
currIdx | index of the currently chosent option |
The documentation for this class was generated from the following file: