forked from jaildesigner-jailgames/jaildoctors_dilemma
reestructurat utils
This commit is contained in:
@@ -282,6 +282,24 @@ void normalizeLine(LineDiagonal& l) {
|
||||
}
|
||||
}
|
||||
|
||||
// Convierte SDL_FRect a SDL_Rect
|
||||
auto toSDLRect(const SDL_FRect& frect) -> SDL_Rect {
|
||||
SDL_Rect rect = {
|
||||
.x = static_cast<int>(frect.x),
|
||||
.y = static_cast<int>(frect.y),
|
||||
.w = static_cast<int>(frect.w),
|
||||
.h = static_cast<int>(frect.h)};
|
||||
return rect;
|
||||
}
|
||||
|
||||
// Convierte SDL_FPoint a SDL_Point
|
||||
auto toSDLPoint(const SDL_FPoint& fpoint) -> SDL_Point {
|
||||
SDL_Point point = {
|
||||
.x = static_cast<int>(fpoint.x),
|
||||
.y = static_cast<int>(fpoint.y)};
|
||||
return point;
|
||||
}
|
||||
|
||||
// Detector de colisiones entre un punto y una linea diagonal
|
||||
auto checkCollision(const SDL_FPoint& point, const LineDiagonal& l) -> bool {
|
||||
SDL_Point p = toSDLPoint(point);
|
||||
@@ -425,14 +443,6 @@ auto stringInVector(const std::vector<std::string>& vec, const std::string& str)
|
||||
return std::ranges::find(vec, str) != vec.end();
|
||||
}
|
||||
|
||||
// Hace sonar la música
|
||||
void playMusic(const std::string& music_path) {
|
||||
// Si la música no está sonando
|
||||
if (JA_GetMusicState() == JA_MUSIC_INVALID || JA_GetMusicState() == JA_MUSIC_STOPPED) {
|
||||
JA_PlayMusic(Resource::Cache::get()->getMusic(music_path));
|
||||
}
|
||||
}
|
||||
|
||||
// Rellena una textura de un color
|
||||
void fillTextureWithColor(SDL_Renderer* renderer, SDL_Texture* texture, Uint8 r, Uint8 g, Uint8 b, Uint8 a) {
|
||||
// Guardar el render target actual
|
||||
|
||||
Reference in New Issue
Block a user