aboutsummaryrefslogtreecommitdiff
path: root/funkey/fk_menu.h
diff options
context:
space:
mode:
authorneonloop2023-01-09 14:36:40 +0000
committerneonloop2023-01-09 14:36:40 +0000
commit6d0d8f2ce924a0b1a433280160d90f71121509a4 (patch)
treef2e99784fa3e708ae8ac70d65f721c65cf171184 /funkey/fk_menu.h
parent50d426b6d2c84d4ddc32009268d99047e83ced7f (diff)
downloadpicoarch-6d0d8f2ce924a0b1a433280160d90f71121509a4.tar.gz
picoarch-6d0d8f2ce924a0b1a433280160d90f71121509a4.tar.bz2
picoarch-6d0d8f2ce924a0b1a433280160d90f71121509a4.zip
Adds initial Funkey S support
Diffstat (limited to 'funkey/fk_menu.h')
-rw-r--r--funkey/fk_menu.h170
1 files changed, 170 insertions, 0 deletions
diff --git a/funkey/fk_menu.h b/funkey/fk_menu.h
new file mode 100644
index 0000000..36bc460
--- /dev/null
+++ b/funkey/fk_menu.h
@@ -0,0 +1,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 */