[Super-tux-commit] supertux/lib/video font.cpp,1.17,1.18
Brought to you by:
wkendrick
From: Matze B. <mat...@us...> - 2004-12-05 16:57:52
|
Update of /cvsroot/super-tux/supertux/lib/video In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16796/lib/video Modified Files: font.cpp Log Message: -Incorporated Marcin KoÅcielnicki patch that reintroduces the flying snowball, thanks -Changed worldmapfile format to support intro texts -Moved intro.txt extro.txt and extro-bonus.txt to levels/world1 and levels/bonus1 -Added a new text mode to the textfile system display that aligns the text at the left side. This is alot easier to read than all text centered. Still the current font is hard to read for long texts and should be improved/replaced somehow... -Use new translation system in the .txt files Index: font.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/lib/video/font.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- font.cpp 2 Dec 2004 00:25:27 -0000 1.17 +++ font.cpp 5 Dec 2004 16:57:12 -0000 1.18 @@ -260,6 +260,7 @@ int done = 0; float scroll = 0; float speed = scroll_speed / 50; + float left_border = 50; DrawingContext context; SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); @@ -316,18 +317,32 @@ } Font* font = 0; + bool center = true; switch(names[i][0]) { case ' ': font = small_font; break; case '\t': font = normal_font; break; case '-': font = heading_font; break; case '*': font = reference_font; break; - default: font = reference_font; break; + case '#': font = normal_font; center = false; break; + default: + break; } - - context.draw_text(font, - names[i].substr(1, names[i].size()-1), - Vector(screen->w/2, screen->h + y - scroll), CENTER_ALLIGN, LAYER_FOREGROUND1); + + if(font) { + if(center) { + context.draw_text(font, + names[i].substr(1, names[i].size()-1), + Vector(screen->w/2, screen->h + y - scroll), + CENTER_ALLIGN, LAYER_FOREGROUND1); + } else { + context.draw_text(font, + names[i].substr(1, names[i].size()-1), + Vector(left_border, screen->h + y - scroll), + LEFT_ALLIGN, LAYER_FOREGROUND1); + } + } + y += font->get_height() + ITEMS_SPACE; } |