forked from jaildesigner-jailgames/jaildoctors_dilemma
merdes varies
This commit is contained in:
@@ -12,6 +12,10 @@
|
|||||||
#include "game/ui/notifier.hpp" // Para Notifier, NotificationText
|
#include "game/ui/notifier.hpp" // Para Notifier, NotificationText
|
||||||
#include "utils/utils.hpp" // Para stringInVector
|
#include "utils/utils.hpp" // Para stringInVector
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#include "core/system/debug.hpp" // Para Debug
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace GlobalInputs {
|
namespace GlobalInputs {
|
||||||
|
|
||||||
// Funciones internas
|
// Funciones internas
|
||||||
@@ -101,10 +105,17 @@ void handleToggleVSync() {
|
|||||||
Notifier::get()->show({"V-SYNC " + std::string(Options::video.vertical_sync ? "ENABLED" : "DISABLED")}, NotificationText::CENTER);
|
Notifier::get()->show({"V-SYNC " + std::string(Options::video.vertical_sync ? "ENABLED" : "DISABLED")}, NotificationText::CENTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
void handleShowDebugInfo() {
|
void handleShowDebugInfo() {
|
||||||
Screen::get()->toggleDebugInfo();
|
Screen::get()->toggleDebugInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void handleToggleDebug() {
|
||||||
|
Debug::get()->toggleEnabled();
|
||||||
|
Notifier::get()->show({"DEBUG " + std::string(Debug::get()->getEnabled() ? "ENABLED" : "DISABLED")}, NotificationText::CENTER);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Detecta qué acción global ha sido presionada (si alguna)
|
// Detecta qué acción global ha sido presionada (si alguna)
|
||||||
auto getPressedAction() -> InputAction {
|
auto getPressedAction() -> InputAction {
|
||||||
if (Input::get()->checkAction(InputAction::EXIT, Input::DO_NOT_ALLOW_REPEAT)) {
|
if (Input::get()->checkAction(InputAction::EXIT, Input::DO_NOT_ALLOW_REPEAT)) {
|
||||||
@@ -140,6 +151,9 @@ auto getPressedAction() -> InputAction {
|
|||||||
if (Input::get()->checkAction(InputAction::TOGGLE_VSYNC, Input::DO_NOT_ALLOW_REPEAT)) {
|
if (Input::get()->checkAction(InputAction::TOGGLE_VSYNC, Input::DO_NOT_ALLOW_REPEAT)) {
|
||||||
return InputAction::TOGGLE_VSYNC;
|
return InputAction::TOGGLE_VSYNC;
|
||||||
}
|
}
|
||||||
|
if (Input::get()->checkAction(InputAction::TOGGLE_DEBUG, Input::DO_NOT_ALLOW_REPEAT)) {
|
||||||
|
return InputAction::TOGGLE_DEBUG;
|
||||||
|
}
|
||||||
if (Input::get()->checkAction(InputAction::SHOW_DEBUG_INFO, Input::DO_NOT_ALLOW_REPEAT)) {
|
if (Input::get()->checkAction(InputAction::SHOW_DEBUG_INFO, Input::DO_NOT_ALLOW_REPEAT)) {
|
||||||
return InputAction::SHOW_DEBUG_INFO;
|
return InputAction::SHOW_DEBUG_INFO;
|
||||||
}
|
}
|
||||||
@@ -201,6 +215,10 @@ void handle() {
|
|||||||
handleToggleVSync();
|
handleToggleVSync();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case InputAction::TOGGLE_DEBUG:
|
||||||
|
handleToggleDebug();
|
||||||
|
break;
|
||||||
|
|
||||||
case InputAction::SHOW_DEBUG_INFO:
|
case InputAction::SHOW_DEBUG_INFO:
|
||||||
handleShowDebugInfo();
|
handleShowDebugInfo();
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -78,8 +78,8 @@ class Input {
|
|||||||
{Action::TOGGLE_MUSIC, KeyState(SDL_SCANCODE_F8)},
|
{Action::TOGGLE_MUSIC, KeyState(SDL_SCANCODE_F8)},
|
||||||
{Action::TOGGLE_BORDER, KeyState(SDL_SCANCODE_F9)},
|
{Action::TOGGLE_BORDER, KeyState(SDL_SCANCODE_F9)},
|
||||||
{Action::TOGGLE_VSYNC, KeyState(SDL_SCANCODE_F10)},
|
{Action::TOGGLE_VSYNC, KeyState(SDL_SCANCODE_F10)},
|
||||||
{Action::PAUSE, KeyState(SDL_SCANCODE_F11)},
|
{Action::TOGGLE_DEBUG, KeyState(SDL_SCANCODE_F12)},
|
||||||
{Action::SHOW_DEBUG_INFO, KeyState(SDL_SCANCODE_F12)}} {}
|
{Action::SHOW_DEBUG_INFO, KeyState(SDL_SCANCODE_F11)}} {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Gamepad {
|
struct Gamepad {
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ const std::unordered_map<InputAction, std::string> ACTION_TO_STRING = {
|
|||||||
{InputAction::PREVIOUS_PALETTE, "PREVIOUS_PALETTE"},
|
{InputAction::PREVIOUS_PALETTE, "PREVIOUS_PALETTE"},
|
||||||
{InputAction::TOGGLE_SHADERS, "TOGGLE_SHADERS"},
|
{InputAction::TOGGLE_SHADERS, "TOGGLE_SHADERS"},
|
||||||
{InputAction::SHOW_DEBUG_INFO, "SHOW_DEBUG_INFO"},
|
{InputAction::SHOW_DEBUG_INFO, "SHOW_DEBUG_INFO"},
|
||||||
|
{InputAction::TOGGLE_DEBUG, "TOGGLE_DEBUG"},
|
||||||
{InputAction::NONE, "NONE"}};
|
{InputAction::NONE, "NONE"}};
|
||||||
|
|
||||||
const std::unordered_map<std::string, InputAction> STRING_TO_ACTION = {
|
const std::unordered_map<std::string, InputAction> STRING_TO_ACTION = {
|
||||||
@@ -43,6 +44,7 @@ const std::unordered_map<std::string, InputAction> STRING_TO_ACTION = {
|
|||||||
{"PREVIOUS_PALETTE", InputAction::PREVIOUS_PALETTE},
|
{"PREVIOUS_PALETTE", InputAction::PREVIOUS_PALETTE},
|
||||||
{"TOGGLE_SHADERS", InputAction::TOGGLE_SHADERS},
|
{"TOGGLE_SHADERS", InputAction::TOGGLE_SHADERS},
|
||||||
{"SHOW_DEBUG_INFO", InputAction::SHOW_DEBUG_INFO},
|
{"SHOW_DEBUG_INFO", InputAction::SHOW_DEBUG_INFO},
|
||||||
|
{"TOGGLE_DEBUG", InputAction::TOGGLE_DEBUG},
|
||||||
{"NONE", InputAction::NONE}};
|
{"NONE", InputAction::NONE}};
|
||||||
|
|
||||||
const std::unordered_map<SDL_GamepadButton, std::string> BUTTON_TO_STRING = {
|
const std::unordered_map<SDL_GamepadButton, std::string> BUTTON_TO_STRING = {
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ enum class InputAction : int { // Acciones de entrada posibles en el juego
|
|||||||
NEXT_PALETTE,
|
NEXT_PALETTE,
|
||||||
PREVIOUS_PALETTE,
|
PREVIOUS_PALETTE,
|
||||||
SHOW_DEBUG_INFO,
|
SHOW_DEBUG_INFO,
|
||||||
|
TOGGLE_DEBUG,
|
||||||
|
|
||||||
// Input obligatorio
|
// Input obligatorio
|
||||||
NONE,
|
NONE,
|
||||||
|
|||||||
@@ -7,23 +7,6 @@
|
|||||||
|
|
||||||
// Clase Debug
|
// Clase Debug
|
||||||
class Debug {
|
class Debug {
|
||||||
private:
|
|
||||||
// [SINGLETON] Objeto privado
|
|
||||||
static Debug* debug;
|
|
||||||
|
|
||||||
// Variables
|
|
||||||
std::vector<std::string> slot_; // Vector con los textos a escribir
|
|
||||||
std::vector<std::string> log_; // Vector con los textos a escribir
|
|
||||||
int x_ = 0; // Posicion donde escribir el texto de debug
|
|
||||||
int y_ = 0; // Posición donde escribir el texto de debug
|
|
||||||
bool enabled_ = false; // Indica si esta activo el modo debug
|
|
||||||
|
|
||||||
// Constructor
|
|
||||||
Debug() = default;
|
|
||||||
|
|
||||||
// Destructor
|
|
||||||
~Debug() = default;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// [SINGLETON] Crearemos el objeto con esta función estática
|
// [SINGLETON] Crearemos el objeto con esta función estática
|
||||||
static void init();
|
static void init();
|
||||||
@@ -50,4 +33,21 @@ class Debug {
|
|||||||
void clearLog() { log_.clear(); }
|
void clearLog() { log_.clear(); }
|
||||||
void setEnabled(bool value) { enabled_ = value; }
|
void setEnabled(bool value) { enabled_ = value; }
|
||||||
void toggleEnabled() { enabled_ = !enabled_; }
|
void toggleEnabled() { enabled_ = !enabled_; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
// [SINGLETON] Objeto privado
|
||||||
|
static Debug* debug;
|
||||||
|
|
||||||
|
// Variables
|
||||||
|
std::vector<std::string> slot_; // Vector con los textos a escribir
|
||||||
|
std::vector<std::string> log_; // Vector con los textos a escribir
|
||||||
|
int x_ = 0; // Posicion donde escribir el texto de debug
|
||||||
|
int y_ = 0; // Posición donde escribir el texto de debug
|
||||||
|
bool enabled_ = false; // Indica si esta activo el modo debug
|
||||||
|
|
||||||
|
// Constructor
|
||||||
|
Debug() = default;
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
~Debug() = default;
|
||||||
};
|
};
|
||||||
@@ -34,7 +34,7 @@ enum class Options {
|
|||||||
|
|
||||||
// --- Variables de estado globales ---
|
// --- Variables de estado globales ---
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
inline Scene current = Scene::LOGO; // Escena actual
|
inline Scene current = Scene::GAME; // Escena actual
|
||||||
inline Options options = Options::LOGO_TO_LOADING_SCREEN; // Opciones de la escena actual
|
inline Options options = Options::LOGO_TO_LOADING_SCREEN; // Opciones de la escena actual
|
||||||
#else
|
#else
|
||||||
inline Scene current = Scene::LOGO; // Escena actual
|
inline Scene current = Scene::LOGO; // Escena actual
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
#include "core/rendering/text.hpp" // Para Text, TEXT_CENTER, TEXT_COLOR
|
#include "core/rendering/text.hpp" // Para Text, TEXT_CENTER, TEXT_COLOR
|
||||||
#include "core/resources/asset.hpp" // Para Asset
|
#include "core/resources/asset.hpp" // Para Asset
|
||||||
#include "core/resources/resource.hpp" // Para ResourceRoom, Resource
|
#include "core/resources/resource.hpp" // Para ResourceRoom, Resource
|
||||||
#include "core/system/debug.hpp" // Para Debug
|
|
||||||
#include "core/system/global_events.hpp" // Para check
|
#include "core/system/global_events.hpp" // Para check
|
||||||
#include "game/gameplay/cheevos.hpp" // Para Cheevos
|
#include "game/gameplay/cheevos.hpp" // Para Cheevos
|
||||||
#include "game/gameplay/item_tracker.hpp" // Para ItemTracker
|
#include "game/gameplay/item_tracker.hpp" // Para ItemTracker
|
||||||
@@ -27,6 +26,10 @@
|
|||||||
#include "utils/defines.hpp" // Para TILE_SIZE, PLAY_AREA_HEIGHT, RoomBorder::BOTTOM
|
#include "utils/defines.hpp" // Para TILE_SIZE, PLAY_AREA_HEIGHT, RoomBorder::BOTTOM
|
||||||
#include "utils/utils.hpp" // Para PaletteColor, stringToColor
|
#include "utils/utils.hpp" // Para PaletteColor, stringToColor
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#include "core/system/debug.hpp" // Para Debug
|
||||||
|
#endif
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Game::Game(Mode mode)
|
Game::Game(Mode mode)
|
||||||
: board_(std::make_shared<ScoreboardData>(0, 9, 0, true, 0, SDL_GetTicks(), Options::cheats.jail_is_open == Options::Cheat::State::ENABLED)),
|
: board_(std::make_shared<ScoreboardData>(0, 9, 0, true, 0, SDL_GetTicks(), Options::cheats.jail_is_open == Options::Cheat::State::ENABLED)),
|
||||||
@@ -42,10 +45,6 @@ Game::Game(Mode mode)
|
|||||||
spawn_data_(Player::SpawnData(25 * TILE_SIZE, 13 * TILE_SIZE, 0, 0, 0, Player::State::STANDING, SDL_FLIP_HORIZONTAL))
|
spawn_data_(Player::SpawnData(25 * TILE_SIZE, 13 * TILE_SIZE, 0, 0, 0, Player::State::STANDING, SDL_FLIP_HORIZONTAL))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
|
||||||
Debug::get()->setEnabled(false);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Crea objetos e inicializa variables
|
// Crea objetos e inicializa variables
|
||||||
ItemTracker::init();
|
ItemTracker::init();
|
||||||
demoInit();
|
demoInit();
|
||||||
|
|||||||
@@ -274,7 +274,8 @@ void Logo::initSprites() {
|
|||||||
jailgames_sprite_.back()->setClip(0, i, jailgames_surface_->getWidth(), 1);
|
jailgames_sprite_.back()->setClip(0, i, jailgames_surface_->getWidth(), 1);
|
||||||
|
|
||||||
// Calcular posición inicial (alternando entre derecha e izquierda)
|
// Calcular posición inicial (alternando entre derecha e izquierda)
|
||||||
const int initial_x = (i % 2 == 0) ? (256 + (i * 3)) : (static_cast<int>(-WIDTH) - (i * 3));
|
constexpr int LINE_OFFSET = 6;
|
||||||
|
const int initial_x = (i % 2 == 0) ? (256 + (i * LINE_OFFSET)) : (static_cast<int>(-WIDTH) - (i * LINE_OFFSET));
|
||||||
jailgames_initial_x_.push_back(initial_x);
|
jailgames_initial_x_.push_back(initial_x);
|
||||||
|
|
||||||
jailgames_sprite_.at(i)->setX(initial_x);
|
jailgames_sprite_.at(i)->setX(initial_x);
|
||||||
|
|||||||
Reference in New Issue
Block a user