afegit pulso de color
This commit is contained in:
@@ -37,6 +37,7 @@ set(APP_SOURCES
|
|||||||
source/core/system/director.cpp
|
source/core/system/director.cpp
|
||||||
source/core/rendering/sdl_manager.cpp
|
source/core/rendering/sdl_manager.cpp
|
||||||
source/core/rendering/line_renderer.cpp
|
source/core/rendering/line_renderer.cpp
|
||||||
|
source/core/rendering/color_oscillator.cpp
|
||||||
source/core/rendering/polygon_renderer.cpp
|
source/core/rendering/polygon_renderer.cpp
|
||||||
source/core/rendering/primitives.cpp
|
source/core/rendering/primitives.cpp
|
||||||
source/game/options.cpp
|
source/game/options.cpp
|
||||||
|
|||||||
1
Makefile
1
Makefile
@@ -37,6 +37,7 @@ APP_SOURCES := \
|
|||||||
source/core/system/director.cpp \
|
source/core/system/director.cpp \
|
||||||
source/core/rendering/sdl_manager.cpp \
|
source/core/rendering/sdl_manager.cpp \
|
||||||
source/core/rendering/line_renderer.cpp \
|
source/core/rendering/line_renderer.cpp \
|
||||||
|
source/core/rendering/color_oscillator.cpp \
|
||||||
source/core/rendering/polygon_renderer.cpp \
|
source/core/rendering/polygon_renderer.cpp \
|
||||||
source/core/rendering/primitives.cpp \
|
source/core/rendering/primitives.cpp \
|
||||||
source/game/options.cpp \
|
source/game/options.cpp \
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "sdl_manager.hpp"
|
#include "sdl_manager.hpp"
|
||||||
#include "core/defaults.hpp"
|
#include "core/defaults.hpp"
|
||||||
|
#include "core/rendering/line_renderer.hpp"
|
||||||
#include "game/options.hpp"
|
#include "game/options.hpp"
|
||||||
#include "project.h"
|
#include "project.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@@ -277,7 +278,12 @@ void SDLManager::neteja(uint8_t r, uint8_t g, uint8_t b) {
|
|||||||
if (!renderer_)
|
if (!renderer_)
|
||||||
return;
|
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_);
|
SDL_RenderClear(renderer_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -287,3 +293,11 @@ void SDLManager::presenta() {
|
|||||||
|
|
||||||
SDL_RenderPresent(renderer_);
|
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 <SDL3/SDL.h>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include "core/rendering/color_oscillator.hpp"
|
||||||
|
|
||||||
class SDLManager {
|
class SDLManager {
|
||||||
public:
|
public:
|
||||||
@@ -29,6 +30,9 @@ public:
|
|||||||
void neteja(uint8_t r = 0, uint8_t g = 0, uint8_t b = 0);
|
void neteja(uint8_t r = 0, uint8_t g = 0, uint8_t b = 0);
|
||||||
void presenta();
|
void presenta();
|
||||||
|
|
||||||
|
// [NUEVO] Actualització de colors (oscil·lació)
|
||||||
|
void updateColors(float delta_time);
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
SDL_Renderer *obte_renderer() { return renderer_; }
|
SDL_Renderer *obte_renderer() { return renderer_; }
|
||||||
|
|
||||||
@@ -47,6 +51,9 @@ private:
|
|||||||
void calculateMaxWindowSize(); // Llegir resolució del display
|
void calculateMaxWindowSize(); // Llegir resolució del display
|
||||||
void applyWindowSize(int width, int height); // Canviar mida + centrar
|
void applyWindowSize(int width, int height); // Canviar mida + centrar
|
||||||
void updateLogicalPresentation(); // Actualitzar viewport
|
void updateLogicalPresentation(); // Actualitzar viewport
|
||||||
|
|
||||||
|
// [NUEVO] Oscil·lador de colors
|
||||||
|
Rendering::ColorOscillator color_oscillator_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SDL_MANAGER_HPP
|
#endif // SDL_MANAGER_HPP
|
||||||
|
|||||||
Reference in New Issue
Block a user