Primera build. Ja mostra algo per pantalla. Primer esqueleto del joc. Encara no te res mes
This commit is contained in:
@@ -36,7 +36,7 @@ Director::Director(std::string path)
|
||||
}
|
||||
|
||||
// Crea los objetos
|
||||
mInput = new Input(mFileList[53]);
|
||||
mInput = new Input(mFileList[11]);
|
||||
|
||||
// Inicializa SDL
|
||||
initSDL();
|
||||
@@ -123,8 +123,8 @@ bool Director::initSDL()
|
||||
bool success = true;
|
||||
|
||||
// Inicializa SDL
|
||||
//if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_GAMECONTROLLER | SDL_INIT_AUDIO) < 0)
|
||||
if (SDL_Init(SDL_INIT_EVERYTHING) < 0)
|
||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_GAMECONTROLLER | SDL_INIT_AUDIO) < 0)
|
||||
//if (SDL_Init(SDL_INIT_EVERYTHING) < 0)
|
||||
{
|
||||
printf("SDL could not initialize!\nSDL Error: %s\n", SDL_GetError());
|
||||
success = false;
|
||||
@@ -185,75 +185,24 @@ void Director::setFileList()
|
||||
for (int i = 0; i < MAX_FILE_LIST; i++)
|
||||
mFileList[i] = "";
|
||||
|
||||
// Ficheros binarios
|
||||
mFileList[0] = mExecutablePath + "/" + "../data/score.bin";
|
||||
mFileList[1] = mExecutablePath + "/" + "../data/demo.bin";
|
||||
mFileList[2] = mExecutablePath + "/" + "../data/config.bin";
|
||||
|
||||
// Musicas
|
||||
mFileList[3] = mExecutablePath + "/" + "../media/music/intro.ogg";
|
||||
mFileList[4] = mExecutablePath + "/" + "../media/music/playing.ogg";
|
||||
mFileList[5] = mExecutablePath + "/" + "../media/music/title.ogg";
|
||||
|
||||
// Sonidos
|
||||
mFileList[6] = mExecutablePath + "/" + "../media/sound/balloon.wav";
|
||||
mFileList[7] = mExecutablePath + "/" + "../media/sound/bubble1.wav";
|
||||
mFileList[8] = mExecutablePath + "/" + "../media/sound/bubble2.wav";
|
||||
mFileList[9] = mExecutablePath + "/" + "../media/sound/bubble3.wav";
|
||||
mFileList[10] = mExecutablePath + "/" + "../media/sound/bubble4.wav";
|
||||
mFileList[11] = mExecutablePath + "/" + "../media/sound/bullet.wav";
|
||||
mFileList[12] = mExecutablePath + "/" + "../media/sound/coffeeout.wav";
|
||||
mFileList[13] = mExecutablePath + "/" + "../media/sound/hiscore.wav";
|
||||
mFileList[14] = mExecutablePath + "/" + "../media/sound/itemdrop.wav";
|
||||
mFileList[15] = mExecutablePath + "/" + "../media/sound/itempickup.wav";
|
||||
mFileList[16] = mExecutablePath + "/" + "../media/sound/menu_cancel.wav";
|
||||
mFileList[17] = mExecutablePath + "/" + "../media/sound/menu_move.wav";
|
||||
mFileList[18] = mExecutablePath + "/" + "../media/sound/menu_select.wav";
|
||||
mFileList[19] = mExecutablePath + "/" + "../media/sound/player_collision.wav";
|
||||
mFileList[20] = mExecutablePath + "/" + "../media/sound/stage_change.wav";
|
||||
mFileList[21] = mExecutablePath + "/" + "../media/sound/title.wav";
|
||||
mFileList[22] = mExecutablePath + "/" + "../media/sound/clock.wav";
|
||||
mFileList[23] = mExecutablePath + "/" + "../media/sound/powerball.wav";
|
||||
|
||||
// Texturas
|
||||
mFileList[24] = mExecutablePath + "/" + "../media/gfx/balloon.png";
|
||||
mFileList[25] = mExecutablePath + "/" + "../media/gfx/bullet.png";
|
||||
mFileList[31] = mExecutablePath + "/" + "../media/gfx/game_bg.png";
|
||||
mFileList[32] = mExecutablePath + "/" + "../media/gfx/game_text.png";
|
||||
mFileList[33] = mExecutablePath + "/" + "../media/gfx/intro.png";
|
||||
mFileList[34] = mExecutablePath + "/" + "../media/gfx/items.png";
|
||||
mFileList[35] = mExecutablePath + "/" + "../media/gfx/logo.png";
|
||||
mFileList[37] = mExecutablePath + "/" + "../media/gfx/player1_body.png";
|
||||
mFileList[38] = mExecutablePath + "/" + "../media/gfx/player1_death.png";
|
||||
mFileList[39] = mExecutablePath + "/" + "../media/gfx/player1_legs.png";
|
||||
mFileList[40] = mExecutablePath + "/" + "../media/gfx/title.png";
|
||||
mFileList[41] = mExecutablePath + "/" + "../media/gfx/player1_head.png";
|
||||
mFileList[42] = mExecutablePath + "/" + "../media/gfx/player2_body.png";
|
||||
mFileList[43] = mExecutablePath + "/" + "../media/gfx/player2_death.png";
|
||||
mFileList[44] = mExecutablePath + "/" + "../media/gfx/player2_legs.png";
|
||||
mFileList[45] = mExecutablePath + "/" + "../media/gfx/player2_head.png";
|
||||
|
||||
// Fuentes
|
||||
mFileList[27] = mExecutablePath + "/" + "../media/font/8bithud.png";
|
||||
mFileList[46] = mExecutablePath + "/" + "../media/font/8bithud.txt";
|
||||
mFileList[28] = mExecutablePath + "/" + "../media/font/nokia.png";
|
||||
mFileList[54] = mExecutablePath + "/" + "../media/font/nokia_big2.png";
|
||||
mFileList[52] = mExecutablePath + "/" + "../media/font/nokia.txt";
|
||||
mFileList[56] = mExecutablePath + "/" + "../media/font/nokia2.png";
|
||||
mFileList[57] = mExecutablePath + "/" + "../media/font/nokia2.txt";
|
||||
mFileList[55] = mExecutablePath + "/" + "../media/font/nokia_big2.txt";
|
||||
mFileList[29] = mExecutablePath + "/" + "../media/font/smb2_big.png";
|
||||
mFileList[47] = mExecutablePath + "/" + "../media/font/smb2_big.txt";
|
||||
mFileList[30] = mExecutablePath + "/" + "../media/font/smb2.png";
|
||||
mFileList[48] = mExecutablePath + "/" + "../media/font/smb2.txt";
|
||||
mFileList[0] = mExecutablePath + "/" + "../media/font/8bithud.png";
|
||||
mFileList[1] = mExecutablePath + "/" + "../media/font/8bithud.txt";
|
||||
mFileList[2] = mExecutablePath + "/" + "../media/font/nokia.png";
|
||||
mFileList[3] = mExecutablePath + "/" + "../media/font/nokia.txt";
|
||||
mFileList[4] = mExecutablePath + "/" + "../media/font/nokia2.png";
|
||||
mFileList[5] = mExecutablePath + "/" + "../media/font/nokia2.txt";
|
||||
mFileList[6] = mExecutablePath + "/" + "../media/font/smb2.png";
|
||||
mFileList[7] = mExecutablePath + "/" + "../media/font/smb2.txt";
|
||||
|
||||
// Textos
|
||||
mFileList[49] = mExecutablePath + "/" + "../media/lang/es_ES.txt";
|
||||
mFileList[50] = mExecutablePath + "/" + "../media/lang/en_UK.txt";
|
||||
mFileList[51] = mExecutablePath + "/" + "../media/lang/ba_BA.txt";
|
||||
mFileList[8] = mExecutablePath + "/" + "../media/lang/es_ES.txt";
|
||||
mFileList[9] = mExecutablePath + "/" + "../media/lang/en_UK.txt";
|
||||
mFileList[10] = mExecutablePath + "/" + "../media/lang/ba_BA.txt";
|
||||
|
||||
// DATA
|
||||
mFileList[53] = mExecutablePath + "/" + "../data/gamecontrollerdb.txt";
|
||||
mFileList[11] = mExecutablePath + "/" + "../data/gamecontrollerdb.txt";
|
||||
mFileList[12] = mExecutablePath + "/" + "../data/config.bin";
|
||||
}
|
||||
|
||||
// Comprueba los ficheros del vector de ficheros que coinciden con una ruta dada
|
||||
@@ -335,7 +284,7 @@ bool Director::loadConfigFile()
|
||||
// Indicador de éxito en la carga
|
||||
bool success = true;
|
||||
|
||||
const std::string p = mFileList[2];
|
||||
const std::string p = mFileList[12];
|
||||
std::string filename = p.substr(p.find_last_of("\\/") + 1);
|
||||
SDL_RWops *file = SDL_RWFromFile(p.c_str(), "r+b");
|
||||
|
||||
@@ -404,7 +353,7 @@ bool Director::loadConfigFile()
|
||||
bool Director::saveConfigFile()
|
||||
{
|
||||
bool success = true;
|
||||
const std::string p = mFileList[2];
|
||||
const std::string p = mFileList[12];
|
||||
std::string filename = p.substr(p.find_last_of("\\/") + 1);
|
||||
SDL_RWops *file = SDL_RWFromFile(p.c_str(), "w+b");
|
||||
if (file != NULL)
|
||||
@@ -469,6 +418,9 @@ void Director::runTitle()
|
||||
|
||||
void Director::runGame()
|
||||
{
|
||||
mGame = new Game(mRenderer, mFileList, mLang, mInput);
|
||||
setSection(mGame->run());
|
||||
delete mGame;
|
||||
}
|
||||
|
||||
void Director::run()
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "utils.h"
|
||||
#include "input.h"
|
||||
#include "fade.h"
|
||||
#include "game.h"
|
||||
|
||||
#ifndef DIRECTOR_H
|
||||
#define DIRECTOR_H
|
||||
@@ -26,6 +27,7 @@ private:
|
||||
|
||||
Input *mInput; // Objeto Input para gestionar las entradas
|
||||
Lang *mLang; // Objeto para gestionar los textos en diferentes idiomas
|
||||
Game *mGame; // Objeto para la sección del juego
|
||||
|
||||
std::string mFileList[MAX_FILE_LIST]; // Vector con las rutas a los ficheros de recursos
|
||||
struct options_t *mOptions; // Variable con todas las opciones del programa
|
||||
|
||||
238
source/game.cpp
238
source/game.cpp
@@ -14,7 +14,7 @@ Game::Game(SDL_Renderer *renderer, std::string *filelist, Lang *lang, Input *inp
|
||||
mInput = input;
|
||||
mTextureText = new LTexture();
|
||||
|
||||
mText = new Text(mFileList[48], mTextureText, mRenderer);
|
||||
mText = new Text(mFileList[5], mTextureText, mRenderer);
|
||||
|
||||
mFade = new Fade(mRenderer);
|
||||
mEventHandler = new SDL_Event();
|
||||
@@ -47,238 +47,22 @@ void Game::init()
|
||||
// Carga los recursos
|
||||
loadMedia();
|
||||
|
||||
// Carga ficheros
|
||||
loadScoreFile();
|
||||
loadDemoFile();
|
||||
|
||||
mTicks = 0;
|
||||
mTicksSpeed = 15;
|
||||
|
||||
// Inicializa las variables
|
||||
switch (mDifficulty)
|
||||
{
|
||||
case DIFFICULTY_EASY:
|
||||
mDefaultEnemySpeed = BALLOON_SPEED_1;
|
||||
mDifficultyScoreMultiplier = 0.5f;
|
||||
break;
|
||||
|
||||
case DIFFICULTY_NORMAL:
|
||||
mDefaultEnemySpeed = BALLOON_SPEED_1;
|
||||
mDifficultyScoreMultiplier = 1.0f;
|
||||
break;
|
||||
|
||||
case DIFFICULTY_HARD:
|
||||
mDefaultEnemySpeed = BALLOON_SPEED_5;
|
||||
mDifficultyScoreMultiplier = 1.5f;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
mGameCompleted = false;
|
||||
mGameCompletedCounter = 0;
|
||||
mSection.name = PROG_SECTION_GAME;
|
||||
mSection.subsection = GAME_SECTION_PLAY_1P;
|
||||
mMenaceCurrent = 0;
|
||||
mMenaceThreshold = 0;
|
||||
mHiScoreAchieved = false;
|
||||
mCurrentStage = 0;
|
||||
mStageBitmapCounter = STAGE_COUNTER;
|
||||
mDeathCounter = DEATH_COUNTER;
|
||||
mExplosionTime = false;
|
||||
mRemainingExplosions = REMAINING_EXPLOSIONS;
|
||||
mRemainingExplosionsCounter = REMAINING_EXPLOSIONS_COUNTER;
|
||||
mTimeStopped = false;
|
||||
mTimeStoppedCounter = 0;
|
||||
mCounter = 0;
|
||||
mBalloonsPopped = 0;
|
||||
mLastEnemyDeploy = 0;
|
||||
mEnemyDeployCounter = 0;
|
||||
mEnemySpeed = mDefaultEnemySpeed;
|
||||
mEffect.flash = false;
|
||||
mEffect.shake = false;
|
||||
mEffect.shakeCounter = SHAKE_COUNTER;
|
||||
mHelper.needCoffee = false;
|
||||
mHelper.needCoffeeMachine = false;
|
||||
mHelper.needPowerBall = false;
|
||||
mHelper.counter = HELP_COUNTER;
|
||||
mHelper.itemPoints1Odds = ITEM_POINTS_1_DISK_ODDS;
|
||||
mHelper.itemPoints2Odds = ITEM_POINTS_2_GAVINA_ODDS;
|
||||
mHelper.itemPoints3Odds = ITEM_POINTS_3_PACMAR_ODDS;
|
||||
mHelper.itemClockOdds = ITEM_CLOCK_ODDS;
|
||||
mHelper.itemCoffeeOdds = ITEM_COFFEE_ODDS;
|
||||
mHelper.itemCoffeeMachineOdds = ITEM_COFFEE_MACHINE_ODDS;
|
||||
mPowerBallEnabled = false;
|
||||
mPowerBallCounter = 0;
|
||||
mCoffeeMachineEnabled = false;
|
||||
mPostFade = 0;
|
||||
}
|
||||
|
||||
if (mDemo.enabled)
|
||||
{
|
||||
int num = rand() % 2;
|
||||
if (num == 0)
|
||||
{
|
||||
mBalloonsPopped = 1000;
|
||||
mCurrentStage = 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
mBalloonsPopped = 1800;
|
||||
mCurrentStage = 6;
|
||||
}
|
||||
}
|
||||
// Carga los recursos necesarios para la sección 'Game'
|
||||
bool Game::loadMedia()
|
||||
{
|
||||
bool success = true;
|
||||
|
||||
initSin();
|
||||
initPaths();
|
||||
initEnemyFormations();
|
||||
initEnemyPools();
|
||||
initGameStages();
|
||||
// Texturas
|
||||
success &= loadTextureFromFile(mTextureText, mFileList[4], mRenderer);
|
||||
|
||||
// BORRAR
|
||||
//mStage[mCurrentStage].currentPower = mStage[mCurrentStage].powerToComplete - 10;
|
||||
|
||||
// Modo debug
|
||||
mDebug.enabled = false;
|
||||
mDebug.enemySet = 0;
|
||||
mDebug.gradR = mDebug.gradG = mDebug.gradB = 0;
|
||||
|
||||
// Modo demo
|
||||
mDemo.recording = false;
|
||||
mDemo.counter = 0;
|
||||
|
||||
// Iniciualiza el objeto para el fundido
|
||||
mFade->init(0x27, 0x27, 0x36);
|
||||
|
||||
// Inicializa el objeto con el menu de pausa
|
||||
mMenuPause->init("PAUSE", 0, 12 * BLOCK, MENU_BACKGROUND_SOLID);
|
||||
mMenuPause->addItem(mLang->getText(46), 2);
|
||||
mMenuPause->addItem(mLang->getText(47), 0);
|
||||
mMenuPause->setDefaultActionWhenCancel(0);
|
||||
mMenuPause->setBackgroundColor(0x29, 0x39, 0x41, 240);
|
||||
mMenuPause->setSelectorColor(0xFF, 0x7A, 0x00, 255);
|
||||
mMenuPause->setSelectorTextColor(0xFF, 0xFF, 0xFF);
|
||||
mMenuPause->centerMenuOnX(SCREEN_CENTER_X);
|
||||
mMenuPause->centerMenuElementsOnX();
|
||||
|
||||
// Inicializa el objeto con el menu de la pantalla de game over
|
||||
mMenuGameOver->init("GAME OVER", 0, PLAY_AREA_CENTER_Y + BLOCK * 4, MENU_BACKGROUND_TRANSPARENT);
|
||||
mMenuGameOver->addItem(mLang->getText(48), 2);
|
||||
mMenuGameOver->addItem(mLang->getText(49));
|
||||
mMenuGameOver->setDefaultActionWhenCancel(1);
|
||||
mMenuGameOver->setBackgroundColor(0, 0, 0, 255);
|
||||
mMenuGameOver->setSelectorColor(0x54, 0x6e, 0x7a, 255);
|
||||
mMenuGameOver->setSelectorColor(0x54, 0x6e, 0x7a, 0);
|
||||
mMenuGameOver->setSelectorTextColor(0xFF, 0xFF, 0xFF);
|
||||
mMenuGameOver->setSelectorTextColor(0xFF, 0xF1, 0x76);
|
||||
mMenuGameOver->setSelectorTextColor(0xFF, 0x7A, 0x00);
|
||||
mMenuGameOver->centerMenuOnX(SCREEN_CENTER_X);
|
||||
mMenuGameOver->centerMenuElementsOnX();
|
||||
|
||||
// Sprites
|
||||
mClouds1a->init(0, 0, 256, 52, -0.4f, 0.0f, 0.0f, 0.0f, mTextureGameBG, mRenderer);
|
||||
mClouds1a->setSpriteClip(256, 0, 256, 52);
|
||||
|
||||
mClouds1b->init(256, 0, 256, 52, -0.4f, 0.0f, 0.0f, 0.0f, mTextureGameBG, mRenderer);
|
||||
mClouds1b->setSpriteClip(256, 0, 256, 52);
|
||||
|
||||
mClouds2a->init(0, 52, 256, 32, -0.2f, 0.0f, 0.0f, 0.0f, mTextureGameBG, mRenderer);
|
||||
mClouds2a->setSpriteClip(256, 52, 256, 32);
|
||||
|
||||
mClouds2b->init(256, 52, 256, 32, -0.2f, 0.0f, 0.0f, 0.0f, mTextureGameBG, mRenderer);
|
||||
mClouds2b->setSpriteClip(256, 52, 256, 32);
|
||||
|
||||
mSpriteGrass->init(0, 85, SCREEN_WIDTH, 6, mTextureGameBG, mRenderer);
|
||||
mSpriteGrass->setPosY(154);
|
||||
|
||||
mSpriteScoreBoard->init(0, 160, SCREEN_WIDTH, 32, mTextureGameBG, mRenderer);
|
||||
mSpriteScoreBoard->setSpriteClip(0, 160, 256, 32);
|
||||
|
||||
mSpritePowerMeter->init(PLAY_AREA_CENTER_X - 20, 170, 40, 8, mTextureGameBG, mRenderer);
|
||||
mSpritePowerMeter->setSpriteClip(256, 192 - 8, 40, 8);
|
||||
|
||||
// Vector de jugadores
|
||||
if (mNumPlayers == 1)
|
||||
mPlayer[0]->init(PLAY_AREA_CENTER_X - 11, PLAY_AREA_BOTTOM - 24, mTexturePlayer1Legs, mTexturePlayer1Body, mTexturePlayer1Head, mTexturePlayer1Death, mRenderer);
|
||||
if (mNumPlayers == 2)
|
||||
{
|
||||
mPlayer[0]->init((PLAY_AREA_CENTER_FIRST_QUARTER_X * ((0 * 2) + 1)) - 11, PLAY_AREA_BOTTOM - 24, mTexturePlayer1Legs, mTexturePlayer1Body, mTexturePlayer1Head, mTexturePlayer1Death, mRenderer);
|
||||
mPlayer[1]->init((PLAY_AREA_CENTER_FIRST_QUARTER_X * ((1 * 2) + 1)) - 11, PLAY_AREA_BOTTOM - 24, mTexturePlayer2Legs, mTexturePlayer2Body, mTexturePlayer2Head, mTexturePlayer2Death, mRenderer);
|
||||
}
|
||||
|
||||
// Establece a cero todos los valores del vector de objetos globo
|
||||
resetBalloons();
|
||||
|
||||
// Con los globos creados, calcula el nivel de amenaza
|
||||
evaluateAndSetMenace();
|
||||
|
||||
// Establece a cero todos los valores del vector de objetos bala
|
||||
resetBullets();
|
||||
|
||||
// Establece a cero todos los valores del vector de objetos item
|
||||
resetItems();
|
||||
|
||||
// Establece a cero todos los valores del vector de objetos SmafrtSprite
|
||||
resetSmartSprites();
|
||||
|
||||
// Inicializa el bitmap de GetReady!
|
||||
mSpriteGetReady->init(0, PLAY_AREA_CENTER_Y - 10, 109, 20, mTextureGameText, mRenderer);
|
||||
mSpriteGetReady->setSpriteClip(0, 0, 109, 20);
|
||||
|
||||
// Inicializa el bitmap de 1000 puntos
|
||||
m1000Bitmap->init(mTextureGameText, mRenderer);
|
||||
m1000Bitmap->setPosX(0);
|
||||
m1000Bitmap->setPosY(0);
|
||||
m1000Bitmap->setWidth(26);
|
||||
m1000Bitmap->setHeight(9);
|
||||
m1000Bitmap->setVelX(0.0f);
|
||||
m1000Bitmap->setVelY(-0.5f);
|
||||
m1000Bitmap->setAccelX(0.0f);
|
||||
m1000Bitmap->setAccelY(-0.1f);
|
||||
m1000Bitmap->setSpriteClip(0, 20, 26, 9);
|
||||
m1000Bitmap->setEnabled(false);
|
||||
m1000Bitmap->setEnabledTimer(0);
|
||||
m1000Bitmap->setDestX(0);
|
||||
m1000Bitmap->setDestY(0);
|
||||
|
||||
// Inicializa el bitmap de 2500 puntos
|
||||
m2500Bitmap->init(mTextureGameText, mRenderer);
|
||||
m2500Bitmap->setPosX(0);
|
||||
m2500Bitmap->setPosY(0);
|
||||
m2500Bitmap->setWidth(28);
|
||||
m2500Bitmap->setHeight(9);
|
||||
m2500Bitmap->setVelX(0.0f);
|
||||
m2500Bitmap->setVelY(-0.5f);
|
||||
m2500Bitmap->setAccelX(0.0f);
|
||||
m2500Bitmap->setAccelY(-0.1f);
|
||||
m2500Bitmap->setSpriteClip(26, 20, 28, 9);
|
||||
m2500Bitmap->setEnabled(false);
|
||||
m2500Bitmap->setEnabledTimer(0);
|
||||
m2500Bitmap->setDestX(0);
|
||||
m2500Bitmap->setDestY(0);
|
||||
|
||||
// Inicializa el bitmap de 5000 puntos
|
||||
m5000Bitmap->init(mTextureGameText, mRenderer);
|
||||
m5000Bitmap->setPosX(0);
|
||||
m5000Bitmap->setPosY(0);
|
||||
m5000Bitmap->setWidth(28);
|
||||
m5000Bitmap->setHeight(9);
|
||||
m5000Bitmap->setVelX(0.0f);
|
||||
m5000Bitmap->setVelY(-0.5f);
|
||||
m5000Bitmap->setAccelX(0.0f);
|
||||
m5000Bitmap->setAccelY(-0.1f);
|
||||
m5000Bitmap->setSpriteClip(54, 20, 28, 9);
|
||||
m5000Bitmap->setEnabled(false);
|
||||
m5000Bitmap->setEnabledTimer(0);
|
||||
m5000Bitmap->setDestX(0);
|
||||
m5000Bitmap->setDestY(0);
|
||||
|
||||
// Los fondos
|
||||
mSpriteBackground->init(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, mTextureGameBG, mRenderer);
|
||||
mSpriteGradient->init(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, mTextureGameBG, mRenderer);
|
||||
mGradientRect[0] = {0, 192, SCREEN_WIDTH, SCREEN_HEIGHT};
|
||||
mGradientRect[1] = {256, 192, SCREEN_WIDTH, SCREEN_HEIGHT};
|
||||
mGradientRect[2] = {0, 384, SCREEN_WIDTH, SCREEN_HEIGHT};
|
||||
mGradientRect[3] = {256, 384, SCREEN_WIDTH, SCREEN_HEIGHT};
|
||||
return success;
|
||||
}
|
||||
|
||||
// Bucle para el juego
|
||||
@@ -310,9 +94,11 @@ section_t Game::run()
|
||||
}
|
||||
|
||||
// Limpia la pantalla
|
||||
SDL_SetRenderDrawColor(mRenderer, 0x00, 0x00, 0x00, 0xFF);
|
||||
SDL_SetRenderDrawColor(mRenderer, 0xAA, 0x44, 0x44, 0xFF);
|
||||
SDL_RenderClear(mRenderer);
|
||||
|
||||
mText->writeCentered(SCREEN_CENTER_X, SCREEN_CENTER_Y, "Pepe el Cazavampiros", 0);
|
||||
|
||||
// Actualiza la pantalla
|
||||
SDL_RenderPresent(mRenderer);
|
||||
}
|
||||
|
||||
@@ -28,17 +28,17 @@ private:
|
||||
Input *mInput; // Manejador de entrada
|
||||
Text *mText; // Fuente para los textos del juego
|
||||
Fade *mFade; // Objeto para renderizar fades
|
||||
|
||||
LTexture *mTextureText; // Textura para la fuente de texto Nokia grande
|
||||
|
||||
Uint32 mTicks; // Contador de ticks para ajustar la velocidad del programa
|
||||
Uint8 mTicksSpeed; // Velocidad a la que se repiten los bucles del programa
|
||||
|
||||
section_t mSection; // Seccion actual dentro del juego
|
||||
LTexture *mTextureText; // Textura para la fuente de texto Nokia grande
|
||||
Uint32 mTicks; // Contador de ticks para ajustar la velocidad del programa
|
||||
Uint8 mTicksSpeed; // Velocidad a la que se repiten los bucles del programa
|
||||
section_t mSection; // Seccion actual dentro del juego
|
||||
|
||||
// Inicializa las variables necesarias para la sección 'Game'
|
||||
void init();
|
||||
|
||||
// Carga los recursos necesarios para la sección 'Game'
|
||||
bool loadMedia();
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Game(SDL_Renderer *renderer, std::string *filelist, Lang *lang, Input *input);
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#include <SDL2/SDL.h>
|
||||
#ifdef __APPLE__
|
||||
#include "/Library/Frameworks/SDL2.framework/Versions/A/Headers/SDL.h"
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
#ifdef __MIPSEL__
|
||||
|
||||
Reference in New Issue
Block a user