diff --git a/source/service_menu.cpp b/source/service_menu.cpp index dfc3f50..e7e232b 100644 --- a/source/service_menu.cpp +++ b/source/service_menu.cpp @@ -1,6 +1,10 @@ #include "service_menu.h" #include "screen.h" #include +#include +#include +#include "text.h" +#include "resource.h" // Singleton ServiceMenu *ServiceMenu::instance_ = nullptr; @@ -16,8 +20,9 @@ ServiceMenu *ServiceMenu::get() { return ServiceMenu::instance_; } // Constructor ServiceMenu::ServiceMenu() + : text_(Resource::get()->getText("04b_25_metal")) { - constexpr float GAP = 15.0f; + constexpr float GAP = 30.0f; rect_ = {GAP, GAP, param.game.width - GAP * 2, param.game.height - GAP * 2}; } @@ -30,11 +35,55 @@ void ServiceMenu::render() { if (enabled_) { + constexpr int SEPARATION = 14; + constexpr std::array MAIN_LIST = { + "VIDEO", + "AUDIO", + "GAME", + "SYSTEM"}; + + constexpr std::array VIDEO_LIST = { + "VIDEO MODE", + "WINDOW SIZE", + "SHADERS", + "VSYNC", + "INTEGER SCALE"}; + + constexpr std::array AUDIO_LIST = { + "AUDIO", + "MAIN VOLUME", + "MUSIC VOLUME", + "SFX VOLUME"}; + + constexpr std::array GAME_LIST = { + "AUTOFIRE", + "LANG"}; + + constexpr std::array SYSTEM_LIST = { + "RESET", + "EXIT", + "SHUTDOWN"}; + + // FONDO SDL_SetRenderDrawColor(Screen::get()->getRenderer(), 0, 0, 0, 224); SDL_RenderFillRect(Screen::get()->getRenderer(), &rect_); + // BORDE SDL_SetRenderDrawColor(Screen::get()->getRenderer(), 224, 224, 224, 255); SDL_RenderRect(Screen::get()->getRenderer(), &rect_); + + // SERVICE MENU + text_->writeDX(TEXT_COLOR | TEXT_CENTER, param.game.game_area.center_x, rect_.y + SEPARATION, "SERVICE MENU", -2, BLUE_SKY_COLOR.lighten()); + + // LINEA + SDL_SetRenderDrawColor(Screen::get()->getRenderer(), BLUE_SKY_COLOR.lighten().r, BLUE_SKY_COLOR.lighten().g, BLUE_SKY_COLOR.lighten().b, 255); + SDL_RenderLine(Screen::get()->getRenderer(), rect_.x + 20, rect_.y + SEPARATION * 3, rect_.x + rect_.w - 20, rect_.y + SEPARATION * 3); + + // LIST + for (size_t i = 0; i < MAIN_LIST.size(); ++i) + { + text_->writeColored(rect_.x + 20, rect_.y + (SEPARATION * 4) + (i * (SEPARATION + SEPARATION * 0.5f)), MAIN_LIST.at(i), BLUE_SKY_COLOR.lighten(100), -2); + } } } diff --git a/source/service_menu.h b/source/service_menu.h index 5095721..38d2075 100644 --- a/source/service_menu.h +++ b/source/service_menu.h @@ -2,8 +2,11 @@ #include #include +#include #include +class Text; + class ServiceMenu { public: @@ -19,8 +22,9 @@ public: private: // -- Variables internas --- - bool enabled_ = false; - SDL_FRect rect_; // Rectangulo para definir el area del menú de servicio + bool enabled_ = false; // Indica si el menú de servicio está activo + SDL_FRect rect_; // Rectangulo para definir el area del menú de servicio + std::shared_ptr text_; // Objeto para escribir texto; // --- Patrón Singleton --- ServiceMenu(); // Constructor privado