fix miniswig using wrong stack numbers in functions with HSQUIRRELVM arguments
[supertux.git] / src / gui / menu.cpp
index d70b16a..37d74c6 100644 (file)
 #include <cassert>
 #include <stdexcept>
 
-#include "menu.h"
-#include "video/screen.h"
-#include "video/drawing_context.h"
-#include "gettext.h"
-#include "math/vector.h"
-#include "main.h"
-#include "resources.h"
-#include "control/joystickkeyboardcontroller.h"
+#include "menu.hpp"
+#include "video/screen.hpp"
+#include "video/drawing_context.hpp"
+#include "gettext.hpp"
+#include "math/vector.hpp"
+#include "main.hpp"
+#include "resources.hpp"
+#include "control/joystickkeyboardcontroller.hpp"
 
 static const int MENU_REPEAT_INITIAL = 400;
 static const int MENU_REPEAT_RATE = 200;
@@ -76,11 +76,10 @@ bool confirm_dialog(Surface *background, std::string text)
   while(true)
     {
       SDL_Event event;
-
-      if(event.type == SDL_QUIT)
-        throw std::runtime_error("received window close event");
-      
       while (SDL_PollEvent(&event)) {
+        if(event.type == SDL_QUIT)
+          throw std::runtime_error("received window close event");
+        main_controller->process_event(event);
         dialog->event(event);
       }
 
@@ -90,7 +89,7 @@ bool confirm_dialog(Surface *background, std::string text)
         context.draw_surface(background, Vector(0,0), LAYER_BACKGROUND0);
 
       dialog->draw(context);
-      dialog->action();
+      dialog->update();
 
       switch (dialog->check())
         {
@@ -315,7 +314,7 @@ Menu::clear()
 
 /* Process actions done on the menu */
 void
-Menu::action()
+Menu::update()
 {
   /** check main input controller... */
   Uint32 ticks = SDL_GetTicks();
@@ -420,7 +419,7 @@ Menu::action()
         case MN_TEXTFIELD:
         case MN_NUMFIELD:
           menuaction = MENU_ACTION_DOWN;
-          action();
+          update();
           break;
           
         case MN_BACK:
@@ -691,6 +690,10 @@ int Menu::get_height() const
 void
 Menu::draw(DrawingContext& context)
 {
+  if(MouseCursor::current()) {
+    MouseCursor::current()->draw(context);
+  }
+  
   int menu_height = get_height();
   int menu_width = get_width();