From 9899de0428a36dd59f5853a22cf77474d433b590 Mon Sep 17 00:00:00 2001 From: RocketRobz Date: Tue, 30 Jun 2020 23:51:31 -0600 Subject: [PATCH] Add GUI reinit --- gui.cpp | 9 +++++++++ gui.hpp | 3 +++ 2 files changed, 12 insertions(+) diff --git a/gui.cpp b/gui.cpp index 5c3912a..af58cc3 100644 --- a/gui.cpp +++ b/gui.cpp @@ -105,6 +105,15 @@ void Gui::exit(void) { if (usedScreen != nullptr) usedScreen = nullptr; } +// Reinitialize GUI. +Result Gui::reinit(void) { + C2D_TextBufDelete(TextBuf); + C2D_Fini(); + C3D_Fini(); + + return init(); +} + // Draw a Centered String. void Gui::DrawStringCentered(float x, float y, float size, u32 color, std::string Text, int maxWidth, int maxHeight, C2D_Font fnt) { float lineHeight, widthScale; diff --git a/gui.hpp b/gui.hpp index 77d216a..9d2c00c 100644 --- a/gui.hpp +++ b/gui.hpp @@ -76,6 +76,9 @@ namespace Gui { // Exit the GUI. (Call this at exit.) void exit(void); + // Reinit the GUI. + Result reinit(void); + /* Draws a centered String. * x: The X Offset from center. (Center: 200 px on top, 160 px on Bottom.) * y: The Y Position of the Text.