Limpieza de código. Modificada la fuente nokiabig2. Puestas ayudas para los dos jugadores. Cambiado el tamaño del mensaje de juego completado
This commit is contained in:
@@ -227,26 +227,15 @@ bool Menu::increaseSelectorIndex()
|
||||
mSelector.h = mSelector.originH = getSelectorHeight(mSelector.index);
|
||||
|
||||
// Calcula cual es el siguiente elemento
|
||||
//if (mSelector.index < (mTotalItems - 1))
|
||||
//{
|
||||
// mSelector.index++;
|
||||
// while ((!mItem[mSelector.index].selectable) && (mSelector.index < (mTotalItems - 1)))
|
||||
// mSelector.index++;
|
||||
// success = true;
|
||||
//}
|
||||
|
||||
// Calcula cual es el siguiente elemento (versión con loop)
|
||||
//if (mSelector.index < (mTotalItems - 1))
|
||||
{
|
||||
++mSelector.index %= mTotalItems;
|
||||
while (!mItem[mSelector.index].selectable)
|
||||
//mSelector.index++;
|
||||
++mSelector.index %= mTotalItems;
|
||||
while (!mItem[mSelector.index].selectable)
|
||||
//mSelector.index++;
|
||||
++mSelector.index %= mTotalItems;
|
||||
success = true;
|
||||
}
|
||||
success = true;
|
||||
|
||||
// Establece las coordenadas y altura de destino
|
||||
if (success)
|
||||
{ // Establece las coordenadas y altura de destino
|
||||
{
|
||||
mSelector.targetY = mItem[mSelector.index].rect.y;
|
||||
mSelector.despY = (mSelector.targetY - mSelector.originY) / mSelector.numJumps;
|
||||
|
||||
@@ -271,33 +260,22 @@ bool Menu::decreaseSelectorIndex()
|
||||
mSelector.h = mSelector.originH = getSelectorHeight(mSelector.index);
|
||||
|
||||
// Calcula cual es el siguiente elemento
|
||||
//if (mSelector.index > 0)
|
||||
//{
|
||||
// mSelector.index--;
|
||||
// while ((!mItem[mSelector.index].selectable) && (mSelector.index > 0))
|
||||
// mSelector.index--;
|
||||
// success = true;
|
||||
//}
|
||||
|
||||
// Calcula cual es el siguiente elemento (versión con loop)
|
||||
//if (mSelector.index > 0)
|
||||
if (mSelector.index == 0)
|
||||
mSelector.index = mTotalItems;
|
||||
else
|
||||
mSelector.index--;
|
||||
while (!mItem[mSelector.index].selectable)
|
||||
{
|
||||
if (mSelector.index == 0)
|
||||
mSelector.index = mTotalItems;
|
||||
else
|
||||
mSelector.index--;
|
||||
while (!mItem[mSelector.index].selectable)
|
||||
{
|
||||
if (mSelector.index == 0)
|
||||
mSelector.index = mTotalItems;
|
||||
else
|
||||
mSelector.index--;
|
||||
}
|
||||
success = true;
|
||||
}
|
||||
success = true;
|
||||
|
||||
// Establece las coordenadas y altura de destino
|
||||
if (success)
|
||||
{ // Establece las coordenadas y altura de destino
|
||||
{
|
||||
mSelector.targetY = mItem[mSelector.index].rect.y;
|
||||
mSelector.despY = (mSelector.targetY - mSelector.originY) / mSelector.numJumps;
|
||||
|
||||
@@ -370,10 +348,6 @@ void Menu::render()
|
||||
mText->write(mItem[i].rect.x, mItem[i].rect.y, mItem[i].label);
|
||||
}
|
||||
}
|
||||
|
||||
//borrar
|
||||
//mText->write(0, 0, std::to_string(mSelector.h) + " " + std::to_string(mSelector.incH) + " " + std::to_string(mSelector.resizing));
|
||||
//mText->write(0, 8, std::to_string(mSelector.y) + " " + std::to_string(mSelector.despY) + " " + std::to_string(mSelector.moving));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -433,9 +407,6 @@ void Menu::centerMenuOnX(int value)
|
||||
mIsCenteredOnX = true;
|
||||
mCenterX = value;
|
||||
|
||||
// Actualiza el rectangulo de fondo para recalcular las dimensiones
|
||||
//setRectSize();
|
||||
|
||||
// Establece la nueva posición centrada en funcion del elemento más ancho
|
||||
mPosX = (value) - (findWidth() / 2);
|
||||
|
||||
@@ -453,9 +424,6 @@ void Menu::centerMenuOnY(int value)
|
||||
mIsCenteredOnY = true;
|
||||
mCenterY = value;
|
||||
|
||||
// Actualiza el rectangulo de fondo para recalcular las dimensiones
|
||||
//setRectSize();
|
||||
|
||||
// Establece la nueva posición centrada en funcion del elemento más ancho
|
||||
mPosY = (value) - (findHeight() / 2);
|
||||
|
||||
@@ -497,7 +465,6 @@ void Menu::addItem(std::string text, Uint8 hPaddingDown, bool selectable, bool g
|
||||
|
||||
setTotalItems(mTotalItems + 1);
|
||||
mCenterX = mPosX + (findWidth() / 2);
|
||||
//setSelectorPos(0);
|
||||
reorganize();
|
||||
}
|
||||
|
||||
@@ -520,16 +487,12 @@ void Menu::setDefaultActionWhenCancel(Uint8 item)
|
||||
void Menu::checkInput()
|
||||
{
|
||||
if (mInput->checkInput(INPUT_UP, REPEAT_FALSE))
|
||||
{
|
||||
if (decreaseSelectorIndex())
|
||||
JA_PlaySound(mSoundMove);
|
||||
}
|
||||
|
||||
if (mInput->checkInput(INPUT_DOWN, REPEAT_FALSE))
|
||||
{
|
||||
if (increaseSelectorIndex())
|
||||
JA_PlaySound(mSoundMove);
|
||||
}
|
||||
|
||||
if (mInput->checkInput(INPUT_ACCEPT, REPEAT_FALSE))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user