working on options menu, almost done
This commit is contained in:
@@ -53,6 +53,7 @@ void Menu::init(std::string name, int x, int y, int backgroundType)
|
||||
mCenterX = x + ((SCREEN_WIDTH - x) / 2);
|
||||
mCenterY = y + ((SCREEN_HEIGHT - y) / 2);
|
||||
mWidestItem = 0;
|
||||
mColorGreyed = {128, 128, 128};
|
||||
|
||||
// Selector
|
||||
mSelector.origin = 0;
|
||||
@@ -275,10 +276,19 @@ void Menu::render()
|
||||
const color_t color = {mSelector.itemR, mSelector.itemG, mSelector.itemB};
|
||||
mText->writeColored(mItem[i].x, mItem[i].y, mItem[i].label, color);
|
||||
}
|
||||
else
|
||||
else if (mItem[i].selectable)
|
||||
{
|
||||
mText->write(mItem[i].x, mItem[i].y, mItem[i].label);
|
||||
}
|
||||
else if (mItem[i].greyed)
|
||||
{
|
||||
mText->writeColored(mItem[i].x, mItem[i].y, mItem[i].label, mColorGreyed);
|
||||
}
|
||||
//else // no selectable
|
||||
//{
|
||||
// const color_t color = {mSelector.itemR, mSelector.itemG, mSelector.itemB};
|
||||
// mText->writeColored(mItem[i].x, mItem[i].y, mItem[i].label, color);
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -502,3 +512,15 @@ void Menu::replaceElementsOnY()
|
||||
mItem[i].y = mItem[i - 1].y + mItem[i - 1].h + mItem[i - 1].hPaddingDown;
|
||||
}
|
||||
}
|
||||
|
||||
// Establece el estado seleccionable de un item
|
||||
void Menu::setSelectable(Uint8 index, bool value)
|
||||
{
|
||||
mItem[index].selectable = value;
|
||||
}
|
||||
|
||||
// Establece el estado agrisado de un item
|
||||
void Menu::setGreyed(Uint8 index, bool value)
|
||||
{
|
||||
mItem[index].greyed = value;
|
||||
}
|
||||
@@ -37,6 +37,7 @@ private:
|
||||
JA_Sound mSoundCancel; // Sonido al cancelar el menu
|
||||
JA_Sound mSoundMove; // Sonido al mover el selector
|
||||
Input *mInput; // Gestor de eventos de entrada de teclado o gamepad
|
||||
color_t mColorGreyed; // Color para los elementos agrisados
|
||||
|
||||
struct rectangle
|
||||
{
|
||||
@@ -184,6 +185,12 @@ public:
|
||||
|
||||
// Coloca el selector en una posición específica
|
||||
void setSelectorPos(Uint8 index);
|
||||
|
||||
// Establece el estado seleccionable de un item
|
||||
void setSelectable(Uint8 index, bool value);
|
||||
|
||||
// Establece el estado agrisado de un item
|
||||
void setGreyed(Uint8 index, bool value);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -754,6 +754,16 @@ section_t Title::run(Uint8 subsection)
|
||||
break;
|
||||
case 6: // Display mode
|
||||
switchFullScreenModeVar();
|
||||
if (mOptions->fullScreenMode != 0)
|
||||
{
|
||||
mMenu.options->setSelectable(8, false);
|
||||
mMenu.options->setGreyed(8, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
mMenu.options->setSelectable(8, true);
|
||||
mMenu.options->setGreyed(8, false);
|
||||
}
|
||||
updateMenuLabels();
|
||||
break;
|
||||
case 8: // Windows size
|
||||
@@ -878,11 +888,11 @@ void Title::runDemoGame()
|
||||
delete mDemoGame;
|
||||
}
|
||||
|
||||
// Modifica las opciones para los controles de los jugadores
|
||||
void Title::SwitchInputs(int value)
|
||||
{
|
||||
Uint8 temp;
|
||||
temp = mOptions->player1Input;
|
||||
mOptions->player1Input = mOptions->player2Input;
|
||||
mOptions->player2Input = temp;
|
||||
}
|
||||
// Modifica las opciones para los controles de los jugadores
|
||||
void Title::SwitchInputs(int value)
|
||||
{
|
||||
Uint8 temp;
|
||||
temp = mOptions->player1Input;
|
||||
mOptions->player1Input = mOptions->player2Input;
|
||||
mOptions->player2Input = temp;
|
||||
}
|
||||
Reference in New Issue
Block a user