mirror of
https://github.com/holub/mame
synced 2025-04-26 18:23:08 +03:00
menu: allocate and draw icons only if available. nw
This commit is contained in:
parent
97f515d8c4
commit
32630f09aa
@ -1309,11 +1309,27 @@ void ui_menu::init_ui(running_machine &machine)
|
||||
star_texture = mrender.texture_alloc();
|
||||
star_texture->set_bitmap(*star_bitmap, star_bitmap->cliprect(), TEXFORMAT_ARGB32);
|
||||
|
||||
// allocates icons bitmap and texture
|
||||
for (int i = 0; i < MAX_ICONS_RENDER; i++)
|
||||
// check and allocate icons
|
||||
file_enumerator path(machine.ui().options().icons_directory());
|
||||
const osd_directory_entry *dir;
|
||||
while ((dir = path.next()) != nullptr)
|
||||
{
|
||||
icons_bitmap[i] = auto_alloc(machine, bitmap_argb32);
|
||||
icons_texture[i] = mrender.texture_alloc();
|
||||
char drivername[50];
|
||||
char *dst = drivername;
|
||||
const char *src;
|
||||
|
||||
// build a name for it
|
||||
src = dir->name;
|
||||
if (*src != 0 && *src != '.')
|
||||
{
|
||||
ui_globals::has_icons = true;
|
||||
for (int i = 0; i < MAX_ICONS_RENDER; i++)
|
||||
{
|
||||
icons_bitmap[i] = auto_alloc(machine, bitmap_argb32);
|
||||
icons_texture[i] = mrender.texture_alloc();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// create a texture for main menu background
|
||||
|
@ -48,6 +48,7 @@ bool ui_globals::redraw_icon = false;
|
||||
int ui_globals::visible_main_lines = 0;
|
||||
int ui_globals::visible_sw_lines = 0;
|
||||
UINT16 ui_globals::panels_status = 0;
|
||||
bool ui_globals::has_icons = false;
|
||||
|
||||
// Custom filter
|
||||
UINT16 custfltr::main = 0;
|
||||
|
@ -208,6 +208,7 @@ struct ui_globals
|
||||
static bool switch_image, redraw_icon, default_image, reset;
|
||||
static int visible_main_lines, visible_sw_lines;
|
||||
static UINT16 panels_status;
|
||||
static bool has_icons;
|
||||
};
|
||||
|
||||
#define main_struct(name) \
|
||||
|
Loading…
Reference in New Issue
Block a user