extern SDL_Surface* screen;
std::vector<Menu*> Menu::last_menus;
+std::list<Menu*> Menu::all_menus;
Menu* Menu::current_ = 0;
Menu* Menu::previous = 0;
Font* Menu::default_font;
if (current_)
current_->set_pos(SCREEN_WIDTH/2, SCREEN_HEIGHT/2);
- for(std::vector<Menu*>::iterator i = last_menus.begin(); i != last_menus.end(); ++i)
+ for(std::list<Menu*>::iterator i = all_menus.begin(); i != all_menus.end(); ++i)
{
// FIXME: This is of course not quite right, since it ignores any previous set_pos() calls
(*i)->set_pos(SCREEN_WIDTH/2, SCREEN_HEIGHT/2);
\f
Menu::~Menu()
{
+ all_menus.remove(this);
+
for(std::vector<MenuItem*>::iterator i = items.begin();
i != items.end(); ++i)
delete *i;
Menu::Menu()
{
+ all_menus.push_back(this);
+
hit_item = -1;
menuaction = MENU_ACTION_NONE;
delete_character = 0;
#define SUPERTUX_MENU_H
#include <vector>
+#include <list>
#include <memory>
#include <set>
#include <string>
{
private:
static std::vector<Menu*> last_menus;
+
+ /** Pointers to all currently available menus, used to handle repositioning on window resize */
+ static std::list<Menu*> all_menus;
+
static Menu* previous;
static Menu* current_;