llevat soport per a colors amb nom
This commit is contained in:
@@ -22,7 +22,7 @@ PixelReveal::PixelReveal(int width, int height, float pixels_per_second, float s
|
||||
mode_(mode) {
|
||||
// En modo normal: empieza negro sólido (se irá revelando a transparente)
|
||||
// En modo inverso: empieza transparente (se irá cubriendo de negro)
|
||||
const auto INITIAL_COLOR = reverse_ ? static_cast<Uint8>(PaletteColor::TRANSPARENT) : static_cast<Uint8>(PaletteColor::BLACK);
|
||||
const auto INITIAL_COLOR = reverse_ ? 255 : 0;
|
||||
cover_surface_->clear(INITIAL_COLOR);
|
||||
|
||||
if (mode_ == RevealMode::ORDERED) {
|
||||
@@ -68,7 +68,7 @@ PixelReveal::PixelReveal(int width, int height, float pixels_per_second, float s
|
||||
// Actualiza el estado del revelado
|
||||
void PixelReveal::update(float time_active) { // NOLINT(readability-make-member-function-const)
|
||||
// En modo normal revela (pone transparente); en modo inverso cubre (pone negro)
|
||||
const auto PIXEL_COLOR = reverse_ ? static_cast<Uint8>(PaletteColor::BLACK) : static_cast<Uint8>(PaletteColor::TRANSPARENT);
|
||||
const auto PIXEL_COLOR = reverse_ ? 0 : 255;
|
||||
|
||||
for (int r = 0; r < height_; r++) {
|
||||
const float T_START = static_cast<float>(r) / pixels_per_second_;
|
||||
|
||||
@@ -56,7 +56,7 @@ Screen::Screen() {
|
||||
game_surface_dstrect_ = {.x = Options::video.border.width, .y = Options::video.border.height, .w = Options::game.width, .h = Options::game.height};
|
||||
|
||||
// Define el color del borde para el modo de pantalla completa
|
||||
border_color_ = static_cast<Uint8>(PaletteColor::BLACK);
|
||||
border_color_ = 0;
|
||||
|
||||
// Crea la textura donde se dibujan los graficos del juego
|
||||
game_texture_ = SDL_CreateTexture(renderer_, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, Options::game.width, Options::game.height);
|
||||
@@ -76,7 +76,7 @@ Screen::Screen() {
|
||||
|
||||
// Crea las surfaces (PaletteManager aplicará la paleta inicial en su constructor)
|
||||
game_surface_ = std::make_shared<Surface>(Options::game.width, Options::game.height);
|
||||
game_surface_->clear(static_cast<Uint8>(PaletteColor::BLACK));
|
||||
game_surface_->clear(0);
|
||||
|
||||
border_surface_ = std::make_shared<Surface>(Options::game.width + (Options::video.border.width * 2), Options::game.height + (Options::video.border.height * 2));
|
||||
border_surface_->clear(border_color_);
|
||||
|
||||
@@ -4249,5 +4249,6 @@ static const uint8_t kdownscale_frag_spv[] = {
|
||||
0x38,
|
||||
0x00,
|
||||
0x01,
|
||||
0x00};
|
||||
0x00,
|
||||
};
|
||||
static const size_t kdownscale_frag_spv_size = 4248;
|
||||
|
||||
@@ -11713,5 +11713,6 @@ static const uint8_t kpostfx_frag_spv[] = {
|
||||
0x38,
|
||||
0x00,
|
||||
0x01,
|
||||
0x00};
|
||||
0x00,
|
||||
};
|
||||
static const size_t kpostfx_frag_spv_size = 11712;
|
||||
|
||||
@@ -1445,5 +1445,6 @@ static const uint8_t kpostfx_vert_spv[] = {
|
||||
0x38,
|
||||
0x00,
|
||||
0x01,
|
||||
0x00};
|
||||
0x00,
|
||||
};
|
||||
static const size_t kpostfx_vert_spv_size = 1444;
|
||||
|
||||
@@ -629,5 +629,6 @@ static const uint8_t kupscale_frag_spv[] = {
|
||||
0x38,
|
||||
0x00,
|
||||
0x01,
|
||||
0x00};
|
||||
0x00,
|
||||
};
|
||||
static const size_t kupscale_frag_spv_size = 628;
|
||||
|
||||
@@ -93,10 +93,10 @@ auto readPalFile(const std::string& file_path) -> Palette {
|
||||
// Constructor
|
||||
Surface::Surface(int w, int h)
|
||||
: surface_data_(std::make_shared<SurfaceData>(w, h)),
|
||||
transparent_color_(static_cast<Uint8>(PaletteColor::TRANSPARENT)) { initializeSubPalette(sub_palette_); }
|
||||
transparent_color_(255) { initializeSubPalette(sub_palette_); }
|
||||
|
||||
Surface::Surface(const std::string& file_path)
|
||||
: transparent_color_(static_cast<Uint8>(PaletteColor::TRANSPARENT)) {
|
||||
: transparent_color_(255) {
|
||||
SurfaceData loaded_data = loadSurface(file_path);
|
||||
surface_data_ = std::make_shared<SurfaceData>(std::move(loaded_data));
|
||||
|
||||
|
||||
@@ -176,7 +176,7 @@ auto Text::writeToSurface(const std::string& text, int zoom, int kerning) -> std
|
||||
auto surface = std::make_shared<Surface>(width, height);
|
||||
auto previuos_renderer = Screen::get()->getRendererSurface();
|
||||
Screen::get()->setRendererSurface(surface);
|
||||
surface->clear(stringToColor("transparent"));
|
||||
surface->clear(255);
|
||||
write(0, 0, text, kerning);
|
||||
Screen::get()->setRendererSurface(previuos_renderer);
|
||||
|
||||
@@ -190,7 +190,7 @@ auto Text::writeDXToSurface(Uint8 flags, const std::string& text, int kerning, U
|
||||
auto surface = std::make_shared<Surface>(width, height);
|
||||
auto previuos_renderer = Screen::get()->getRendererSurface();
|
||||
Screen::get()->setRendererSurface(surface);
|
||||
surface->clear(stringToColor("transparent"));
|
||||
surface->clear(255);
|
||||
writeDX(flags, 0, 0, text, kerning, text_color, shadow_distance, shadow_color, lenght);
|
||||
Screen::get()->setRendererSurface(previuos_renderer);
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace Resource {
|
||||
// por lo que updateZoomFactor() se llamará correctamente en RenderInfo::init().
|
||||
if (loading_mode_ == LoadingMode::EAGER) {
|
||||
calculateTotal();
|
||||
Screen::get()->setBorderColor(static_cast<Uint8>(PaletteColor::BLACK));
|
||||
Screen::get()->setBorderColor(0);
|
||||
std::cout << "\n** LOADING RESOURCES" << '\n';
|
||||
loadSounds();
|
||||
loadMusics();
|
||||
@@ -499,11 +499,11 @@ namespace Resource {
|
||||
|
||||
const float BAR_POSITION = Options::game.height - BAR_HEIGHT - Y_PADDING;
|
||||
Screen::get()->start();
|
||||
Screen::get()->clearSurface(static_cast<Uint8>(PaletteColor::BLACK));
|
||||
Screen::get()->clearSurface(0);
|
||||
|
||||
auto surface = Screen::get()->getRendererSurface();
|
||||
const auto LOADING_TEXT_COLOR = static_cast<Uint8>(PaletteColor::BRIGHT_WHITE);
|
||||
const auto BAR_COLOR = static_cast<Uint8>(PaletteColor::WHITE);
|
||||
const auto LOADING_TEXT_COLOR = 15;
|
||||
const auto BAR_COLOR = 14;
|
||||
const int TEXT_HEIGHT = loading_text_->getCharacterSize();
|
||||
const int CENTER_X = Options::game.width / 2;
|
||||
const int CENTER_Y = Options::game.height / 2;
|
||||
|
||||
@@ -66,7 +66,7 @@ void Debug::render() { // NOLINT(readability-make-member-function-const)
|
||||
|
||||
y = 0;
|
||||
for (const auto& l : log_) {
|
||||
text->writeColored(x_ + 10, y, l, static_cast<Uint8>(PaletteColor::WHITE));
|
||||
text->writeColored(x_ + 10, y, l, 14);
|
||||
y += CHAR_SIZE + 1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user