canviat Options de struct a namespace
This commit is contained in:
@@ -4,33 +4,33 @@
|
||||
|
||||
#include <algorithm> // Para min
|
||||
|
||||
#include "utils/defines.hpp" // Para GAME_SPEED, PLAY_AREA_CENTER_X, PLAY_...
|
||||
#include "utils/global_events.hpp" // Para check
|
||||
#include "core/input/global_inputs.hpp" // Para check
|
||||
#include "game/gameplay/options.hpp" // Para Options, options, OptionsGame, Sectio...
|
||||
#include "core/resources/resource.hpp" // Para Resource
|
||||
#include "core/rendering/screen.hpp" // Para Screen
|
||||
#include "core/input/global_inputs.hpp" // Para check
|
||||
#include "core/rendering/screen.hpp" // Para Screen
|
||||
#include "core/rendering/surface.hpp" // Para Surface
|
||||
#include "core/rendering/surface_animated_sprite.hpp" // Para SAnimatedSprite
|
||||
#include "core/rendering/surface.hpp" // Para Surface
|
||||
#include "core/rendering/text.hpp" // Para Text, TEXT_CENTER, TEXT_COLOR
|
||||
#include "utils/utils.hpp" // Para PaletteColor
|
||||
#include "core/rendering/text.hpp" // Para Text, TEXT_CENTER, TEXT_COLOR
|
||||
#include "core/resources/resource.hpp" // Para Resource
|
||||
#include "game/gameplay/options.hpp" // Para Options, options, OptionsGame, Sectio...
|
||||
#include "utils/defines.hpp" // Para GAME_SPEED, PLAY_AREA_CENTER_X, PLAY_...
|
||||
#include "utils/global_events.hpp" // Para check
|
||||
#include "utils/utils.hpp" // Para PaletteColor
|
||||
|
||||
// Constructor
|
||||
Credits::Credits()
|
||||
: shining_sprite_(std::make_shared<SAnimatedSprite>(Resource::get()->getSurface("shine.gif"), Resource::get()->getAnimations("shine.ani"))) {
|
||||
// Inicializa variables
|
||||
options.section.section = Section::CREDITS;
|
||||
options.section.subsection = Subsection::NONE;
|
||||
Options::section.section = Options::Scene::CREDITS;
|
||||
Options::section.subsection = Options::SceneOptions::NONE;
|
||||
shining_sprite_->setPos({194, 174, 8, 8});
|
||||
|
||||
// Cambia el color del borde
|
||||
Screen::get()->setBorderColor(static_cast<Uint8>(PaletteColor::BLACK));
|
||||
|
||||
// Crea la textura para el texto que se escribe en pantalla
|
||||
text_surface_ = std::make_shared<Surface>(options.game.width, options.game.height);
|
||||
text_surface_ = std::make_shared<Surface>(Options::game.width, Options::game.height);
|
||||
|
||||
// Crea la textura para cubrir el rexto
|
||||
cover_surface_ = std::make_shared<Surface>(options.game.width, options.game.height);
|
||||
cover_surface_ = std::make_shared<Surface>(Options::game.width, Options::game.height);
|
||||
|
||||
// Escribe el texto en la textura
|
||||
fillTexture();
|
||||
@@ -51,17 +51,16 @@ void Credits::checkInput() {
|
||||
|
||||
// Inicializa los textos
|
||||
void Credits::iniTexts() {
|
||||
#ifndef GAME_CONSOLE
|
||||
std::string keys = "";
|
||||
|
||||
switch (options.keys) {
|
||||
case ControlScheme::CURSOR:
|
||||
switch (Options::keys) {
|
||||
case Options::ControlScheme::CURSOR:
|
||||
keys = "CURSORS";
|
||||
break;
|
||||
case ControlScheme::OPQA:
|
||||
case Options::ControlScheme::OPQA:
|
||||
keys = "O,P AND Q";
|
||||
break;
|
||||
case ControlScheme::WASD:
|
||||
case Options::ControlScheme::WASD:
|
||||
keys = "A,D AND W";
|
||||
break;
|
||||
default:
|
||||
@@ -96,36 +95,6 @@ void Credits::iniTexts() {
|
||||
|
||||
texts_.push_back({"I LOVE JAILGAMES! ", static_cast<Uint8>(PaletteColor::WHITE)});
|
||||
texts_.push_back({"", static_cast<Uint8>(PaletteColor::WHITE)});
|
||||
#else
|
||||
texts.clear();
|
||||
texts.push_back({"", static_cast<Uint8>(PaletteColor::WHITE)});
|
||||
texts.push_back({"INSTRUCTIONS:", static_cast<Uint8>(PaletteColor::YELLOW)});
|
||||
texts.push_back({"", static_cast<Uint8>(PaletteColor::WHITE)});
|
||||
texts.push_back({"HELP JAILDOC TO GET BACK ALL", static_cast<Uint8>(PaletteColor::WHITE)});
|
||||
texts.push_back({"HIS PROJECTS AND GO TO THE", static_cast<Uint8>(PaletteColor::WHITE)});
|
||||
texts.push_back({"JAIL TO FINISH THEM", static_cast<Uint8>(PaletteColor::WHITE)});
|
||||
texts.push_back({"", static_cast<Uint8>(PaletteColor::WHITE)});
|
||||
texts.push_back({"", static_cast<Uint8>(PaletteColor::WHITE)});
|
||||
|
||||
texts.push_back({"KEYS:", static_cast<Uint8>(PaletteColor::YELLOW)});
|
||||
texts.push_back({"", static_cast<Uint8>(PaletteColor::WHITE)});
|
||||
texts.push_back({"B TO JUMP", static_cast<Uint8>(PaletteColor::WHITE)});
|
||||
texts.push_back({"R TO SWITCH THE MUSIC", static_cast<Uint8>(PaletteColor::WHITE)});
|
||||
texts.push_back({"L TO SWAP THE COLOR PALETTE", static_cast<Uint8>(PaletteColor::WHITE)});
|
||||
texts.push_back({"START TO PAUSE", static_cast<Uint8>(PaletteColor::WHITE)});
|
||||
texts.push_back({"SELECT TO EXIT", static_cast<Uint8>(PaletteColor::WHITE)});
|
||||
texts.push_back({"", static_cast<Uint8>(PaletteColor::WHITE)});
|
||||
texts.push_back({"", static_cast<Uint8>(PaletteColor::WHITE)});
|
||||
texts.push_back({"", static_cast<Uint8>(PaletteColor::WHITE)});
|
||||
|
||||
texts.push_back({"A GAME BY JAILDESIGNER", static_cast<Uint8>(PaletteColor::YELLOW)});
|
||||
texts.push_back({"MADE ON SUMMER/FALL 2022", static_cast<Uint8>(PaletteColor::YELLOW)});
|
||||
texts.push_back({"", static_cast<Uint8>(PaletteColor::WHITE)});
|
||||
texts.push_back({"", static_cast<Uint8>(PaletteColor::WHITE)});
|
||||
|
||||
texts.push_back({"I LOVE JAILGAMES! ", static_cast<Uint8>(PaletteColor::WHITE)});
|
||||
texts.push_back({"", static_cast<Uint8>(PaletteColor::WHITE)});
|
||||
#endif
|
||||
}
|
||||
|
||||
// Escribe el texto en la textura
|
||||
@@ -196,7 +165,7 @@ void Credits::updateCounter() {
|
||||
|
||||
// Comprueba si ha terminado la sección
|
||||
if (counter_ > 1200) {
|
||||
options.section.section = Section::DEMO;
|
||||
Options::section.section = Options::Scene::DEMO;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,7 +218,7 @@ void Credits::render() {
|
||||
|
||||
// Bucle para el logo del juego
|
||||
void Credits::run() {
|
||||
while (options.section.section == Section::CREDITS) {
|
||||
while (Options::section.section == Options::Scene::CREDITS) {
|
||||
update();
|
||||
checkEvents();
|
||||
render();
|
||||
|
||||
Reference in New Issue
Block a user