La música la tiene ahora la clase Director
This commit is contained in:
@@ -187,4 +187,20 @@ std::string Asset::getTypeName(int type)
|
||||
void Asset::setVerbose(bool value)
|
||||
{
|
||||
verbose = value;
|
||||
}
|
||||
|
||||
// Devuelve la lista de recursos de un tipo
|
||||
std::vector<std::string> Asset::getListByType(assetType type)
|
||||
{
|
||||
std::vector<std::string> list;
|
||||
|
||||
for (auto f : fileList)
|
||||
{
|
||||
if (f.type == type)
|
||||
{
|
||||
list.push_back(f.file);
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
@@ -61,6 +61,9 @@ public:
|
||||
|
||||
// Establece si ha de mostrar texto por pantalla
|
||||
void setVerbose(bool value);
|
||||
|
||||
// Devuelve la lista de recursos de un tipo
|
||||
std::vector<std::string> getListByType(assetType type);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -183,4 +183,32 @@ std::string toLower(std::string str)
|
||||
std::string nova(lower);
|
||||
free(lower);
|
||||
return nova;
|
||||
}
|
||||
|
||||
// Obtiene el fichero de sonido a partir de un nombre
|
||||
JA_Sound_t *getSound(std::vector<sound_file_t> sounds, std::string name)
|
||||
{
|
||||
for (auto s : sounds)
|
||||
{
|
||||
if (s.name == name)
|
||||
{
|
||||
return s.file;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Obtiene el fichero de música a partir de un nombre
|
||||
JA_Music_t *getMusic(std::vector<music_file_t> music, std::string name)
|
||||
{
|
||||
for (auto m : music)
|
||||
{
|
||||
if (m.name == name)
|
||||
{
|
||||
return m.file;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include "texture.h"
|
||||
#include "jail_audio.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -163,6 +164,7 @@ struct options_t
|
||||
op_audio_t audio; // Opciones para el audio
|
||||
};
|
||||
|
||||
// Estructura para almacenar todos los parámetros del juego
|
||||
struct param_t
|
||||
{
|
||||
int gameWidth; // Ancho de la resolucion nativa del juego
|
||||
@@ -181,6 +183,20 @@ struct param_t
|
||||
int titleCounter; // Tiempo de inactividad del titulo
|
||||
};
|
||||
|
||||
// Estructura para almacenar ficheros de sonido y su nombre
|
||||
struct sound_file_t
|
||||
{
|
||||
std::string name; // Nombre del sonido
|
||||
JA_Sound_t *file; // Fichero con el sonido
|
||||
};
|
||||
|
||||
// Estructura para almacenar ficheros musicales y su nombre
|
||||
struct music_file_t
|
||||
{
|
||||
std::string name; // Nombre de la musica
|
||||
JA_Music_t *file; // Fichero con la música
|
||||
};
|
||||
|
||||
// Calcula el cuadrado de la distancia entre dos puntos
|
||||
double distanceSquared(int x1, int y1, int x2, int y2);
|
||||
|
||||
@@ -205,4 +221,10 @@ std::string boolToString(bool value);
|
||||
// Convierte una cadena a minusculas
|
||||
std::string toLower(std::string str);
|
||||
|
||||
// Obtiene el fichero de sonido a partir de un nombre
|
||||
JA_Sound_t *getSound(std::vector<sound_file_t> sounds, std::string name);
|
||||
|
||||
// Obtiene el fichero de música a partir de un nombre
|
||||
JA_Music_t *getMusic(std::vector<music_file_t> music, std::string name);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user