#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;
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);
}
context.draw_surface(background, Vector(0,0), LAYER_BACKGROUND0);
dialog->draw(context);
- dialog->action();
+ dialog->update();
switch (dialog->check())
{
/* Process actions done on the menu */
void
-Menu::action()
+Menu::update()
{
/** check main input controller... */
Uint32 ticks = SDL_GetTicks();
case MN_TEXTFIELD:
case MN_NUMFIELD:
menuaction = MENU_ACTION_DOWN;
- action();
+ update();
break;
case MN_BACK:
void
Menu::draw(DrawingContext& context)
{
+ if(MouseCursor::current()) {
+ MouseCursor::current()->draw(context);
+ }
+
int menu_height = get_height();
int menu_width = get_width();