aboutsummaryrefslogtreecommitdiffstats
path: root/src/menu
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2011-12-25 20:56:32 +0100
committerAlexander Sulfrian <alexander@sulfrian.net>2013-01-05 17:17:50 +0100
commit71f32f9c7bcedb5f44fcd80587252a8148aab758 (patch)
treeb2021106213eea437a74268ac6d0630a74e53d6a /src/menu
parent08241dfab34a37fb94707311def70d1ccaac702d (diff)
downloadusdx-71f32f9c7bcedb5f44fcd80587252a8148aab758.tar.gz
usdx-71f32f9c7bcedb5f44fcd80587252a8148aab758.tar.xz
usdx-71f32f9c7bcedb5f44fcd80587252a8148aab758.zip
menu/application: Application now is also a container for the overlays
Diffstat (limited to 'src/menu')
-rw-r--r--src/menu/application.cpp23
-rw-r--r--src/menu/application.hpp7
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<DrawableControl*>::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<DrawableControl*>::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 <log4cpp/Category.hh>
#include <list>
-#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<DrawableControl*> 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);
};
};