Major Screen changes. (If using the screen class, read the description!!)

Changes which are needed when using the screen class:

- Add `void callConstructor() override { }` to your screen's public header.
- Call `Gui::DrawScreen();` to draw the screen.
- Call `Gui::ScreenLogic(u32 hDown, u32 hHeld, touchPosition touch);` to call the Logic.
- Call `Gui::CallConstructor();` to call the used screen's constructor.
- call `Gui::setScreen(std::make_unique<ScreenName>(), <true/ false, depends if you like to transfer the screen to the usedScreen directly.>);` to set the screen.
- Call `Gui::transferScreen();` in case you like to set the tempScreen to the used one.
- Get rid of the `Gui::screenBack();` calls and use `Gui::setScreen(...)` directly for it.
This commit is contained in:
StackZ
2020-05-26 05:25:33 +02:00
parent f0dca7c784
commit a5f7134d1c
6 changed files with 55 additions and 31 deletions
+19 -10
View File
@@ -32,10 +32,8 @@
#include <3ds.h>
#include <citro2d.h>
#include <citro3d.h>
#include <stack>
namespace Gui
{
namespace Gui {
// Clear the Text Buffer.
void clearTextBufs(void);
@@ -134,20 +132,31 @@ namespace Gui
*/
bool Draw_Rect(float x, float y, float w, float h, u32 color);
/* Used for the mainLoop to display the screens. (Optional!)
// Used for the current Screen's Draw. (Optional!)
void DrawScreen();
/* Used for the current Screen's Logic. (Optional!)
* hDown: the hidKeysDown() variable.
* hHeld: the HidKeysHeld() variable.
* touch: The TouchPosition variable.
*/
void mainLoop(u32 hDown, u32 hHeld, touchPosition touch);
void ScreenLogic(u32 hDown, u32 hHeld, touchPosition touch);
/* Set a specific Screen.
* screen: unique_ptr of the screen. (Optional by using the screen class.)
/* Used for the current Screen's Constructor call. (Optional!)
* This is useful if you need to call the screen's constructor.
*/
void setScreen(std::unique_ptr<Screen> screen);
void CallConstructor();
/* Transfer the Temp Screen to the used one. (Optional!)
* It will check, if the tempScreen variable is not nullptr, so don't worry.
*/
void transferScreen();
// Go a Screen back. (Optional by using the screen class.)
void screenBack();
/* Set a specific Screen with switch function. (Optional!)
* screen: unique_ptr of the screen. (Optional by using the screen class.)
* screenSwitch: Wheter to switch to the current screen.
*/
void setScreen(std::unique_ptr<Screen> screen, bool screenSwitch = true);
/* Set on which screen to draw.
* screen: The render target. (Targets are inside the screenCommon.hpp file.)