Me voy a la cama. Sigo con la reescritura de todo el código
This commit is contained in:
@@ -15,18 +15,21 @@ Title::Title(SDL_Window *window, SDL_Renderer *renderer, Screen *screen, Input *
|
||||
// Reserva memoria para los punteros propios
|
||||
mEventHandler = new SDL_Event();
|
||||
mFade = new Fade(renderer);
|
||||
mTitleTexture = new LTexture(mRenderer);
|
||||
mItemsTexture = new LTexture(mRenderer);
|
||||
mCoffeeBitmap = new SmartSprite();
|
||||
mCrisisBitmap = new SmartSprite();
|
||||
mDustBitmapL = new AnimatedSprite();
|
||||
mDustBitmapR = new AnimatedSprite();
|
||||
|
||||
mTitleTexture = new LTexture(mRenderer, mAsset->get("title.png"));
|
||||
mItemsTexture = new LTexture(mRenderer, mAsset->get("items.png"));
|
||||
|
||||
mCoffeeBitmap = new SmartSprite(mTitleTexture, mRenderer);
|
||||
mCrisisBitmap = new SmartSprite(mTitleTexture, mRenderer);
|
||||
mDustBitmapL = new AnimatedSprite(mTitleTexture, mRenderer);
|
||||
mDustBitmapR = new AnimatedSprite(mTitleTexture, mRenderer);
|
||||
|
||||
mTile = new Sprite();
|
||||
mGradient = new Sprite();
|
||||
mText = new Text(mAsset->get("smb2.png"), mAsset->get("smb2.txt"), mRenderer);
|
||||
mText2 = new Text(mAsset->get("8bithud.png"), mAsset->get("8bithud.txt"), mRenderer);
|
||||
mMenu.title = new Menu(mRenderer, mText, mInput, mAsset);
|
||||
mMenu.options = new Menu(mRenderer, mText, mInput, mAsset);
|
||||
mMenu.title = new Menu(mRenderer, mInput, mAsset);
|
||||
mMenu.options = new Menu(mRenderer, mInput, mAsset);
|
||||
|
||||
// Crea la textura para el mosaico de fondo
|
||||
mBackground = SDL_CreateTexture(mRenderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, GAME_WIDTH * 2, GAME_HEIGHT * 2);
|
||||
@@ -67,14 +70,6 @@ Title::~Title()
|
||||
delete mItemsTexture;
|
||||
mItemsTexture = nullptr;
|
||||
|
||||
mTextTexture->unload();
|
||||
delete mTextTexture;
|
||||
mTextTexture = nullptr;
|
||||
|
||||
mTextTexture2->unload();
|
||||
delete mTextTexture2;
|
||||
mTextTexture2 = nullptr;
|
||||
|
||||
delete mCoffeeBitmap;
|
||||
mCoffeeBitmap = nullptr;
|
||||
|
||||
@@ -154,7 +149,6 @@ void Title::init(bool demo, Uint8 subsection)
|
||||
}
|
||||
|
||||
// Inicializa el bitmap de Coffee
|
||||
mCoffeeBitmap->init(mTitleTexture, mRenderer);
|
||||
mCoffeeBitmap->setId(0);
|
||||
mCoffeeBitmap->setIntroEvents(&mEvents[0]);
|
||||
mCoffeeBitmap->setPosX(45);
|
||||
@@ -172,7 +166,6 @@ void Title::init(bool demo, Uint8 subsection)
|
||||
mCoffeeBitmap->setDestY(11);
|
||||
|
||||
// Inicializa el bitmap de Crisis
|
||||
mCrisisBitmap->init(mTitleTexture, mRenderer);
|
||||
mCrisisBitmap->setId(1);
|
||||
mCrisisBitmap->setIntroEvents(&mEvents[0]);
|
||||
mCrisisBitmap->setPosX(60);
|
||||
@@ -190,14 +183,12 @@ void Title::init(bool demo, Uint8 subsection)
|
||||
mCrisisBitmap->setDestY(57);
|
||||
|
||||
// Inicializa el bitmap de DustRight
|
||||
mDustBitmapR->init(mTitleTexture, mRenderer);
|
||||
mDustBitmapR->setPosX(218);
|
||||
mDustBitmapR->setPosY(47);
|
||||
mDustBitmapR->setWidth(16);
|
||||
mDustBitmapR->setHeight(14);
|
||||
mDustBitmapR->setCurrentFrame(0);
|
||||
mDustBitmapR->setAnimationCounter(0);
|
||||
mDustBitmapR->setAnimationNumFrames(0, 7);
|
||||
mDustBitmapR->setAnimationSpeed(0, 8);
|
||||
mDustBitmapR->setAnimationLoop(0, false);
|
||||
mDustBitmapR->setAnimationFrames(0, 0, 160 + (mDustBitmapR->getWidth() * 0), 80, mDustBitmapR->getWidth(), mDustBitmapR->getHeight());
|
||||
@@ -209,14 +200,12 @@ void Title::init(bool demo, Uint8 subsection)
|
||||
mDustBitmapR->setAnimationFrames(0, 6, 160 + (mDustBitmapR->getWidth() * 6), 80, mDustBitmapR->getWidth(), mDustBitmapR->getHeight());
|
||||
|
||||
// Inicializa el bitmap de DustLeft
|
||||
mDustBitmapL->init(mTitleTexture, mRenderer);
|
||||
mDustBitmapL->setPosX(33);
|
||||
mDustBitmapL->setPosY(47);
|
||||
mDustBitmapL->setWidth(16);
|
||||
mDustBitmapL->setHeight(14);
|
||||
mDustBitmapL->setCurrentFrame(0);
|
||||
mDustBitmapL->setAnimationCounter(0);
|
||||
mDustBitmapL->setAnimationNumFrames(0, 7);
|
||||
mDustBitmapL->setAnimationSpeed(0, 8);
|
||||
mDustBitmapL->setAnimationLoop(0, false);
|
||||
mDustBitmapL->setAnimationFrames(0, 0, 160 + (mDustBitmapL->getWidth() * 0), 66, mDustBitmapL->getWidth(), mDustBitmapL->getHeight());
|
||||
@@ -233,7 +222,9 @@ void Title::init(bool demo, Uint8 subsection)
|
||||
|
||||
// Inicializa el vector de eventos de la pantalla de titulo
|
||||
for (int i = 0; i < TITLE_TOTAL_EVENTS; i++)
|
||||
{
|
||||
mEvents[i] = EVENT_WAITING;
|
||||
}
|
||||
|
||||
// Crea el mosaico de fondo del titulo
|
||||
createTiledBackground();
|
||||
@@ -246,22 +237,30 @@ void Title::init(bool demo, Uint8 subsection)
|
||||
|
||||
// Inicializa los valores del vector con los valores del seno
|
||||
for (int i = 0; i < 360; i++)
|
||||
{
|
||||
mSin[i] = SDL_sinf((float)i * 3.14f / 180.0f);
|
||||
}
|
||||
|
||||
// Inicializa los objetos de menu
|
||||
mMenu.title->init("TITLE", 0, (14 * BLOCK) + 4, MENU_BACKGROUND_TRANSPARENT);
|
||||
mMenu.title->setText(mAsset->get("smb2.png"), mAsset->get("smb2.txt"));
|
||||
mMenu.title->setName("TITLE");
|
||||
mMenu.title->setPos(0, (14 * BLOCK) + 4);
|
||||
mMenu.title->setBackgroundType(MENU_BACKGROUND_TRANSPARENT);
|
||||
mMenu.title->addItem(mLang->getText(51), 2); // 1 PLAYER
|
||||
mMenu.title->addItem(mLang->getText(52), 7); // 2 PLAYERS
|
||||
mMenu.title->addItem(mLang->getText(1), 7); // OPTIONS
|
||||
mMenu.title->addItem(mLang->getText(3)); // QUIT
|
||||
mMenu.title->setDefaultActionWhenCancel(3);
|
||||
mMenu.title->setBackgroundColor(0x30, 0x30, 0x40, 192);
|
||||
mMenu.title->setSelectorColor(0xe5, 0x1c, 0x23, 0);
|
||||
mMenu.title->setSelectorTextColor(0xFF, 0xB4, 0x00);
|
||||
mMenu.title->setBackgroundColor({0x30, 0x30, 0x40}, 192);
|
||||
mMenu.title->setSelectorColor({0xe5, 0x1c, 0x23}, 0);
|
||||
mMenu.title->setSelectorTextColor({0xFF, 0xB4, 0x00});
|
||||
mMenu.title->centerMenuOnX(SCREEN_CENTER_X);
|
||||
mMenu.title->centerMenuElementsOnX();
|
||||
|
||||
mMenu.options->init("OPTIONS", 0, BLOCK, MENU_BACKGROUND_TRANSPARENT);
|
||||
mMenu.options->setText(mAsset->get("smb2.png"), mAsset->get("smb2.txt"));
|
||||
mMenu.options->setName("OPTIONS");
|
||||
mMenu.options->setPos(0, BLOCK);
|
||||
mMenu.options->setBackgroundType(MENU_BACKGROUND_TRANSPARENT);
|
||||
mMenu.options->addItem(mLang->getText(59), 7); // (0) DIFFICULTY
|
||||
mMenu.options->addItem(mLang->getText(62), 2, true, false, true); // (1) PLAYER 1 CONTROLS
|
||||
mMenu.options->addItem(mLang->getText(69), 7, false, false); // (2) KEYBOARD
|
||||
@@ -277,9 +276,9 @@ void Title::init(bool demo, Uint8 subsection)
|
||||
mMenu.options->addItem(mLang->getText(9), 2); // (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);
|
||||
mMenu.options->setBackgroundColor({0x30, 0x30, 0x40}, 192);
|
||||
mMenu.options->setSelectorColor({0xe5, 0x1c, 0x23}, 255);
|
||||
mMenu.options->setSelectorTextColor({0xFF, 0xF1, 0x76});
|
||||
mMenu.options->centerMenuOnX(SCREEN_CENTER_X);
|
||||
mMenu.options->centerMenuOnY(SCREEN_CENTER_Y);
|
||||
|
||||
@@ -293,12 +292,6 @@ bool Title::loadMedia()
|
||||
// Indicador de éxito en la carga
|
||||
bool success = true;
|
||||
|
||||
// Texturas
|
||||
success &= loadTextureFromFile(mTitleTexture, mAsset->get("title.png"), mRenderer);
|
||||
success &= loadTextureFromFile(mItemsTexture, mAsset->get("items.png"), mRenderer);
|
||||
success &= loadTextureFromFile(mTextTexture, mAsset->get("smb2.png"), mRenderer);
|
||||
success &= loadTextureFromFile(mTextTexture2, mAsset->get("8bithud.png"), mRenderer);
|
||||
|
||||
// Sonidos
|
||||
mSound = JA_LoadSound(mAsset->get("title.wav").c_str());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user