Eliminado SDL_image
This commit is contained in:
@@ -78,6 +78,11 @@ void Bullet::init(int x, int y, int kind)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
// Establece la velocidad inicial
|
||||||
|
mVelX = 0;
|
||||||
|
|
||||||
|
// Rectangulo con los gráficos del objeto
|
||||||
|
mSprite.setSpriteClip(0 * mWidth, 0, mSprite.getWidth(), mSprite.getHeight());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,12 +31,14 @@ GameDirector::GameDirector(SDL_Renderer *gRenderer)
|
|||||||
{
|
{
|
||||||
this->gRenderer = gRenderer;
|
this->gRenderer = gRenderer;
|
||||||
|
|
||||||
for (Uint8 i = 0; i < mMaxBalloons; i++)
|
mMaxBalloons = 50;
|
||||||
|
for (int i = 0; i < mMaxBalloons; ++i)
|
||||||
{
|
{
|
||||||
balloon[i] = new Balloon(gRenderer);
|
balloon[i] = new Balloon(gRenderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < mMaxBullets; i++)
|
mMaxBullets = 50;
|
||||||
|
for (int i = 0; i < mMaxBullets; ++i)
|
||||||
{
|
{
|
||||||
bullet[i] = new Bullet(gRenderer);
|
bullet[i] = new Bullet(gRenderer);
|
||||||
}
|
}
|
||||||
@@ -75,12 +77,12 @@ GameDirector::~GameDirector()
|
|||||||
delete menuPause;
|
delete menuPause;
|
||||||
delete menuTitle;
|
delete menuTitle;
|
||||||
|
|
||||||
for (Uint8 i = 0; i < mMaxBalloons; i++)
|
for (int i = 0; i < mMaxBalloons; ++i)
|
||||||
{
|
{
|
||||||
delete balloon[i];
|
delete balloon[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < mMaxBullets; i++)
|
for (int i = 0; i < mMaxBullets; ++i)
|
||||||
{
|
{
|
||||||
delete bullet[i];
|
delete bullet[i];
|
||||||
}
|
}
|
||||||
@@ -172,8 +174,6 @@ void GameDirector::init()
|
|||||||
// Variables
|
// Variables
|
||||||
mGameStatus = GAME_STATE_TITLE;
|
mGameStatus = GAME_STATE_TITLE;
|
||||||
mOldTicks = 0;
|
mOldTicks = 0;
|
||||||
mMaxBalloons = 50;
|
|
||||||
mMaxBullets = 50;
|
|
||||||
mGameSpeed = 15;
|
mGameSpeed = 15;
|
||||||
mMenaceLevel = 0;
|
mMenaceLevel = 0;
|
||||||
mMenaceLevelThreshold = 7;
|
mMenaceLevelThreshold = 7;
|
||||||
@@ -361,7 +361,7 @@ Uint8 GameDirector::createNewBalloon(int x, int y, Uint8 kind, float velx, Uint1
|
|||||||
// Establece a cero todos los valores del vector de objetos globo
|
// Establece a cero todos los valores del vector de objetos globo
|
||||||
void GameDirector::resetBalloons()
|
void GameDirector::resetBalloons()
|
||||||
{
|
{
|
||||||
for (Uint8 i = 0; i < mMaxBalloons; i++)
|
for (int i = 0; i < mMaxBalloons; ++i)
|
||||||
{
|
{
|
||||||
balloon[i]->erase();
|
balloon[i]->erase();
|
||||||
}
|
}
|
||||||
@@ -525,7 +525,7 @@ Uint8 GameDirector::getBulletFreeIndex()
|
|||||||
// Establece a cero todos los valores del vector de objetos bala
|
// Establece a cero todos los valores del vector de objetos bala
|
||||||
void GameDirector::resetBullets()
|
void GameDirector::resetBullets()
|
||||||
{
|
{
|
||||||
for (Uint8 i = 0; i < mMaxBullets; i++)
|
for (int i = 0; i < mMaxBullets; ++i)
|
||||||
{
|
{
|
||||||
bullet[i]->init(0, 0, NO_KIND);
|
bullet[i]->init(0, 0, NO_KIND);
|
||||||
}
|
}
|
||||||
@@ -542,7 +542,7 @@ void GameDirector::createBullet(int x, int y, Uint8 kind)
|
|||||||
void GameDirector::calculateMenaceLevel()
|
void GameDirector::calculateMenaceLevel()
|
||||||
{
|
{
|
||||||
mMenaceLevel = 0;
|
mMenaceLevel = 0;
|
||||||
for (Uint8 i = 0; i < mMaxBalloons; i++)
|
for (int i = 0; i < mMaxBalloons; ++i)
|
||||||
{
|
{
|
||||||
switch (balloon[i]->getKind())
|
switch (balloon[i]->getKind())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
#include <SDL2/SDL_image.h>
|
//#include <SDL2/SDL_image.h>
|
||||||
#include <SDL2/SDL_mixer.h>
|
#include <SDL2/SDL_mixer.h>
|
||||||
|
|
||||||
#ifndef GLOBALS_H
|
#ifndef GLOBALS_H
|
||||||
|
|||||||
@@ -120,12 +120,12 @@ bool init()
|
|||||||
SDL_RenderSetLogicalSize(gRenderer, SCREEN_WIDTH, SCREEN_HEIGHT);
|
SDL_RenderSetLogicalSize(gRenderer, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||||
|
|
||||||
// Inicializa el cargador de PNG
|
// Inicializa el cargador de PNG
|
||||||
int imgFlags = IMG_INIT_PNG;
|
/*int imgFlags = IMG_INIT_PNG;
|
||||||
if (!(IMG_Init(imgFlags) & imgFlags))
|
if (!(IMG_Init(imgFlags) & imgFlags))
|
||||||
{
|
{
|
||||||
printf("SDL_image could not initialize! SDL_image Error: %s\n", IMG_GetError());
|
printf("SDL_image could not initialize! SDL_image Error: %s\n", IMG_GetError());
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -143,7 +143,7 @@ void close()
|
|||||||
gRenderer = NULL;
|
gRenderer = NULL;
|
||||||
|
|
||||||
// Sal del subsistema SDL
|
// Sal del subsistema SDL
|
||||||
IMG_Quit();
|
//IMG_Quit();
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ Menu::Menu(SDL_Renderer *gRenderer)
|
|||||||
printf("Failed to load menu texture!\n");
|
printf("Failed to load menu texture!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
init(0, 0, 0, MENU_BACKGROUND_SOLID);
|
//init(0, 0, 0, MENU_BACKGROUND_SOLID);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
@@ -50,9 +50,9 @@ void Menu::init(int x, int y, int offset_sprite_selector, int backgroundType)
|
|||||||
// Elementos del menu
|
// Elementos del menu
|
||||||
for (Uint8 i = 0; i < 10; i++)
|
for (Uint8 i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
mMenuItem[i].label = "";
|
|
||||||
mMenuItem[i].x = mPosX;
|
mMenuItem[i].x = mPosX;
|
||||||
mMenuItem[i].y = mPosY + (i * (BLOCK + 2));
|
mMenuItem[i].y = mPosY + (i * (BLOCK + 2));
|
||||||
|
mMenuItem[i].label = "s";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mueve el grafico del selector al elemento seleccionado
|
// Mueve el grafico del selector al elemento seleccionado
|
||||||
|
|||||||
Reference in New Issue
Block a user