temporary /render cmd for debugging

This commit is contained in:
Kae 2024-12-27 20:14:36 +11:00
parent 3205f3b283
commit 5cf11ead98
2 changed files with 11 additions and 1 deletions

View File

@ -52,7 +52,8 @@ ClientCommandProcessor::ClientCommandProcessor(UniverseClientPtr universeClient,
{"enabletech", bind(&ClientCommandProcessor::enableTech, this, _1)}, {"enabletech", bind(&ClientCommandProcessor::enableTech, this, _1)},
{"upgradeship", bind(&ClientCommandProcessor::upgradeShip, this, _1)}, {"upgradeship", bind(&ClientCommandProcessor::upgradeShip, this, _1)},
{"swap", bind(&ClientCommandProcessor::swap, this, _1)}, {"swap", bind(&ClientCommandProcessor::swap, this, _1)},
{"respawnInWorld", bind(&ClientCommandProcessor::respawnInWorld, this, _1)} {"respawnInWorld", bind(&ClientCommandProcessor::respawnInWorld, this, _1)},
{"render", bind(&ClientCommandProcessor::render, this, _1)}
}; };
} }
@ -440,4 +441,12 @@ String ClientCommandProcessor::respawnInWorld(String const& argumentsString) {
return strf("Respawn in this world set to {} (This is client-side!)", respawnInWorld ? "true" : "false"); return strf("Respawn in this world set to {} (This is client-side!)", respawnInWorld ? "true" : "false");
} }
// Temporary hardcoded render command for debugging purposes, future version will write to the clipboard
String ClientCommandProcessor::render(String const& imagePath) {
auto image = Root::singleton().assets()->image(imagePath);
image->writePng(File::open("render.png", IOMode::Write));
return strf("Saved {}x{} image to render.png", image->width(), image->height());
}
} }

View File

@ -59,6 +59,7 @@ private:
String upgradeShip(String const& argumentsString); String upgradeShip(String const& argumentsString);
String swap(String const& argumentsString); String swap(String const& argumentsString);
String respawnInWorld(String const& argumentsString); String respawnInWorld(String const& argumentsString);
String render(String const& imagePath);
UniverseClientPtr m_universeClient; UniverseClientPtr m_universeClient;
CinematicPtr m_cinematicOverlay; CinematicPtr m_cinematicOverlay;