From: Ingo Ruhnke Date: Mon, 5 May 2008 20:08:41 +0000 (+0000) Subject: Added scrolling to the menu (a little crude, but working) X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=9fb7f9c2578417b2cc2491a731f4dcc2bf02ec8f;p=supertux.git Added scrolling to the menu (a little crude, but working) SVN-Revision: 5420 --- diff --git a/data/images/engine/menu/frame.png b/data/images/engine/menu/frame.png index 9eede6f7c..0bf5113cb 100644 Binary files a/data/images/engine/menu/frame.png and b/data/images/engine/menu/frame.png differ diff --git a/src/gui/menu.cpp b/src/gui/menu.cpp index ce8ff6323..7768934e4 100644 --- a/src/gui/menu.cpp +++ b/src/gui/menu.cpp @@ -342,6 +342,13 @@ Menu::clear() void Menu::update() { + int menu_height = get_height(); + if (menu_height > SCREEN_HEIGHT) + { // Scrolling + int scroll_offset = (menu_height - SCREEN_HEIGHT) / 2 + 32; + pos_y = SCREEN_HEIGHT/2 - scroll_offset * ((float(active_item) / (items.size()-1)) - 0.5f) * 2.0f; + } + effect_progress = (real_time - effect_start_time) * 6.0f; if(effect_progress >= 1.0f) {