millorada una mica la classe Debug en quant a mostrar info
This commit is contained in:
@@ -90,7 +90,7 @@ Game::Game(Mode mode)
|
||||
auto ss = Debug::get()->getSpawnSettings();
|
||||
ss.spawn_x = tile_x * Tile::SIZE;
|
||||
ss.spawn_y = tile_y * Tile::SIZE;
|
||||
ss.flip = player_->getSpawnParams().flip;
|
||||
ss.flip = player_->getSpawnParams().flip;
|
||||
Debug::get()->setSpawnSettings(ss);
|
||||
Debug::get()->saveToFile();
|
||||
return "Pos:" + std::to_string(tile_x) + "," + std::to_string(tile_y);
|
||||
@@ -109,7 +109,7 @@ Game::~Game() {
|
||||
GameControl::refresh_player_color = nullptr;
|
||||
GameControl::toggle_debug_mode = nullptr;
|
||||
GameControl::set_initial_room = nullptr;
|
||||
GameControl::set_initial_pos = nullptr;
|
||||
GameControl::set_initial_pos = nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -207,10 +207,6 @@ void Game::update() {
|
||||
|
||||
Audio::update(); // Actualiza el objeto Audio
|
||||
Screen::get()->update(DELTA_TIME); // Actualiza el objeto Screen
|
||||
|
||||
#ifdef _DEBUG
|
||||
updateDebugInfo();
|
||||
#endif
|
||||
}
|
||||
|
||||
// Actualiza el juego en estado PLAYING
|
||||
@@ -432,18 +428,9 @@ static void toggleCheat(Options::Cheat::State& cheat, const std::string& label)
|
||||
Notifier::get()->show({label + (ENABLED ? Locale::get()->get("game.enabled") : Locale::get()->get("game.disabled"))}, Notifier::Style::DEFAULT, -1, true); // NOLINT(readability-static-accessed-through-instance)
|
||||
}
|
||||
|
||||
// Pasa la información de debug
|
||||
void Game::updateDebugInfo() {
|
||||
// Debug::get()->add("X = " + std::to_string(static_cast<int>(player_->x_)) + ", Y = " + std::to_string(static_cast<int>(player_->y_)));
|
||||
// Debug::get()->add("VX = " + std::to_string(player_->vx_).substr(0, 4) + ", VY = " + std::to_string(player_->vy_).substr(0, 4));
|
||||
// Debug::get()->add("STATE = " + std::to_string(static_cast<int>(player_->state_)));
|
||||
}
|
||||
|
||||
// Pone la información de debug en pantalla
|
||||
void Game::renderDebugInfo() {
|
||||
if (!Debug::get()->isEnabled()) {
|
||||
return;
|
||||
}
|
||||
if (!Debug::get()->isEnabled()) { return; }
|
||||
|
||||
auto surface = Screen::get()->getRendererSurface();
|
||||
|
||||
@@ -589,8 +576,8 @@ void Game::handleDebugMouseDrag(float delta_time) {
|
||||
}
|
||||
|
||||
debug_dragging_player_ = true;
|
||||
Debug::get()->add(std::string("X : " + std::to_string(static_cast<int>(player_rect.x))));
|
||||
Debug::get()->add(std::string("Y : " + std::to_string(static_cast<int>(player_rect.y))));
|
||||
Debug::get()->set("drag.x", std::to_string(static_cast<int>(player_rect.x)));
|
||||
Debug::get()->set("drag.y", std::to_string(static_cast<int>(player_rect.y)));
|
||||
} else if (debug_dragging_player_) {
|
||||
// Botón soltado después de arrastrar: finalizar teleport
|
||||
player_->finalizeDebugTeleport();
|
||||
|
||||
Reference in New Issue
Block a user