|
From: Tapio V. <aa...@us...> - 2010-08-21 18:02:48
|
Module: performous
Branch: master
Commit: 464fd8db834388590beefac936fc1282de6890f1
Author: Tapio Vierros <tap...@gm...>
Date: Wed Jun 23 21:17:06 2010 +0300
Theming support for instrument menu.
* Uses SVGs from main menu for place holders.
- Not very well suited.
* Background images are disabled.
- Waiting for proper pics to tune them with.
---
game/instrumentgraph.cc | 24 +++++++++++++++---------
game/menu.hh | 5 ++++-
game/theme.cc | 4 +---
game/theme.hh | 2 +-
4 files changed, 21 insertions(+), 14 deletions(-)
diff --git a/game/instrumentgraph.cc b/game/instrumentgraph.cc
index 1c31753..470af9c 100644
--- a/game/instrumentgraph.cc
+++ b/game/instrumentgraph.cc
@@ -52,20 +52,26 @@ void InstrumentGraph::toggleMenu(int dontforce) {
void InstrumentGraph::drawMenu(double offsetX) {
if (m_menu.options.empty()) return;
- float step = 0.05;
+ float step = 0.075;
float y = -0.5 * m_menu.options.size() * step;
- m_text.dimensions.screenCenter(0).middle(0);
+ ThemeInstrumentMenu& th = *m_menu.theme;
for (InstrumentMenuOptions::iterator it = m_menu.options.begin(); it != m_menu.options.end(); ++it) {
- // TODO: Use theme
- m_text.dimensions.center(y).middle(-0.09 + offsetX);
- std::string value = it->value;
- if (m_menu.current == it) value = "> " + value + " <";
- m_text.draw(value);
+ if (m_menu.current == it) {
+ //th.back_h.dimensions.middle(0.05 + offsetX).center(y);
+ //th.back_h.draw();
+ th.option_selected.dimensions.middle(-0.1 + offsetX).center(y);
+ th.option_selected.draw(it->value);
+ } else {
+ th.option.dimensions.middle(-0.1 + offsetX).center(y);
+ th.option.draw(it->value);
+ }
y += step;
}
if (m_menu.current->comment != "") {
- m_text.dimensions.center(y+3*step).middle(-0.09 + offsetX);
- m_text.draw(m_menu.current->comment);
+ //th.comment_bg.dimensions.middle().screenBottom(-0.2);
+ //th.comment_bg.draw();
+ th.comment.dimensions.middle(-0.1 + offsetX).screenBottom(-0.2);
+ th.comment.draw(m_menu.current->comment);
}
}
diff --git a/game/menu.hh b/game/menu.hh
index 7afb371..7ebe636 100755
--- a/game/menu.hh
+++ b/game/menu.hh
@@ -2,7 +2,9 @@
#include "opengl_text.hh"
#include "surface.hh"
+#include "theme.hh"
#include <boost/noncopyable.hpp>
+#include <boost/scoped_ptr.hpp>
#include <string>
#include <vector>
@@ -50,7 +52,7 @@ typedef std::vector<InstrumentMenuOption> InstrumentMenuOptions;
/// Menu for selecting difficulty etc.
struct InstrumentMenu {
/// constructor
- InstrumentMenu(InstrumentGraph& ig): owner(ig), current(options.end()) {}
+ InstrumentMenu(InstrumentGraph& ig): owner(ig), current(options.end()) { theme.reset(new ThemeInstrumentMenu()); }
/// add a menu option
void add(InstrumentMenuOption opt);
/// move the selection
@@ -65,4 +67,5 @@ struct InstrumentMenu {
InstrumentGraph& owner;
InstrumentMenuOptions options;
InstrumentMenuOptions::iterator current;
+ boost::scoped_ptr<ThemeInstrumentMenu> theme;
};
diff --git a/game/theme.cc b/game/theme.cc
index e583b1d..24add72 100755
--- a/game/theme.cc
+++ b/game/theme.cc
@@ -63,12 +63,10 @@ ThemeIntro::ThemeIntro():
ThemeInstrumentMenu::ThemeInstrumentMenu():
Theme(getThemePath("warning.svg")),
back_h(getThemePath("menu_back_highlight.svg")),
+ option(getThemePath("menu_option.svg"), config["graphic/text_lod"].f()),
option_selected(getThemePath("menu_option_selected.svg"), config["graphic/text_lod"].f()),
comment(getThemePath("menu_comment.svg"), config["graphic/text_lod"].f()),
comment_bg(getThemePath("menu_comment_bg.svg"))
{
back_h.dimensions.fixedHeight(0.08f);
- option.push_back(new SvgTxtTheme(getThemePath("menu_option.svg"), config["graphic/text_lod"].f()));
- option.push_back(new SvgTxtTheme(getThemePath("menu_option.svg"), config["graphic/text_lod"].f()));
- option.push_back(new SvgTxtTheme(getThemePath("menu_option.svg"), config["graphic/text_lod"].f()));
}
diff --git a/game/theme.hh b/game/theme.hh
index 0e3e042..c1c9ffa 100755
--- a/game/theme.hh
+++ b/game/theme.hh
@@ -97,7 +97,7 @@ struct ThemeInstrumentMenu: Theme {
/// back highlight for selected option
Surface back_h;
/// menu option text
- boost::ptr_vector<SvgTxtTheme> option;
+ SvgTxtTheme option;
/// menu selected option text
SvgTxtTheme option_selected;
/// menu comment text
|