feat(menu): add menu class
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
#define MENU_ITEM_COUNT 4
|
||||
#include <Arduino.h>
|
||||
#include "joystick.hpp"
|
||||
|
||||
typedef struct {
|
||||
String name;
|
||||
void (*action)();
|
||||
} Item;
|
||||
|
||||
class Menu {
|
||||
public:
|
||||
Menu(Item* items);
|
||||
void updateCurrentItem(JoystickDirection& direction);
|
||||
void execute();
|
||||
|
||||
Item& getItemAt(size_t index);
|
||||
size_t getCurrentItemIndex() const;
|
||||
private:
|
||||
Item items[MENU_ITEM_COUNT];
|
||||
int currentItem;
|
||||
};
|
||||
Reference in New Issue
Block a user