aboutsummaryrefslogtreecommitdiff
path: root/funkey/fk_menu.h
blob: 36bc46099fc03dfb9475b4a9bd64e4c7e1f63ba8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/*
    FK - FunKey retro gaming console library
    Copyright (C) 2020-2021 Vincent Buso
    Copyright (C) 2020-2021 Michel Stempin

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

    Vincent Buso
    vincent.buso@funkey-project.com
    Michel Stempin
    michel.stempin@funkey-project.com
*/

/**
 *  @file FK_menu.h
 *  This is the menu API for the FunKey retro gaming console library
 */

#ifndef _FK_menu_h
#define _FK_menu_h

/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif

#include <SDL/SDL.h>
#include <SDL/SDL_ttf.h>
#include <SDL/SDL_image.h>

#define HAS_MENU_VOLUME
#define HAS_MENU_BRIGHTNESS
#define HAS_MENU_SAVE
#define HAS_MENU_LOAD
#define HAS_MENU_ASPECT_RATIO
//#define HAS_MENU_USB
//#define HAS_MENU_THEME
//#define HAS_MENU_LAUNCHER
#define HAS_MENU_ADVANCED
#define HAS_MENU_EXIT
//#define HAS_MENU_POWERDOWN
//#define HAS_MENU_RO_RW

typedef enum{
    MENU_TYPE_VOLUME,
    MENU_TYPE_BRIGHTNESS,
    MENU_TYPE_SAVE,
    MENU_TYPE_LOAD,
    MENU_TYPE_ASPECT_RATIO,
    MENU_TYPE_USB,
    MENU_TYPE_THEME,
    MENU_TYPE_LAUNCHER,
    MENU_TYPE_ADVANCED,
    MENU_TYPE_EXIT,
    MENU_TYPE_POWERDOWN,
    MENU_TYPE_RO_RW,
    NB_MENU_TYPES,
} ENUM_MENU_TYPE;

typedef enum{
    MENU_RETURN_OK,
    MENU_RETURN_MENU,
    MENU_RETURN_EXIT,
    MENU_RETURN_ERROR,
    NB_MENU_RETURN_CODES,
} ENUM_MENU_RETURN_CODES;

#ifdef HAS_MENU_ASPECT_RATIO
///------ Definition of the different aspect ratios
#define ASPECT_RATIOS \
    /* X(ASPECT_RATIOS_TYPE_MANUAL, "MANUAL ZOOM") */ \
    X(ASPECT_RATIOS_TYPE_STRETCHED, "STRETCHED") \
    X(ASPECT_RATIOS_TYPE_CROPPED, "CROPPED") \
    X(ASPECT_RATIOS_TYPE_SCALED, "SCALED") \
    X(ASPECT_RATIOS_TYPE_NONE, "NONE") \
    X(NB_ASPECT_RATIOS_TYPES, "")

////------ Enumeration of the different aspect ratios ------
#undef X
#define X(a, b) a,
typedef enum {ASPECT_RATIOS} ENUM_ASPECT_RATIOS_TYPES;
#endif

///------ Definition of the different resume options
#define RESUME_OPTIONS \
    X(RESUME_YES, "RESUME GAME") \
    X(RESUME_NO, "NEW GAME") \
    X(NB_RESUME_OPTIONS, "")

////------ Enumeration of the different resume options ------
#undef X
#define X(a, b) a,
typedef enum {RESUME_OPTIONS} ENUM_RESUME_OPTIONS;

////------ Defines to be shared -------
#ifdef HAS_MENU_VOLUME
#define STEP_CHANGE_VOLUME          10
#endif
#ifdef HAS_MENU_BRIGHTNESS
#define STEP_CHANGE_BRIGHTNESS      10
#endif
#define NOTIF_SECONDS_DISP          2

////------ Menu commands -------
#ifdef HAS_MENU_VOLUME
#define SHELL_CMD_VOLUME_GET                "volume get"
#define SHELL_CMD_VOLUME_SET                "volume set"
#endif
#ifdef HAS_MENU_BRIGHTNESS
#define SHELL_CMD_BRIGHTNESS_GET            "brightness get"
#define SHELL_CMD_BRIGHTNESS_SET            "brightness set"
#endif
#ifdef HAS_MENU_USB
#define SHELL_CMD_USB_DATA_CONNECTED        "is_usb_data_connected"
#define SHELL_CMD_USB_MOUNT                 "share start"
#define SHELL_CMD_USB_UNMOUNT               "share stop"
#define SHELL_CMD_USB_CHECK_IS_SHARING      "share is_sharing"
#endif
#ifdef HAS_MENU_POWERDOWN
#define SHELL_CMD_POWERDOWN                 "shutdown_funkey"
#define SHELL_CMD_SCHEDULE_POWERDOWN        "sched_shutdown"
#define SHELL_CMD_CANCEL_SCHED_POWERDOWN    "cancel_sched_powerdown"
#endif
#ifdef HAS_MENU_LAUNCHER
#define SHELL_CMD_SET_LAUNCHER_GMENU2X      "set_launcher gmenu2x"
#define SHELL_CMD_SET_LAUNCHER_RETROFE      "set_launcher retrofe"
#endif
#ifdef HAS_MENU_RO_RW
#define SHELL_CMD_RO                        "ro"
#define SHELL_CMD_RW                        "rw"
#endif

#define SHELL_CMD_INSTANT_PLAY              "instant_play"
#define SHELL_CMD_NOTIF_SET                 "notif set"
#define SHELL_CMD_NOTIF_CLEAR               "notif clear"
#define SHELL_CMD_KEYMAP_DEFAULT            "keymap default"
#define SHELL_CMD_KEYMAP_RESUME             "keymap resume"

#ifdef HAS_MENU_THEME
extern void FK_InitMenu(Configuration &c);
#else
extern void FK_InitMenu(void);
#endif
extern void FK_EndMenu(void);
extern int FK_RunMenu(SDL_Surface *screen);
extern int FK_RunResumeMenu(SDL_Surface *screen);
extern void FK_StopMenu(void);

#ifdef HAS_MENU_ASPECT_RATIO
extern void FK_NextAspectRatio(void);
#endif

/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif

#endif /* _FK_menu_h */