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: knittl <kn...@us...> - 2009-08-03 08:40:59
|
Module: performous
Branch: master
Commit: a7efbab3998c33875dde313a198134fb4a511279
Author: Lasse Karkkainen <tro...@tr...>
Date: Sat Aug 1 22:30:58 2009 +0300
Minor fix for FPS calculator.
---
game/main.cc | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/game/main.cc b/game/main.cc
index 59bb9dd..26ff642 100644
--- a/game/main.cc
+++ b/game/main.cc
@@ -151,22 +151,23 @@ void mainLoop() {
sm.activateScreen("Intro");
// Main loop
boost::xtime time = now();
- unsigned nb_frames = 0;
+ unsigned frames = 0;
while (!sm.isFinished()) {
checkEvents_SDL(sm, window);
window.blank();
sm.getCurrentScreen()->draw();
window.swap();
- ++nb_frames;
if (config["graphic/fps"].b()) {
+ ++frames;
if (now() - time > 1.0) {
- std::cout << nb_frames << " FPS" << std::endl;
+ std::cout << frames << " FPS" << std::endl;
time += 1.0;
- nb_frames = 0;
+ frames = 0;
}
} else {
boost::thread::sleep(time + 0.01); // Max 100 FPS
time = now();
+ frames = 0;
}
}
} catch (std::exception& e) {
|
|
From: knittl <kn...@us...> - 2009-08-03 08:40:59
|
Module: performous
Branch: master
Commit: ffc699c1a721333d75a9c94c13284871b75a548e
Author: Lasse Karkkainen <tro...@tr...>
Date: Sat Aug 1 21:07:25 2009 +0300
Kinda correct guitar rendering in multiplayer (separate perspective points). Looks weird, needs some hacking?
---
game/guitargraph.cc | 6 ++++--
game/video_driver.cc | 2 +-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index 5705dca..d7d766d 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -203,8 +203,10 @@ void GuitarGraph::draw(double time) {
engine(time);
Dimensions dimensions(1.0); // FIXME: bogus aspect ratio (is this fixable?)
dimensions.screenBottom().middle(m_cx).fixedWidth(m_width);
- glutil::PushMatrix pmb;
- glTranslatef(0.5 * (dimensions.x1() + dimensions.x2()), dimensions.y2(), 0.0f);
+ glutil::PushMatrixMode pmm(GL_PROJECTION);
+ glTranslatef((dimensions.x1() + dimensions.x2()), 0.0f, 0.0f);
+ glutil::PushMatrixMode pmb(GL_MODELVIEW);
+ glTranslatef(0.0, dimensions.y2(), 0.0f);
glRotatef(85.0f, 1.0f, 0.0f, 0.0f);
{ float s = dimensions.w() / 5.0f; glScalef(s, s, s); }
// Draw the neck
diff --git a/game/video_driver.cc b/game/video_driver.cc
index b1edfe2..431ba89 100644
--- a/game/video_driver.cc
+++ b/game/video_driver.cc
@@ -90,10 +90,10 @@ void Window::resize() {
float h = virtH();
const float near = 1.5f; // This determines FOV: the value is your distance from the monitor (the unit being the width of the Performous window)
const float far = 100.0f; // How far away can things be seen
- glFrustum(-0.5f, 0.5f, 0.5f * h, -0.5f * h, near, far);
// Set model-view matrix
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
+ glFrustum(-0.5f, 0.5f, 0.5f * h, -0.5f * h, near, far);
glTranslatef(0.0f, 0.0f, -near); // So that z = 0.0f is still on monitor surface
}
|
|
From: knittl <kn...@us...> - 2009-08-03 08:40:58
|
Module: performous
Branch: master
Commit: 0e748f7eafb6bb2f5bc3d3d52f1015fe8dd95ad4
Author: Lasse Karkkainen <tro...@tr...>
Date: Sat Aug 1 21:44:51 2009 +0300
More flexibility for instrument perspective.
---
game/guitargraph.cc | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index 0560e6d..2e1951a 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -204,10 +204,11 @@ void GuitarGraph::draw(double time) {
Dimensions dimensions(1.0); // FIXME: bogus aspect ratio (is this fixable?)
dimensions.screenBottom().middle(m_cx).fixedWidth(m_width);
glutil::PushMatrixMode pmm(GL_PROJECTION);
- float offsetX = 0.5 * (dimensions.x1() + dimensions.x2());
- glTranslatef(offsetX, 0.0f, 0.0f);
+ double offsetX = 0.5 * (dimensions.x1() + dimensions.x2());
+ double frac = 0.75; // Adjustable: 1.0 means fully separated, 0.0 means fully attached
+ glTranslatef(frac * 2.0 * offsetX, 0.0f, 0.0f);
glutil::PushMatrixMode pmb(GL_MODELVIEW);
- glTranslatef(0.5 * offsetX, dimensions.y2(), 0.0f);
+ glTranslatef((1.0 - frac) * offsetX, dimensions.y2(), 0.0f);
glRotatef(85.0f, 1.0f, 0.0f, 0.0f);
{ float s = dimensions.w() / 5.0f; glScalef(s, s, s); }
// Draw the neck
|
|
From: knittl <kn...@us...> - 2009-08-03 08:40:55
|
Module: performous
Branch: master
Commit: 01921d405676ce1fbf856ed8a5c199a23a3a0e0f
Author: Lasse Karkkainen <tro...@tr...>
Date: Sat Aug 1 21:12:05 2009 +0300
Fix reversed guitar and bass graphics.
---
game/guitargraph.cc | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index d7d766d..2390648 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -49,8 +49,8 @@ GuitarGraph::GuitarGraph(Song const& song, bool drums, unsigned track):
if (drums != (it->name == "DRUMS")) continue;
m_tracks.push_back(&*it);
if (it->name == "DRUMS") m_necks.push_back(new Texture("drumneck.svg"));
- else if (it->name == "BASS") m_necks.push_back(new Texture("guitarneck.svg"));
- else m_necks.push_back(new Texture("bassneck.svg"));
+ else if (it->name == "BASS") m_necks.push_back(new Texture("bassneck.svg"));
+ else m_necks.push_back(new Texture("guitarneck.svg"));
}
if (m_tracks.empty()) throw std::runtime_error("No tracks");
difficultyAuto();
|
|
From: knittl <kn...@us...> - 2009-08-03 08:40:51
|
Module: performous
Branch: master
Commit: 89c2d8377b55f66526e8a0c2c271610d172fa233
Author: Lasse Karkkainen <tro...@tr...>
Date: Sat Aug 1 20:28:51 2009 +0300
Fix tracks named "PART DRUM" to DRUMS as they should be.
---
game/songparser-ini.cc | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/game/songparser-ini.cc b/game/songparser-ini.cc
index f22d965..fb491d9 100644
--- a/game/songparser-ini.cc
+++ b/game/songparser-ini.cc
@@ -50,6 +50,7 @@ void SongParser::iniParse() {
else if (name == "T1 GEMS") name = "GUITAR"; // Some old MIDI files have a track named T1 GEMS
else if (name.substr(0, 5) != "PART ") continue;
else name.erase(0, 5);
+ if (name == "DRUM") name = "DRUMS";
// Process non-vocal tracks
if (name != "VOCALS") {
bool drums = (name == "DRUMS");
|
|
From: knittl <kn...@us...> - 2009-08-03 08:40:49
|
Module: performous Branch: master Commit: 9998cb35dc94b45fa5de44c9ec29eff50e024660 Author: Lasse Karkkainen <tro...@tr...> Date: Sat Aug 1 20:05:59 2009 +0300 Merge branch 'master' of ssh://zi.fi/performous --- |
|
From: knittl <kn...@us...> - 2009-08-03 08:40:48
|
Module: performous
Branch: master
Commit: 4e9c499c37363cfe6bdb726768e231d94ebd1bb3
Author: Lasse Karkkainen <tro...@tr...>
Date: Sat Aug 1 20:04:41 2009 +0300
Proper instrument selection by controller type.
Automatic instrument selection (instead of everybody being guitar).
Drums go in the middle.
---
game/guitargraph.cc | 34 ++++++++++++++++++----------------
game/guitargraph.hh | 5 +++--
game/screen_sing.cc | 12 +++++-------
3 files changed, 26 insertions(+), 25 deletions(-)
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index 5237b90..5705dca 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -30,7 +30,7 @@ namespace {
}
-GuitarGraph::GuitarGraph(Song const& song, bool drums):
+GuitarGraph::GuitarGraph(Song const& song, bool drums, unsigned track):
m_input(drums ? input::DRUMS : input::GUITAR),
m_song(song),
m_button("button.svg"),
@@ -39,17 +39,20 @@ GuitarGraph::GuitarGraph(Song const& song, bool drums):
m_drums(drums),
m_cx(),
m_width(0.5),
- m_instrument(),
+ m_track(track),
m_level(),
m_text(getThemePath("sing_timetxt.svg"), config["graphic/text_lod"].f()),
m_hammerReady(0.0, 2.0),
m_score()
{
- std::size_t tracks = m_song.tracks.size();
- if (tracks == 0) throw std::runtime_error("No tracks");
- m_necks.push_back(new Texture("guitarneck.svg"));
- if (tracks > 1) m_necks.push_back(new Texture("bassneck.svg"));
- if (tracks > 2) m_necks.push_back(new Texture("drumneck.svg"));
+ for (Tracks::const_iterator it = m_song.tracks.begin(); it != m_song.tracks.end(); ++it) {
+ if (drums != (it->name == "DRUMS")) continue;
+ m_tracks.push_back(&*it);
+ if (it->name == "DRUMS") m_necks.push_back(new Texture("drumneck.svg"));
+ else if (it->name == "BASS") m_necks.push_back(new Texture("guitarneck.svg"));
+ else m_necks.push_back(new Texture("bassneck.svg"));
+ }
+ if (m_tracks.empty()) throw std::runtime_error("No tracks");
difficultyAuto();
}
@@ -61,7 +64,7 @@ void GuitarGraph::engine(double time) {
if (time < -0.5) {
if (ev.type == input::Event::PICK) {
if (ev.pressed[4]) {
- ++m_instrument;
+ ++m_track;
if (!difficulty(m_level)) difficultyAuto();
}
if (ev.pressed[0]) difficulty(DIFFICULTY_SUPAEASY);
@@ -79,7 +82,7 @@ void GuitarGraph::engine(double time) {
void GuitarGraph::drumHit(double time, int fret) {
if (fret == 0) m_pickValue.setValue(1.0);
int basepitch = diffv[m_level].basepitch;
- NoteMap const& nm = m_song.tracks[m_instrument].nm;
+ NoteMap const& nm = m_tracks[m_track]->nm;
NoteMap::const_iterator it = nm.find(basepitch + fret);
if (it == nm.end()) return;
Durations const& dur = it->second;
@@ -159,9 +162,8 @@ void GuitarGraph::difficultyAuto() {
}
bool GuitarGraph::difficulty(Difficulty level) {
- m_instrument %= m_song.tracks.size();
- Track const& track = m_song.tracks[m_instrument];
- m_drums = (m_song.tracks[m_instrument].name == "DRUMS");
+ m_track %= m_tracks.size();
+ Track const& track = *m_tracks[m_track];
uint8_t basepitch = diffv[level].basepitch;
NoteMap const& nm = track.nm;
int fail = 0;
@@ -191,7 +193,7 @@ glutil::Color const& GuitarGraph::color(int fret) const {
void GuitarGraph::draw(double time) {
if (time < -0.5) {
std::string txt = (m_drums ? "Hit a pad to change:\n" : "Play a fret to change:\n");
- txt += m_song.tracks[m_instrument].name + "/" + diffv[m_level].name;
+ txt += m_tracks[m_track]->name + "/" + diffv[m_level].name;
m_text.dimensions.screenBottom(-0.05).middle(0.0);
m_text.draw(txt);
} else {
@@ -207,9 +209,9 @@ void GuitarGraph::draw(double time) {
{ float s = dimensions.w() / 5.0f; glScalef(s, s, s); }
// Draw the neck
{
- UseTexture tex(m_necks[m_instrument]);
+ UseTexture tex(m_necks[m_track]);
glutil::Begin block(GL_TRIANGLE_STRIP);
- float w = m_instrument == 2 ? 2.0f : 2.5f;
+ float w = (m_drums ? 2.0f : 2.5f);
float texCoord = 0.0f;
float tBeg = 0.0f, tEnd;
for (Song::Beats::const_iterator it = m_song.beats.begin(); it != m_song.beats.end() && tBeg < future; ++it, texCoord += texCoordStep, tBeg = tEnd) {
@@ -301,7 +303,7 @@ void GuitarGraph::updateChords() {
Durations::size_type pos[5] = {}, size[5] = {};
Durations const* durations[5] = {};
for (int fret = 0; fret < 5; ++fret) {
- NoteMap const& nm = m_song.tracks[m_instrument].nm;
+ NoteMap const& nm = m_tracks[m_track]->nm;
int basepitch = diffv[m_level].basepitch;
NoteMap::const_iterator it = nm.find(basepitch + fret);
if (it == nm.end()) continue;
diff --git a/game/guitargraph.hh b/game/guitargraph.hh
index eac6681..4fae928 100644
--- a/game/guitargraph.hh
+++ b/game/guitargraph.hh
@@ -47,7 +47,7 @@ static inline bool operator==(Chord const& a, Chord const& b) {
class GuitarGraph {
public:
/// constructor
- GuitarGraph(Song const& song, bool drums = false);
+ GuitarGraph(Song const& song, bool drums, unsigned num);
/** draws GuitarGraph
* @param time at which time to draw
*/
@@ -63,7 +63,8 @@ class GuitarGraph {
boost::ptr_vector<Texture> m_necks;
bool m_drums;
double m_cx, m_width;
- std::size_t m_instrument;
+ unsigned m_track;
+ std::vector<Track const*> m_tracks;
void drumHit(double time, int pad);
void guitarPlay(double time, input::Event const& ev);
enum Difficulty {
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index f359d95..11e714a 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -33,15 +33,13 @@ void ScreenSing::enter() {
m_engine.reset(new Engine(m_audio, *m_song, analyzers.begin(), analyzers.end(), m_players));
m_layout_singer.reset(new LayoutSinger(*m_song, m_players, theme));
// I know some purists would hang me for this loop
+ bool drums = false;
for (int num = 0; true; ++num) {
try {
- m_instruments.push_back(new GuitarGraph(*m_song));
- } catch (std::runtime_error&) { break; }
- }
- for (int num = 0; true; ++num) {
- try {
- m_instruments.push_back(new GuitarGraph(*m_song, true));
- } catch (std::runtime_error&) { break; }
+ Instruments::iterator it = m_instruments.end();
+ if (drums && m_instruments.size() > 1) it = m_instruments.begin() + 1; // Drums go after the first guitar
+ m_instruments.insert(it, new GuitarGraph(*m_song, drums, num));
+ } catch (std::runtime_error&) { if (drums) break; drums = true; }
}
double iw = std::min(0.5, 1.0 / m_instruments.size());
for (Instruments::size_type i = 0, s = m_instruments.size(); i < s; ++i) {
|
|
From: knittl <kn...@us...> - 2009-08-03 08:40:46
|
Module: performous
Branch: master
Commit: f2768aeb127ae5cda3900e414ad923f73b56502b
Author: Vincent Le Ligeour <yo...@us...>
Date: Sat Aug 1 18:58:13 2009 +0200
Added some comments
---
game/joystick.cc | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/game/joystick.cc b/game/joystick.cc
index 2c522b5..bee8bdb 100644
--- a/game/joystick.cc
+++ b/game/joystick.cc
@@ -7,18 +7,20 @@ static const unsigned SDL_BUTTONS = 6;
int buttonFromSDL(input::Private::Type _type, unsigned int _sdl_button) {
static const int inputmap[4][SDL_BUTTONS] = {
+ //G R Y B O // for guitars
{ 2, 0, 1, 3, 4, 0 }, // Guitar Hero guitar
- { 3, 4, 1, 2, 0, 4 }, // Guitar Hero drums
{ 3, 0, 1, 2, 4, 0 }, // Rock Band guitar
+ //K R Y B G O // for drums
+ { 3, 4, 1, 2, 0, 4 }, // Guitar Hero drums
{ 3, 4, 1, 2, 0, 0 } // Rock Band drums
};
if( _sdl_button >= SDL_BUTTONS ) return -1;
switch(_type) {
case input::Private::GUITAR_GH:
return inputmap[0][_sdl_button];
- case input::Private::DRUMS_GH:
- return inputmap[1][_sdl_button];
case input::Private::GUITAR_RB:
+ return inputmap[1][_sdl_button];
+ case input::Private::DRUMS_GH:
return inputmap[2][_sdl_button];
case input::Private::DRUMS_RB:
return inputmap[3][_sdl_button];
|
|
From: knittl <kn...@us...> - 2009-08-03 08:40:45
|
Module: performous
Branch: master
Commit: 58e8b8bada7e4eb6421397aa9605a5bb5cae6c4c
Author: Lasse Karkkainen <tro...@tr...>
Date: Sat Aug 1 19:35:48 2009 +0300
Fix off-by-one error in array boundary check.
---
game/joystick.cc | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/game/joystick.cc b/game/joystick.cc
index 8971b60..2c522b5 100644
--- a/game/joystick.cc
+++ b/game/joystick.cc
@@ -12,7 +12,7 @@ int buttonFromSDL(input::Private::Type _type, unsigned int _sdl_button) {
{ 3, 0, 1, 2, 4, 0 }, // Rock Band guitar
{ 3, 4, 1, 2, 0, 0 } // Rock Band drums
};
- if( _sdl_button > 6 ) return -1;
+ if( _sdl_button >= SDL_BUTTONS ) return -1;
switch(_type) {
case input::Private::GUITAR_GH:
return inputmap[0][_sdl_button];
|
|
From: knittl <kn...@us...> - 2009-08-03 08:40:43
|
Module: performous
Branch: master
Commit: 68fc8b52fd2edc2d9e00c7513f3077e354da9834
Author: Lasse Karkkainen <tro...@tr...>
Date: Sat Aug 1 19:28:00 2009 +0300
Multiple instrument support.
---
game/glutil.hh | 10 +++++++++-
game/guitargraph.cc | 4 +++-
game/guitargraph.hh | 2 ++
game/screen_sing.cc | 20 +++++++++++++++++---
game/screen_sing.hh | 3 ++-
5 files changed, 33 insertions(+), 6 deletions(-)
diff --git a/game/glutil.hh b/game/glutil.hh
index 90a1b09..3ce9949 100644
--- a/game/glutil.hh
+++ b/game/glutil.hh
@@ -3,13 +3,21 @@
#include <GL/glew.h>
namespace glutil {
- /// wrapper struct for RAII
+ /// wrapper struct for RAII
struct PushMatrix {
PushMatrix() { glPushMatrix(); }
~PushMatrix() { glPopMatrix(); }
};
/// wrapper struct for RAII
+ struct PushMatrixMode {
+ PushMatrixMode(GLenum mode) { glGetIntegerv(GL_MATRIX_MODE, &m_old); glMatrixMode(mode); glPushMatrix(); }
+ ~PushMatrixMode() { glPopMatrix(); glMatrixMode(m_old); }
+ private:
+ GLint m_old;
+ };
+
+ /// wrapper struct for RAII
struct Begin {
/// call glBegin with given mode
Begin(GLint mode) { glBegin(mode); }
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index 4bd7a01..5237b90 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -37,6 +37,8 @@ GuitarGraph::GuitarGraph(Song const& song, bool drums):
m_tap("tap.svg"),
m_pickValue(0.0, 5.0),
m_drums(drums),
+ m_cx(),
+ m_width(0.5),
m_instrument(),
m_level(),
m_text(getThemePath("sing_timetxt.svg"), config["graphic/text_lod"].f()),
@@ -198,7 +200,7 @@ void GuitarGraph::draw(double time) {
}
engine(time);
Dimensions dimensions(1.0); // FIXME: bogus aspect ratio (is this fixable?)
- dimensions.screenBottom().fixedWidth(0.5f);
+ dimensions.screenBottom().middle(m_cx).fixedWidth(m_width);
glutil::PushMatrix pmb;
glTranslatef(0.5 * (dimensions.x1() + dimensions.x2()), dimensions.y2(), 0.0f);
glRotatef(85.0f, 1.0f, 0.0f, 0.0f);
diff --git a/game/guitargraph.hh b/game/guitargraph.hh
index 7e3d2ab..eac6681 100644
--- a/game/guitargraph.hh
+++ b/game/guitargraph.hh
@@ -53,6 +53,7 @@ class GuitarGraph {
*/
void draw(double time);
void engine(double time);
+ void position(double cx, double width) { m_cx = cx; m_width = width; }
private:
input::InputDev m_input;
Song const& m_song;
@@ -61,6 +62,7 @@ class GuitarGraph {
AnimValue m_pickValue;
boost::ptr_vector<Texture> m_necks;
bool m_drums;
+ double m_cx, m_width;
std::size_t m_instrument;
void drumHit(double time, int pad);
void guitarPlay(double time, input::Event const& ev);
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index 6e4d153..f359d95 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -32,12 +32,26 @@ void ScreenSing::enter() {
boost::ptr_vector<Analyzer>& analyzers = m_capture.analyzers();
m_engine.reset(new Engine(m_audio, *m_song, analyzers.begin(), analyzers.end(), m_players));
m_layout_singer.reset(new LayoutSinger(*m_song, m_players, theme));
- if (m_song->music.size() > 1) m_guitarGraph.reset(new GuitarGraph(*m_song));
+ // I know some purists would hang me for this loop
+ for (int num = 0; true; ++num) {
+ try {
+ m_instruments.push_back(new GuitarGraph(*m_song));
+ } catch (std::runtime_error&) { break; }
+ }
+ for (int num = 0; true; ++num) {
+ try {
+ m_instruments.push_back(new GuitarGraph(*m_song, true));
+ } catch (std::runtime_error&) { break; }
+ }
+ double iw = std::min(0.5, 1.0 / m_instruments.size());
+ for (Instruments::size_type i = 0, s = m_instruments.size(); i < s; ++i) {
+ m_instruments[i].position((0.5 + i - 0.5 * s) * iw, iw);
+ }
}
void ScreenSing::exit() {
m_score_window.reset();
- m_guitarGraph.reset();
+ m_instruments.clear();
m_layout_singer.reset();
m_engine.reset();
m_pause_icon.reset();
@@ -170,7 +184,7 @@ void ScreenSing::draw() {
theme->bg_top.draw();
}
- if (m_guitarGraph.get()) m_guitarGraph->draw(time);
+ for (Instruments::iterator it = m_instruments.begin(); it != m_instruments.end(); ++it) it->draw(time);
if( m_song->tracks.empty() ) {
m_layout_singer->draw(time, LayoutSinger::BOTTOM);
diff --git a/game/screen_sing.hh b/game/screen_sing.hh
index 07e3668..ca5ace9 100644
--- a/game/screen_sing.hh
+++ b/game/screen_sing.hh
@@ -71,7 +71,8 @@ class ScreenSing: public Screen {
boost::scoped_ptr<Surface> m_pause_icon;
boost::scoped_ptr<Engine> m_engine;
boost::scoped_ptr<LayoutSinger> m_layout_singer;
- boost::scoped_ptr<GuitarGraph> m_guitarGraph;
+ typedef boost::ptr_vector<GuitarGraph> Instruments;
+ Instruments m_instruments;
double m_latencyAV; // Latency between audio and video output (do not confuse with latencyAR)
boost::shared_ptr<ThemeSing> theme;
AnimValue m_quitTimer;
|
|
From: knittl <kn...@us...> - 2009-08-03 08:40:42
|
Module: performous
Branch: master
Commit: 2f88cdb319a4fd1d933cc709b629c53d03897dd4
Author: Vincent Le Ligeour <yo...@us...>
Date: Sat Aug 1 18:12:49 2009 +0200
Made it work except if you press a button before starting performous
---
game/joystick.cc | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/game/joystick.cc b/game/joystick.cc
index 691042b..8971b60 100644
--- a/game/joystick.cc
+++ b/game/joystick.cc
@@ -68,7 +68,7 @@ void input::init_devices() {
for( unsigned int i = 0 ; i < num_buttons ; ++i ) {
SDL_Event event;
int state = SDL_JoystickGetButton(input::sdl_devices[id], i);
- if( state == 0 ) {
+ if( state != 0 ) {
event.type = SDL_JOYBUTTONDOWN;
event.jbutton.type = SDL_JOYBUTTONDOWN;
event.jbutton.state = SDL_PRESSED;
|
|
From: knittl <kn...@us...> - 2009-08-03 08:40:40
|
Module: performous
Branch: master
Commit: 68ce777bcb78b9f11a672aab08fbbb92ac20d8e6
Author: Vincent Le Ligeour <yo...@us...>
Date: Sat Aug 1 18:10:18 2009 +0200
Tried to fix initialization of button states
---
game/joystick.cc | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/game/joystick.cc b/game/joystick.cc
index 21c3f9c..691042b 100644
--- a/game/joystick.cc
+++ b/game/joystick.cc
@@ -67,11 +67,19 @@ void input::init_devices() {
unsigned int num_buttons = SDL_JoystickNumButtons(input::sdl_devices[id]);
for( unsigned int i = 0 ; i < num_buttons ; ++i ) {
SDL_Event event;
- event.type = SDL_JOYBUTTONDOWN;
- event.jbutton.type = SDL_JOYBUTTONDOWN;
+ int state = SDL_JoystickGetButton(input::sdl_devices[id], i);
+ if( state == 0 ) {
+ event.type = SDL_JOYBUTTONDOWN;
+ event.jbutton.type = SDL_JOYBUTTONDOWN;
+ event.jbutton.state = SDL_PRESSED;
+ } else {
+ event.type = SDL_JOYBUTTONUP;
+ event.jbutton.type = SDL_JOYBUTTONUP;
+ event.jbutton.state = SDL_RELEASED;
+ }
+
event.jbutton.which = id;
event.jbutton.button = i;
- event.jbutton.state = SDL_PRESSED;
input::pushEvent(event);
}
}
|
|
From: knittl <kn...@us...> - 2009-08-03 08:40:39
|
Module: performous
Branch: master
Commit: f1a97897ece494bb563679560250ea10f8f81227
Author: Vincent Le Ligeour <yo...@us...>
Date: Sat Aug 1 17:27:17 2009 +0200
Added pick events
---
game/joystick.cc | 28 ++++++++++++++++++++++++++--
game/joystick.hh | 6 ++++++
2 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/game/joystick.cc b/game/joystick.cc
index eb01fa5..e115e00 100644
--- a/game/joystick.cc
+++ b/game/joystick.cc
@@ -104,14 +104,38 @@ void input::init() {
bool input::pushEvent(SDL_Event _e) {
int joy_id;
using namespace input::Private;
+
+ Event event;
switch(_e.type) {
case SDL_JOYAXISMOTION:
joy_id = _e.jaxis.which;
- // do stuffs to devices[joy_id] events (PICK)
+
+ event.type = input::Event::PICK;
+ for( unsigned int i = 0 ; i < BUTTONS ; ++i ) {
+ event.pressed[i] = devices[joy_id].pressed(i);
+ }
+ if(_e.jaxis.value > 0 ) { // down
+ event.button = 0;
+ devices[joy_id].addEvent(event);
+ } else if(_e.jaxis.value < 0 ) { // up
+ event.button = 1;
+ devices[joy_id].addEvent(event);
+ }
break;
case SDL_JOYHATMOTION:
joy_id = _e.jhat.which;
- // do stuffs to devices[joy_id] events (PICK)
+
+ event.type = input::Event::PICK;
+ for( unsigned int i = 0 ; i < BUTTONS ; ++i ) {
+ event.pressed[i] = devices[joy_id].pressed(i);
+ }
+ if(_e.jhat.value == SDL_HAT_DOWN ) {
+ event.button = 0;
+ devices[joy_id].addEvent(event);
+ } else if(_e.jhat.value == SDL_HAT_UP ) {
+ event.button = 1;
+ devices[joy_id].addEvent(event);
+ }
break;
case SDL_JOYBUTTONDOWN:
case SDL_JOYBUTTONUP:
diff --git a/game/joystick.hh b/game/joystick.hh
index e65e7d4..6e2c004 100644
--- a/game/joystick.hh
+++ b/game/joystick.hh
@@ -35,6 +35,12 @@ namespace input {
void addEvent(Event _event) {
// only add event if the device is assigned
if( m_assigned ) m_events.push_back(_event);
+ if( _event.type == input::Event::PICK )
+ std::cout << "PICK event " << _event.button << std::endl;
+ if( _event.type == input::Event::PRESS )
+ std::cout << "PRESS event " << _event.button << std::endl;
+ if( _event.type == input::Event::RELEASE )
+ std::cout << "RELEASE event " << _event.button << std::endl;
// always keep track of button status
for( unsigned int i = 0 ; i < BUTTONS ; ++i ) {
m_pressed[i] = _event.pressed[i];
|
|
From: knittl <kn...@us...> - 2009-08-03 08:40:39
|
Module: performous
Branch: master
Commit: 05b678e6dada0a38af37e4f92386e5408adee747
Author: Vincent Le Ligeour <yo...@us...>
Date: Sat Aug 1 17:57:23 2009 +0200
Added input with event
---
game/joystick.cc | 56 +++++++++++++++++++++++++++++++++++++++--------------
game/joystick.hh | 28 +++++++++-----------------
2 files changed, 51 insertions(+), 33 deletions(-)
diff --git a/game/joystick.cc b/game/joystick.cc
index e115e00..21c3f9c 100644
--- a/game/joystick.cc
+++ b/game/joystick.cc
@@ -3,22 +3,29 @@
#include <boost/lexical_cast.hpp>
-/*
-enum TypeSDL {UNKNOWN, GUITAR_RB, DRUM_RB, GUITAR_GH, DRUM_GH, TYPESDL_N};
static const unsigned SDL_BUTTONS = 6;
-int buttonFromSDL(TypeSDL type, unsigned sdlButton) {
- static const int inputmap[TYPESDL_N][SDL_BUTTONS] = {
+int buttonFromSDL(input::Private::Type _type, unsigned int _sdl_button) {
+ static const int inputmap[4][SDL_BUTTONS] = {
{ 2, 0, 1, 3, 4, 0 }, // Guitar Hero guitar
{ 3, 4, 1, 2, 0, 4 }, // Guitar Hero drums
{ 3, 0, 1, 2, 4, 0 }, // Rock Band guitar
{ 3, 4, 1, 2, 0, 0 } // Rock Band drums
};
- if (sdlButton > SDL_BUTTONS) return -1;
- return inputmap[type][sdlButton];
+ if( _sdl_button > 6 ) return -1;
+ switch(_type) {
+ case input::Private::GUITAR_GH:
+ return inputmap[0][_sdl_button];
+ case input::Private::DRUMS_GH:
+ return inputmap[1][_sdl_button];
+ case input::Private::GUITAR_RB:
+ return inputmap[2][_sdl_button];
+ case input::Private::DRUMS_RB:
+ return inputmap[3][_sdl_button];
+ default:
+ return -1;
+ }
}
-*/
-
/*
@@ -80,21 +87,21 @@ void input::init() {
std::cout << "Id: " << i << std::endl;
std::cout << " Name: " << name << std::endl;
if( name.find("Guitar Hero3") != std::string::npos ) {
- input::Private::devices[i] = input::Private::InputDevPrivate(input::Private::GUITAR_GH);
std::cout << " Detected as: Guitar Hero Guitar" << std::endl;
+ input::Private::devices[i] = input::Private::InputDevPrivate(input::Private::GUITAR_GH);
} else if( name.find("Guitar Hero4") != std::string::npos ) {
// here we can have both drumkit or guitar .... let say the drumkit
- input::Private::devices[i] = input::Private::InputDevPrivate(input::Private::DRUM_GH);
std::cout << " Detected as: Guitar Hero Drums (guessed)" << std::endl;
+ input::Private::devices[i] = input::Private::InputDevPrivate(input::Private::DRUMS_GH);
} else if( name.find("Harmonix Guitar") != std::string::npos ) {
std::cout << " Detected as: RockBand Guitar" << std::endl;
input::Private::devices[i] = input::Private::InputDevPrivate(input::Private::GUITAR_RB);
} else if( name.find("Harmonix Drum Kit") != std::string::npos ) {
std::cout << " Detected as: RockBand Drums" << std::endl;
- input::Private::devices[i] = input::Private::InputDevPrivate(input::Private::DRUM_RB);
+ input::Private::devices[i] = input::Private::InputDevPrivate(input::Private::DRUMS_RB);
} else {
- std::cout << " Detected as: Unknwown (please report the name)" << std::endl;
- input::Private::devices[i] = input::Private::InputDevPrivate();
+ std::cout << " Detected as: Unknwown (please report the name, assuming Guitar Hero Drums)" << std::endl;
+ input::Private::devices[i] = input::Private::InputDevPrivate(input::Private::DRUMS_GH);
}
}
// Here we should send an event to have correct state buttons
@@ -103,6 +110,7 @@ void input::init() {
bool input::pushEvent(SDL_Event _e) {
int joy_id;
+ int button;
using namespace input::Private;
Event event;
@@ -138,10 +146,28 @@ bool input::pushEvent(SDL_Event _e) {
}
break;
case SDL_JOYBUTTONDOWN:
+ joy_id = _e.jbutton.which;
+ button = buttonFromSDL(devices[joy_id].type(),_e.jbutton.button);
+ if( button == -1 ) break;
+ for( unsigned int i = 0 ; i < BUTTONS ; ++i ) {
+ event.pressed[i] = devices[joy_id].pressed(i);
+ }
+ event.type = input::Event::PRESS;
+ event.button = button;
+ event.pressed[button] = true;
+ devices[joy_id].addEvent(event);
+ break;
case SDL_JOYBUTTONUP:
joy_id = _e.jbutton.which;
- // do stuffs to devices[joy_id] states (BUTTONS)
- // do stuffs to devices[joy_id] events (BUTTONS)
+ button = buttonFromSDL(devices[joy_id].type(),_e.jbutton.button);
+ if( button == -1 ) break;
+ for( unsigned int i = 0 ; i < BUTTONS ; ++i ) {
+ event.pressed[i] = devices[joy_id].pressed(i);
+ }
+ event.type = input::Event::RELEASE;
+ event.button = button;
+ event.pressed[button] = false;
+ devices[joy_id].addEvent(event);
break;
case SDL_JOYBALLMOTION:
default:
diff --git a/game/joystick.hh b/game/joystick.hh
index 6e2c004..603fa23 100644
--- a/game/joystick.hh
+++ b/game/joystick.hh
@@ -22,10 +22,11 @@ namespace input {
};
namespace Private {
- enum Type {UNKNOWN, GUITAR_RB, DRUM_RB, GUITAR_GH, DRUM_GH};
+ enum Type {GUITAR_RB, DRUMS_RB, GUITAR_GH, DRUMS_GH};
class InputDevPrivate {
public:
- InputDevPrivate(input::Private::Type _type = input::Private::UNKNOWN) : m_assigned(false), m_type(_type) {};
+ InputDevPrivate() : m_assigned(false), m_type(input::Private::DRUMS_GH) {};
+ InputDevPrivate(input::Private::Type _type) : m_assigned(false), m_type(_type) {};
bool tryPoll(Event& _event) {
if( m_events.empty() ) return false;
_event = m_events.front();
@@ -57,22 +58,12 @@ namespace input {
(m_type == input::Private::GUITAR_GH || m_type == input::Private::GUITAR_RB) ) {
return true;
} else if( _type == input::DRUMS &&
- (m_type == input::Private::DRUM_GH || m_type == input::Private::DRUM_RB) ) {
+ (m_type == input::Private::DRUMS_GH || m_type == input::Private::DRUMS_RB) ) {
return true;
} else {
return false;
}
};
- void setType(input::DevType _type) {
- if( _type == input::GUITAR ) {
- m_type = input::Private::GUITAR_RB;
- } else if( _type == input::DRUMS ) {
- m_type = input::Private::DRUM_RB;
- } else {
- m_type = input::Private::UNKNOWN;
- }
- init_devices();
- };
private:
std::deque<Event> m_events;
bool m_assigned;
@@ -108,12 +99,13 @@ namespace input {
throw std::runtime_error("No matching instrument available");
};
~InputDev() {
- std::cout << "Releasing @" << m_device_id << std::endl;
- input::Private::devices[m_device_id].unassign();
+ using namespace input::Private;
+ // we assume find will success
+ devices.find(m_device_id)->second.unassign();
};
- bool tryPoll(Event& _e) {return input::Private::devices[m_device_id].tryPoll(_e);};
- void addEvent(Event _e) {input::Private::devices[m_device_id].addEvent(_e);};
- bool pressed(int _button) {return input::Private::devices[m_device_id].pressed(_button);}; // Current state
+ bool tryPoll(Event& _e) {return input::Private::devices.find(m_device_id)->second.tryPoll(_e);};
+ void addEvent(Event _e) {input::Private::devices.find(m_device_id)->second.addEvent(_e);};
+ bool pressed(int _button) {return input::Private::devices.find(m_device_id)->second.pressed(_button);}; // Current state
private:
unsigned int m_device_id; // should be some kind of reference
};
|
|
From: knittl <kn...@us...> - 2009-08-03 08:40:37
|
Module: performous Branch: master Commit: 76d8bb952ea3a0a24fc3d6ffc8847d3b74cf367c Author: Lasse Karkkainen <tro...@tr...> Date: Sat Aug 1 18:36:39 2009 +0300 Merge branch 'master' of ssh://zi.fi/performous --- |
|
From: knittl <kn...@us...> - 2009-08-03 08:40:35
|
Module: performous
Branch: master
Commit: 26ce43f4167a7cf7feeb55e18498257e73a081f4
Author: Lasse Karkkainen <tro...@tr...>
Date: Sat Aug 1 18:34:41 2009 +0300
GuitarGraph cleanup.
---
game/guitargraph.cc | 28 ++++++++++++++++------------
1 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index c349804..4bd7a01 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -19,6 +19,15 @@ namespace {
float a = clamp(1.0 - t / future); // Note: we want 1.0 alpha already at zero t.
return std::pow(a, 0.8); // Nicer curve
}
+
+ double points(double error) {
+ double score = 15;
+ if (error < 0.1) score += 15;
+ if (error < 0.05) score += 15;
+ if (error < 0.03) score += 5;
+ return score;
+ }
+
}
GuitarGraph::GuitarGraph(Song const& song, bool drums):
@@ -88,10 +97,7 @@ void GuitarGraph::drumHit(double time, int fret) {
tolerance = std::abs(it2->begin - time);
} while (++it2tmp != it2end && std::abs(it2tmp->begin - time) < tolerance);
if (!d) throw std::logic_error("d is NULL in GuitarGraph::engine");
- m_score += 15;
- if (tolerance < 0.1) m_score += 15;
- if (tolerance < 0.05) m_score += 15;
- if (tolerance < 0.03) m_score += 5;
+ m_score += points(tolerance);
m_notes[d] = 2;
}
@@ -106,7 +112,7 @@ void GuitarGraph::guitarPlay(double time, input::Event const& ev) {
m_hammerReady.setTarget(0.0);
// Find any suitable note within the tolerance
double tolerance = 0.2;
- if (!picked) tolerance *= 0.5; // Hammering has stricter limits
+ if (!picked) tolerance *= 0.5; // Hammering and drums have stricter limits
Chords::iterator best = m_chords.end();
for (Chords::iterator it = m_chordIt; it != m_chords.end() && it->begin <= time + tolerance; ++it) {
if (it->status > 1) continue; // Already picked, can't play again
@@ -115,7 +121,7 @@ void GuitarGraph::guitarPlay(double time, input::Event const& ev) {
if (!it->tappable) continue; // Cannot tap
Chords::iterator tmp = it;
if (tmp == m_chords.begin() || (--tmp)->status == 0) continue; // The previous note not played
- }
+ }
if (!it->matches(frets)) continue;
double error = std::abs(it->begin - time);
if (error < tolerance) {
@@ -123,7 +129,7 @@ void GuitarGraph::guitarPlay(double time, input::Event const& ev) {
tolerance = error;
}
}
- std::cout << (picked ? "Pick: " : "Tap: ");
+ std::cout << (picked ? "Hard: " : "Soft: ");
if (best == m_chords.end()) {
std::cout << "MISS" << std::endl;
if (picked) {
@@ -135,10 +141,8 @@ void GuitarGraph::guitarPlay(double time, input::Event const& ev) {
int& score = m_chordIt->score;
std::cout << "HIT, old score = " << score;
m_score -= score;
- score = 15;
- if (tolerance < 0.1) score += 15;
- if (tolerance < 0.05) score += 15;
- if (tolerance < 0.03) score += 5;
+ score = points(tolerance);
+ score *= m_chordIt->polyphony;
std::cout << ", new score = " << score << std::endl;
m_chordIt->status = 1 + picked;
m_score += score;
@@ -184,7 +188,7 @@ glutil::Color const& GuitarGraph::color(int fret) const {
void GuitarGraph::draw(double time) {
if (time < -0.5) {
- std::string txt = "Play a fret to change:\n";
+ std::string txt = (m_drums ? "Hit a pad to change:\n" : "Play a fret to change:\n");
txt += m_song.tracks[m_instrument].name + "/" + diffv[m_level].name;
m_text.dimensions.screenBottom(-0.05).middle(0.0);
m_text.draw(txt);
|
|
From: knittl <kn...@us...> - 2009-08-03 08:40:32
|
Module: performous Branch: master Commit: 8ad7c65bfa0b5485942cfe01e8a2e2f3f09ad414 Author: Vincent Le Ligeour <yo...@us...> Date: Sat Aug 1 17:12:02 2009 +0200 Removed old joystick code Fixed segfault on practice exit Added some comment to see InputDev aquired/relesed --- game/joystick.cc | 142 +++-------------------------------------------- game/joystick.hh | 78 +++---------------------- game/main.cc | 3 - game/screen_practice.cc | 48 ++++++++-------- 4 files changed, 43 insertions(+), 228 deletions(-) |
|
From: knittl <kn...@us...> - 2009-08-03 08:40:31
|
Module: performous
Branch: master
Commit: b96ec107fd1a4d178374648ba86809610877ca86
Author: Vincent Le Ligeour <yo...@us...>
Date: Sat Aug 1 16:31:16 2009 +0200
Fixed compilation errors
---
game/screen_practice.cc | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/game/screen_practice.cc b/game/screen_practice.cc
index 38543d7..7a724c7 100644
--- a/game/screen_practice.cc
+++ b/game/screen_practice.cc
@@ -42,7 +42,7 @@ void ScreenPractice::manageEvent(SDL_Event event) {
}
}
input::Event input_event;
- while( drums->tryPollEvent(input_event) ) {
+ while( drums->tryPoll(input_event) ) {
if(input_event.type == input::Event::PRESS) {
switch(input_event.button) {
case 0:
|
|
From: knittl <kn...@us...> - 2009-08-03 08:40:29
|
Module: performous
Branch: master
Commit: 0efcf1019bcf5894ec080561be767ca5d69ecf55
Author: Vincent Le Ligeour <yo...@us...>
Date: Sat Aug 1 16:20:34 2009 +0200
Fixed compilation errors
Moved practice screen to new intrument management
---
game/joystick.cc | 2 ++
game/screen_practice.cc | 27 +++++++++++++++------------
game/screen_practice.hh | 2 ++
3 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/game/joystick.cc b/game/joystick.cc
index d23e04a..9a8f6fb 100644
--- a/game/joystick.cc
+++ b/game/joystick.cc
@@ -3,6 +3,7 @@
#include <boost/lexical_cast.hpp>
+/*
enum TypeSDL {UNKNOWN, GUITAR_RB, DRUM_RB, GUITAR_GH, DRUM_GH, TYPESDL_N};
static const unsigned SDL_BUTTONS = 6;
@@ -16,6 +17,7 @@ int buttonFromSDL(TypeSDL type, unsigned sdlButton) {
if (sdlButton > SDL_BUTTONS) return -1;
return inputmap[type][sdlButton];
}
+*/
/*
diff --git a/game/screen_practice.cc b/game/screen_practice.cc
index 7cd3339..38543d7 100644
--- a/game/screen_practice.cc
+++ b/game/screen_practice.cc
@@ -1,7 +1,6 @@
#include "screen_practice.hh"
#include "util.hh"
-#include "joystick.hh"
#include "configuration.hh"
ScreenPractice::ScreenPractice(std::string const& name, Audio& audio, Capture& capture):
@@ -17,11 +16,13 @@ void ScreenPractice::enter() {
m_vumeters.push_back(b = new ProgressBar(getThemePath("vumeter_bg.svg"), getThemePath("vumeter_fg.svg"), ProgressBar::VERTICAL, 0.136, 0.023));
b->dimensions.screenBottom().left(-0.4 + i * 0.2).fixedWidth(0.04);
}
+ drums.reset(new input::InputDev(input::DRUMS));
}
void ScreenPractice::exit() {
m_vumeters.clear();
theme.reset();
+ drums.reset();
}
void ScreenPractice::manageEvent(SDL_Event event) {
@@ -40,27 +41,29 @@ void ScreenPractice::manageEvent(SDL_Event event) {
break;
}
}
- JoystickEvent joy_event;
- for(Joysticks::iterator it = joysticks.begin() ; it != joysticks.end() ; ++it ) {
- if( it->second.tryPollEvent(joy_event) && joy_event.type == JoystickEvent::BUTTON_DOWN) {
- switch(joy_event.button_id) {
- case PS3_DRUM_CONTROLLER_RED: // Snare drum
+ input::Event input_event;
+ while( drums->tryPollEvent(input_event) ) {
+ if(input_event.type == input::Event::PRESS) {
+ switch(input_event.button) {
+ case 0:
+ m_audio.playMusic(getDataPath("sounds/drum_bass.ogg"));
+ break;
+ case 1:
m_audio.playMusic(getDataPath("sounds/drum_snare.ogg"));
break;
- case PS3_DRUM_CONTROLLER_BLUE: // Tom 1
+ case 2:
m_audio.playMusic(getDataPath("sounds/drum_tom1.ogg"));
break;
- case PS3_DRUM_CONTROLLER_GREEN: // Tom 2
+ case 3:
m_audio.playMusic(getDataPath("sounds/drum_tom2.ogg"));
break;
- case PS3_DRUM_CONTROLLER_YELLOW: // Hi hat
+ case 4:
m_audio.playMusic(getDataPath("sounds/drum_hi-hat.ogg"));
break;
- case PS3_DRUM_CONTROLLER_ORANGE: // crash cymbal
+ case 5:
m_audio.playMusic(getDataPath("sounds/drum_cymbal.ogg"));
break;
- case PS3_DRUM_CONTROLLER_XXX: // Drum bass
- m_audio.playMusic(getDataPath("sounds/drum_bass.ogg"));
+ default:
break;
}
}
diff --git a/game/screen_practice.hh b/game/screen_practice.hh
index 1816055..84d60e2 100644
--- a/game/screen_practice.hh
+++ b/game/screen_practice.hh
@@ -7,6 +7,7 @@
#include "theme.hh"
#include "opengl_text.hh"
#include "progressbar.hh"
+#include "joystick.hh"
/// screen for practice mode
class ScreenPractice : public Screen {
@@ -26,6 +27,7 @@ class ScreenPractice : public Screen {
Capture& m_capture;
boost::ptr_vector<ProgressBar> m_vumeters;
boost::scoped_ptr<ThemePractice> theme;
+ boost::scoped_ptr<input::InputDev> drums;
};
#endif
|
|
From: knittl <kn...@us...> - 2009-08-03 08:40:28
|
Module: performous
Branch: master
Commit: f083cb30d165d72d453ef66d87a9feb45174aae5
Author: Lasse Karkkainen <tro...@tr...>
Date: Sat Aug 1 16:46:58 2009 +0300
Harmonix instrument IDs.
---
game/joystick.cc | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/game/joystick.cc b/game/joystick.cc
index 45cbe89..eb07ac7 100644
--- a/game/joystick.cc
+++ b/game/joystick.cc
@@ -144,8 +144,10 @@ void input::init() {
} else if( name.find("Guitar Hero4") != std::string::npos ) {
// here we can have both drumkit or guitar .... let say the drumkit
input::Private::devices[i] = input::Private::InputDevPrivate(input::Private::DRUM_GH);
- } else if( name.find("Harmonix") != std::string::npos ) {
+ } else if( name.find("Harmonix Guitar") != std::string::npos ) {
input::Private::devices[i] = input::Private::InputDevPrivate(input::Private::GUITAR_RB);
+ } else if( name.find("Harmonix Drum Kit") != std::string::npos ) {
+ input::Private::devices[i] = input::Private::InputDevPrivate(input::Private::DRUM_RB);
} else {
input::Private::devices[i] = input::Private::InputDevPrivate();
}
|
|
From: knittl <kn...@us...> - 2009-08-03 08:40:28
|
Module: performous Branch: master Commit: 9653a81f69ed1c696502bfc486025d292efaf30f Author: Lasse Karkkainen <tro...@tr...> Date: Sat Aug 1 17:27:43 2009 +0300 GuitarGraph hacked so that it compiles on the new input system. --- game/guitargraph.cc | 136 ++++++++++++++++++++------------------------------- game/guitargraph.hh | 7 ++- game/joystick.cc | 35 ++++++++++++- game/screen_sing.cc | 1 - 4 files changed, 91 insertions(+), 88 deletions(-) |
|
From: knittl <kn...@us...> - 2009-08-03 08:40:26
|
Module: performous
Branch: master
Commit: edc7575e4e5a68e9c14aa10c1d7a8c5817f571ab
Author: Vincent Le Ligeour <yo...@us...>
Date: Sat Aug 1 16:11:31 2009 +0200
Renames InputDevEvent into Event
---
game/joystick.hh | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/game/joystick.hh b/game/joystick.hh
index 9764e9a..ea6b8c5 100644
--- a/game/joystick.hh
+++ b/game/joystick.hh
@@ -78,7 +78,7 @@ namespace input {
extern SDL_devices sdl_devices;
void init_devices();
- struct InputDevEvent {
+ struct Event {
enum Type { PRESS, RELEASE, PICK };
Type type;
int button; // Translated button number for press/release events. 0 for pick down, 1 for pick up (NOTE: these are NOT pick press/release events but rather different directions)
@@ -91,13 +91,13 @@ namespace input {
class InputDevPrivate {
public:
InputDevPrivate(input::Private::Type _type = input::Private::UNKNOWN) : m_assigned(false), m_type(_type) {};
- bool tryPoll(InputDevEvent& _event) {
+ bool tryPoll(Event& _event) {
if( m_events.empty() ) return false;
_event = m_events.front();
m_events.pop_front();
return true;
};
- void addEvent(InputDevEvent _event) {
+ void addEvent(Event _event) {
// only add event if the device is assigned
if( m_assigned ) m_events.push_back(_event);
// always keep track of button status
@@ -133,7 +133,7 @@ namespace input {
init_devices();
};
private:
- std::deque<InputDevEvent> m_events;
+ std::deque<Event> m_events;
bool m_assigned;
bool m_pressed[BUTTONS];
input::Private::Type m_type;
@@ -161,8 +161,8 @@ namespace input {
throw std::runtime_error("No matching instrument available");
};
~InputDev() {input::Private::devices[m_device_id].unassign();};
- bool tryPoll(InputDevEvent& _e) {return input::Private::devices[m_device_id].tryPoll(_e);};
- void addEvent(InputDevEvent _e) {input::Private::devices[m_device_id].addEvent(_e);};
+ bool tryPoll(Event& _e) {return input::Private::devices[m_device_id].tryPoll(_e);};
+ void addEvent(Event _e) {input::Private::devices[m_device_id].addEvent(_e);};
bool pressed(int _button) {return input::Private::devices[m_device_id].pressed(_button);}; // Current state
private:
unsigned int m_device_id; // should be some kind of reference
@@ -172,7 +172,7 @@ namespace input {
void init();
// clear all event stuffs
void clear();
- // Returns true if event is taken, feed an InputDev by transforming SDL_Event into InputDevEvent
+ // Returns true if event is taken, feed an InputDev by transforming SDL_Event into Event
bool pushEvent(SDL_Event);
};
|
|
From: knittl <kn...@us...> - 2009-08-03 08:40:25
|
Module: performous
Branch: master
Commit: bc368146609b9bf157af69186607ff9075bc678d
Author: Vincent Le Ligeour <yo...@us...>
Date: Sat Aug 1 15:52:44 2009 +0200
Fixed compilation error inside joystick.hh
---
game/joystick.hh | 20 +++++---------------
1 files changed, 5 insertions(+), 15 deletions(-)
diff --git a/game/joystick.hh b/game/joystick.hh
index 748cd9d..9764e9a 100644
--- a/game/joystick.hh
+++ b/game/joystick.hh
@@ -111,23 +111,21 @@ namespace input {
bool assigned() {return m_assigned;};
bool pressed(int _button) {return m_pressed[_button];};
input::Private::Type type() {return m_type;};
- bool type_match( input::Type _type) {
- if( _type == input::UNKNOWN && m_type == input::Private::UNKNOWN ) {
- return true;
- } else if( _type == input::GUITAR &&
+ bool type_match( input::DevType _type) {
+ if( _type == input::GUITAR &&
(m_type == input::Private::GUITAR_GH || m_type == input::Private::GUITAR_RB) ) {
return true;
- } else if( _type == input::DRUM &&
+ } else if( _type == input::DRUMS &&
(m_type == input::Private::DRUM_GH || m_type == input::Private::DRUM_RB) ) {
return true;
} else {
return false;
}
};
- void setType(input::Type _type) {
+ void setType(input::DevType _type) {
if( _type == input::GUITAR ) {
m_type = input::Private::GUITAR_RB;
- } else if( _type == input::DRUM ) {
+ } else if( _type == input::DRUMS ) {
m_type = input::Private::DRUM_RB;
} else {
m_type = input::Private::UNKNOWN;
@@ -160,14 +158,6 @@ namespace input {
return;
}
}
- for(InputDevs::iterator it = devices.begin() ; it != devices.end() ; ++it) {
- if( !it->second.assigned() && it->second.type_match(input::UNKNOWN) ) {
- m_device_id = it->first;
- it->second.setType(_type);
- it->second.assign();
- return;
- }
- }
throw std::runtime_error("No matching instrument available");
};
~InputDev() {input::Private::devices[m_device_id].unassign();};
|
|
From: knittl <kn...@us...> - 2009-08-03 08:40:23
|
Module: performous Branch: master Commit: 4c21d93f9770926e134af7f90d105c829b015a32 Author: Lasse Karkkainen <tro...@tr...> Date: Sat Aug 1 16:42:46 2009 +0300 Merge branch 'master' of ssh://zi.fi/performous --- |
|
From: knittl <kn...@us...> - 2009-08-03 08:40:21
|
Module: performous Branch: master Commit: a7a5cb4d1eee8eab2718697eab4133b37fc1ce33 Author: Lasse Karkkainen <tro...@tr...> Date: Sat Aug 1 16:42:31 2009 +0300 Merge branch 'master' of ssh://zi.fi/performous Conflicts: game/joystick.hh --- |