canvi de pc

This commit is contained in:
2025-02-21 18:26:32 +01:00
parent 04ff428aa0
commit 29c85fecad
6 changed files with 179 additions and 36 deletions

View File

@@ -2,8 +2,9 @@
#include <SDL2/SDL_rect.h> // Para SDL_Point
#include <SDL2/SDL_stdinc.h> // Para Uint32
#include <memory> // Para shared_ptr, unique_ptr
#include <vector> // Para vector
#include <SDL2/SDL.h>
#include <memory> // Para shared_ptr, unique_ptr
#include <vector> // Para vector
class Sprite;
class Texture; // lines 9-9
struct Color;
@@ -16,6 +17,21 @@ struct Color;
ZX Spectrum
*/
struct Pixel
{
int x, y; // Coordenadas del píxel
Uint8 r, g, b, a; // Color del píxel
// Método para ascender y desvanecerse
void evaporate()
{
y -= 1; // Asciende hacia arriba
a = (a > 5) ? a - 5 : 0; // Desvanece el alfa (transparencia)
// Añadir movimiento zig-zag aleatorio
x += (rand() % 3 - 1); // Movimiento horizontal aleatorio (-1, 0, 1)
}
};
// Clase Logo
class Logo
{
@@ -45,6 +61,9 @@ private:
Uint32 ticks_ = 0; // Contador de ticks para ajustar la velocidad del programa
SDL_Point dest_; // Posición X donde dibujar el logo
LogoState state_ = LogoState::JAILGAMES; // El estado indica qué logo se está procesando
Uint32 ticks_start_ = 0; // Almacena el valor actual de los ticks de SDL
std::vector<Pixel> pixels_; // Vector con los pixels que forman el logo de "RETROWEEKEND"
SDL_Texture *mi_textura;
// Actualiza las variables
void update();
@@ -76,6 +95,10 @@ private:
// Recarga todas las texturas
void reloadTextures();
std::vector<Pixel> extractPixels(SDL_Texture *texture);
void renderAndEvaporate(SDL_Renderer *renderer, std::vector<Pixel> &pixels);
public:
// Constructor
Logo();