From 1a8b5160d105b50f20cb3cc24443b1f41ac6c1af Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Sun, 25 Apr 2010 18:10:15 +0200 Subject: added SDL_Surface* display to all repaint/draw methods --- src/menu/container.cpp | 6 +++--- src/menu/container.hpp | 6 ++++-- src/menu/drawable.cpp | 5 ++--- src/menu/drawable.hpp | 6 ++++-- src/menu/drawable_control.hpp | 4 +++- src/menu/frame.cpp | 4 ++-- src/menu/frame.hpp | 4 +++- src/menu/frame_background.hpp | 2 +- src/menu/frame_background_color.cpp | 2 +- src/menu/frame_background_color.hpp | 4 +++- 10 files changed, 26 insertions(+), 17 deletions(-) (limited to 'src/menu') diff --git a/src/menu/container.cpp b/src/menu/container.cpp index 467e5aa5..edcd5e10 100644 --- a/src/menu/container.cpp +++ b/src/menu/container.cpp @@ -43,16 +43,16 @@ namespace usdx controls.clear(); } - void Container::repaint(void) const + void Container::repaint(SDL_Surface* display) const { if (get_visible()) { - draw(); + draw(display); for (std::list::const_iterator it = controls.begin(); it != controls.end(); it++) { - (*it)->repaint(); + (*it)->repaint(display); } } } diff --git a/src/menu/container.hpp b/src/menu/container.hpp index 271a4f67..8ba9466c 100644 --- a/src/menu/container.hpp +++ b/src/menu/container.hpp @@ -27,9 +27,11 @@ #ifndef CONTAINER_HPP #define CONTAINER_HPP -#include "drawable_control.hpp" +#include #include +#include "drawable_control.hpp" + namespace usdx { class Container : public DrawableControl @@ -44,7 +46,7 @@ namespace usdx /** * Method for redraw all contained objects. */ - void repaint(void) const; + void repaint(SDL_Surface* display) const; }; }; diff --git a/src/menu/drawable.cpp b/src/menu/drawable.cpp index 5f744e62..0c68affc 100644 --- a/src/menu/drawable.cpp +++ b/src/menu/drawable.cpp @@ -32,17 +32,16 @@ namespace usdx { } - void Drawable::repaint(void) const + void Drawable::repaint(SDL_Surface* display) const { if (visible) { - draw(); + draw(display); } }; void Drawable::set_visible(bool value) { visible = value; - draw(); } const bool Drawable::get_visible(void) const diff --git a/src/menu/drawable.hpp b/src/menu/drawable.hpp index e2cc43fc..28cbd223 100644 --- a/src/menu/drawable.hpp +++ b/src/menu/drawable.hpp @@ -27,6 +27,8 @@ #ifndef DRAWABLE_HPP #define DRAWABLE_HPP +#include + namespace usdx { /** @@ -41,7 +43,7 @@ namespace usdx /** * Pure virtual method, that descendant classes have to implement. */ - virtual void draw(void) const = 0; + virtual void draw(SDL_Surface* display) const = 0; public: Drawable(void); @@ -50,7 +52,7 @@ namespace usdx /** * Method for redraw this Object. If visible issues draw. */ - void repaint(void) const; + void repaint(SDL_Surface* display) const; /** * Setter for visible. diff --git a/src/menu/drawable_control.hpp b/src/menu/drawable_control.hpp index 60701f4b..bf7ff42b 100644 --- a/src/menu/drawable_control.hpp +++ b/src/menu/drawable_control.hpp @@ -27,6 +27,8 @@ #ifndef DRAWABLE_CONTROL_HPP #define DRAWABLE_CONTROL_HPP +#include + #include "drawable.hpp" #include "control.hpp" @@ -39,7 +41,7 @@ namespace usdx * Pure virtual method, that descendant classes have to * implement. (Should be left pure virtual.) */ - virtual void draw(void) const = 0; + virtual void draw(SDL_Surface* display) const = 0; public: DrawableControl(Control* parent); diff --git a/src/menu/frame.cpp b/src/menu/frame.cpp index 665a2627..228df767 100644 --- a/src/menu/frame.cpp +++ b/src/menu/frame.cpp @@ -56,8 +56,8 @@ namespace usdx return background; } - void Frame::draw(void) const + void Frame::draw(SDL_Surface* display) const { - background->repaint(); + background->repaint(display); } }; diff --git a/src/menu/frame.hpp b/src/menu/frame.hpp index e71bef9b..b337275c 100644 --- a/src/menu/frame.hpp +++ b/src/menu/frame.hpp @@ -27,6 +27,8 @@ #ifndef FRAME_HPP #define FRAME_HPP +#include + #include "container.hpp" #include "frame_background.hpp" @@ -38,7 +40,7 @@ namespace usdx FrameBackground* background; protected: - virtual void draw(void) const; + virtual void draw(SDL_Surface* display) const; public: Frame(Control* parent); diff --git a/src/menu/frame_background.hpp b/src/menu/frame_background.hpp index e815094a..a8e7daea 100644 --- a/src/menu/frame_background.hpp +++ b/src/menu/frame_background.hpp @@ -51,7 +51,7 @@ namespace usdx FrameBackground(const FrameBackground&); FrameBackground& operator=(const FrameBackground&); - virtual void draw(void) = 0; + virtual void draw(SDL_Surface* display) = 0; }; }; diff --git a/src/menu/frame_background_color.cpp b/src/menu/frame_background_color.cpp index 3c3adfd8..4f37b184 100644 --- a/src/menu/frame_background_color.cpp +++ b/src/menu/frame_background_color.cpp @@ -33,7 +33,7 @@ namespace usdx { } - void FrameBackgroundColor::draw(void) const + void FrameBackgroundColor::draw(SDL_Surface* display) const { glClearColor(color.get_red(), color.get_green(), color.get_blue(), 0); glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); diff --git a/src/menu/frame_background_color.hpp b/src/menu/frame_background_color.hpp index d1fdcc17..a52e1f13 100644 --- a/src/menu/frame_background_color.hpp +++ b/src/menu/frame_background_color.hpp @@ -27,6 +27,8 @@ #ifndef FRAME_BACKGROUND_COLOR_HPP #define FRAME_BACKGROUND_COLOR_HPP +#include + #include "frame_background.hpp" #include "utils/rgb_color.hpp" @@ -38,7 +40,7 @@ namespace usdx RgbColor color; protected: - virtual void draw(void) const; + virtual void draw(SDL_Surface* display) const; public: FrameBackgroundColor(RgbColor &color); -- cgit v1.2.3