(Menu) Create menu_display.c/menu_display.h

This commit is contained in:
twinaphex 2015-04-21 14:44:14 +02:00
parent f0d4a52b16
commit a104517168
8 changed files with 130 additions and 49 deletions

View File

@ -352,6 +352,7 @@ ifeq ($(HAVE_MENU_COMMON), 1)
menu/menu_entries_cbs_contentlist_switch.o \
menu/menu_entries_cbs.o \
menu/menu_list.o \
menu/menu_display.o \
menu/menu_animation.o \
menu/drivers/null.o
endif

View File

@ -717,6 +717,7 @@ MENU
#include "../menu/menu_entries_cbs.c"
#include "../menu/menu_shader.c"
#include "../menu/menu_navigation.c"
#include "../menu/menu_display.c"
#include "../menu/menu_animation.c"
#include "../menu/menu_database.c"

View File

@ -22,6 +22,7 @@
#include <limits.h>
#include "../menu.h"
#include "../menu_display.h"
#include "../../runloop_data.h"
#include <file/file_path.h>

View File

@ -22,6 +22,7 @@
#include <limits.h>
#include "../menu.h"
#include "../menu_display.h"
#include <compat/posix_string.h>
#include <file/file_path.h>
#include <retro_inline.h>

View File

@ -15,7 +15,7 @@
*/
#include "menu.h"
#include "menu_animation.h"
#include "menu_display.h"
#include "menu_entries.h"
#include "menu_shader.h"
#include "../dynamic.h"
@ -24,46 +24,6 @@
#include "../../performance.h"
#include <file/file_path.h>
bool menu_display_update_pending(void)
{
runloop_t *runloop = rarch_main_get_ptr();
if (!runloop)
return false;
if (runloop->frames.video.current.menu.animation.is_active ||
runloop->frames.video.current.menu.label.is_updated ||
runloop->frames.video.current.menu.framebuf.dirty)
return true;
return false;
}
/**
** draw_frame:
*
* Draws menu graphics onscreen.
**/
static void draw_frame(void)
{
driver_t *driver = driver_get_ptr();
global_t *global = global_get_ptr();
settings_t *settings = config_get_ptr();
video_driver_set_texture_enable(true, false);
if (!settings->menu.pause_libretro)
{
if (global->main_is_init && !global->libretro_dummy)
{
bool block_libretro_input = driver->block_libretro_input;
driver->block_libretro_input = true;
pretro_run();
driver->block_libretro_input = block_libretro_input;
return;
}
}
rarch_render_cached_frame();
}
/**
* menu_update_libretro_info:
* @info : Pointer to system info
@ -150,7 +110,7 @@ bool menu_load_content(void)
menu_driver_entry_iterate(MENU_ACTION_NOOP);
draw_frame();
menu_display_fb();
if (!(main_load_content(0, NULL, NULL, menu_environment_get,
driver->frontend_ctx->process_args)))
@ -224,9 +184,7 @@ void *menu_init(const void *data)
menu_shader_manager_init(menu);
menu->animation = (animation_t*)calloc(1, sizeof(animation_t));
if (!menu->animation)
if (!menu_display_init(menu))
goto error;
rarch_assert(menu->msg_queue = msg_queue_new(8));
@ -301,8 +259,7 @@ void menu_free(void *data)
msg_queue_free(menu->msg_queue);
menu->msg_queue = NULL;
menu_animation_free(menu->animation);
menu->animation = NULL;
menu_display_free(menu);
if (menu->frame_buf.data)
free(menu->frame_buf.data);
@ -420,7 +377,7 @@ int menu_iterate(retro_input_t input,
menu_driver_entry_iterate(action);
if (runloop->is_menu && !runloop->is_idle)
draw_frame();
menu_display_fb();
menu_driver_set_texture();

View File

@ -198,7 +198,6 @@ void menu_update_system_info(menu_handle_t *menu, bool *load_no_content);
void menu_apply_deferred_settings(void);
bool menu_display_update_pending(void);
void menu_update_libretro_info(struct retro_system_info *info);

86
menu/menu_display.c Normal file
View File

@ -0,0 +1,86 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2011-2015 - Daniel De Matteis
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "menu.h"
#include "menu_display.h"
#include "menu_animation.h"
#include "../dynamic.h"
#include "../../retroarch.h"
bool menu_display_update_pending(void)
{
runloop_t *runloop = rarch_main_get_ptr();
if (!runloop)
return false;
if (runloop->frames.video.current.menu.animation.is_active ||
runloop->frames.video.current.menu.label.is_updated ||
runloop->frames.video.current.menu.framebuf.dirty)
return true;
return false;
}
/**
** menu_display_fb:
*
* Draws menu graphics onscreen.
**/
void menu_display_fb(void)
{
driver_t *driver = driver_get_ptr();
global_t *global = global_get_ptr();
settings_t *settings = config_get_ptr();
video_driver_set_texture_enable(true, false);
if (!settings->menu.pause_libretro)
{
if (global->main_is_init && !global->libretro_dummy)
{
bool block_libretro_input = driver->block_libretro_input;
driver->block_libretro_input = true;
pretro_run();
driver->block_libretro_input = block_libretro_input;
return;
}
}
rarch_render_cached_frame();
}
void menu_display_free(void *data)
{
menu_handle_t *menu = (menu_handle_t*)data;
if (!menu)
return;
menu_animation_free(menu->animation);
menu->animation = NULL;
}
bool menu_display_init(void *data)
{
menu_handle_t *menu = (menu_handle_t*)data;
if (!menu)
return false;
menu->animation = (animation_t*)calloc(1, sizeof(animation_t));
if (!menu->animation)
return false;
return true;
}

35
menu/menu_display.h Normal file
View File

@ -0,0 +1,35 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2011-2015 - Daniel De Matteis
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __MENU_DISPLAY_H__
#define __MENU_DISPLAY_H__
#ifdef __cplusplus
extern "C" {
#endif
void menu_display_fb(void);
void menu_display_free(void *data);
bool menu_display_init(void *data);
bool menu_display_update_pending(void);
#ifdef __cplusplus
}
#endif
#endif