JKSV/source/ui/iconMenu.cpp
2024-09-11 17:47:57 -04:00

29 lines
946 B
C++

#include "ui/iconMenu.hpp"
#include "ui/ui.hpp"
ui::iconMenu::iconMenu(int x, int y, int maxScroll) :
menu(x, y, 128, 128, maxScroll) { }
void ui::iconMenu::addOpt(graphics::sdlTexture newOption)
{
//Parent class needs a text string to register newOpt. Might fix this later.
menu::addOption("ICON");
m_MenuOptions.push_back(newOption);
}
void ui::iconMenu::render(SDL_Texture *target)
{
// Update the color pulsing for the selection box
menu::updateColorPulse();
for(unsigned int i = 0; i < m_MenuOptions.size(); i++)
{
//This is special and hardcoded mostly
if(m_Selected == static_cast<int>(i))
{
ui::renderSelectionBox(target, m_X - 8, (m_Y + (i * m_RectHeight)) - 8, 144, 144, m_ColorMod);
}
//iconMenu is hardcoded for 128x128 icons
graphics::textureRenderStretched(m_MenuOptions[i].get(), target, m_X, m_Y + (i * m_RectHeight), 128, 128);
}
}