canviat Options de struct a namespace
This commit is contained in:
@@ -4,17 +4,17 @@
|
||||
|
||||
#include <algorithm> // Para min
|
||||
|
||||
#include "utils/defines.hpp" // Para GAME_SPEED
|
||||
#include "external/jail_audio.h" // Para JA_SetVolume, JA_PlayMusic, JA_StopMusic
|
||||
#include "utils/global_events.hpp" // Para check
|
||||
#include "core/input/global_inputs.hpp" // Para check
|
||||
#include "game/gameplay/options.hpp" // Para Options, options, OptionsGame, SectionS...
|
||||
#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_sprite.hpp" // Para SSprite
|
||||
#include "core/rendering/surface.hpp" // Para Surface
|
||||
#include "core/rendering/text.hpp" // Para Text, TEXT_STROKE
|
||||
#include "utils/utils.hpp" // Para PaletteColor
|
||||
#include "core/rendering/text.hpp" // Para Text, TEXT_STROKE
|
||||
#include "core/resources/resource.hpp" // Para Resource
|
||||
#include "external/jail_audio.h" // Para JA_SetVolume, JA_PlayMusic, JA_StopMusic
|
||||
#include "game/gameplay/options.hpp" // Para Options, options, OptionsGame, SectionS...
|
||||
#include "utils/defines.hpp" // Para GAME_SPEED
|
||||
#include "utils/global_events.hpp" // Para check
|
||||
#include "utils/utils.hpp" // Para PaletteColor
|
||||
|
||||
// Constructor
|
||||
Ending::Ending()
|
||||
@@ -23,8 +23,8 @@ Ending::Ending()
|
||||
cover_counter_(0),
|
||||
ticks_(0),
|
||||
current_scene_(0) {
|
||||
options.section.section = Section::ENDING;
|
||||
options.section.subsection = Subsection::NONE;
|
||||
Options::section.section = Options::Scene::ENDING;
|
||||
Options::section.subsection = Options::SceneOptions::NONE;
|
||||
|
||||
// Inicializa los textos
|
||||
iniTexts();
|
||||
@@ -39,7 +39,7 @@ Ending::Ending()
|
||||
Screen::get()->setBorderColor(static_cast<Uint8>(PaletteColor::BLACK));
|
||||
|
||||
// Crea la textura para cubrir el texto
|
||||
cover_surface_ = std::make_shared<Surface>(options.game.width, options.game.height + 8);
|
||||
cover_surface_ = std::make_shared<Surface>(Options::game.width, Options::game.height + 8);
|
||||
|
||||
// Rellena la textura para la cortinilla
|
||||
fillCoverTexture();
|
||||
@@ -167,7 +167,7 @@ void Ending::iniTexts() {
|
||||
|
||||
// Crea el sprite
|
||||
st.image_sprite = std::make_shared<SSprite>(st.image_surface, 0, 0, st.image_surface->getWidth(), st.image_surface->getHeight());
|
||||
st.image_sprite->setPosition((options.game.width - st.image_surface->getWidth()) / 2, txt.pos);
|
||||
st.image_sprite->setPosition((Options::game.width - st.image_surface->getWidth()) / 2, txt.pos);
|
||||
|
||||
// Crea la cover_surface
|
||||
st.cover_surface = std::make_shared<Surface>(WIDTH, HEIGHT + 8);
|
||||
@@ -195,7 +195,7 @@ void Ending::iniTexts() {
|
||||
|
||||
// Crea el sprite
|
||||
st.cover_sprite = std::make_shared<SSprite>(st.cover_surface, 0, 0, st.cover_surface->getWidth(), st.cover_surface->getHeight() - 8);
|
||||
st.cover_sprite->setPosition((options.game.width - st.cover_surface->getWidth()) / 2, txt.pos);
|
||||
st.cover_sprite->setPosition((Options::game.width - st.cover_surface->getWidth()) / 2, txt.pos);
|
||||
st.cover_sprite->setClip(0, 8, st.cover_surface->getWidth(), st.cover_surface->getHeight());
|
||||
|
||||
// Inicializa variables
|
||||
@@ -232,7 +232,7 @@ void Ending::iniPics() {
|
||||
|
||||
// Crea el sprite
|
||||
sp.image_sprite = std::make_shared<SSprite>(sp.image_surface, 0, 0, WIDTH, HEIGHT);
|
||||
sp.image_sprite->setPosition((options.game.width - WIDTH) / 2, pic.pos);
|
||||
sp.image_sprite->setPosition((Options::game.width - WIDTH) / 2, pic.pos);
|
||||
|
||||
// Crea la cover_surface
|
||||
sp.cover_surface = std::make_shared<Surface>(WIDTH, HEIGHT + 8);
|
||||
@@ -261,7 +261,7 @@ void Ending::iniPics() {
|
||||
|
||||
// Crea el sprite
|
||||
sp.cover_sprite = std::make_shared<SSprite>(sp.cover_surface, 0, 0, sp.cover_surface->getWidth(), sp.cover_surface->getHeight() - 8);
|
||||
sp.cover_sprite->setPosition((options.game.width - sp.cover_surface->getWidth()) / 2, pic.pos);
|
||||
sp.cover_sprite->setPosition((Options::game.width - sp.cover_surface->getWidth()) / 2, pic.pos);
|
||||
sp.cover_sprite->setClip(0, 8, sp.cover_surface->getWidth(), sp.cover_surface->getHeight());
|
||||
|
||||
// Inicializa variables
|
||||
@@ -359,7 +359,7 @@ void Ending::iniScenes() {
|
||||
void Ending::run() {
|
||||
JA_PlayMusic(Resource::get()->getMusic("ending1.ogg"));
|
||||
|
||||
while (options.section.section == Section::ENDING) {
|
||||
while (Options::section.section == Options::Scene::ENDING) {
|
||||
update();
|
||||
checkEvents();
|
||||
render();
|
||||
@@ -423,7 +423,7 @@ void Ending::checkChangeScene() {
|
||||
cover_counter_ = 0;
|
||||
if (current_scene_ == 5) {
|
||||
// Termina el bucle
|
||||
options.section.section = Section::ENDING2;
|
||||
Options::section.section = Options::Scene::ENDING2;
|
||||
|
||||
// Mantiene los valores anteriores
|
||||
current_scene_ = 4;
|
||||
@@ -443,17 +443,17 @@ void Ending::fillCoverTexture() {
|
||||
const Uint8 color = static_cast<Uint8>(PaletteColor::BLACK);
|
||||
auto surface = Screen::get()->getRendererSurface();
|
||||
for (int i = 0; i < 256; i += 2) {
|
||||
surface->putPixel(i + 0, options.game.height + 0, color);
|
||||
surface->putPixel(i + 1, options.game.height + 1, color);
|
||||
surface->putPixel(i + 0, options.game.height + 2, color);
|
||||
surface->putPixel(i + 1, options.game.height + 3, color);
|
||||
surface->putPixel(i + 0, Options::game.height + 0, color);
|
||||
surface->putPixel(i + 1, Options::game.height + 1, color);
|
||||
surface->putPixel(i + 0, Options::game.height + 2, color);
|
||||
surface->putPixel(i + 1, Options::game.height + 3, color);
|
||||
|
||||
surface->putPixel(i, options.game.height + 4, color);
|
||||
surface->putPixel(i, options.game.height + 6, color);
|
||||
surface->putPixel(i, Options::game.height + 4, color);
|
||||
surface->putPixel(i, Options::game.height + 6, color);
|
||||
}
|
||||
|
||||
// El resto se rellena de color sólido
|
||||
SDL_FRect rect = {0, 0, 256, options.game.height};
|
||||
SDL_FRect rect = {0, 0, 256, Options::game.height};
|
||||
surface->fillRect(&rect, color);
|
||||
|
||||
Screen::get()->setRendererSurface(previuos_renderer);
|
||||
|
||||
Reference in New Issue
Block a user