|
From: Tapio V. <aa...@us...> - 2010-05-17 17:00:50
|
Module: performous
Branch: master
Commit: 5d74a0bb7f6eb2d1f5a04d4e37cb65494d66549b
Author: Tapio Vierros <tap...@gm...>
Date: Mon Apr 12 19:32:01 2010 +0300
Screen_sing's containers now hold InstrumentGraph instead of Guitar/Dance.
---
game/dancegraph.cc | 2 +-
game/dancegraph.hh | 2 +-
game/guitargraph.hh | 1 -
game/instrumentgraph.hh | 8 ++++++--
game/joystick.hh | 2 +-
game/screen_sing.cc | 6 +++---
game/screen_sing.hh | 6 +++---
7 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/game/dancegraph.cc b/game/dancegraph.cc
index 8738755..66c0ce7 100644
--- a/game/dancegraph.cc
+++ b/game/dancegraph.cc
@@ -467,7 +467,7 @@ void DanceGraph::drawInfo(double time, double offsetX, Dimensions dimensions) {
m_text.dimensions.screenBottom(-0.075).middle(-0.09 + offsetX);
m_text.draw("^ " + getDifficultyString() + " v");
m_text.dimensions.screenBottom(-0.050).middle(-0.09 + offsetX);
- m_text.draw("< " + getGameMode() + " >");
+ m_text.draw("< " + getTrack() + " >");
} else { // 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/dancegraph.hh b/game/dancegraph.hh
index c1cdce3..47fe757 100644
--- a/game/dancegraph.hh
+++ b/game/dancegraph.hh
@@ -40,7 +40,7 @@ class DanceGraph: public InstrumentGraph {
void draw(double time);
void engine();
bool dead() const;
- std::string getGameMode() const { return m_gamingMode; }
+ std::string getTrack() const { return m_gamingMode; }
std::string getDifficultyString() const;
private:
enum DanceStep { STEP_LEFT, STEP_DOWN, STEP_UP, STEP_RIGHT };
diff --git a/game/guitargraph.hh b/game/guitargraph.hh
index a4a2300..3aeb633 100644
--- a/game/guitargraph.hh
+++ b/game/guitargraph.hh
@@ -60,7 +60,6 @@ class GuitarGraph: public InstrumentGraph {
void draw(double time);
void engine();
bool dead() const;
- std::string getTrackIndex() const { return m_track_index->first; }
std::string getTrack() const { return m_track_index->first; }
std::string getDifficultyString() const;
private:
diff --git a/game/instrumentgraph.hh b/game/instrumentgraph.hh
index 2d36f2d..d8e77bc 100644
--- a/game/instrumentgraph.hh
+++ b/game/instrumentgraph.hh
@@ -34,12 +34,16 @@ class InstrumentGraph {
m_dead()
{
m_popupText.reset(new SvgTxtThemeSimple(getThemePath("sing_score_text.svg"), config["graphic/text_lod"].f()));
-
};
+ virtual void draw(double time) = 0;
+ virtual void engine() = 0;
+ virtual bool dead() const = 0;
+ virtual std::string getTrack() const = 0;
+ virtual std::string getDifficultyString() const = 0;
+
void position(double cx, double width) { m_cx.setTarget(cx); m_width.setTarget(width); }
unsigned stream() const { return m_stream; }
- bool dead() const;
double correctness() const { return m_correctness.get(); }
int getScore() const { return (m_score > 0 ? m_score : 0) * m_scoreFactor; }
protected:
diff --git a/game/joystick.hh b/game/joystick.hh
index ef3cf20..5874661 100644
--- a/game/joystick.hh
+++ b/game/joystick.hh
@@ -115,7 +115,7 @@ namespace input {
struct NoDevError: std::runtime_error {
NoDevError(): runtime_error("No instrument of the requested type was available") {}
};
-
+
class InputDev {
public:
// First gives a correct instrument type
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index 9bbb3dd..7221edd 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -119,7 +119,7 @@ bool ScreenSing::instrumentLayout(double time) {
it->engine(); // Run engine even when dead so that joining is possible
if (!it->dead()) {
it->position((0.5 + i - 0.5 * count) * iw, iw); // Do layout stuff
- CountSum& cs = volume[it->getTrackIndex()];
+ CountSum& cs = volume[it->getTrack()];
cs.first++;
cs.second += it->correctness();
it->draw(time);
@@ -406,8 +406,8 @@ ScoreWindow::ScoreWindow(Instruments& instruments, Database& database, Dancers&
ScoreItem item; item.type = ScoreItem::DANCER;
item.score = it->getScore();
if (item.score < 100) { it = dancers.erase(it); continue; } // Dead
- item.track_simple = it->getGameMode();
- item.track = it->getGameMode() + " - " + it->getDifficultyString();
+ item.track_simple = it->getTrack();
+ item.track = it->getTrack() + " - " + it->getDifficultyString();
item.track[0] = toupper(item.track[0]); // Capitalize
item.color = glutil::Color(1.0f, 0.4f, 0.1f);
diff --git a/game/screen_sing.hh b/game/screen_sing.hh
index 87cc33c..10106e4 100644
--- a/game/screen_sing.hh
+++ b/game/screen_sing.hh
@@ -6,6 +6,7 @@
#include "layout_singer.hh"
#include "animvalue.hh"
#include "engine.hh"
+#include "instrumentgraph.hh"
#include "guitargraph.hh"
#include "dancegraph.hh"
#include "screen.hh"
@@ -14,7 +15,6 @@
#include "surface.hh"
#include "opengl_text.hh"
#include "progressbar.hh"
-#include "guitargraph.hh"
#include "screen_players.hh"
@@ -24,8 +24,8 @@ class Capture;
class Database;
class Video;
-typedef boost::ptr_vector<GuitarGraph> Instruments;
-typedef boost::ptr_vector<DanceGraph> Dancers;
+typedef boost::ptr_vector<InstrumentGraph> Instruments;
+typedef boost::ptr_vector<InstrumentGraph> Dancers;
/// shows score at end of song
class ScoreWindow {
|