|
From: Tapio V. <aa...@us...> - 2010-05-16 16:31:43
|
Module: performous
Branch: instrumentgraph
Commit: ae34964527610b8007ad0743244ff43a8599348f
Author: Xaldyz <xa...@us...>
Date: Wed May 12 19:18:46 2010 +0200
Fixed linking problem when library OpenCV not set
---
game/screen_sing.cc | 14 +++++++++++++-
game/screen_sing.hh | 6 ++++++
2 files changed, 19 insertions(+), 1 deletions(-)
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index dcde072..2252fb1 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -56,9 +56,13 @@ void ScreenSing::enter() {
std::cerr << e.what() << std::endl;
}
}
+
+#ifdef USE_OPENCV
if (config["graphic/webcam"].b()) { // Initialize webcam
m_cam.reset(new Webcam());
}
+#endif
+
if (!m_song->video.empty() && config["graphic/video"].b()) { // Load video
m_video.reset(new Video(m_song->path + m_song->video, m_song->videoGap));
}
@@ -178,7 +182,9 @@ void ScreenSing::exit() {
m_engine.reset();
m_help.reset();
m_pause_icon.reset();
+#ifdef USE_OPENCV
m_cam.reset();
+#endif
m_video.reset();
m_background.reset();
m_song->dropNotes();
@@ -307,9 +313,15 @@ void ScreenSing::draw() {
m_background->draw();
} else fillBG();
// Video
- if (m_video && (!m_cam || !m_cam->is_good())) { m_video->render(time); double tmp = m_video->dimensions().ar(); if (tmp > 0.0) ar = tmp; }
+ if (m_video
+ #ifdef USE_OPENCV
+ && (!m_cam || !m_cam->is_good())
+ #endif
+ ) { m_video->render(time); double tmp = m_video->dimensions().ar(); if (tmp > 0.0) ar = tmp; }
+#ifdef USE_OPENCV
// Webcam
if (m_cam && config["graphic/webcam"].b()) m_cam->render();
+#endif
// Top/bottom borders
ar = clamp(ar, arMin, arMax);
double offset = 0.5 / ar + 0.2;
diff --git a/game/screen_sing.hh b/game/screen_sing.hh
index e73eb17..3b56aec 100644
--- a/game/screen_sing.hh
+++ b/game/screen_sing.hh
@@ -15,7 +15,11 @@
#include "opengl_text.hh"
#include "progressbar.hh"
#include "guitargraph.hh"
+
+#ifdef USE_OPENCV
#include "webcam.hh"
+#endif
+
#include "screen_players.hh"
class Players;
@@ -81,7 +85,9 @@ class ScreenSing: public Screen {
boost::scoped_ptr<ProgressBar> m_progress;
boost::scoped_ptr<Surface> m_background;
boost::scoped_ptr<Video> m_video;
+#ifdef USE_OPENCV
boost::scoped_ptr<Webcam> m_cam;
+#endif
boost::scoped_ptr<Surface> m_pause_icon;
boost::scoped_ptr<Surface> m_help;
boost::scoped_ptr<Engine> m_engine;
|