Migrar de vibe3_physics a vibe4_shaders con enfoque en shaders CRT
- Actualizar nombre del proyecto en CMakeLists.txt a vibe4_shaders - Cambiar título de ventana en defines.h a vibe4_shaders - Reescribir completamente README.md enfocado en tecnología de shaders: * Renderizado multi-backend (OpenGL, Vulkan, Metal) * Efectos de shader CRT (scanlines, curvatura, bloom) * Documentación del pipeline de post-procesado * Nuevos controles específicos de shaders (R, C, S, B, U) * Estructura del proyecto actualizada con directorios de shaders - Mantener todos los controles y funcionalidad existente - Reposicionar proyecto como demo de tecnología de renderizado - Añadir .gitignore básico para C++ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
63
source/ball.h
Normal file
63
source/ball.h
Normal file
@@ -0,0 +1,63 @@
|
||||
#pragma once
|
||||
|
||||
#include <SDL3/SDL_rect.h> // for SDL_FRect
|
||||
|
||||
#include <memory> // for shared_ptr, unique_ptr
|
||||
|
||||
#include "defines.h" // for Color
|
||||
#include "external/sprite.h" // for Sprite
|
||||
class Texture;
|
||||
|
||||
class Ball {
|
||||
private:
|
||||
std::unique_ptr<Sprite> sprite_; // Sprite para pintar la clase
|
||||
SDL_FRect pos_; // Posición y tamaño de la pelota
|
||||
float vx_, vy_; // Velocidad
|
||||
float gravity_force_; // Gravedad base
|
||||
float gravity_mass_factor_; // Factor de masa individual (0.7-1.3, afecta gravedad)
|
||||
GravityDirection gravity_direction_; // Direcci\u00f3n de la gravedad
|
||||
int screen_width_; // Ancho del terreno de juego
|
||||
int screen_height_; // Alto del terreno de juego
|
||||
Color color_; // Color de la pelota
|
||||
bool on_surface_; // Indica si la pelota est\u00e1 en la superficie (suelo/techo/pared)
|
||||
bool stopped_; // Indica si la pelota ha terminado de moverse;
|
||||
float loss_; // Coeficiente de rebote. Pérdida de energía en cada rebote
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Ball(float x, float vx, float vy, Color color, std::shared_ptr<Texture> texture, int screen_width, int screen_height, GravityDirection gravity_dir = GravityDirection::DOWN, float mass_factor = 1.0f);
|
||||
|
||||
// Destructor
|
||||
~Ball() = default;
|
||||
|
||||
// Actualiza la lógica de la clase
|
||||
void update(float deltaTime);
|
||||
|
||||
// Pinta la clase
|
||||
void render();
|
||||
|
||||
// Modifica la velocidad
|
||||
void modVel(float vx, float vy);
|
||||
|
||||
// Cambia la gravedad
|
||||
void switchGravity();
|
||||
|
||||
// Cambia la direcci\u00f3n de gravedad
|
||||
void setGravityDirection(GravityDirection direction);
|
||||
|
||||
// Aplica un peque\u00f1o empuje lateral aleatorio
|
||||
void applyRandomLateralPush();
|
||||
|
||||
// Getters para debug
|
||||
float getVelocityY() const { return vy_; }
|
||||
float getVelocityX() const { return vx_; }
|
||||
float getGravityForce() const { return gravity_force_; }
|
||||
float getLossCoefficient() const { return loss_; }
|
||||
GravityDirection getGravityDirection() const { return gravity_direction_; }
|
||||
bool isOnSurface() const { return on_surface_; }
|
||||
bool isStopped() const { return stopped_; }
|
||||
|
||||
// Getters para batch rendering
|
||||
SDL_FRect getPosition() const { return pos_; }
|
||||
Color getColor() const { return color_; }
|
||||
};
|
||||
Reference in New Issue
Block a user