summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2010-10-24 21:06:19 +0000
committer Aaron Giles <aaron@aarongiles.com>2010-10-24 21:06:19 +0000
commit1eb4b235852394d37ad1ddbd88d2de09e479b91a (patch)
tree0a7751aa62b6db2db5058b5fd85fc198bd8738e2
parent504cee4992358b8408c224cef6a6d67f1cf609af (diff)
Fix for previous fix.
-rw-r--r--src/emu/ui.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/emu/ui.c b/src/emu/ui.c
index 7eb1fff1664..e99b1d3bb1f 100644
--- a/src/emu/ui.c
+++ b/src/emu/ui.c
@@ -723,12 +723,13 @@ void ui_draw_text_full(render_container *container, const char *origs, float x,
void ui_draw_text_box(render_container *container, const char *text, int justify, float xpos, float ypos, rgb_t backcolor)
{
float line_height = ui_get_line_height(container->manager().machine());
- float target_width = 2.0f - ((xpos <= 0.5f) ? xpos : 1.0f - xpos) - 2.0f * UI_BOX_LR_BORDER;
+ float max_width = 2.0f * ((xpos <= 0.5f) ? xpos : 1.0f - xpos) - 2.0f * UI_BOX_LR_BORDER;
+ float target_width = max_width;
float target_height = line_height;
float target_x, target_y;
float last_target_height = 0;
- do
+ while (1)
{
/* determine the target location */
target_x = xpos - 0.5f * target_width;
@@ -745,20 +746,23 @@ void ui_draw_text_box(render_container *container, const char *text, int justify
target_y = 1.0f - UI_BOX_TB_BORDER - target_height;
/* compute the multi-line target width/height */
- last_target_height = target_height;
- ui_draw_text_full(container, text, target_x, target_y, target_width + 0.00001,
+ ui_draw_text_full(container, text, target_x, target_y, target_width + 0.00001f,
justify, WRAP_WORD, DRAW_NONE, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, &target_width, &target_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;
- } while (target_height != last_target_height);
+ /* if we match our last value, we're done */
+ if (target_height == last_target_height)
+ break;
+ last_target_height = target_height;
+ }
/* add a box around that */
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,
target_y + target_height + UI_BOX_TB_BORDER, backcolor);
- ui_draw_text_full(container, text, target_x, target_y, target_width + 0.00001,
+ ui_draw_text_full(container, text, target_x, target_y, target_width + 0.00001f,
justify, WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, NULL, NULL);
}