Archimedes/Dash Da Capo!
All Classes Functions
Public Member Functions | List of all members
BaseMenu Class Reference

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>

Public Member Functions

 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
 

Detailed Description

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.

Member Function Documentation

◆ onInput()

void BaseMenu::onInput ( SDL_Event &  event,
Mix_Chunk *  SelectMusic,
std::string &  optionSelected 
)
Parameters
eventreads the input event
SelectMusicthe sound to be made when scrolling
optionSelectedthe variable that retains the option chosen by the end

◆ render()

void BaseMenu::render ( SDL_Renderer *  renderer)

renders the menu

Parameters
renderer

◆ updateHighlight()

void BaseMenu::updateHighlight ( int  prevIdx,
int  currIdx 
)

updates the highlight color of the option selected

Parameters
prevIdxindex of the previously chosen option
currIdxindex of the currently chosent option

The documentation for this class was generated from the following file: