/**
 * Copyright (c) 2021 Dominic Masters
 * 
 * This software is released under the MIT License.
 * https://opensource.org/licenses/MIT
 */

#pragma once
#include "../libs.h"

#define MENU_ITEMS_COLUMNS_MAX 16
#define MENU_ITEMS_ROWS_MAX 128
#define MENU_ITEMS_MAX MENU_ITEMS_COLUMNS_MAX * MENU_ITEMS_ROWS_MAX

#define MENU_DIRECTION_DOWN 0x01
#define MENU_DIRECTION_UP 0x02
#define MENU_DIRECTION_LEFT 0x03
#define MENU_DIRECTION_RIGHT 0x04

#define MENU_HOLD_DURATION 1.0

typedef struct {
  int32_t x;
  int32_t y;
} menuitem_t;

typedef struct {
  int32_t columns;
  int32_t rows;

  int32_t x;
  int32_t y;
  
  uint8_t direction;

  menuitem_t* items[MENU_ITEMS_MAX];
  bool holdAllow;
  float holdLast;
} menu_t;