afegit pulso de color
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "sdl_manager.hpp"
|
||||
#include "core/defaults.hpp"
|
||||
#include "core/rendering/line_renderer.hpp"
|
||||
#include "game/options.hpp"
|
||||
#include "project.h"
|
||||
#include <algorithm>
|
||||
@@ -277,7 +278,12 @@ void SDLManager::neteja(uint8_t r, uint8_t g, uint8_t b) {
|
||||
if (!renderer_)
|
||||
return;
|
||||
|
||||
SDL_SetRenderDrawColor(renderer_, r, g, b, 255);
|
||||
// [MODIFICAT] Usar color oscil·lat del fons en lloc dels paràmetres
|
||||
(void)r;
|
||||
(void)g;
|
||||
(void)b; // Suprimir warnings
|
||||
SDL_Color bg = color_oscillator_.getCurrentBackgroundColor();
|
||||
SDL_SetRenderDrawColor(renderer_, bg.r, bg.g, bg.b, 255);
|
||||
SDL_RenderClear(renderer_);
|
||||
}
|
||||
|
||||
@@ -287,3 +293,11 @@ void SDLManager::presenta() {
|
||||
|
||||
SDL_RenderPresent(renderer_);
|
||||
}
|
||||
|
||||
// [NUEVO] Actualitzar colors amb oscil·lació
|
||||
void SDLManager::updateColors(float delta_time) {
|
||||
color_oscillator_.update(delta_time);
|
||||
|
||||
// Actualitzar color global de línies
|
||||
Rendering::setLineColor(color_oscillator_.getCurrentLineColor());
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
#include <cstdint>
|
||||
#include "core/rendering/color_oscillator.hpp"
|
||||
|
||||
class SDLManager {
|
||||
public:
|
||||
@@ -29,6 +30,9 @@ public:
|
||||
void neteja(uint8_t r = 0, uint8_t g = 0, uint8_t b = 0);
|
||||
void presenta();
|
||||
|
||||
// [NUEVO] Actualització de colors (oscil·lació)
|
||||
void updateColors(float delta_time);
|
||||
|
||||
// Getters
|
||||
SDL_Renderer *obte_renderer() { return renderer_; }
|
||||
|
||||
@@ -47,6 +51,9 @@ private:
|
||||
void calculateMaxWindowSize(); // Llegir resolució del display
|
||||
void applyWindowSize(int width, int height); // Canviar mida + centrar
|
||||
void updateLogicalPresentation(); // Actualitzar viewport
|
||||
|
||||
// [NUEVO] Oscil·lador de colors
|
||||
Rendering::ColorOscillator color_oscillator_;
|
||||
};
|
||||
|
||||
#endif // SDL_MANAGER_HPP
|
||||
|
||||
Reference in New Issue
Block a user