Thread: [Super-tux-commit] supertux/lib/gui button.cpp,1.5,1.6 menu.cpp,1.13,1.14
Brought to you by:
wkendrick
From: Ricardo C. <rm...@us...> - 2004-09-16 15:04:25
|
Update of /cvsroot/super-tux/supertux/lib/gui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18913/lib/gui Modified Files: button.cpp menu.cpp Log Message: Changed behavior of centered text drawing and added right allignment, as well. Added a new allignment argument for draw_text(). draw_text_center() is draw_text() with CENTER_ALLIGN in point Vector(screen->w/2, ...). Index: menu.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/gui/menu.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- menu.cpp 8 Sep 2004 17:32:32 -0000 1.13 +++ menu.cpp 16 Sep 2004 15:04:16 -0000 1.14 @@ -531,9 +531,9 @@ { case MN_DEACTIVE: { - context.draw_text_center(deactive_font, pitem.text, - Vector(0, y_pos - int(deactive_font->get_height()/2)), - LAYER_GUI); + context.draw_text(deactive_font, pitem.text, + Vector(screen->w/2, y_pos - int(deactive_font->get_height()/2)), + CENTER_ALLIGN, LAYER_GUI); break; } @@ -551,9 +551,9 @@ } case MN_LABEL: { - context.draw_text_center(label_font, - pitem.text, Vector(0, y_pos - int(label_font->get_height()/2)), - LAYER_GUI); + context.draw_text(label_font, pitem.text, + Vector(screen->w/2, y_pos - int(label_font->get_height()/2)), + CENTER_ALLIGN, LAYER_GUI); break; } case MN_TEXTFIELD: @@ -585,21 +585,21 @@ context.draw_text(field_font, pitem.get_input_with_symbol(true), Vector(input_pos, y_pos - int(field_font->get_height()/2)), - LAYER_GUI); + LEFT_ALLIGN, LAYER_GUI); else context.draw_text(field_font, pitem.get_input_with_symbol(false), Vector(input_pos, y_pos - int(field_font->get_height()/2)), - LAYER_GUI); + LEFT_ALLIGN, LAYER_GUI); } else context.draw_text(field_font, pitem.input, Vector(input_pos, y_pos - int(field_font->get_height()/2)), - LAYER_GUI); + LEFT_ALLIGN, LAYER_GUI); context.draw_text(text_font, pitem.text, Vector(text_pos, y_pos - int(text_font->get_height()/2)), - LAYER_GUI); + LEFT_ALLIGN, LAYER_GUI); break; } case MN_STRINGSELECT: @@ -626,19 +626,19 @@ Vector(list_pos_2, 18), Color(0,0,0,128), LAYER_GUI - 5); - context.draw_text_center(text_font, (*pitem.list.second), - Vector(text_pos, y_pos - int(text_font->get_height()/2)), - LAYER_GUI); - context.draw_text_center(text_font, pitem.text, - Vector(list_pos_2/2, y_pos - int(text_font->get_height()/2)), - LAYER_GUI); + context.draw_text(text_font, (*pitem.list.second), + Vector(screen->w/2 + text_pos, y_pos - int(text_font->get_height()/2)), + CENTER_ALLIGN, LAYER_GUI); + context.draw_text(text_font, pitem.text, + Vector(screen->w/2 + list_pos_2/2, y_pos - int(text_font->get_height()/2)), + CENTER_ALLIGN, LAYER_GUI); break; } case MN_BACK: { - context.draw_text_center(text_font, pitem.text, - Vector(0, y_pos - int(text_font->get_height()/2)), - LAYER_GUI); + context.draw_text(text_font, pitem.text, + Vector(screen->w/2, y_pos - int(text_font->get_height()/2)), + CENTER_ALLIGN, LAYER_GUI); context.draw_surface(back, Vector(x_pos + text_width/2 + 16, y_pos - 8), LAYER_GUI); @@ -647,9 +647,9 @@ case MN_TOGGLE: { - context.draw_text_center(text_font, pitem.text, - Vector(0, y_pos - (text_font->get_height()/2)), - LAYER_GUI); + context.draw_text(text_font, pitem.text, + Vector(screen->w/2, y_pos - (text_font->get_height()/2)), + CENTER_ALLIGN, LAYER_GUI); if(pitem.toggled) context.draw_surface(checkbox_checked, @@ -662,15 +662,15 @@ break; } case MN_ACTION: - context.draw_text_center(text_font, pitem.text, - Vector(0, y_pos - int(text_font->get_height()/2)), - LAYER_GUI); + context.draw_text(text_font, pitem.text, + Vector(screen->w/2, y_pos - int(text_font->get_height()/2)), + CENTER_ALLIGN, LAYER_GUI); break; case MN_GOTO: - context.draw_text_center(text_font, pitem.text, - Vector(0, y_pos - int(text_font->get_height()/2)), - LAYER_GUI); + context.draw_text(text_font, pitem.text, + Vector(screen->w/2, y_pos - int(text_font->get_height()/2)), + CENTER_ALLIGN, LAYER_GUI); break; } } Index: button.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/gui/button.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- button.cpp 26 Jul 2004 15:48:37 -0000 1.5 +++ button.cpp 16 Sep 2004 15:04:15 -0000 1.6 @@ -126,9 +126,9 @@ i = rect.w + (int)info_font->get_text_width(info); if(!info.empty()) - context.draw_text(info_font, info, Vector(i + rect.x - info_font->get_text_width(info), rect.y), LAYER_GUI); + context.draw_text(info_font, info, Vector(i + rect.x - info_font->get_text_width(info), rect.y), LEFT_ALLIGN, LAYER_GUI); sprintf(str,"(%s)", SDL_GetKeyName(shortcut)); - context.draw_text(info_font, str, Vector(i + rect.x - info_font->get_text_width(str), rect.y + info_font->get_height()+2), LAYER_GUI); + context.draw_text(info_font, str, Vector(i + rect.x - info_font->get_text_width(str), rect.y + info_font->get_height()+2), LEFT_ALLIGN, LAYER_GUI); } if(state == BUTTON_PRESSED || state == BUTTON_DEACTIVE) fillrect(rect.x,rect.y,rect.w,rect.h,75,75,75,200); |