(RGUI) add reset command to custom viewport setting

allow negative custom viewport offsets
This commit is contained in:
Toad King 2012-08-20 22:50:15 -04:00
parent fa643ee56d
commit 7d4a320a17
4 changed files with 34 additions and 7 deletions

View File

@ -678,6 +678,9 @@ static void rgui_settings_controller_populate_entries(rgui_handle_t *rgui)
void rgui_viewport_iterate(rgui_handle_t *rgui, rgui_action_t action)
{
#ifdef GEKKO
gx_video_t *gx = (gx_video_t*)driver.video_data;
#endif
rgui_file_type_t menu_type = 0;
rgui_list_back(rgui->path_stack, NULL, &menu_type, NULL);
@ -753,6 +756,23 @@ void rgui_viewport_iterate(rgui_handle_t *rgui, rgui_action_t action)
rgui_list_pop(rgui->path_stack);
}
break;
case RGUI_ACTION_START:
#ifdef GEKKO
if (menu_type == RGUI_SETTINGS_CUSTOM_VIEWPORT)
{
g_console.viewports.custom_vp.width += g_console.viewports.custom_vp.x;
g_console.viewports.custom_vp.height += g_console.viewports.custom_vp.y;
g_console.viewports.custom_vp.x = 0;
g_console.viewports.custom_vp.y = 0;
}
else
{
g_console.viewports.custom_vp.width = gx->win_width - g_console.viewports.custom_vp.x;
g_console.viewports.custom_vp.height = gx->win_height - g_console.viewports.custom_vp.y;
}
#endif
driver.video->apply_state_changes();
break;
case RGUI_ACTION_SETTINGS:
rgui_list_pop(rgui->path_stack);
break;

View File

@ -193,8 +193,8 @@ struct settings
#ifdef RARCH_CONSOLE
typedef struct
{
unsigned x;
unsigned y;
int x;
int y;
unsigned width;
unsigned height;
} rarch_viewport_t;

View File

@ -194,6 +194,7 @@ static void gx_restart(void)
static void *gx_init(const video_info_t *video,
const input_driver_t **input, void **input_data)
{
RARCH_LOG("GX_INIT\n");
if (driver.video_data)
return driver.video_data;
@ -203,12 +204,15 @@ static void *gx_init(const video_info_t *video,
g_vsync = video->vsync;
gx->win_width = gx_width;
gx->win_height = gx_height;
gx->should_resize = true;
return gx;
}
static void gx_start(void)
{
RARCH_LOG("GX_START\n");
video_info_t video_info = {0};
video_info.vsync = g_settings.video.vsync;
@ -217,8 +221,6 @@ static void gx_start(void)
video_info.smooth = g_settings.video.smooth;
video_info.input_scale = 2;
driver.video_data = gx_init(&video_info, NULL, NULL);
VIDEO_Init();
GXRModeObj *mode = VIDEO_GetPreferredMode(NULL);
setup_video_mode(mode);
@ -234,6 +236,8 @@ static void gx_start(void)
g_vsync = true;
gx_width = mode->fbWidth;
gx_height = mode->efbHeight;
driver.video_data = gx_init(&video_info, NULL, NULL);
}
#define ASM_BLITTER
@ -417,7 +421,8 @@ static void update_texture(const uint32_t *src,
static void gx_resize(gx_video_t *gx)
{
unsigned x = 0, y = 0, width = gx_width, height = gx_height;
int x = 0, y = 0;
unsigned width = gx->win_width, height = gx->win_height;
#ifdef HW_RVL
VIDEO_SetTrapFilter(g_console.soft_display_filter_enable);
@ -441,8 +446,8 @@ static void gx_resize(gx_video_t *gx)
{
g_console.viewports.custom_vp.x = 0;
g_console.viewports.custom_vp.y = 0;
g_console.viewports.custom_vp.width = gx_width;
g_console.viewports.custom_vp.height = gx_height;
g_console.viewports.custom_vp.width = gx->win_width;
g_console.viewports.custom_vp.height = gx->win_height;
}
x = g_console.viewports.custom_vp.x;

View File

@ -23,6 +23,8 @@ typedef struct gx_video
bool keep_aspect;
uint32_t frame_count;
uint32_t *menu_data;
unsigned win_width;
unsigned win_height;
char msg[128];
} gx_video_t;