Start documenting menu_common.c

This commit is contained in:
twinaphex 2015-01-09 21:54:08 +01:00
parent 38fdfe2f47
commit a4d0ab0607
2 changed files with 89 additions and 8 deletions

View File

@ -24,6 +24,11 @@
#include "../../retroarch.h" #include "../../retroarch.h"
#include <file/file_path.h> #include <file/file_path.h>
/**
** draw_frame:
*
* Draws menu graphics onscreen.
**/
static void draw_frame(void) static void draw_frame(void)
{ {
if (driver.video_data && driver.video_poke && if (driver.video_data && driver.video_poke &&
@ -46,8 +51,12 @@ static void draw_frame(void)
rarch_render_cached_frame(); rarch_render_cached_frame();
} }
/* Update menu state which depends on config. */ /**
* menu_update_libretro_info:
* @info : Pointer to system info
*
* Update menu state which depends on config.
**/
void menu_update_libretro_info(struct retro_system_info *info) void menu_update_libretro_info(struct retro_system_info *info)
{ {
#ifndef HAVE_DYNAMIC #ifndef HAVE_DYNAMIC
@ -146,6 +155,14 @@ bool load_menu_content(void)
return true; return true;
} }
/**
* menu_init:
* @data : Menu context handle.
*
* Create and initialize menu handle.
*
* Returns: menu handle on success, otherwise NULL.
**/
void *menu_init(const void *data) void *menu_init(const void *data)
{ {
menu_handle_t *menu = NULL; menu_handle_t *menu = NULL;
@ -206,6 +223,12 @@ bool menu_init_list(void *data)
return true; return true;
} }
/**
* menu_free:
* @info : Menu handle.
*
* Frees a menu handle
**/
void menu_free(void *data) void menu_free(void *data)
{ {
menu_handle_t *menu = (menu_handle_t*)data; menu_handle_t *menu = (menu_handle_t*)data;
@ -240,6 +263,17 @@ void menu_free(void *data)
free(data); free(data);
} }
/**
* menu_ticker_line:
* @buf : buffer to write new message line to.
* @len : length of buffer @input.
* @idx : Index. Will be used for ticker logic.
* @str : Input string.
* @selected : Is the item currently selected in the menu?
*
* Take the contents of @str and apply a ticker effect to it,
* and write the results in @buf.
**/
void menu_ticker_line(char *buf, size_t len, unsigned idx, void menu_ticker_line(char *buf, size_t len, unsigned idx,
const char *str, bool selected) const char *str, bool selected)
{ {
@ -376,11 +410,17 @@ void apply_deferred_settings(void)
} }
} }
/* Returns: /**
* 0 - Forcibly wake up the loop. * menu_iterate:
* -1 - Quit out of iteration loop. * @input : input sample for this frame
*/ * @old_input : input sample of the previous frame
* @trigger_input : difference' input sample - difference
* between 'input' and 'old_input'
*
* Runs RetroArch menu for one frame.
*
* Returns: 0 on success, -1 if we need to quit out of the loop.
**/
int menu_iterate(retro_input_t input, int menu_iterate(retro_input_t input,
retro_input_t old_input, retro_input_t trigger_input) retro_input_t old_input, retro_input_t trigger_input)
{ {

View File

@ -116,7 +116,6 @@ typedef enum
typedef enum typedef enum
{ {
// Shader stuff
MENU_SETTINGS_VIDEO_RESOLUTION = MENU_FILE_TYPE_T_LAST + 1, MENU_SETTINGS_VIDEO_RESOLUTION = MENU_FILE_TYPE_T_LAST + 1,
MENU_SETTINGS_CUSTOM_VIEWPORT, MENU_SETTINGS_CUSTOM_VIEWPORT,
MENU_SETTINGS_SHADER_PARAMETER_0, MENU_SETTINGS_SHADER_PARAMETER_0,
@ -152,17 +151,53 @@ typedef enum
MENU_SETTINGS_INPUT_DESC_END = MENU_SETTINGS_INPUT_DESC_BEGIN + (MAX_USERS * RARCH_CUSTOM_BIND_LIST_END), MENU_SETTINGS_INPUT_DESC_END = MENU_SETTINGS_INPUT_DESC_BEGIN + (MAX_USERS * RARCH_CUSTOM_BIND_LIST_END),
} menu_settings_t; } menu_settings_t;
/**
* menu_init:
* @data : Menu context handle.
*
* Create and initialize menu handle.
*
* Returns: menu handle on success, otherwise NULL.
**/
void *menu_init(const void *data); void *menu_init(const void *data);
void menu_free_list(void *data); void menu_free_list(void *data);
bool menu_init_list(void *data); bool menu_init_list(void *data);
/**
* menu_iterate:
* @input : input sample for this frame
* @old_input : input sample of the previous frame
* @trigger_input : difference' input sample - difference
* between 'input' and 'old_input'
*
* Runs RetroArch menu for one frame.
*
* Returns: 0 on success, -1 if we need to quit out of the loop.
**/
int menu_iterate(retro_input_t input, int menu_iterate(retro_input_t input,
retro_input_t old_input, retro_input_t trigger_input); retro_input_t old_input, retro_input_t trigger_input);
/**
* menu_free:
* @info : Menu handle.
*
* Frees a menu handle
**/
void menu_free(void *data); void menu_free(void *data);
/**
* menu_ticker_line:
* @buf : buffer to write new message line to.
* @len : length of buffer @input.
* @idx : Index. Will be used for ticker logic.
* @str : Input string.
* @selected : Is the item currently selected in the menu?
*
* Take the contents of @str and apply a ticker effect to it,
* and write the results in @buf.
**/
void menu_ticker_line(char *buf, size_t len, unsigned tick, void menu_ticker_line(char *buf, size_t len, unsigned tick,
const char *str, bool selected); const char *str, bool selected);
@ -170,6 +205,12 @@ bool load_menu_content(void);
void menu_update_system_info(menu_handle_t *menu, bool *load_no_content); void menu_update_system_info(menu_handle_t *menu, bool *load_no_content);
/**
* menu_update_libretro_info:
* @info : Pointer to system info
*
* Update menu state which depends on config.
**/
void menu_update_libretro_info(struct retro_system_info *info); void menu_update_libretro_info(struct retro_system_info *info);
unsigned menu_common_type_is(const char *label, unsigned type); unsigned menu_common_type_is(const char *label, unsigned type);