(RMenu) Refactor RMenu images

This commit is contained in:
twinaphex 2013-02-01 06:53:06 +01:00
parent c479cc9961
commit 914e39c55a
3 changed files with 26 additions and 22 deletions

View File

@ -36,6 +36,10 @@
#include "config.h"
#endif
#ifdef HAVE_RMENU
#include "gfx/image.h"
#endif
// Platform-specific headers
// PS3
#if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
@ -561,6 +565,10 @@ struct global
{
oskutil_params oskutil_handle;
} misc;
#endif
#ifdef HAVE_RMENU
struct texture_image menu_texture;
struct texture_image menu_panel;
#endif
} console;

View File

@ -44,7 +44,6 @@
#if defined(HAVE_RMENU)
GLuint menu_texture_id;
static struct texture_image menu_texture;
#endif
#if defined(HAVE_PSGL)
@ -311,7 +310,7 @@ static bool gfx_ctx_rmenu_init(void)
glGenTextures(1, &menu_texture_id);
RARCH_LOG("Loading texture image for menu...\n");
if (!texture_image_load(default_paths.menu_border_file, &menu_texture))
if (!texture_image_load(default_paths.menu_border_file, &g_extern.console.menu_texture))
{
RARCH_ERR("Failed to load texture image for menu.\n");
return false;
@ -324,12 +323,12 @@ static bool gfx_ctx_rmenu_init(void)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, RARCH_GL_INTERNAL_FORMAT32,
menu_texture.width, menu_texture.height, 0,
RARCH_GL_TEXTURE_TYPE32, RARCH_GL_FORMAT32, menu_texture.pixels);
g_extern.console.menu_texture.width, g_extern.console.menu_texture.height, 0,
RARCH_GL_TEXTURE_TYPE32, RARCH_GL_FORMAT32, g_extern.console.menu_texture.pixels);
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
free(menu_texture.pixels);
free(g_extern.console.menu_texture.pixels);
menu_bg_inited = true;
#endif

View File

@ -82,10 +82,7 @@ unsigned char drive_mapping_idx = 2;
int xpos, ypos;
#ifdef _XBOX1
texture_image m_menuMainRomSelectPanel;
texture_image m_menuMainBG;
// Rom list coords
// Rom list coordinates
unsigned m_menuMainRomListPos_x;
unsigned m_menuMainRomListPos_y;
#endif
@ -144,19 +141,19 @@ static bool gfx_ctx_xdk_menu_init(void)
// Load background image
if(width == 640)
{
texture_image_load("D:\\Media\\main-menu_480p.png", &m_menuMainBG);
texture_image_load("D:\\Media\\main-menu_480p.png", &g_extern.console.menu_texture);
m_menuMainRomListPos_x = 60;
m_menuMainRomListPos_y = 80;
}
else if(width == 1280)
{
texture_image_load("D:\\Media\\main-menu_720p.png", &m_menuMainBG);
texture_image_load("D:\\Media\\main-menu_720p.png", &g_extern.console.menu_texture);
m_menuMainRomListPos_x = 360;
m_menuMainRomListPos_y = 130;
}
// Load rom selector panel
texture_image_load("D:\\Media\\menuMainRomSelectPanel.png", &m_menuMainRomSelectPanel);
texture_image_load("D:\\Media\\menuMainRomSelectPanel.png", &g_extern.console.menu_panel);
//Display some text
//Center the text (hardcoded)
@ -175,8 +172,8 @@ static void gfx_ctx_xdk_menu_frame(void* data)
static void gfx_ctx_xdk_menu_free(void)
{
#ifdef _XBOX1
texture_image_free(&m_menuMainBG);
texture_image_free(&m_menuMainRomSelectPanel);
texture_image_free(&g_extern.console.menu_texture);
texture_image_free(&g_extern.console.menu_panel);
#endif
}
@ -198,20 +195,20 @@ static bool gfx_ctx_xdk_window_has_focus(void)
static void gfx_ctx_xdk_menu_draw_bg(rarch_position_t *position)
{
#ifdef _XBOX1
m_menuMainBG.x = 0;
m_menuMainBG.y = 0;
texture_image_render(&m_menuMainBG);
g_extern.console.menu_texture.x = 0;
g_extern.console.menu_texture.y = 0;
texture_image_render(&g_extern.console.menu_texture);
#endif
}
static void gfx_ctx_xdk_menu_draw_panel(rarch_position_t *position)
{
#ifdef _XBOX1
m_menuMainRomSelectPanel.x = position->x;
m_menuMainRomSelectPanel.y = position->y;
m_menuMainRomSelectPanel.width = ROM_PANEL_WIDTH;
m_menuMainRomSelectPanel.height = ROM_PANEL_HEIGHT;
texture_image_render(&m_menuMainRomSelectPanel);
g_extern.console.menu_panel.x = position->x;
g_extern.console.menu_panel.y = position->y;
g_extern.console.menu_panel.width = ROM_PANEL_WIDTH;
g_extern.console.menu_panel.height = ROM_PANEL_HEIGHT;
texture_image_render(&g_extern.console.menu_panel);
#endif
}