Add scene stack menu flow and restore stable TFT sync refresh

This commit is contained in:
Adolfo Reyna
2026-02-18 15:10:20 -05:00
parent a06e0d69fe
commit ebc58d7e4d
4 changed files with 366 additions and 69 deletions

45
lib/scene_stack.h Normal file
View File

@@ -0,0 +1,45 @@
#ifndef SCENE_STACK_H
#define SCENE_STACK_H
#include <vector>
enum class SceneId {
LAUNCHER = 0,
GAME,
IN_GAME_MENU
};
class SceneStack {
public:
SceneStack() {
stack.push_back(SceneId::LAUNCHER);
}
SceneId current() const {
return stack.empty() ? SceneId::LAUNCHER : stack.back();
}
bool is(SceneId scene) const {
return current() == scene;
}
void push(SceneId scene) {
stack.push_back(scene);
}
void pop() {
if (stack.size() > 1) {
stack.pop_back();
}
}
void clear_to_launcher() {
stack.clear();
stack.push_back(SceneId::LAUNCHER);
}
private:
std::vector<SceneId> stack;
};
#endif // SCENE_STACK_H