Cambiados muchos DEFINEs por variables de param
This commit is contained in:
@@ -1,7 +1,11 @@
|
|||||||
## GAME
|
## GAME
|
||||||
|
game.itemSize 20
|
||||||
game.width 320
|
game.width 320
|
||||||
game.height 256
|
game.height 256
|
||||||
game.itemSize 20
|
game.playArea.rect.x 0
|
||||||
|
game.playArea.rect.y 0
|
||||||
|
game.playArea.rect.w 320
|
||||||
|
game.playArea.rect.h 216
|
||||||
|
|
||||||
## FADE
|
## FADE
|
||||||
fade.numSquaresWidth 160
|
fade.numSquaresWidth 160
|
||||||
|
|||||||
@@ -8,19 +8,6 @@ Background::Background(SDL_Renderer *renderer, Asset *asset, param_t *param)
|
|||||||
this->asset = asset;
|
this->asset = asset;
|
||||||
this->param = param;
|
this->param = param;
|
||||||
|
|
||||||
// Inicializa variables
|
|
||||||
gradientNumber = 0;
|
|
||||||
alpha = 0;
|
|
||||||
cloudsSpeed = 0;
|
|
||||||
transition = 0;
|
|
||||||
counter = 0;
|
|
||||||
rect = {0, 0, param->game.width, param->game.height};
|
|
||||||
srcRect = {playArea.x, rect.h - playArea.h, playArea.w, playArea.h};
|
|
||||||
dstRect = {0, 0, playArea.w, playArea.h};
|
|
||||||
base = rect.h;
|
|
||||||
color = {param->background.attenuateColor.r, param->background.attenuateColor.g, param->background.attenuateColor.b};
|
|
||||||
alphaColorText = alphaColorTextTemp = param->background.attenuateAlpha;
|
|
||||||
|
|
||||||
// Carga las texturas
|
// Carga las texturas
|
||||||
buildingsTexture = new Texture(renderer, asset->get("game_buildings.png"));
|
buildingsTexture = new Texture(renderer, asset->get("game_buildings.png"));
|
||||||
topCloudsTexture = new Texture(renderer, asset->get("game_clouds1.png"));
|
topCloudsTexture = new Texture(renderer, asset->get("game_clouds1.png"));
|
||||||
@@ -28,6 +15,21 @@ Background::Background(SDL_Renderer *renderer, Asset *asset, param_t *param)
|
|||||||
grassTexture = new Texture(renderer, asset->get("game_grass.png"));
|
grassTexture = new Texture(renderer, asset->get("game_grass.png"));
|
||||||
gradientsTexture = new Texture(renderer, asset->get("game_sky_colors.png"));
|
gradientsTexture = new Texture(renderer, asset->get("game_sky_colors.png"));
|
||||||
|
|
||||||
|
// Inicializa variables
|
||||||
|
gradientNumber = 0;
|
||||||
|
alpha = 0;
|
||||||
|
cloudsSpeed = 0;
|
||||||
|
transition = 0;
|
||||||
|
counter = 0;
|
||||||
|
|
||||||
|
rect = {0, 0, gradientsTexture->getWidth() / 2, gradientsTexture->getHeight() / 2};
|
||||||
|
srcRect = {0, 0, 320, 240};
|
||||||
|
dstRect = {0, 0, 320, 240};
|
||||||
|
|
||||||
|
base = rect.h;
|
||||||
|
color = {param->background.attenuateColor.r, param->background.attenuateColor.g, param->background.attenuateColor.b};
|
||||||
|
alphaColorText = alphaColorTextTemp = param->background.attenuateAlpha;
|
||||||
|
|
||||||
gradientRect[0] = {0, 0, rect.w, rect.h};
|
gradientRect[0] = {0, 0, rect.w, rect.h};
|
||||||
gradientRect[1] = {rect.w, 0, rect.w, rect.h};
|
gradientRect[1] = {rect.w, 0, rect.w, rect.h};
|
||||||
gradientRect[2] = {0, rect.h, rect.w, rect.h};
|
gradientRect[2] = {0, rect.h, rect.w, rect.h};
|
||||||
@@ -42,15 +44,15 @@ Background::Background(SDL_Renderer *renderer, Asset *asset, param_t *param)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Crea los sprites
|
// Crea los sprites
|
||||||
const int clouds1y = base - 165;
|
const int topClouds_y = base - 165;
|
||||||
const int clouds2y = base - 101;
|
const int bottomClouds_y = base - 101;
|
||||||
const float clouds1speed = 0.1f;
|
const float topCloudsSpeed = 0.1f;
|
||||||
const float clouds2speed = 0.05f;
|
const float bottomCloudsSpeed = 0.05f;
|
||||||
topCloudsSprite_A = new MovingSprite(0, clouds1y, rect.w, topCloudsTexture->getHeight(), -clouds1speed, 0.0f, 0.0f, 0.0f, topCloudsTexture);
|
topCloudsSprite_A = new MovingSprite(0, topClouds_y, rect.w, topCloudsTexture->getHeight(), -topCloudsSpeed, 0.0f, 0.0f, 0.0f, topCloudsTexture);
|
||||||
topCloudsSprite_B = new MovingSprite(rect.w, clouds1y, rect.w, topCloudsTexture->getHeight(), -clouds1speed, 0.0f, 0.0f, 0.0f, topCloudsTexture);
|
topCloudsSprite_B = new MovingSprite(rect.w, topClouds_y, rect.w, topCloudsTexture->getHeight(), -topCloudsSpeed, 0.0f, 0.0f, 0.0f, topCloudsTexture);
|
||||||
|
|
||||||
bottomCloudsSprite_A = new MovingSprite(0, clouds2y, rect.w, bottomCloudsTexture->getHeight(), -clouds2speed, 0.0f, 0.0f, 0.0f, bottomCloudsTexture);
|
bottomCloudsSprite_A = new MovingSprite(0, bottomClouds_y, rect.w, bottomCloudsTexture->getHeight(), -bottomCloudsSpeed, 0.0f, 0.0f, 0.0f, bottomCloudsTexture);
|
||||||
bottomCloudsSprite_B = new MovingSprite(rect.w, clouds2y, rect.w, bottomCloudsTexture->getHeight(), -clouds2speed, 0.0f, 0.0f, 0.0f, bottomCloudsTexture);
|
bottomCloudsSprite_B = new MovingSprite(rect.w, bottomClouds_y, rect.w, bottomCloudsTexture->getHeight(), -bottomCloudsSpeed, 0.0f, 0.0f, 0.0f, bottomCloudsTexture);
|
||||||
|
|
||||||
buildingsSprite = new Sprite(0, 0, buildingsTexture->getWidth(), buildingsTexture->getHeight(), buildingsTexture);
|
buildingsSprite = new Sprite(0, 0, buildingsTexture->getWidth(), buildingsTexture->getHeight(), buildingsTexture);
|
||||||
gradientSprite = new Sprite(0, 0, rect.w, rect.h, gradientsTexture);
|
gradientSprite = new Sprite(0, 0, rect.w, rect.h, gradientsTexture);
|
||||||
@@ -233,13 +235,15 @@ void Background::setTransition(float value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Establece la posición del objeto
|
// Establece la posición del objeto
|
||||||
void Background::setPos(SDL_Rect rect)
|
void Background::setPos(SDL_Rect pos)
|
||||||
{
|
{
|
||||||
dstRect = rect;
|
this->dstRect = pos;
|
||||||
|
|
||||||
// Si cambian las medidas del destino, hay que cambiar las del origen para evitar deformar la imagen
|
// Si cambian las medidas del destino, hay que cambiar las del origen para evitar deformar la imagen
|
||||||
srcRect.w = rect.w;
|
this->srcRect.x = 0;
|
||||||
srcRect.h = rect.h;
|
this->srcRect.y = rect.h - pos.h;
|
||||||
|
this->srcRect.w = pos.w;
|
||||||
|
this->srcRect.h = pos.h;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ajusta el valor de la variable
|
// Ajusta el valor de la variable
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
solo el rectangulo definido en srcRect en la posición de la pantalla definida en
|
solo el rectangulo definido en srcRect en la posición de la pantalla definida en
|
||||||
dstRect.
|
dstRect.
|
||||||
|
|
||||||
|
Ambos rectangulos han de coincidir en tamaño y por definición, el punto comun es el inferior derecho el rectangulo.
|
||||||
|
|
||||||
Utiliza varios métodos para definir su comportamiento:
|
Utiliza varios métodos para definir su comportamiento:
|
||||||
- setCloudsSpeed(float value)
|
- setCloudsSpeed(float value)
|
||||||
Velocidad a la que se desplazan las nubes cada frame
|
Velocidad a la que se desplazan las nubes cada frame
|
||||||
@@ -27,11 +29,11 @@
|
|||||||
- setTransition(float value)
|
- setTransition(float value)
|
||||||
Porcentaje (entre 0.0f (textura actual) y 1.0f (textura siguiente)) para mostrar entre la textura de fondo actual y la siguiente
|
Porcentaje (entre 0.0f (textura actual) y 1.0f (textura siguiente)) para mostrar entre la textura de fondo actual y la siguiente
|
||||||
|
|
||||||
- setSrcDest(SDL_Rect value)
|
- setSrcRect(SDL_Rect value)
|
||||||
Rectangulo de la textura de fondo que se desea mostrar
|
Rectangulo de la textura de fondo que se desea mostrar
|
||||||
|
|
||||||
- setDstDest(SDL_Rect value)
|
- setDstRecr(SDL_Rect value)
|
||||||
Rectangulo de destino donde se mostrará el rectángulo antrior
|
Rectangulo de destino donde se mostrará el rectángulo antrior. Automaticamente modifica srcRect para coincidor en tamaño con el destino.
|
||||||
|
|
||||||
- setColor(color_t color)
|
- setColor(color_t color)
|
||||||
Establece el color de la textura de superposición
|
Establece el color de la textura de superposición
|
||||||
@@ -117,7 +119,7 @@ public:
|
|||||||
void render();
|
void render();
|
||||||
|
|
||||||
// Establece la posición del objeto
|
// Establece la posición del objeto
|
||||||
void setPos(SDL_Rect);
|
void setPos(SDL_Rect pos);
|
||||||
|
|
||||||
// Vuelve a cargar las texturas
|
// Vuelve a cargar las texturas
|
||||||
void reloadTextures();
|
void reloadTextures();
|
||||||
|
|||||||
@@ -285,9 +285,9 @@ void Balloon::allignTo(int x)
|
|||||||
{
|
{
|
||||||
posX = PLAY_AREA_LEFT + 1;
|
posX = PLAY_AREA_LEFT + 1;
|
||||||
}
|
}
|
||||||
else if ((posX + width) > PLAY_AREA_RIGHT)
|
else if ((posX + width) > param->game.playArea.rect.w)
|
||||||
{
|
{
|
||||||
posX = float(PLAY_AREA_RIGHT - width - 1);
|
posX = float(param->game.playArea.rect.w - width - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Posición X,Y del sprite
|
// Posición X,Y del sprite
|
||||||
@@ -347,7 +347,7 @@ void Balloon::move()
|
|||||||
posX += (velX * speed);
|
posX += (velX * speed);
|
||||||
|
|
||||||
// Si queda fuera de pantalla, corregimos su posición y cambiamos su sentido
|
// Si queda fuera de pantalla, corregimos su posición y cambiamos su sentido
|
||||||
if ((posX < PLAY_AREA_LEFT) || (posX + width > PLAY_AREA_RIGHT))
|
if ((posX < PLAY_AREA_LEFT) || (posX + width > param->game.playArea.rect.w))
|
||||||
{
|
{
|
||||||
// Corrige posición
|
// Corrige posición
|
||||||
posX -= (velX * speed);
|
posX -= (velX * speed);
|
||||||
@@ -385,10 +385,10 @@ void Balloon::move()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Si el globo se sale por la parte inferior
|
// Si el globo se sale por la parte inferior
|
||||||
if (posY + height > PLAY_AREA_BOTTOM)
|
if (posY + height > param->game.playArea.rect.h)
|
||||||
{
|
{
|
||||||
// Corrige
|
// Corrige
|
||||||
posY = PLAY_AREA_BOTTOM - height;
|
posY = param->game.playArea.rect.h - height;
|
||||||
|
|
||||||
// Invierte colocando una velocidad por defecto
|
// Invierte colocando una velocidad por defecto
|
||||||
velY = -defaultVelY;
|
velY = -defaultVelY;
|
||||||
@@ -508,7 +508,7 @@ void Balloon::updateState()
|
|||||||
posX += velX;
|
posX += velX;
|
||||||
|
|
||||||
// Comprueba no se salga por los laterales
|
// Comprueba no se salga por los laterales
|
||||||
if ((posX < PLAY_AREA_LEFT) || (posX > (PLAY_AREA_RIGHT - width)))
|
if ((posX < PLAY_AREA_LEFT) || (posX > (param->game.playArea.rect.w - width)))
|
||||||
{
|
{
|
||||||
// Corrige y cambia el sentido de la velocidad
|
// Corrige y cambia el sentido de la velocidad
|
||||||
posX -= velX;
|
posX -= velX;
|
||||||
|
|||||||
@@ -2,8 +2,10 @@
|
|||||||
#include "bullet.h"
|
#include "bullet.h"
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Bullet::Bullet(int x, int y, int kind, bool poweredUp, int owner, Texture *texture)
|
Bullet::Bullet(int x, int y, int kind, bool poweredUp, int owner, SDL_Rect *playArea, Texture *texture)
|
||||||
{
|
{
|
||||||
|
// Rectangulo con la zona de juego
|
||||||
|
this->playArea = playArea;
|
||||||
|
|
||||||
// Posición inicial del objeto
|
// Posición inicial del objeto
|
||||||
posX = x;
|
posX = x;
|
||||||
@@ -106,7 +108,7 @@ Uint8 Bullet::move()
|
|||||||
posX += velX;
|
posX += velX;
|
||||||
|
|
||||||
// Si el objeto se sale del area de juego por los laterales
|
// Si el objeto se sale del area de juego por los laterales
|
||||||
if ((posX < PLAY_AREA_LEFT - width) || (posX > PLAY_AREA_RIGHT))
|
if ((posX < PLAY_AREA_LEFT - width) || (posX > playArea->w))
|
||||||
{
|
{
|
||||||
// Se deshabilita
|
// Se deshabilita
|
||||||
kind = NO_KIND;
|
kind = NO_KIND;
|
||||||
|
|||||||
@@ -30,13 +30,14 @@ private:
|
|||||||
int kind; // Tipo de objeto
|
int kind; // Tipo de objeto
|
||||||
int owner; // Identificador del dueño del objeto
|
int owner; // Identificador del dueño del objeto
|
||||||
circle_t collider; // Circulo de colisión del objeto
|
circle_t collider; // Circulo de colisión del objeto
|
||||||
|
SDL_Rect *playArea; // Rectangulo con la zona de juego
|
||||||
|
|
||||||
// Alinea el circulo de colisión con el objeto
|
// Alinea el circulo de colisión con el objeto
|
||||||
void shiftColliders();
|
void shiftColliders();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
Bullet(int x, int y, int kind, bool poweredUp, int owner, Texture *texture);
|
Bullet(int x, int y, int kind, bool poweredUp, int owner, SDL_Rect *playArea, Texture *texture);
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~Bullet();
|
~Bullet();
|
||||||
|
|||||||
@@ -169,12 +169,26 @@ struct options_t
|
|||||||
std::vector<op_controller_t> controller; // Opciones con las asignaciones del mando para cada jugador
|
std::vector<op_controller_t> controller; // Opciones con las asignaciones del mando para cada jugador
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Posiciones dentro de un rectangulo
|
||||||
|
struct zone_t
|
||||||
|
{
|
||||||
|
SDL_Rect rect; // Rectangulo que define la zona
|
||||||
|
int centerX; // Anclaje al 50% del eje X
|
||||||
|
int firstQuarterX; // Anclaje al 25% del eje X
|
||||||
|
int thirdQuarterX; // Anclaje al 75% del eje X
|
||||||
|
int centerY; // Anclaje al 50% del eje Y
|
||||||
|
int firstQuarterY; // Anclaje al 25% del eje Y
|
||||||
|
int thirdQuarterY; // Anclaje al 75% del eje X
|
||||||
|
};
|
||||||
|
|
||||||
// param.game
|
// param.game
|
||||||
struct paramGame_t
|
struct paramGame_t
|
||||||
{
|
{
|
||||||
int width; // Ancho de la resolucion nativa del juego
|
int width; // Ancho de la resolucion nativa del juego
|
||||||
int height; // Alto de la resolucion nativa del juego
|
int height; // Alto de la resolucion nativa del juego
|
||||||
int itemSize; // Tamaño de los items del juego
|
int itemSize; // Tamaño de los items del juego
|
||||||
|
zone_t playArea; // Rectangulo con la posición de la zona de juego
|
||||||
|
zone_t gameArea; // Rectangulo con las dimensiones del juego
|
||||||
};
|
};
|
||||||
|
|
||||||
// param.fade
|
// param.fade
|
||||||
|
|||||||
@@ -5,35 +5,10 @@
|
|||||||
|
|
||||||
// Tamaño de bloque
|
// Tamaño de bloque
|
||||||
#define BLOCK 8
|
#define BLOCK 8
|
||||||
#define HALF_BLOCK BLOCK / 2
|
|
||||||
|
|
||||||
// Resolución nativa del juego
|
// Para mejor visibilidad
|
||||||
#define WIDTH 320
|
#define PLAY_AREA_LEFT 0
|
||||||
#define HEIGHT 240
|
#define PLAY_AREA_TOP 0
|
||||||
|
|
||||||
// Zona de juego
|
|
||||||
const SDL_Rect windowArea = {0, 0, WIDTH, HEIGHT};
|
|
||||||
const SDL_Rect playArea = {0, 0, WIDTH, 200};
|
|
||||||
const int PLAY_AREA_TOP = 0;
|
|
||||||
const int PLAY_AREA_BOTTOM = playArea.h;
|
|
||||||
const int PLAY_AREA_LEFT = 0;
|
|
||||||
const int PLAY_AREA_RIGHT = playArea.w;
|
|
||||||
const int PLAY_AREA_WIDTH = playArea.w;
|
|
||||||
const int PLAY_AREA_HEIGHT = playArea.h;
|
|
||||||
const int PLAY_AREA_CENTER_X = PLAY_AREA_LEFT + (PLAY_AREA_WIDTH / 2);
|
|
||||||
const int PLAY_AREA_CENTER_FIRST_QUARTER_X = (PLAY_AREA_WIDTH / 4);
|
|
||||||
const int PLAY_AREA_CENTER_THIRD_QUARTER_X = (PLAY_AREA_WIDTH / 4) * 3;
|
|
||||||
const int PLAY_AREA_CENTER_Y = PLAY_AREA_TOP + (PLAY_AREA_HEIGHT / 2);
|
|
||||||
const int PLAY_AREA_FIRST_QUARTER_Y = PLAY_AREA_HEIGHT / 4;
|
|
||||||
const int PLAY_AREA_THIRD_QUARTER_Y = (PLAY_AREA_HEIGHT / 4) * 3;
|
|
||||||
|
|
||||||
// Anclajes de pantalla
|
|
||||||
const int GAMECANVAS_CENTER_X = WIDTH / 2;
|
|
||||||
const int GAMECANVAS_FIRST_QUARTER_X = WIDTH / 4;
|
|
||||||
const int GAMECANVAS_THIRD_QUARTER_X = (WIDTH / 4) * 3;
|
|
||||||
const int GAMECANVAS_CENTER_Y = HEIGHT / 2;
|
|
||||||
const int GAMECANVAS_FIRST_QUARTER_Y = HEIGHT / 4;
|
|
||||||
const int GAMECANVAS_THIRD_QUARTER_Y = (HEIGHT / 4) * 3;
|
|
||||||
|
|
||||||
// Secciones del programa
|
// Secciones del programa
|
||||||
#define SECTION_PROG_LOGO 0
|
#define SECTION_PROG_LOGO 0
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ Director::Director(int argc, char *argv[])
|
|||||||
#ifdef RECORDING
|
#ifdef RECORDING
|
||||||
section->name = SECTION_PROG_GAME;
|
section->name = SECTION_PROG_GAME;
|
||||||
section->subsection = SUBSECTION_GAME_PLAY_1P;
|
section->subsection = SUBSECTION_GAME_PLAY_1P;
|
||||||
|
#elif DEBUG
|
||||||
|
section->name = SECTION_PROG_LOGO;
|
||||||
#else
|
#else
|
||||||
section->name = SECTION_PROG_LOGO;
|
section->name = SECTION_PROG_LOGO;
|
||||||
#endif
|
#endif
|
||||||
@@ -424,7 +426,7 @@ void Director::loadParams()
|
|||||||
{
|
{
|
||||||
param = new param_t;
|
param = new param_t;
|
||||||
|
|
||||||
loadParam(param, asset->get("param.txt"));
|
loadParamsFromFile(param, asset->get("param.txt"));
|
||||||
|
|
||||||
// Modifica las opciones desde el fichero de parametros
|
// Modifica las opciones desde el fichero de parametros
|
||||||
options->video.window.width = options->video.window.size * param->game.width;
|
options->video.window.width = options->video.window.size * param->game.width;
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
#include "enemy_formations.h"
|
#include "enemy_formations.h"
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
EnemyFormations::EnemyFormations()
|
EnemyFormations::EnemyFormations(param_t *param)
|
||||||
{
|
{
|
||||||
|
this->param = param;
|
||||||
initEnemyFormations();
|
initEnemyFormations();
|
||||||
initEnemyPools();
|
initEnemyPools();
|
||||||
initGameStages();
|
initGameStages();
|
||||||
@@ -16,22 +17,22 @@ EnemyFormations::~EnemyFormations()
|
|||||||
// Inicializa las formaciones enemigas
|
// Inicializa las formaciones enemigas
|
||||||
void EnemyFormations::initEnemyFormations()
|
void EnemyFormations::initEnemyFormations()
|
||||||
{
|
{
|
||||||
const int y4 = PLAY_AREA_TOP - BLOCK;
|
const int y4 = - BLOCK;
|
||||||
const int x4_0 = PLAY_AREA_LEFT;
|
const int x4_0 = PLAY_AREA_LEFT;
|
||||||
const int x4_100 = PLAY_AREA_RIGHT - BALLOON_WIDTH_4;
|
const int x4_100 = param->game.playArea.rect.w - BALLOON_WIDTH_4;
|
||||||
|
|
||||||
const int y3 = PLAY_AREA_TOP - BLOCK;
|
const int y3 = - BLOCK;
|
||||||
const int x3_0 = PLAY_AREA_LEFT;
|
const int x3_0 = PLAY_AREA_LEFT;
|
||||||
const int x3_100 = PLAY_AREA_RIGHT - BALLOON_WIDTH_3;
|
const int x3_100 = param->game.playArea.rect.w - BALLOON_WIDTH_3;
|
||||||
|
|
||||||
const int y2 = PLAY_AREA_TOP - BLOCK;
|
const int y2 = - BLOCK;
|
||||||
const int x2_0 = PLAY_AREA_LEFT;
|
const int x2_0 = PLAY_AREA_LEFT;
|
||||||
const int x2_100 = PLAY_AREA_RIGHT - BALLOON_WIDTH_2;
|
const int x2_100 = param->game.playArea.rect.w - BALLOON_WIDTH_2;
|
||||||
|
|
||||||
const int y1 = PLAY_AREA_TOP - BLOCK;
|
const int y1 = - BLOCK;
|
||||||
const int x1_0 = PLAY_AREA_LEFT;
|
const int x1_0 = PLAY_AREA_LEFT;
|
||||||
const int x1_50 = PLAY_AREA_CENTER_X - (BALLOON_WIDTH_1 / 2);
|
const int x1_50 = param->game.playArea.centerX - (BALLOON_WIDTH_1 / 2);
|
||||||
const int x1_100 = PLAY_AREA_RIGHT - BALLOON_WIDTH_1;
|
const int x1_100 = param->game.playArea.rect.w - BALLOON_WIDTH_1;
|
||||||
|
|
||||||
// Inicializa a cero las variables
|
// Inicializa a cero las variables
|
||||||
for (int i = 0; i < NUMBER_OF_ENEMY_FORMATIONS; i++)
|
for (int i = 0; i < NUMBER_OF_ENEMY_FORMATIONS; i++)
|
||||||
@@ -69,11 +70,11 @@ void EnemyFormations::initEnemyFormations()
|
|||||||
// #01 - Dos enemigos BALLOON4 uno a cada cuarto. Ambos van hacia el centro
|
// #01 - Dos enemigos BALLOON4 uno a cada cuarto. Ambos van hacia el centro
|
||||||
j = 1;
|
j = 1;
|
||||||
enemyFormation[j].numberOfEnemies = 2;
|
enemyFormation[j].numberOfEnemies = 2;
|
||||||
incX = PLAY_AREA_CENTER_X;
|
incX = param->game.playArea.centerX;
|
||||||
incTime = 0;
|
incTime = 0;
|
||||||
for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++)
|
for (int i = 0; i < enemyFormation[j].numberOfEnemies; i++)
|
||||||
{
|
{
|
||||||
enemyFormation[j].init[i].x = PLAY_AREA_CENTER_FIRST_QUARTER_X - (BALLOON_WIDTH_4 / 2) + (i * incX);
|
enemyFormation[j].init[i].x = param->game.playArea.firstQuarterX - (BALLOON_WIDTH_4 / 2) + (i * incX);
|
||||||
enemyFormation[j].init[i].y = y4;
|
enemyFormation[j].init[i].y = y4;
|
||||||
enemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE * (((i % 2) * 2) - 1);
|
enemyFormation[j].init[i].velX = BALLOON_VELX_NEGATIVE * (((i % 2) * 2) - 1);
|
||||||
enemyFormation[j].init[i].kind = BALLOON_4;
|
enemyFormation[j].init[i].kind = BALLOON_4;
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ private:
|
|||||||
stage_t stage[10]; // Variable con los datos de cada pantalla
|
stage_t stage[10]; // Variable con los datos de cada pantalla
|
||||||
enemyFormation_t enemyFormation[NUMBER_OF_ENEMY_FORMATIONS]; // Vector con todas las formaciones enemigas
|
enemyFormation_t enemyFormation[NUMBER_OF_ENEMY_FORMATIONS]; // Vector con todas las formaciones enemigas
|
||||||
enemyPool_t enemyPool[10]; // Variable con los diferentes conjuntos de formaciones enemigas
|
enemyPool_t enemyPool[10]; // Variable con los diferentes conjuntos de formaciones enemigas
|
||||||
|
param_t *param; // Puntero con todos los parametros del programa
|
||||||
|
|
||||||
// Inicializa las formaciones enemigas
|
// Inicializa las formaciones enemigas
|
||||||
void initEnemyFormations();
|
void initEnemyFormations();
|
||||||
@@ -58,7 +59,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
EnemyFormations();
|
EnemyFormations(param_t *param);
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~EnemyFormations();
|
~EnemyFormations();
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ Game::Game(int playerID, int currentStage, Screen *screen, Asset *asset, Lang *l
|
|||||||
scoreboard = new Scoreboard(renderer, asset, lang, options);
|
scoreboard = new Scoreboard(renderer, asset, lang, options);
|
||||||
background = new Background(renderer, asset, param);
|
background = new Background(renderer, asset, param);
|
||||||
explosions = new Explosions();
|
explosions = new Explosions();
|
||||||
enemyFormations = new EnemyFormations();
|
enemyFormations = new EnemyFormations(param);
|
||||||
|
|
||||||
// Carga los recursos
|
// Carga los recursos
|
||||||
loadMedia();
|
loadMedia();
|
||||||
@@ -42,6 +42,8 @@ Game::Game(int playerID, int currentStage, Screen *screen, Asset *asset, Lang *l
|
|||||||
loadDemoFile(asset->get("demo2.bin"), &this->demo.dataFile[index2]);
|
loadDemoFile(asset->get("demo2.bin"), &this->demo.dataFile[index2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
background->setPos(param->game.playArea.rect);
|
||||||
|
|
||||||
n1000Sprite = new SmartSprite(gameTextTexture);
|
n1000Sprite = new SmartSprite(gameTextTexture);
|
||||||
n2500Sprite = new SmartSprite(gameTextTexture);
|
n2500Sprite = new SmartSprite(gameTextTexture);
|
||||||
n5000Sprite = new SmartSprite(gameTextTexture);
|
n5000Sprite = new SmartSprite(gameTextTexture);
|
||||||
@@ -51,7 +53,7 @@ Game::Game(int playerID, int currentStage, Screen *screen, Asset *asset, Lang *l
|
|||||||
explosions->addTexture(3, explosionsTextures[2], explosionsAnimations[2]);
|
explosions->addTexture(3, explosionsTextures[2], explosionsAnimations[2]);
|
||||||
explosions->addTexture(4, explosionsTextures[3], explosionsAnimations[3]);
|
explosions->addTexture(4, explosionsTextures[3], explosionsAnimations[3]);
|
||||||
|
|
||||||
canvas = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, playArea.w, playArea.h);
|
canvas = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, param->game.playArea.rect.w, param->game.playArea.rect.h);
|
||||||
SDL_SetTextureBlendMode(canvas, SDL_BLENDMODE_BLEND);
|
SDL_SetTextureBlendMode(canvas, SDL_BLENDMODE_BLEND);
|
||||||
|
|
||||||
// Inicializa las variables necesarias para la sección 'Game'
|
// Inicializa las variables necesarias para la sección 'Game'
|
||||||
@@ -106,12 +108,12 @@ void Game::init(int playerID)
|
|||||||
players.clear();
|
players.clear();
|
||||||
|
|
||||||
// Crea los dos jugadores
|
// Crea los dos jugadores
|
||||||
Player *player1 = new Player((PLAY_AREA_CENTER_FIRST_QUARTER_X * ((0 * 2) + 1)) - 11, PLAY_AREA_BOTTOM - 30, playerTextures[0], playerAnimations);
|
Player *player1 = new Player((param->game.playArea.firstQuarterX * ((0 * 2) + 1)) - 11, param->game.playArea.rect.h - 30, ¶m->game.playArea.rect ,playerTextures[0], playerAnimations);
|
||||||
player1->setScoreBoardPanel(SCOREBOARD_LEFT_PANEL);
|
player1->setScoreBoardPanel(SCOREBOARD_LEFT_PANEL);
|
||||||
player1->setName(lang->getText(53));
|
player1->setName(lang->getText(53));
|
||||||
players.push_back(player1);
|
players.push_back(player1);
|
||||||
|
|
||||||
Player *player2 = new Player((PLAY_AREA_CENTER_FIRST_QUARTER_X * ((1 * 2) + 1)) - 11, PLAY_AREA_BOTTOM - 30, playerTextures[1], playerAnimations);
|
Player *player2 = new Player((param->game.playArea.firstQuarterX * ((1 * 2) + 1)) - 11, param->game.playArea.rect.h - 30, ¶m->game.playArea.rect, playerTextures[1], playerAnimations);
|
||||||
player2->setScoreBoardPanel(SCOREBOARD_RIGHT_PANEL);
|
player2->setScoreBoardPanel(SCOREBOARD_RIGHT_PANEL);
|
||||||
player2->setName(lang->getText(54));
|
player2->setName(lang->getText(54));
|
||||||
players.push_back(player2);
|
players.push_back(player2);
|
||||||
@@ -977,11 +979,11 @@ int Game::createBalloon(float x, int y, int kind, float velx, float speed, int c
|
|||||||
void Game::createPowerBall()
|
void Game::createPowerBall()
|
||||||
{
|
{
|
||||||
const int values = 6;
|
const int values = 6;
|
||||||
const int posY = PLAY_AREA_TOP - BLOCK;
|
const int posY = -BLOCK;
|
||||||
|
|
||||||
const int left = PLAY_AREA_LEFT;
|
const int left = PLAY_AREA_LEFT;
|
||||||
const int center = PLAY_AREA_CENTER_X - (BALLOON_WIDTH_4 / 2);
|
const int center = param->game.playArea.centerX - (BALLOON_WIDTH_4 / 2);
|
||||||
const int right = PLAY_AREA_RIGHT - BALLOON_WIDTH_4;
|
const int right = param->game.playArea.rect.w - BALLOON_WIDTH_4;
|
||||||
|
|
||||||
const float vpos = BALLOON_VELX_POSITIVE;
|
const float vpos = BALLOON_VELX_POSITIVE;
|
||||||
const float vneg = BALLOON_VELX_NEGATIVE;
|
const float vneg = BALLOON_VELX_NEGATIVE;
|
||||||
@@ -1466,7 +1468,7 @@ void Game::renderBullets()
|
|||||||
// Crea un objeto bala
|
// Crea un objeto bala
|
||||||
void Game::createBullet(int x, int y, int kind, bool poweredUp, int owner)
|
void Game::createBullet(int x, int y, int kind, bool poweredUp, int owner)
|
||||||
{
|
{
|
||||||
Bullet *b = new Bullet(x, y, kind, poweredUp, owner, bulletTexture);
|
Bullet *b = new Bullet(x, y, kind, poweredUp, owner, ¶m->game.playArea.rect, bulletTexture);
|
||||||
bullets.push_back(b);
|
bullets.push_back(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1591,7 +1593,7 @@ int Game::dropItem()
|
|||||||
// Crea un objeto item
|
// Crea un objeto item
|
||||||
void Game::createItem(int kind, float x, float y)
|
void Game::createItem(int kind, float x, float y)
|
||||||
{
|
{
|
||||||
Item *item = new Item(kind, x, y, itemTextures[kind - 1], itemAnimations[kind - 1]);
|
Item *item = new Item(kind, x, y, ¶m->game.playArea.rect, itemTextures[kind - 1], itemAnimations[kind - 1]);
|
||||||
items.push_back(item);
|
items.push_back(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1989,7 +1991,7 @@ void Game::render()
|
|||||||
screen->start();
|
screen->start();
|
||||||
|
|
||||||
// Copia la textura con la zona de juego a la pantalla
|
// Copia la textura con la zona de juego a la pantalla
|
||||||
SDL_RenderCopy(renderer, canvas, nullptr, &playArea);
|
SDL_RenderCopy(renderer, canvas, nullptr, ¶m->game.playArea.rect);
|
||||||
|
|
||||||
// Dibuja el marcador
|
// Dibuja el marcador
|
||||||
scoreboard->render();
|
scoreboard->render();
|
||||||
@@ -1997,12 +1999,6 @@ void Game::render()
|
|||||||
// Dibuja el separador del marcador de la zona de juego
|
// Dibuja el separador del marcador de la zona de juego
|
||||||
renderSeparator();
|
renderSeparator();
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
// text->write(0, 0, "P1 ALIVE: " + boolToString(players[0]->isAlive()));
|
|
||||||
// text->write(0, 10, "P2 ALIVE: " + boolToString(players[1]->isAlive()));
|
|
||||||
// text->write(0, 20, "ALL DEAD: " + boolToString(allPlayersAreWaiting()));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Dibuja el fade
|
// Dibuja el fade
|
||||||
fade->render();
|
fade->render();
|
||||||
|
|
||||||
@@ -2277,7 +2273,7 @@ void Game::renderMessages()
|
|||||||
// GetReady
|
// GetReady
|
||||||
if ((counter < STAGE_COUNTER) && (!demo.enabled))
|
if ((counter < STAGE_COUNTER) && (!demo.enabled))
|
||||||
{
|
{
|
||||||
textNokiaBig2->write((int)getReadyBitmapPath[counter], PLAY_AREA_CENTER_Y - 8, lang->getText(75), -2);
|
textNokiaBig2->write((int)getReadyBitmapPath[counter], param->game.playArea.centerY - 8, lang->getText(75), -2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Time Stopped
|
// Time Stopped
|
||||||
@@ -2285,7 +2281,7 @@ void Game::renderMessages()
|
|||||||
{
|
{
|
||||||
if ((timeStoppedCounter > 100) || (timeStoppedCounter % 10 > 4))
|
if ((timeStoppedCounter > 100) || (timeStoppedCounter % 10 > 4))
|
||||||
{
|
{
|
||||||
textNokia2->writeDX(TXT_CENTER, PLAY_AREA_CENTER_X, PLAY_AREA_FIRST_QUARTER_Y, lang->getText(36) + std::to_string(timeStoppedCounter / 10), -1, noColor, 1, shdwTxtColor);
|
textNokia2->writeDX(TXT_CENTER, param->game.playArea.centerX, param->game.playArea.firstQuarterY, lang->getText(36) + std::to_string(timeStoppedCounter / 10), -1, noColor, 1, shdwTxtColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (timeStoppedCounter > 100)
|
if (timeStoppedCounter > 100)
|
||||||
@@ -2323,13 +2319,13 @@ void Game::renderMessages()
|
|||||||
|
|
||||||
if (!gameCompleted)
|
if (!gameCompleted)
|
||||||
{ // Escribe el número de fases restantes
|
{ // Escribe el número de fases restantes
|
||||||
textNokiaBig2->writeDX(TXT_CENTER, PLAY_AREA_CENTER_X, stageBitmapPath[stageBitmapCounter], text, -2, noColor, 2, shdwTxtColor);
|
textNokiaBig2->writeDX(TXT_CENTER, param->game.playArea.centerX, stageBitmapPath[stageBitmapCounter], text, -2, noColor, 2, shdwTxtColor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // Escribe el texto de juego completado
|
{ // Escribe el texto de juego completado
|
||||||
text = lang->getText(50);
|
text = lang->getText(50);
|
||||||
textNokiaBig2->writeDX(TXT_CENTER, PLAY_AREA_CENTER_X, stageBitmapPath[stageBitmapCounter], text, -2, noColor, 1, shdwTxtColor);
|
textNokiaBig2->writeDX(TXT_CENTER, param->game.playArea.centerX, stageBitmapPath[stageBitmapCounter], text, -2, noColor, 1, shdwTxtColor);
|
||||||
textNokia2->writeDX(TXT_CENTER, PLAY_AREA_CENTER_X, stageBitmapPath[stageBitmapCounter] + textNokiaBig2->getCharacterSize() + 2, lang->getText(76), -1, noColor, 1, shdwTxtColor);
|
textNokia2->writeDX(TXT_CENTER, param->game.playArea.centerX, stageBitmapPath[stageBitmapCounter] + textNokiaBig2->getCharacterSize() + 2, lang->getText(76), -1, noColor, 1, shdwTxtColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2433,8 +2429,8 @@ void Game::initPaths()
|
|||||||
// Letrero de STAGE #
|
// Letrero de STAGE #
|
||||||
const int firstPart = STAGE_COUNTER / 4; // 50
|
const int firstPart = STAGE_COUNTER / 4; // 50
|
||||||
const int secondPart = firstPart * 3; // 150
|
const int secondPart = firstPart * 3; // 150
|
||||||
const int centerPoint = PLAY_AREA_CENTER_Y - (BLOCK * 2);
|
const int centerPoint = param->game.playArea.centerY - (BLOCK * 2);
|
||||||
const int distance = (PLAY_AREA_BOTTOM) - (PLAY_AREA_CENTER_Y - 16);
|
const int distance = (param->game.playArea.rect.h) - (param->game.playArea.centerY - 16);
|
||||||
|
|
||||||
for (int i = 0; i < STAGE_COUNTER; ++i)
|
for (int i = 0; i < STAGE_COUNTER; ++i)
|
||||||
{
|
{
|
||||||
@@ -2458,10 +2454,10 @@ void Game::initPaths()
|
|||||||
const int size = textNokiaBig2->lenght(lang->getText(75), -2);
|
const int size = textNokiaBig2->lenght(lang->getText(75), -2);
|
||||||
|
|
||||||
const float start1 = PLAY_AREA_LEFT - size;
|
const float start1 = PLAY_AREA_LEFT - size;
|
||||||
const float finish1 = PLAY_AREA_CENTER_X - (size / 2);
|
const float finish1 = param->game.playArea.centerX - (size / 2);
|
||||||
|
|
||||||
const float start2 = finish1;
|
const float start2 = finish1;
|
||||||
const float finish2 = PLAY_AREA_RIGHT;
|
const float finish2 = param->game.playArea.rect.w;
|
||||||
|
|
||||||
const float distance1 = finish1 - start1;
|
const float distance1 = finish1 - start1;
|
||||||
const float distance2 = finish2 - start2;
|
const float distance2 = finish2 - start2;
|
||||||
|
|||||||
@@ -35,8 +35,7 @@ HiScoreTable::HiScoreTable(Screen *screen, Asset *asset, Input *input, Lang *lan
|
|||||||
fadeMode = FADE_IN;
|
fadeMode = FADE_IN;
|
||||||
|
|
||||||
// Inicializa objetos
|
// Inicializa objetos
|
||||||
background->setSrcRect(windowArea);
|
background->setPos({0, 0, 320, 240});
|
||||||
background->setDstRect(windowArea);
|
|
||||||
background->setCloudsSpeed(-0.1f);
|
background->setCloudsSpeed(-0.1f);
|
||||||
background->setGradientNumber(1);
|
background->setGradientNumber(1);
|
||||||
background->setTransition(0.8f);
|
background->setTransition(0.8f);
|
||||||
@@ -115,7 +114,7 @@ void HiScoreTable::fillTexture()
|
|||||||
SDL_RenderClear(renderer);
|
SDL_RenderClear(renderer);
|
||||||
|
|
||||||
// Escribe el texto: Mejores puntuaciones
|
// Escribe el texto: Mejores puntuaciones
|
||||||
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, GAMECANVAS_CENTER_X, firstLine, lang->getText(42), 1, orangeColor, 1, shdwTxtColor);
|
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, param->game.gameArea.centerX, firstLine, lang->getText(42), 1, orangeColor, 1, shdwTxtColor);
|
||||||
|
|
||||||
// Escribe los nombres de la tabla de puntuaciones
|
// Escribe los nombres de la tabla de puntuaciones
|
||||||
for (int i = 0; i < maxNames; ++i)
|
for (int i = 0; i < maxNames; ++i)
|
||||||
@@ -130,7 +129,7 @@ void HiScoreTable::fillTexture()
|
|||||||
dots = dots + ".";
|
dots = dots + ".";
|
||||||
}
|
}
|
||||||
const std::string line = options->game.hiScoreTable[i].name + dots + score;
|
const std::string line = options->game.hiScoreTable[i].name + dots + score;
|
||||||
text->writeDX(TXT_CENTER | TXT_SHADOW, GAMECANVAS_CENTER_X, (i * spaceBetweenLines) + firstLine + spaceBetweenHeader, line, 1, orangeColor, 1, shdwTxtColor);
|
text->writeDX(TXT_CENTER | TXT_SHADOW, param->game.gameArea.centerX, (i * spaceBetweenLines) + firstLine + spaceBetweenHeader, line, 1, orangeColor, 1, shdwTxtColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cambia el destino de renderizado
|
// Cambia el destino de renderizado
|
||||||
|
|||||||
@@ -169,17 +169,17 @@ void Instructions::fillTexture()
|
|||||||
const int anchorItem = (param->game.width - (lenght + despX)) / 2;
|
const int anchorItem = (param->game.width - (lenght + despX)) / 2;
|
||||||
|
|
||||||
// Escribe el texto de las instrucciones
|
// Escribe el texto de las instrucciones
|
||||||
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, GAMECANVAS_CENTER_X, firstLine, lang->getText(11), 1, orangeColor, 1, shdwTxtColor);
|
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, param->game.gameArea.centerX, firstLine, lang->getText(11), 1, orangeColor, 1, shdwTxtColor);
|
||||||
|
|
||||||
const int anchor1 = firstLine + spacePostHeader;
|
const int anchor1 = firstLine + spacePostHeader;
|
||||||
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, GAMECANVAS_CENTER_X, anchor1 + spaceBetweenLines * 0, lang->getText(12), 1, noColor, 1, shdwTxtColor);
|
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, param->game.gameArea.centerX, anchor1 + spaceBetweenLines * 0, lang->getText(12), 1, noColor, 1, shdwTxtColor);
|
||||||
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, GAMECANVAS_CENTER_X, anchor1 + spaceBetweenLines * 1, lang->getText(13), 1, noColor, 1, shdwTxtColor);
|
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, param->game.gameArea.centerX, anchor1 + spaceBetweenLines * 1, lang->getText(13), 1, noColor, 1, shdwTxtColor);
|
||||||
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, GAMECANVAS_CENTER_X, anchor1 + spaceNewParagraph + spaceBetweenLines * 2, lang->getText(14), 1, noColor, 1, shdwTxtColor);
|
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, param->game.gameArea.centerX, anchor1 + spaceNewParagraph + spaceBetweenLines * 2, lang->getText(14), 1, noColor, 1, shdwTxtColor);
|
||||||
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, GAMECANVAS_CENTER_X, anchor1 + spaceNewParagraph + spaceBetweenLines * 3, lang->getText(15), 1, noColor, 1, shdwTxtColor);
|
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, param->game.gameArea.centerX, anchor1 + spaceNewParagraph + spaceBetweenLines * 3, lang->getText(15), 1, noColor, 1, shdwTxtColor);
|
||||||
|
|
||||||
// Escribe el texto de los objetos y sus puntos
|
// Escribe el texto de los objetos y sus puntos
|
||||||
const int anchor2 = anchor1 + spacePreHeader + spaceNewParagraph + spaceBetweenLines * 3;
|
const int anchor2 = anchor1 + spacePreHeader + spaceNewParagraph + spaceBetweenLines * 3;
|
||||||
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, GAMECANVAS_CENTER_X, anchor2, lang->getText(16), 1, orangeColor, 1, shdwTxtColor);
|
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, param->game.gameArea.centerX, anchor2, lang->getText(16), 1, orangeColor, 1, shdwTxtColor);
|
||||||
|
|
||||||
const int anchor3 = anchor2 + spacePostHeader;
|
const int anchor3 = anchor2 + spacePostHeader;
|
||||||
// const int anchor4 = anchor3 + ((param->game.itemSize + text->getCharacterSize()) / 2);
|
// const int anchor4 = anchor3 + ((param->game.itemSize + text->getCharacterSize()) / 2);
|
||||||
|
|||||||
@@ -33,13 +33,13 @@ Intro::Intro(Screen *screen, Asset *asset, Input *input, Lang *lang, param_t *pa
|
|||||||
ss->setWidth(128);
|
ss->setWidth(128);
|
||||||
ss->setHeight(96);
|
ss->setHeight(96);
|
||||||
ss->setEnabledCounter(20);
|
ss->setEnabledCounter(20);
|
||||||
ss->setDestX(GAMECANVAS_CENTER_X - 64);
|
ss->setDestX(param->game.gameArea.centerX - 64);
|
||||||
ss->setDestY(GAMECANVAS_FIRST_QUARTER_Y - 24);
|
ss->setDestY(param->game.gameArea.firstQuarterY - 24);
|
||||||
bitmaps.push_back(ss);
|
bitmaps.push_back(ss);
|
||||||
}
|
}
|
||||||
|
|
||||||
bitmaps[0]->setPosX(-128);
|
bitmaps[0]->setPosX(-128);
|
||||||
bitmaps[0]->setPosY(GAMECANVAS_FIRST_QUARTER_Y - 24);
|
bitmaps[0]->setPosY(param->game.gameArea.firstQuarterY - 24);
|
||||||
bitmaps[0]->setVelX(0.0f);
|
bitmaps[0]->setVelX(0.0f);
|
||||||
bitmaps[0]->setVelY(0.0f);
|
bitmaps[0]->setVelY(0.0f);
|
||||||
bitmaps[0]->setAccelX(0.6f);
|
bitmaps[0]->setAccelX(0.6f);
|
||||||
@@ -47,14 +47,14 @@ Intro::Intro(Screen *screen, Asset *asset, Input *input, Lang *lang, param_t *pa
|
|||||||
bitmaps[0]->setSpriteClip(0, 0, 128, 96);
|
bitmaps[0]->setSpriteClip(0, 0, 128, 96);
|
||||||
|
|
||||||
bitmaps[1]->setPosX(param->game.width);
|
bitmaps[1]->setPosX(param->game.width);
|
||||||
bitmaps[1]->setPosY(GAMECANVAS_FIRST_QUARTER_Y - 24);
|
bitmaps[1]->setPosY(param->game.gameArea.firstQuarterY - 24);
|
||||||
bitmaps[1]->setVelX(-1.0f);
|
bitmaps[1]->setVelX(-1.0f);
|
||||||
bitmaps[1]->setVelY(0.0f);
|
bitmaps[1]->setVelY(0.0f);
|
||||||
bitmaps[1]->setAccelX(-0.3f);
|
bitmaps[1]->setAccelX(-0.3f);
|
||||||
bitmaps[1]->setAccelY(0.0f);
|
bitmaps[1]->setAccelY(0.0f);
|
||||||
bitmaps[1]->setSpriteClip(128, 0, 128, 96);
|
bitmaps[1]->setSpriteClip(128, 0, 128, 96);
|
||||||
|
|
||||||
bitmaps[2]->setPosX(GAMECANVAS_CENTER_X - 64);
|
bitmaps[2]->setPosX(param->game.gameArea.centerX - 64);
|
||||||
bitmaps[2]->setPosY(-96);
|
bitmaps[2]->setPosY(-96);
|
||||||
bitmaps[2]->setVelX(0.0f);
|
bitmaps[2]->setVelX(0.0f);
|
||||||
bitmaps[2]->setVelY(3.0f);
|
bitmaps[2]->setVelY(3.0f);
|
||||||
@@ -63,7 +63,7 @@ Intro::Intro(Screen *screen, Asset *asset, Input *input, Lang *lang, param_t *pa
|
|||||||
bitmaps[2]->setSpriteClip(0, 96, 128, 96);
|
bitmaps[2]->setSpriteClip(0, 96, 128, 96);
|
||||||
bitmaps[2]->setEnabledCounter(250);
|
bitmaps[2]->setEnabledCounter(250);
|
||||||
|
|
||||||
bitmaps[3]->setPosX(GAMECANVAS_CENTER_X - 64);
|
bitmaps[3]->setPosX(param->game.gameArea.centerX - 64);
|
||||||
bitmaps[3]->setPosY(param->game.height);
|
bitmaps[3]->setPosY(param->game.height);
|
||||||
bitmaps[3]->setVelX(0.0f);
|
bitmaps[3]->setVelX(0.0f);
|
||||||
bitmaps[3]->setVelY(-0.7f);
|
bitmaps[3]->setVelY(-0.7f);
|
||||||
@@ -71,7 +71,7 @@ Intro::Intro(Screen *screen, Asset *asset, Input *input, Lang *lang, param_t *pa
|
|||||||
bitmaps[3]->setAccelY(0.0f);
|
bitmaps[3]->setAccelY(0.0f);
|
||||||
bitmaps[3]->setSpriteClip(128, 96, 128, 96);
|
bitmaps[3]->setSpriteClip(128, 96, 128, 96);
|
||||||
|
|
||||||
bitmaps[4]->setPosX(GAMECANVAS_CENTER_X - 64);
|
bitmaps[4]->setPosX(param->game.gameArea.centerX - 64);
|
||||||
bitmaps[4]->setPosY(-96);
|
bitmaps[4]->setPosY(-96);
|
||||||
bitmaps[4]->setVelX(0.0f);
|
bitmaps[4]->setVelX(0.0f);
|
||||||
bitmaps[4]->setVelY(3.0f);
|
bitmaps[4]->setVelY(3.0f);
|
||||||
@@ -80,7 +80,7 @@ Intro::Intro(Screen *screen, Asset *asset, Input *input, Lang *lang, param_t *pa
|
|||||||
bitmaps[4]->setSpriteClip(0, 192, 128, 96);
|
bitmaps[4]->setSpriteClip(0, 192, 128, 96);
|
||||||
|
|
||||||
bitmaps[5]->setPosX(param->game.width);
|
bitmaps[5]->setPosX(param->game.width);
|
||||||
bitmaps[5]->setPosY(GAMECANVAS_FIRST_QUARTER_Y - 24);
|
bitmaps[5]->setPosY(param->game.gameArea.firstQuarterY - 24);
|
||||||
bitmaps[5]->setVelX(-0.7f);
|
bitmaps[5]->setVelX(-0.7f);
|
||||||
bitmaps[5]->setVelY(0.0f);
|
bitmaps[5]->setVelY(0.0f);
|
||||||
bitmaps[5]->setAccelX(0.0f);
|
bitmaps[5]->setAccelX(0.0f);
|
||||||
@@ -138,7 +138,7 @@ Intro::Intro(Screen *screen, Asset *asset, Input *input, Lang *lang, param_t *pa
|
|||||||
|
|
||||||
for (auto text : texts)
|
for (auto text : texts)
|
||||||
{
|
{
|
||||||
text->center(GAMECANVAS_CENTER_X);
|
text->center(param->game.gameArea.centerX);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,12 @@
|
|||||||
#include "item.h"
|
#include "item.h"
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Item::Item(int kind, float x, float y, Texture *texture, std::vector<std::string> *animation)
|
Item::Item(int kind, float x, float y, SDL_Rect *playArea, Texture *texture, std::vector<std::string> *animation)
|
||||||
{
|
{
|
||||||
sprite = new AnimatedSprite(texture, "", animation);
|
sprite = new AnimatedSprite(texture, "", animation);
|
||||||
|
|
||||||
this->kind = kind;
|
this->kind = kind;
|
||||||
|
this->playArea = playArea;
|
||||||
enabled = true;
|
enabled = true;
|
||||||
timeToLive = 600;
|
timeToLive = 600;
|
||||||
accelX = 0.0f;
|
accelX = 0.0f;
|
||||||
@@ -16,8 +17,8 @@ Item::Item(int kind, float x, float y, Texture *texture, std::vector<std::string
|
|||||||
{
|
{
|
||||||
width = 28;
|
width = 28;
|
||||||
height = 37;
|
height = 37;
|
||||||
posX = (((int)x + (PLAY_AREA_WIDTH / 2)) % (PLAY_AREA_WIDTH - width - 5)) + 2;
|
posX = (((int)x + (playArea->w / 2)) % (playArea->w - width - 5)) + 2;
|
||||||
posY = PLAY_AREA_TOP - height;
|
posY = -height;
|
||||||
velX = 0.0f;
|
velX = 0.0f;
|
||||||
velY = -0.1f;
|
velY = -0.1f;
|
||||||
accelY = 0.1f;
|
accelY = 0.1f;
|
||||||
@@ -55,9 +56,9 @@ void Item::allignTo(int x)
|
|||||||
{
|
{
|
||||||
posX = PLAY_AREA_LEFT + 1;
|
posX = PLAY_AREA_LEFT + 1;
|
||||||
}
|
}
|
||||||
else if ((posX + width) > PLAY_AREA_RIGHT)
|
else if ((posX + width) > playArea->w)
|
||||||
{
|
{
|
||||||
posX = float(PLAY_AREA_RIGHT - width - 1);
|
posX = float(playArea->w - width - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Posición X,Y del sprite
|
// Posición X,Y del sprite
|
||||||
@@ -98,7 +99,7 @@ void Item::move()
|
|||||||
velY += accelY;
|
velY += accelY;
|
||||||
|
|
||||||
// Si queda fuera de pantalla, corregimos su posición y cambiamos su sentido
|
// Si queda fuera de pantalla, corregimos su posición y cambiamos su sentido
|
||||||
if ((posX < PLAY_AREA_LEFT) || (posX + width > PLAY_AREA_RIGHT))
|
if ((posX < PLAY_AREA_LEFT) || (posX + width > playArea->w))
|
||||||
{
|
{
|
||||||
// Corregir posición
|
// Corregir posición
|
||||||
posX -= velX;
|
posX -= velX;
|
||||||
@@ -118,7 +119,7 @@ void Item::move()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Si el objeto se sale por la parte inferior
|
// Si el objeto se sale por la parte inferior
|
||||||
if (posY + height > PLAY_AREA_BOTTOM)
|
if (posY + height > playArea->w)
|
||||||
{
|
{
|
||||||
// Corrige
|
// Corrige
|
||||||
posY -= velY;
|
posY -= velY;
|
||||||
@@ -128,7 +129,7 @@ void Item::move()
|
|||||||
velX = 0;
|
velX = 0;
|
||||||
accelX = 0;
|
accelX = 0;
|
||||||
accelY = 0;
|
accelY = 0;
|
||||||
posY = PLAY_AREA_BOTTOM - height;
|
posY = playArea->w - height;
|
||||||
if (kind == ITEM_COFFEE_MACHINE)
|
if (kind == ITEM_COFFEE_MACHINE)
|
||||||
{
|
{
|
||||||
floorCollision = true;
|
floorCollision = true;
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ private:
|
|||||||
int kind; // Especifica el tipo de objeto que es
|
int kind; // Especifica el tipo de objeto que es
|
||||||
bool enabled; // Especifica si el objeto está habilitado
|
bool enabled; // Especifica si el objeto está habilitado
|
||||||
circle_t collider; // Circulo de colisión del objeto
|
circle_t collider; // Circulo de colisión del objeto
|
||||||
|
SDL_Rect *playArea; // Rectangulo con la zona de juego
|
||||||
|
|
||||||
// Alinea el circulo de colisión con la posición del objeto
|
// Alinea el circulo de colisión con la posición del objeto
|
||||||
void shiftColliders();
|
void shiftColliders();
|
||||||
@@ -43,7 +44,7 @@ public:
|
|||||||
Uint16 timeToLive; // Temporizador con el tiempo que el objeto está presente
|
Uint16 timeToLive; // Temporizador con el tiempo que el objeto está presente
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Item(int kind, float x, float y, Texture *texture, std::vector<std::string> *animation);
|
Item(int kind, float x, float y, SDL_Rect *playArea, Texture *texture, std::vector<std::string> *animation);
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~Item();
|
~Item();
|
||||||
|
|||||||
@@ -5,20 +5,26 @@
|
|||||||
// Asigna variables a partir de dos cadenas
|
// Asigna variables a partir de dos cadenas
|
||||||
bool setOptions(param_t *param, std::string var, std::string value);
|
bool setOptions(param_t *param, std::string var, std::string value);
|
||||||
|
|
||||||
|
// Calcula variables a partir de otras variables
|
||||||
|
void precalculateZones(param_t *param);
|
||||||
|
|
||||||
// Establece valores por defecto a las variables
|
// Establece valores por defecto a las variables
|
||||||
void initParam(param_t *param)
|
void initParam(param_t *param)
|
||||||
{
|
{
|
||||||
// GAME
|
// GAME
|
||||||
param->game.width = 320;
|
param->game.width = 320;
|
||||||
param->game.height = 240;
|
param->game.height = 256;
|
||||||
param->game.itemSize = 20;
|
param->game.itemSize = 20;
|
||||||
|
param->game.gameArea.rect = {0, 0, param->game.width, param->game.height};
|
||||||
|
param->game.playArea.rect = {0, 0, param->game.width, 216};
|
||||||
|
precalculateZones(param);
|
||||||
|
|
||||||
// SCOREBOARD
|
// SCOREBOARD
|
||||||
param->scoreboard = {0, 200, 320, 40};
|
param->scoreboard = {0, 216, param->game.width, 40};
|
||||||
|
|
||||||
// FADE
|
// FADE
|
||||||
param->fade.numSquaresWidth = 160;
|
param->fade.numSquaresWidth = param->game.width / 2;
|
||||||
param->fade.numSquaresHeight = 120;
|
param->fade.numSquaresHeight = param->game.height / 2;
|
||||||
param->fade.randomSquaresDelay = 1;
|
param->fade.randomSquaresDelay = 1;
|
||||||
param->fade.randomSquaresMult = 500;
|
param->fade.randomSquaresMult = 500;
|
||||||
param->fade.postDuration = 80;
|
param->fade.postDuration = 80;
|
||||||
@@ -46,7 +52,7 @@ void initParam(param_t *param)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Establece valores para los parametros a partir de un fichero de texto
|
// Establece valores para los parametros a partir de un fichero de texto
|
||||||
void loadParam(param_t *param, std::string filePath)
|
void loadParamsFromFile(param_t *param, std::string filePath)
|
||||||
{
|
{
|
||||||
// Pone valores por defecto a las variables
|
// Pone valores por defecto a las variables
|
||||||
initParam(param);
|
initParam(param);
|
||||||
@@ -130,6 +136,8 @@ void loadParam(param_t *param, std::string filePath)
|
|||||||
// Cierra el fichero
|
// Cierra el fichero
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
precalculateZones(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Asigna variables a partir de dos cadenas
|
// Asigna variables a partir de dos cadenas
|
||||||
@@ -154,6 +162,26 @@ bool setOptions(param_t *param, std::string var, std::string value)
|
|||||||
param->game.itemSize = std::stoi(value);
|
param->game.itemSize = std::stoi(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (var == "game.playArea.rect.x")
|
||||||
|
{
|
||||||
|
param->game.playArea.rect.x = std::stoi(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (var == "game.playArea.rect.y")
|
||||||
|
{
|
||||||
|
param->game.playArea.rect.y = std::stoi(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (var == "game.playArea.rect.w")
|
||||||
|
{
|
||||||
|
param->game.playArea.rect.w = std::stoi(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (var == "game.playArea.rect.h")
|
||||||
|
{
|
||||||
|
param->game.playArea.rect.h = std::stoi(value);
|
||||||
|
}
|
||||||
|
|
||||||
// FADE
|
// FADE
|
||||||
else if (var == "fade.numSquaresWidth")
|
else if (var == "fade.numSquaresWidth")
|
||||||
{
|
{
|
||||||
@@ -297,3 +325,25 @@ bool setOptions(param_t *param, std::string var, std::string value)
|
|||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Calcula variables a partir de otras variables
|
||||||
|
void precalculateZones(param_t *param)
|
||||||
|
{
|
||||||
|
|
||||||
|
// playArea
|
||||||
|
param->game.playArea.centerX = param->game.playArea.rect.w / 2;
|
||||||
|
param->game.playArea.firstQuarterX = param->game.playArea.rect.w / 4;
|
||||||
|
param->game.playArea.thirdQuarterX = param->game.playArea.rect.w / 4 * 3;
|
||||||
|
param->game.playArea.centerY = param->game.playArea.rect.h / 2;
|
||||||
|
param->game.playArea.firstQuarterY = param->game.playArea.rect.h / 4;
|
||||||
|
param->game.playArea.thirdQuarterY = param->game.playArea.rect.h / 4 * 3;
|
||||||
|
|
||||||
|
// gameArea
|
||||||
|
param->game.gameArea.rect = {0, 0, param->game.width, param->game.height};
|
||||||
|
param->game.gameArea.centerX = param->game.gameArea.rect.w / 2;
|
||||||
|
param->game.gameArea.firstQuarterX = param->game.gameArea.rect.w / 4;
|
||||||
|
param->game.gameArea.thirdQuarterX = param->game.gameArea.rect.w / 4 * 3;
|
||||||
|
param->game.gameArea.centerY = param->game.gameArea.rect.h / 2;
|
||||||
|
param->game.gameArea.firstQuarterY = param->game.gameArea.rect.h / 4;
|
||||||
|
param->game.gameArea.thirdQuarterY = param->game.gameArea.rect.h / 4 * 3;
|
||||||
|
}
|
||||||
@@ -5,4 +5,4 @@
|
|||||||
#include "const.h"
|
#include "const.h"
|
||||||
|
|
||||||
// Establece valores para los parametros a partir de un fichero de texto
|
// Establece valores para los parametros a partir de un fichero de texto
|
||||||
void loadParam(param_t *param, std::string filePath);
|
void loadParamsFromFile(param_t *param, std::string filePath);
|
||||||
@@ -28,8 +28,8 @@ Logo::Logo(Screen *screen, Asset *asset, Input *input, param_t *param, section_t
|
|||||||
endLogo_cm = 400;
|
endLogo_cm = 400;
|
||||||
postLogoDuration = 20;
|
postLogoDuration = 20;
|
||||||
speed = 8;
|
speed = 8;
|
||||||
dest.x = GAMECANVAS_CENTER_X - jailTexture->getWidth() / 2;
|
dest.x = param->game.gameArea.centerX - jailTexture->getWidth() / 2;
|
||||||
dest.y = GAMECANVAS_CENTER_Y - jailTexture->getHeight() / 2;
|
dest.y = param->game.gameArea.centerY - jailTexture->getHeight() / 2;
|
||||||
sinceSprite->setPosY(dest.y + jailTexture->getHeight() + 5);
|
sinceSprite->setPosY(dest.y + jailTexture->getHeight() + 5);
|
||||||
sinceSprite->setSpriteClip(0, 0, sinceTexture->getWidth(), sinceTexture->getHeight());
|
sinceSprite->setSpriteClip(0, 0, sinceTexture->getWidth(), sinceTexture->getHeight());
|
||||||
sinceSprite->setEnabled(false);
|
sinceSprite->setEnabled(false);
|
||||||
|
|||||||
@@ -2,13 +2,16 @@
|
|||||||
#include "player.h"
|
#include "player.h"
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Player::Player(float x, int y, std::vector<Texture *> texture, std::vector<std::vector<std::string> *> animations)
|
Player::Player(float x, int y, SDL_Rect *playArea, std::vector<Texture *> texture, std::vector<std::vector<std::string> *> animations)
|
||||||
{
|
{
|
||||||
// Reserva memoria para los objetos
|
// Reserva memoria para los objetos
|
||||||
playerSprite = new AnimatedSprite(texture[0], "", animations[0]);
|
playerSprite = new AnimatedSprite(texture[0], "", animations[0]);
|
||||||
powerSprite = new AnimatedSprite(texture[1], "", animations[1]);
|
powerSprite = new AnimatedSprite(texture[1], "", animations[1]);
|
||||||
powerSprite->getTexture()->setAlpha(224);
|
powerSprite->getTexture()->setAlpha(224);
|
||||||
|
|
||||||
|
// Rectangulo con la zona de juego
|
||||||
|
this->playArea = playArea;
|
||||||
|
|
||||||
// Establece la posición inicial del jugador
|
// Establece la posición inicial del jugador
|
||||||
defaultPosX = posX = x;
|
defaultPosX = posX = x;
|
||||||
defaultPosY = posY = y;
|
defaultPosY = posY = y;
|
||||||
@@ -110,7 +113,7 @@ void Player::move()
|
|||||||
posX += velX;
|
posX += velX;
|
||||||
|
|
||||||
// Si el jugador abandona el area de juego por los laterales
|
// Si el jugador abandona el area de juego por los laterales
|
||||||
if ((posX < PLAY_AREA_LEFT - 5) || (posX + width > PLAY_AREA_RIGHT + 5))
|
if ((posX < PLAY_AREA_LEFT - 5) || (posX + width > playArea->w + 5))
|
||||||
{
|
{
|
||||||
// Restaura su posición
|
// Restaura su posición
|
||||||
posX -= velX;
|
posX -= velX;
|
||||||
@@ -127,7 +130,7 @@ void Player::move()
|
|||||||
playerSprite->update();
|
playerSprite->update();
|
||||||
|
|
||||||
// Si el cadaver abandona el area de juego por los laterales
|
// Si el cadaver abandona el area de juego por los laterales
|
||||||
if ((playerSprite->getPosX() < PLAY_AREA_LEFT) || (playerSprite->getPosX() + width > PLAY_AREA_RIGHT))
|
if ((playerSprite->getPosX() < PLAY_AREA_LEFT) || (playerSprite->getPosX() + width > playArea->w))
|
||||||
{
|
{
|
||||||
// Restaura su posición
|
// Restaura su posición
|
||||||
const float vx = playerSprite->getVelX();
|
const float vx = playerSprite->getVelX();
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ private:
|
|||||||
// Objetos y punteros
|
// Objetos y punteros
|
||||||
AnimatedSprite *playerSprite; // Sprite para dibujar el jugador
|
AnimatedSprite *playerSprite; // Sprite para dibujar el jugador
|
||||||
AnimatedSprite *powerSprite; // Sprite para dibujar el aura del jugador con el poder a tope
|
AnimatedSprite *powerSprite; // Sprite para dibujar el aura del jugador con el poder a tope
|
||||||
|
SDL_Rect *playArea; // Rectangulo con la zona de juego
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
float posX; // Posicion en el eje X
|
float posX; // Posicion en el eje X
|
||||||
@@ -74,7 +75,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
Player(float x, int y, std::vector<Texture *> texture, std::vector<std::vector<std::string> *> animations);
|
Player(float x, int y, SDL_Rect *playArea, std::vector<Texture *> texture, std::vector<std::vector<std::string> *> animations);
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~Player();
|
~Player();
|
||||||
|
|||||||
@@ -24,11 +24,11 @@ Title::Title(Screen *screen, Asset *asset, Input *input, options_t *options, Lan
|
|||||||
text2 = new Text(asset->get("8bithud.png"), asset->get("8bithud.txt"), renderer);
|
text2 = new Text(asset->get("8bithud.png"), asset->get("8bithud.txt"), renderer);
|
||||||
|
|
||||||
miniLogoTexture = new Texture(renderer, asset->get("logo_jailgames_mini.png"));
|
miniLogoTexture = new Texture(renderer, asset->get("logo_jailgames_mini.png"));
|
||||||
miniLogoSprite = new Sprite(GAMECANVAS_CENTER_X - miniLogoTexture->getWidth() / 2, 0, miniLogoTexture->getWidth(), miniLogoTexture->getHeight(), miniLogoTexture);
|
miniLogoSprite = new Sprite(param->game.gameArea.centerX - miniLogoTexture->getWidth() / 2, 0, miniLogoTexture->getWidth(), miniLogoTexture->getHeight(), miniLogoTexture);
|
||||||
|
|
||||||
tiledbg = new Tiledbg(renderer, asset, {0, 0, param->game.width, param->game.height}, TILED_MODE_RANDOM);
|
tiledbg = new Tiledbg(renderer, asset, {0, 0, param->game.width, param->game.height}, TILED_MODE_RANDOM);
|
||||||
|
|
||||||
gameLogo = new GameLogo(renderer, screen, asset, param, GAMECANVAS_CENTER_X, param->title.titleCCPosition);
|
gameLogo = new GameLogo(renderer, screen, asset, param, param->game.gameArea.centerX, param->title.titleCCPosition);
|
||||||
gameLogo->enable();
|
gameLogo->enable();
|
||||||
|
|
||||||
defineButtons = new DefineButtons(input, text2, param, options, section);
|
defineButtons = new DefineButtons(input, text2, param, options, section);
|
||||||
@@ -175,7 +175,7 @@ void Title::render()
|
|||||||
// 'PULSA 1P o 2P PARA JUGAR'
|
// 'PULSA 1P o 2P PARA JUGAR'
|
||||||
if (counter % 50 > 14 && !defineButtons->isEnabled())
|
if (counter % 50 > 14 && !defineButtons->isEnabled())
|
||||||
{
|
{
|
||||||
text1->writeDX(TXT_CENTER | TXT_SHADOW, GAMECANVAS_CENTER_X, param->title.pressStartPosition, lang->getText(23), 1, noColor, 1, shadow);
|
text1->writeDX(TXT_CENTER | TXT_SHADOW, param->game.gameArea.centerX, param->title.pressStartPosition, lang->getText(23), 1, noColor, 1, shadow);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mini logo
|
// Mini logo
|
||||||
@@ -185,7 +185,7 @@ void Title::render()
|
|||||||
miniLogoSprite->render();
|
miniLogoSprite->render();
|
||||||
|
|
||||||
// Texto con el copyright
|
// Texto con el copyright
|
||||||
text1->writeDX(TXT_CENTER | TXT_SHADOW, GAMECANVAS_CENTER_X, pos2, TEXT_COPYRIGHT, 1, noColor, 1, shadow);
|
text1->writeDX(TXT_CENTER | TXT_SHADOW, param->game.gameArea.centerX, pos2, TEXT_COPYRIGHT, 1, noColor, 1, shadow);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define Buttons
|
// Define Buttons
|
||||||
|
|||||||
Reference in New Issue
Block a user