singletons
This commit is contained in:
@@ -6,27 +6,22 @@
|
||||
#include <iostream> // for char_traits, basic_ostream, operator<<
|
||||
#include <string> // for basic_string
|
||||
|
||||
#include "core/audio/jail_audio.hpp" // for JA_StopMusic
|
||||
#include "core/audio/jail_audio.hpp" // for JA_StopMusic
|
||||
#include "core/input/global_inputs.hpp" // for GlobalInputs::handle
|
||||
#include "core/input/input.h" // for Input, REPEAT_FALSE, inputs_e
|
||||
#include "core/locale/lang.h" // for Lang
|
||||
#include "core/rendering/screen.h" // for Screen
|
||||
#include "core/rendering/sprite.h" // for Sprite
|
||||
#include "core/rendering/text.h" // for Text, TXT_CENTER, TXT_COLOR, TXT_SHADOW
|
||||
#include "core/rendering/texture.h" // for Texture
|
||||
#include "core/resources/asset.h" // for Asset
|
||||
#include "core/input/input.h" // for Input, REPEAT_FALSE, inputs_e
|
||||
#include "core/locale/lang.h" // for Lang
|
||||
#include "core/rendering/screen.h" // for Screen
|
||||
#include "core/rendering/sprite.h" // for Sprite
|
||||
#include "core/rendering/text.h" // for Text, TXT_CENTER, TXT_COLOR, TXT_SHADOW
|
||||
#include "core/rendering/texture.h" // for Texture
|
||||
#include "core/resources/resource.h"
|
||||
#include "game/defaults.hpp" // for shdwTxtColor, GAMECANVAS_CENTER_X, GAME...
|
||||
#include "utils/utils.h" // for color_t, section_t
|
||||
|
||||
// Constructor
|
||||
Instructions::Instructions(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input, Lang *lang, section_t *section) {
|
||||
Instructions::Instructions(SDL_Renderer *renderer, section_t *section) {
|
||||
// Copia los punteros
|
||||
this->renderer = renderer;
|
||||
this->screen = screen;
|
||||
this->asset = asset;
|
||||
this->input = input;
|
||||
this->lang = lang;
|
||||
this->section = section;
|
||||
|
||||
// Texturas (handles compartidos de Resource)
|
||||
@@ -122,21 +117,21 @@ void Instructions::render() {
|
||||
SDL_RenderClear(renderer);
|
||||
|
||||
// Escribe el texto
|
||||
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, GAMECANVAS_CENTER_X, 8, lang->getText(11), 1, orangeColor, 1, shdwTxtColor);
|
||||
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, GAMECANVAS_CENTER_X, 24, lang->getText(12), 1, noColor, 1, shdwTxtColor);
|
||||
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, GAMECANVAS_CENTER_X, 34, lang->getText(13), 1, noColor, 1, shdwTxtColor);
|
||||
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, GAMECANVAS_CENTER_X, 48, lang->getText(14), 1, noColor, 1, shdwTxtColor);
|
||||
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, GAMECANVAS_CENTER_X, 58, lang->getText(15), 1, noColor, 1, shdwTxtColor);
|
||||
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, GAMECANVAS_CENTER_X, 75, lang->getText(16), 1, orangeColor, 1, shdwTxtColor);
|
||||
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, GAMECANVAS_CENTER_X, 8, Lang::get()->getText(11), 1, orangeColor, 1, shdwTxtColor);
|
||||
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, GAMECANVAS_CENTER_X, 24, Lang::get()->getText(12), 1, noColor, 1, shdwTxtColor);
|
||||
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, GAMECANVAS_CENTER_X, 34, Lang::get()->getText(13), 1, noColor, 1, shdwTxtColor);
|
||||
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, GAMECANVAS_CENTER_X, 48, Lang::get()->getText(14), 1, noColor, 1, shdwTxtColor);
|
||||
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, GAMECANVAS_CENTER_X, 58, Lang::get()->getText(15), 1, noColor, 1, shdwTxtColor);
|
||||
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, GAMECANVAS_CENTER_X, 75, Lang::get()->getText(16), 1, orangeColor, 1, shdwTxtColor);
|
||||
|
||||
text->writeShadowed(84, 92, lang->getText(17), shdwTxtColor);
|
||||
text->writeShadowed(84, 108, lang->getText(18), shdwTxtColor);
|
||||
text->writeShadowed(84, 124, lang->getText(19), shdwTxtColor);
|
||||
text->writeShadowed(84, 140, lang->getText(20), shdwTxtColor);
|
||||
text->writeShadowed(84, 156, lang->getText(21), shdwTxtColor);
|
||||
text->writeShadowed(84, 92, Lang::get()->getText(17), shdwTxtColor);
|
||||
text->writeShadowed(84, 108, Lang::get()->getText(18), shdwTxtColor);
|
||||
text->writeShadowed(84, 124, Lang::get()->getText(19), shdwTxtColor);
|
||||
text->writeShadowed(84, 140, Lang::get()->getText(20), shdwTxtColor);
|
||||
text->writeShadowed(84, 156, Lang::get()->getText(21), shdwTxtColor);
|
||||
|
||||
if ((mode == m_manual) && (counter % 50 > 14)) {
|
||||
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, GAMECANVAS_CENTER_X, GAMECANVAS_HEIGHT - 12, lang->getText(22), 1, orangeColor, 1, shdwTxtColor);
|
||||
text->writeDX(TXT_CENTER | TXT_COLOR | TXT_SHADOW, GAMECANVAS_CENTER_X, GAMECANVAS_HEIGHT - 12, Lang::get()->getText(22), 1, orangeColor, 1, shdwTxtColor);
|
||||
}
|
||||
|
||||
// Disquito
|
||||
@@ -178,10 +173,10 @@ void Instructions::render() {
|
||||
SDL_SetRenderTarget(renderer, nullptr);
|
||||
|
||||
// Prepara para empezar a dibujar en la textura de juego
|
||||
screen->start();
|
||||
Screen::get()->start();
|
||||
|
||||
// Limpia la pantalla
|
||||
screen->clean(bgColor);
|
||||
Screen::get()->clean(bgColor);
|
||||
|
||||
// Establece la ventana del backbuffer
|
||||
if (mode == m_auto) {
|
||||
@@ -195,7 +190,7 @@ void Instructions::render() {
|
||||
SDL_RenderTexture(renderer, backbuffer, nullptr, &fWindow);
|
||||
|
||||
// Vuelca el contenido del renderizador en pantalla
|
||||
screen->blit();
|
||||
Screen::get()->blit();
|
||||
}
|
||||
|
||||
// Comprueba los eventos
|
||||
@@ -216,15 +211,15 @@ void Instructions::checkEvents() {
|
||||
// Comprueba las entradas
|
||||
void Instructions::checkInput() {
|
||||
#ifndef __EMSCRIPTEN__
|
||||
if (input->checkInput(input_exit, REPEAT_FALSE)) {
|
||||
if (Input::get()->checkInput(input_exit, REPEAT_FALSE)) {
|
||||
quitRequested = true;
|
||||
finished = true;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (GlobalInputs::handle(screen, input)) { return; }
|
||||
if (GlobalInputs::handle()) { return; }
|
||||
|
||||
if (input->checkInput(input_pause, REPEAT_FALSE) || input->checkInput(input_accept, REPEAT_FALSE) || input->checkInput(input_fire_left, REPEAT_FALSE) || input->checkInput(input_fire_center, REPEAT_FALSE) || input->checkInput(input_fire_right, REPEAT_FALSE)) {
|
||||
if (Input::get()->checkInput(input_pause, REPEAT_FALSE) || Input::get()->checkInput(input_accept, REPEAT_FALSE) || Input::get()->checkInput(input_fire_left, REPEAT_FALSE) || Input::get()->checkInput(input_fire_center, REPEAT_FALSE) || Input::get()->checkInput(input_fire_right, REPEAT_FALSE)) {
|
||||
if (mode == m_auto) {
|
||||
finished = true;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user