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);
|
mCenterX = x + ((SCREEN_WIDTH - x) / 2);
|
||||||
mCenterY = y + ((SCREEN_HEIGHT - y) / 2);
|
mCenterY = y + ((SCREEN_HEIGHT - y) / 2);
|
||||||
mWidestItem = 0;
|
mWidestItem = 0;
|
||||||
|
mColorGreyed = {128, 128, 128};
|
||||||
|
|
||||||
// Selector
|
// Selector
|
||||||
mSelector.origin = 0;
|
mSelector.origin = 0;
|
||||||
@@ -275,10 +276,19 @@ void Menu::render()
|
|||||||
const color_t color = {mSelector.itemR, mSelector.itemG, mSelector.itemB};
|
const color_t color = {mSelector.itemR, mSelector.itemG, mSelector.itemB};
|
||||||
mText->writeColored(mItem[i].x, mItem[i].y, mItem[i].label, color);
|
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);
|
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);
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -501,4 +511,16 @@ void Menu::replaceElementsOnY()
|
|||||||
{
|
{
|
||||||
mItem[i].y = mItem[i - 1].y + mItem[i - 1].h + mItem[i - 1].hPaddingDown;
|
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 mSoundCancel; // Sonido al cancelar el menu
|
||||||
JA_Sound mSoundMove; // Sonido al mover el selector
|
JA_Sound mSoundMove; // Sonido al mover el selector
|
||||||
Input *mInput; // Gestor de eventos de entrada de teclado o gamepad
|
Input *mInput; // Gestor de eventos de entrada de teclado o gamepad
|
||||||
|
color_t mColorGreyed; // Color para los elementos agrisados
|
||||||
|
|
||||||
struct rectangle
|
struct rectangle
|
||||||
{
|
{
|
||||||
@@ -184,6 +185,12 @@ public:
|
|||||||
|
|
||||||
// Coloca el selector en una posición específica
|
// Coloca el selector en una posición específica
|
||||||
void setSelectorPos(Uint8 index);
|
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
|
#endif
|
||||||
|
|||||||
@@ -754,6 +754,16 @@ section_t Title::run(Uint8 subsection)
|
|||||||
break;
|
break;
|
||||||
case 6: // Display mode
|
case 6: // Display mode
|
||||||
switchFullScreenModeVar();
|
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();
|
updateMenuLabels();
|
||||||
break;
|
break;
|
||||||
case 8: // Windows size
|
case 8: // Windows size
|
||||||
@@ -878,11 +888,11 @@ void Title::runDemoGame()
|
|||||||
delete mDemoGame;
|
delete mDemoGame;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Modifica las opciones para los controles de los jugadores
|
// Modifica las opciones para los controles de los jugadores
|
||||||
void Title::SwitchInputs(int value)
|
void Title::SwitchInputs(int value)
|
||||||
{
|
{
|
||||||
Uint8 temp;
|
Uint8 temp;
|
||||||
temp = mOptions->player1Input;
|
temp = mOptions->player1Input;
|
||||||
mOptions->player1Input = mOptions->player2Input;
|
mOptions->player1Input = mOptions->player2Input;
|
||||||
mOptions->player2Input = temp;
|
mOptions->player2Input = temp;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user