You can subscribe to this list here.
| 2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(25) |
Jul
(288) |
Aug
(119) |
Sep
(31) |
Oct
(59) |
Nov
(458) |
Dec
(359) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2010 |
Jan
(268) |
Feb
(26) |
Mar
(36) |
Apr
(48) |
May
(119) |
Jun
(37) |
Jul
(173) |
Aug
(429) |
Sep
(137) |
Oct
(156) |
Nov
(59) |
Dec
(45) |
| 2011 |
Jan
(398) |
Feb
(257) |
Mar
(49) |
Apr
(5) |
May
(34) |
Jun
(11) |
Jul
(38) |
Aug
(12) |
Sep
(1) |
Oct
(49) |
Nov
(5) |
Dec
(10) |
| 2012 |
Jan
(21) |
Feb
(32) |
Mar
(20) |
Apr
(1) |
May
(2) |
Jun
|
Jul
(173) |
Aug
|
Sep
(25) |
Oct
(6) |
Nov
(44) |
Dec
|
|
From: Tapio V. <aa...@us...> - 2010-08-21 18:04:01
|
Module: performous
Branch: master
Commit: 13325f573b4661a51c84af000e66d922ded29e4d
Author: Tapio Vierros <tap...@gm...>
Date: Tue Aug 3 00:28:01 2010 +0300
Fix instrument cursor rendering and don't crash with more than 5 menu items.
---
game/guitargraph.cc | 4 ++--
game/instrumentgraph.cc | 7 +++++--
game/menu.cc | 3 +--
3 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index 5a47ce7..e98db01 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -293,8 +293,8 @@ void GuitarGraph::engine() {
// Menu keys
if (menuOpen()) {
// Check first regular keys
- if (ev.type == input::Event::PRESS && ev.button >= 0 && ev.button < 5) {
- int sel = m_drums ? ((ev.button + 5 - 1) % 5) : ev.button;
+ if (ev.type == input::Event::PRESS && ev.button >= 0 && ev.button < m_pads) {
+ int sel = m_drums ? ((ev.button + m_pads - 1) % m_pads) : ev.button;
m_menu.select(sel);
m_menu.action();
}
diff --git a/game/instrumentgraph.cc b/game/instrumentgraph.cc
index 6d25b26..a4f207a 100644
--- a/game/instrumentgraph.cc
+++ b/game/instrumentgraph.cc
@@ -80,8 +80,8 @@ void InstrumentGraph::drawMenu() {
for (MenuOptions::const_iterator it = m_menu.begin(); it != m_menu.end(); ++it, ++i) {
SvgTxtTheme* txt = &th.option;
// Draw the key hints
- if (getGraphType() != input::DANCEPAD) {
- int fret = (getGraphType() == input::DRUMS ? ((i + 1) % 5) : i);
+ if (getGraphType() != input::DANCEPAD && i < m_pads) {
+ int fret = (getGraphType() == input::DRUMS ? ((i + 1) % m_pads) : i);
glColor4fv(color(fret));
m_button.dimensions.middle(x - button_margin).center(y).stretch(0.05, 0.05);
m_button.draw();
@@ -97,12 +97,15 @@ void InstrumentGraph::drawMenu() {
w = std::max(w, txt->w() + 2 * step + button_margin * 2); // Calculate the widest entry
y += step;
}
+ // Draw comment text
if (cur->getComment() != "") {
//th.comment_bg.dimensions.middle().screenBottom(-0.2);
//th.comment_bg.draw();
th.comment.dimensions.middle(offsetX).screenBottom(-0.12);
th.comment.draw(cur->getComment());
}
+ m_button.dimensions.stretch(1.0, 1.0);
+ // Save the calculated menu dimensions
m_menu.dimensions.stretch(w, h);
}
diff --git a/game/menu.cc b/game/menu.cc
index 3081598..30ca24d 100644
--- a/game/menu.cc
+++ b/game/menu.cc
@@ -2,8 +2,7 @@
#include "screen.hh"
#include "surface.hh"
#include "fs.hh"
-#include "configuration.hh"
-#include "instrumentgraph.hh"
+
MenuOption::MenuOption(const std::string& nm, const std::string& comm):
type(CLOSE_SUBMENU),
|
|
From: Tapio V. <aa...@us...> - 2010-08-21 18:03:59
|
Module: performous
Branch: master
Commit: 07bd39363234da32765fa7025a3ab11ba701710c
Author: Tapio Vierros <tap...@gm...>
Date: Tue Aug 3 00:11:58 2010 +0300
Change instrumenthelp image texts.
---
themes/default/instrumenthelp.svg | 33 +++++++++++----------------------
1 files changed, 11 insertions(+), 22 deletions(-)
diff --git a/themes/default/instrumenthelp.svg b/themes/default/instrumenthelp.svg
index 01690c1..ca8c77a 100644
--- a/themes/default/instrumenthelp.svg
+++ b/themes/default/instrumenthelp.svg
@@ -65,11 +65,11 @@
showgrid="false"
showguides="true"
inkscape:guide-bbox="true"
- inkscape:zoom="0.5"
- inkscape:cx="287.72345"
- inkscape:cy="261.06756"
+ inkscape:zoom="1"
+ inkscape:cx="602.01716"
+ inkscape:cy="358.48892"
inkscape:window-x="58"
- inkscape:window-y="13"
+ inkscape:window-y="24"
inkscape:current-layer="svg5215"
inkscape:window-maximized="0" />
<text
@@ -322,28 +322,17 @@
<text
xml:space="preserve"
style="font-size:28px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;text-anchor:start;opacity:0.95;fill:#ffffff;fill-opacity:0.95;fill-rule:nonzero;stroke:#000000;stroke-width:0.89999998;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;font-family:Verdana;-inkscape-font-specification:Verdana"
- x="562.48071"
- y="372.84677"
+ x="548.48071"
+ y="373.84677"
id="text3235"><tspan
sodipodi:role="line"
- x="562.48071"
- y="372.84677"
+ x="548.48071"
+ y="373.84677"
id="tspan3239"
- style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.89999998;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none">Choose your level</tspan></text>
- <text
- xml:space="preserve"
- style="font-size:28px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;opacity:0.95;fill:#ffffff;fill-opacity:0.95;fill-rule:nonzero;stroke:#000000;stroke-width:0.89999998;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;font-family:Verdana;-inkscape-font-specification:Verdana"
- x="483.65076"
- y="424.65451"
- id="text3241"><tspan
- sodipodi:role="line"
- x="483.65076"
- y="424.65451"
- id="tspan3245"
- style="fill-rule:nonzero;stroke-width:0.89999998;stroke-miterlimit:4;stroke-dasharray:none">Switch instruments</tspan></text>
+ style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.89999998;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none">Navigate guitar menu</tspan></text>
<path
- style="fill:none;stroke:#000000;stroke-width:1.98199999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
- d="m 494.78718,355.56651 c 33.7918,36.90148 32.13332,41.46233 32.13332,41.46233"
+ style="fill:none;stroke:#000000;stroke-width:1.98200011;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
+ d="M 557.1897,348.34804 C 504.84576,364.89347 501.307,360.2599 501.307,360.2599"
id="path3253" />
<path
style="fill:none;stroke:#000000;stroke-width:1.98199999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
|
|
From: Tapio V. <aa...@us...> - 2010-08-21 18:03:57
|
Module: performous
Branch: master
Commit: 2941e0d385b2075dbab3c32d05024745f957573a
Author: Tapio Vierros <tap...@gm...>
Date: Tue Aug 3 00:06:30 2010 +0300
Revert "Document lefty mode in instrument selection screen."
This reverts commit cf97cf631b2b650e57eef46a69462fc17e11698a.
Reason: Lefty-mode is now selected through the menu.
---
themes/default/instrumenthelp.svg | 51 ++----------------------------------
1 files changed, 3 insertions(+), 48 deletions(-)
diff --git a/themes/default/instrumenthelp.svg b/themes/default/instrumenthelp.svg
index de5d706..01690c1 100644
--- a/themes/default/instrumenthelp.svg
+++ b/themes/default/instrumenthelp.svg
@@ -49,20 +49,6 @@
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
- <inkscape:perspective
- id="perspective2902"
- inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
- inkscape:vp_z="1 : 0.5 : 1"
- inkscape:vp_y="0 : 1000 : 0"
- inkscape:vp_x="0 : 0.5 : 1"
- sodipodi:type="inkscape:persp3d" />
- <inkscape:perspective
- id="perspective2935"
- inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
- inkscape:vp_z="1 : 0.5 : 1"
- inkscape:vp_y="0 : 1000 : 0"
- inkscape:vp_x="0 : 0.5 : 1"
- sodipodi:type="inkscape:persp3d" />
</defs>
<sodipodi:namedview
inkscape:window-height="791"
@@ -79,9 +65,9 @@
showgrid="false"
showguides="true"
inkscape:guide-bbox="true"
- inkscape:zoom="1.4142136"
- inkscape:cx="525.81157"
- inkscape:cy="402.48892"
+ inkscape:zoom="0.5"
+ inkscape:cx="287.72345"
+ inkscape:cy="261.06756"
inkscape:window-x="58"
inkscape:window-y="13"
inkscape:current-layer="svg5215"
@@ -477,35 +463,4 @@
x="297.83939"
y="495.83029"
style="text-align:center;text-anchor:start;stroke-width:1.01400006;stroke-miterlimit:4;stroke-dasharray:none">TO JOIN THE GAME</tspan></text>
- <text
- xml:space="preserve"
- style="font-size:28px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;opacity:0.95;fill:#ffffff;fill-opacity:0.95;fill-rule:nonzero;stroke:#000000;stroke-width:0.89999998;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;font-family:Verdana;-inkscape-font-specification:Verdana"
- x="695.70026"
- y="310.90945"
- id="text3241-6"><tspan
- sodipodi:role="line"
- x="695.70026"
- y="310.90945"
- id="tspan3245-4"
- style="fill-rule:nonzero;stroke-width:0.89999998;stroke-miterlimit:4;stroke-dasharray:none">+ Lefty mode</tspan></text>
- <path
- sodipodi:type="arc"
- style="fill:#ffff00;fill-opacity:0.87058824;fill-rule:nonzero;stroke:none"
- id="path2925"
- sodipodi:cx="152.38152"
- sodipodi:cy="418.5715"
- sodipodi:rx="38.537319"
- sodipodi:ry="14.849242"
- d="m 190.91883,418.5715 a 38.537319,14.849242 0 1 1 -77.07463,0 38.537319,14.849242 0 1 1 77.07463,0 z"
- transform="matrix(0.41518197,0,0,1.0774961,606.80752,-150.6452)" />
- <path
- sodipodi:type="arc"
- style="fill:#0000ff;fill-opacity:0.87058824;fill-rule:nonzero;stroke:none"
- id="path2925-8"
- sodipodi:cx="152.38152"
- sodipodi:cy="418.5715"
- sodipodi:rx="38.537319"
- sodipodi:ry="14.849242"
- d="m 190.91883,418.5715 a 38.537319,14.849242 0 1 1 -77.07463,0 38.537319,14.849242 0 1 1 77.07463,0 z"
- transform="matrix(0.41518197,0,0,1.0774961,678.48896,-150.6452)" />
</svg>
|
|
From: Tapio V. <aa...@us...> - 2010-08-21 18:03:55
|
Module: performous
Branch: master
Commit: 2489bb8dd85212d2f24f251ce49387f66152bead
Author: Tapio Vierros <tap...@gm...>
Date: Mon Aug 2 23:55:40 2010 +0300
Instrument menu items are selected with frets.
* Color is shown next to the item for clarity.
* Strum+start alternative navigation disabled.
* Assumes there are max 5 options in the menu.
* Dance uses old navigation.
---
game/guitargraph.cc | 44 +++++++++++++++-----------------------------
game/guitargraph.hh | 2 --
game/instrumentgraph.cc | 34 +++++++++++++++++++++++++++++++---
game/instrumentgraph.hh | 4 ++++
game/menu.cc | 5 +++++
game/menu.hh | 2 ++
6 files changed, 57 insertions(+), 34 deletions(-)
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index 117b1dc..5a47ce7 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -59,7 +59,6 @@ namespace {
GuitarGraph::GuitarGraph(Audio& audio, Song const& song, bool drums, int number, bool practmode):
InstrumentGraph(audio, song, drums ? input::DRUMS : input::GUITAR),
- m_button(getThemePath("button.svg")),
m_tail(getThemePath("tail.svg")),
m_tail_glow(getThemePath("tail_glow.svg")),
m_tail_drumfill(getThemePath("tail_drumfill.svg")),
@@ -181,6 +180,7 @@ void GuitarGraph::changeTrack(int dir) {
difficultyAuto(true);
updateNeck();
setupJoinMenu();
+ m_menu.select(1); // Restore selection to the track menu item
}
/// Set specific track
@@ -190,6 +190,7 @@ void GuitarGraph::setTrack(const std::string& track) {
difficultyAuto(true);
updateNeck();
setupJoinMenu();
+ m_menu.select(1); // Restore selection to the track menu item
}
/// Get the difficulty as displayable string
@@ -284,7 +285,7 @@ void GuitarGraph::engine() {
if (ev.type == input::Event::WHAMMY) whammy = (1.0 + ev.button + 2.0*(rand()/double(RAND_MAX))) / 4.0;
} else {
// Handle drum lefty-mode
- if (m_leftymode.b() && ev.button > 0) ev.button = m_pads - ev.button;
+ if (m_leftymode.b() && ev.button > 0 && !menuOpen()) ev.button = m_pads - ev.button;
}
// Keypress anims
if (ev.type == input::Event::PRESS) m_pressed_anim[!m_drums + ev.button].setValue(1.0);
@@ -292,17 +293,19 @@ void GuitarGraph::engine() {
// Menu keys
if (menuOpen()) {
// Check first regular keys
- if (ev.type == input::Event::PRESS && ev.button == 0) m_menu.action(1);
- else if (ev.type == input::Event::PRESS && ev.button == (m_drums ? 4 : 1)) m_menu.action(-1);
- else if (ev.type == input::Event::PRESS && ev.button == (m_drums ? 1 : 2)) m_menu.move(1);
- else if (ev.type == input::Event::PRESS && ev.button == (m_drums ? 2 : 3)) m_menu.move(-1);
- // Strum (strum of keyboard as guitar doesn't generate nav-events)
- else if (ev.type == input::Event::PICK && ev.button == 0) m_menu.move(1);
- else if (ev.type == input::Event::PICK && ev.button == 1) m_menu.move(-1);
- else { // Try nav keys (arrows)
- if (ev.nav == input::DOWN || ev.nav == input::RIGHT) m_menu.move(1);
- else if (ev.nav == input::UP || ev.nav == input::LEFT) m_menu.move(-1);
+ if (ev.type == input::Event::PRESS && ev.button >= 0 && ev.button < 5) {
+ int sel = m_drums ? ((ev.button + 5 - 1) % 5) : ev.button;
+ m_menu.select(sel);
+ m_menu.action();
}
+ // Strum (strum of keyboard as guitar doesn't generate nav-events)
+ //else if (ev.type == input::Event::PICK && ev.button == 0) m_menu.move(1);
+ //else if (ev.type == input::Event::PICK && ev.button == 1) m_menu.move(-1);
+ //else { // Try nav keys (arrows)
+ // if (ev.nav == input::START) m_menu.action();
+ // else if (ev.nav == input::DOWN || ev.nav == input::RIGHT) m_menu.move(1);
+ // else if (ev.nav == input::UP || ev.nav == input::LEFT) m_menu.move(-1);
+ //}
// See if anything changed
if (m_selectedTrack.s() != getTrack()) setTrack(m_selectedTrack.s());
else if (m_selectedDifficulty.i() != m_level) difficulty(Difficulty(m_selectedDifficulty.i()));
@@ -692,23 +695,6 @@ void GuitarGraph::guitarPlay(double time, input::Event const& ev) {
}
}
-/// Get a color based on fret index
-glutil::Color const& GuitarGraph::color(int fret) const {
- static glutil::Color fretColors[5] = {
- glutil::Color(0.0f, 0.9f, 0.0f),
- glutil::Color(0.9f, 0.0f, 0.0f),
- glutil::Color(0.9f, 0.9f, 0.0f),
- glutil::Color(0.0f, 0.0f, 1.0f),
- glutil::Color(0.9f, 0.4f, 0.0f)
- };
- if (fret < 0 || fret >= m_pads) throw std::logic_error("Invalid fret number in GuitarGraph::getColor");
- if (m_drums) {
- if (fret == 0) fret = 4;
- else if (fret == 4) fret = 0;
- }
- return fretColors[fret];
-}
-
/// Modify color based on things like GodMode and solos
glutil::Color const GuitarGraph::colorize(glutil::Color c, double time) const {
const static glutil::Color godmodeC(0.5f, 0.5f, 1.0f); // Color for full GodMode
diff --git a/game/guitargraph.hh b/game/guitargraph.hh
index 2a69547..5c2a06b 100644
--- a/game/guitargraph.hh
+++ b/game/guitargraph.hh
@@ -79,7 +79,6 @@ class GuitarGraph: public InstrumentGraph {
void guitarPlay(double time, input::Event const& ev);
// Media
- Surface m_button;
Texture m_tail;
Texture m_tail_glow;
Texture m_tail_drumfill;
@@ -121,7 +120,6 @@ class GuitarGraph: public InstrumentGraph {
unsigned m_holds[max_panels]; /// active hold notes
// Graphics functions
- glutil::Color const& color(int fret) const;
glutil::Color const colorize(glutil::Color c, double time) const;
void drawBar(double time, float h);
void drawNote(int fret, glutil::Color, float tBeg, float tEnd, float whammy = 0, bool tappable = false, bool hit = false, double hitAnim = 0.0, double releaseTime = 0.0);
diff --git a/game/instrumentgraph.cc b/game/instrumentgraph.cc
index b6e1443..6d25b26 100644
--- a/game/instrumentgraph.cc
+++ b/game/instrumentgraph.cc
@@ -18,6 +18,7 @@ InstrumentGraph::InstrumentGraph(Audio& audio, Song const& song, input::DevType
m_stream(),
m_cx(0.0, 0.2), m_width(0.5, 0.4),
m_menu(),
+ m_button(getThemePath("button.svg")),
m_text(getThemePath("sing_timetxt.svg"), config["graphic/text_lod"].f()),
m_selectedTrack(""),
m_selectedDifficulty(0),
@@ -65,17 +66,27 @@ void InstrumentGraph::drawMenu() {
double w = m_menu.dimensions.w();
const double offsetX = 0.5f * (dimensions.x1() + dimensions.x2());
const float txth = th.option.h();
+ const float button_margin = 0.05f;
const float step = txth * 0.7f;
const float h = m_menu.getOptions().size() * step + step;
float y = -h * .5f + step;
- float x = -w * .5f + step + offsetX;
+ float x = -w * .5f + step + offsetX + button_margin * 1.5f;
// Background
th.bg.dimensions.middle(offsetX).center(0).stretch(w, h);
th.bg.draw();
// Loop through menu items
w = 0;
- for (MenuOptions::const_iterator it = m_menu.begin(); it != m_menu.end(); ++it) {
+ int i = 0;
+ for (MenuOptions::const_iterator it = m_menu.begin(); it != m_menu.end(); ++it, ++i) {
SvgTxtTheme* txt = &th.option;
+ // Draw the key hints
+ if (getGraphType() != input::DANCEPAD) {
+ int fret = (getGraphType() == input::DRUMS ? ((i + 1) % 5) : i);
+ glColor4fv(color(fret));
+ m_button.dimensions.middle(x - button_margin).center(y).stretch(0.05, 0.05);
+ m_button.draw();
+ }
+ // Selected item?
if (cur == it) {
//th.back_h.dimensions.middle(0.05 + offsetX).center(y);
//th.back_h.draw();
@@ -83,7 +94,7 @@ void InstrumentGraph::drawMenu() {
}
txt->dimensions.middle(x).center(y);
txt->draw(it->getName());
- w = std::max(w, txt->w() + 2 * step); // Calculate the widest entry
+ w = std::max(w, txt->w() + 2 * step + button_margin * 2); // Calculate the widest entry
y += step;
}
if (cur->getComment() != "") {
@@ -112,3 +123,20 @@ void InstrumentGraph::handleCountdown(double time, double beginTime) {
--m_countdown;
}
}
+
+
+glutil::Color const& InstrumentGraph::color(int fret) const {
+ static glutil::Color fretColors[5] = {
+ glutil::Color(0.0f, 0.9f, 0.0f),
+ glutil::Color(0.9f, 0.0f, 0.0f),
+ glutil::Color(0.9f, 0.9f, 0.0f),
+ glutil::Color(0.0f, 0.0f, 1.0f),
+ glutil::Color(0.9f, 0.4f, 0.0f)
+ };
+ if (fret < 0 || fret >= m_pads) throw std::logic_error("Invalid fret number in InstrumentGraph::color");
+ if (getGraphType() == input::DRUMS) {
+ if (fret == 0) fret = 4;
+ else if (fret == 4) fret = 0;
+ }
+ return fretColors[fret];
+}
diff --git a/game/instrumentgraph.hh b/game/instrumentgraph.hh
index 0489814..5d853b3 100644
--- a/game/instrumentgraph.hh
+++ b/game/instrumentgraph.hh
@@ -121,7 +121,11 @@ class InstrumentGraph {
void drawPopups(double offsetX);
void handleCountdown(double time, double beginTime);
+ // Functions not really shared, but needed here
+ glutil::Color const& color(int fret) const;
+
// Media
+ Surface m_button;
SvgTxtTheme m_text;
boost::scoped_ptr<SvgTxtThemeSimple> m_popupText;
boost::scoped_ptr<ThemeInstrumentMenu> m_menuTheme;
diff --git a/game/menu.cc b/game/menu.cc
index 7d44b35..3081598 100644
--- a/game/menu.cc
+++ b/game/menu.cc
@@ -78,6 +78,11 @@ void Menu::move(int dir) {
else if (dir < 0 && selection_stack.back() > 0) --selection_stack.back();
}
+void Menu::select(unsigned sel) {
+ if (sel < menu_stack.back()->size())
+ selection_stack.back() = sel;
+}
+
void Menu::action(int dir) {
switch (current().type) {
case MenuOption::OPEN_SUBMENU:
diff --git a/game/menu.hh b/game/menu.hh
index a2be1c2..a04a11b 100644
--- a/game/menu.hh
+++ b/game/menu.hh
@@ -59,6 +59,8 @@ struct Menu {
void add(MenuOption opt);
/// move the selection
void move(int dir = 1);
+ /// set selection
+ void select(unsigned sel);
/// adjust the selected value
void action(int dir = 1);
/// clear items
|
|
From: Tapio V. <aa...@us...> - 2010-08-21 18:03:52
|
Module: performous
Branch: master
Commit: 6d757abe88d70767e5149b93fed23a12caaa5a14
Author: Tapio Vierros <tap...@gm...>
Date: Mon Aug 2 20:23:26 2010 +0300
Better horizontal position & size calculation for instrument menu + comment.
---
game/instrumentgraph.cc | 11 ++++++++---
game/menu.cc | 1 +
game/menu.hh | 2 ++
game/opengl_text.hh | 2 ++
game/screen_sing.cc | 11 ++++++++---
game/theme.cc | 1 +
6 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/game/instrumentgraph.cc b/game/instrumentgraph.cc
index 76e5455..b6e1443 100644
--- a/game/instrumentgraph.cc
+++ b/game/instrumentgraph.cc
@@ -62,15 +62,18 @@ void InstrumentGraph::drawMenu() {
// Some helper vars
ThemeInstrumentMenu& th = *m_menuTheme;
MenuOptions::const_iterator cur = static_cast<MenuOptions::const_iterator>(&m_menu.current());
+ double w = m_menu.dimensions.w();
const double offsetX = 0.5f * (dimensions.x1() + dimensions.x2());
const float txth = th.option.h();
const float step = txth * 0.7f;
const float h = m_menu.getOptions().size() * step + step;
float y = -h * .5f + step;
+ float x = -w * .5f + step + offsetX;
// Background
- th.bg.dimensions.middle(.05 + offsetX).center(0).stretch(.45, h);
+ th.bg.dimensions.middle(offsetX).center(0).stretch(w, h);
th.bg.draw();
// Loop through menu items
+ w = 0;
for (MenuOptions::const_iterator it = m_menu.begin(); it != m_menu.end(); ++it) {
SvgTxtTheme* txt = &th.option;
if (cur == it) {
@@ -78,16 +81,18 @@ void InstrumentGraph::drawMenu() {
//th.back_h.draw();
txt = &th.option_selected;
}
- txt->dimensions.middle(-0.1 + offsetX).center(y);
+ txt->dimensions.middle(x).center(y);
txt->draw(it->getName());
+ w = std::max(w, txt->w() + 2 * step); // Calculate the widest entry
y += step;
}
if (cur->getComment() != "") {
//th.comment_bg.dimensions.middle().screenBottom(-0.2);
//th.comment_bg.draw();
- th.comment.dimensions.middle(-0.1 + offsetX).screenBottom(-0.12);
+ th.comment.dimensions.middle(offsetX).screenBottom(-0.12);
th.comment.draw(cur->getComment());
}
+ m_menu.dimensions.stretch(w, h);
}
diff --git a/game/menu.cc b/game/menu.cc
index 265ca3f..7d44b35 100644
--- a/game/menu.cc
+++ b/game/menu.cc
@@ -62,6 +62,7 @@ MenuOption::MenuOption(const std::string& nm, const std::string& comm, const std
Menu::Menu():
+ dimensions(),
m_open(true)
{
clear();
diff --git a/game/menu.hh b/game/menu.hh
index ab5e883..a2be1c2 100644
--- a/game/menu.hh
+++ b/game/menu.hh
@@ -77,6 +77,8 @@ struct Menu {
const MenuOptions::const_iterator end() const { return menu_stack.back()->end(); }
const MenuOptions getOptions() const { return *menu_stack.back(); }
+ Dimensions dimensions;
+
private:
MenuOptions root_options;
SubmenuStack menu_stack;
diff --git a/game/opengl_text.hh b/game/opengl_text.hh
index 0a74b05..5dc228c 100644
--- a/game/opengl_text.hh
+++ b/game/opengl_text.hh
@@ -153,6 +153,8 @@ class SvgTxtTheme {
double w() const { return m_texture_width; }
/// height
double h() const { return m_texture_height; }
+ /// set align
+ void setAlign(Align align) { m_align = align; }
private:
boost::ptr_vector<OpenGLText> m_opengl_text;
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index 25a2d34..e7109e6 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -488,27 +488,32 @@ void ScreenSing::drawMenu() {
// Some helper vars
ThemeInstrumentMenu& th = *m_menuTheme;
MenuOptions::const_iterator cur = static_cast<MenuOptions::const_iterator>(&m_menu.current());
+ double w = m_menu.dimensions.w();
const float txth = th.option.h();
const float step = txth * 0.85f;
const float h = m_menu.getOptions().size() * step + step;
float y = -h * .5f + step;
+ float x = -w * .5f + step;
// Background
- th.bg.dimensions.middle(.05).center(0).stretch(.45, h);
+ th.bg.dimensions.middle(0).center(0).stretch(w, h);
th.bg.draw();
// Loop through menu items
+ w = 0;
for (MenuOptions::const_iterator it = m_menu.begin(); it != m_menu.end(); ++it) {
SvgTxtTheme* txt = &th.option;
if (cur == it) {
txt = &th.option_selected;
}
- txt->dimensions.middle(-0.1).center(y);
+ txt->dimensions.middle(x).center(y);
txt->draw(it->getName());
+ w = std::max(w, txt->w() + 2 * step); // Calculate the widest entry
y += step;
}
if (cur->getComment() != "") {
- th.comment.dimensions.middle(-0.1).screenBottom(-0.12);
+ th.comment.dimensions.middle(0).screenBottom(-0.12);
th.comment.draw(cur->getComment());
}
+ m_menu.dimensions.stretch(w, h);
}
diff --git a/game/theme.cc b/game/theme.cc
index ac90a57..73b07b1 100644
--- a/game/theme.cc
+++ b/game/theme.cc
@@ -66,4 +66,5 @@ ThemeInstrumentMenu::ThemeInstrumentMenu():
//comment_bg(getThemePath("menu_comment_bg.svg"))
{
back_h.dimensions.fixedHeight(0.08f);
+ comment.setAlign(SvgTxtTheme::CENTER);
}
|
|
From: Tapio V. <aa...@us...> - 2010-08-21 18:03:50
|
Module: performous
Branch: master
Commit: 97e4b9531588305391ac7ae56e248b23c8250b75
Author: Tapio Vierros <tap...@gm...>
Date: Mon Aug 2 18:59:26 2010 +0300
Hide lyrics and instrument "cursor" when menu is open (overlap with menu comments).
---
game/guitargraph.cc | 30 ++++++++++---------
game/layout_singer.cc | 76 +++++++++++++++++++++++++------------------------
game/layout_singer.hh | 2 +
game/screen_sing.cc | 2 +
4 files changed, 59 insertions(+), 51 deletions(-)
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index 9cbd7e3..117b1dc 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -785,20 +785,22 @@ void GuitarGraph::draw(double time) {
}
// Draw the cursor
- float level = m_pressed_anim[0].get();
- glColor3f(level, level, level);
- drawBar(0.0, 0.01f);
- // Fret buttons on cursor
- for (int fret = m_drums; fret < m_pads; ++fret) {
- float x = getFretX(fret);
- float l = m_pressed_anim[fret + !m_drums].get();
- // Get a color for the fret and adjust it if GodMode is on
- glColor4fv(colorize(color(fret), time));
- m_button.dimensions.center(time2y(0.0)).middle(x);
- m_button.draw();
- glColor3f(l, l, l);
- m_tap.dimensions = m_button.dimensions;
- m_tap.draw();
+ if (!menuOpen()) {
+ float level = m_pressed_anim[0].get();
+ glColor3f(level, level, level);
+ drawBar(0.0, 0.01f);
+ // Fret buttons on cursor
+ for (int fret = m_drums; fret < m_pads; ++fret) {
+ float x = getFretX(fret);
+ float l = m_pressed_anim[fret + !m_drums].get();
+ // Get a color for the fret and adjust it if GodMode is on
+ glColor4fv(colorize(color(fret), time));
+ m_button.dimensions.center(time2y(0.0)).middle(x);
+ m_button.draw();
+ glColor3f(l, l, l);
+ m_tap.dimensions = m_button.dimensions;
+ m_tap.draw();
+ }
}
// Draw the notes
diff --git a/game/layout_singer.cc b/game/layout_singer.cc
index 0419a93..02ec959 100644
--- a/game/layout_singer.cc
+++ b/game/layout_singer.cc
@@ -9,7 +9,7 @@
#include <boost/format.hpp>
LayoutSinger::LayoutSinger(VocalTrack& vocals, Database& database, boost::shared_ptr<ThemeSing> theme):
- m_vocals(vocals), m_noteGraph(vocals),m_lyricit(vocals.notes.begin()), m_lyrics(), m_database(database), m_theme(theme) {
+ m_vocals(vocals), m_noteGraph(vocals),m_lyricit(vocals.notes.begin()), m_lyrics(), m_database(database), m_theme(theme), m_hideLyrics() {
m_score_text[0].reset(new SvgTxtThemeSimple(getThemePath("sing_score_text.svg"), config["graphic/text_lod"].f()));
m_score_text[1].reset(new SvgTxtThemeSimple(getThemePath("sing_score_text.svg"), config["graphic/text_lod"].f()));
m_score_text[2].reset(new SvgTxtThemeSimple(getThemePath("sing_score_text.svg"), config["graphic/text_lod"].f()));
@@ -103,43 +103,45 @@ void LayoutSinger::draw(double time, Position position) {
}
// Draw the lyrics
- double linespacing = 0.0;
- Dimensions pos;
- switch(position) {
- case LayoutSinger::BOTTOM: // Fullscreen
- pos.screenBottom(-0.1);
- linespacing = 0.06;
- break;
- case LayoutSinger::MIDDLE: // Band mode
- pos.center(-0.05);
- linespacing = 0.04;
- break;
- case LayoutSinger::LEFT:
- case LayoutSinger::RIGHT:
- pos.screenBottom(-0.1);
- linespacing = 0.06;
- break;
- }
- bool dirty;
- do {
- dirty = false;
- if (!m_lyrics.empty() && m_lyrics[0].expired(time)) {
- // Add extra spacing to replace the removed row
- if (m_lyrics.size() > 1) m_lyrics[1].extraspacing.move(m_lyrics[0].extraspacing.get() + 1.0);
- m_lyrics.pop_front();
- dirty = true;
- }
- if (!dirty && m_lyricit != m_vocals.notes.end() && m_lyricit->begin < time + 4.0) {
- m_lyrics.push_back(LyricRow(m_lyricit, m_vocals.notes.end()));
- dirty = true;
+ if (!m_hideLyrics) {
+ double linespacing = 0.0;
+ Dimensions pos;
+ switch(position) {
+ case LayoutSinger::BOTTOM: // Fullscreen
+ pos.screenBottom(-0.1);
+ linespacing = 0.06;
+ break;
+ case LayoutSinger::MIDDLE: // Band mode
+ pos.center(-0.05);
+ linespacing = 0.04;
+ break;
+ case LayoutSinger::LEFT:
+ case LayoutSinger::RIGHT:
+ pos.screenBottom(-0.1);
+ linespacing = 0.06;
+ break;
}
- } while (dirty);
- if (m_theme.get()) // if there is a theme, draw the lyrics with it
- {
- for (size_t i = 0; i < m_lyrics.size(); ++i, pos.move(0.0, linespacing)) {
- pos.move(0.0, m_lyrics[i].extraspacing.get() * linespacing);
- if (i == 0) m_lyrics[0].draw(m_theme->lyrics_now, time, pos);
- else if (i == 1 && position == LayoutSinger::BOTTOM) m_lyrics[1].draw(m_theme->lyrics_next, time, pos);
+ bool dirty;
+ do {
+ dirty = false;
+ if (!m_lyrics.empty() && m_lyrics[0].expired(time)) {
+ // Add extra spacing to replace the removed row
+ if (m_lyrics.size() > 1) m_lyrics[1].extraspacing.move(m_lyrics[0].extraspacing.get() + 1.0);
+ m_lyrics.pop_front();
+ dirty = true;
+ }
+ if (!dirty && m_lyricit != m_vocals.notes.end() && m_lyricit->begin < time + 4.0) {
+ m_lyrics.push_back(LyricRow(m_lyricit, m_vocals.notes.end()));
+ dirty = true;
+ }
+ } while (dirty);
+ if (m_theme.get()) // if there is a theme, draw the lyrics with it
+ {
+ for (size_t i = 0; i < m_lyrics.size(); ++i, pos.move(0.0, linespacing)) {
+ pos.move(0.0, m_lyrics[i].extraspacing.get() * linespacing);
+ if (i == 0) m_lyrics[0].draw(m_theme->lyrics_now, time, pos);
+ else if (i == 1 && position == LayoutSinger::BOTTOM) m_lyrics[1].draw(m_theme->lyrics_next, time, pos);
+ }
}
}
diff --git a/game/layout_singer.hh b/game/layout_singer.hh
index 68a74a4..a2fbceb 100644
--- a/game/layout_singer.hh
+++ b/game/layout_singer.hh
@@ -56,6 +56,7 @@ class LayoutSinger {
void draw(double time, Position position = LayoutSinger::BOTTOM);
void drawScore(Position position);
double lyrics_begin();
+ void hideLyrics(bool hide = true) { m_hideLyrics = hide; };
private:
VocalTrack& m_vocals;
NoteGraph m_noteGraph;
@@ -67,4 +68,5 @@ class LayoutSinger {
Database& m_database;
boost::shared_ptr<ThemeSing> m_theme;
AnimValue m_feedbackFader;
+ bool m_hideLyrics;
};
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index eedfdbb..25a2d34 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -402,6 +402,8 @@ void ScreenSing::draw() {
theme->bg_top.draw();
}
+ m_layout_singer->hideLyrics(m_audio.isPaused());
+
// Dancing
if( !m_dancers.empty() ) {
danceLayout(time);
|
|
From: Tapio V. <aa...@us...> - 2010-08-21 18:03:48
|
Module: performous
Branch: master
Commit: 78d1f9ff3c756e4bef94b2fbd74f1297132f4743
Author: Tapio Vierros <tap...@gm...>
Date: Mon Aug 2 18:48:59 2010 +0300
Calculate instrument menu background size better.
---
game/instrumentgraph.cc | 13 +++++++------
game/opengl_text.cc | 18 +++++++++---------
game/opengl_text.hh | 6 ++++++
game/screen_sing.cc | 11 ++++++-----
4 files changed, 28 insertions(+), 20 deletions(-)
diff --git a/game/instrumentgraph.cc b/game/instrumentgraph.cc
index 2177dde..76e5455 100644
--- a/game/instrumentgraph.cc
+++ b/game/instrumentgraph.cc
@@ -59,15 +59,16 @@ void InstrumentGraph::drawMenu() {
Dimensions dimensions(1.0); // FIXME: bogus aspect ratio (is this fixable?)
if (getGraphType() == input::DANCEPAD) dimensions.screenTop().middle(m_cx.get()).stretch(m_width.get(), 1.0);
else dimensions.screenBottom().middle(m_cx.get()).fixedWidth(std::min(m_width.get(),0.5));
- double offsetX = 0.5 * (dimensions.x1() + dimensions.x2());
- float step = 0.05;
- float y = -0.6 * m_menu.getOptions().size() * step;
- float h = m_menu.getOptions().size() * step + step;
// Some helper vars
ThemeInstrumentMenu& th = *m_menuTheme;
MenuOptions::const_iterator cur = static_cast<MenuOptions::const_iterator>(&m_menu.current());
+ const double offsetX = 0.5f * (dimensions.x1() + dimensions.x2());
+ const float txth = th.option.h();
+ const float step = txth * 0.7f;
+ const float h = m_menu.getOptions().size() * step + step;
+ float y = -h * .5f + step;
// Background
- th.bg.dimensions.middle(.05 + offsetX).center((y+step)*.5).stretch(.45, h);
+ th.bg.dimensions.middle(.05 + offsetX).center(0).stretch(.45, h);
th.bg.draw();
// Loop through menu items
for (MenuOptions::const_iterator it = m_menu.begin(); it != m_menu.end(); ++it) {
@@ -84,7 +85,7 @@ void InstrumentGraph::drawMenu() {
if (cur->getComment() != "") {
//th.comment_bg.dimensions.middle().screenBottom(-0.2);
//th.comment_bg.draw();
- th.comment.dimensions.middle(-0.1 + offsetX).screenBottom(-0.22);
+ th.comment.dimensions.middle(-0.1 + offsetX).screenBottom(-0.12);
th.comment.draw(cur->getComment());
}
}
diff --git a/game/opengl_text.cc b/game/opengl_text.cc
index 290d572..d46d3b3 100644
--- a/game/opengl_text.cc
+++ b/game/opengl_text.cc
@@ -219,27 +219,27 @@ void SvgTxtTheme::draw(std::vector<TZoomText> const& _text, float alpha) {
}
double text_x = 0.0;
double text_y = 0.0;
- // first compute maximum height and whole length
+ // First compute maximum height and whole length
for (unsigned int i = 0; i < _text.size(); i++ ) {
text_x += m_opengl_text[i].x();
text_y = std::max(text_y, m_opengl_text[i].y());
}
- double texture_ar = text_x/text_y;
- double texture_width = std::min(0.96, text_x/800.);
- double texture_height = texture_width / texture_ar;
+ double texture_ar = text_x / text_y;
+ m_texture_width = std::min(0.96, text_x/800.);
+ m_texture_height = m_texture_width / texture_ar;
double position_x = dimensions.x1();
- if (m_align == CENTER) position_x -= 0.5 * texture_width;
- if (m_align == RIGHT) position_x -= texture_width;
+ if (m_align == CENTER) position_x -= 0.5 * m_texture_width;
+ if (m_align == RIGHT) position_x -= m_texture_width;
for (unsigned int i = 0; i < _text.size(); i++ ) {
double syllable_x = m_opengl_text[i].x();
- double syllable_width = syllable_x * texture_width / text_x;
- double syllable_height = texture_height;
+ double syllable_width = syllable_x * m_texture_width / text_x;
+ double syllable_height = m_texture_height;
double syllable_ar = syllable_width / syllable_height;
Dimensions dim(syllable_ar);
- dim.fixedHeight(texture_height).center(dimensions.y1());
+ dim.fixedHeight(m_texture_height).center(dimensions.y1());
dim.middle(position_x + 0.5 * dim.w());
TexCoords tex;
double factor = _text[i].factor;
diff --git a/game/opengl_text.hh b/game/opengl_text.hh
index 4130fde..0a74b05 100644
--- a/game/opengl_text.hh
+++ b/game/opengl_text.hh
@@ -149,6 +149,10 @@ class SvgTxtTheme {
void draw(std::string _text, float alpha = 1.0f);
/// sets highlight
void setHighlight(std::string _theme_file);
+ /// width
+ double w() const { return m_texture_width; }
+ /// height
+ double h() const { return m_texture_height; }
private:
boost::ptr_vector<OpenGLText> m_opengl_text;
@@ -158,6 +162,8 @@ class SvgTxtTheme {
double m_width;
double m_height;
double m_factor;
+ double m_texture_width;
+ double m_texture_height;
std::string m_cache_text;
TThemeTxtOpenGL m_text;
TThemeTxtOpenGL m_text_highlight;
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index 0fb6dd9..eedfdbb 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -483,14 +483,15 @@ void ScreenSing::draw() {
void ScreenSing::drawMenu() {
if (m_menu.empty()) return;
- float step = 0.075;
- float y = -0.6 * m_menu.getOptions().size() * step;
- float h = m_menu.getOptions().size() * step + step;
// Some helper vars
ThemeInstrumentMenu& th = *m_menuTheme;
MenuOptions::const_iterator cur = static_cast<MenuOptions::const_iterator>(&m_menu.current());
+ const float txth = th.option.h();
+ const float step = txth * 0.85f;
+ const float h = m_menu.getOptions().size() * step + step;
+ float y = -h * .5f + step;
// Background
- th.bg.dimensions.middle(.05).center((y+step)*.5).stretch(.45, h);
+ th.bg.dimensions.middle(.05).center(0).stretch(.45, h);
th.bg.draw();
// Loop through menu items
for (MenuOptions::const_iterator it = m_menu.begin(); it != m_menu.end(); ++it) {
@@ -503,7 +504,7 @@ void ScreenSing::drawMenu() {
y += step;
}
if (cur->getComment() != "") {
- th.comment.dimensions.middle(-0.1).screenBottom(-0.22);
+ th.comment.dimensions.middle(-0.1).screenBottom(-0.12);
th.comment.draw(cur->getComment());
}
}
|
|
From: Tapio V. <aa...@us...> - 2010-08-21 18:03:45
|
Module: performous Branch: master Commit: 326198c0e6666254578a5c862ddc2e8368dd181f Author: Tapio Vierros <tap...@gm...> Date: Sat Jul 17 00:03:52 2010 +0300 Update theme file changes to nsis uninstall. --- win32/setup.nsi | 23 ++++++++++++++--------- 1 files changed, 14 insertions(+), 9 deletions(-) diff --git a/win32/setup.nsi b/win32/setup.nsi index 1c05a35..36eb0ee 100644 --- a/win32/setup.nsi +++ b/win32/setup.nsi @@ -337,22 +337,27 @@ Section Uninstall Delete "$INSTDIR\themes\default\neck_glow.svg" Delete "$INSTDIR\themes\default\mine.svg" Delete "$INSTDIR\themes\default\message_text.svg" - Delete "$INSTDIR\themes\default\menu_short_comment.svg" - Delete "$INSTDIR\themes\default\menu_scomment_bg.svg" - Delete "$INSTDIR\themes\default\menu_option_selected.svg" - Delete "$INSTDIR\themes\default\menu_option.svg" - Delete "$INSTDIR\themes\default\menu_comment_bg.svg" - Delete "$INSTDIR\themes\default\menu_comment.svg" - Delete "$INSTDIR\themes\default\menu_back_highlight.svg" Delete "$INSTDIR\themes\default\menu.ogg" + Delete "$INSTDIR\themes\default\mainmenu_back_highlight.svg" + Delete "$INSTDIR\themes\default\mainmenu_comment.svg" + Delete "$INSTDIR\themes\default\mainmenu_comment_bg.svg" + Delete "$INSTDIR\themes\default\mainmenu_option.svg" + Delete "$INSTDIR\themes\default\mainmenu_option_selected.svg" + Delete "$INSTDIR\themes\default\mainmenu_scomment_bg.svg" + Delete "$INSTDIR\themes\default\mainmenu_short_comment.svg" Delete "$INSTDIR\themes\default\intro_sing.svg" Delete "$INSTDIR\themes\default\intro_quit.svg" Delete "$INSTDIR\themes\default\intro_practice.svg" Delete "$INSTDIR\themes\default\intro_configure.svg" Delete "$INSTDIR\themes\default\intro_bg.svg" - Delete "$INSTDIR\themes\default\instruments.svg" - Delete "$INSTDIR\themes\default\instrumenthelp.svg" Delete "$INSTDIR\themes\default\instrument_cover.svg" + Delete "$INSTDIR\themes\default\instrumenthelp.svg" + Delete "$INSTDIR\themes\default\instrumentmenu_back_highlight.svg" + Delete "$INSTDIR\themes\default\instrumentmenu_bg.svg" + Delete "$INSTDIR\themes\default\instrumentmenu_comment.svg" + Delete "$INSTDIR\themes\default\instrumentmenu_option.svg" + Delete "$INSTDIR\themes\default\instrumentmenu_option_selected.svg" + Delete "$INSTDIR\themes\default\instruments.svg" Delete "$INSTDIR\themes\default\icon.svg" Delete "$INSTDIR\themes\default\icon.png" Delete "$INSTDIR\themes\default\icon.bmp" |
|
From: Tapio V. <aa...@us...> - 2010-08-21 18:03:43
|
Module: performous
Branch: master
Commit: 94319ff930e7384f4776fce3fe233151f848772a
Author: Tapio Vierros <tap...@gm...>
Date: Fri Jul 16 21:32:23 2010 +0300
Hack together a crude background for menus.
---
game/instrumentgraph.cc | 4 ++
game/screen_sing.cc | 4 ++
game/theme.cc | 2 +-
themes/default/instrumentmenu_bg.svg | 81 ++++++++++++++++++++++++++++++++++
win32/setup.nsi | 1 +
5 files changed, 91 insertions(+), 1 deletions(-)
diff --git a/game/instrumentgraph.cc b/game/instrumentgraph.cc
index 1ac25ab..2177dde 100644
--- a/game/instrumentgraph.cc
+++ b/game/instrumentgraph.cc
@@ -62,9 +62,13 @@ void InstrumentGraph::drawMenu() {
double offsetX = 0.5 * (dimensions.x1() + dimensions.x2());
float step = 0.05;
float y = -0.6 * m_menu.getOptions().size() * step;
+ float h = m_menu.getOptions().size() * step + step;
// Some helper vars
ThemeInstrumentMenu& th = *m_menuTheme;
MenuOptions::const_iterator cur = static_cast<MenuOptions::const_iterator>(&m_menu.current());
+ // Background
+ th.bg.dimensions.middle(.05 + offsetX).center((y+step)*.5).stretch(.45, h);
+ th.bg.draw();
// Loop through menu items
for (MenuOptions::const_iterator it = m_menu.begin(); it != m_menu.end(); ++it) {
SvgTxtTheme* txt = &th.option;
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index a367263..0fb6dd9 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -485,9 +485,13 @@ void ScreenSing::drawMenu() {
if (m_menu.empty()) return;
float step = 0.075;
float y = -0.6 * m_menu.getOptions().size() * step;
+ float h = m_menu.getOptions().size() * step + step;
// Some helper vars
ThemeInstrumentMenu& th = *m_menuTheme;
MenuOptions::const_iterator cur = static_cast<MenuOptions::const_iterator>(&m_menu.current());
+ // Background
+ th.bg.dimensions.middle(.05).center((y+step)*.5).stretch(.45, h);
+ th.bg.draw();
// Loop through menu items
for (MenuOptions::const_iterator it = m_menu.begin(); it != m_menu.end(); ++it) {
SvgTxtTheme* txt = &th.option;
diff --git a/game/theme.cc b/game/theme.cc
index a70e5fd..ac90a57 100644
--- a/game/theme.cc
+++ b/game/theme.cc
@@ -58,7 +58,7 @@ ThemeIntro::ThemeIntro():
}
ThemeInstrumentMenu::ThemeInstrumentMenu():
- Theme(getThemePath("warning.svg")),
+ Theme(getThemePath("instrumentmenu_bg.svg")),
back_h(getThemePath("instrumentmenu_back_highlight.svg")),
option(getThemePath("instrumentmenu_option.svg"), config["graphic/text_lod"].f()),
option_selected(getThemePath("instrumentmenu_option_selected.svg"), config["graphic/text_lod"].f()),
diff --git a/themes/default/instrumentmenu_bg.svg b/themes/default/instrumentmenu_bg.svg
new file mode 100644
index 0000000..248fe4e
--- /dev/null
+++ b/themes/default/instrumentmenu_bg.svg
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="300"
+ height="400"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.47 r22583"
+ version="1.0"
+ sodipodi:docname="instrumentmenu_bg.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs4">
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ id="perspective10" />
+ <inkscape:perspective
+ id="perspective2963"
+ inkscape:persp3d-origin="88 : 58.666667 : 1"
+ inkscape:vp_z="176 : 88 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_x="0 : 88 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="0.98994949"
+ inkscape:cx="55.32752"
+ inkscape:cy="231.31119"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:window-width="1313"
+ inkscape:window-height="722"
+ inkscape:window-x="0"
+ inkscape:window-y="25"
+ inkscape:window-maximized="0" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Calque 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(0,80)">
+ <rect
+ style="fill:#ffffff;fill-opacity:0.66810346;stroke:#000000;stroke-width:1.50000000000000000;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ id="rect2383"
+ width="278.5"
+ height="378.5"
+ x="10.75"
+ y="-69.25"
+ rx="31.357962"
+ ry="55.004662" />
+ </g>
+</svg>
diff --git a/win32/setup.nsi b/win32/setup.nsi
index 41c59e0..1c05a35 100644
--- a/win32/setup.nsi
+++ b/win32/setup.nsi
@@ -168,6 +168,7 @@ Section "SezionePrincipale" SEC01
File "${FILES_PATH}\themes\default\instrument_cover.svg"
File "${FILES_PATH}\themes\default\instrumenthelp.svg"
File "${FILES_PATH}\themes\default\instrumentmenu_back_highlight.svg"
+ File "${FILES_PATH}\themes\default\instrumentmenu_bg.svg"
File "${FILES_PATH}\themes\default\instrumentmenu_comment.svg"
File "${FILES_PATH}\themes\default\instrumentmenu_option.svg"
File "${FILES_PATH}\themes\default\instrumentmenu_option_selected.svg"
|
|
From: Tapio V. <aa...@us...> - 2010-08-21 18:03:40
|
Module: performous
Branch: master
Commit: f7b863c50411638e1463514c3982963614afa829
Author: Tapio Vierros <tap...@gm...>
Date: Fri Jul 16 21:03:06 2010 +0300
Implement song restart.
---
game/instrumentgraph.cc | 3 +--
game/instrumentgraph.hh | 1 -
2 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/game/instrumentgraph.cc b/game/instrumentgraph.cc
index 7a5f599..1ac25ab 100644
--- a/game/instrumentgraph.cc
+++ b/game/instrumentgraph.cc
@@ -8,8 +8,7 @@
void InstrumentGraph::setupPauseMenu(Menu& menu) {
menu.clear();
menu.add(MenuOption(_("Resume"), _("Back to performing!")));
- //TODO: Implement restart
- //menu.add(MenuOption(_("Restart"), _("Start the song\nfrom the beginning")));
+ menu.add(MenuOption(_("Restart"), _("Start the song\nfrom the beginning"), "Sing"));
menu.add(MenuOption(_("Quit"), _("Exit to song browser"), "Songs"));
}
diff --git a/game/instrumentgraph.hh b/game/instrumentgraph.hh
index 8454123..0489814 100644
--- a/game/instrumentgraph.hh
+++ b/game/instrumentgraph.hh
@@ -81,7 +81,6 @@ class InstrumentGraph {
void drawMenu();
void toggleMenu(int forcestate = -1); // 0 = close, 1 = open, -1 = auto/toggle
void togglePause(int) { m_audio.togglePause(); }
- void restart(int) { /* TODO: Implement */ }
void quit(int) { ScreenManager::getSingletonPtr()->activateScreen("Songs"); }
std::string noValue() const { return ""; }
|
|
From: Tapio V. <aa...@us...> - 2010-08-21 18:03:38
|
Module: performous
Branch: master
Commit: cb849b0288532bc58dcb80effccbf4b744ec6f7d
Author: Tapio Vierros <tap...@gm...>
Date: Fri Jul 16 20:53:35 2010 +0300
Fix instruments not being allowed to open their pause menus.
---
game/screen_sing.cc | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index 4998506..a367263 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -367,13 +367,15 @@ void ScreenSing::draw() {
// Menu mangling
// We don't allow instrument menus during global menu
// except for joining, in which case global menu is closed
- for (Instruments::iterator it = m_instruments.begin(); it != m_instruments.end(); ++it) {
- if (!it->dead() && !it->joining(time)) it->toggleMenu(0);
- else if (!it->dead() && it->joining(time)) m_menu.close();
- }
- for (Dancers::iterator it = m_dancers.begin(); it != m_dancers.end(); ++it) {
- if (!it->dead() && !it->joining(time)) it->toggleMenu(0);
- else if (!it->dead() && it->joining(time)) m_menu.close();
+ if (m_menu.isOpen()) {
+ for (Instruments::iterator it = m_instruments.begin(); it != m_instruments.end(); ++it) {
+ if (!it->dead() && !it->joining(time)) it->toggleMenu(0);
+ else if (!it->dead() && it->joining(time)) m_menu.close();
+ }
+ for (Dancers::iterator it = m_dancers.begin(); it != m_dancers.end(); ++it) {
+ if (!it->dead() && !it->joining(time)) it->toggleMenu(0);
+ else if (!it->dead() && it->joining(time)) m_menu.close();
+ }
}
// Rendering starts
|
|
From: Tapio V. <aa...@us...> - 2010-08-21 18:03:36
|
Module: performous
Branch: master
Commit: 6bce9101c6b3981354a38d91ffd82d7b759af3fe
Author: Tapio Vierros <tap...@gm...>
Date: Fri Jul 16 20:49:44 2010 +0300
Make setupPauseMenu() static member function used everywhere.
---
game/instrumentgraph.cc | 21 +++++++++++----------
game/instrumentgraph.hh | 3 ++-
game/screen_sing.cc | 8 +++-----
game/screen_sing.hh | 2 --
4 files changed, 16 insertions(+), 18 deletions(-)
diff --git a/game/instrumentgraph.cc b/game/instrumentgraph.cc
index 5d147a2..7a5f599 100644
--- a/game/instrumentgraph.cc
+++ b/game/instrumentgraph.cc
@@ -4,6 +4,16 @@
//const unsigned InstrumentGraph::max_panels = 10; // Maximum number of arrow lines / guitar frets
+
+void InstrumentGraph::setupPauseMenu(Menu& menu) {
+ menu.clear();
+ menu.add(MenuOption(_("Resume"), _("Back to performing!")));
+ //TODO: Implement restart
+ //menu.add(MenuOption(_("Restart"), _("Start the song\nfrom the beginning")));
+ menu.add(MenuOption(_("Quit"), _("Exit to song browser"), "Songs"));
+}
+
+
InstrumentGraph::InstrumentGraph(Audio& audio, Song const& song, input::DevType inp):
m_audio(audio), m_song(song), m_input(input::DevType(inp)),
m_stream(),
@@ -30,19 +40,10 @@ InstrumentGraph::InstrumentGraph(Audio& audio, Song const& song, input::DevType
}
-void InstrumentGraph::setupPauseMenu() {
- m_menu.clear();
- m_menu.add(MenuOption(_("Resume"), _("Back to performing!")));
- // TODO: Implement restart
- //m_menu.add(MenuOption(_("Restart"), _("Start the song\nfrom the beginning")));
- m_menu.add(MenuOption(_("Quit"), _("Exit to song browser"), "Songs"));
-}
-
-
void InstrumentGraph::doUpdates() {
if (!menuOpen() && !m_ready) {
m_ready = true;
- setupPauseMenu();
+ setupPauseMenu(m_menu);
}
}
diff --git a/game/instrumentgraph.hh b/game/instrumentgraph.hh
index a0f85ea..8454123 100644
--- a/game/instrumentgraph.hh
+++ b/game/instrumentgraph.hh
@@ -62,6 +62,8 @@ class Song;
class InstrumentGraph {
public:
+ static void setupPauseMenu(Menu& menu);
+
/// Constructor
InstrumentGraph(Audio& audio, Song const& song, input::DevType inp);
@@ -117,7 +119,6 @@ class InstrumentGraph {
Menu m_menu;
// Shared functions for derived classes
- void setupPauseMenu();
void drawPopups(double offsetX);
void handleCountdown(double time, double beginTime);
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index 3086eb8..4998506 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -9,6 +9,7 @@
#include "database.hh"
#include "video.hh"
#include "guitargraph.hh"
+#include "dancegraph.hh"
#include "glutil.hh"
#include "i18n.hh"
#include "menu.hh"
@@ -111,11 +112,7 @@ void ScreenSing::enter() {
// Populate the pause menu
// TODO: Refactor this menu population to static
// function that instrumentgraph can also use
- m_menu.clear();
- m_menu.add(MenuOption(_("Resume"), _("Back to performing!")));
- // TODO: Implement restart
- //m_menu.add(MenuOption(_("Restart"), _("Start the song\nfrom the beginning")));
- m_menu.add(MenuOption(_("Quit"), _("Exit to song browser"), "Songs"));
+ InstrumentGraph::setupPauseMenu(m_menu);
m_menu.close();
// Startup delay for instruments is longer than for singing only
double setup_delay = (m_instruments.empty() && m_dancers.empty() ? -1.0 : -3.0);
@@ -123,6 +120,7 @@ void ScreenSing::enter() {
m_engine.reset(new Engine(m_audio, m_song->vocals, analyzers.begin(), analyzers.end(), m_database));
}
+
/// Manages the instrument drawing
/// Returns false if no instuments are alive
bool ScreenSing::instrumentLayout(double time) {
diff --git a/game/screen_sing.hh b/game/screen_sing.hh
index a8064e2..93b3cc8 100644
--- a/game/screen_sing.hh
+++ b/game/screen_sing.hh
@@ -7,8 +7,6 @@
#include "animvalue.hh"
#include "engine.hh"
#include "instrumentgraph.hh"
-#include "guitargraph.hh"
-#include "dancegraph.hh"
#include "screen.hh"
#include "backgrounds.hh"
#include "theme.hh"
|
|
From: Tapio V. <aa...@us...> - 2010-08-21 18:03:34
|
Module: performous
Branch: master
Commit: c815cde3dff0e33cea4c003f980957f2b43c5fe9
Author: Tapio Vierros <tap...@gm...>
Date: Fri Jul 16 20:28:32 2010 +0300
Draw instrument menus on top of everything.
---
game/dancegraph.cc | 7 ++-----
game/guitargraph.cc | 6 ++----
game/instrumentgraph.cc | 6 +++++-
game/instrumentgraph.hh | 4 +++-
game/joystick.hh | 4 +++-
game/screen_sing.cc | 6 +++++-
6 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/game/dancegraph.cc b/game/dancegraph.cc
index e823614..62bb261 100644
--- a/game/dancegraph.cc
+++ b/game/dancegraph.cc
@@ -17,7 +17,7 @@ namespace {
static const int mapping10[max_panels]= {0, 3, 4, 7, 1, 6, 2, 5,-1,-1};
const std::string diffv[] = { "Beginner", "Easy", "Medium", "Hard", "Challenge" };
const int death_delay = 25; // Delay in notes after which the player is hidden
- const float join_delay = 7.0f; // Time to select track/difficulty when joining mid-game
+ const float join_delay = 3.0f; // Time after join menu before playing when joining mid-game
const float past = -0.3f; // Relative time from cursor that is considered past (out of screen)
const float future = 2.0f; // Relative time from cursor that is considered future (out of screen)
const float timescale = 12.0f; // Multiplier to get graphics units from time
@@ -534,10 +534,7 @@ void DanceGraph::drawNote(DanceNote& note, double time) {
/// Draw popups and other info texts
void DanceGraph::drawInfo(double time, double offsetX, Dimensions dimensions) {
- if (menuOpen()) {
- // Draw join menu
- drawMenu(offsetX);
- } else {
+ if (!menuOpen()) {
// Draw scores
m_text.dimensions.screenBottom(-0.35).middle(0.32 * dimensions.w() + offsetX);
m_text.draw(boost::lexical_cast<std::string>(unsigned(getScore())));
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index 0fe015f..9cbd7e3 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -20,7 +20,7 @@ namespace {
};
const size_t diffsz = sizeof(diffv) / sizeof(*diffv);
const int death_delay = 20; // Delay in notes after which the player is hidden
- const float join_delay = 6.0f; // Time to select track/difficulty when joining mid-game
+ const float join_delay = 3.0f; // Time after join menu before playing when joining mid-game
const float g_angle = 80.0f; // How much to rotate the fretboards
const float past = -0.2f; // Relative time from cursor that is considered past (out of screen)
const float future = 1.5f; // Relative time from cursor that is considered future (out of screen)
@@ -1055,9 +1055,7 @@ void GuitarGraph::drawDrumfill(float tBeg, float tEnd) {
/// Draw popups and other info texts
void GuitarGraph::drawInfo(double time, double offsetX, Dimensions dimensions) {
// Draw info
- if (menuOpen()) {
- drawMenu(offsetX);
- } else {
+ if (!menuOpen()) {
float xcor = 0.35 * dimensions.w();
float h = 0.075 * 2.0 * dimensions.w();
// Hack to show the scores better when there is more space (1 instrument)
diff --git a/game/instrumentgraph.cc b/game/instrumentgraph.cc
index cf40301..5d147a2 100644
--- a/game/instrumentgraph.cc
+++ b/game/instrumentgraph.cc
@@ -54,8 +54,12 @@ void InstrumentGraph::toggleMenu(int forcestate) {
}
-void InstrumentGraph::drawMenu(double offsetX) {
+void InstrumentGraph::drawMenu() {
if (m_menu.empty()) return;
+ Dimensions dimensions(1.0); // FIXME: bogus aspect ratio (is this fixable?)
+ if (getGraphType() == input::DANCEPAD) dimensions.screenTop().middle(m_cx.get()).stretch(m_width.get(), 1.0);
+ else dimensions.screenBottom().middle(m_cx.get()).fixedWidth(std::min(m_width.get(),0.5));
+ double offsetX = 0.5 * (dimensions.x1() + dimensions.x2());
float step = 0.05;
float y = -0.6 * m_menu.getOptions().size() * step;
// Some helper vars
diff --git a/game/instrumentgraph.hh b/game/instrumentgraph.hh
index c2f68dc..a0f85ea 100644
--- a/game/instrumentgraph.hh
+++ b/game/instrumentgraph.hh
@@ -74,7 +74,9 @@ class InstrumentGraph {
virtual void changeTrack(int dir = 1) = 0;
virtual void changeDifficulty(int dir = 1) = 0;
+ // General shared functions
void doUpdates();
+ void drawMenu();
void toggleMenu(int forcestate = -1); // 0 = close, 1 = open, -1 = auto/toggle
void togglePause(int) { m_audio.togglePause(); }
void restart(int) { /* TODO: Implement */ }
@@ -89,6 +91,7 @@ class InstrumentGraph {
unsigned stream() const { return m_stream; }
double correctness() const { return m_correctness.get(); }
int getScore() const { return (m_score > 0 ? m_score : 0) * m_scoreFactor; }
+ input::DevType getGraphType() const { return m_input.getDevType(); }
protected:
// Core stuff
@@ -115,7 +118,6 @@ class InstrumentGraph {
// Shared functions for derived classes
void setupPauseMenu();
- void drawMenu(double offsetX);
void drawPopups(double offsetX);
void handleCountdown(double time, double beginTime);
diff --git a/game/joystick.hh b/game/joystick.hh
index 09fccd1..294e16d 100644
--- a/game/joystick.hh
+++ b/game/joystick.hh
@@ -124,7 +124,7 @@ namespace input {
// First gives a correct instrument type
// Then gives an unknown instrument type
// Finally throw an exception if only wrong (or none) instrument are available
- InputDev(DevType _type) {
+ InputDev(DevType _type): m_dev_type(_type) {
for (detail::InputDevs::iterator it = detail::devices.begin() ; it != detail::devices.end() ; ++it) {
if (it->first == detail::KEYBOARD_ID && !config["game/keyboard_guitar"].b()) continue;
if (it->first == detail::KEYBOARD_ID2 && !config["game/keyboard_drumkit"].b()) continue;
@@ -144,8 +144,10 @@ namespace input {
void addEvent(Event _e) { detail::devices.find(m_device_id)->second.addEvent(_e); };
bool pressed(int _button) { return detail::devices.find(m_device_id)->second.pressed(_button); }; // Current state
bool isKeyboard() const { return (m_device_id == detail::KEYBOARD_ID || m_device_id == detail::KEYBOARD_ID2 || m_device_id == detail::KEYBOARD_ID3); };
+ DevType getDevType() const { return m_dev_type; }
private:
unsigned int m_device_id; // should be some kind of reference
+ DevType m_dev_type;
};
namespace SDL {
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index b96f840..3086eb8 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -472,7 +472,11 @@ void ScreenSing::draw() {
}
}
- // Draw menu
+ // Menus on top of everything
+ for (Instruments::iterator it = m_instruments.begin(); it != m_instruments.end(); ++it)
+ if (!it->dead() && it->menuOpen()) it->drawMenu();
+ for (Dancers::iterator it = m_dancers.begin(); it != m_dancers.end(); ++it)
+ if (!it->dead() && it->menuOpen()) it->drawMenu();
if (m_menu.isOpen()) drawMenu();
}
|
|
From: Tapio V. <aa...@us...> - 2010-08-21 18:03:33
|
Module: performous
Branch: master
Commit: 0988ac618fea42eea1955aeebe3e5600a63341a1
Author: Tapio Vierros <tap...@gm...>
Date: Fri Jul 16 19:37:26 2010 +0300
"Singer" pause menu.
Behaviour:
1) Esc at the very beginning of the song insta-quits
2) Esc during normal gameplay opens the "singer" pause menu
3) Instrument joining during singer pause menu quits it
4) Esc during instrument menu does nothing
---
game/instrumentgraph.cc | 6 ++-
game/instrumentgraph.hh | 4 +-
game/screen_sing.cc | 83 ++++++++++++++++++++++++++++++++++++++++++----
game/screen_sing.hh | 4 ++
4 files changed, 85 insertions(+), 12 deletions(-)
diff --git a/game/instrumentgraph.cc b/game/instrumentgraph.cc
index ce67f74..cf40301 100644
--- a/game/instrumentgraph.cc
+++ b/game/instrumentgraph.cc
@@ -16,6 +16,7 @@ InstrumentGraph::InstrumentGraph(Audio& audio, Song const& song, input::DevType
m_correctness(0.0, 5.0),
m_score(),
m_scoreFactor(),
+ m_starmeter(),
m_streak(),
m_longestStreak(),
m_bigStreak(),
@@ -46,8 +47,9 @@ void InstrumentGraph::doUpdates() {
}
-void InstrumentGraph::toggleMenu(bool forceopen) {
- if (forceopen) { m_menu.open(); return; }
+void InstrumentGraph::toggleMenu(int forcestate) {
+ if (forcestate == 1) { m_menu.open(); return; }
+ else if (forcestate == 0) { m_menu.close(); return; }
m_menu.toggle();
}
diff --git a/game/instrumentgraph.hh b/game/instrumentgraph.hh
index 81bf524..c2f68dc 100644
--- a/game/instrumentgraph.hh
+++ b/game/instrumentgraph.hh
@@ -75,13 +75,14 @@ class InstrumentGraph {
virtual void changeDifficulty(int dir = 1) = 0;
void doUpdates();
- void toggleMenu(bool forceopen = false);
+ void toggleMenu(int forcestate = -1); // 0 = close, 1 = open, -1 = auto/toggle
void togglePause(int) { m_audio.togglePause(); }
void restart(int) { /* TODO: Implement */ }
void quit(int) { ScreenManager::getSingletonPtr()->activateScreen("Songs"); }
std::string noValue() const { return ""; }
// General getters
+ bool joining(double time) const { return time < m_jointime; }
bool ready() const { return m_ready; };
bool menuOpen() const { return m_menu.isOpen(); }
void position(double cx, double width) { m_cx.setTarget(cx); m_width.setTarget(width); }
@@ -117,7 +118,6 @@ class InstrumentGraph {
void drawMenu(double offsetX);
void drawPopups(double offsetX);
void handleCountdown(double time, double beginTime);
- bool joining(double time) const { return time < m_jointime; }
// Media
SvgTxtTheme m_text;
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index 75a0e14..b96f840 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -11,6 +11,7 @@
#include "guitargraph.hh"
#include "glutil.hh"
#include "i18n.hh"
+#include "menu.hh"
#include <boost/format.hpp>
#include <boost/lexical_cast.hpp>
@@ -35,6 +36,7 @@ void ScreenSing::enter() {
sm->flashMessage(_("Loading song..."), 0.0, 1.0, 0.5);
sm->drawFlashMessage(); sm->window().swap(); // Make loading message show
theme.reset(new ThemeSing());
+ m_menuTheme.reset(new ThemeInstrumentMenu());
// Load the rest of the song
if (m_song->loadStatus != Song::FULL) {
try { SongParser sp(*m_song); }
@@ -106,6 +108,15 @@ void ScreenSing::enter() {
}
}
}
+ // Populate the pause menu
+ // TODO: Refactor this menu population to static
+ // function that instrumentgraph can also use
+ m_menu.clear();
+ m_menu.add(MenuOption(_("Resume"), _("Back to performing!")));
+ // TODO: Implement restart
+ //m_menu.add(MenuOption(_("Restart"), _("Start the song\nfrom the beginning")));
+ m_menu.add(MenuOption(_("Quit"), _("Exit to song browser"), "Songs"));
+ m_menu.close();
// Startup delay for instruments is longer than for singing only
double setup_delay = (m_instruments.empty() && m_dancers.empty() ? -1.0 : -3.0);
m_audio.playMusic(m_song->music, false, 0.0, setup_delay);
@@ -125,7 +136,7 @@ bool ScreenSing::instrumentLayout(double time) {
}
// Handle pause
if (count_alive > 0) {
- if (count_menu == 0 && m_audio.isPaused()) m_audio.togglePause();
+ if (count_menu == 0 && m_audio.isPaused() && !m_menu.isOpen()) m_audio.togglePause();
else if (count_menu > 0 && !m_audio.isPaused()) m_audio.togglePause();
}
double iw = 1.0 / count_alive;
@@ -173,7 +184,7 @@ void ScreenSing::danceLayout(double time) {
}
// Handle pause
if (count_alive > 0) {
- if (count_menu == 0 && m_audio.isPaused()) m_audio.togglePause();
+ if (count_menu == 0 && m_audio.isPaused() && !m_menu.isOpen()) m_audio.togglePause();
else if (count_menu > 0 && !m_audio.isPaused()) m_audio.togglePause();
}
double iw = std::min(0.5, 1.0 / m_dancers.size());
@@ -194,6 +205,7 @@ void ScreenSing::danceLayout(double time) {
void ScreenSing::exit() {
m_score_window.reset();
+ m_menu.clear();
m_instruments.clear();
m_dancers.clear();
m_layout_singer.reset();
@@ -204,6 +216,7 @@ void ScreenSing::exit() {
m_video.reset();
m_background.reset();
m_song->dropNotes();
+ m_menuTheme.reset();
theme.reset();
if (m_audio.isPaused()) m_audio.togglePause();
}
@@ -235,7 +248,6 @@ void ScreenSing::manageEvent(SDL_Event event) {
// Handle keys
if (nav != input::NONE) {
m_quitTimer.setValue(QUIT_TIMEOUT);
- if (nav == input::PAUSE) m_audio.togglePause();
// When score window is displayed
if (m_score_window.get()) {
if (nav == input::START || nav == input::CANCEL) activateNextScreen();
@@ -247,15 +259,26 @@ void ScreenSing::manageEvent(SDL_Event event) {
return;
}
// Esc-key needs special handling, it is global pause
- if (event.type == SDL_KEYDOWN && key == SDLK_ESCAPE && !m_audio.isPaused()) {
- for (Instruments::iterator it = m_instruments.begin(); it != m_instruments.end(); ++it) it->toggleMenu(true);
- for (Dancers::iterator it = m_dancers.begin(); it != m_dancers.end(); ++it) it->toggleMenu(true);
+ if ((nav == input::PAUSE || (event.type == SDL_KEYDOWN && key == SDLK_ESCAPE))
+ && !m_audio.isPaused() && !m_menu.isOpen()) {
+ m_menu.open();
+ m_audio.togglePause();
+ }
+ // Global/singer pause menu navigation
+ if (m_menu.isOpen()) {
+ if (nav == input::START) {
+ m_menu.action();
+ if (!m_menu.isOpen() && m_audio.isPaused()) m_audio.togglePause();
+ return;
+ }
+ else if (nav == input::DOWN) { m_menu.move(1); return; }
+ else if (nav == input::UP) { m_menu.move(-1); return; }
}
// Start button has special functions for skipping things (only in singing for now)
if (nav == input::START && m_only_singers_alive && !m_song->vocals.notes.empty() && !m_audio.isPaused()) {
// Open score dialog early
if (status == Song::FINISHED) {
- m_engine->kill(); // kill the engine thread
+ m_engine->kill(); // Kill the engine thread
m_score_window.reset(new ScoreWindow(m_instruments, m_database, m_dancers)); // Song finished, but no score window -> show it
}
// Skip instrumental breaks
@@ -343,6 +366,18 @@ void ScreenSing::draw() {
time -= config["audio/video_delay"].f();
double songPercent = clamp(time / length);
+ // Menu mangling
+ // We don't allow instrument menus during global menu
+ // except for joining, in which case global menu is closed
+ for (Instruments::iterator it = m_instruments.begin(); it != m_instruments.end(); ++it) {
+ if (!it->dead() && !it->joining(time)) it->toggleMenu(0);
+ else if (!it->dead() && it->joining(time)) m_menu.close();
+ }
+ for (Dancers::iterator it = m_dancers.begin(); it != m_dancers.end(); ++it) {
+ if (!it->dead() && !it->joining(time)) it->toggleMenu(0);
+ else if (!it->dead() && it->joining(time)) m_menu.close();
+ }
+
// Rendering starts
{
double ar = arMax;
@@ -367,15 +402,18 @@ void ScreenSing::draw() {
theme->bg_top.draw();
}
+ // Dancing
if( !m_dancers.empty() ) {
danceLayout(time);
//m_layout_singer->draw(time, LayoutSinger::LEFT);
m_only_singers_alive = false;
+ // Singing only
} else if( m_instruments.empty() ) {
m_layout_singer->draw(time, LayoutSinger::BOTTOM);
m_only_singers_alive = true;
+ // Band
} else {
- m_only_singers_alive = !instrumentLayout(time);;
+ m_only_singers_alive = !instrumentLayout(time);
m_layout_singer->draw(time, m_only_singers_alive ? LayoutSinger::BOTTOM : LayoutSinger::MIDDLE);
}
@@ -433,8 +471,37 @@ void ScreenSing::draw() {
// TODO: display some (small) info screen here
}
}
+
+ // Draw menu
+ if (m_menu.isOpen()) drawMenu();
+}
+
+
+void ScreenSing::drawMenu() {
+ if (m_menu.empty()) return;
+ float step = 0.075;
+ float y = -0.6 * m_menu.getOptions().size() * step;
+ // Some helper vars
+ ThemeInstrumentMenu& th = *m_menuTheme;
+ MenuOptions::const_iterator cur = static_cast<MenuOptions::const_iterator>(&m_menu.current());
+ // Loop through menu items
+ for (MenuOptions::const_iterator it = m_menu.begin(); it != m_menu.end(); ++it) {
+ SvgTxtTheme* txt = &th.option;
+ if (cur == it) {
+ txt = &th.option_selected;
+ }
+ txt->dimensions.middle(-0.1).center(y);
+ txt->draw(it->getName());
+ y += step;
+ }
+ if (cur->getComment() != "") {
+ th.comment.dimensions.middle(-0.1).screenBottom(-0.22);
+ th.comment.draw(cur->getComment());
+ }
}
+
+
ScoreWindow::ScoreWindow(Instruments& instruments, Database& database, Dancers& dancers):
m_database(database),
m_pos(0.8, 2.0),
diff --git a/game/screen_sing.hh b/game/screen_sing.hh
index c743877..a8064e2 100644
--- a/game/screen_sing.hh
+++ b/game/screen_sing.hh
@@ -23,6 +23,7 @@ class Audio;
class Capture;
class Database;
class Video;
+class Menu;
typedef boost::ptr_vector<InstrumentGraph> Instruments;
typedef boost::ptr_vector<InstrumentGraph> Dancers;
@@ -72,6 +73,7 @@ class ScreenSing: public Screen {
void activateNextScreen();
bool instrumentLayout(double time);
void danceLayout(double time);
+ void drawMenu();
Audio& m_audio;
Capture& m_capture;
Database& m_database;
@@ -86,6 +88,8 @@ class ScreenSing: public Screen {
boost::scoped_ptr<Surface> m_help;
boost::scoped_ptr<Engine> m_engine;
boost::scoped_ptr<LayoutSinger> m_layout_singer;
+ boost::scoped_ptr<ThemeInstrumentMenu> m_menuTheme;
+ Menu m_menu;
Instruments m_instruments;
Dancers m_dancers;
double m_latencyAV; // Latency between audio and video output (do not confuse with latencyAR)
|
|
From: Tapio V. <aa...@us...> - 2010-08-21 18:03:28
|
Module: performous Branch: master Commit: 6f90b1ace68cda728d2953d4d3240c67f6927699 Author: Tapio Vierros <tap...@gm...> Date: Fri Jul 16 18:17:11 2010 +0300 Merge branch 'master' into joinmenu Conflicts: game/dancegraph.cc game/instrumentgraph.hh game/menu.cc game/menu.hh --- |
|
From: Tapio V. <aa...@us...> - 2010-08-21 18:03:26
|
Module: performous
Branch: master
Commit: cac8b33763a04e8ea354472389628c0c9573b300
Author: Tapio Vierros <tap...@gm...>
Date: Thu Jul 8 23:26:43 2010 +0300
Tighter instrument menu layout.
---
game/dancegraph.cc | 6 +++---
game/guitargraph.cc | 8 ++++----
game/instrumentgraph.cc | 11 +++++------
3 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/game/dancegraph.cc b/game/dancegraph.cc
index ba829d9..6a09a19 100644
--- a/game/dancegraph.cc
+++ b/game/dancegraph.cc
@@ -127,9 +127,9 @@ void DanceGraph::setupJoinMenu() {
}
void DanceGraph::updateJoinMenu() {
- std::string s(" (");
- m_trackComment = _("Select track to play") + s + getTrack() + ")";
- m_difficultyComment = _("Select difficulty level") + s + getDifficultyString() + ")";
+ std::string s("\n (");
+ m_trackComment = _("Select track") + s + getTrack() + ")";
+ m_difficultyComment = _("Select difficulty") + s + getDifficultyString() + ")";
m_selectedTrack = ConfigItem(getTrack());
m_selectedDifficulty = ConfigItem(m_level);
}
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index 48e2a72..6898f31 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -155,11 +155,11 @@ void GuitarGraph::setupJoinMenu() {
}
void GuitarGraph::updateJoinMenu() {
- std::string s(" (");
+ std::string s("\n (");
std::string le = m_leftymode.b() ? _("ON") : _("OFF");
- m_trackComment = _("Select track to play") + s + getTrack() + ")";
- m_difficultyComment = _("Select difficulty level") + s + getDifficultyString() + ")";
- m_leftyComment = _("Toggle left-handed mode") + s + le + ")";
+ m_trackComment = _("Select track") + s + getTrack() + ")";
+ m_difficultyComment = _("Select difficulty") + s + getDifficultyString() + ")";
+ m_leftyComment = _("Toggle lefty-mode") + s + le + ")";
m_selectedTrack = ConfigItem(getTrack());
m_selectedDifficulty = ConfigItem(m_level);
}
diff --git a/game/instrumentgraph.cc b/game/instrumentgraph.cc
index 7dcc6bc..ce67f74 100644
--- a/game/instrumentgraph.cc
+++ b/game/instrumentgraph.cc
@@ -31,10 +31,9 @@ InstrumentGraph::InstrumentGraph(Audio& audio, Song const& song, input::DevType
void InstrumentGraph::setupPauseMenu() {
m_menu.clear();
- // TODO: Replace with options that actually do something
m_menu.add(MenuOption(_("Resume"), _("Back to performing!")));
- //m_menu.add(MenuOption(_("Pause"), _("Toggle pause"), &InstrumentGraph::togglePause));
- m_menu.add(MenuOption(_("Restart"), _("Start the song from the beginning")));
+ // TODO: Implement restart
+ //m_menu.add(MenuOption(_("Restart"), _("Start the song\nfrom the beginning")));
m_menu.add(MenuOption(_("Quit"), _("Exit to song browser"), "Songs"));
}
@@ -55,8 +54,8 @@ void InstrumentGraph::toggleMenu(bool forceopen) {
void InstrumentGraph::drawMenu(double offsetX) {
if (m_menu.empty()) return;
- float step = 0.075;
- float y = -0.5 * m_menu.getOptions().size() * step;
+ float step = 0.05;
+ float y = -0.6 * m_menu.getOptions().size() * step;
// Some helper vars
ThemeInstrumentMenu& th = *m_menuTheme;
MenuOptions::const_iterator cur = static_cast<MenuOptions::const_iterator>(&m_menu.current());
@@ -75,7 +74,7 @@ void InstrumentGraph::drawMenu(double offsetX) {
if (cur->getComment() != "") {
//th.comment_bg.dimensions.middle().screenBottom(-0.2);
//th.comment_bg.draw();
- th.comment.dimensions.middle(-0.15 + offsetX).screenBottom(-0.2);
+ th.comment.dimensions.middle(-0.1 + offsetX).screenBottom(-0.22);
th.comment.draw(cur->getComment());
}
}
|
|
From: Tapio V. <aa...@us...> - 2010-08-21 18:03:24
|
Module: performous
Branch: master
Commit: 59d7017c58374b4c24463401abbc6da5cfe163c0
Author: Tapio Vierros <tap...@gm...>
Date: Thu Jul 8 21:57:53 2010 +0300
Menu theming stuff.
* Add dedicated theme files for instrument menu.
* Rename menu_* --> mainmenu_*
* Update nsis script.
* Still needs actual theming.
---
game/instrumentgraph.cc | 3 +-
game/theme.cc | 28 ++++++++++----------
game/theme.hh | 2 +-
...light.svg => instrumentmenu_back_highlight.svg} | 0
...hort_comment.svg => instrumentmenu_comment.svg} | 28 ++++++++++----------
.../{menu_option.svg => instrumentmenu_option.svg} | 0
...cted.svg => instrumentmenu_option_selected.svg} | 0
...k_highlight.svg => mainmenu_back_highlight.svg} | 0
.../{menu_comment.svg => mainmenu_comment.svg} | 0
...menu_comment_bg.svg => mainmenu_comment_bg.svg} | 0
.../{menu_option.svg => mainmenu_option.svg} | 0
...n_selected.svg => mainmenu_option_selected.svg} | 0
...nu_scomment_bg.svg => mainmenu_scomment_bg.svg} | 0
...hort_comment.svg => mainmenu_short_comment.svg} | 0
win32/setup.nsi | 26 ++++++++++--------
15 files changed, 45 insertions(+), 42 deletions(-)
|
|
From: Tapio V. <aa...@us...> - 2010-08-21 18:03:21
|
Module: performous
Branch: master
Commit: fc87927320d7744ad5496702e395668e0512db24
Author: Tapio Vierros <tap...@gm...>
Date: Thu Jul 8 21:29:01 2010 +0300
Menu now remembers where it was previously when exiting submenu.
---
game/instrumentgraph.cc | 2 +-
game/menu.cc | 47 ++++++++++++++++++++++-------------------------
game/menu.hh | 11 ++++-------
game/screen_intro.cc | 6 +++---
4 files changed, 30 insertions(+), 36 deletions(-)
diff --git a/game/instrumentgraph.cc b/game/instrumentgraph.cc
index 7240bb7..3629f66 100644
--- a/game/instrumentgraph.cc
+++ b/game/instrumentgraph.cc
@@ -59,7 +59,7 @@ void InstrumentGraph::drawMenu(double offsetX) {
float y = -0.5 * m_menu.getOptions().size() * step;
// Some helper vars
ThemeInstrumentMenu& th = *m_menuTheme;
- MenuOptions::const_iterator cur = m_menu.current();
+ MenuOptions::const_iterator cur = static_cast<MenuOptions::const_iterator>(&m_menu.current());
// Loop through menu items
for (MenuOptions::const_iterator it = m_menu.begin(); it != m_menu.end(); ++it) {
SvgTxtTheme* txt = &th.option;
diff --git a/game/menu.cc b/game/menu.cc
index e1b78f6..8f08e63 100644
--- a/game/menu.cc
+++ b/game/menu.cc
@@ -61,50 +61,46 @@ MenuOption::MenuOption(const std::string& nm, const std::string& comm, const std
Menu::Menu():
- m_open(true),
- m_level(0)
+ m_open(true)
{
- menu_stack.push_back(&root_options);
- current_it = menu_stack.back()->end();
+ clear();
}
void Menu::add(MenuOption opt) {
root_options.push_back(opt);
- menu_stack.clear();
- menu_stack.push_back(&root_options);
- current_it = menu_stack.back()->begin(); // Reset iterator
+ clear(true); // Adding resets menu stack
}
void Menu::move(int dir) {
- if (dir > 0 && current_it != (--menu_stack.back()->end())) ++current_it;
- else if (dir < 0 && current_it != menu_stack.back()->begin()) --current_it;
+ if (dir > 0 && selection_stack.back() < menu_stack.back()->size() - 1) ++selection_stack.back();
+ else if (dir < 0 && selection_stack.back() > 0) --selection_stack.back();
}
void Menu::action(int dir) {
- switch (current_it->type) {
+ switch (current().type) {
case MenuOption::OPEN_SUBMENU:
- if (current_it->options.empty()) break;
- menu_stack.push_back(¤t_it->options);
- current_it = menu_stack.back()->begin();
- m_level++;
+ if (current().options.empty()) break;
+ menu_stack.push_back(¤t().options);
+ selection_stack.push_back(0);
break;
case MenuOption::CHANGE_VALUE:
- if (current_it->value) {
- if (dir > 0) ++(*(current_it->value));
- else if (dir < 0) --(*(current_it->value));
+ if (current().value) {
+ if (dir > 0) ++(*(current().value));
+ else if (dir < 0) --(*(current().value));
}
break;
case MenuOption::SET_AND_CLOSE:
- if (current_it->value) *(current_it->value) = current_it->newValue;
+ if (current().value) *(current().value) = current().newValue;
// Fall-through to closing
case MenuOption::CLOSE_SUBMENU:
- if (menu_stack.size() > 1) menu_stack.pop_back();
- else close();
- current_it = menu_stack.back()->begin();
+ if (menu_stack.size() > 1) {
+ menu_stack.pop_back();
+ selection_stack.pop_back();
+ } else close();
break;
case MenuOption::ACTIVATE_SCREEN:
ScreenManager* sm = ScreenManager::getSingletonPtr();
- std::string screen = current_it->newValue.s();
+ std::string screen = current().newValue.s();
clear();
if (screen.empty()) sm->finished();
else sm->activateScreen(screen);
@@ -112,9 +108,10 @@ void Menu::action(int dir) {
}
}
-void Menu::clear() {
+void Menu::clear(bool save_root) {
+ if (!save_root) root_options.clear();
menu_stack.clear();
- root_options.clear();
+ selection_stack.clear();
menu_stack.push_back(&root_options);
- current_it = menu_stack.back()->end();
+ selection_stack.push_back(0);
}
diff --git a/game/menu.hh b/game/menu.hh
index 9877e38..ab5e883 100644
--- a/game/menu.hh
+++ b/game/menu.hh
@@ -62,28 +62,25 @@ struct Menu {
/// adjust the selected value
void action(int dir = 1);
/// clear items
- void clear();
+ void clear(bool save_root = false);
bool empty() const { return (menu_stack.empty() || (menu_stack.size() == 1 && menu_stack.back()->empty())); }
bool isOpen() const { return m_open; }
void open() { m_open = true; }
void close() { m_open = false; }
void toggle() { m_open = !m_open; }
- void moveToLast() { current_it = --(menu_stack.back()->end()); }
+ void moveToLast() { selection_stack.back() = menu_stack.back()->size() - 1; }
+ MenuOption& current() { return menu_stack.back()->at(selection_stack.back()); }
MenuOption& back() { return root_options.back(); }
- MenuOptions::iterator& currentRef() { return current_it; }
- const MenuOptions::const_iterator current() const { return current_it; }
const MenuOptions::const_iterator begin() const { return menu_stack.back()->begin(); }
const MenuOptions::const_iterator end() const { return menu_stack.back()->end(); }
const MenuOptions getOptions() const { return *menu_stack.back(); }
private:
- MenuOptions::iterator current_it;
MenuOptions root_options;
SubmenuStack menu_stack;
+ std::vector<size_t> selection_stack;
bool m_open;
- int m_level;
-
};
diff --git a/game/screen_intro.cc b/game/screen_intro.cc
index 7775457..5496a1b 100644
--- a/game/screen_intro.cc
+++ b/game/screen_intro.cc
@@ -49,7 +49,7 @@ void ScreenIntro::manageEvent(SDL_Event event) {
void ScreenIntro::draw_menu_options() {
int i = 0;
for (MenuOptions::const_iterator it = m_menu.begin(); it != m_menu.end(); ++it, ++i) {
- if (m_menu.current() == it) {
+ if (static_cast<MenuOptions::const_iterator>(&m_menu.current()) == it) {
theme->back_h.dimensions.left(-0.4).center(-0.097 + i*0.08);
theme->back_h.draw();
theme->option_selected.dimensions.left(-0.35).center(-0.1 + i*0.08);
@@ -63,11 +63,11 @@ void ScreenIntro::draw_menu_options() {
void ScreenIntro::draw() {
theme->bg.draw();
- m_menu.current()->image->draw();
+ m_menu.current().image->draw();
theme->comment_bg.dimensions.center().screenBottom(-0.01);
theme->comment_bg.draw();
theme->comment.dimensions.left(-0.48).screenBottom(-0.028);
- theme->comment.draw(m_menu.current()->getComment());
+ theme->comment.draw(m_menu.current().getComment());
draw_menu_options();
if (m_dialog) m_dialog->draw();
}
|
|
From: Tapio V. <aa...@us...> - 2010-08-21 18:03:19
|
Module: performous Branch: master Commit: f6c39cfb3cf6ce95068e97928bf1f4cb588809c3 Author: Tapio Vierros <tap...@gm...> Date: Thu Jul 8 20:46:00 2010 +0300 Menu changes. * Name and comment can optionally be dynamic * Join menu is now only re-created if necessary (track change) * Submenu stack changed to pointers to keep root easily synced --- game/dancegraph.cc | 19 +++++++++++++--- game/dancegraph.hh | 1 + game/guitargraph.cc | 30 +++++++++++++++++-------- game/guitargraph.hh | 1 + game/instrumentgraph.cc | 6 ++-- game/instrumentgraph.hh | 7 +++++- game/menu.cc | 54 +++++++++++++++++++++++++++------------------- game/menu.hh | 40 +++++++++++++++++++++------------- game/screen_intro.cc | 6 ++-- 9 files changed, 106 insertions(+), 58 deletions(-) |
|
From: Tapio V. <aa...@us...> - 2010-08-21 18:03:16
|
Module: performous
Branch: master
Commit: 33de4c23cb98a3f7f4b50354fd1cd43853a87794
Author: Tapio Vierros <tap...@gm...>
Date: Thu Jul 8 19:21:29 2010 +0300
Support unlimited submenu levels.
Also fix a mistake in previous navigation commit.
---
game/joystick.cc | 2 +-
game/menu.cc | 34 +++++++++++++++++++++-------------
game/menu.hh | 15 ++++++++-------
3 files changed, 30 insertions(+), 21 deletions(-)
diff --git a/game/joystick.cc b/game/joystick.cc
index 82e65a1..d30b33e 100644
--- a/game/joystick.cc
+++ b/game/joystick.cc
@@ -474,7 +474,7 @@ bool input::SDL::pushEvent(SDL_Event _e) {
if (pickPressed[0]) return true; // repeating
pickPressed[0] = true;
event.type = input::Event::PICK;
- button = 1;
+ button = 0;
is_guitar_event = true;
break;
case SDLK_RSHIFT:
diff --git a/game/menu.cc b/game/menu.cc
index 3fab361..e71ec37 100644
--- a/game/menu.cc
+++ b/game/menu.cc
@@ -50,24 +50,32 @@ MenuOption::MenuOption(const std::string& nm, const std::string& comm, const std
}
+Menu::Menu():
+ m_open(true),
+ m_level(0)
+{
+ menu_stack.push_back(root_options);
+ current_it = menu_stack.back().end();
+}
void Menu::add(MenuOption opt) {
root_options.push_back(opt);
- options = root_options; // Set active menu to root
- current_it = options.begin(); // Reset iterator
+ menu_stack.clear();
+ menu_stack.push_back(root_options);
+ current_it = menu_stack.back().begin(); // Reset iterator
}
void Menu::move(int dir) {
- if (dir > 0 && current_it != (--options.end())) ++current_it;
- else if (dir < 0 && current_it != options.begin()) --current_it;
+ if (dir > 0 && current_it != (--menu_stack.back().end())) ++current_it;
+ else if (dir < 0 && current_it != menu_stack.back().begin()) --current_it;
}
void Menu::action(int dir) {
switch (current_it->type) {
case MenuOption::OPEN_SUBMENU:
if (current_it->options.empty()) break;
- options = current_it->options;
- current_it = options.begin();
+ menu_stack.push_back(current_it->options);
+ current_it = menu_stack.back().begin();
m_level++;
break;
case MenuOption::CHANGE_VALUE:
@@ -80,15 +88,14 @@ void Menu::action(int dir) {
if (current_it->value) *(current_it->value) = current_it->newValue;
// Fall-through to closing
case MenuOption::CLOSE_SUBMENU:
- // TODO: Handle more than one level of submenus
- if (m_level == 0) close();
- else m_level--;
- options = root_options;
- current_it = options.begin();
+ if (menu_stack.size() > 1) menu_stack.pop_back();
+ else close();
+ current_it = menu_stack.back().begin();
break;
case MenuOption::ACTIVATE_SCREEN:
ScreenManager* sm = ScreenManager::getSingletonPtr();
std::string screen = current_it->newValue.s();
+ clear();
if (screen.empty()) sm->finished();
else sm->activateScreen(screen);
break;
@@ -96,7 +103,8 @@ void Menu::action(int dir) {
}
void Menu::clear() {
- options.clear();
+ menu_stack.clear();
root_options.clear();
- current_it = options.end();
+ menu_stack.push_back(root_options);
+ current_it = menu_stack.back().end();
}
diff --git a/game/menu.hh b/game/menu.hh
index 21ba3d9..6b11de8 100644
--- a/game/menu.hh
+++ b/game/menu.hh
@@ -11,6 +11,7 @@ class Surface;
struct MenuOption;
typedef std::vector<MenuOption> MenuOptions;
+typedef std::vector<MenuOptions> SubmenuStack;
/// struct for menu options
struct MenuOption {
@@ -44,7 +45,7 @@ struct MenuOption {
/// Menu for selecting difficulty etc.
struct Menu {
/// constructor
- Menu(): current_it(options.end()), m_open(true), m_level(0) { }
+ Menu();
/// add a menu option
void add(MenuOption opt);
/// move the selection
@@ -54,23 +55,23 @@ struct Menu {
/// clear items
void clear();
- bool empty() const { return options.empty(); }
+ bool empty() const { return (menu_stack.empty() || (menu_stack.size() == 1 && menu_stack.back().empty())); }
bool isOpen() const { return m_open; }
void open() { m_open = true; }
void close() { m_open = false; }
void toggle() { m_open = !m_open; }
- void moveToLast() { current_it = --(options.end()); }
+ void moveToLast() { current_it = --(menu_stack.back().end()); }
MenuOptions::iterator& currentRef() { return current_it; }
const MenuOptions::const_iterator current() const { return current_it; }
- const MenuOptions::const_iterator begin() const { return options.begin(); }
- const MenuOptions::const_iterator end() const { return options.end(); }
- const MenuOptions getOptions() const { return options; }
+ const MenuOptions::const_iterator begin() const { return menu_stack.back().begin(); }
+ const MenuOptions::const_iterator end() const { return menu_stack.back().end(); }
+ const MenuOptions getOptions() const { return menu_stack.back(); }
private:
MenuOptions::iterator current_it;
- MenuOptions options;
MenuOptions root_options;
+ SubmenuStack menu_stack;
bool m_open;
int m_level;
|
|
From: Tapio V. <aa...@us...> - 2010-08-21 18:03:14
|
Module: performous
Branch: master
Commit: a839bba5a254c7fe8f717bd1bd86716dbb12da0e
Author: Tapio Vierros <tap...@gm...>
Date: Thu Jul 8 18:45:24 2010 +0300
Don't enter into an empty submenu.
---
game/menu.cc | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/game/menu.cc b/game/menu.cc
index d01b578..3fab361 100644
--- a/game/menu.cc
+++ b/game/menu.cc
@@ -65,6 +65,7 @@ void Menu::move(int dir) {
void Menu::action(int dir) {
switch (current_it->type) {
case MenuOption::OPEN_SUBMENU:
+ if (current_it->options.empty()) break;
options = current_it->options;
current_it = options.begin();
m_level++;
|
|
From: Tapio V. <aa...@us...> - 2010-08-21 18:03:11
|
Module: performous
Branch: master
Commit: 95fa380393074aa4049580103b43d3c81ac6a423
Author: Tapio Vierros <tap...@gm...>
Date: Thu Jul 8 18:40:57 2010 +0300
Modify instrument menu navigation.
---
game/guitargraph.cc | 10 +++++-----
game/joystick.cc | 2 +-
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index 75746bd..bf62484 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -283,11 +283,11 @@ void GuitarGraph::engine() {
if (menuOpen()) {
bool old_lefty = m_leftymode.b();
// Check first regular keys
- if (ev.type == input::Event::PRESS && ev.button == 0 + m_drums) m_menu.action(1);
- else if (ev.type == input::Event::PRESS && ev.button == 1 + m_drums) m_menu.action(-1);
- else if (ev.type == input::Event::PRESS && ev.button == 2 + m_drums) m_menu.move(1);
- else if (ev.type == input::Event::PRESS && ev.button == 3 + m_drums) m_menu.move(-1);
- // Strum
+ if (ev.type == input::Event::PRESS && ev.button == 0) m_menu.action(1);
+ else if (ev.type == input::Event::PRESS && ev.button == (m_drums ? 4 : 1)) m_menu.action(-1);
+ else if (ev.type == input::Event::PRESS && ev.button == (m_drums ? 1 : 2)) m_menu.move(1);
+ else if (ev.type == input::Event::PRESS && ev.button == (m_drums ? 2 : 3)) m_menu.move(-1);
+ // Strum (strum of keyboard as guitar doesn't generate nav-events)
else if (ev.type == input::Event::PICK && ev.button == 0) m_menu.move(1);
else if (ev.type == input::Event::PICK && ev.button == 1) m_menu.move(-1);
else { // Try nav keys (arrows)
diff --git a/game/joystick.cc b/game/joystick.cc
index 08661fb..82e65a1 100644
--- a/game/joystick.cc
+++ b/game/joystick.cc
@@ -482,7 +482,7 @@ bool input::SDL::pushEvent(SDL_Event _e) {
if (pickPressed[1]) return true; // repeating
pickPressed[1] = true;
event.type = input::Event::PICK;
- button = 0;
+ button = 1;
is_guitar_event = true;
break;
case SDLK_BACKSPACE:
|
|
From: Tapio V. <aa...@us...> - 2010-08-21 18:03:08
|
Module: performous
Branch: master
Commit: 06cbf09faa2896fe91bd073c7ee642aa0ffa50c5
Author: Tapio Vierros <tap...@gm...>
Date: Thu Jul 8 17:58:51 2010 +0300
Lefty-mode can now be enabled via the menu.
---
game/guitargraph.cc | 6 +++++-
game/guitargraph.hh | 4 ++--
game/menu.hh | 2 +-
3 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index 899b4b2..75746bd 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -146,9 +146,11 @@ void GuitarGraph::setupJoinMenu() {
}
// Populate root menu
std::string s(" (");
+ std::string le = m_leftymode.b() ? _("ON") : _("OFF");
m_menu.add(MenuOption(_("Ready!"), _("Start performing!")));
m_menu.add(MenuOption(_("Track"), _("Select track to play") + s + getTrack() + ")", trackmenu));
m_menu.add(MenuOption(_("Difficulty"), _("Select difficulty level") + s + getDifficultyString() + ")", diffmenu));
+ m_menu.add(MenuOption(_("Lefty-mode"), _("Toggle left-handed mode") + s + le + ")", &m_leftymode));
m_menu.add(MenuOption(_("Quit"), _("Exit to song browser"), "Songs"));
}
@@ -272,13 +274,14 @@ void GuitarGraph::engine() {
if (ev.type == input::Event::WHAMMY) whammy = (1.0 + ev.button + 2.0*(rand()/double(RAND_MAX))) / 4.0;
} else {
// Handle drum lefty-mode
- if (m_leftymode && ev.button > 0) ev.button = m_pads - ev.button;
+ if (m_leftymode.b() && ev.button > 0) ev.button = m_pads - ev.button;
}
// Keypress anims
if (ev.type == input::Event::PRESS) m_pressed_anim[!m_drums + ev.button].setValue(1.0);
else if (ev.type == input::Event::PICK) m_pressed_anim[0].setValue(1.0);
// Menu keys
if (menuOpen()) {
+ bool old_lefty = m_leftymode.b();
// Check first regular keys
if (ev.type == input::Event::PRESS && ev.button == 0 + m_drums) m_menu.action(1);
else if (ev.type == input::Event::PRESS && ev.button == 1 + m_drums) m_menu.action(-1);
@@ -294,6 +297,7 @@ void GuitarGraph::engine() {
// See if anything changed
if (m_selectedTrack.s() != getTrack()) setTrack(m_selectedTrack.s());
else if (m_selectedDifficulty.i() != m_level) difficulty(Difficulty(m_selectedDifficulty.i()));
+ else if (old_lefty != m_leftymode.b()) setupJoinMenu();
// Playing
} else if (m_drums) {
if (ev.type == input::Event::PRESS) drumHit(time, ev.button);
diff --git a/game/guitargraph.hh b/game/guitargraph.hh
index a8f853c..622441e 100644
--- a/game/guitargraph.hh
+++ b/game/guitargraph.hh
@@ -98,7 +98,7 @@ class GuitarGraph: public InstrumentGraph {
// Flags
bool m_drums; /// are we using drums?
bool m_use3d; /// are we using 3d?
- bool m_leftymode; /// switch guitar notes to right-to-left direction
+ ConfigItem m_leftymode; /// switch guitar notes to right-to-left direction
bool m_practmode; /// switch to enable practice mode
// Track stuff
@@ -126,7 +126,7 @@ class GuitarGraph: public InstrumentGraph {
void drawNote(int fret, glutil::Color, float tBeg, float tEnd, float whammy = 0, bool tappable = false, bool hit = false, double hitAnim = 0.0, double releaseTime = 0.0);
void drawDrumfill(float tBeg, float tEnd);
void drawInfo(double time, double offsetX, Dimensions dimensions);
- float getFretX(int fret) const { return (-2.0f + fret- (m_drums ? 0.5 : 0)) * (m_leftymode ? -1 : 1); }
+ float getFretX(int fret) { return (-2.0f + fret- (m_drums ? 0.5 : 0)) * (m_leftymode.b() ? -1 : 1); }
// Chords & notes
void updateChords();
diff --git a/game/menu.hh b/game/menu.hh
index 947feef..21ba3d9 100644
--- a/game/menu.hh
+++ b/game/menu.hh
@@ -8,7 +8,7 @@
#include <vector>
class Surface;
-class MenuOption;
+struct MenuOption;
typedef std::vector<MenuOption> MenuOptions;
|
|
From: Tapio V. <aa...@us...> - 2010-08-21 18:03:06
|
Module: performous Branch: master Commit: 0ee98bb48cc6b95ab25f2956cb0561a34e62f2a5 Author: Tapio Vierros <tap...@gm...> Date: Wed Jul 7 22:40:29 2010 +0300 Track/difficulty selection menus based on submenu approach. --- game/dancegraph.cc | 63 +++++++++++++++++++++++++++++++++++----------- game/dancegraph.hh | 5 +++- game/guitargraph.cc | 43 ++++++++++++++++++++++++++----- game/guitargraph.hh | 4 ++- game/instrumentgraph.cc | 6 +--- game/instrumentgraph.hh | 2 + 6 files changed, 95 insertions(+), 28 deletions(-) |
|
From: Tapio V. <aa...@us...> - 2010-08-21 18:03:01
|
Module: performous Branch: master Commit: 9e0a8d2d5107af2484dbdddc5c5d74232d945b7e Author: Tapio Vierros <tap...@gm...> Date: Wed Jul 7 20:06:25 2010 +0300 Merge branch 'master' into joinmenu Conflicts: game/dancegraph.cc --- |