jugant amb clang-tidy
This commit is contained in:
@@ -15,9 +15,9 @@ MenuRenderer::MenuRenderer(const ServiceMenu *menu_state, std::shared_ptr<Text>
|
||||
void MenuRenderer::render(const ServiceMenu *menu_state) {
|
||||
// Dibuja la sombra
|
||||
if (param.service_menu.drop_shadow) {
|
||||
SDL_FRect shadowRect = {rect_.x + 5, rect_.y + 5, rect_.w, rect_.h};
|
||||
SDL_FRect shadow_rect = {rect_.x + 5, rect_.y + 5, rect_.w, rect_.h};
|
||||
SDL_SetRenderDrawColor(Screen::get()->getRenderer(), 0, 0, 0, 64);
|
||||
SDL_RenderFillRect(Screen::get()->getRenderer(), &shadowRect);
|
||||
SDL_RenderFillRect(Screen::get()->getRenderer(), &shadow_rect);
|
||||
}
|
||||
|
||||
// Dibuja el fondo
|
||||
@@ -43,8 +43,8 @@ void MenuRenderer::render(const ServiceMenu *menu_state) {
|
||||
y = options_y_;
|
||||
const auto &option_pairs = menu_state->getOptionPairs();
|
||||
for (size_t i = 0; i < option_pairs.size(); ++i) {
|
||||
const bool is_selected = (i == menu_state->getSelectedIndex());
|
||||
const Color ¤t_color = is_selected ? param.service_menu.selected_color : param.service_menu.text_color;
|
||||
const bool IS_SELECTED = (i == menu_state->getSelectedIndex());
|
||||
const Color ¤t_color = IS_SELECTED ? param.service_menu.selected_color : param.service_menu.text_color;
|
||||
|
||||
if (menu_state->getCurrentGroupAlignment() == ServiceMenu::GroupAlignment::LEFT) {
|
||||
element_text_->writeColored(rect_.x + ServiceMenu::OPTIONS_HORIZONTAL_PADDING_, y, option_pairs.at(i).first, current_color, -2);
|
||||
@@ -177,17 +177,17 @@ int MenuRenderer::getMenuWidthForGroup(ServiceMenu::SettingsGroup group) const {
|
||||
}
|
||||
|
||||
void MenuRenderer::updateColorCounter() {
|
||||
static Uint64 lastUpdate = SDL_GetTicks();
|
||||
Uint64 currentTicks = SDL_GetTicks();
|
||||
if (currentTicks - lastUpdate >= 50) {
|
||||
static Uint64 last_update_ = SDL_GetTicks();
|
||||
Uint64 current_ticks = SDL_GetTicks();
|
||||
if (current_ticks - last_update_ >= 50) {
|
||||
color_counter_++;
|
||||
lastUpdate = currentTicks;
|
||||
last_update_ = current_ticks;
|
||||
}
|
||||
}
|
||||
|
||||
Color MenuRenderer::getAnimatedSelectedColor() {
|
||||
static auto colorCycle = generateMirroredCycle(param.service_menu.selected_color, ColorCycleStyle::HUE_WAVE);
|
||||
return colorCycle.at(color_counter_ % colorCycle.size());
|
||||
static auto color_cycle_ = generateMirroredCycle(param.service_menu.selected_color, ColorCycleStyle::HUE_WAVE);
|
||||
return color_cycle_.at(color_counter_ % color_cycle_.size());
|
||||
}
|
||||
|
||||
SDL_FRect MenuRenderer::setRect(SDL_FRect rect) {
|
||||
|
||||
Reference in New Issue
Block a user