summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/ui/menu.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/emu/ui/menu.c')
-rw-r--r--src/emu/ui/menu.c204
1 files changed, 102 insertions, 102 deletions
diff --git a/src/emu/ui/menu.c b/src/emu/ui/menu.c
index 3e35ee3a6c5..6e5c8f09297 100644
--- a/src/emu/ui/menu.c
+++ b/src/emu/ui/menu.c
@@ -83,10 +83,10 @@ void ui_menu::init(running_machine &machine)
{
int x;
- // initialize the menu stack
+ // initialize the menu stack
ui_menu::stack_reset(machine);
- // create a texture for hilighting items
+ // create a texture for hilighting items
hilight_bitmap = auto_bitmap_rgb32_alloc(machine, 256, 1);
for (x = 0; x < 256; x++)
{
@@ -98,10 +98,10 @@ void ui_menu::init(running_machine &machine)
hilight_texture = machine.render().texture_alloc();
hilight_texture->set_bitmap(*hilight_bitmap, hilight_bitmap->cliprect(), TEXFORMAT_ARGB32);
- // create a texture for arrow icons
+ // create a texture for arrow icons
arrow_texture = machine.render().texture_alloc(render_triangle);
- // add an exit callback to free memory
+ // add an exit callback to free memory
machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(ui_menu::exit), &machine));
}
@@ -112,11 +112,11 @@ void ui_menu::init(running_machine &machine)
void ui_menu::exit(running_machine &machine)
{
- // free menus
+ // free menus
ui_menu::stack_reset(machine);
ui_menu::clear_free_list(machine);
- // free textures
+ // free textures
machine.render().texture_free(hilight_texture);
machine.render().texture_free(arrow_texture);
}
@@ -146,7 +146,7 @@ ui_menu::ui_menu(running_machine &machine, render_container *_container) : m_mac
ui_menu::~ui_menu()
{
- // free the pools
+ // free the pools
while (pool)
{
ui_menu_pool *ppool = pool;
@@ -154,7 +154,7 @@ ui_menu::~ui_menu()
auto_free(machine(), ppool);
}
- // free the item array
+ // free the item array
if (item)
auto_free(machine(), item);
}
@@ -167,7 +167,7 @@ ui_menu::~ui_menu()
void ui_menu::reset(ui_menu_reset_options options)
{
- // based on the reset option, set the reset info
+ // based on the reset option, set the reset info
resetpos = 0;
resetref = NULL;
if (options == UI_MENU_RESET_REMEMBER_POSITION)
@@ -175,7 +175,7 @@ void ui_menu::reset(ui_menu_reset_options options)
else if (options == UI_MENU_RESET_REMEMBER_REF)
resetref = item[selected].ref;
- // reset all the pools and the numitems back to 0
+ // reset all the pools and the numitems back to 0
for (ui_menu_pool *ppool = pool; ppool != NULL; ppool = ppool->next)
ppool->top = (UINT8 *)(ppool + 1);
numitems = 0;
@@ -184,7 +184,7 @@ void ui_menu::reset(ui_menu_reset_options options)
astring backtext;
backtext.printf("Return to %s",emulator_info::get_capstartgamenoun());
- // add an item to return
+ // add an item to return
if (parent == NULL)
item_append(backtext.cstr(), NULL, 0, NULL);
else if (parent->is_special_main_menu())
@@ -237,15 +237,15 @@ void ui_menu::item_append(const char *text, const char *subtext, UINT32 flags, v
ui_menu_item *pitem;
int index;
- // only allow multiline as the first item
+ // only allow multiline as the first item
if ((flags & MENU_FLAG_MULTILINE) != 0)
assert(numitems == 1);
- // only allow a single multi-line item
+ // only allow a single multi-line item
else if (numitems >= 2)
assert((item[0].flags & MENU_FLAG_MULTILINE) == 0);
- // realloc the item array if necessary
+ // realloc the item array if necessary
if (numitems >= allocitems)
{
int olditems = allocitems;
@@ -258,21 +258,21 @@ void ui_menu::item_append(const char *text, const char *subtext, UINT32 flags, v
}
index = numitems++;
- // copy the previous last item to the next one
+ // copy the previous last item to the next one
if (index != 0)
{
index--;
item[index + 1] = item[index];
}
- // allocate a new item and populate it
+ // allocate a new item and populate it
pitem = &item[index];
pitem->text = (text != NULL) ? pool_strdup(text) : NULL;
pitem->subtext = (subtext != NULL) ? pool_strdup(subtext) : NULL;
pitem->flags = flags;
pitem->ref = ref;
- // update the selection if we need to
+ // update the selection if we need to
if (resetpos == index || (resetref != NULL && resetref == ref))
selected = index;
if (resetpos == numitems - 1)
@@ -287,30 +287,30 @@ void ui_menu::item_append(const char *text, const char *subtext, UINT32 flags, v
const ui_menu_event *ui_menu::process(UINT32 flags)
{
- // reset the menu_event
+ // reset the menu_event
menu_event.iptkey = IPT_INVALID;
- // first make sure our selection is valid
+ // first make sure our selection is valid
validate_selection(1);
- // draw the menu
+ // draw the menu
if (numitems > 1 && (item[0].flags & MENU_FLAG_MULTILINE) != 0)
draw_text_box();
else
draw(flags & UI_MENU_PROCESS_CUSTOM_ONLY);
- // process input
+ // process input
if (!(flags & UI_MENU_PROCESS_NOKEYS))
{
- // read events
+ // read events
handle_events();
- // handle the keys if we don't already have an menu_event
+ // handle the keys if we don't already have an menu_event
if (menu_event.iptkey == IPT_INVALID)
handle_keys(flags);
}
- // update the selected item in the menu_event
+ // update the selected item in the menu_event
if (menu_event.iptkey != IPT_INVALID && selected >= 0 && selected < numitems)
{
menu_event.itemref = item[selected].ref;
@@ -331,7 +331,7 @@ void *ui_menu::m_pool_alloc(size_t size)
assert(size < UI_MENU_POOL_SIZE);
- // find a pool with enough room
+ // find a pool with enough room
for (ppool = pool; ppool != NULL; ppool = ppool->next)
if (ppool->end - ppool->top >= size)
{
@@ -340,10 +340,10 @@ void *ui_menu::m_pool_alloc(size_t size)
return result;
}
- // allocate a new pool
+ // allocate a new pool
ppool = (ui_menu_pool *)auto_alloc_array_clear(machine(), UINT8, sizeof(*ppool) + UI_MENU_POOL_SIZE);
- // wire it up
+ // wire it up
ppool->next = pool;
pool = ppool;
ppool->top = (UINT8 *)(ppool + 1);
@@ -423,7 +423,7 @@ void ui_menu::draw(bool customonly)
INT32 mouse_target_x, mouse_target_y;
float mouse_x = -1, mouse_y = -1;
- // compute the width and height of the full menu
+ // compute the width and height of the full menu
visible_width = 0;
visible_main_menu_height = 0;
for (itemnum = 0; itemnum < numitems; itemnum++)
@@ -431,47 +431,47 @@ void ui_menu::draw(bool customonly)
const ui_menu_item &pitem = item[itemnum];
float total_width;
- // compute width of left hand side
+ // compute width of left hand side
total_width = gutter_width + machine().ui().get_string_width(pitem.text) + gutter_width;
- // add in width of right hand side
+ // add in width of right hand side
if (pitem.subtext)
total_width += 2.0f * gutter_width + machine().ui().get_string_width(pitem.subtext);
- // track the maximum
+ // track the maximum
if (total_width > visible_width)
visible_width = total_width;
- // track the height as well
+ // track the height as well
visible_main_menu_height += line_height;
}
- // account for extra space at the top and bottom
+ // account for extra space at the top and bottom
visible_extra_menu_height = customtop + custombottom;
- // add a little bit of slop for rounding
+ // add a little bit of slop for rounding
visible_width += 0.01f;
visible_main_menu_height += 0.01f;
- // if we are too wide or too tall, clamp it down
+ // if we are too wide or too tall, clamp it down
if (visible_width + 2.0f * UI_BOX_LR_BORDER > 1.0f)
visible_width = 1.0f - 2.0f * UI_BOX_LR_BORDER;
- // if the menu and extra menu won't fit, take away part of the regular menu, it will scroll
+ // if the menu and extra menu won't fit, take away part of the regular menu, it will scroll
if (visible_main_menu_height + visible_extra_menu_height + 2.0f * UI_BOX_TB_BORDER > 1.0f)
visible_main_menu_height = 1.0f - 2.0f * UI_BOX_TB_BORDER - visible_extra_menu_height;
visible_lines = floor(visible_main_menu_height / line_height);
visible_main_menu_height = (float)visible_lines * line_height;
- // compute top/left of inner menu area by centering
+ // compute top/left of inner menu area by centering
visible_left = (1.0f - visible_width) * 0.5f;
visible_top = (1.0f - (visible_main_menu_height + visible_extra_menu_height)) * 0.5f;
- // if the menu is at the bottom of the extra, adjust
+ // if the menu is at the bottom of the extra, adjust
visible_top += customtop;
- // first add us a box
+ // first add us a box
x1 = visible_left - UI_BOX_LR_BORDER;
y1 = visible_top - UI_BOX_TB_BORDER;
x2 = visible_left + visible_width + UI_BOX_LR_BORDER;
@@ -479,18 +479,18 @@ void ui_menu::draw(bool customonly)
if (!customonly)
machine().ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR);
- // determine the first visible line based on the current selection
+ // determine the first visible line based on the current selection
top_line = selected - visible_lines / 2;
if (top_line < 0)
top_line = 0;
if (top_line + visible_lines >= numitems)
top_line = numitems - visible_lines;
- // determine effective positions taking into account the hilighting arrows
+ // determine effective positions taking into account the hilighting arrows
effective_width = visible_width - 2.0f * gutter_width;
effective_left = visible_left + gutter_width;
- // locate mouse
+ // locate mouse
mouse_hit = false;
mouse_button = false;
if (!customonly)
@@ -501,7 +501,7 @@ void ui_menu::draw(bool customonly)
mouse_hit = true;
}
- // loop over visible lines
+ // loop over visible lines
hover = numitems + 1;
if (!customonly)
for (linenum = 0; linenum < visible_lines; linenum++)
@@ -519,11 +519,11 @@ void ui_menu::draw(bool customonly)
float line_x1 = x2 - 0.5f * UI_LINE_WIDTH;
float line_y1 = line_y + line_height;
- // set the hover if this is our item
+ // set the hover if this is our item
if (mouse_hit && line_x0 <= mouse_x && line_x1 > mouse_x && line_y0 <= mouse_y && line_y1 > mouse_y && pitem.is_selectable())
hover = itemnum;
- // if we're selected, draw with a different background
+ // if we're selected, draw with a different background
if (itemnum == selected)
{
fgcolor = UI_SELECTED_COLOR;
@@ -532,7 +532,7 @@ void ui_menu::draw(bool customonly)
fgcolor3 = UI_SELECTED_COLOR;
}
- // else if the mouse is over this item, draw with a different background
+ // else if the mouse is over this item, draw with a different background
else if (itemnum == hover)
{
fgcolor = UI_MOUSEOVER_COLOR;
@@ -541,11 +541,11 @@ void ui_menu::draw(bool customonly)
fgcolor3 = UI_MOUSEOVER_COLOR;
}
- // if we have some background hilighting to do, add a quad behind everything else
+ // if we have some background hilighting to do, add a quad behind everything else
if (bgcolor != UI_TEXT_BG_COLOR)
highlight(container, line_x0, line_y0, line_x1, line_y1, bgcolor);
- // if we're on the top line, display the up arrow
+ // if we're on the top line, display the up arrow
if (linenum == 0 && top_line != 0)
{
draw_arrow(
@@ -560,7 +560,7 @@ void ui_menu::draw(bool customonly)
hover = -2;
}
- // if we're on the bottom line, display the down arrow
+ // if we're on the bottom line, display the down arrow
else if (linenum == visible_lines - 1 && itemnum != numitems - 1)
{
draw_arrow(
@@ -575,30 +575,30 @@ void ui_menu::draw(bool customonly)
hover = -1;
}
- // if we're just a divider, draw a line
+ // if we're just a divider, draw a line
else if (strcmp(itemtext, MENU_SEPARATOR_ITEM) == 0)
container->add_line(visible_left, line_y + 0.5f * line_height, visible_left + visible_width, line_y + 0.5f * line_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
- // if we don't have a subitem, just draw the string centered
+ // if we don't have a subitem, just draw the string centered
else if (pitem.subtext == NULL)
machine().ui().draw_text_full(container, itemtext, effective_left, line_y, effective_width,
JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL, fgcolor, bgcolor, NULL, NULL);
- // otherwise, draw the item on the left and the subitem text on the right
+ // otherwise, draw the item on the left and the subitem text on the right
else
{
int subitem_invert = pitem.flags & MENU_FLAG_INVERT;
const char *subitem_text = pitem.subtext;
float item_width, subitem_width;
- // draw the left-side text
+ // draw the left-side text
machine().ui().draw_text_full(container, itemtext, effective_left, line_y, effective_width,
JUSTIFY_LEFT, WRAP_TRUNCATE, DRAW_NORMAL, fgcolor, bgcolor, &item_width, NULL);
- // give 2 spaces worth of padding
+ // give 2 spaces worth of padding
item_width += 2.0f * gutter_width;
- // if the subitem doesn't fit here, display dots
+ // if the subitem doesn't fit here, display dots
if (machine().ui().get_string_width(subitem_text) > effective_width - item_width)
{
subitem_text = "...";
@@ -606,11 +606,11 @@ void ui_menu::draw(bool customonly)
selected_subitem_too_big = TRUE;
}
- // draw the subitem right-justified
+ // draw the subitem right-justified
machine().ui().draw_text_full(container, subitem_text, effective_left + item_width, line_y, effective_width - item_width,
JUSTIFY_RIGHT, WRAP_TRUNCATE, DRAW_NORMAL, subitem_invert ? fgcolor3 : fgcolor2, bgcolor, &subitem_width, NULL);
- // apply arrows
+ // apply arrows
if (itemnum == selected && (pitem.flags & MENU_FLAG_LEFT_ARROW))
{
draw_arrow(
@@ -636,7 +636,7 @@ void ui_menu::draw(bool customonly)
}
}
- // if the selected subitem is too big, display it in a separate offset box
+ // if the selected subitem is too big, display it in a separate offset box
if (selected_subitem_too_big)
{
const ui_menu_item &pitem = item[selected];
@@ -646,17 +646,17 @@ void ui_menu::draw(bool customonly)
float target_width, target_height;
float target_x, target_y;
- // compute the multi-line target width/height
+ // compute the multi-line target width/height
machine().ui().draw_text_full(container, pitem.subtext, 0, 0, visible_width * 0.75f,
JUSTIFY_RIGHT, WRAP_WORD, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &target_width, &target_height);
- // determine the target location
+ // determine the target location
target_x = visible_left + visible_width - target_width - UI_BOX_LR_BORDER;
target_y = line_y + line_height + UI_BOX_TB_BORDER;
if (target_y + target_height + UI_BOX_TB_BORDER > visible_main_menu_height)
target_y = line_y - target_height - UI_BOX_TB_BORDER;
- // add a box around that
+ // add a box around that
machine().ui().draw_outlined_box(container, target_x - UI_BOX_LR_BORDER,
target_y - UI_BOX_TB_BORDER,
target_x + target_width + UI_BOX_LR_BORDER,
@@ -665,10 +665,10 @@ void ui_menu::draw(bool customonly)
JUSTIFY_RIGHT, WRAP_WORD, DRAW_NORMAL, UI_SELECTED_COLOR, UI_SELECTED_BG_COLOR, NULL, NULL);
}
- // if there is something special to add, do it by calling the virtual method
+ // if there is something special to add, do it by calling the virtual method
custom_render((selected >= 0 && selected < numitems) ? item[selected].ref : NULL, customtop, custombottom, x1, y1, x2, y2);
- // return the number of visible lines, minus 1 for top arrow and 1 for bottom arrow
+ // return the number of visible lines, minus 1 for top arrow and 1 for bottom arrow
visitems = visible_lines - (top_line != 0) - (top_line + visible_lines != numitems);
}
@@ -692,22 +692,22 @@ void ui_menu::draw_text_box()
float target_width, target_height, prior_width;
float target_x, target_y;
- // compute the multi-line target width/height
+ // compute the multi-line target width/height
machine().ui().draw_text_full(container, text, 0, 0, 1.0f - 2.0f * UI_BOX_LR_BORDER - 2.0f * gutter_width,
JUSTIFY_LEFT, WRAP_WORD, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &target_width, &target_height);
target_height += 2.0f * line_height;
if (target_height > 1.0f - 2.0f * UI_BOX_TB_BORDER)
target_height = floor((1.0f - 2.0f * UI_BOX_TB_BORDER) / line_height) * line_height;
- // maximum against "return to prior menu" text
+ // maximum against "return to prior menu" text
prior_width = machine().ui().get_string_width(backtext) + 2.0f * gutter_width;
target_width = MAX(target_width, prior_width);
- // determine the target location
+ // determine the target location
target_x = 0.5f - 0.5f * target_width;
target_y = 0.5f - 0.5f * target_height;
- // make sure we stay on-screen
+ // make sure we stay on-screen
if (target_x < UI_BOX_LR_BORDER + gutter_width)
target_x = UI_BOX_LR_BORDER + gutter_width;
if (target_x + target_width + gutter_width + UI_BOX_LR_BORDER > 1.0f)
@@ -717,7 +717,7 @@ void ui_menu::draw_text_box()
if (target_y + target_height + UI_BOX_TB_BORDER > 1.0f)
target_y = 1.0f - UI_BOX_TB_BORDER - target_height;
- // add a box around that
+ // add a box around that
machine().ui().draw_outlined_box(container, target_x - UI_BOX_LR_BORDER - gutter_width,
target_y - UI_BOX_TB_BORDER,
target_x + target_width + gutter_width + UI_BOX_LR_BORDER,
@@ -725,7 +725,7 @@ void ui_menu::draw_text_box()
machine().ui().draw_text_full(container, text, target_x, target_y, target_width,
JUSTIFY_LEFT, WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, NULL, NULL);
- // draw the "return to prior menu" text with a hilight behind it
+ // draw the "return to prior menu" text with a hilight behind it
highlight(
container,
target_x + 0.5f * UI_LINE_WIDTH,
@@ -736,7 +736,7 @@ void ui_menu::draw_text_box()
machine().ui().draw_text_full(container, backtext, target_x, target_y + target_height - line_height, target_width,
JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL, UI_SELECTED_COLOR, UI_SELECTED_BG_COLOR, NULL, NULL);
- // artificially set the hover to the last item so a double-click exits
+ // artificially set the hover to the last item so a double-click exits
hover = numitems - 1;
}
@@ -751,12 +751,12 @@ void ui_menu::handle_events()
int stop = FALSE;
ui_event local_menu_event;
- // loop while we have interesting events
+ // loop while we have interesting events
while (!stop && ui_input_pop_event(machine(), &local_menu_event))
{
switch (local_menu_event.event_type)
{
- // if we are hovering over a valid item, select it with a single click
+ // if we are hovering over a valid item, select it with a single click
case UI_EVENT_MOUSE_DOWN:
if (hover >= 0 && hover < numitems)
selected = hover;
@@ -772,7 +772,7 @@ void ui_menu::handle_events()
}
break;
- // if we are hovering over a valid item, fake a UI_SELECT with a double-click
+ // if we are hovering over a valid item, fake a UI_SELECT with a double-click
case UI_EVENT_MOUSE_DOUBLE_CLICK:
if (hover >= 0 && hover < numitems)
{
@@ -790,14 +790,14 @@ void ui_menu::handle_events()
}
break;
- // translate CHAR events into specials
+ // translate CHAR events into specials
case UI_EVENT_CHAR:
menu_event.iptkey = IPT_SPECIAL;
menu_event.unichar = local_menu_event.ch;
stop = TRUE;
break;
- // ignore everything else
+ // ignore everything else
default:
break;
}
@@ -817,11 +817,11 @@ void ui_menu::handle_keys(UINT32 flags)
int ignoreleft = FALSE;
int code;
- // bail if no items
+ // bail if no items
if (numitems == 0)
return;
- // if we hit select, return TRUE or pop the stack, depending on the item
+ // if we hit select, return TRUE or pop the stack, depending on the item
if (exclusive_input_pressed(IPT_UI_SELECT, 0))
{
if (selected == numitems - 1)
@@ -832,69 +832,69 @@ void ui_menu::handle_keys(UINT32 flags)
return;
}
- // hitting cancel also pops the stack
+ // hitting cancel also pops the stack
if (exclusive_input_pressed(IPT_UI_CANCEL, 0))
{
ui_menu::stack_pop(machine());
return;
}
- // validate the current selection
+ // validate the current selection
validate_selection(1);
- // swallow left/right keys if they are not appropriate
+ // swallow left/right keys if they are not appropriate
ignoreleft = ((item[selected].flags & MENU_FLAG_LEFT_ARROW) == 0);
ignoreright = ((item[selected].flags & MENU_FLAG_RIGHT_ARROW) == 0);
- // accept left/right keys as-is with repeat
+ // accept left/right keys as-is with repeat
if (!ignoreleft && exclusive_input_pressed(IPT_UI_LEFT, (flags & UI_MENU_PROCESS_LR_REPEAT) ? 6 : 0))
return;
if (!ignoreright && exclusive_input_pressed(IPT_UI_RIGHT, (flags & UI_MENU_PROCESS_LR_REPEAT) ? 6 : 0))
return;
- // up backs up by one item
+ // up backs up by one item
if (exclusive_input_pressed(IPT_UI_UP, 6))
{
selected = (selected + numitems - 1) % numitems;
validate_selection(-1);
}
- // down advances by one item
+ // down advances by one item
if (exclusive_input_pressed(IPT_UI_DOWN, 6))
{
selected = (selected + 1) % numitems;
validate_selection(1);
}
- // page up backs up by visitems
+ // page up backs up by visitems
if (exclusive_input_pressed(IPT_UI_PAGE_UP, 6))
{
selected -= visitems - 1;
validate_selection(1);
}
- // page down advances by visitems
+ // page down advances by visitems
if (exclusive_input_pressed(IPT_UI_PAGE_DOWN, 6))
{
selected += visitems - 1;
validate_selection(-1);
}
- // home goes to the start
+ // home goes to the start
if (exclusive_input_pressed(IPT_UI_HOME, 0))
{
selected = 0;
validate_selection(1);
}
- // end goes to the last
+ // end goes to the last
if (exclusive_input_pressed(IPT_UI_END, 0))
{
selected = numitems - 1;
validate_selection(-1);
}
- // pause enables/disables pause
+ // pause enables/disables pause
if (!ignorepause && exclusive_input_pressed(IPT_UI_PAUSE, 0))
{
if (machine().paused())
@@ -903,11 +903,11 @@ void ui_menu::handle_keys(UINT32 flags)
machine().pause();
}
- // handle a toggle cheats request
+ // handle a toggle cheats request
if (ui_input_pressed_repeat(machine(), IPT_UI_TOGGLE_CHEAT, 0))
machine().cheat().set_enable(!machine().cheat().enabled());
- // see if any other UI keys are pressed
+ // see if any other UI keys are pressed
if (menu_event.iptkey == IPT_INVALID)
for (code = IPT_UI_FIRST + 1; code < IPT_UI_LAST; code++)
{
@@ -927,13 +927,13 @@ void ui_menu::handle_keys(UINT32 flags)
void ui_menu::validate_selection(int scandir)
{
- // clamp to be in range
+ // clamp to be in range
if (selected < 0)
selected = 0;
else if (selected >= numitems)
selected = numitems - 1;
- // skip past unselectable items
+ // skip past unselectable items
while (!item[selected].is_selectable())
selected = (selected + numitems + scandir) % numitems;
}
@@ -1038,18 +1038,18 @@ void ui_menu::do_handle()
UINT32 ui_menu::ui_handler(running_machine &machine, render_container *container, UINT32 state)
{
- // if we have no menus stacked up, start with the main menu
+ // if we have no menus stacked up, start with the main menu
if (menu_stack == NULL)
stack_push(auto_alloc_clear(machine, ui_menu_main(machine, container)));
- // update the menu state
+ // update the menu state
if (menu_stack != NULL)
menu_stack->do_handle();
- // clear up anything pending to be released
+ // clear up anything pending to be released
clear_free_list(machine);
- // if the menus are to be hidden, return a cancel here
+ // if the menus are to be hidden, return a cancel here
if (machine.ui().is_menu_active() && ((ui_input_pressed(machine, IPT_UI_CONFIGURE) && !stack_has_special_main_menu()) || menu_stack == NULL))
return UI_HANDLER_CANCEL;
@@ -1072,16 +1072,16 @@ void ui_menu::render_triangle(bitmap_argb32 &dest, bitmap_argb32 &source, const
int height = dest.height();
int x, y;
- // start with all-transparent
+ // start with all-transparent
dest.fill(rgb_t(0x00,0x00,0x00,0x00));
- // render from the tip to the bottom
+ // render from the tip to the bottom
for (y = 0; y < height; y++)
{
int linewidth = (y * (halfwidth - 1) + (height / 2)) * 255 * 2 / height;
UINT32 *target = &dest.pix32(y, halfwidth);
- // don't antialias if height < 12
+ // don't antialias if height < 12
if (dest.height() < 12)
{
int pixels = (linewidth + 254) / 255;
@@ -1089,19 +1089,19 @@ void ui_menu::render_triangle(bitmap_argb32 &dest, bitmap_argb32 &source, const
linewidth = pixels * 255;
}
- // loop while we still have data to generate
+ // loop while we still have data to generate
for (x = 0; linewidth > 0; x++)
{
int dalpha;
- // first column we only consume one pixel
+ // first column we only consume one pixel
if (x == 0)
{
dalpha = MIN(0xff, linewidth);
target[x] = rgb_t(dalpha,0xff,0xff,0xff);
}
- // remaining columns consume two pixels, one on each side
+ // remaining columns consume two pixels, one on each side
else
{
dalpha = MIN(0x1fe, linewidth);