-
- context.do_drawing();
-
- if(screen->h+y-scroll < 0 && 20+screen->h+y-scroll < 0)
- done = 1;
-
- Uint32 ticks = SDL_GetTicks();
- scroll += speed * (ticks - lastticks);
- lastticks = ticks;
- if(scroll < 0)
- scroll = 0;
-
- SDL_Delay(10);
+
+ const Font* font = 0;
+ bool center = true;
+ switch(line[0])
+ {
+ case ' ': font = small_font; break;
+ case '\t': font = normal_font; break;
+ case '-': font = heading_font; break;
+ case '*': font = reference_font; break;
+ case '#': font = normal_font; center = false; break;
+ default:
+ std::cerr << "Warning: text contains an unformated line.\n";
+ font = normal_font;
+ center = false;
+ break;
+ }
+
+ if(center) {
+ context.draw_text(font,
+ line.substr(1, line.size()-1),
+ Vector(SCREEN_WIDTH/2, SCREEN_HEIGHT + y - scroll),
+ CENTER_ALLIGN, LAYER_FOREGROUND1);
+ } else {
+ context.draw_text(font,
+ line.substr(1, line.size()-1),
+ Vector(left_border, SCREEN_HEIGHT + y - scroll),
+ LEFT_ALLIGN, LAYER_FOREGROUND1);
+ }
+
+ y += font->get_height() + ITEMS_SPACE;