aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/menu/container.cpp58
-rw-r--r--src/menu/container.hpp53
-rw-r--r--src/menu/control.cpp38
-rw-r--r--src/menu/control.hpp40
-rw-r--r--src/menu/drawable.cpp4
-rw-r--r--src/menu/drawable.hpp6
-rw-r--r--src/menu/drawable_control.cpp38
-rw-r--r--src/menu/drawable_control.hpp50
-rw-r--r--src/menu/frame.cpp61
-rw-r--r--src/menu/frame.hpp56
-rw-r--r--src/menu/frame_background.cpp38
-rw-r--r--src/menu/frame_background.hpp (renamed from src/menu/menuBackground.hpp)35
-rw-r--r--src/menu/frame_background_color.cpp (renamed from src/menu/menuBackground.cpp)27
-rw-r--r--src/menu/frame_background_color.hpp50
-rw-r--r--test/Makefile2
15 files changed, 505 insertions, 51 deletions
diff --git a/src/menu/container.cpp b/src/menu/container.cpp
new file mode 100644
index 00000000..57bac666
--- /dev/null
+++ b/src/menu/container.cpp
@@ -0,0 +1,58 @@
+/*
+ * UltraStar Deluxe - Karaoke Game
+ *
+ * UltraStar Deluxe is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ */
+
+#include "container.hpp"
+
+namespace usdx
+{
+ Container::Container()
+ {
+ }
+
+ Container::~Container()
+ {
+ for (std::list<DrawableControl*>::iterator it =
+ controls.begin(); it != controls.end(); it++) {
+ delete *it;
+ }
+
+ controls.clear();
+ }
+
+ void Container::repaint(void) const
+ {
+ if (get_visible()) {
+ draw();
+
+ for (std::list<DrawableControl*>::const_iterator it =
+ controls.begin();
+ it != controls.end(); it++) {
+
+ (*it)->repaint();
+ }
+ }
+ }
+};
diff --git a/src/menu/container.hpp b/src/menu/container.hpp
new file mode 100644
index 00000000..d85320a2
--- /dev/null
+++ b/src/menu/container.hpp
@@ -0,0 +1,53 @@
+/*
+ * UltraStar Deluxe - Karaoke Game
+ *
+ * UltraStar Deluxe is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ */
+
+#ifndef CONTAINER_HPP
+#define CONTAINER_HPP
+
+#include "drawable_control.hpp"
+#include <list>
+
+namespace usdx
+{
+ class Container : public DrawableControl
+ {
+ private:
+ std::list<DrawableControl*> controls;
+
+ public:
+ Container();
+ virtual ~Container();
+
+ /**
+ * Method for redraw all contained objects.
+ */
+ void repaint(void) const;
+
+ };
+};
+
+
+#endif
diff --git a/src/menu/control.cpp b/src/menu/control.cpp
new file mode 100644
index 00000000..373fb482
--- /dev/null
+++ b/src/menu/control.cpp
@@ -0,0 +1,38 @@
+/*
+ * UltraStar Deluxe - Karaoke Game
+ *
+ * UltraStar Deluxe is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ */
+
+#include "control.hpp"
+
+namespace usdx
+{
+ Control::Control()
+ {
+ }
+
+ Control::~Control()
+ {
+ }
+};
diff --git a/src/menu/control.hpp b/src/menu/control.hpp
new file mode 100644
index 00000000..2d47eb55
--- /dev/null
+++ b/src/menu/control.hpp
@@ -0,0 +1,40 @@
+/*
+ * UltraStar Deluxe - Karaoke Game
+ *
+ * UltraStar Deluxe is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ */
+
+#ifndef CONTROL_HPP
+#define CONTROL_HPP
+
+namespace usdx
+{
+ class Control
+ {
+ public:
+ Control();
+ virtual ~Control();
+ };
+};
+
+#endif
diff --git a/src/menu/drawable.cpp b/src/menu/drawable.cpp
index 8bfd5772..5f744e62 100644
--- a/src/menu/drawable.cpp
+++ b/src/menu/drawable.cpp
@@ -32,10 +32,10 @@ namespace usdx
{
}
- void Drawable::draw(void) const
+ void Drawable::repaint(void) const
{
if (visible) {
- on_draw();
+ draw();
}
};
diff --git a/src/menu/drawable.hpp b/src/menu/drawable.hpp
index 84f9daa0..e2cc43fc 100644
--- a/src/menu/drawable.hpp
+++ b/src/menu/drawable.hpp
@@ -41,16 +41,16 @@ namespace usdx
/**
* Pure virtual method, that descendant classes have to implement.
*/
- virtual void on_draw(void) const = 0;
+ virtual void draw(void) const = 0;
public:
Drawable(void);
virtual ~Drawable(void) {};
/**
- * Method for redraw this Object. If visible issues on_draw.
+ * Method for redraw this Object. If visible issues draw.
*/
- void draw(void) const;
+ void repaint(void) const;
/**
* Setter for visible.
diff --git a/src/menu/drawable_control.cpp b/src/menu/drawable_control.cpp
new file mode 100644
index 00000000..404b0e4c
--- /dev/null
+++ b/src/menu/drawable_control.cpp
@@ -0,0 +1,38 @@
+/*
+ * UltraStar Deluxe - Karaoke Game
+ *
+ * UltraStar Deluxe is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ */
+
+#include "drawable_control.hpp"
+
+namespace usdx
+{
+ DrawableControl::DrawableControl()
+ {
+ }
+
+ DrawableControl::~DrawableControl()
+ {
+ }
+};
diff --git a/src/menu/drawable_control.hpp b/src/menu/drawable_control.hpp
new file mode 100644
index 00000000..612e17d3
--- /dev/null
+++ b/src/menu/drawable_control.hpp
@@ -0,0 +1,50 @@
+/*
+ * UltraStar Deluxe - Karaoke Game
+ *
+ * UltraStar Deluxe is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ */
+
+#ifndef DRAWABLE_CONTROL_HPP
+#define DRAWABLE_CONTROL_HPP
+
+#include "drawable.hpp"
+#include "control.hpp"
+
+namespace usdx
+{
+ class DrawableControl : public Drawable, public Control
+ {
+ protected:
+ /**
+ * Pure virtual method, that descendant classes have to
+ * implement. (Should be left pure virtual.)
+ */
+ virtual void draw(void) const = 0;
+
+ public:
+ DrawableControl();
+ virtual ~DrawableControl();
+ };
+};
+
+#endif
diff --git a/src/menu/frame.cpp b/src/menu/frame.cpp
new file mode 100644
index 00000000..8707f0cc
--- /dev/null
+++ b/src/menu/frame.cpp
@@ -0,0 +1,61 @@
+/*
+ * UltraStar Deluxe - Karaoke Game
+ *
+ * UltraStar Deluxe is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ */
+
+#include "frame.hpp"
+
+namespace usdx
+{
+ Frame::Frame() : background(NULL)
+ {
+ }
+
+ Frame::Frame(FrameBackground* background) : background(background)
+ {
+ }
+
+ Frame::~Frame()
+ {
+ if (background) {
+ delete background;
+ background = NULL;
+ }
+ }
+
+ void Frame::set_background(FrameBackground* background)
+ {
+ this->background = background;
+ }
+
+ const FrameBackground* Frame::get_background(void) const
+ {
+ return background;
+ }
+
+ void Frame::draw(void) const
+ {
+ background->repaint();
+ }
+};
diff --git a/src/menu/frame.hpp b/src/menu/frame.hpp
new file mode 100644
index 00000000..7f9af120
--- /dev/null
+++ b/src/menu/frame.hpp
@@ -0,0 +1,56 @@
+/*
+ * UltraStar Deluxe - Karaoke Game
+ *
+ * UltraStar Deluxe is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ */
+
+#ifndef FRAME_HPP
+#define FRAME_HPP
+
+#include "container.hpp"
+#include "frame_background.hpp"
+
+namespace usdx
+{
+ class Frame : public Container
+ {
+ private:
+ FrameBackground* background;
+
+ protected:
+ virtual void draw(void) const;
+
+ public:
+ Frame();
+ Frame(FrameBackground* background);
+
+ virtual ~Frame();
+
+ void set_background(FrameBackground* background);
+
+ const FrameBackground* get_background() const;
+ };
+};
+
+
+#endif
diff --git a/src/menu/frame_background.cpp b/src/menu/frame_background.cpp
new file mode 100644
index 00000000..5c18cf45
--- /dev/null
+++ b/src/menu/frame_background.cpp
@@ -0,0 +1,38 @@
+/*
+ * UltraStar Deluxe - Karaoke Game
+ *
+ * UltraStar Deluxe is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ */
+
+#include "frame_background.hpp"
+
+namespace usdx
+{
+ FrameBackground::FrameBackground()
+ {
+ }
+
+ FrameBackground::~FrameBackground()
+ {
+ }
+};
diff --git a/src/menu/menuBackground.hpp b/src/menu/frame_background.hpp
index c398b381..e815094a 100644
--- a/src/menu/menuBackground.hpp
+++ b/src/menu/frame_background.hpp
@@ -24,45 +24,34 @@
* $Id$
*/
-#ifndef MENUBACKGROUND_HPP
-#define MENUBACKGROUND_HPP
+#ifndef FRAME_BACKGROUND_HPP
+#define FRAME_BACKGROUND_HPP
+
+#include "drawable.hpp"
namespace usdx
{
// Exception
- class MenuBackgroundException { };
+ class FrameBackgroundException { };
- // MenuBackground - abstract class for MenuBackgrounds
- class MenuBackground
+ // FrameBackground - abstract class for FrameBackgrounds
+ class FrameBackground : public Drawable
{
public:
- virtual void draw(void) = 0;
+ FrameBackground();
// optional methods
- virtual ~MenuBackground() {}
+ virtual ~FrameBackground();
virtual void on_show(void) {}
virtual void on_finish(void) {}
protected:
// no copy and no assignment
- MenuBackground(const MenuBackground&);
- MenuBackground& operator=(const MenuBackground&);
- };
-
- class MenuBackgroundNone : MenuBackground
- {
- public:
- virtual void draw(void);
- };
+ FrameBackground(const FrameBackground&);
+ FrameBackground& operator=(const FrameBackground&);
- class MenuBackgroundColor : MenuBackground
- {
- private:
- RGB color;
- public:
- MenuBackgroundColor(RGB &color);
- virtual void draw(void);
+ virtual void draw(void) = 0;
};
};
diff --git a/src/menu/menuBackground.cpp b/src/menu/frame_background_color.cpp
index f34cf987..3c3adfd8 100644
--- a/src/menu/menuBackground.cpp
+++ b/src/menu/frame_background_color.cpp
@@ -24,35 +24,18 @@
* $Id$
*/
-#if 0
-
-#include "menuBackground.hpp"
+#include "frame_background_color.hpp"
#include <GL/gl.h>
-int screen_act = 1;
-
namespace usdx
{
- void MenuBackgroundNone::draw(void)
- {
- // clear just once when in dual screen mode
- if (screen_act == 0)
- glClear(GL_DEPTH_BUFFER_BIT);
- }
-
- MenuBackgroundColor::MenuBackgrundColor(RGB &color)
+ FrameBackgroundColor::FrameBackgroundColor(RgbColor &color) : color(color)
{
- this->color = color;
}
- void MenuBackgroundColor::draw(void)
+ void FrameBackgroundColor::draw(void) const
{
- // just clear once, even when using two screens
- if (screen_act == 1) {
- glClearColor(color.r, color.g, color.b, 0);
- glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
- }
+ glClearColor(color.get_red(), color.get_green(), color.get_blue(), 0);
+ glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
}
};
-
-#endif
diff --git a/src/menu/frame_background_color.hpp b/src/menu/frame_background_color.hpp
new file mode 100644
index 00000000..d1fdcc17
--- /dev/null
+++ b/src/menu/frame_background_color.hpp
@@ -0,0 +1,50 @@
+/*
+ * UltraStar Deluxe - Karaoke Game
+ *
+ * UltraStar Deluxe is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ */
+
+#ifndef FRAME_BACKGROUND_COLOR_HPP
+#define FRAME_BACKGROUND_COLOR_HPP
+
+#include "frame_background.hpp"
+#include "utils/rgb_color.hpp"
+
+namespace usdx
+{
+ class FrameBackgroundColor : public FrameBackground
+ {
+ private:
+ RgbColor color;
+
+ protected:
+ virtual void draw(void) const;
+
+ public:
+ FrameBackgroundColor(RgbColor &color);
+
+ };
+};
+
+
+#endif
diff --git a/test/Makefile b/test/Makefile
index 6278be7d..937ee760 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -10,7 +10,7 @@ sources:=$(wildcard *.cpp) $(wildcard */*.cpp) $(wildcard $(TOP)/src/*/*/*.cpp)
deps:=$(sources:.cpp=.d)
CXXFLAGS:=-Wall -Werror -I$(TOP)/src -I$(TOP)/src/base -I$(TOP)/src/menu -I$(TOP)/src/media -I$(TOP)/src/screens -g
-LDFLAGS:=-lsqlite3 -lSDL -llog4cxx -lboost_program_options-mt -lboost_filesystem-mt -lSDL_image -lcppunit
+LDFLAGS:=-lsqlite3 -lSDL -llog4cxx -lboost_program_options-mt -lboost_filesystem-mt -lSDL_image -lcppunit -lGL
TARGET:=$(PROJECT)
objects:=$(sources:.cpp=.o)