|
From: Tapio V. <aa...@us...> - 2009-11-08 08:31:17
|
Module: performous
Branch: dance
Commit: 31abba01e0f1f2c9b3d82174d3230c966ba4f948
Author: Tapio Vierros <tap...@gm...>
Date: Sun Nov 8 10:27:24 2009 +0200
Some basis for dance graph.
---
game/dancegraph.cc | 51 +++++++++++++++++++++++++++++++++++++++++++++
game/dancegraph.hh | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++
game/joystick.hh | 2 +-
3 files changed, 110 insertions(+), 1 deletions(-)
diff --git a/game/dancegraph.cc b/game/dancegraph.cc
index 46e002f..3a4777b 100644
--- a/game/dancegraph.cc
+++ b/game/dancegraph.cc
@@ -1 +1,52 @@
#include "dancegraph.hh"
+#include "fs.hh"
+
+/// Constructor
+DanceGraph::DanceGraph(Audio& audio, Song const& song):
+ m_audio(audio),
+ m_song(song),
+ m_input(input::DANCEPAD),
+ m_arrow("arrow.svg"),
+ m_cx(0.0, 0.2),
+ m_width(0.5, 0.4),
+ m_stream(),
+ m_dead(1000),
+ m_text(getThemePath("sing_timetxt.svg"), config["graphic/text_lod"].f()),
+ m_correctness(0.0, 5.0),
+ m_score(),
+ m_scoreFactor(),
+ m_streak(),
+ m_longestStreak()
+{
+ //TODO
+
+
+}
+
+
+/// Handles input
+void DanceGraph::engine() {
+ //TODO
+
+}
+
+
+/// Handles scoring and such
+void DanceGraph::dance(double time, input::Event const& ev) {
+ //TODO:
+
+}
+
+
+/// Draws the dance graph
+void DanceGraph::draw(double time) {
+ //TODO
+
+}
+
+
+/// Draws a single note (or hold)
+void DanceGraph::drawNote(int fret, glutil::Color, float tBeg, float tEnd) {
+ //TODO
+
+}
diff --git a/game/dancegraph.hh b/game/dancegraph.hh
index 6f70f09..a3f146b 100644
--- a/game/dancegraph.hh
+++ b/game/dancegraph.hh
@@ -1 +1,59 @@
#pragma once
+
+#include <vector>
+
+#include <boost/ptr_container/ptr_map.hpp>
+#include "animvalue.hh"
+#include "notes.hh"
+#include "audio.hh"
+#include "joystick.hh"
+#include "surface.hh"
+#include "opengl_text.hh"
+
+class Song;
+
+/// handles drawing of notes
+class DanceGraph {
+ public:
+ /// constructor
+ DanceGraph(Audio& audio, Song const& song);
+ /** draws DanceGraph
+ * @param time at which time to draw
+ */
+ void draw(double time);
+ void engine();
+ void position(double cx, double width) { m_cx.setTarget(cx); m_width.setTarget(width); }
+ double dead(double time) const { return time > -0.5 && m_dead > 50; }
+ unsigned stream() const { return m_stream; }
+ double correctness() const { return m_correctness.get(); }
+ int getScore() const { return m_score * m_scoreFactor; }
+ private:
+ void dance(double time, input::Event const& ev);
+ void drawNote(int fret, glutil::Color, float tBeg, float tEnd);
+ Audio& m_audio;
+ input::InputDev m_input;
+ Song const& m_song;
+ Surface m_arrow;
+ AnimValue m_cx, m_width;
+ std::size_t m_stream;
+ struct Event {
+ double time;
+ AnimValue glow;
+ int type; // 0 = miss (pick), 1 = tap, 2 = pick
+ int fret;
+ Duration const* dur;
+ double holdTime;
+ Event(double t, int ty, int f = -1, Duration const* d = NULL): time(t), glow(0.0, 5.0), type(ty), fret(f), dur(d), holdTime(d ? d->begin : getNaN()) { if (type > 0) glow.setValue(1.0); }
+ };
+ typedef std::vector<Event> Events;
+ Events m_events;
+ unsigned m_holds[4];
+ int m_dead;
+ SvgTxtTheme m_text;
+ AnimValue m_correctness;
+ double m_score;
+ double m_scoreFactor;
+ int m_streak;
+ int m_longestStreak;
+};
+
diff --git a/game/joystick.hh b/game/joystick.hh
index f3ee06b..ea59fc8 100644
--- a/game/joystick.hh
+++ b/game/joystick.hh
@@ -16,7 +16,7 @@
#endif
namespace input {
- enum DevType { GUITAR, DRUMS };
+ enum DevType { GUITAR, DRUMS, DANCEPAD };
static const std::size_t BUTTONS = 6;
|