From 5cf11ead986b950a9932fae667805fd71d79fa72 Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Fri, 27 Dec 2024 20:14:36 +1100 Subject: [PATCH] temporary /render cmd for debugging --- source/frontend/StarClientCommandProcessor.cpp | 11 ++++++++++- source/frontend/StarClientCommandProcessor.hpp | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/source/frontend/StarClientCommandProcessor.cpp b/source/frontend/StarClientCommandProcessor.cpp index e0fe827..5b2ca0f 100644 --- a/source/frontend/StarClientCommandProcessor.cpp +++ b/source/frontend/StarClientCommandProcessor.cpp @@ -52,7 +52,8 @@ ClientCommandProcessor::ClientCommandProcessor(UniverseClientPtr universeClient, {"enabletech", bind(&ClientCommandProcessor::enableTech, this, _1)}, {"upgradeship", bind(&ClientCommandProcessor::upgradeShip, 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"); } +// 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()); +} + + } \ No newline at end of file diff --git a/source/frontend/StarClientCommandProcessor.hpp b/source/frontend/StarClientCommandProcessor.hpp index 94dad5d..c3978a4 100644 --- a/source/frontend/StarClientCommandProcessor.hpp +++ b/source/frontend/StarClientCommandProcessor.hpp @@ -59,6 +59,7 @@ private: String upgradeShip(String const& argumentsString); String swap(String const& argumentsString); String respawnInWorld(String const& argumentsString); + String render(String const& imagePath); UniverseClientPtr m_universeClient; CinematicPtr m_cinematicOverlay;