|
From: Yoda-JM <yo...@us...> - 2010-08-06 16:51:53
|
Module: performous
Branch: master
Commit: 7a4dedaa40563dd1c73c289409a29f8cd16e27fd
Author: Vincent Le Ligeour <yo...@us...>
Date: Wed Aug 4 22:47:34 2010 +0200
Fixed compilation when using portmidi
---
game/joystick.cc | 9 ++++-----
game/joystick.hh | 1 +
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/game/joystick.cc b/game/joystick.cc
index a782a1b..c6c9c31 100644
--- a/game/joystick.cc
+++ b/game/joystick.cc
@@ -3,10 +3,12 @@
#include <boost/lexical_cast.hpp>
#include <boost/regex.hpp>
+input::Instruments g_instruments;
+
#ifdef USE_PORTMIDI
input::MidiDrums::MidiDrums(): stream(pm::findDevice(true, config["system/midi_input"].s())), devnum(0x8000) {
while (detail::devices.find(devnum) != detail::devices.end()) ++devnum;
- detail::devices[devnum] = detail::InputDevPrivate(detail::DRUMS_MIDI);
+ detail::devices.insert(std::make_pair<unsigned int, input::detail::InputDevPrivate>(devnum, detail::InputDevPrivate(g_instruments.find("DRUMS_GUITARHERO")->second)));
event.type = Event::PRESS;
for (unsigned int i = 0; i < BUTTONS; ++i) event.pressed[i] = false;
#if 1
@@ -107,7 +109,7 @@ void input::MidiDrums::process() {
event.time = now();
for (unsigned int i = 0; i < BUTTONS; ++i) event.pressed[i] = false;
event.pressed[it->second] = true;
- detail::devices[devnum].addEvent(event);
+ detail::devices.find(devnum)->second.addEvent(event);
}
}
#endif
@@ -115,7 +117,6 @@ void input::MidiDrums::process() {
input::detail::InputDevs input::detail::devices;
input::SDL::SDL_devices input::SDL::sdl_devices;
-
/// Abstract navigation actions for different input devices, including keyboard
input::NavButton input::getNav(SDL_Event const &e) {
if (e.type == SDL_KEYDOWN) {
@@ -219,8 +220,6 @@ void input::SDL::init_devices() {
#include "fs.hh"
#include <libxml++/libxml++.h>
-input::Instruments g_instruments;
-
namespace {
struct XMLError {
XMLError(xmlpp::Element& e, std::string msg): elem(e), message(msg) {}
diff --git a/game/joystick.hh b/game/joystick.hh
index 2d433da..31e0f30 100644
--- a/game/joystick.hh
+++ b/game/joystick.hh
@@ -150,6 +150,7 @@ namespace input {
}
#ifdef USE_PORTMIDI
+ // Warning: MidiDrums should be instanciated after Window (that load joysticks)
class MidiDrums {
public:
static bool enabled() { return true; }
|