options menu completed
This commit is contained in:
@@ -352,7 +352,7 @@ const color_t shdwTxtColor = {0x43, 0x43, 0x4F};
|
||||
#define DIFFICULTY_HARD 2
|
||||
|
||||
// Tipo de filtro
|
||||
#define FILTER_BILINEAL 0
|
||||
#define FILTER_NEAREST 0
|
||||
#define FILTER_LINEAL 1
|
||||
|
||||
#endif
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "utils.h"
|
||||
#include "director.h"
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#ifdef __MIPSEL__
|
||||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
@@ -31,13 +32,10 @@ Director::Director(std::string path)
|
||||
mOptions->fullScreenMode = 0;
|
||||
mOptions->windowSize = 3;
|
||||
mOptions->language = en_UK;
|
||||
mOptions->fullScreenMode = 0;
|
||||
mOptions->windowSize = 3;
|
||||
mOptions->language = en_UK;
|
||||
mOptions->difficulty = 0;
|
||||
mOptions->difficulty = DIFFICULTY_NORMAL;
|
||||
mOptions->player1Input = INPUT_USE_KEYBOARD;
|
||||
mOptions->player2Input = INPUT_USE_GAMECONTROLLER;
|
||||
mOptions->filter = 0;
|
||||
mOptions->filter = FILTER_NEAREST;
|
||||
mOptions->vSync = true;
|
||||
}
|
||||
|
||||
@@ -155,7 +153,7 @@ bool Director::initSDL()
|
||||
else
|
||||
{
|
||||
// Establece el filtro de la textura a nearest
|
||||
if (!SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "0"))
|
||||
if (!SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, std::to_string(mOptions->filter).c_str()))
|
||||
{
|
||||
printf("Warning: Nearest texture filtering not enabled!\n");
|
||||
}
|
||||
@@ -169,8 +167,12 @@ bool Director::initSDL()
|
||||
}
|
||||
else
|
||||
{
|
||||
// Crea un renderizador para la ventana con vsync
|
||||
mRenderer = SDL_CreateRenderer(mWindow, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
|
||||
// Crea un renderizador para la ventana. El vsync se activa en funcion de las opciones
|
||||
if (mOptions->vSync)
|
||||
mRenderer = SDL_CreateRenderer(mWindow, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
|
||||
else
|
||||
mRenderer = SDL_CreateRenderer(mWindow, -1, SDL_RENDERER_ACCELERATED);
|
||||
|
||||
if (mRenderer == NULL)
|
||||
{
|
||||
printf("Renderer could not be created!\nSDL Error: %s\n", SDL_GetError());
|
||||
@@ -420,7 +422,7 @@ bool Director::loadConfigFile()
|
||||
mOptions->difficulty = DIFFICULTY_NORMAL;
|
||||
mOptions->player1Input = INPUT_USE_KEYBOARD;
|
||||
mOptions->player2Input = INPUT_USE_GAMECONTROLLER;
|
||||
mOptions->filter = 0;
|
||||
mOptions->filter = FILTER_NEAREST;
|
||||
mOptions->vSync = true;
|
||||
|
||||
// Indicador de éxito en la carga
|
||||
|
||||
@@ -1613,40 +1613,48 @@ void Game::renderScoreBoard()
|
||||
mSpritePowerMeter->setSpriteClip(296, 184, (int)percent, 8);
|
||||
mSpritePowerMeter->render();
|
||||
*/
|
||||
const int offset1 = 163;
|
||||
const int offset2 = offset1 + 8;
|
||||
const int offset3 = offset2 + 8;
|
||||
//const int offset4 = offset3 + 8;
|
||||
const int offset1 = 162;
|
||||
const int offset2 = offset1 + 7;
|
||||
const int offset3 = offset2 + 7;
|
||||
const int offset4 = offset3 + 7;
|
||||
|
||||
const int offsetLeft = PLAY_AREA_LEFT + 45;
|
||||
const int offsetRight = PLAY_AREA_RIGHT - 45;
|
||||
|
||||
// PLAYER1 - SCORE
|
||||
mTextScoreBoard->writeCentered(PLAY_AREA_LEFT + 30, offset1, mLang->getText(53));
|
||||
mTextScoreBoard->writeCentered(PLAY_AREA_LEFT + 30, offset2, updateScoreText(mPlayer[0]->getScore()));
|
||||
mTextScoreBoard->writeCentered(offsetLeft, offset1, mLang->getText(53));
|
||||
mTextScoreBoard->writeCentered(offsetLeft, offset2, updateScoreText(mPlayer[0]->getScore()));
|
||||
|
||||
// PLAYER1 - MULT
|
||||
mTextScoreBoard->writeCentered(PLAY_AREA_LEFT + 30, offset3, mLang->getText(55) + std::to_string(mPlayer[0]->getScoreMultiplier()).substr(0, 3));
|
||||
mTextScoreBoard->writeCentered(offsetLeft, offset3, mLang->getText(55));
|
||||
mTextScoreBoard->writeCentered(offsetLeft, offset4, std::to_string(mPlayer[0]->getScoreMultiplier()).substr(0, 3));
|
||||
|
||||
if (mNumPlayers == 2)
|
||||
{
|
||||
// PLAYER2 - SCORE
|
||||
mTextScoreBoard->writeCentered(PLAY_AREA_RIGHT - 30, offset1, mLang->getText(54));
|
||||
mTextScoreBoard->writeCentered(PLAY_AREA_RIGHT - 30, offset2, updateScoreText(mPlayer[1]->getScore()));
|
||||
mTextScoreBoard->writeCentered(offsetRight, offset1, mLang->getText(54));
|
||||
mTextScoreBoard->writeCentered(offsetRight, offset2, updateScoreText(mPlayer[1]->getScore()));
|
||||
|
||||
// PLAYER2 - MULT
|
||||
mTextScoreBoard->writeCentered(PLAY_AREA_RIGHT - 30, offset3, mLang->getText(55) + std::to_string(mPlayer[1]->getScoreMultiplier()).substr(0, 3));
|
||||
mTextScoreBoard->writeCentered(offsetRight, offset3, mLang->getText(55));
|
||||
mTextScoreBoard->writeCentered(offsetRight, offset4, std::to_string(mPlayer[1]->getScoreMultiplier()).substr(0, 3));
|
||||
}
|
||||
else
|
||||
{
|
||||
// PLAYER2 - SCORE
|
||||
mTextScoreBoard->writeCentered(PLAY_AREA_RIGHT - 30, offset1, mLang->getText(54));
|
||||
mTextScoreBoard->writeCentered(PLAY_AREA_RIGHT - 30, offset2, "0000000");
|
||||
mTextScoreBoard->writeCentered(offsetRight, offset1, mLang->getText(54));
|
||||
mTextScoreBoard->writeCentered(offsetRight, offset2, "0000000");
|
||||
|
||||
// PLAYER2 - MULT
|
||||
mTextScoreBoard->writeCentered(PLAY_AREA_RIGHT - 30, offset3, mLang->getText(55) + "1.0");
|
||||
mTextScoreBoard->writeCentered(offsetRight, offset3, mLang->getText(55));
|
||||
mTextScoreBoard->writeCentered(offsetRight, offset4, "1.0");
|
||||
}
|
||||
|
||||
// STAGE
|
||||
mTextScoreBoard->writeCentered(PLAY_AREA_CENTER_X, offset1 - 1, mLang->getText(57) + std::to_string(mStage[mCurrentStage].number));
|
||||
mTextScoreBoard->writeCentered(PLAY_AREA_CENTER_X, offset1, mLang->getText(57) + std::to_string(mStage[mCurrentStage].number));
|
||||
|
||||
// POWER
|
||||
mSpritePowerMeter->setPosY(offset2);
|
||||
mSpritePowerMeter->setSpriteClip(256, 184, 40, 8);
|
||||
mSpritePowerMeter->render();
|
||||
const float percent = (mStage[mCurrentStage].currentPower * 40.0f) / mStage[mCurrentStage].powerToComplete;
|
||||
@@ -1654,7 +1662,8 @@ void Game::renderScoreBoard()
|
||||
mSpritePowerMeter->render();
|
||||
|
||||
// HI-SCORE
|
||||
mTextScoreBoard->writeCentered(PLAY_AREA_CENTER_X, offset3 + 1, mLang->getText(56) + updateScoreText(mHiScore));
|
||||
mTextScoreBoard->writeCentered(PLAY_AREA_CENTER_X, offset3, mLang->getText(56));
|
||||
mTextScoreBoard->writeCentered(PLAY_AREA_CENTER_X, offset4, updateScoreText(mHiScore));
|
||||
}
|
||||
|
||||
// Actualiza las variables del jugador
|
||||
|
||||
@@ -286,8 +286,10 @@ circle_t &Item::getCollider()
|
||||
// Alinea el circulo de colisión con la posición del objeto
|
||||
void Item::shiftColliders()
|
||||
{
|
||||
mCollider.x = int(mPosX + mCollider.r);
|
||||
mCollider.y = int(mPosY + mCollider.r);
|
||||
//mCollider.x = int(mPosX + mCollider.r);
|
||||
//mCollider.y = int(mPosY + mCollider.r);
|
||||
mCollider.x = int(mPosX + (mWidth / 2));
|
||||
mCollider.y = int(mPosY + (mHeight / 2));
|
||||
}
|
||||
|
||||
// Informa si el objeto ha colisionado con el suelo
|
||||
|
||||
@@ -266,17 +266,18 @@ void Title::init(bool demo, Uint8 subsection)
|
||||
mMenu.options->addItem(mLang->getText(59), 0, 5); // (0) DIFFICULTY
|
||||
mMenu.options->addItem(mLang->getText(62), 0, 0, true, false, true); // (1) PLAYER 1 CONTROLS
|
||||
mMenu.options->addItem(mLang->getText(69), 0, 0, false, false); // (2) KEYBOARD
|
||||
mMenu.options->addItem(mLang->getText(63), 0, 0, true, false, true); // (3) PLAYER 2 CONTROLS
|
||||
mMenu.options->addItem(mLang->getText(63), 0, 0, true, false, true); // (3) PLAYER 2 CONTROLS
|
||||
mMenu.options->addItem(mLang->getText(70), 0, 5, false, false); // (4) GAME CONTROLLER
|
||||
mMenu.options->addItem(mLang->getText(8), 0, 5); // (5) LANGUAGE
|
||||
mMenu.options->addItem(mLang->getText(58), 0, 0, true, false, true); // (6) DISPLAY MODE
|
||||
mMenu.options->addItem(mLang->getText(58), 0, 0, true, false, true); // (6) DISPLAY MODE
|
||||
mMenu.options->addItem(mLang->getText(4), 0, 0, false, false); // (7) WINDOWED
|
||||
mMenu.options->addItem(mLang->getText(7)); // (8) WINDOW SIZE
|
||||
mMenu.options->addItem(mLang->getText(60)); // (9) FILTER
|
||||
mMenu.options->addItem(mLang->getText(61), 0, 5); // (10) VSYNC
|
||||
mMenu.options->addItem(mLang->getText(9)); // (11) ACCEPT
|
||||
mMenu.options->addItem(mLang->getText(10)); // (12) CANCEL
|
||||
mMenu.options->setDefaultActionWhenCancel(9);
|
||||
mMenu.options->addItem(mLang->getText(2), 0, 5); // (11) HOW TO PLAY
|
||||
mMenu.options->addItem(mLang->getText(9)); // (12) ACCEPT
|
||||
mMenu.options->addItem(mLang->getText(10)); // (13) CANCEL
|
||||
mMenu.options->setDefaultActionWhenCancel(13);
|
||||
mMenu.options->setBackgroundColor(0x30, 0x30, 0x40, 192);
|
||||
mMenu.options->setSelectorColor(0xe5, 0x1c, 0x23, 255);
|
||||
mMenu.options->setSelectorTextColor(0xFF, 0xF1, 0x76);
|
||||
@@ -353,8 +354,12 @@ void Title::updateMenuLabels()
|
||||
break;
|
||||
}
|
||||
|
||||
i = 2;
|
||||
i++;
|
||||
// PLAYER 1 CONTROLS
|
||||
mMenu.options->setItemCaption(i, mLang->getText(62));
|
||||
|
||||
i++;
|
||||
// PLAYER 1 CONTROLS - OPTIONS
|
||||
switch (mOptions->player1Input)
|
||||
{
|
||||
case INPUT_USE_KEYBOARD:
|
||||
@@ -370,8 +375,12 @@ void Title::updateMenuLabels()
|
||||
break;
|
||||
}
|
||||
|
||||
i = 4;
|
||||
i++;
|
||||
// PLAYER 2 CONTROLS
|
||||
mMenu.options->setItemCaption(i, mLang->getText(63));
|
||||
|
||||
i++;
|
||||
// PLAYER 2 CONTROLS - OPTIONS
|
||||
switch (mOptions->player2Input)
|
||||
{
|
||||
case INPUT_USE_KEYBOARD:
|
||||
@@ -408,8 +417,12 @@ void Title::updateMenuLabels()
|
||||
break;
|
||||
}
|
||||
|
||||
i = 7;
|
||||
i++;
|
||||
// DISPLAY MODE
|
||||
mMenu.options->setItemCaption(i, mLang->getText(58));
|
||||
|
||||
i++;
|
||||
// DISPLAY MODE - OPTIONS
|
||||
switch (mOptions->fullScreenMode)
|
||||
{
|
||||
case 0:
|
||||
@@ -435,7 +448,7 @@ void Title::updateMenuLabels()
|
||||
|
||||
i++;
|
||||
// FILTER
|
||||
if (mOptions->filter == FILTER_BILINEAL)
|
||||
if (mOptions->filter == FILTER_LINEAL)
|
||||
mMenu.options->setItemCaption(i, mLang->getText(60) + ": " + mLang->getText(71)); // BILINEAL
|
||||
else
|
||||
mMenu.options->setItemCaption(i, mLang->getText(60) + ": " + mLang->getText(72)); // LINEAL
|
||||
@@ -447,6 +460,10 @@ void Title::updateMenuLabels()
|
||||
else
|
||||
mMenu.options->setItemCaption(i, mLang->getText(61) + ": " + mLang->getText(74)); // OFF
|
||||
|
||||
i++;
|
||||
// HOW TO PLAY
|
||||
mMenu.options->setItemCaption(i, mLang->getText(2));
|
||||
|
||||
i++;
|
||||
// ACCEPT
|
||||
mMenu.options->setItemCaption(i, mLang->getText(9)); // ACCEPT
|
||||
@@ -462,8 +479,7 @@ void Title::updateMenuLabels()
|
||||
mMenu.title->setItemCaption(0, mLang->getText(51)); // 1 PLAYER
|
||||
mMenu.title->setItemCaption(1, mLang->getText(52)); // 2 PLAYERS
|
||||
mMenu.title->setItemCaption(2, mLang->getText(1)); // OPTIONS
|
||||
//mMenu.title->setItemCaption(3, mLang->getText(2)); // HOW TO PLAY
|
||||
mMenu.title->setItemCaption(3, mLang->getText(3)); // QUIT
|
||||
mMenu.title->setItemCaption(3, mLang->getText(3)); // QUIT
|
||||
|
||||
mMenu.title->centerMenuOnX(SCREEN_CENTER_X);
|
||||
mMenu.title->centerMenuElementsOnX();
|
||||
@@ -707,13 +723,7 @@ section_t Title::run(Uint8 subsection)
|
||||
case 2: // OPTIONS
|
||||
mMenu.active = mMenu.options;
|
||||
mOptionsPrevious = *mOptions;
|
||||
//mOptions->fullScreenModePrevious = mOptions->fullScreenMode;
|
||||
//mOptions->windowSizePrevious = mOptions->windowSize;
|
||||
//mOptions->languagePrevious = mOptions->language;
|
||||
break;
|
||||
//case 3: // HOW TO PLAY
|
||||
// runInstructions(INSTRUCTIONS_MODE_MANUAL);
|
||||
// break;
|
||||
case 3: // QUIT
|
||||
mPostFade = 2;
|
||||
mFade->activateFade();
|
||||
@@ -773,10 +783,10 @@ section_t Title::run(Uint8 subsection)
|
||||
updateMenuLabels();
|
||||
break;
|
||||
case 9: // FILTER
|
||||
if (mOptions->filter == FILTER_BILINEAL)
|
||||
mOptions->filter = FILTER_LINEAL;
|
||||
if (mOptions->filter == FILTER_LINEAL)
|
||||
mOptions->filter = FILTER_NEAREST;
|
||||
else
|
||||
mOptions->filter = FILTER_BILINEAL;
|
||||
mOptions->filter = FILTER_LINEAL;
|
||||
updateMenuLabels();
|
||||
break;
|
||||
case 10: // VSYNC
|
||||
@@ -786,16 +796,16 @@ section_t Title::run(Uint8 subsection)
|
||||
mOptions->vSync = true;
|
||||
updateMenuLabels();
|
||||
break;
|
||||
case 11: // ACCEPT
|
||||
case 11: // HOW TO PLAY
|
||||
runInstructions(INSTRUCTIONS_MODE_MANUAL);
|
||||
break;
|
||||
case 12: // ACCEPT
|
||||
applyOptions();
|
||||
mMenu.active->reset();
|
||||
mMenu.active = mMenu.title;
|
||||
break;
|
||||
case 12: // CANCEL
|
||||
case 13: // CANCEL
|
||||
mOptions = &mOptionsPrevious;
|
||||
//mOptions->fullScreenMode = mOptions->fullScreenModePrevious;
|
||||
//mOptions->windowSize = mOptions->windowSizePrevious;
|
||||
//mOptions->language = mOptions->languagePrevious;
|
||||
updateMenuLabels();
|
||||
mMenu.active->reset();
|
||||
mMenu.active = mMenu.title;
|
||||
@@ -825,11 +835,17 @@ section_t Title::run(Uint8 subsection)
|
||||
// Dibuja los objetos
|
||||
if (mMenu.active->getName() != "OPTIONS")
|
||||
{
|
||||
// Bitmaps con el logo/titulo del juego
|
||||
mCoffeeBitmap->render();
|
||||
mCrisisBitmap->render();
|
||||
|
||||
// Texto con el copyright y versión
|
||||
mText2->writeDX(TXT_CENTER | TXT_SHADOW, SCREEN_CENTER_X, SCREEN_HEIGHT - (BLOCK * 2), TEXT_COPYRIGHT, 1, noColor, 1, shdwTxtColor);
|
||||
}
|
||||
|
||||
if (mMenuVisible == true)
|
||||
mMenu.active->render();
|
||||
|
||||
mDustBitmapR->animate(0);
|
||||
mDustBitmapL->animate(0);
|
||||
mDustBitmapR->render();
|
||||
@@ -839,9 +855,6 @@ section_t Title::run(Uint8 subsection)
|
||||
if ((mCounter % 50 > 14) && (mMenuVisible == false))
|
||||
mText->writeDX(TXT_CENTER | TXT_SHADOW, SCREEN_CENTER_X, PLAY_AREA_THIRD_QUARTER_Y + BLOCK, mLang->getText(23), 1, noColor, 1, shdwTxtColor);
|
||||
|
||||
// Texto con el copyright y versión
|
||||
mText2->writeDX(TXT_CENTER | TXT_SHADOW, SCREEN_CENTER_X, SCREEN_HEIGHT - (BLOCK * 2), TEXT_COPYRIGHT, 1, noColor, 1, shdwTxtColor);
|
||||
|
||||
// Fade
|
||||
mFade->render();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user