X-Git-Url: https://git.octo.it/?a=blobdiff_plain;ds=sidebyside;f=src%2Fgui%2Fmenu_manager.hpp;h=2be698318bfcac89d40aaf263655cb550c2643dd;hb=d27bb6ddfcb9911da9058430497b72a0386b1225;hp=85ba2ec00d797badbff396064d557d893a6fef47;hpb=955f4af66a1e3a9c7c839417dd19ca2af41b3793;p=supertux.git diff --git a/src/gui/menu_manager.hpp b/src/gui/menu_manager.hpp index 85ba2ec00..2be698318 100644 --- a/src/gui/menu_manager.hpp +++ b/src/gui/menu_manager.hpp @@ -1,5 +1,5 @@ // SuperTux -// Copyright (C) 2009 Ingo Ruhnke +// Copyright (C) 2009 Ingo Ruhnke // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -17,12 +17,16 @@ #ifndef HEADER_SUPERTUX_GUI_MENU_MANAGER_HPP #define HEADER_SUPERTUX_GUI_MENU_MANAGER_HPP -#include #include #include +#include -class Menu; +#include "SDL.h" + +class Dialog; class DrawingContext; +class Menu; +class MenuTransition; class MenuManager { @@ -31,52 +35,42 @@ private: public: static MenuManager& instance(); -public: - std::vector > m_menu_stack; - - bool close; - float effect_progress; - float effect_start_time; +private: + std::unique_ptr m_dialog; + bool m_has_next_dialog; + std::unique_ptr m_next_dialog; - friend class Menu; + std::vector > m_menu_stack; + std::unique_ptr m_transition; public: MenuManager(); ~MenuManager(); + void event(const SDL_Event& event); + void process_input(); + void refresh(); + void draw(DrawingContext& context); - bool check_menu(); - void set_menu(int id); - void clear_menu_stack(); + void set_dialog(std::unique_ptr dialog); - void push_menu(std::unique_ptr menu); + void set_menu(int id); + void set_menu(std::unique_ptr menu); void push_menu(int id); + void push_menu(std::unique_ptr menu); void pop_menu(); + void clear_menu_stack(); - void recalc_pos(); - - /** Return the current active menu or NULL if none is active */ - Menu* current() const - { - if (m_menu_stack.empty()) - { - return nullptr; - } - else - { - return m_menu_stack.back().get(); - } - } - + void on_window_resize(); bool is_active() const { return !m_menu_stack.empty(); } private: - /** Set the current menu, if pmenu is NULL, hide the current menu */ - void set_menu(std::unique_ptr menu); + Menu* current_menu() const; + void transition(Menu* from, Menu* to); private: MenuManager(const MenuManager&);