From 71f32f9c7bcedb5f44fcd80587252a8148aab758 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Sun, 25 Dec 2011 20:56:32 +0100 Subject: menu/application: Application now is also a container for the overlays --- src/menu/application.cpp | 23 ++++------------------- src/menu/application.hpp | 7 +------ 2 files changed, 5 insertions(+), 25 deletions(-) diff --git a/src/menu/application.cpp b/src/menu/application.cpp index 9e790b15..80fded75 100644 --- a/src/menu/application.cpp +++ b/src/menu/application.cpp @@ -40,7 +40,7 @@ namespace usdx Application* Application::instance = NULL; Application::Application(Container* parent) - : DrawableControl(parent), display(NULL), frame(NULL), + : Container(parent), display(NULL), frame(NULL), fps_manager(NULL), running(false), display_width(800), display_height(600), frames_per_second(50) { @@ -50,13 +50,6 @@ namespace usdx Application::~Application() { - for (std::list::iterator it = - overlays.begin(); it != overlays.end(); it++) { - delete *it; - } - - overlays.clear(); - if (fps_manager) { delete fps_manager; fps_manager = NULL; @@ -82,17 +75,8 @@ namespace usdx if (frame) { frame->repaint(); } - } - void Application::repaint(void) { - DrawableControl::repaint(); - - for (std::list::const_iterator it = - overlays.begin(); - it != overlays.end(); it++) { - - (*it)->repaint(); - } + Container::draw(); } const Frame *Application::get_current_frame(void) const @@ -110,7 +94,8 @@ namespace usdx SDL_Event event; EventManager event_manager; boost::thread event_thread(boost::bind(&EventManager::handle_events, &event_manager)); - overlays.push_front(new SoftwareMousePointer(NULL, &event_manager)); + DrawableControl *p = new SoftwareMousePointer(this, &event_manager); + p->repaint(); LoadingFrame frame; set_current_frame(&frame); diff --git a/src/menu/application.hpp b/src/menu/application.hpp index 76b451f0..efd99533 100644 --- a/src/menu/application.hpp +++ b/src/menu/application.hpp @@ -32,13 +32,12 @@ #include #include -#include "drawable_control.hpp" #include "container.hpp" #include "frame.hpp" namespace usdx { - class Application : public DrawableControl + class Application : public Container { private: static log4cpp::Category& log; @@ -55,8 +54,6 @@ namespace usdx int frames_per_second; - std::list overlays; - /** * This is the main loop. */ @@ -84,8 +81,6 @@ namespace usdx const int get_frames_per_second(void) const; void set_frames_per_second(int fps); - - void repaint(void); }; }; -- cgit v1.2.3