X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fsupertux%2Ftextscroller.cpp;h=9820891879fe99fbe9ad7dd22231d0e8072376ea;hb=aa9dd770ebf02361a846acfaef136864b82b92ce;hp=f5e7863a28ef48001bc5b42b4fc62a10190dd742;hpb=fdd4409cae442e2ccf092da87f4b7c6e0a6d7382;p=supertux.git diff --git a/src/supertux/textscroller.cpp b/src/supertux/textscroller.cpp index f5e7863a2..982089187 100644 --- a/src/supertux/textscroller.cpp +++ b/src/supertux/textscroller.cpp @@ -81,19 +81,19 @@ TextScroller::TextScroller(const std::string& filename) : TextScroller::~TextScroller() { - for(std::vector::iterator i = lines.begin(); i != lines.end(); i++) delete *i; + for(std::vector::iterator i = lines.begin(); i != lines.end(); ++i) delete *i; } void TextScroller::setup() { - sound_manager->play_music(music); + SoundManager::current()->play_music(music); } void TextScroller::update(float elapsed_time) { - Controller *controller = g_input_manager->get_controller(); + Controller* controller = InputManager::current()->get_controller(); if(controller->hold(Controller::UP)) { speed = -defaultspeed*5; } else if(controller->hold(Controller::DOWN)) { @@ -106,8 +106,9 @@ TextScroller::update(float elapsed_time) || controller->pressed(Controller::MENU_SELECT) )&& !(controller->pressed(Controller::UP))) // prevent skipping if jump with up is enabled scroll += SCROLL; - if(controller->pressed(Controller::PAUSE_MENU)) { - g_screen_manager->exit_screen(new FadeOut(0.5)); + if(controller->pressed(Controller::START) || + controller->pressed(Controller::ESCAPE)) { + ScreenManager::current()->pop_screen(std::unique_ptr(new FadeOut(0.5))); } scroll += speed * elapsed_time; @@ -121,7 +122,9 @@ TextScroller::draw(DrawingContext& context) { context.draw_filled_rect(Vector(0, 0), Vector(SCREEN_WIDTH, SCREEN_HEIGHT), Color(0.6f, 0.7f, 0.8f, 0.5f), 0); - context.draw_surface(background, Vector(SCREEN_WIDTH/2 - background->get_width()/2 , SCREEN_HEIGHT/2 - background->get_height()/2), 0); + context.draw_surface_part(background, Rectf(0, 0, background->get_width(), background->get_height()), + Rectf(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 0); + float y = SCREEN_HEIGHT - scroll; for(size_t i = 0; i < lines.size(); i++) { @@ -134,7 +137,7 @@ TextScroller::draw(DrawingContext& context) if(y < 0 && !fading ) { fading = true; - g_screen_manager->exit_screen(new FadeOut(0.5)); + ScreenManager::current()->pop_screen(std::unique_ptr(new FadeOut(0.5))); } }