canvi de pc
This commit is contained in:
@@ -167,4 +167,23 @@ int EnterName::findIndex(char character) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Devuelve un nombre al azar
|
||||||
|
std::string EnterName::getRandomName()
|
||||||
|
{
|
||||||
|
static constexpr std::array<std::string_view, 8> NAMES = {
|
||||||
|
"BAL1", "TABE", "DOC", "MON", "SAM1", "JORDI", "JDES", "PEPE"};
|
||||||
|
return std::string(NAMES[rand() % NAMES.size()]);
|
||||||
|
}
|
||||||
|
// Obtiene el nombre final introducido
|
||||||
|
std::string EnterName::getFinalName()
|
||||||
|
{
|
||||||
|
auto name = trim(name_.substr(0, position_));
|
||||||
|
if (name.empty())
|
||||||
|
{
|
||||||
|
name = getRandomName();
|
||||||
|
}
|
||||||
|
name_ = name;
|
||||||
|
return name_;
|
||||||
|
}
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ public:
|
|||||||
void incIndex(); // Incrementa el índice del carácter en la lista
|
void incIndex(); // Incrementa el índice del carácter en la lista
|
||||||
void decIndex(); // Decrementa el índice del carácter en la lista
|
void decIndex(); // Decrementa el índice del carácter en la lista
|
||||||
|
|
||||||
std::string getFinalName() const { return trim(name_.substr(0, position_)); } // Obtiene el nombre final introducido
|
std::string getFinalName(); // Obtiene el nombre final introducido
|
||||||
std::string getCurrentName() const { return trim(name_); } // Obtiene el nombre actual en proceso
|
std::string getCurrentName() const { return trim(name_); } // Obtiene el nombre actual en proceso
|
||||||
|
|
||||||
int getPosition() const { return position_; } // Posición actual del carácter editado
|
int getPosition() const { return position_; } // Posición actual del carácter editado
|
||||||
bool getPositionOverflow() const { return position_overflow_; } // Indica si la posición excede el límite
|
bool getPositionOverflow() const { return position_overflow_; } // Indica si la posición excede el límite
|
||||||
@@ -37,4 +37,5 @@ private:
|
|||||||
void updateNameFromCharacterIndex(); // Actualiza "name_" según "character_index_"
|
void updateNameFromCharacterIndex(); // Actualiza "name_" según "character_index_"
|
||||||
void initCharacterIndex(const std::string &name); // Inicializa índices desde el nombre
|
void initCharacterIndex(const std::string &name); // Inicializa índices desde el nombre
|
||||||
int findIndex(char character) const; // Busca el índice de un carácter en "character_list_"
|
int findIndex(char character) const; // Busca el índice de un carácter en "character_list_"
|
||||||
|
static std::string getRandomName(); // Devuelve un nombre al azar
|
||||||
};
|
};
|
||||||
@@ -150,11 +150,6 @@ void Player::setInputEnteringName(InputAction input)
|
|||||||
break;
|
break;
|
||||||
case InputAction::START:
|
case InputAction::START:
|
||||||
last_enter_name_ = getRecordName();
|
last_enter_name_ = getRecordName();
|
||||||
if (last_enter_name_.empty())
|
|
||||||
{
|
|
||||||
const std::array<std::string, 8> NAMES = {"BAL1", "TABE", "DOC", "MON", "SAM1", "JORDI", "JDES", "PEPE"};
|
|
||||||
last_enter_name_ = NAMES.at(rand() % NAMES.size());
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ public:
|
|||||||
int getPosX() const { return static_cast<int>(pos_x_); }
|
int getPosX() const { return static_cast<int>(pos_x_); }
|
||||||
int getPosY() const { return pos_y_; }
|
int getPosY() const { return pos_y_; }
|
||||||
int getPowerUpCounter() const { return power_up_counter_; }
|
int getPowerUpCounter() const { return power_up_counter_; }
|
||||||
std::string getRecordName() const { return enter_name_ ? enter_name_->getFinalName() : ""; }
|
std::string getRecordName() const { return enter_name_ ? enter_name_->getFinalName() : "xxx"; }
|
||||||
int getScore() const { return score_; }
|
int getScore() const { return score_; }
|
||||||
int getScoreBoardPanel() const { return scoreboard_panel_; }
|
int getScoreBoardPanel() const { return scoreboard_panel_; }
|
||||||
int getWidth() const { return WIDTH_; }
|
int getWidth() const { return WIDTH_; }
|
||||||
|
|||||||
@@ -474,31 +474,6 @@ constexpr Color hsvToRgb(HSV hsv)
|
|||||||
static_cast<uint8_t>(roundf((b + m) * 255)));
|
static_cast<uint8_t>(roundf((b + m) * 255)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*ColorCycle generateMirroredCycle(Color base)
|
|
||||||
{
|
|
||||||
ColorCycle result{};
|
|
||||||
HSV baseHSV = rgbToHsv(base);
|
|
||||||
|
|
||||||
for (size_t i = 0; i < COLOR_CYCLE_SIZE; ++i)
|
|
||||||
{
|
|
||||||
float t = static_cast<float>(i) / (COLOR_CYCLE_SIZE - 1);
|
|
||||||
float hueShift = 25.0f * t; // reducido de 45 a 25
|
|
||||||
float satShift = 0.0f; // sin cambio de saturación
|
|
||||||
float valShift = 0.07f * sinf(t * 3.1415926f); // brillo más suave
|
|
||||||
|
|
||||||
HSV adjusted = {
|
|
||||||
fmodf(baseHSV.h + hueShift, 360.0f),
|
|
||||||
fminf(1.0f, fmaxf(0.0f, baseHSV.s + satShift)),
|
|
||||||
fminf(1.0f, fmaxf(0.0f, baseHSV.v + valShift))};
|
|
||||||
|
|
||||||
Color c = hsvToRgb(adjusted);
|
|
||||||
result[i] = c;
|
|
||||||
result[2 * COLOR_CYCLE_SIZE - 1 - i] = c; // espejo
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
ColorCycle generateMirroredCycle(Color base, ColorCycleStyle style)
|
ColorCycle generateMirroredCycle(Color base, ColorCycleStyle style)
|
||||||
{
|
{
|
||||||
ColorCycle result{};
|
ColorCycle result{};
|
||||||
|
|||||||
Reference in New Issue
Block a user