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...> - 2012-04-29 00:51:12
|
Author: Lasse Karkkainen <tro...@tr...> Date: Mon Mar 19 03:44:22 2012 +0200 Remove our custom (smart) FindBoost.cmake in favor of using the one shipped with CMake. --- cmake/Modules/FindBoost.cmake | 416 ----------------------------------------- game/CMakeLists.txt | 4 +- tools/CMakeLists.txt | 2 +- 3 files changed, 3 insertions(+), 419 deletions(-) |
|
From: Tapio V. <aa...@us...> - 2012-03-29 17:52:08
|
Author: Tapio Vierros <tap...@gm...>
Date: Thu Mar 29 20:50:58 2012 +0300
Mark some CMake variables advanced (most notably those hordes from OpenCV).
---
cmake/Modules/FindMsgfmt.cmake | 5 ++++-
cmake/Modules/FindOpenCV.cmake | 10 +++++++++-
cmake/Modules/FindPortMidi.cmake | 1 +
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/cmake/Modules/FindMsgfmt.cmake b/cmake/Modules/FindMsgfmt.cmake
index 8238cd1..14de5bd 100644
--- a/cmake/Modules/FindMsgfmt.cmake
+++ b/cmake/Modules/FindMsgfmt.cmake
@@ -10,4 +10,7 @@ if(Msgfmt_BIN)
set(Msgfmt_FOUND 1)
else()
set(Msgfmt_FOUND 0)
-endif(Msgfmt_BIN)
\ No newline at end of file
+endif(Msgfmt_BIN)
+
+mark_as_advanced(Msgfmt_BIN)
+
diff --git a/cmake/Modules/FindOpenCV.cmake b/cmake/Modules/FindOpenCV.cmake
index 27b383b..e7de88b 100644
--- a/cmake/Modules/FindOpenCV.cmake
+++ b/cmake/Modules/FindOpenCV.cmake
@@ -196,6 +196,9 @@ if(EXISTS "${OpenCV_DIR}")
set(OpenCV_LIBS ${OpenCV_LIBS} ${OpenCV_${__CVLIB}_LIBRARY})
endif(OpenCV_${__CVLIB}_LIBRARY)
+ #Avoid pollution
+ mark_as_advanced(OpenCV_${__CVLIB}_LIBRARY OpenCV_${__CVLIB}_LIBRARY_RELEASE OpenCV_${__CVLIB}_LIBRARY_DEBUG)
+
endforeach(__CVLIB)
@@ -243,7 +246,9 @@ if(EXISTS "${OpenCV_DIR}")
set(OpenCV_LIBS ${OpenCV_LIBS} ${OpenCV_${__CVLIB}_LIBRARY})
endif(OpenCV_${__CVLIB}_LIBRARY)
-
+ #Avoid pollution
+ mark_as_advanced(OpenCV_${__CVLIB}_LIBRARY OpenCV_${__CVLIB}_LIBRARY_RELEASE OpenCV_${__CVLIB}_LIBRARY_DEBUG)
+
endforeach(__CVLIB)
@@ -285,3 +290,6 @@ if(OpenCV_FOUND)
endif(OpenCV_BACKWARD_COMPA)
endif(OpenCV_FOUND)
##====================================================
+
+mark_as_advanced(OpenCV_DIR OpenCV_FOUND)
+
diff --git a/cmake/Modules/FindPortMidi.cmake b/cmake/Modules/FindPortMidi.cmake
index e3774ad..ef3fa1f 100644
--- a/cmake/Modules/FindPortMidi.cmake
+++ b/cmake/Modules/FindPortMidi.cmake
@@ -24,4 +24,5 @@ if (${PortTime_LIBRARY})
endif (${PortTime_LIBRARY})
libfind_process(PortMidi)
+mark_as_advanced(PortTime_LIBRARY)
|
|
From: Tapio V. <aa...@us...> - 2012-03-29 17:35:13
|
Author: Tapio Vierros <tap...@gm...>
Date: Thu Mar 29 20:33:39 2012 +0300
Revert "Adjusted minimal libavformat version"
This reverts commit ba04de2b7b18d895f6695e6cd152863edb54604b.
---
game/ffmpeg.cc | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/game/ffmpeg.cc b/game/ffmpeg.cc
index 114ac7f..1b9d874 100644
--- a/game/ffmpeg.cc
+++ b/game/ffmpeg.cc
@@ -36,7 +36,7 @@ FFmpeg::~FFmpeg() {
boost::mutex::scoped_lock l(s_avcodec_mutex); // avcodec_close is not thread-safe
if (m_resampleContext) audio_resample_close(m_resampleContext);
if (m_codecContext) avcodec_close(m_codecContext);
-#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(53, 2, 0)
+#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(53, 17, 0)
if (m_formatContext) avformat_close_input(&m_formatContext);
#else
if (m_formatContext) av_close_input_file(m_formatContext);
|
|
From: Tapio V. <aa...@us...> - 2012-03-28 09:24:23
|
Author: Tapio Vierros <tap...@gm...> Date: Wed Mar 28 12:19:47 2012 +0300 Added Chinese translation courtesy of Wei-Lun Chao. --- lang/zh.po | 798 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 798 insertions(+), 0 deletions(-) |
|
From: Lasse Kärkkäi. <tr...@us...> - 2012-03-26 01:20:29
|
Author: Lasse Karkkainen <tro...@tr...>
Date: Mon Mar 26 04:19:06 2012 +0300
Add a separate pass for preparing a screen, for slow operations that we don't want to do in draw(), and use that for loading the next video frame.
---
game/main.cc | 1 +
game/screen.hh | 4 ++++
game/screen_sing.cc | 7 ++++++-
game/screen_sing.hh | 1 +
game/screenmanager.cc | 4 ++++
game/video.cc | 22 ++++++++++++----------
game/video.hh | 4 ++--
7 files changed, 30 insertions(+), 13 deletions(-)
diff --git a/game/main.cc b/game/main.cc
index a0bcc10..45f3a08 100644
--- a/game/main.cc
+++ b/game/main.cc
@@ -185,6 +185,7 @@ void mainLoop(std::string const& songlist) {
glFinish();
prof("swap");
updateSurfaces();
+ sm.prepareScreen();
glFinish();
prof("surfaces");
if (config["graphic/fps"].b()) {
diff --git a/game/screen.hh b/game/screen.hh
index 64d3e29..5c3e27a 100644
--- a/game/screen.hh
+++ b/game/screen.hh
@@ -19,6 +19,8 @@ class Screen {
virtual ~Screen() {}
/// eventhandler
virtual void manageEvent(SDL_Event event) = 0;
+ /// prepare screen for drawing
+ virtual void prepare() {}
/// draws screen
virtual void draw() = 0;
/// enters screen
@@ -49,6 +51,8 @@ class ScreenManager: public Singleton <ScreenManager> {
void activateScreen(std::string const& name);
/// Does actual switching of screens (if necessary)
void updateScreen();
+ /// Prepare (slow loading operations) of the current screen for rendering
+ void prepareScreen();
/// Draws the current screen and possible transition effects
void drawScreen();
/// Reload OpenGL resources (after fullscreen toggle etc)
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index 7b16fb4..2a6bbd3 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -399,6 +399,11 @@ namespace {
}
+void ScreenSing::prepare() {
+ double time = m_audio.getPosition();
+ if (m_video) m_video->prepare(time);
+}
+
void ScreenSing::draw() {
// Get the time in the song
double length = m_audio.getLength();
@@ -432,7 +437,7 @@ void ScreenSing::draw() {
// Webcam
if (m_cam && config["graphic/webcam"].b()) m_cam->render();
// Video
- if (m_video /* && (!m_cam || !m_cam->is_good()) */) {
+ if (m_video) {
m_video->render(time); double tmp = m_video->dimensions().ar(); if (tmp > 0.0) ar = tmp;
}
// Top/bottom borders
diff --git a/game/screen_sing.hh b/game/screen_sing.hh
index a5a5a74..9d7438d 100644
--- a/game/screen_sing.hh
+++ b/game/screen_sing.hh
@@ -55,6 +55,7 @@ class ScreenSing: public Screen {
void exit();
void reloadGL();
void manageEvent(SDL_Event event);
+ void prepare();
void draw();
void setSong (boost::shared_ptr<Song> song_)
diff --git a/game/screenmanager.cc b/game/screenmanager.cc
index f3b30f7..5e1bb15 100644
--- a/game/screenmanager.cc
+++ b/game/screenmanager.cc
@@ -43,6 +43,10 @@ Screen* ScreenManager::getScreen(std::string const& name) {
}
}
+void ScreenManager::prepareScreen() {
+ getCurrentScreen()->prepare();
+}
+
void ScreenManager::drawScreen() {
getCurrentScreen()->draw();
drawLogo();
diff --git a/game/video.cc b/game/video.cc
index 09c104f..7adca6a 100644
--- a/game/video.cc
+++ b/game/video.cc
@@ -1,12 +1,11 @@
#include "video.hh"
#include "util.hh"
-
#include <cmath>
Video::Video(std::string const& _videoFile, double videoGap): m_mpeg(true, false, _videoFile), m_videoGap(videoGap), m_surfaceTime(), m_lastTime(), m_alpha(-0.5, 1.5) {}
-void Video::render(double time) {
+void Video::prepare(double time) {
time += m_videoGap;
VideoFrame& fr = m_videoFrame;
// Time to switch frame?
@@ -18,6 +17,17 @@ void Video::render(double time) {
m_surface.load(bitmap);
m_surfaceTime = fr.timestamp;
}
+ // Preload the next future frame
+ if (fr.data.empty()) while (m_mpeg.videoQueue.tryPop(fr) && fr.timestamp < time) {};
+ // Do a seek before next render, if required
+ if (time < m_lastTime - 1.0 || (!fr.data.empty() && time > fr.timestamp + 7.0)) {
+ m_mpeg.seek(std::max(0.0, time - 5.0)); // -5 to workaround ffmpeg inaccurate seeking
+ fr.data.clear();
+ }
+ m_lastTime = time;
+}
+
+void Video::render(double time) {
double tdist = std::abs(m_surfaceTime - time);
m_alpha.setTarget(tdist < 0.4 ? 1.2f : -0.5f);
float alpha = clamp(m_alpha.get());
@@ -33,13 +43,5 @@ void Video::render(double time) {
m_surface.draw();
}
}
- // Preload the next future frame
- if (fr.data.empty()) while (m_mpeg.videoQueue.tryPop(fr) && fr.timestamp < time) {};
- // Do a seek before next render, if required
- if (time < m_lastTime - 1.0 || (!fr.data.empty() && time > fr.timestamp + 7.0)) {
- m_mpeg.seek(std::max(0.0, time - 5.0)); // -5 to workaround ffmpeg inaccurate seeking
- fr.data.clear();
- }
- m_lastTime = time;
}
diff --git a/game/video.hh b/game/video.hh
index c1ed3ea..2390991 100644
--- a/game/video.hh
+++ b/game/video.hh
@@ -10,8 +10,8 @@ class Video {
public:
/// opens given video file
Video(std::string const& videoFile, double videoGap = 0.0);
- /// renders video
- void render(double time);
+ void prepare(double time); ///< Load the current video frame into a texture
+ void render(double time); ///< Render the prepared video frame
/// returns Dimensions of video clip
Dimensions& dimensions() { return m_surface.dimensions; }
/// returns Dimensions of video clip
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2012-03-26 01:20:26
|
Author: Lasse Karkkainen <tro...@tr...>
Date: Mon Mar 26 04:14:03 2012 +0300
Display FPS with flashMessage instead of std::cout.
---
game/main.cc | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/game/main.cc b/game/main.cc
index db690cc..a0bcc10 100644
--- a/game/main.cc
+++ b/game/main.cc
@@ -190,7 +190,9 @@ void mainLoop(std::string const& songlist) {
if (config["graphic/fps"].b()) {
++frames;
if (now() - time > 1.0) {
- std::cout << frames << " FPS" << std::endl;
+ std::ostringstream oss;
+ oss << frames << " FPS";
+ sm.flashMessage(oss.str());
time += 1.0;
frames = 0;
}
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2012-03-26 01:20:24
|
Author: Lasse Karkkainen <tro...@tr...>
Date: Mon Mar 26 03:40:26 2012 +0300
Profiler rewritten so that it can be used inside loops.
---
game/profiler.hh | 62 +++++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 54 insertions(+), 8 deletions(-)
diff --git a/game/profiler.hh b/game/profiler.hh
index f56db2b..172f186 100644
--- a/game/profiler.hh
+++ b/game/profiler.hh
@@ -1,23 +1,69 @@
#pragma once
#include "xtime.hh"
+#include <iomanip>
#include <iostream>
+#include <map>
#include <sstream>
#include <string>
+#include <vector>
-/// easy access for profiling code
+struct ProfCP {
+ unsigned long samples;
+ double total;
+ double peak;
+ double avg;
+ ProfCP(): samples(), total(), peak(), avg() {}
+ void add(double t) {
+ ++samples;
+ total += t;
+ avg = total / samples;
+ if (peak < t) peak = t;
+ }
+};
+
+static inline std::ostream& operator<<(std::ostream& os, ProfCP const& cp) {
+ os << std::fixed << std::setprecision(1);
+ if (cp.samples == 0) return os << "no data";
+ if (cp.samples > 1) os << cp.samples << "x ";
+ os << cp.avg * 1000.0 << " ms";
+ if (cp.peak > 2.0 * cp.avg) os << " peak " << cp.peak * 1000.0 << " ms";
+ return os;
+}
+
+/// @short A simple performance profiling tool
class Profiler {
- std::ostringstream m_oss;
+ typedef std::map<std::string, ProfCP> Checkpoints;
+ typedef std::pair<std::string, ProfCP> Pair;
+ Checkpoints m_checkpoints;
+ std::string m_name;
boost::xtime m_time;
+ static bool cmpFunc(Pair const& a, Pair const& b) { return a.second.total > b.second.total; }
public:
- /// create a new profiler with a given name
- Profiler(std::string const& name): m_time(now()) { m_oss << "profiler-" << name << "/info: "; }
- ~Profiler() { std::clog << m_oss.str() << std::endl; }
- /// calling the object as a function will return the time since the start
- void operator()(std::string const& tag) {
+ /// Start a profiler with the given name
+ Profiler(std::string const& name): m_name(name), m_time(now()) {}
+ ~Profiler() { dump(); }
+ /// Profiling checkpoint: record the duration since construction or previous checkpoint.
+ /// If no tag is specified, no recording is done.
+ void operator()(std::string const& tag = std::string()) {
boost::xtime n = now();
std::swap(n, m_time);
- m_oss << unsigned((m_time - n) * 1000.0 + 0.5) << " ms (" << tag << ") ";
+ double t = m_time - n;
+ m_checkpoints[tag].add(t);
+ }
+ /// Dump current stats to log and reset
+ void dump(std::string const& level = "info") {
+ if (m_checkpoints.empty()) return;
+ if (level.empty()) { m_checkpoints.clear(); return; }
+ std::vector<Pair> cps(m_checkpoints.begin(), m_checkpoints.end());
+ m_checkpoints.clear();
+ std::sort(cps.begin(), cps.end(), cmpFunc);
+ std::ostringstream oss;
+ oss << "profiler-" << m_name << "/" << level << ":";
+ for (std::vector<Pair>::const_iterator it = cps.begin(); it != cps.end(); ++it) {
+ oss << " " << it->first << " (" << it->second << ")";
+ }
+ std::clog << oss.str() << std::endl;
}
};
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2012-03-26 01:20:21
|
Author: Lasse Karkkainen <tro...@tr...>
Date: Mon Mar 26 01:04:54 2012 +0300
Allow specifying audiodev in=N for input channels (useful with cards that require a large number of channels). Still requires mics= as well (TODO: auto-assign mics if not specified?).
---
game/audio.cc | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/game/audio.cc b/game/audio.cc
index 8cd85f7..7f09b92 100644
--- a/game/audio.cc
+++ b/game/audio.cc
@@ -418,12 +418,13 @@ struct Audio::Impl {
for (ConfigItem::StringList::const_iterator it = devs.begin(), end = devs.end(); it != end; ++it) {
try {
struct Params {
- int out;
+ int out, in;
unsigned int rate;
std::string dev;
std::vector<std::string> mics;
} params = Params();
params.out = 0;
+ params.in = 0;
params.rate = 48000;
// Break into tokens:
std::map<std::string, std::string> keyvalues = parseKeyValuePairs(*it);
@@ -433,6 +434,7 @@ struct Audio::Impl {
std::string key = it2->first;
std::istringstream iss(it2->second);
if (key == "out") iss >> params.out;
+ else if (key == "in") iss >> params.in;
else if (key == "rate") iss >> params.rate;
else if (key == "dev") std::getline(iss, params.dev);
else if (key == "mics") {
@@ -442,6 +444,9 @@ struct Audio::Impl {
else throw std::runtime_error("Unknown device parameter " + key);
if (!iss.eof()) throw std::runtime_error("Syntax error parsing device parameter " + key);
}
+ // Sync mics/in settings together
+ if (params.in == 0) params.in = params.mics.size();
+ else params.mics.resize(params.in);
int count = portaudio::AudioDevices::count();
int dev = -1;
// Handle empty device
@@ -453,7 +458,7 @@ struct Audio::Impl {
if (iss >> tmp && iss.get() == EOF && tmp >= 0 && tmp < count) dev = tmp;
}
std::clog << "audio/info: Trying audio device \"" << params.dev << "\", id: " << dev
- << ", in: " << params.mics.size() << ", out: " << params.out << std::endl;
+ << ", in: " << params.in << ", out: " << params.out << std::endl;
bool skip_partial = false;
bool found = false;
portaudio::AudioDevices ad;
@@ -475,13 +480,13 @@ struct Audio::Impl {
int assigned_mics = 0;
bool device_init_threw = true;
try {
- devices.push_back(new Device(params.mics.size(), params.out, params.rate, i));
+ devices.push_back(new Device(params.in, params.out, params.rate, i));
Device& d = devices.back();
device_init_threw = false;
// Start capture/playback on this device
d.start();
// Assign mics for all channels of the device
- for (unsigned int j = 0; j < d.in; ++j) {
+ for (unsigned int j = 0; j < params.in; ++j) {
if (analyzers.size() >= 4) break; // Too many mics
std::string const& m = params.mics[j];
if (m.empty()) continue; // Input channel not used
|
|
From: Yoda-JM <yo...@us...> - 2012-03-25 16:35:05
|
Author: Vincent Le Ligeour <yo...@us...>
Date: Sun Mar 25 18:34:42 2012 +0200
Adjusted minimal libavformat version
---
game/ffmpeg.cc | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/game/ffmpeg.cc b/game/ffmpeg.cc
index 1b9d874..114ac7f 100644
--- a/game/ffmpeg.cc
+++ b/game/ffmpeg.cc
@@ -36,7 +36,7 @@ FFmpeg::~FFmpeg() {
boost::mutex::scoped_lock l(s_avcodec_mutex); // avcodec_close is not thread-safe
if (m_resampleContext) audio_resample_close(m_resampleContext);
if (m_codecContext) avcodec_close(m_codecContext);
-#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(53, 17, 0)
+#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(53, 2, 0)
if (m_formatContext) avformat_close_input(&m_formatContext);
#else
if (m_formatContext) av_close_input_file(m_formatContext);
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2012-03-22 23:32:54
|
Author: Lasse Karkkainen <tro...@tr...> Date: Fri Mar 23 01:30:50 2012 +0200 New FindOpenCV.cmake for OpenCV 2.x (instead of 0.x/1.0). https://code.ros.org/trac/opencv/attachment/ticket/597/FindOpenCV.cmake - Changes to CMakeLists.txt and webcam.cc accordingly. --- cmake/Modules/FindOpenCV.cmake | 476 ++++++++++++++++++++++------------------ game/CMakeLists.txt | 2 +- game/webcam.cc | 3 +- 3 files changed, 262 insertions(+), 219 deletions(-) |
|
From: Lasse Kärkkäi. <tr...@us...> - 2012-03-21 06:11:19
|
Author: Lasse Karkkainen <tro...@tr...> Date: Wed Mar 21 08:06:56 2012 +0200 FFmpeg internal cleanup. Will only decode one stream at a time now (not both audio and video). Refactoring of variable names, etc. --- game/ffmpeg.cc | 115 ++++++++++++++++++++++++++----------------------------- game/ffmpeg.hh | 22 ++++------ 2 files changed, 63 insertions(+), 74 deletions(-) |
|
From: Lasse Kärkkäi. <tr...@us...> - 2012-03-21 04:23:00
|
Author: Lasse Kärkkäinen <tronic+ndrm at trn.iki.fi> Date: Wed Mar 21 06:22:48 2012 +0200 Restore support for older libav versions (Ubuntu 11.10). --- game/ffmpeg.cc | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/game/ffmpeg.cc b/game/ffmpeg.cc index 32a6b78..c04ba8d 100644 --- a/game/ffmpeg.cc +++ b/game/ffmpeg.cc @@ -33,7 +33,11 @@ FFmpeg::~FFmpeg() { if (pResampleCtx) audio_resample_close(pResampleCtx); if (pAudioCodecCtx) avcodec_close(pAudioCodecCtx); if (pVideoCodecCtx) avcodec_close(pVideoCodecCtx); +#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(53, 17, 0) if (pFormatCtx) avformat_close_input(&pFormatCtx); +#else + if (pFormatCtx) av_close_input_file(pFormatCtx); +#endif } double FFmpeg::duration() const { |
|
From: Lasse Kärkkäi. <tr...@us...> - 2012-03-21 04:22:57
|
Author: Lasse Kärkkäinen <tronic+ndrm at trn.iki.fi> Date: Tue Nov 29 11:24:11 2011 +0200 Use std::list for fs Paths instead of std::vector. --- game/fs.cc | 3 +-- game/fs.hh | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/game/fs.cc b/game/fs.cc index cb59487..718d630 100644 --- a/game/fs.cc +++ b/game/fs.cc @@ -214,8 +214,7 @@ Paths const& getPaths(bool refresh) { paths.clear(); std::remove_copy_if(dirs.begin(), dirs.end(), std::inserter(paths, paths.end()), pathNotExist); // Assure that each path appears only once - Paths::iterator it = std::unique(paths.begin(), paths.end()); - paths.resize(it - paths.begin()); + paths.erase(std::unique(paths.begin(), paths.end()), paths.end()); } return paths; } diff --git a/game/fs.hh b/game/fs.hh index a77265a..241d110 100644 --- a/game/fs.hh +++ b/game/fs.hh @@ -1,7 +1,7 @@ #pragma once #include <boost/filesystem.hpp> -#include <vector> +#include <list> // Define this useful alias for the overlong namespace name (yes, for everyone who includes this header) namespace fs = boost::filesystem; @@ -42,7 +42,7 @@ std::string getPath(fs::path const& filename); /** Get full path to a default conguration file **/ fs::path getDefaultConfig(fs::path const &configFile); -typedef std::vector<fs::path> Paths; +typedef std::list<fs::path> Paths; /** Get all shared data paths in preference order **/ Paths const& getPaths(bool refresh = false); |
Author: Lasse Karkkainen <tro...@tr...>
Date: Wed Mar 21 05:46:46 2012 +0200
Fix some issues with timecode calculation, should fix video being off sync in some cases (in particular, with very recent libav versions). May also make sync errors appear in songs made for Performous.
---
game/ffmpeg.cc | 11 +++++------
1 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/game/ffmpeg.cc b/game/ffmpeg.cc
index 8fdc974..32a6b78 100644
--- a/game/ffmpeg.cc
+++ b/game/ffmpeg.cc
@@ -135,10 +135,6 @@ struct ReadFramePacket: public AVPacket {
if (av_read_frame(s, this) < 0) throw FFmpeg::eof_error();
}
~ReadFramePacket() { av_free_packet(this); }
- double time() {
- return uint64_t(dts) == uint64_t(AV_NOPTS_VALUE) ?
- getNaN() : double(dts) * av_q2d(m_s->streams[stream_index]->time_base);
- }
};
void FFmpeg::decodePacket() {
@@ -179,7 +175,8 @@ int FFmpeg::decodeVideoFrame(ReadFramePacket& packet) {
int linesize = w * 3;
sws_scale(img_convert_ctx, videoFrame->data, videoFrame->linesize, 0, h, &data, &linesize);
}
- if (packet.time() == packet.time()) m_position = packet.time();
+ // Timecode calculation
+ m_position = double(videoFrame->pkt_pts) * av_q2d(pFormatCtx->streams[videoStream]->time_base);
// Construct a new video frame and push it to output queue
VideoFrame* tmp = new VideoFrame(m_position, w, h);
tmp->data.swap(buffer);
@@ -211,7 +208,9 @@ int FFmpeg::decodeAudioFrame(ReadFramePacket& packet) {
int frames = audio_resample(pResampleCtx, &resampled[0], audioFrames, outsize);
resampled.resize(frames * AUDIO_CHANNELS);
// Use timecode from packet if available
- if (packet.time() == packet.time()) m_position = packet.time();
+ if (uint64_t(packet.pts) != uint64_t(AV_NOPTS_VALUE)) {
+ m_position = double(packet.pts) * av_q2d(pFormatCtx->streams[audioStream]->time_base);
+ }
// Push to output queue (may block)
audioQueue.push(resampled, m_position);
// Increment current time
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2012-03-21 03:50:43
|
Author: Lasse Karkkainen <tro...@tr...>
Date: Wed Mar 21 05:24:47 2012 +0200
Fix handling of odd audio timestamps. Should finally fix all the wrong song playing issues.
---
game/ffmpeg.hh | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/game/ffmpeg.hh b/game/ffmpeg.hh
index 25f15e8..4b0ecf5 100644
--- a/game/ffmpeg.hh
+++ b/game/ffmpeg.hh
@@ -133,9 +133,14 @@ class AudioBuffer {
mutex::scoped_lock l(m_mutex);
while (!condition()) m_cond.wait(l);
if (m_quit) return;
- if (m_pos == 0 && timestamp != 0.0) {
- std::clog << "ffmpeg/info: The first audio frame begins at " << timestamp << " seconds instead of zero." << std::endl;
+ if (timestamp < 0.0) {
+ std::clog << "ffmpeg/warn: Negative audio timestamp " << timestamp << " seconds, frame ignored." << std::endl;
+ return;
+ }
+ // Insert silence at the beginning if the stream starts later than 0.0
+ if (m_pos == 0 && timestamp > 0.0) {
m_pos = timestamp * m_sps;
+ m_data.resize(m_pos, 0);
}
m_data.insert(m_data.end(), data.begin(), data.end());
m_pos += data.size();
|
|
From: Yoda-JM <yo...@us...> - 2012-03-18 06:28:24
|
Author: Vincent Le Ligeour <yo...@us...> Date: Sun Mar 18 07:13:57 2012 +0100 Fixed some compilation errors by missing iostream include (for example continuous integration) --- game/ffmpeg.hh | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/game/ffmpeg.hh b/game/ffmpeg.hh index 6cbdd13..25f15e8 100644 --- a/game/ffmpeg.hh +++ b/game/ffmpeg.hh @@ -10,6 +10,7 @@ #include <boost/thread/recursive_mutex.hpp> #include <boost/thread/thread.hpp> #include <vector> +#include <iostream> using boost::uint8_t; using boost::int16_t; |
|
From: Lasse Kärkkäi. <tr...@us...> - 2012-03-16 23:32:24
|
Author: Lasse Karkkainen <tro...@tr...>
Date: Sat Mar 17 01:25:28 2012 +0200
Ffmpeg API keeps changing, fix some deprecation warnings...
---
game/ffmpeg.cc | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/game/ffmpeg.cc b/game/ffmpeg.cc
index 1f5d5b2..8fdc974 100644
--- a/game/ffmpeg.cc
+++ b/game/ffmpeg.cc
@@ -33,7 +33,7 @@ FFmpeg::~FFmpeg() {
if (pResampleCtx) audio_resample_close(pResampleCtx);
if (pAudioCodecCtx) avcodec_close(pAudioCodecCtx);
if (pVideoCodecCtx) avcodec_close(pVideoCodecCtx);
- if (pFormatCtx) av_close_input_file(pFormatCtx);
+ if (pFormatCtx) avformat_close_input(&pFormatCtx);
}
double FFmpeg::duration() const {
@@ -46,7 +46,7 @@ void FFmpeg::open() {
av_register_all();
av_log_set_level(AV_LOG_ERROR);
if (avformat_open_input(&pFormatCtx, m_filename.c_str(), NULL, NULL)) throw std::runtime_error("Cannot open input file");
- if (av_find_stream_info(pFormatCtx) < 0) throw std::runtime_error("Cannot find stream information");
+ if (avformat_find_stream_info(pFormatCtx, NULL) < 0) throw std::runtime_error("Cannot find stream information");
pFormatCtx->flags |= AVFMT_FLAG_GENPTS;
videoStream = -1;
audioStream = -1;
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2012-03-16 23:32:21
|
Author: Lasse Karkkainen <tro...@tr...>
Date: Sat Mar 17 01:14:02 2012 +0200
Fix a compile error due to missing av_rescale_q by removing some unnecessary per-stream seeking logic.
---
game/ffmpeg.cc | 8 +-------
1 files changed, 1 insertions(+), 7 deletions(-)
diff --git a/game/ffmpeg.cc b/game/ffmpeg.cc
index 87efcfa..1f5d5b2 100644
--- a/game/ffmpeg.cc
+++ b/game/ffmpeg.cc
@@ -125,13 +125,7 @@ void FFmpeg::seek_internal() {
audioQueue.reset();
int flags = 0;
if (m_seekTarget < position()) flags |= AVSEEK_FLAG_BACKWARD;
- int stream = -1;
- if (decodeVideo) stream = videoStream;
- if (decodeAudio) stream = audioStream;
- int64_t target = m_seekTarget * AV_TIME_BASE;
- const AVRational time_base_q = { 1, AV_TIME_BASE }; // AV_TIME_BASE_Q is the same thing with C99 struct literal (not supported by MSVC)
- if (stream != -1) target = av_rescale_q(target, time_base_q, pFormatCtx->streams[stream]->time_base);
- av_seek_frame(pFormatCtx, stream, target, flags);
+ av_seek_frame(pFormatCtx, -1, m_seekTarget * AV_TIME_BASE, flags);
m_seekTarget = getNaN(); // Signal that seeking is done
}
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2012-03-16 23:25:45
|
Author: Lasse Karkkainen <tro...@tr...>
Date: Sat Mar 17 01:25:28 2012 +0200
Ffmpeg API keeps changing, fix some deprecation warnings...
---
game/ffmpeg.cc | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/game/ffmpeg.cc b/game/ffmpeg.cc
index 1f5d5b2..8fdc974 100644
--- a/game/ffmpeg.cc
+++ b/game/ffmpeg.cc
@@ -33,7 +33,7 @@ FFmpeg::~FFmpeg() {
if (pResampleCtx) audio_resample_close(pResampleCtx);
if (pAudioCodecCtx) avcodec_close(pAudioCodecCtx);
if (pVideoCodecCtx) avcodec_close(pVideoCodecCtx);
- if (pFormatCtx) av_close_input_file(pFormatCtx);
+ if (pFormatCtx) avformat_close_input(&pFormatCtx);
}
double FFmpeg::duration() const {
@@ -46,7 +46,7 @@ void FFmpeg::open() {
av_register_all();
av_log_set_level(AV_LOG_ERROR);
if (avformat_open_input(&pFormatCtx, m_filename.c_str(), NULL, NULL)) throw std::runtime_error("Cannot open input file");
- if (av_find_stream_info(pFormatCtx) < 0) throw std::runtime_error("Cannot find stream information");
+ if (avformat_find_stream_info(pFormatCtx, NULL) < 0) throw std::runtime_error("Cannot find stream information");
pFormatCtx->flags |= AVFMT_FLAG_GENPTS;
videoStream = -1;
audioStream = -1;
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2012-03-16 23:25:42
|
Author: Lasse Karkkainen <tro...@tr...>
Date: Sat Mar 17 01:14:02 2012 +0200
Fix a compile error due to missing av_rescale_q by removing some unnecessary per-stream seeking logic.
---
game/ffmpeg.cc | 8 +-------
1 files changed, 1 insertions(+), 7 deletions(-)
diff --git a/game/ffmpeg.cc b/game/ffmpeg.cc
index 87efcfa..1f5d5b2 100644
--- a/game/ffmpeg.cc
+++ b/game/ffmpeg.cc
@@ -125,13 +125,7 @@ void FFmpeg::seek_internal() {
audioQueue.reset();
int flags = 0;
if (m_seekTarget < position()) flags |= AVSEEK_FLAG_BACKWARD;
- int stream = -1;
- if (decodeVideo) stream = videoStream;
- if (decodeAudio) stream = audioStream;
- int64_t target = m_seekTarget * AV_TIME_BASE;
- const AVRational time_base_q = { 1, AV_TIME_BASE }; // AV_TIME_BASE_Q is the same thing with C99 struct literal (not supported by MSVC)
- if (stream != -1) target = av_rescale_q(target, time_base_q, pFormatCtx->streams[stream]->time_base);
- av_seek_frame(pFormatCtx, stream, target, flags);
+ av_seek_frame(pFormatCtx, -1, m_seekTarget * AV_TIME_BASE, flags);
m_seekTarget = getNaN(); // Signal that seeking is done
}
|
|
From: Tapio V. <aa...@us...> - 2012-03-07 17:25:22
|
Author: Tapio Vierros <tap...@gm...>
Date: Wed Mar 7 19:24:35 2012 +0200
Fixed MIDI writer doubling the timecode of the first lyric.
---
songwriter-ini.cc | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/songwriter-ini.cc b/songwriter-ini.cc
index 31cced5..8df181c 100644
--- a/songwriter-ini.cc
+++ b/songwriter-ini.cc
@@ -52,12 +52,14 @@ void FoFMIDIWriter::writeMIDI() const {
// End the previous sentence (if not at the beginning)
if (sentenceOn) {
ev.arg2 = 0;
- writer.writeEvent(ev);
+ writer.writeEvent(ev); // Note OFF
ev.timecode = 0; // Reset time for the next event
- } // Note OFF
+ }
sentenceOn = true;
// Begin a new one
- ev.arg2 = 127; writer.writeEvent(ev); // Note ON
+ ev.arg2 = 127;
+ writer.writeEvent(ev); // Note ON
+ ev.timecode = 0; // Reset time for the next event
}
// Write lyric
QByteArray bytes = it->syllable.toUtf8();
|
|
From: Tapio V. <aa...@us...> - 2012-02-20 17:24:10
|
Author: Lasse Karkkainen <tro...@tr...>
Date: Mon Feb 20 07:15:24 2012 +0200
Load a random background if background loading fails (screen_sing).
- Added empty() for Surface, allows testing if the loading has failed.
---
game/screen_sing.cc | 30 +++++-------------------------
game/surface.cc | 2 +-
game/surface.hh | 1 +
3 files changed, 7 insertions(+), 26 deletions(-)
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index 6b5ff3d..7b16fb4 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -135,26 +135,7 @@ void ScreenSing::reloadGL() {
m_help.reset(new Surface(getThemePath("instrumenthelp.svg")));
m_progress.reset(new ProgressBar(getThemePath("sing_progressbg.svg"), getThemePath("sing_progressfg.svg"), ProgressBar::HORIZONTAL, 0.01f, 0.01f, true));
// Load background
- bool foundbg = false;
- if (!m_song->background.empty()) { // Load bg image
- try {
- m_background.reset(new Surface(m_song->path + m_song->background));
- foundbg = true;
- } catch (std::exception& e) {
- m_song->background = "";
- std::cerr << e.what() << std::endl;
- }
- }
- // Use random bg if specified fails (also for tracks with video)
- if (!foundbg) {
- sm->loading(_("Random background..."), 0.65);
- try {
- std::string bgpath = m_backgrounds.getRandom();
- m_background.reset(new Surface(bgpath));
- } catch (std::exception& e) {
- std::cerr << e.what() << std::endl;
- }
- }
+ if (!m_song->background.empty()) m_background.reset(new Surface(m_song->path + m_song->background));
}
void ScreenSing::exit() {
@@ -444,11 +425,10 @@ void ScreenSing::draw() {
Transform ft(farTransform());
double ar = arMax;
// Background image
- if (m_background) {
- ar = m_background->dimensions.ar();
- if (ar > arMax || (m_video && ar > arMin)) fillBG(); // Fill white background to avoid black borders
- m_background->draw();
- } else fillBG(); // Blank
+ if (!m_background || m_background->empty()) m_background.reset(new Surface(m_backgrounds.getRandom()));
+ ar = m_background->dimensions.ar();
+ if (ar > arMax || (m_video && ar > arMin)) fillBG(); // Fill white background to avoid black borders
+ m_background->draw();
// Webcam
if (m_cam && config["graphic/webcam"].b()) m_cam->render();
// Video
diff --git a/game/surface.cc b/game/surface.cc
index a25e2f6..8f9bd1c 100644
--- a/game/surface.cc
+++ b/game/surface.cc
@@ -195,6 +195,6 @@ void Surface::load(Bitmap const& bitmap) {
}
void Surface::draw() const {
- if (m_width * m_height > 0.0) m_texture.draw(dimensions, TexCoords(tex.x1 * m_width, tex.y1 * m_height, tex.x2 * m_width, tex.y2 * m_height));
+ if (!empty()) m_texture.draw(dimensions, TexCoords(tex.x1 * m_width, tex.y1 * m_height, tex.x2 * m_width, tex.y2 * m_height));
}
diff --git a/game/surface.hh b/game/surface.hh
index 57a926e..055550f 100644
--- a/game/surface.hh
+++ b/game/surface.hh
@@ -221,6 +221,7 @@ class Surface {
/// creates surface from file
Surface(std::string const& filename);
~Surface();
+ bool empty() const { return m_width * m_height == 0; } ///< Test if the loading has failed
/// draws surface
void draw() const;
/// loads surface into buffer
|
|
From: Tapio V. <aa...@us...> - 2012-02-20 17:24:02
|
Author: Lasse Karkkainen <tro...@tr...>
Date: Mon Feb 20 06:50:00 2012 +0200
Draw one more cover (outside the screen) on song browser to avoid seeing the loading of images when browsing.
---
game/screen_songs.cc | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/game/screen_songs.cc b/game/screen_songs.cc
index 64d621c..95a5d44 100644
--- a/game/screen_songs.cc
+++ b/game/screen_songs.cc
@@ -256,7 +256,7 @@ void ScreenSongs::drawCovers() {
std::size_t ss = m_songs.size();
int baseidx = spos + 1.5; --baseidx; // Round correctly
double shift = spos - baseidx;
- for (int i = -2; i < 5; ++i) {
+ for (int i = -2; i < 6; ++i) {
if (baseidx + i < 0 || baseidx + i >= int(ss)) continue;
Song& song = m_songs[baseidx + i];
Surface& s = getCover(song);
|
|
From: Tapio V. <aa...@us...> - 2012-02-20 17:23:55
|
Author: Lasse Karkkainen <tro...@tr...>
Date: Sun Feb 19 22:31:10 2012 +0200
Use black non-transparent placeholder texture instead of gray.
---
game/surface.cc | 3 ++-
game/surface.hh | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/game/surface.cc b/game/surface.cc
index fedf953..a25e2f6 100644
--- a/game/surface.cc
+++ b/game/surface.cc
@@ -115,8 +115,9 @@ struct Loader {
void updateSurfaces() { ldr.apply(); }
template <typename T> void loader(T* target, fs::path const& name) {
- // Temporarily add 1x1 pixel gray block
+ // Temporarily add 1x1 pixel black texture
Bitmap bitmap;
+ bitmap.fmt = pix::RGB;
bitmap.resize(1, 1);
target->load(bitmap);
// Ask the loader to retrieve the image
diff --git a/game/surface.hh b/game/surface.hh
index 1dc70fe..57a926e 100644
--- a/game/surface.hh
+++ b/game/surface.hh
@@ -171,7 +171,7 @@ struct Bitmap {
pix::Format fmt;
Bitmap(): width(), height(), ar(), fmt(pix::CHAR_RGBA) {}
void resize(unsigned w, unsigned h) {
- buf.resize(w * h * 4, 0x80);
+ buf.resize(w * h * 4);
width = w;
height = h;
ar = float(w) / h;
|
|
From: Tapio V. <aa...@us...> - 2012-02-20 17:23:47
|
Author: Tapio Vierros <tap...@gm...>
Date: Sun Feb 19 22:10:34 2012 +0200
Fixed (hopefully all) aspect ratio issues with the new threaded gfx loading.
---
game/instrumentgraph.cc | 10 +++++-----
game/progressbar.cc | 2 ++
game/screen_intro.cc | 1 +
game/screen_practice.cc | 4 +++-
game/screen_sing.cc | 7 +++----
game/theme.cc | 10 ++--------
6 files changed, 16 insertions(+), 18 deletions(-)
diff --git a/game/instrumentgraph.cc b/game/instrumentgraph.cc
index 6d25d3b..454196a 100644
--- a/game/instrumentgraph.cc
+++ b/game/instrumentgraph.cc
@@ -36,10 +36,6 @@ InstrumentGraph::InstrumentGraph(Audio& audio, Song const& song, input::DevType
m_popupText.reset(new SvgTxtThemeSimple(getThemePath("sing_popup_text.svg"), config["graphic/text_lod"].f()));
m_menuTheme.reset(new ThemeInstrumentMenu());
for (size_t i = 0; i < max_panels; ++i) m_pressed[i] = false;
- m_arrow_up.dimensions.stretch(0.05, 0.05);
- m_arrow_down.dimensions.stretch(0.05, 0.05);
- m_arrow_left.dimensions.stretch(0.05, 0.05);
- m_arrow_right.dimensions.stretch(0.05, 0.05);
}
@@ -73,8 +69,12 @@ void InstrumentGraph::drawMenu() {
Dimensions dimensions(1.0); // FIXME: bogus aspect ratio (is this fixable?)
if (getGraphType() == input::DANCEPAD) dimensions.screenTop().middle().stretch(m_width.get(), 1.0);
else dimensions.screenBottom().middle().fixedWidth(std::min(m_width.get(), 0.5));
- // Some helper vars
ThemeInstrumentMenu& th = *m_menuTheme;
+ th.back_h.dimensions.fixedHeight(0.08f);
+ m_arrow_up.dimensions.stretch(0.05, 0.05);
+ m_arrow_down.dimensions.stretch(0.05, 0.05);
+ m_arrow_left.dimensions.stretch(0.05, 0.05);
+ m_arrow_right.dimensions.stretch(0.05, 0.05);
MenuOptions::const_iterator cur = static_cast<MenuOptions::const_iterator>(&m_menu.current());
double w = m_menu.dimensions.w();
const float s = std::min(m_width.get(), 0.5) / w;
diff --git a/game/progressbar.cc b/game/progressbar.cc
index a2a8c78..2c0a12c 100644
--- a/game/progressbar.cc
+++ b/game/progressbar.cc
@@ -40,4 +40,6 @@ void ProgressBar::draw(float value) {
break;
default: throw std::logic_error("ProgressBar::draw(): unknown m_mode value");
}
+ // Reset dimensions due to async image loading
+ dimensions = Dimensions(m_bg.ar());
}
diff --git a/game/screen_intro.cc b/game/screen_intro.cc
index 6109b06..906df55 100644
--- a/game/screen_intro.cc
+++ b/game/screen_intro.cc
@@ -78,6 +78,7 @@ void ScreenIntro::draw_menu_options() {
const float sel_margin = 0.05;
const MenuOptions opts = m_menu.getOptions();
double submenuanim = 1.0 - std::min(1.0, std::abs(m_submenuAnim.get()-m_menu.getSubmenuLevel()));
+ theme->back_h.dimensions.fixedHeight(0.08f);
theme->back_h.dimensions.stretch(m_menu.dimensions.w(), theme->back_h.dimensions.h());
// Determine from which item to start
int start_i = std::min((int)m_menu.curIndex() - 1, (int)opts.size() - (int)showopts
diff --git a/game/screen_practice.cc b/game/screen_practice.cc
index 3f6862f..28f8197 100644
--- a/game/screen_practice.cc
+++ b/game/screen_practice.cc
@@ -16,7 +16,6 @@ void ScreenPractice::enter() {
// draw vu meters
for (unsigned int i = 0, mics = m_audio.analyzers().size(); i < mics; ++i) {
m_vumeters.push_back(new ProgressBar(getThemePath("vumeter_bg.svg"), getThemePath("vumeter_fg.svg"), ProgressBar::VERTICAL, 0.136, 0.023));
- m_vumeters.back().dimensions.screenBottom().left(-0.4 + i * 0.2).fixedWidth(0.04);
}
m_samples.push_back("drum bass");
m_samples.push_back("drum snare");
@@ -56,6 +55,8 @@ void ScreenPractice::draw() {
}
void ScreenPractice::draw_analyzers() {
+ theme->note.dimensions.fixedHeight(0.03f);
+ theme->sharp.dimensions.fixedHeight(0.09f);
MusicalScale scale;
boost::ptr_vector<Analyzer>& analyzers = m_audio.analyzers();
if (analyzers.empty()) return;
@@ -73,6 +74,7 @@ void ScreenPractice::draw_analyzers() {
}
// getPeak returns 0.0 when clipping, negative values when not that loud.
// Normalizing to [0,1], where 0 is -43 dB or less (to match the vumeter graphic)
+ m_vumeters[i].dimensions.screenBottom().left(-0.4 + i * 0.2).fixedWidth(0.04);
m_vumeters[i].draw(analyzer.getPeak() / 43.0 + 1.0);
if (freq != 0.0) {
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index dfb7a9e..6b5ff3d 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -134,8 +134,6 @@ void ScreenSing::reloadGL() {
m_pause_icon.reset(new Surface(getThemePath("sing_pause.svg")));
m_help.reset(new Surface(getThemePath("instrumenthelp.svg")));
m_progress.reset(new ProgressBar(getThemePath("sing_progressbg.svg"), getThemePath("sing_progressfg.svg"), ProgressBar::HORIZONTAL, 0.01f, 0.01f, true));
- m_progress->dimensions.fixedWidth(0.4).left(-0.5).screenTop();
- theme->timer.dimensions.screenTop(0.5 * m_progress->dimensions.h());
// Load background
bool foundbg = false;
if (!m_song->background.empty()) { // Load bg image
@@ -490,6 +488,8 @@ void ScreenSing::draw() {
// Compute and draw the timer and the progressbar
{
unsigned t = clamp(time, 0.0, length);
+ m_progress->dimensions.fixedWidth(0.4).left(-0.5).screenTop();
+ theme->timer.dimensions.screenTop(0.5 * m_progress->dimensions.h());
m_progress->draw(songPercent);
Song::SongSection section("error", 0);
@@ -661,7 +661,6 @@ ScoreWindow::ScoreWindow(Instruments& instruments, Database& database, Dancers&
}
}
m_bg.dimensions.middle().center();
- m_scoreBar.dimensions.fixedWidth(0.09);
}
void ScoreWindow::draw() {
@@ -675,7 +674,7 @@ void ScoreWindow::draw() {
int score = p->score;
ColorTrans c(p->color);
double x = -0.12 + spacing * (0.5 + i - 0.5 * m_database.scores.size());
- m_scoreBar.dimensions.middle(x).bottom(0.20);
+ m_scoreBar.dimensions.fixedWidth(0.09).middle(x).bottom(0.20);
m_scoreBar.draw(score / 10000.0);
m_score_text.render(boost::lexical_cast<std::string>(score));
m_score_text.dimensions().middle(x).top(0.24).fixedHeight(0.05);
diff --git a/game/theme.cc b/game/theme.cc
index dbaab57..ffcc88d 100644
--- a/game/theme.cc
+++ b/game/theme.cc
@@ -21,10 +21,7 @@ ThemePractice::ThemePractice():
note(getThemePath("practice_note.svg")),
sharp(getThemePath("practice_sharp.svg")),
note_txt(getThemePath("practice_txt.svg"), config["graphic/text_lod"].f())
-{
- note.dimensions.fixedHeight(0.03f);
- sharp.dimensions.fixedHeight(0.09f);
-}
+{}
ThemeSing::ThemeSing():
bg_top(getThemePath("sing_bg_top.svg")),
@@ -53,9 +50,7 @@ ThemeIntro::ThemeIntro():
short_comment(getThemePath("mainmenu_short_comment.svg"), config["graphic/text_lod"].f()),
comment_bg(getThemePath("mainmenu_comment_bg.svg")),
short_comment_bg(getThemePath("mainmenu_scomment_bg.svg"))
-{
- back_h.dimensions.fixedHeight(0.08f);
-}
+{}
ThemeInstrumentMenu::ThemeInstrumentMenu():
Theme(getThemePath("instrumentmenu_bg.svg")),
@@ -65,7 +60,6 @@ ThemeInstrumentMenu::ThemeInstrumentMenu():
comment(getThemePath("instrumentmenu_comment.svg"), config["graphic/text_lod"].f())
//comment_bg(getThemePath("menu_comment_bg.svg"))
{
- back_h.dimensions.fixedHeight(0.08f);
comment.setAlign(SvgTxtTheme::CENTER);
}
|