Skip to content

[gui.hpp] screen functions

StackZ edited this page May 27, 2020 · 1 revision

All Screen functions from Universal-Core are listed here. If you haven't looked at the creating a screen page, please do that first.

Informations for screens: Use the stack screens, if you rely on the screens from before, else leave the stack Parameters to false.

Note: You need to set a screen first before while(aptMainLoop()) to use this.

Global Screen variables:

std::unique_ptr<Screen> usedScreen, tempScreen;
std::stack<std::unique_ptr<Screen>> screens; // Needs to be declared as extern first for now for direct use.

Call the Draw of the screen.

/*
 *    bool stack: Whether if using the stack screens. (Optional!)
 *    This function calls the screens 'void Draw(void) const' function.
*/

void Gui::DrawScreen(bool stack = false);

Call the Logic of the screen.

/*
 *    u32 hDown: The hidKeysDown() variable.
 *    u32 hHeld: The hidKeysHeld() variable.
 *    touchPosition touch: The touchPosition variable.
 *    bool waitFade: Whether if waiting for the input until the fade effect stops. (Optional!)
 *    bool stack: Whether if using the stack screens. (Optional!)
 *    This function calls the screens 'void Logic(u32 hDown, u32 hHeld, touchPosition touch)' function.
*/

void Gui::ScreenLogic(u32 hDown, u32 hHeld, touchPosition touch, bool waitFade = true, bool stack = false);

Set the screen.

/*
 *    std::unique_ptr<Screen> screen: The new screen. Use: std::make_unique<screen>()
 *    bool fade: Whether if fade out and in the new screen. (Optional!)
 *    bool stack: Whether if using the stack screens. (Optional!)
*/

void Gui::setScreen(std::unique_ptr<Screen> screen, bool fade = false, bool stack = false);

Transfer the temp screen to the used one.

/*
 *    bool stack: Whether if using the stack screens. (Optional!)
 *    This is used in the fadeEffects(…) function. You don't really need to use that actually.
*/

void Gui::transferScreen(bool stack = false);

Go a screen back. (Stack Screens only!)

/*
 *    bool fade: Whether if allowing fade effects. (Optional!)
 *    Note: This only works, if the stack is not empty.
*/

void Gui::screenBack(bool fade = false);