From: Ricardo Cruz Date: Wed, 21 Apr 2004 15:45:39 +0000 (+0000) Subject: Display key number on the key selection: X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=8abc459ad51b575e93659b9d40aadabcb597c71f;p=supertux.git Display key number on the key selection: This is not obvious to the user, we have to get a way to translate it into human readable strings... SVN-Revision: 612 --- diff --git a/src/menu.cpp b/src/menu.cpp index 53a339833..1cfb5a0f4 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -443,7 +443,6 @@ Menu::draw_item(int index, // Position of the current item in the menu } case MN_TEXTFIELD: case MN_NUMFIELD: - case MN_CONTROLFIELD: { int input_pos = input_width/2; int text_pos = (text_width + font_width)/2; @@ -464,6 +463,32 @@ Menu::draw_item(int index, // Position of the current item in the menu A_HMIDDLE, A_VMIDDLE, shadow_size); break; } + case MN_CONTROLFIELD: + { + /* display key */ // FIXME: the key number is not that obvious to the user :P + char str[12]; + sprintf(str, "%i", *pitem.int_p); + input_width = strlen(str) * font_width; + + int input_pos = input_width/2; + int text_pos = (text_width + font_width)/2; + + fillrect(x_pos - input_pos + text_pos - 1, y_pos - 10, + input_width + font_width + 2, 20, + 255,255,255,255); + fillrect(x_pos - input_pos + text_pos, y_pos - 9, + input_width + font_width, 18, + 0,0,0,128); + + gold_text->draw_align(str, + x_pos + text_pos, y_pos, + A_HMIDDLE, A_VMIDDLE, 2); + + text_font->draw_align(pitem.text, + x_pos - (input_width + font_width)/2, y_pos, + A_HMIDDLE, A_VMIDDLE, shadow_size); + break; + } case MN_STRINGSELECT: { int list_pos_2 = list_width + font_width;