Estandaritzant noms segons convencions
This commit is contained in:
@@ -4,39 +4,39 @@
|
||||
#include <cctype> // for isspace
|
||||
#include <iterator> // for distance
|
||||
#include <cmath>
|
||||
struct JA_Music_t; // lines 3-3
|
||||
struct JA_Sound_t; // lines 4-4
|
||||
struct JA_Music_t; // lines 3-3
|
||||
struct JA_Sound_t; // lines 4-4
|
||||
|
||||
// Colores
|
||||
const color_t bgColor = {0x27, 0x27, 0x36};
|
||||
const color_t noColor = {0xFF, 0xFF, 0xFF};
|
||||
const color_t shdwTxtColor = {0x43, 0x43, 0x4F};
|
||||
const color_t separatorColor = {0x0D, 0x1A, 0x2B};
|
||||
const color_t scoreboardColor = {0x2E, 0x3F, 0x47};
|
||||
const color_t difficultyEasyColor = {0x4B, 0x69, 0x2F};
|
||||
const color_t difficultyNormalColor = {0xFF, 0x7A, 0x00};
|
||||
const color_t difficultyHardColor = {0x76, 0x42, 0x8A};
|
||||
const color_t flashColor = {0xFF, 0xFF, 0xFF};
|
||||
const color_t fadeColor = {0x27, 0x27, 0x36};
|
||||
const color_t orangeColor = {0xFF, 0x7A, 0x00};
|
||||
const Color bg_color = {0x27, 0x27, 0x36};
|
||||
const Color no_color = {0xFF, 0xFF, 0xFF};
|
||||
const Color shdw_txt_color = {0x43, 0x43, 0x4F};
|
||||
const Color separator_color = {0x0D, 0x1A, 0x2B};
|
||||
const Color scoreboard_color = {0x2E, 0x3F, 0x47};
|
||||
const Color difficulty_easy_color = {0x4B, 0x69, 0x2F};
|
||||
const Color difficulty_normal_color = {0xFF, 0x7A, 0x00};
|
||||
const Color difficulty_hard_color = {0x76, 0x42, 0x8A};
|
||||
const Color flash_color = {0xFF, 0xFF, 0xFF};
|
||||
const Color fade_color = {0x27, 0x27, 0x36};
|
||||
const Color orange_color = {0xFF, 0x7A, 0x00};
|
||||
|
||||
// Calcula el cuadrado de la distancia entre dos puntos
|
||||
double distanceSquared(int x1, int y1, int x2, int y2)
|
||||
{
|
||||
const int deltaX = x2 - x1;
|
||||
const int deltaY = y2 - y1;
|
||||
return deltaX * deltaX + deltaY * deltaY;
|
||||
const int delta_x = x2 - x1;
|
||||
const int delta_y = y2 - y1;
|
||||
return delta_x * delta_x + delta_y * delta_y;
|
||||
}
|
||||
|
||||
// Detector de colisiones entre dos circulos
|
||||
bool checkCollision(circle_t &a, circle_t &b)
|
||||
bool checkCollision(Circle &a, Circle &b)
|
||||
{
|
||||
// Calcula el radio total al cuadrado
|
||||
int totalRadiusSquared = a.r + b.r;
|
||||
totalRadiusSquared = totalRadiusSquared * totalRadiusSquared;
|
||||
int total_radius_squared = a.r + b.r;
|
||||
total_radius_squared = total_radius_squared * total_radius_squared;
|
||||
|
||||
// Si la distancia entre el centro de los circulos es inferior a la suma de sus radios
|
||||
if (distanceSquared(a.x, a.y, b.x, b.y) < (totalRadiusSquared))
|
||||
if (distanceSquared(a.x, a.y, b.x, b.y) < (total_radius_squared))
|
||||
{
|
||||
// Los circulos han colisionado
|
||||
return true;
|
||||
@@ -47,7 +47,7 @@ bool checkCollision(circle_t &a, circle_t &b)
|
||||
}
|
||||
|
||||
// Detector de colisiones entre un circulo y un rectangulo
|
||||
bool checkCollision(circle_t &a, SDL_Rect &b)
|
||||
bool checkCollision(Circle &a, SDL_Rect &b)
|
||||
{
|
||||
// Closest point on collision box
|
||||
int cX, cY;
|
||||
@@ -80,10 +80,10 @@ bool checkCollision(circle_t &a, SDL_Rect &b)
|
||||
cY = a.y;
|
||||
}
|
||||
|
||||
// If the closest point is inside the circle_t
|
||||
// If the closest point is inside the Circle
|
||||
if (distanceSquared(a.x, a.y, cX, cY) < a.r * a.r)
|
||||
{
|
||||
// This box and the circle_t have collided
|
||||
// This box and the Circle have collided
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -197,7 +197,7 @@ 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)
|
||||
JA_Sound_t *getSound(std::vector<SoundFile> sounds, std::string name)
|
||||
{
|
||||
for (auto s : sounds)
|
||||
{
|
||||
@@ -211,7 +211,7 @@ 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)
|
||||
JA_Music_t *getMusic(std::vector<MusicFile> music, std::string name)
|
||||
{
|
||||
for (auto m : music)
|
||||
{
|
||||
@@ -225,7 +225,7 @@ JA_Music_t *getMusic(std::vector<music_file_t> music, std::string name)
|
||||
}
|
||||
|
||||
// Ordena las entradas de la tabla de records
|
||||
hiScoreEntry_t sortHiScoreTable(hiScoreEntry_t entry1, hiScoreEntry_t entry2)
|
||||
HiScoreEntry sortHiScoreTable(HiScoreEntry entry1, HiScoreEntry entry2)
|
||||
{
|
||||
if (entry1.score > entry2.score)
|
||||
{
|
||||
@@ -275,9 +275,9 @@ void DrawCircle(SDL_Renderer *renderer, int32_t centerX, int32_t centerY, int32_
|
||||
}
|
||||
|
||||
// Aclara el color
|
||||
color_t lightenColor(color_t color, int amount)
|
||||
Color lightenColor(Color color, int amount)
|
||||
{
|
||||
color_t newColor;
|
||||
Color newColor;
|
||||
newColor.r = std::min(255, (int)color.r + amount);
|
||||
newColor.g = std::min(255, (int)color.g + amount);
|
||||
newColor.b = std::min(255, (int)color.b + amount);
|
||||
@@ -285,9 +285,9 @@ color_t lightenColor(color_t color, int amount)
|
||||
}
|
||||
|
||||
// Oscurece el color
|
||||
color_t DarkenColor(color_t color, int amount)
|
||||
Color DarkenColor(Color color, int amount)
|
||||
{
|
||||
color_t newColor;
|
||||
Color newColor;
|
||||
newColor.r = std::max(0, (int)color.r - amount);
|
||||
newColor.g = std::max(0, (int)color.g - amount);
|
||||
newColor.b = std::max(0, (int)color.b - amount);
|
||||
@@ -319,6 +319,7 @@ double easeOutQuint(double t)
|
||||
}
|
||||
|
||||
// Función de suavizado
|
||||
double easeInOutSine(double t) {
|
||||
double easeInOutSine(double t)
|
||||
{
|
||||
return -0.5 * (std::cos(M_PI * t) - 1);
|
||||
}
|
||||
Reference in New Issue
Block a user