diff --git a/source/director.cpp b/source/director.cpp index 00c5dd5..1650094 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -9,7 +9,7 @@ Director::Director(std::string path) section.name = SECTION_PROG_LOGO; section.subsection = SUBSECTION_LOGO_TO_INTRO; - section.name = SECTION_PROG_LOGO; + section.name = SECTION_PROG_TITLE; // Crea el objeto que controla los ficheros de recursos asset = new Asset(path.substr(0, path.find_last_of("\\/"))); diff --git a/source/item.cpp b/source/item.cpp index e058b6d..6b824e5 100644 --- a/source/item.cpp +++ b/source/item.cpp @@ -70,4 +70,19 @@ SDL_Point Item::getPos() void Item::reLoadTexture() { texture->reLoad(); +} + +// Asigna los colores del objeto +void Item::setColors(color_t col1, color_t col2) +{ + // Reinicializa el vector de colores + color.clear(); + + // Añade el primer color + color.push_back(col1); + color.push_back(col1); + + // Añade el segundo color + color.push_back(col2); + color.push_back(col2); } \ No newline at end of file diff --git a/source/item.h b/source/item.h index e3dd302..b193f0b 100644 --- a/source/item.h +++ b/source/item.h @@ -59,8 +59,8 @@ public: // Recarga la textura void reLoadTexture(); - // Recarga la paleta - void reLoadPalette(palette_e pal); + // Asigna los colores del objeto + void setColors(color_t col1, color_t col2); }; #endif diff --git a/source/room.cpp b/source/room.cpp index 877e22e..d80e520 100644 --- a/source/room.cpp +++ b/source/room.cpp @@ -812,7 +812,7 @@ int Room::getSlopeHeight(SDL_Point p, tile_e slope) debug->add("BASE = " + std::to_string(base)); // Calcula cuanto se ha entrado en el tile horizontalmente - const int pos = (p.x % tileSize); // esto da un valor entre 0 y 7 + const int pos = (p.x % tileSize); // Esto da un valor entre 0 y 7 debug->add("POS = " + std::to_string(pos)); // Se resta a la base la cantidad de pixeles pos en funcion de la rampa diff --git a/source/title.cpp b/source/title.cpp index f99fb5d..21a0c07 100644 --- a/source/title.cpp +++ b/source/title.cpp @@ -82,27 +82,32 @@ void Title::checkEventHandler() case SDL_SCANCODE_F: screen->switchVideoMode(); - texture->reLoad(); + reLoadTextures(); break; case SDL_SCANCODE_F1: screen->setWindowSize(1); - texture->reLoad(); + reLoadTextures(); break; case SDL_SCANCODE_F2: screen->setWindowSize(2); - texture->reLoad(); + reLoadTextures(); break; case SDL_SCANCODE_F3: screen->setWindowSize(3); - texture->reLoad(); + reLoadTextures(); break; case SDL_SCANCODE_F4: screen->setWindowSize(4); - texture->reLoad(); + reLoadTextures(); + break; + + case SDL_SCANCODE_F5: + switchPalette(); + reLoadTextures(); break; default: @@ -220,4 +225,34 @@ section_t Title::run() } return section; +} + +// Recarga las texturas +void Title::reLoadTextures() +{ + // Carga la textura adecuada + if (options->palette == p_zxspectrum) + { + texture->loadFromFile(asset->get("loading_screen_color.png"), renderer); + } + else if (options->palette == p_zxarne) + { + texture->loadFromFile(asset->get("loading_screen_color_zxarne.png"), renderer); + } +} + +// Cambia la paleta +void Title::switchPalette() +{ + if (options->palette == p_zxspectrum) + { + options->palette = p_zxarne; + } + else + { + options->palette = p_zxspectrum; + } + + // Cambia el color del borde + screen->setBorderColor(stringToColor(options->palette, "bright_blue")); } \ No newline at end of file diff --git a/source/title.h b/source/title.h index 188b2d0..8df341f 100644 --- a/source/title.h +++ b/source/title.h @@ -56,6 +56,12 @@ private: // Dibuja la marquesina void renderMarquee(); + // Recarga las texturas + void reLoadTextures(); + + // Cambia la paleta + void switchPalette(); + public: // Constructor Title(SDL_Renderer *renderer, Screen *screen, Asset *asset, options_t *options); diff --git a/todo.txt b/todo.txt index 3116611..056fa6d 100644 --- a/todo.txt +++ b/todo.txt @@ -54,6 +54,8 @@ x (B) Así como no necesitar lo de frames per row x (C) Que no cree la ventana y luego añada el borde x (A) Las vidas del marcador no estan animadas. No cambian de frame (A) Mejorar las cintas. no permitir saltar hacia atras +(A) Cambio de paleta en caliente +(A) Precargar todos los recursos del juego ## TEMAS