|
From: Johnny O. <js...@us...> - 2010-10-28 21:12:47
|
Module: performous
Branch: opengl2
Commit: 12622095c6ff10d7d13bbe8feb72fca3a7cec1e8
Author: Tapio Vierros <tap...@gm...>
Date: Wed Oct 27 17:59:10 2010 +0300
Arrow icon hints for instrument & dance joinmenu.
---
game/instrumentgraph.cc | 71 ++++++++++++++++++++++++-----------------------
game/instrumentgraph.hh | 4 ++
2 files changed, 40 insertions(+), 35 deletions(-)
diff --git a/game/instrumentgraph.cc b/game/instrumentgraph.cc
index 607843a..b608b08 100644
--- a/game/instrumentgraph.cc
+++ b/game/instrumentgraph.cc
@@ -12,6 +12,10 @@ InstrumentGraph::InstrumentGraph(Audio& audio, Song const& song, input::DevType
m_cx(0.0, 0.2), m_width(0.5, 0.4),
m_menu(),
m_button(getThemePath("button.svg")),
+ m_arrow_up(getThemePath("arrow_button_up.svg")),
+ m_arrow_down(getThemePath("arrow_button_down.svg")),
+ m_arrow_left(getThemePath("arrow_button_left.svg")),
+ m_arrow_right(getThemePath("arrow_button_right.svg")),
m_text(getThemePath("sing_timetxt.svg"), config["graphic/text_lod"].f()),
m_selectedTrack(""),
m_selectedDifficulty(0),
@@ -33,6 +37,10 @@ InstrumentGraph::InstrumentGraph(Audio& audio, Song const& song, input::DevType
m_popupText.reset(new SvgTxtThemeSimple(getThemePath("sing_popup_text.svg"), config["graphic/text_lod"].f()));
m_menuTheme.reset(new ThemeInstrumentMenu());
for (size_t i = 0; i < max_panels; ++i) m_pressed[i] = false;
+ m_arrow_up.dimensions.stretch(0.05, 0.05);
+ m_arrow_down.dimensions.stretch(0.05, 0.05);
+ m_arrow_left.dimensions.stretch(0.05, 0.05);
+ m_arrow_right.dimensions.stretch(0.05, 0.05);
}
@@ -76,7 +84,7 @@ void InstrumentGraph::drawMenu() {
// All these vars are ultimately affected by the scaling matrix
const double offsetX = 0.5f * (dimensions.x1() + dimensions.x2()) / s;
const float txth = th.option.h();
- const float button_margin = (getGraphType() == input::DANCEPAD ? 0.0f : 0.05f);
+ const float button_margin = m_arrow_up.dimensions.w();
const float step = txth * 0.7f;
const float h = m_menu.getOptions().size() * step + step;
float y = -h * .5f + step;
@@ -88,51 +96,46 @@ void InstrumentGraph::drawMenu() {
// Loop through menu items
w = 0;
unsigned i = 0;
- m_button.dimensions.stretch(0.05, 0.05);
for (MenuOptions::const_iterator it = m_menu.begin(); it != m_menu.end(); ++it, ++i) {
SvgTxtTheme* txt = &th.option;
// Selected item?
if (cur == it) {
// Draw the key hints
- if (getGraphType() != input::DANCEPAD) {
- if (m_input.isKeyboard()) { // Key letters for keyboard
- txt->dimensions.middle(x - button_margin - m_button.dimensions.w()*0.5f).center(y);
- txt->draw(getGraphType() == input::GUITAR ? (m_leftymode.b() ? "Z" : "1") : "U");
- txt->dimensions.middle(xx + button_margin - m_button.dimensions.w()*0.5f).center(y);
- txt->draw(getGraphType() == input::GUITAR ? (m_leftymode.b() ? "X" : "2") : "P");
- } else { // Colored icons for real instruments
- {
- glutil::Color c(color(getGraphType() == input::GUITAR ? 0 : 1));
- m_button.dimensions.middle(x - button_margin).center(y);
- m_button.draw();
- }
- {
- glutil::Color c(color(getGraphType() == input::GUITAR ? 1 : 4));
- m_button.dimensions.middle(xx + button_margin);
- m_button.draw();
- }
+ if (m_input.isKeyboard() && getGraphType() != input::DANCEPAD) { // Key letters for keyboard
+ txt->dimensions.middle(x - button_margin - button_margin*0.5f).center(y);
+ txt->draw(getGraphType() == input::GUITAR ? (m_leftymode.b() ? "Z" : "1") : "U");
+ txt->dimensions.middle(xx + button_margin - button_margin*0.5f).center(y);
+ txt->draw(getGraphType() == input::GUITAR ? (m_leftymode.b() ? "X" : "2") : "P");
+ } else { // Colored icons for real instruments
+ if (getGraphType() == input::DRUMS) {
+ // Drum colors are mirrored
+ m_arrow_left.dimensions.middle(xx + button_margin).center(y);
+ m_arrow_right.dimensions.middle(x - button_margin).center(y);
+ } else {
+ m_arrow_left.dimensions.middle(x - button_margin).center(y);
+ m_arrow_right.dimensions.middle(xx + button_margin).center(y);
}
+ m_arrow_left.draw();
+ m_arrow_right.draw();
}
- // Drum up hint
- if (getGraphType() == input::DRUMS && i > 0) {
- if (m_input.isKeyboard()) { // Key letters for keyboard
- txt->dimensions.middle(x - button_margin - m_button.dimensions.w()*0.5f).center(y - step);
+ // Up hint
+ if (getGraphType() != input::GUITAR && i > 0) {
+ if (m_input.isKeyboard() && getGraphType() == input::DRUMS) { // Key letters for keyboard drums
+ txt->dimensions.middle(x - button_margin - button_margin*0.5f).center(y - step);
txt->draw("I");
} else { // Colored icons for real instruments
- glutil::Color c(color(2));
- m_button.dimensions.middle(x - button_margin).center(y - step);
- m_button.draw();
+ m_arrow_up.dimensions.middle(x - button_margin).center(y - step);
+ m_arrow_up.draw();
}
}
// Drum down hint
- if (getGraphType() == input::DRUMS && i < m_menu.getOptions().size()-1) {
- if (m_input.isKeyboard()) {
- txt->dimensions.middle(x - button_margin - m_button.dimensions.w()*0.5f).center(y + step);
+ if (getGraphType() != input::GUITAR && i < m_menu.getOptions().size()-1) {
+ if (m_input.isKeyboard() && getGraphType() == input::DRUMS) { // Key letters for keyboard drums
+ txt->dimensions.middle(x - button_margin - button_margin*0.5f).center(y + step);
txt->draw("O");
- } else {
- glutil::Color c(color(3));
- m_button.dimensions.middle(x - button_margin).center(y + step);
- m_button.draw();
+ } else { // Colored icons for real instruments
+ m_arrow_down.dimensions.middle(x - button_margin).center(y + step);
+ m_arrow_down.draw();
}
}
//th.back_h.dimensions.middle(0.05 + offsetX).center(y);
@@ -152,8 +155,6 @@ void InstrumentGraph::drawMenu() {
th.comment.dimensions.middle(offsetX).screenBottom(-0.12);
th.comment.draw(cur->getComment());
}
- // Reset button size
- m_button.dimensions.stretch(1.0, 1.0);
// Save the calculated menu dimensions
m_menu.dimensions.stretch(w, h);
}
diff --git a/game/instrumentgraph.hh b/game/instrumentgraph.hh
index 72661ab..7b6fd77 100644
--- a/game/instrumentgraph.hh
+++ b/game/instrumentgraph.hh
@@ -127,6 +127,10 @@ class InstrumentGraph {
// Media
Surface m_button;
+ Surface m_arrow_up;
+ Surface m_arrow_down;
+ Surface m_arrow_left;
+ Surface m_arrow_right;
SvgTxtTheme m_text;
boost::scoped_ptr<SvgTxtThemeSimple> m_popupText;
boost::scoped_ptr<ThemeInstrumentMenu> m_menuTheme;
|