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: Lasse Kärkkäi. <tr...@us...> - 2010-07-18 06:38:34
|
Module: performous Branch: portaudio Commit: 2e763d3921ad673cdc0e9ae48b7ec1b7429c4dab Author: Tapio Vierros <tap...@gm...> Date: Mon Jul 5 20:42:11 2010 +0300 Every singer now gets colored stars individually. --- game/notegraph.cc | 38 ++++---- game/notegraph.hh | 1 + game/notes.hh | 6 +- game/player.cc | 7 +- themes/default/star_glow.svg | 209 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 240 insertions(+), 21 deletions(-) |
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-07-18 06:38:31
|
Module: performous
Branch: portaudio
Commit: c783bf544100b9501830fd34c256ac9e30324b8a
Author: Felix Bertram <fl...@be...>
Date: Sun Jul 4 14:43:37 2010 -0700
Slowdown play
- uses pre-created time-stretched audio files
- minimal changes to code, uses warped time-base
---
game/audio.cc | 44 +++++++++++++++++++++++++++++++++++---------
game/audio.hh | 7 +++++--
game/guitargraph.cc | 4 +++-
game/main.cc | 2 ++
game/screen_sing.cc | 8 ++++++--
game/screen_sing.hh | 1 +
6 files changed, 52 insertions(+), 14 deletions(-)
diff --git a/game/audio.cc b/game/audio.cc
index ae4acfb..18824d8 100644
--- a/game/audio.cc
+++ b/game/audio.cc
@@ -5,6 +5,7 @@
#include <libda/fft.hpp> // For M_PI
#include <cmath>
#include <iostream>
+#include <boost/filesystem.hpp>
struct SampleStream {
SampleStream(boost::shared_ptr<FFmpeg> const& mpeg): m_mpeg(mpeg) {}
@@ -75,19 +76,39 @@ void Audio::play(Sample const& s, std::string const& volumeSetting) {
m_mixer.add(da::shared_ref(acc));
}
-void Audio::playMusic(std::map<std::string,std::string> const& filenames, bool preview, double fadeTime, double startPos) {
+void Audio::playMusic(std::map<std::string,std::string> const& filenames, bool preview, double fadeTime, double startPos, int speed) {
if (!isOpen()) return;
da::lock_holder l = m_mixer.lock();
fadeout(fadeTime);
boost::shared_ptr<da::chain> ch(new da::chain());
for(std::map<std::string,std::string>::const_iterator it = filenames.begin() ; it != filenames.end() ; ++it ) {
+ std::string f;
try {
- boost::shared_ptr<Stream> s(new Stream(it->second, m_rs.rate()));
+ f = it->second;
+ if (speed != 100) {
+ // instead of real-time time-stretching we use previously created files
+ // best effects have been achieved with SBSMS library
+ // as used by Audacity's Sliding Time Scale/ Pitch Shift plugin
+ std::string f2 = "-" + boost::lexical_cast<std::string>(speed) + ".ogg";
+ f.replace(f.find(".ogg"), 4, f2);
+ // std::cout << "loading time-stretched audio (" << f << ")" << std::endl;
+
+ if (!boost::filesystem::exists(f)) throw std::runtime_error("time-stretched file \"" + f +"\" not found");
+ }
+
+ boost::shared_ptr<Stream> s(new Stream(f, m_rs.rate()));
m_streams[it->first] = s;
ch->add(da::shared_ref(s));
s->seek(startPos);
} catch (std::runtime_error& e) {
- std::cerr << "Error loading " << it->second << " (" << e.what() << ")" << std::endl;
+ if (speed != 100) {
+ // in case time-stretching failed let's retry at normal speed
+ // TODO: we could also auto-create time-stretched files here
+ playMusic(filenames, preview, fadeTime, startPos, 100);
+ return;
+ }
+ // in case we are at normal speed we skip this file and try to continue
+ std::cerr << "Error loading " << f << " (" << e.what() << ")" << std::endl;
continue;
}
}
@@ -96,12 +117,14 @@ void Audio::playMusic(std::map<std::string,std::string> const& filenames, bool p
ch->add(boost::ref(m_volume));
m_mixer.fadein(da::shared_ref(ch), fadeTime, startPos);
if (!preview) pause(false);
+
+ m_speed = speed;
}
-void Audio::playMusic(std::string const& filename, bool preview, double fadeTime, double startPos) {
+void Audio::playMusic(std::string const& filename, bool preview, double fadeTime, double startPos, int speed) {
std::map<std::string,std::string> tmp;
tmp["unidentified"] = filename;
- playMusic(tmp, preview, fadeTime, startPos);
+ playMusic(tmp, preview, fadeTime, startPos, speed);
}
void Audio::stopMusic() {
@@ -120,12 +143,13 @@ void Audio::fadeout(double fadeTime) {
double Audio::getPosition() const {
da::lock_holder l = m_mixer.lock();
- return m_streams.empty() ? getNaN() : m_streams.begin()->second->pos();
+ // only the audio slows down; the game still uses original time base
+ return m_streams.empty() ? getNaN() : m_streams.begin()->second->pos() * m_speed/100.0;
}
double Audio::getLength() const {
da::lock_holder l = m_mixer.lock();
- return m_streams.empty() ? getNaN() : m_streams.begin()->second->duration();
+ return m_streams.empty() ? getNaN() : m_streams.begin()->second->duration() * m_speed/100.0;
}
bool Audio::isPlaying() const {
@@ -133,14 +157,16 @@ bool Audio::isPlaying() const {
return m_streams.empty() ? false : !m_streams.begin()->second->eof();
}
-void Audio::seek(double offset) {
+void Audio::seek(double offset2) {
+ double offset = offset2 * 100.0/m_speed;
da::lock_holder l = m_mixer.lock();
for(std::map<std::string,boost::shared_ptr<Stream> >::iterator it = m_streams.begin() ; it != m_streams.end() ; ++it)
it->second->seek(clamp(it->second->pos() + offset, 0.0, it->second->duration()));
pause(false);
}
-void Audio::seekPos(double pos) {
+void Audio::seekPos(double pos2) {
+ double pos = pos2 * 100.0/m_speed;
da::lock_holder l = m_mixer.lock();
for(std::map<std::string,boost::shared_ptr<Stream> >::iterator it = m_streams.begin() ; it != m_streams.end() ; ++it)
it->second->seek(pos);
diff --git a/game/audio.hh b/game/audio.hh
index e4f701f..d441cb1 100644
--- a/game/audio.hh
+++ b/game/audio.hh
@@ -94,9 +94,9 @@ class Audio {
* @param fadeTime time to fade
* @param startPos starting position
*/
- void playMusic(std::string const& filename, bool preview = false, double fadeTime = 0.5, double startPos = -0.2);
+ void playMusic(std::string const& filename, bool preview = false, double fadeTime = 0.5, double startPos = -0.2, int speed = 100);
/// plays a list of songs
- void playMusic(std::map<std::string,std::string> const& filenames, bool preview = false, double fadeTime = 0.5, double startPos = -0.2);
+ void playMusic(std::map<std::string,std::string> const& filenames, bool preview = false, double fadeTime = 0.5, double startPos = -0.2, int speed = 100);
/// plays a sample
void play(Sample const& s, std::string const& volumeSetting);
/// get pause status
@@ -107,6 +107,8 @@ class Audio {
void fadeout(double time = 1.0);
/** Get the length of the currently playing song, in seconds. **/
double getLength() const;
+ /// return current speed
+ int getSpeed() {return m_speed;}
/**
* This methods seek forward in the stream (backwards if
* argument is negative), and continues playing.
@@ -137,5 +139,6 @@ class Audio {
std::string m_volumeSetting;
da::mixer m_mixer;
std::map<std::string,boost::shared_ptr<Stream> > m_streams;
+ int m_speed;
};
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index 0be7a41..0fdf6aa 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -185,7 +185,9 @@ bool GuitarGraph::difficulty(Difficulty level) {
/// Core engine
void GuitarGraph::engine() {
double time = m_audio.getPosition();
- time -= config["audio/controller_delay"].f();
+ // need to compensate for speed as well. When playing at half speed,
+ // 1 second from getPosition is actually two seconds in real time
+ time -= config["audio/controller_delay"].f() * m_audio.getSpeed()/100.0;
// Handle key markers
if (!m_drums) {
for (int i = 0; i < m_pads; ++i) {
diff --git a/game/main.cc b/game/main.cc
index 91aed77..03da057 100644
--- a/game/main.cc
+++ b/game/main.cc
@@ -145,6 +145,8 @@ void audioSetup(Capture& capture, Audio& audio) {
if (channels != 2) throw std::runtime_error("Only stereo playback is supported, error in pdev=" + *it);
try {
audio.open(devstr, rate, frames);
+ // when we get here, we have successfully opened a device. let's use it!
+ break;
} catch (std::exception const& e) {
std::cerr << "Playback device pdev=" << *it << " failed and will be ignored:\n " << e.what() << std::endl;
}
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index dd822f3..0b52e85 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -31,6 +31,7 @@ namespace {
void ScreenSing::enter() {
//m_practmode = true; // un-comment this line to play with practice mode. temporary, of course!
+ m_speed = 75; // 75% slow-down; falls back to 100% if time-stretch files are not found. temporary, of course!
ScreenManager* sm = ScreenManager::getSingletonPtr();
sm->flashMessage(_("Loading song..."), 0.0, 1.0, 0.5);
sm->drawFlashMessage(); sm->window().swap(); // Make loading message show
@@ -85,6 +86,7 @@ void ScreenSing::enter() {
theme->timer.dimensions.screenTop(0.5 * m_progress->dimensions.h());
boost::ptr_vector<Analyzer>& analyzers = m_capture.analyzers();
m_layout_singer.reset(new LayoutSinger(m_song->vocals, m_database, theme));
+
// Load instrument and dance tracks
{
int type = 0; // 0 for dance, 1 for guitars, 2 for drums
@@ -108,7 +110,7 @@ void ScreenSing::enter() {
}
// Startup delay for instruments is longer than for singing only
double setup_delay = (m_instruments.empty() && m_dancers.empty() ? -1.0 : -8.0);
- m_audio.playMusic(m_song->music, false, 0.0, setup_delay);
+ m_audio.playMusic(m_song->music, false, 0.0, setup_delay, m_speed);
m_engine.reset(new Engine(m_audio, m_song->vocals, analyzers.begin(), analyzers.end(), m_database));
}
@@ -317,7 +319,9 @@ void ScreenSing::draw() {
// Get the time in the song
double length = m_audio.getLength();
double time = m_audio.getPosition();
- time -= config["audio/video_delay"].f();
+ // need to compensate for speed as well. When playing at half speed,
+ // 1 second from getPosition is actually two seconds in real time
+ time -= config["audio/video_delay"].f() * m_audio.getSpeed()/100.0;
double songPercent = clamp(time / length);
// Rendering starts
diff --git a/game/screen_sing.hh b/game/screen_sing.hh
index c743877..16cff8e 100644
--- a/game/screen_sing.hh
+++ b/game/screen_sing.hh
@@ -93,5 +93,6 @@ class ScreenSing: public Screen {
AnimValue m_quitTimer;
bool m_only_singers_alive;
bool m_practmode;
+ int m_speed; // speed in percent, 100 for normal, 50 for half
};
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-07-18 06:38:29
|
Module: performous Branch: portaudio Commit: 107a4c07d8a03dffa603a6d38eed6476c83bd70c Author: Felix Bertram <fl...@be...> Date: Fri Jul 2 10:20:13 2010 -0700 Midi I/O does not compile under Fedora 13 libporttime does not exist on Fedora 13 --- cmake/Modules/FindPortMidi.cmake | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/cmake/Modules/FindPortMidi.cmake b/cmake/Modules/FindPortMidi.cmake index f5126d8..38224a0 100644 --- a/cmake/Modules/FindPortMidi.cmake +++ b/cmake/Modules/FindPortMidi.cmake @@ -13,7 +13,7 @@ include(LibFindMacros) find_path(PortMidi_INCLUDE_DIR NAMES portmidi.h) find_library(PortMidi_LIBRARY NAMES portmidi) -find_library(PortTime_LIBRARY NAMES porttime) +find_library(PortTime_LIBRARY NAMES portmidi) set(PortMidi_PROCESS_INCLUDES PortMidi_INCLUDE_DIR) set(PortMidi_PROCESS_LIBS PortMidi_LIBRARY PortTime_LIBRARY) |
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-07-18 06:38:27
|
Module: performous
Branch: portaudio
Commit: 2ea1b45f0368a74a30f8782d318598495823c1ba
Author: Tapio Vierros <tap...@gm...>
Date: Wed Jun 23 21:35:13 2010 +0300
Add a popup at the beginning of a dance stop.
---
game/dancegraph.cc | 16 ++++++++++++++--
game/dancegraph.hh | 1 +
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/game/dancegraph.cc b/game/dancegraph.cc
index cf9c556..5b19a65 100644
--- a/game/dancegraph.cc
+++ b/game/dancegraph.cc
@@ -78,7 +78,8 @@ DanceGraph::DanceGraph(Audio& audio, Song const& song):
m_arrows_cursor(getThemePath("arrows_cursor.svg")),
m_arrows_hold(getThemePath("arrows_hold.svg")),
m_mine(getThemePath("mine.svg")),
- m_flow_direction(1)
+ m_flow_direction(1),
+ m_insideStop()
{
// Initialize some arrays
for(size_t i = 0; i < max_panels; i++) {
@@ -177,11 +178,22 @@ void DanceGraph::difficulty(DanceDifficulty level) {
void DanceGraph::engine() {
double time = m_audio.getPosition();
time -= config["audio/controller_delay"].f();
+ // Handle stops
+ bool outsideStop = true;
for (Song::Stops::const_iterator it = m_song.stops.begin(), end = m_song.stops.end(); it != end; ++it) {
if (it->first >= time) break;
- if (time < it->first + it->second) { time = it->first; break; } // Inside stop
+ if (time < it->first + it->second) { // Inside stop
+ time = it->first;
+ if (!m_insideStop) {
+ m_popups.push_back(Popup(_("STOP!"), glutil::Color(1.0f, 0.8f, 0.0), 2.0, m_popupText.get()));
+ m_insideStop = true;
+ }
+ outsideStop = false;
+ break;
+ }
time -= it->second;
}
+ if (outsideStop && m_insideStop) m_insideStop = false;
if (joining(time)) m_dead = 0; // Disable dead counting while joining
bool difficulty_changed = false;
// Handle all events
diff --git a/game/dancegraph.hh b/game/dancegraph.hh
index cfdd705..0eff7b7 100644
--- a/game/dancegraph.hh
+++ b/game/dancegraph.hh
@@ -80,5 +80,6 @@ class DanceGraph: public InstrumentGraph {
// Misc
int m_arrow_map[max_panels]; /// game mode dependant mapping of arrows' ordering at cursor
int m_flow_direction;
+ bool m_insideStop;
};
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-07-18 06:38:24
|
Module: performous
Branch: portaudio
Commit: b85c1ebb52719be4a71a2fb127a3ce7460161f63
Author: Tapio Vierros <tap...@gm...>
Date: Tue Jun 22 23:03:56 2010 +0300
Add starpower button to Hama mapping.
---
game/joystick.cc | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/game/joystick.cc b/game/joystick.cc
index e2a71a3..8c1cf66 100644
--- a/game/joystick.cc
+++ b/game/joystick.cc
@@ -121,7 +121,7 @@ int input::buttonFromSDL(input::detail::Type _type, unsigned int _sdl_button) {
{ 0, 1, 3, 2, 4,-1, 8, 9, -1, -1, -1, -1, -1, -1, -1, -1 }, // Guitar Hero X-plorer guitar
{ 3, 0, 1, 2, 4, 5, -1, -1, 8, 9, -1, -1, -1, -1, -1, -1 }, // Rock Band guitar PS3
{ 0, 1, 3, 2, 4,-1, 8, 9, -1, -1, -1, -1, -1, -1, -1, -1 }, // Rock Band guitar XBOX360
- { 2, 1, 3, 4,-1, 0, -1, -1, 8, 9, -1, -1, -1, -1, -1, -1 }, // Hama Wireless Guitar Controller for PS2 with converter
+ { 2, 1, 3, 4, 5, 0, -1, -1, 8, 9, -1, -1, -1, -1, -1, -1 }, // Hama Wireless Guitar Controller for PS2 with converter
//K R Y B G O // for drums
{ 3, 4, 1, 2, 0, 4, -1, -1, 8, 9, -1, -1, -1, -1, -1, -1 }, // Guitar Hero drums
{ 3, 4, 1, 2, 0,-1, -1, -1, 8, 9, -1, -1, -1, -1, -1, -1 }, // Rock Band drums PS3
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-07-18 06:38:22
|
Module: performous Branch: portaudio Commit: 66ed99a828793db65edcf4d13471b5378ad0170d Author: Tapio Vierros <tap...@gm...> Date: Mon Jun 21 23:06:10 2010 +0300 Remove executable bit from a few source files. --- 0 files changed, 0 insertions(+), 0 deletions(-) diff --git a/game/menu.cc b/game/menu.cc old mode 100755 new mode 100644 diff --git a/game/menu.hh b/game/menu.hh old mode 100755 new mode 100644 diff --git a/game/screen_intro.cc b/game/screen_intro.cc old mode 100755 new mode 100644 diff --git a/game/screen_intro.hh b/game/screen_intro.hh old mode 100755 new mode 100644 diff --git a/game/theme.cc b/game/theme.cc old mode 100755 new mode 100644 diff --git a/game/theme.hh b/game/theme.hh old mode 100755 new mode 100644 |
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-07-18 06:38:20
|
Module: performous
Branch: portaudio
Commit: d60b32a98361a9265ba7c7592810d58b24e9a06d
Author: Vincent Le Ligeour <yo...@us...>
Date: Mon Jun 21 14:30:16 2010 +0200
Updated gentoo ebuild
---
.../games-arcade/performous/performous-9999.ebuild | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/portage-overlay/games-arcade/performous/performous-9999.ebuild b/portage-overlay/games-arcade/performous/performous-9999.ebuild
index 6ac7944..d979e5f 100644
--- a/portage-overlay/games-arcade/performous/performous-9999.ebuild
+++ b/portage-overlay/games-arcade/performous/performous-9999.ebuild
@@ -35,7 +35,7 @@ LICENSE="GPL-2
SLOT="0"
KEYWORDS="~x86 ~amd64 ~ppc ~ppc64"
-IUSE="debug alsa portaudio pulseaudio jack songs gstreamer tools editor"
+IUSE="debug alsa portaudio pulseaudio jack songs gstreamer tools editor midi webcam"
RDEPEND="gnome-base/librsvg
dev-libs/boost
@@ -47,6 +47,7 @@ RDEPEND="gnome-base/librsvg
media-libs/jpeg
tools? ( media-gfx/imagemagick[png] )
editor? ( media-gfx/imagemagick[png] )
+ webcam? ( media-libs/opencv[v4l] )
>=media-video/ffmpeg-0.4.9_p20070616-r20
alsa? ( media-libs/alsa-lib )
jack? ( media-sound/jack-audio-connection-kit )
@@ -55,6 +56,9 @@ RDEPEND="gnome-base/librsvg
pulseaudio? ( media-sound/pulseaudio )
sys-apps/help2man
!games-arcade/ultrastar-ng"
+# Waiting for portmidi to enter portage (#90614)
+#RDEPEND="${RDEPEND}
+# midi? ( media-libs/portmidi )"
DEPEND="${RDEPEND}
>=dev-util/cmake-2.6.0"
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-07-18 06:38:18
|
Module: performous
Branch: portaudio
Commit: 25a9da624497f21e57032f086275670647e208d1
Author: Tapio Vierros <tap...@gm...>
Date: Sun Jun 20 18:38:23 2010 +0300
Experimental webcam video recording to file.
* No audio.
* Assumes camera captures 30 FPS (so video has most likely wrong "speed").
* Enabled/disabled via defining SAVE_WEBCAM_VIDEO macro.
* Initially enabled (in webcam.cc) only for testing purposes.
* Output to home directory, new recording overwrites previous.
---
game/webcam.cc | 18 +++++++++++++++++-
game/webcam.hh | 2 ++
2 files changed, 19 insertions(+), 1 deletions(-)
diff --git a/game/webcam.cc b/game/webcam.cc
index 0dd11e1..e29ca66 100644
--- a/game/webcam.cc
+++ b/game/webcam.cc
@@ -2,14 +2,17 @@
#include "webcam.hh"
#include "xtime.hh"
+#include "fs.hh"
#ifdef USE_OPENCV
#include <cv.h>
#include <highgui.h>
+
+#define SAVE_WEBCAM_VIDEO
#endif
Webcam::Webcam(int cam_id):
- m_thread(), m_capture(NULL), m_frameAvailable(false), m_running(false), m_quit(false)
+ m_thread(), m_capture(NULL), m_writer(NULL), m_frameAvailable(false), m_running(false), m_quit(false)
{
#ifdef USE_OPENCV
// Initialize the capture device
@@ -18,6 +21,17 @@ Webcam::Webcam(int cam_id):
std::cout << "Could not initialize webcam capturing!" << std::endl;
return;
}
+ // Initialize the video writer
+ #ifdef SAVE_WEBCAM_VIDEO
+ float fps = cvGetCaptureProperty(m_capture, CV_CAP_PROP_FPS);
+ int framew = cvGetCaptureProperty(m_capture, CV_CAP_PROP_FRAME_WIDTH);
+ int frameh = cvGetCaptureProperty(m_capture, CV_CAP_PROP_FRAME_HEIGHT);
+ int codec = CV_FOURCC('P','I','M','1'); // MPEG-1
+ std::string out_file((getHomeDir() / std::string("/performous-webcam_out.mpg")).string());
+ m_writer = cvCreateVideoWriter(out_file.c_str(), codec, fps > 0 ? fps : 30.0f, cvSize(framew,frameh));
+ if (!m_writer) std::cout << "Could not initialize webcam video saving!" << std::endl;
+ #endif
+ // Start thread
m_thread.reset(new boost::thread(boost::ref(*this)));
#else
++cam_id; // dummy
@@ -29,6 +43,7 @@ Webcam::~Webcam() {
#ifdef USE_OPENCV
if (m_thread) m_thread->join();
cvReleaseCapture(&m_capture);
+ cvReleaseVideoWriter(&m_writer);
#endif
}
@@ -40,6 +55,7 @@ void Webcam::operator()() {
// Try to get a new frame
if (m_running) frame = cvQueryFrame(m_capture);
if (frame) {
+ if (m_writer) cvWriteFrame(m_writer, frame);
boost::mutex::scoped_lock l(m_mutex);
// Copy the frame to storage
m_frame.width = frame->width;
diff --git a/game/webcam.hh b/game/webcam.hh
index 1091c91..f63087d 100644
--- a/game/webcam.hh
+++ b/game/webcam.hh
@@ -8,6 +8,7 @@
#include "surface.hh"
struct CvCapture;
+struct CvVideoWriter;
struct CamFrame {
int width;
@@ -39,6 +40,7 @@ class Webcam {
boost::scoped_ptr<boost::thread> m_thread;
mutable boost::mutex m_mutex;
CvCapture* m_capture;
+ CvVideoWriter* m_writer;
CamFrame m_frame;
Surface m_surface;
bool m_frameAvailable;
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-07-18 06:38:15
|
Module: performous
Branch: portaudio
Commit: c436b8fd7766ffcf28bfd1cc423991fd10777753
Author: Tapio Vierros <tap...@gm...>
Date: Sat Jun 19 22:14:56 2010 +0300
Instrument notes are now gray during joining.
---
game/dancegraph.cc | 6 +++---
game/guitargraph.cc | 24 ++++++++++++++----------
game/instrumentgraph.hh | 1 +
3 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/game/dancegraph.cc b/game/dancegraph.cc
index 10b76bf..cf9c556 100644
--- a/game/dancegraph.cc
+++ b/game/dancegraph.cc
@@ -182,7 +182,7 @@ void DanceGraph::engine() {
if (time < it->first + it->second) { time = it->first; break; } // Inside stop
time -= it->second;
}
- if (time < m_jointime) m_dead = 0; // Disable dead counting while joining
+ if (joining(time)) m_dead = 0; // Disable dead counting while joining
bool difficulty_changed = false;
// Handle all events
for (input::Event ev; m_input.tryPoll(ev);) {
@@ -192,7 +192,7 @@ void DanceGraph::engine() {
break;
}
// Difficulty / mode selection
- if (time < m_jointime && ev.type == input::Event::PRESS) {
+ if (joining(time) && ev.type == input::Event::PRESS) {
if (ev.pressed[STEP_UP]) difficultyDelta(1);
else if (ev.pressed[STEP_DOWN]) difficultyDelta(-1);
else if (ev.pressed[STEP_LEFT]) gameMode(-1);
@@ -466,7 +466,7 @@ void DanceGraph::drawNote(DanceNote& note, double time) {
/// Draw popups and other info texts
void DanceGraph::drawInfo(double time, double offsetX, Dimensions dimensions) {
// Draw info
- if (time < m_jointime) {
+ if (joining(time)) {
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);
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index 5a1e122..0be7a41 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -194,7 +194,7 @@ void GuitarGraph::engine() {
}
if (!m_drumfills.empty()) updateDrumFill(time); // Drum Fills / BREs
if (m_starpower.get() > 0.001) m_correctness.setTarget(1.0, true);
- if (time < m_jointime) m_dead = 0; // Disable dead counting while joining
+ if (joining(time)) m_dead = 0; // Disable dead counting while joining
double whammy = 0;
bool difficulty_changed = false;
// Handle all events
@@ -225,7 +225,7 @@ void GuitarGraph::engine() {
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);
// Difficulty and track selection
- if (time < m_jointime) {
+ if (joining(time)) {
if (ev.type == input::Event::PICK || ev.type == input::Event::PRESS) {
if (!m_drums && ev.pressed[4]) nextTrack();
else if (ev.pressed[0 + m_drums]) difficulty(DIFFICULTY_SUPAEASY);
@@ -778,13 +778,17 @@ void GuitarGraph::draw(double time) {
glow = m_events[event - 1].glow.get();
whammy = m_events[event - 1].whammy.get();
}
- // Get a color for the fret and adjust it if GodMode is on
- glutil::Color c = colorize(color(fret), it->begin);
- if (glow > 0.1f) { ng_r+=c.r; ng_g+=c.g; ng_b+=c.b; ng_ccnt++; } // neck glow
- // Further adjust the color if the note is hit
- c.r += glow * 0.2f;
- c.g += glow * 0.2f;
- c.b += glow * 0.2f;
+ // Set the default color (disabled state)
+ glutil::Color c(0.5f, 0.5f, 0.5f);
+ if (!joining(time)) {
+ // Get a color for the fret and adjust it if GodMode is on
+ c = colorize(color(fret), it->begin);
+ if (glow > 0.1f) { ng_r+=c.r; ng_g+=c.g; ng_b+=c.b; ng_ccnt++; } // neck glow
+ // Further adjust the color if the note is hit
+ c.r += glow * 0.2f;
+ c.g += glow * 0.2f;
+ c.b += glow * 0.2f;
+ }
if (glow > 0.5f && tEnd < 0.1f && it->hitAnim[fret].get() == 0.0)
it->hitAnim[fret].setTarget(1.0);
// Call the actual note drawing function
@@ -983,7 +987,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 (time < m_jointime) {
+ if (joining(time)) {
m_text.dimensions.screenBottom(-0.041).middle(-0.09 + offsetX);
m_text.draw(diffv[m_level].name);
m_text.dimensions.screenBottom(-0.015).middle(-0.09 + offsetX);
diff --git a/game/instrumentgraph.hh b/game/instrumentgraph.hh
index f1cbf86..6923d53 100644
--- a/game/instrumentgraph.hh
+++ b/game/instrumentgraph.hh
@@ -117,6 +117,7 @@ class InstrumentGraph {
// Shared functions for derived classes
void drawPopups(double offsetX);
void handleCountdown(double time, double beginTime);
+ bool joining(double time) const { return time < m_jointime; }
// Media
SvgTxtTheme m_text;
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-07-18 06:23:47
|
Module: performous
Branch: portaudio
Commit: d28fe6660eae95b465e5f58c35d3afde8129680c
Author: Lasse Karkkainen <tro...@tr...>
Date: Sun Jul 18 09:22:36 2010 +0300
Audio device configuration implemented (mostly)
---
data/schema.xml | 2 +-
game/audio.cc | 74 ++++++++++++++++++++++++++++++++++++++++--------------
2 files changed, 56 insertions(+), 20 deletions(-)
diff --git a/data/schema.xml b/data/schema.xml
index c41c864..26ebb9f 100644
--- a/data/schema.xml
+++ b/data/schema.xml
@@ -178,7 +178,7 @@ to save the current settings to XML.
<long>Affects instruments and dancing only. The total of USB (guitar or dance pad) latency combined with audio output latency. Adjust so that you can hit the notes best when playing by ear (not looking on screen). Use Ctrl+F5/F6 to adjust while performing.</long>
</locale>
</entry>
- <entry name="audio/device" type="string_list">
+ <entry name="audio/devices" type="string_list">
<stringvalue>in=2 dev="default" mics="blue,red"</stringvalue><!-- SingStar mics -->
<stringvalue>in=1 dev="Microphone"</stringvalue><!-- Rock Band branded Logitech mic -->
<stringvalue>in=1</stringvalue><!-- Any other microphone -->
diff --git a/game/audio.cc b/game/audio.cc
index 2c6a3b4..7071e50 100644
--- a/game/audio.cc
+++ b/game/audio.cc
@@ -213,9 +213,9 @@ struct Output {
struct Device {
// Init
- unsigned int in, out;
- double rate;
- std::string dev;
+ const unsigned int in, out;
+ const double rate;
+ const std::string dev;
portaudio::Stream stream;
std::vector<Analyzer*> mics;
Output* outptr;
@@ -236,8 +236,8 @@ struct Device {
float const* in = static_cast<float const*>(input);
float* out = static_cast<float*>(output);
for (std::size_t i = 0; i < mics.size(); ++i) {
- if (!mics[i]) continue; // Channel not used
- mics[i]->input(in, in + 1 * frames);
+ if (!mics[i]) continue; // No analyzer? -> Channel not used
+ mics[i]->input(in, in + 1 * frames); // FIXME: needs libda iterators for multiple channel support
}
if (outptr) outptr->callback(out, out + 2 * frames);
return paContinue;
@@ -253,21 +253,57 @@ struct Audio::Impl {
boost::ptr_vector<Analyzer> analyzers;
Output output;
bool playback;
- Impl() {
- devices.push_back(new Device(1, 2, 48000.0, ""));
- // One analyzer for mono input (TODO: fix callbackInput to allow more)
- analyzers.push_back(new Analyzer(48000.0));
- devices[0].mics[0] = &analyzers[0];
- playback = false;
- for (size_t i = 0; i < devices.size(); ++i) {
- Device& d = devices[i];
- // Assign playback output for the first available stereo output
- if (!playback && d.out == 2) {
- d.outptr = &output;
- playback = true;
+ Impl(): playback() {
+ // Parse audio devices from config
+ ConfigItem::StringList devs = config["audio/devices"].sl();
+ for (ConfigItem::StringList::const_iterator it = devs.begin(), end = devs.end(); it != end; ++it) {
+ try {
+ struct Params {
+ int in, out;
+ unsigned int rate;
+ std::string dev;
+ std::vector<int> mics;
+ } params = Params();
+ params.rate = 48000;
+ // Break into tokens:
+ std::istringstream iss(*it);
+ for (std::string token; std::getline(iss, token, ' '); ) {
+ // Parse key=value
+ std::istringstream iss2(token);
+ std::string key;
+ std::getline(iss2, key, '=');
+ if (key == "out") iss2 >> params.out;
+ else if (key == "in") iss2 >> params.in;
+ else if (key == "rate") iss2 >> params.rate;
+ else if (key == "dev") std::getline(iss2, params.dev);
+ else if (key == "mics") {
+ // Parse a comma-separated list of mics
+ for (std::string mic; std::getline(iss2, mic, ','); ) {
+ params.mics.push_back(0); // TODO/FIXME: implement
+ }
+
+ }
+ else throw std::runtime_error("Unknown device parameter " + key);
+ if (!iss2.eof()) throw std::runtime_error("Syntax error parsing device parameter " + key);
+ }
+ devices.push_back(new Device(params.in, params.out, params.rate, params.dev));
+ Device& d = devices.back();
+ // Assign mics for all channels of the device (TODO: proper assignments and limit the number of mics)
+ for (unsigned int i = 0; i < d.in; ++i) {
+ Analyzer* a = new Analyzer(d.rate);
+ analyzers.push_back(a);
+ d.mics[i] = a;
+ }
+ // Assign playback output for the first available stereo output
+ if (!playback && d.out == 2) {
+ d.outptr = &output;
+ playback = true;
+ }
+ // Start capture/playback on this device
+ d.start();
+ } catch(std::runtime_error& e) {
+ std::cerr << "Audio device '" << *it << "': " << e.what() << std::endl;
}
- // Start capture/playback on this device
- d.start();
}
}
};
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-07-18 06:23:44
|
Module: performous
Branch: portaudio
Commit: aa42591f3f8fa2dfc4f072e836205f24f6774215
Author: Lasse Karkkainen <tro...@tr...>
Date: Sun Jul 18 00:51:55 2010 +0300
Replace mics/pdev command line options with --audio
---
game/main.cc | 11 +++--------
1 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/game/main.cc b/game/main.cc
index f466381..a297f0d 100644
--- a/game/main.cc
+++ b/game/main.cc
@@ -254,8 +254,7 @@ int main(int argc, char** argv) try {
std::ios::sync_with_stdio(false); // We do not use C stdio
std::srand(std::time(NULL));
// Parse commandline options
- std::vector<std::string> mics;
- std::vector<std::string> pdevs;
+ std::vector<std::string> devices;
std::vector<std::string> songdirs;
namespace po = boost::program_options;
po::options_description opt1("Generic options");
@@ -266,10 +265,7 @@ int main(int argc, char** argv) try {
("songlist", po::value<std::string>(&songlist), "save a list of songs in the specified folder");
po::options_description opt2("Configuration options");
opt2.add_options()
- ("mics", po::value<std::vector<std::string> >(&mics)->composing(), "specify the microphones to use")
- ("pdev", po::value<std::vector<std::string> >(&pdevs)->composing(), "specify the playback device")
- ("michelp", "detailed help and device list for --mics")
- ("pdevhelp", "detailed help and device list for --pdev")
+ ("audio", po::value<std::vector<std::string> >(&devices)->composing(), "specify an audio device to use")
("jstest", "utility to get joystick button mappings");
po::options_description opt3("Hidden options");
opt3.add_options()
@@ -312,8 +308,7 @@ int main(int argc, char** argv) try {
}
// Override XML config for options that were specified from commandline or performous.conf
confOverride(songdirs, "system/path_songs");
- confOverride(mics, "audio/capture");
- confOverride(pdevs, "audio/playback");
+ confOverride(devices, "audio/devices");
getPaths(); // Initialize paths before other threads start
if (vm.count("jstest")) { // Joystick test program
std::cout << std::endl << "Joystick utility - Touch your joystick to see buttons here" << std::endl
|
|
From: Tapio V. <aa...@us...> - 2010-07-17 08:21:46
|
Module: performous Branch: master Commit: e3ba3fa22419dacc1ed3ca4a8ac2931e07c870be Author: Tapio Vierros <tap...@gm...> Date: Sat Jul 17 11:19:55 2010 +0300 Revert "Midi I/O does not compile under Fedora 13" This reverts commit 107a4c07d8a03dffa603a6d38eed6476c83bd70c. Reason: Apparantly this causes Launchpad builds to fail, so it is reverted pending better solution. --- cmake/Modules/FindPortMidi.cmake | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/cmake/Modules/FindPortMidi.cmake b/cmake/Modules/FindPortMidi.cmake index 38224a0..f5126d8 100644 --- a/cmake/Modules/FindPortMidi.cmake +++ b/cmake/Modules/FindPortMidi.cmake @@ -13,7 +13,7 @@ include(LibFindMacros) find_path(PortMidi_INCLUDE_DIR NAMES portmidi.h) find_library(PortMidi_LIBRARY NAMES portmidi) -find_library(PortTime_LIBRARY NAMES portmidi) +find_library(PortTime_LIBRARY NAMES porttime) set(PortMidi_PROCESS_INCLUDES PortMidi_INCLUDE_DIR) set(PortMidi_PROCESS_LIBS PortMidi_LIBRARY PortTime_LIBRARY) |
|
From: Tapio V. <aa...@us...> - 2010-07-17 08:21:43
|
Module: performous
Branch: master
Commit: b1b1d8d9c4720c5941a2bacc7cb2aaa0c699051f
Author: Tapio Vierros <tap...@gm...>
Date: Sat Jul 17 00:57:29 2010 +0300
Remove excess includes and move to .cc when possible.
---
game/3dobject.cc | 6 ------
game/3dobject.hh | 4 ----
game/backgrounds.cc | 1 -
game/backgrounds.hh | 1 -
game/dancegraph.cc | 7 +++----
game/dancegraph.hh | 8 --------
game/guitargraph.cc | 5 ++---
game/guitargraph.hh | 8 --------
game/instrumentgraph.hh | 3 ---
game/joystick.cc | 1 -
game/screen_configuration.cc | 3 +++
game/screen_configuration.hh | 7 ++++---
game/screen_intro.cc | 2 ++
game/screen_intro.hh | 8 ++++----
game/screen_practice.cc | 4 +++-
game/screen_practice.hh | 10 +++++-----
game/songparser-ini.cc | 1 -
game/songparser-sm.cc | 1 -
game/songparser.cc | 3 +--
game/songparser.hh | 2 --
20 files changed, 27 insertions(+), 58 deletions(-)
diff --git a/game/3dobject.cc b/game/3dobject.cc
index edafe3d..053896c 100644
--- a/game/3dobject.cc
+++ b/game/3dobject.cc
@@ -1,14 +1,8 @@
#include "3dobject.hh"
-#include "surface.hh"
-#include "glutil.hh"
-#include <vector>
-#include <map>
-#include <iostream>
#include <sstream>
#include <fstream>
#include <stdexcept>
-#include <string>
#include <cmath>
diff --git a/game/3dobject.hh b/game/3dobject.hh
index 8bf6ceb..9858de8 100644
--- a/game/3dobject.hh
+++ b/game/3dobject.hh
@@ -1,11 +1,7 @@
#pragma once
#include <vector>
-#include <map>
-#include <iostream>
-#include <stdexcept>
#include <string>
-
#include <boost/scoped_ptr.hpp>
#include <boost/noncopyable.hpp>
#include "surface.hh"
diff --git a/game/backgrounds.cc b/game/backgrounds.cc
index fcc7fe2..5fe42bd 100644
--- a/game/backgrounds.cc
+++ b/game/backgrounds.cc
@@ -1,7 +1,6 @@
#include "backgrounds.hh"
#include "configuration.hh"
-#include "fs.hh"
#include <boost/bind.hpp>
#include <boost/format.hpp>
diff --git a/game/backgrounds.hh b/game/backgrounds.hh
index aa99bab..d56eab7 100644
--- a/game/backgrounds.hh
+++ b/game/backgrounds.hh
@@ -7,7 +7,6 @@
#include <boost/scoped_ptr.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/thread.hpp>
-#include <set>
#include <vector>
/// songs class for songs screen
diff --git a/game/dancegraph.cc b/game/dancegraph.cc
index 468106c..8d2d7a9 100644
--- a/game/dancegraph.cc
+++ b/game/dancegraph.cc
@@ -1,8 +1,7 @@
#include "dancegraph.hh"
-#include "instrumentgraph.hh"
-#include "fs.hh"
-#include "notes.hh"
-#include "surface.hh"
+#include "song.hh"
+#include "i18n.hh"
+
#include <boost/lexical_cast.hpp>
#include <stdexcept>
#include <algorithm>
diff --git a/game/dancegraph.hh b/game/dancegraph.hh
index 0eff7b7..67c58fd 100644
--- a/game/dancegraph.hh
+++ b/game/dancegraph.hh
@@ -1,16 +1,8 @@
#pragma once
-#include <vector>
#include <boost/ptr_container/ptr_map.hpp>
#include "instrumentgraph.hh"
-#include "animvalue.hh"
-#include "song.hh"
-#include "notes.hh"
-#include "audio.hh"
-#include "joystick.hh"
-#include "surface.hh"
-#include "opengl_text.hh"
class Song;
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index 01d9ffb..c0152b1 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -1,12 +1,11 @@
#include "guitargraph.hh"
-#include "instrumentgraph.hh"
#include "fs.hh"
#include "song.hh"
-#include "3dobject.hh"
+#include "i18n.hh"
+
#include <cmath>
#include <cstdlib>
#include <stdexcept>
-
#include <boost/lexical_cast.hpp>
#include <boost/format.hpp>
diff --git a/game/guitargraph.hh b/game/guitargraph.hh
index ed8b931..e8e5e1f 100644
--- a/game/guitargraph.hh
+++ b/game/guitargraph.hh
@@ -1,17 +1,9 @@
#pragma once
-#include <vector>
#include <boost/ptr_container/ptr_map.hpp>
#include "instrumentgraph.hh"
-#include "animvalue.hh"
-#include "notes.hh"
-#include "audio.hh"
-#include "joystick.hh"
-#include "surface.hh"
-#include "opengl_text.hh"
#include "3dobject.hh"
-#include "glutil.hh"
class Song;
diff --git a/game/instrumentgraph.hh b/game/instrumentgraph.hh
index 8ca5cac..7bc6ab8 100644
--- a/game/instrumentgraph.hh
+++ b/game/instrumentgraph.hh
@@ -8,11 +8,8 @@
#include "joystick.hh"
#include "surface.hh"
#include "opengl_text.hh"
-#include "3dobject.hh"
#include "glutil.hh"
#include "fs.hh"
-#include "i18n.hh"
-
/// Represents popup messages
class Popup {
diff --git a/game/joystick.cc b/game/joystick.cc
index 02d016d..98640c1 100644
--- a/game/joystick.cc
+++ b/game/joystick.cc
@@ -1,5 +1,4 @@
#include "joystick.hh"
-#include <iostream>
#include <boost/lexical_cast.hpp>
diff --git a/game/screen_configuration.cc b/game/screen_configuration.cc
index 87b7a4a..e61ecf3 100644
--- a/game/screen_configuration.cc
+++ b/game/screen_configuration.cc
@@ -2,6 +2,9 @@
#include "configuration.hh"
#include "joystick.hh"
+#include "theme.hh"
+#include "audio.hh"
+
ScreenConfiguration::ScreenConfiguration(std::string const& name, Audio& audio): Screen(name), m_audio(audio), selected() {
for (ConfigMenu::const_iterator it = configMenu.begin(); it != configMenu.end(); ++it) {
diff --git a/game/screen_configuration.hh b/game/screen_configuration.hh
index 72d54b8..3524d3c 100644
--- a/game/screen_configuration.hh
+++ b/game/screen_configuration.hh
@@ -1,9 +1,10 @@
#pragma once
-#include "screen.hh"
-#include "audio.hh"
-#include "theme.hh"
#include <boost/scoped_ptr.hpp>
+#include "screen.hh"
+
+class Audio;
+class ThemeConfiguration;
/// options dialogue
class ScreenConfiguration: public Screen {
diff --git a/game/screen_intro.cc b/game/screen_intro.cc
index 2b488a5..818bfeb 100644
--- a/game/screen_intro.cc
+++ b/game/screen_intro.cc
@@ -5,6 +5,8 @@
#include "record.hh"
#include "i18n.hh"
#include "joystick.hh"
+#include "theme.hh"
+#include "menu.hh"
ScreenIntro::ScreenIntro(std::string const& name, Audio& audio, Capture& capture): Screen(name), m_audio(audio), m_capture(capture), selected(), m_first(true) {
}
diff --git a/game/screen_intro.hh b/game/screen_intro.hh
index 76d7909..a7912d8 100644
--- a/game/screen_intro.hh
+++ b/game/screen_intro.hh
@@ -1,13 +1,13 @@
#pragma once
+#include <boost/scoped_ptr.hpp>
#include "dialog.hh"
#include "screen.hh"
-#include "theme.hh"
-#include "menu.hh"
-#include <boost/scoped_ptr.hpp>
class Audio;
class Capture;
+class ThemeIntro;
+class MenuOption;
/// intro screen
class ScreenIntro : public Screen {
@@ -18,7 +18,7 @@ class ScreenIntro : public Screen {
void exit();
void manageEvent(SDL_Event event);
void draw();
-
+
/// draw menu
void draw_menu_options();
diff --git a/game/screen_practice.cc b/game/screen_practice.cc
index 1ca3135..4b37583 100644
--- a/game/screen_practice.cc
+++ b/game/screen_practice.cc
@@ -3,7 +3,9 @@
#include "util.hh"
#include "fs.hh"
#include "record.hh"
-#include "joystick.hh"
+#include "audio.hh"
+#include "theme.hh"
+#include "progressbar.hh"
ScreenPractice::ScreenPractice(std::string const& name, Audio& audio, Capture& capture):
Screen(name), m_audio(audio), m_capture(capture)
diff --git a/game/screen_practice.hh b/game/screen_practice.hh
index a2c372c..fd77a75 100644
--- a/game/screen_practice.hh
+++ b/game/screen_practice.hh
@@ -1,14 +1,14 @@
#pragma once
#include <boost/scoped_ptr.hpp>
-#include "audio.hh"
#include "screen.hh"
-#include "theme.hh"
-//#include "opengl_text.hh"
-#include "progressbar.hh"
#include "joystick.hh"
+class Audio;
class Capture;
+class Sample;
+class ProgressBar;
+class ThemePractice;
/// screen for practice mode
class ScreenPractice : public Screen {
@@ -19,7 +19,7 @@ class ScreenPractice : public Screen {
void exit();
void manageEvent( SDL_Event event );
void draw();
-
+
/// draw analyzers
void draw_analyzers();
diff --git a/game/songparser-ini.cc b/game/songparser-ini.cc
index 1b5a686..67e2ce0 100644
--- a/game/songparser-ini.cc
+++ b/game/songparser-ini.cc
@@ -2,7 +2,6 @@
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
-#include <boost/filesystem.hpp>
#include <boost/regex.hpp>
#include <stdexcept>
#include "midifile.hh"
diff --git a/game/songparser-sm.cc b/game/songparser-sm.cc
index df5fe91..cb84732 100644
--- a/game/songparser-sm.cc
+++ b/game/songparser-sm.cc
@@ -1,6 +1,5 @@
#include "songparser.hh"
-#include <boost/filesystem.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <algorithm>
diff --git a/game/songparser.cc b/game/songparser.cc
index 47c6ca8..af47a6d 100644
--- a/game/songparser.cc
+++ b/game/songparser.cc
@@ -1,9 +1,8 @@
#include "songparser.hh"
+
#include <fstream>
-#include <sstream>
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
-#include <boost/filesystem.hpp>
#include <boost/regex.hpp>
diff --git a/game/songparser.hh b/game/songparser.hh
index 20a6901..a0bb6e5 100644
--- a/game/songparser.hh
+++ b/game/songparser.hh
@@ -2,10 +2,8 @@
#include "song.hh"
#include "unicode.hh"
-#include <fstream>
#include <sstream>
#include <boost/filesystem.hpp>
-#include <boost/regex.hpp>
namespace SongParserUtil {
/// Parse an int from string and assign it to a variable
|
|
From: Tapio V. <aa...@us...> - 2010-07-16 21:04:40
|
Module: performous Branch: joinmenu 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-07-16 18:33:26
|
Module: performous
Branch: joinmenu
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-07-16 18:03:31
|
Module: performous
Branch: joinmenu
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-07-16 17:54:26
|
Module: performous
Branch: joinmenu
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-07-16 17:54:26
|
Module: performous
Branch: joinmenu
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-07-16 17:29:12
|
Module: performous
Branch: joinmenu
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-07-16 16:40:09
|
Module: performous Branch: joinmenu Commit: bf397bf072ad14257e2d04dc5dc5b187aa465aed Author: Tapio Vierros <tap...@gm...> Date: Thu Jul 15 20:33:39 2010 +0300 Merge branch 'svg_caching' --- |
|
From: Tapio V. <aa...@us...> - 2010-07-16 16:40:07
|
Module: performous
Branch: joinmenu
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-07-16 16:40:07
|
Module: performous Branch: joinmenu 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-07-16 16:40:07
|
Module: performous Branch: joinmenu Commit: 22d20084de7f009a363d89af10d2227818e3e20a Author: Tapio Vierros <tap...@gm...> Date: Fri Jul 16 16:39:23 2010 +0300 Some fixes to PPA script. --- tools/ppa/ppa.sh | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/ppa/ppa.sh b/tools/ppa/ppa.sh index 569081f..3f1fa54 100755 --- a/tools/ppa/ppa.sh +++ b/tools/ppa/ppa.sh @@ -42,7 +42,7 @@ PPAPATCHDIR="`pwd`" $COPYCMD "$1/tools" "$2" } -cd $TEMPDIR +cd "$TEMPDIR" # Download the "old" source package version=`apt-cache showsrc $PKG | sed -n 's/^Version: \(.*\)/\1/p' | head -n 1` @@ -52,17 +52,17 @@ if [ -z "$pkgversion" ] ; then echo "Assuming native package" pkgversion="$version" fi -echo "Working on $pkg $version ($pkgversion)" +echo "Working on $PKG $version ($pkgversion)" mkdir -p $PKG-$version cd $PKG-$version apt-get --download-only source $PKG # Download fresh version from git echo "Fetch from git..." -git clone $GITURL $SOURCEDIR +git clone "$GITURL" "$SOURCEDIR" # Get some info from git for changelog pushd . -cd $SOURCEDIR +cd "$SOURCEDIR" headcommit=`git log | head -n 1 | cut --delimiter=" " -f 2 | cut -c 1-10` popd |
|
From: Tapio V. <aa...@us...> - 2010-07-16 16:40:06
|
Module: performous Branch: joinmenu Commit: efa8470abab625022332f76a5497515de7a12ea4 Author: Tapio Vierros <tap...@gm...> Date: Thu Jul 15 23:41:45 2010 +0300 Make cppcheck static analyzer happier. --- game/3dobject.cc | 2 +- game/dancegraph.cc | 8 ++++---- game/database.cc | 4 ++-- game/guitargraph.cc | 2 +- game/instrumentgraph.hh | 1 + game/menu.cc | 2 +- game/menu.hh | 2 +- game/midifile.cc | 2 +- game/screen_configuration.cc | 2 +- game/screen_practice.cc | 7 +++---- game/song.cc | 2 +- game/songparser-ini.cc | 2 +- game/theme.cc | 2 +- game/theme.hh | 4 ++-- 14 files changed, 21 insertions(+), 21 deletions(-) |
|
From: Tapio V. <aa...@us...> - 2010-07-16 16:40:01
|
Module: performous
Branch: joinmenu
Commit: 9a1623b1739d85502e36a99c925830b09d79f2bf
Author: Vincent Le Ligeour <yo...@us...>
Date: Thu Jul 15 13:01:44 2010 +0200
Removed debug message about caching SVG
---
game/image.hh | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/game/image.hh b/game/image.hh
index 1b59873..c5a1c36 100644
--- a/game/image.hh
+++ b/game/image.hh
@@ -53,10 +53,8 @@ namespace {
png_set_IHDR(pngPtr, infoPtr, w, h, 8, PNG_COLOR_TYPE_RGBA, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
bpp = 4;
break;
- case pix::INT_ARGB:
- throw std::runtime_error("Writing PNG failed (pix::INT_ARGB not supported)");
- case pix::BGR:
- throw std::runtime_error("Writing PNG failed (pix::BGR not supported)");
+ default:
+ throw std::logic_error("Unsupported pixel format in writePNG_internal");
}
png_write_info(pngPtr, infoPtr);
unsigned stride = (w * bpp + 3) & ~3; // Number of bytes per row (word-aligned)
@@ -131,7 +129,6 @@ template <typename T> void loadSVG(T& target, std::string const& filename, fs::p
g_error_free(pError);
throw std::runtime_error("Unable to load " + filename);
}
- std::cout << "Caching \"" << filename << "\" into \"" << cache_filename << "\"" << std::endl;
fs::create_directories(cache_filename.parent_path());
writePNG(cache_filename.string(), w, h, pix::CHAR_RGBA, false, gdk_pixbuf_get_pixels(pb));
gdk_pixbuf_unref(pb);
|