mirror of
https://github.com/Oibaf66/uae-wii.git
synced 2024-11-25 12:06:55 +01:00
Added 320X240 resolution, fixed menu_init and added menu_denit
This commit is contained in:
parent
a00f4ef0b4
commit
5650524f40
@ -47,6 +47,10 @@
|
|||||||
#include "hotkeys.h"
|
#include "hotkeys.h"
|
||||||
#include "sdlgfx.h"
|
#include "sdlgfx.h"
|
||||||
|
|
||||||
|
#ifdef USE_SDL
|
||||||
|
#include "guidep/menu.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Uncomment for debugging output */
|
/* Uncomment for debugging output */
|
||||||
//#define DEBUG
|
//#define DEBUG
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -57,8 +61,6 @@
|
|||||||
|
|
||||||
static SDL_Surface *display;
|
static SDL_Surface *display;
|
||||||
static SDL_Surface *screen;
|
static SDL_Surface *screen;
|
||||||
extern void menu_init(SDL_Surface *screen);
|
|
||||||
|
|
||||||
|
|
||||||
/* Standard P96 screen modes */
|
/* Standard P96 screen modes */
|
||||||
#define MAX_SCREEN_MODES 12
|
#define MAX_SCREEN_MODES 12
|
||||||
@ -943,7 +945,9 @@ static int graphics_subinit (void)
|
|||||||
gui_message ("Unable to set video mode: %s\n", SDL_GetError ());
|
gui_message ("Unable to set video mode: %s\n", SDL_GetError ());
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
menu_init(screen);
|
#ifdef USE_SDL
|
||||||
|
menu_init(screen); //GEKKO
|
||||||
|
#endif
|
||||||
/* Just in case we didn't get exactly what we asked for . . . */
|
/* Just in case we didn't get exactly what we asked for . . . */
|
||||||
fullscreen = ((screen->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN);
|
fullscreen = ((screen->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN);
|
||||||
is_hwsurface = ((screen->flags & SDL_HWSURFACE) == SDL_HWSURFACE);
|
is_hwsurface = ((screen->flags & SDL_HWSURFACE) == SDL_HWSURFACE);
|
||||||
@ -1140,6 +1144,9 @@ void graphics_leave (void)
|
|||||||
graphics_subshutdown ();
|
graphics_subshutdown ();
|
||||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||||
dumpcustom ();
|
dumpcustom ();
|
||||||
|
#ifdef USE_SDL
|
||||||
|
menu_deinit(); //GEKKO
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void graphics_notify_state (int state)
|
void graphics_notify_state (int state)
|
||||||
@ -1404,6 +1411,10 @@ int check_prefs_changed_gfx (void)
|
|||||||
currprefs.gfx_pfullscreen = changed_prefs.gfx_pfullscreen;
|
currprefs.gfx_pfullscreen = changed_prefs.gfx_pfullscreen;
|
||||||
#ifdef GEKKO
|
#ifdef GEKKO
|
||||||
currprefs.gfx_correct_ratio = changed_prefs.gfx_correct_ratio;
|
currprefs.gfx_correct_ratio = changed_prefs.gfx_correct_ratio;
|
||||||
|
current_width = currprefs.gfx_width_win;
|
||||||
|
current_height = currprefs.gfx_height_win;
|
||||||
|
gfxvidinfo.width = current_width;
|
||||||
|
gfxvidinfo.height = current_height;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PICASSO96
|
#ifdef PICASSO96
|
||||||
|
@ -104,6 +104,12 @@ void VirtualKeyboard_init(SDL_Surface *screen)
|
|||||||
kbd_is_active=0;
|
kbd_is_active=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VirtualKeyboard_fini(void)
|
||||||
|
{
|
||||||
|
SDL_FreeSurface (image_kbd);
|
||||||
|
vkb_is_init = -1;
|
||||||
|
kbd_is_active = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void draw_vk()
|
void draw_vk()
|
||||||
{
|
{
|
||||||
@ -199,6 +205,8 @@ struct virtkey* virtkbd_get_key()
|
|||||||
{
|
{
|
||||||
virtkey_t *key;
|
virtkey_t *key;
|
||||||
|
|
||||||
|
if (FULL_DISPLAY_X != 640) {msgInfo("Virtual Keyboard only with 640X480 res",4000,NULL);return NULL;}
|
||||||
|
|
||||||
if (vkb_is_init != 1) return NULL;
|
if (vkb_is_init != 1) return NULL;
|
||||||
|
|
||||||
pause_sound();
|
pause_sound();
|
||||||
|
@ -30,7 +30,8 @@ typedef struct Virtual_Keyboard
|
|||||||
|
|
||||||
} VirtualKeyboard_struct;
|
} VirtualKeyboard_struct;
|
||||||
|
|
||||||
extern void VirtualKeyboard_init(SDL_Surface *surf);
|
void VirtualKeyboard_init(SDL_Surface *surf);
|
||||||
|
void VirtualKeyboard_fini(void);
|
||||||
extern struct virtkey *virtkbd_get_key(void);
|
extern struct virtkey *virtkbd_get_key(void);
|
||||||
extern void flip_VKB();
|
void flip_VKB();
|
||||||
extern int kbd_is_active;
|
extern int kbd_is_active;
|
@ -179,14 +179,16 @@ static const char *other_messages[] = {
|
|||||||
/*03*/ "^| 0 | 1 | 2 | 3 | 4 ",
|
/*03*/ "^| 0 | 1 | 2 | 3 | 4 ",
|
||||||
/*04*/ "Correct aspect ratio",
|
/*04*/ "Correct aspect ratio",
|
||||||
/*05*/ "^|off|100%|95%|93%|90%|custom",
|
/*05*/ "^|off|100%|95%|93%|90%|custom",
|
||||||
/*06*/ "Scanlines",
|
/*06*/ "Resolution",
|
||||||
/*07*/ "^|on|off",
|
/*07*/ "^|320X240|640X480",
|
||||||
/*08*/ "Leds",
|
/*08*/ "Scanlines",
|
||||||
/*09*/ "^|on|off",
|
/*09*/ "^|on|off",
|
||||||
/*10*/ "Port",
|
/*10*/ "Leds",
|
||||||
/*11*/ "^|DEFAULT|SD|USB|SMB",
|
/*11*/ "^|on|off",
|
||||||
/*12*/ "Rumble",
|
/*12*/ "Port",
|
||||||
/*13*/ "^|on|off",
|
/*13*/ "^|DEFAULT|SD|USB|SMB",
|
||||||
|
/*14*/ "Rumble",
|
||||||
|
/*15*/ "^|on|off",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -802,7 +804,7 @@ void make_hardfile(void)
|
|||||||
|
|
||||||
if (file_exists(hdf_path))
|
if (file_exists(hdf_path))
|
||||||
{
|
{
|
||||||
if (msgYesNo("Overwrite the existing file?", 0, FULL_DISPLAY_X /2-180, FULL_DISPLAY_Y /2-48))
|
if (msgYesNo("Overwrite the existing file?", 0, FULL_DISPLAY_X /2-180/RATIO, FULL_DISPLAY_Y /2-48/RATIO))
|
||||||
unlink (hdf_path); else return;
|
unlink (hdf_path); else return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -821,7 +823,7 @@ void delete_hardfile(void)
|
|||||||
char dir[255];
|
char dir[255];
|
||||||
strncpy(dir,prefs_get_attr("hardfile_path"),255);
|
strncpy(dir,prefs_get_attr("hardfile_path"),255);
|
||||||
name = (char *) menu_select_file(dir, NULL, 0);
|
name = (char *) menu_select_file(dir, NULL, 0);
|
||||||
if (name && msgYesNo("Are you sure to delete the hardfile?", 0, FULL_DISPLAY_X /2-200, FULL_DISPLAY_Y /2-48))
|
if (name && msgYesNo("Are you sure to delete the hardfile?", 0, FULL_DISPLAY_X /2-200/RATIO, FULL_DISPLAY_Y /2-48/RATIO))
|
||||||
{unlink (name); msgInfo("Hardfile deleted",3000,NULL);}
|
{unlink (name); msgInfo("Hardfile deleted",3000,NULL);}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1216,10 +1218,28 @@ static void audio_options(void)
|
|||||||
fix_options_menu_sdl(1);
|
fix_options_menu_sdl(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void set_gfx_resolution (int res)
|
||||||
|
{
|
||||||
|
if (res) //640X480
|
||||||
|
{
|
||||||
|
changed_prefs.gfx_width_win = 640;
|
||||||
|
changed_prefs.gfx_height_win = 480;
|
||||||
|
changed_prefs.gfx_lores = 0;
|
||||||
|
changed_prefs.gfx_linedbl = 1;
|
||||||
|
}
|
||||||
|
else //320X240
|
||||||
|
{
|
||||||
|
changed_prefs.gfx_width_win = 320;
|
||||||
|
changed_prefs.gfx_height_win = 240;
|
||||||
|
changed_prefs.gfx_lores = 1;
|
||||||
|
changed_prefs.gfx_linedbl = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void other_options(void)
|
static void other_options(void)
|
||||||
{
|
{
|
||||||
int submenus[7];
|
int submenus[8];
|
||||||
int opt, floppy_n;
|
int opt, floppy_n, old_sub_3;
|
||||||
|
|
||||||
memset(submenus, 0, sizeof(submenus));
|
memset(submenus, 0, sizeof(submenus));
|
||||||
|
|
||||||
@ -1228,10 +1248,11 @@ static void other_options(void)
|
|||||||
submenus[0] = get_floppy_speed();
|
submenus[0] = get_floppy_speed();
|
||||||
submenus[1] = floppy_n;
|
submenus[1] = floppy_n;
|
||||||
submenus[2] = get_gfx_aspect_ratio();
|
submenus[2] = get_gfx_aspect_ratio();
|
||||||
submenus[3] = !(changed_prefs.gfx_linedbl == 2) ;
|
submenus[3] = old_sub_3 = (changed_prefs.gfx_width_win == 640) ;
|
||||||
submenus[4] = !changed_prefs.leds_on_screen;
|
submenus[4] = !(changed_prefs.gfx_linedbl == 2) ;
|
||||||
submenus[5] = changed_prefs.Port;
|
submenus[5] = !changed_prefs.leds_on_screen;
|
||||||
submenus[6] = !changed_prefs.rumble;
|
submenus[6] = changed_prefs.Port;
|
||||||
|
submenus[7] = !changed_prefs.rumble;
|
||||||
|
|
||||||
opt = menu_select_title("Other options menu",
|
opt = menu_select_title("Other options menu",
|
||||||
other_messages, submenus);
|
other_messages, submenus);
|
||||||
@ -1241,10 +1262,11 @@ static void other_options(void)
|
|||||||
set_floppy_speed(submenus[0]);
|
set_floppy_speed(submenus[0]);
|
||||||
set_floppy_number(submenus[1]);
|
set_floppy_number(submenus[1]);
|
||||||
set_gfx_aspect_ratio(submenus[2]);
|
set_gfx_aspect_ratio(submenus[2]);
|
||||||
changed_prefs.gfx_linedbl = submenus[3] ? 1 : 2;
|
if (old_sub_3 != submenus[3]) set_gfx_resolution(submenus[3]);
|
||||||
changed_prefs.leds_on_screen = !submenus[4];
|
if (changed_prefs.gfx_width_win == 640) changed_prefs.gfx_linedbl = submenus[4] ? 1 : 2;
|
||||||
set_Port(submenus[5]);
|
changed_prefs.leds_on_screen = !submenus[5];
|
||||||
changed_prefs.rumble = !submenus[6];
|
set_Port(submenus[6]);
|
||||||
|
changed_prefs.rumble = !submenus[7];
|
||||||
currprefs.leds_on_screen = changed_prefs.leds_on_screen;
|
currprefs.leds_on_screen = changed_prefs.leds_on_screen;
|
||||||
currprefs.rumble = changed_prefs.rumble;
|
currprefs.rumble = changed_prefs.rumble;
|
||||||
|
|
||||||
@ -1737,7 +1759,7 @@ void gui_display(int shortcut)
|
|||||||
uae_reset(1);
|
uae_reset(1);
|
||||||
break;
|
break;
|
||||||
case 15:
|
case 15:
|
||||||
if (msgYesNo("Are you sure to quit?", 0, FULL_DISPLAY_X /2-138, FULL_DISPLAY_Y /2-48))
|
if (msgYesNo("Are you sure to quit?", 0, FULL_DISPLAY_X /2-138/RATIO, FULL_DISPLAY_Y /2-48/RATIO))
|
||||||
{currprefs.rumble=0; uae_quit();}
|
{currprefs.rumble=0; uae_quit();}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -77,6 +77,9 @@ enum hdlist_cols {
|
|||||||
HDLIST_MAX_COLS
|
HDLIST_MAX_COLS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int FULL_DISPLAY_X; //640
|
||||||
|
int FULL_DISPLAY_Y; //480
|
||||||
|
int RATIO;
|
||||||
|
|
||||||
static SDL_Surface *real_screen;
|
static SDL_Surface *real_screen;
|
||||||
|
|
||||||
@ -85,7 +88,7 @@ static SDL_Surface *real_screen;
|
|||||||
#define IS_MARKER(p_msg) ( (p_msg)[0] == '@' )
|
#define IS_MARKER(p_msg) ( (p_msg)[0] == '@' )
|
||||||
|
|
||||||
static int is_inited = 0;
|
static int is_inited = 0;
|
||||||
static TTF_Font *menu_font16, *menu_font20;
|
static TTF_Font *menu_font16, *menu_font20,*menu_font8, *menu_font10 ;
|
||||||
static TTF_Font *menu_font_alt16;
|
static TTF_Font *menu_font_alt16;
|
||||||
#if defined(GEKKO)
|
#if defined(GEKKO)
|
||||||
#define FONT_PATH "/apps/uae/FreeMono.ttf"
|
#define FONT_PATH "/apps/uae/FreeMono.ttf"
|
||||||
@ -110,21 +113,21 @@ int msgInfo(char *text, int duration, SDL_Rect *irc)
|
|||||||
SDL_Rect rc;
|
SDL_Rect rc;
|
||||||
SDL_Rect brc;
|
SDL_Rect brc;
|
||||||
|
|
||||||
X = (FULL_DISPLAY_X /2) - (len / 2 + 1)*12;
|
X = (FULL_DISPLAY_X /2) - (len / 2 + 1)*12/RATIO;
|
||||||
Y = (FULL_DISPLAY_Y /2) - 24;
|
Y = (FULL_DISPLAY_Y /2) - 24/RATIO;
|
||||||
|
|
||||||
brc.x = FULL_DISPLAY_X/2-2*12;
|
brc.x = FULL_DISPLAY_X/2-2*12/RATIO;
|
||||||
brc.y=Y+42;
|
brc.y=Y+42/RATIO;
|
||||||
brc.w=48;
|
brc.w=48/RATIO;
|
||||||
brc.h=20;
|
brc.h=20/RATIO;
|
||||||
|
|
||||||
rc.x = X;
|
rc.x = X;
|
||||||
rc.y=Y;
|
rc.y=Y;
|
||||||
rc.w=12*(len + 2);
|
rc.w=12*(len + 2)/RATIO;
|
||||||
rc.h=duration > 0 ? 48 : 80;
|
rc.h=duration > 0 ? 48/RATIO : 80/RATIO;
|
||||||
|
|
||||||
src.x=rc.x+4;
|
src.x=rc.x+4/RATIO;
|
||||||
src.y=rc.y+4;
|
src.y=rc.y+4/RATIO;
|
||||||
src.w=rc.w;
|
src.w=rc.w;
|
||||||
src.h=rc.h;
|
src.h=rc.h;
|
||||||
|
|
||||||
@ -138,7 +141,7 @@ int msgInfo(char *text, int duration, SDL_Rect *irc)
|
|||||||
}
|
}
|
||||||
SDL_FillRect(real_screen, &src, SDL_MapRGB(real_screen->format, 0, 96, 0));
|
SDL_FillRect(real_screen, &src, SDL_MapRGB(real_screen->format, 0, 96, 0));
|
||||||
SDL_FillRect(real_screen, &rc, SDL_MapRGB(real_screen->format, 128, 128, 128));
|
SDL_FillRect(real_screen, &rc, SDL_MapRGB(real_screen->format, 128, 128, 128));
|
||||||
menu_print_font(real_screen, 255,255,255, X+12, Y+12, text,20);
|
menu_print_font(real_screen, 255,255,255, X+12/RATIO, Y+12/RATIO, text,20);
|
||||||
SDL_UpdateRect(real_screen, src.x, src.y, src.w, src.h);
|
SDL_UpdateRect(real_screen, src.x, src.y, src.w, src.h);
|
||||||
SDL_UpdateRect(real_screen, rc.x, rc.y, rc.w,rc.h);
|
SDL_UpdateRect(real_screen, rc.x, rc.y, rc.w,rc.h);
|
||||||
if (duration > 0)
|
if (duration > 0)
|
||||||
@ -146,7 +149,7 @@ int msgInfo(char *text, int duration, SDL_Rect *irc)
|
|||||||
else if (duration < 0)
|
else if (duration < 0)
|
||||||
{
|
{
|
||||||
SDL_FillRect(real_screen, &brc, SDL_MapRGB(real_screen->format, 0x00, 0x80, 0x00));
|
SDL_FillRect(real_screen, &brc, SDL_MapRGB(real_screen->format, 0x00, 0x80, 0x00));
|
||||||
menu_print_font(real_screen, 0,0,0, FULL_DISPLAY_X/2-12, Y+42, "OK",20);
|
menu_print_font(real_screen, 0,0,0, FULL_DISPLAY_X/2-12/RATIO, Y+42/RATIO, "OK",20);
|
||||||
SDL_UpdateRect(real_screen, brc.x, brc.y, brc.w, brc.h);
|
SDL_UpdateRect(real_screen, brc.x, brc.y, brc.w, brc.h);
|
||||||
while (!(KEY_SELECT & menu_wait_key_press())) {}
|
while (!(KEY_SELECT & menu_wait_key_press())) {}
|
||||||
|
|
||||||
@ -175,22 +178,22 @@ int msgYesNo(char *text, int default_opt, int x, int y)
|
|||||||
//old = default_opt;
|
//old = default_opt;
|
||||||
|
|
||||||
if (x < 0)
|
if (x < 0)
|
||||||
X = (FULL_DISPLAY_X /2) - (len / 2 + 1)*12;
|
X = (FULL_DISPLAY_X /2) - (len / 2 + 1)*12/RATIO;
|
||||||
else
|
else
|
||||||
X = x;
|
X = x;
|
||||||
|
|
||||||
if (y < 0)
|
if (y < 0)
|
||||||
Y = (FULL_DISPLAY_Y /2) - 48;
|
Y = (FULL_DISPLAY_Y /2) - 48/RATIO;
|
||||||
else
|
else
|
||||||
Y = y;
|
Y = y;
|
||||||
|
|
||||||
rc.x=X;
|
rc.x=X;
|
||||||
rc.y=Y;
|
rc.y=Y;
|
||||||
rc.w=12*(len + 2);
|
rc.w=12*(len + 2)/RATIO;
|
||||||
rc.h=80;
|
rc.h=80/RATIO;
|
||||||
|
|
||||||
src.x=rc.x+4;
|
src.x=rc.x+4/RATIO;
|
||||||
src.y=rc.y+4;
|
src.y=rc.y+4/RATIO;
|
||||||
src.w=rc.w;
|
src.w=rc.w;
|
||||||
src.h=rc.h;
|
src.h=rc.h;
|
||||||
|
|
||||||
@ -198,27 +201,27 @@ int msgYesNo(char *text, int default_opt, int x, int y)
|
|||||||
{
|
{
|
||||||
SDL_FillRect(real_screen, &src, SDL_MapRGB(real_screen->format, 0, 96, 0));
|
SDL_FillRect(real_screen, &src, SDL_MapRGB(real_screen->format, 0, 96, 0));
|
||||||
SDL_FillRect(real_screen, &rc, SDL_MapRGB(real_screen->format, 128, 128, 128));
|
SDL_FillRect(real_screen, &rc, SDL_MapRGB(real_screen->format, 128, 128, 128));
|
||||||
menu_print_font(real_screen, 255,255,255, X+12, Y+12, text,20);
|
menu_print_font(real_screen, 255,255,255, X+12/RATIO, Y+12/RATIO, text,20);
|
||||||
|
|
||||||
if (default_opt)
|
if (default_opt)
|
||||||
{
|
{
|
||||||
brc.x=rc.x + rc.w/2-5*12;
|
brc.x=rc.x + rc.w/2-5*12/RATIO;
|
||||||
brc.y=rc.y+42;
|
brc.y=rc.y+42/RATIO;
|
||||||
brc.w=12*3;
|
brc.w=12*3/RATIO;
|
||||||
brc.h=20;
|
brc.h=20/RATIO;
|
||||||
SDL_FillRect(real_screen, &brc, SDL_MapRGB(real_screen->format, 0x00, 0x80, 0x00));
|
SDL_FillRect(real_screen, &brc, SDL_MapRGB(real_screen->format, 0x00, 0x80, 0x00));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
brc.x=rc.x + rc.w/2+5*12-2*12-6;
|
brc.x=rc.x + rc.w/2+5*12/RATIO-2*12/RATIO-6/RATIO;
|
||||||
brc.y=rc.y+42;
|
brc.y=rc.y+42/RATIO;
|
||||||
brc.w=12*3;
|
brc.w=12*3/RATIO;
|
||||||
brc.h=20;
|
brc.h=20/RATIO;
|
||||||
SDL_FillRect(real_screen, &brc, SDL_MapRGB(real_screen->format, 0x80, 0x00, 0x00));
|
SDL_FillRect(real_screen, &brc, SDL_MapRGB(real_screen->format, 0x80, 0x00, 0x00));
|
||||||
}
|
}
|
||||||
|
|
||||||
menu_print_font(real_screen, 255,255,255, rc.x + rc.w/2-5*12, Y+42, "YES",20);
|
menu_print_font(real_screen, 255,255,255, rc.x + rc.w/2-5*12/RATIO, Y+42/RATIO, "YES",20);
|
||||||
menu_print_font(real_screen, 255,255,255, rc.x + rc.w/2-5*12+8*12, Y+42, "NO",20);
|
menu_print_font(real_screen, 255,255,255, rc.x + rc.w/2-5*12/RATIO+8*12/RATIO, Y+42/RATIO, "NO",20);
|
||||||
|
|
||||||
SDL_UpdateRect(real_screen, src.x, src.y, src.w, src.h);
|
SDL_UpdateRect(real_screen, src.x, src.y, src.w, src.h);
|
||||||
SDL_UpdateRect(real_screen, rc.x, rc.y, rc.w,rc.h);
|
SDL_UpdateRect(real_screen, rc.x, rc.y, rc.w,rc.h);
|
||||||
@ -472,8 +475,18 @@ void menu_print_font(SDL_Surface *screen, int r, int g, int b,
|
|||||||
buf[i] = ' ';
|
buf[i] = ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (font_size == 16) font_surf = TTF_RenderUTF8_Blended(menu_font16, buf, color);
|
if (FULL_DISPLAY_X == 640)
|
||||||
|
{
|
||||||
|
if (font_size == 16) font_surf = TTF_RenderUTF8_Blended(menu_font16, buf, color);
|
||||||
else font_surf = TTF_RenderUTF8_Blended(menu_font20, buf, color);
|
else font_surf = TTF_RenderUTF8_Blended(menu_font20, buf, color);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (font_size == 16) font_surf = TTF_RenderUTF8_Blended(menu_font8, buf, color);
|
||||||
|
else font_surf = TTF_RenderUTF8_Blended(menu_font10, buf, color);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!font_surf)
|
if (!font_surf)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s\n", TTF_GetError());
|
fprintf(stderr, "%s\n", TTF_GetError());
|
||||||
@ -534,7 +547,7 @@ static void menu_draw(SDL_Surface *screen, menu_t *p_menu, int sel, int font_siz
|
|||||||
int x_start = p_menu->x1;
|
int x_start = p_menu->x1;
|
||||||
int y_start = p_menu->y1 + line_height;
|
int y_start = p_menu->y1 + line_height;
|
||||||
SDL_Rect r;
|
SDL_Rect r;
|
||||||
int entries_visible = (p_menu->y2 - p_menu->y1) / line_height - 1;
|
int entries_visible = (p_menu->y2 - p_menu->y1 -5) / line_height - 1;
|
||||||
|
|
||||||
int i, y;
|
int i, y;
|
||||||
|
|
||||||
@ -991,8 +1004,17 @@ int menu_select_sized(const char *title, const char **msgs, int *submenus, int s
|
|||||||
else
|
else
|
||||||
info = 1;
|
info = 1;
|
||||||
*/
|
*/
|
||||||
|
if (FULL_DISPLAY_X == 640)
|
||||||
|
{
|
||||||
if (font_size == 16) menu_init_internal(&menu, title, menu_font16, msgs, x, y, x2, y2);
|
if (font_size == 16) menu_init_internal(&menu, title, menu_font16, msgs, x, y, x2, y2);
|
||||||
else menu_init_internal(&menu, title, menu_font20, msgs, x, y, x2, y2);
|
else menu_init_internal(&menu, title, menu_font20, msgs, x, y, x2, y2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (font_size == 16) menu_init_internal(&menu, title, menu_font8, msgs, x, y, x2, y2);
|
||||||
|
else menu_init_internal(&menu, title, menu_font10, msgs, x, y, x2, y2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (sel >= 0)
|
if (sel >= 0)
|
||||||
select_one(&menu, sel);
|
select_one(&menu, sel);
|
||||||
@ -1008,7 +1030,7 @@ int menu_select_title(const char *title, const char **msgs, int *submenus)
|
|||||||
{
|
{
|
||||||
SDL_FillRect(real_screen, 0, SDL_MapRGB(real_screen->format, 0, 0, 0));
|
SDL_FillRect(real_screen, 0, SDL_MapRGB(real_screen->format, 0, 0, 0));
|
||||||
return menu_select_sized(title, msgs, submenus, 0,
|
return menu_select_sized(title, msgs, submenus, 0,
|
||||||
32, 20, FULL_DISPLAY_X-32, FULL_DISPLAY_Y-20,
|
32/RATIO, 16/RATIO, FULL_DISPLAY_X-32/RATIO, FULL_DISPLAY_Y-16/RATIO,
|
||||||
NULL, NULL, 20);
|
NULL, NULL, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1103,14 +1125,14 @@ const char *menu_select_file(const char *dir_path,const char *selected_file, int
|
|||||||
if (dir_path == NULL)
|
if (dir_path == NULL)
|
||||||
dir_path = "";
|
dir_path = "";
|
||||||
return menu_select_file_internal(dir_path,
|
return menu_select_file_internal(dir_path,
|
||||||
0, 20, FULL_DISPLAY_X, FULL_DISPLAY_Y - 20, selected_file, which);
|
0, 20/RATIO, FULL_DISPLAY_X, FULL_DISPLAY_Y - 20/RATIO, selected_file, which);
|
||||||
}
|
}
|
||||||
|
|
||||||
int menu_select_devices()
|
int menu_select_devices()
|
||||||
{
|
{
|
||||||
const char *selected_device;
|
const char *selected_device;
|
||||||
selected_device= menu_select_file_internal("devices",
|
selected_device= menu_select_file_internal("devices",
|
||||||
0, 20, FULL_DISPLAY_X, FULL_DISPLAY_Y - 20, NULL, 0);
|
0, 20/RATIO, FULL_DISPLAY_X, FULL_DISPLAY_Y - 20/RATIO, NULL, 0);
|
||||||
if (!selected_device) return -1; else return (atoi(selected_device));
|
if (!selected_device) return -1; else return (atoi(selected_device));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1149,10 +1171,19 @@ static TTF_Font *read_font(const char *path, int font_size)
|
|||||||
|
|
||||||
void menu_init(SDL_Surface *screen)
|
void menu_init(SDL_Surface *screen)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
FULL_DISPLAY_X = currprefs.gfx_width_win;
|
||||||
|
FULL_DISPLAY_Y = currprefs.gfx_height_win;
|
||||||
|
RATIO = 640/FULL_DISPLAY_X;
|
||||||
|
|
||||||
|
if (is_inited) return;
|
||||||
|
|
||||||
TTF_Init();
|
TTF_Init();
|
||||||
|
|
||||||
menu_font16 = read_font(FONT_PATH, 16);
|
menu_font16 = read_font(FONT_PATH, 16);
|
||||||
menu_font20 = read_font(FONT_PATH, 20);
|
menu_font20 = read_font(FONT_PATH, 20);
|
||||||
|
menu_font8 = read_font(FONT_PATH, 8);
|
||||||
|
menu_font10 = read_font(FONT_PATH, 10);
|
||||||
|
|
||||||
menu_font_alt16 = read_font(FONT_ALT_PATH,16);
|
menu_font_alt16 = read_font(FONT_ALT_PATH,16);
|
||||||
|
|
||||||
@ -1161,6 +1192,21 @@ void menu_init(SDL_Surface *screen)
|
|||||||
is_inited = 1;
|
is_inited = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void menu_deinit(void)
|
||||||
|
{
|
||||||
|
is_inited = 0;
|
||||||
|
VirtualKeyboard_fini();
|
||||||
|
|
||||||
|
TTF_CloseFont(menu_font16);
|
||||||
|
TTF_CloseFont(menu_font20);
|
||||||
|
TTF_CloseFont(menu_font8);
|
||||||
|
TTF_CloseFont(menu_font10);
|
||||||
|
TTF_CloseFont(menu_font_alt16);
|
||||||
|
|
||||||
|
TTF_Quit();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int menu_is_inited(void)
|
int menu_is_inited(void)
|
||||||
{
|
{
|
||||||
return is_inited;
|
return is_inited;
|
||||||
|
@ -30,10 +30,12 @@ extern "C" {
|
|||||||
#define KEY_PAGEDOWN 64
|
#define KEY_PAGEDOWN 64
|
||||||
#define KEY_PAGEUP 128
|
#define KEY_PAGEUP 128
|
||||||
#define KEY_HELP 256
|
#define KEY_HELP 256
|
||||||
#define FULL_DISPLAY_X 640
|
|
||||||
#define FULL_DISPLAY_Y 480
|
|
||||||
#define MAX_DEVICE_ITEM 32
|
#define MAX_DEVICE_ITEM 32
|
||||||
|
|
||||||
|
extern int FULL_DISPLAY_X; //640
|
||||||
|
extern int FULL_DISPLAY_Y; //480
|
||||||
|
extern int RATIO;
|
||||||
|
|
||||||
|
|
||||||
void menu_print_font(SDL_Surface *screen, int r, int g, int b, int x, int y, const char *msg, int font_size);
|
void menu_print_font(SDL_Surface *screen, int r, int g, int b, int x, int y, const char *msg, int font_size);
|
||||||
void menu_print_font_alt(SDL_Surface *screen, int r, int g, int b, int x, int y, const char *msg);
|
void menu_print_font_alt(SDL_Surface *screen, int r, int g, int b, int x, int y, const char *msg);
|
||||||
@ -46,13 +48,15 @@ const char *menu_select_file_start(const char *dir_path, const char **d64_name);
|
|||||||
|
|
||||||
uint32_t menu_wait_key_press(void);
|
uint32_t menu_wait_key_press(void);
|
||||||
|
|
||||||
extern void msgKill(SDL_Rect *rc);
|
void msgKill(SDL_Rect *rc);
|
||||||
extern int msgInfo(char *text, int duration, SDL_Rect *rc);
|
int msgInfo(char *text, int duration, SDL_Rect *rc);
|
||||||
|
|
||||||
extern int msgYesNo(char *text, int def,int x, int y);
|
int msgYesNo(char *text, int def,int x, int y);
|
||||||
|
|
||||||
void menu_init(SDL_Surface *screen);
|
void menu_init(SDL_Surface *screen);
|
||||||
|
|
||||||
|
void menu_deinit(void);
|
||||||
|
|
||||||
int menu_is_inited(void);
|
int menu_is_inited(void);
|
||||||
|
|
||||||
int ext_matches(const char *name, const char *ext);
|
int ext_matches(const char *name, const char *ext);
|
||||||
|
Loading…
Reference in New Issue
Block a user