Files
Carputer-cracker/src/core/shell.h

22 lines
605 B
C++

#pragma once
#include "module.h"
// The shell: owns the module list, the main menu, and event routing.
// Backtick (`) always returns to the menu from inside a module.
class Shell {
public:
void begin();
void loop();
private:
static constexpr int MAX = 12;
Module* mods[MAX]; int nmods = 0;
int sel = 0; // menu cursor
int active = -1; // -1 == in menu
int top = 0; // first visible menu row
uint32_t lastTick = 0;
void add(Module* m) { if (nmods < MAX) mods[nmods++] = m; }
void drawMenu(bool force = false);
void enter(int i);
void back();
};