|
From: Yoda-JM <yo...@us...> - 2010-01-13 12:22:22
|
Module: performous
Branch: master
Commit: 266ac464229c4274a5eee15a410c3cc5f797d807
Author: Vincent Le Ligeour <yo...@us...>
Date: Wed Jan 13 13:19:25 2010 +0100
Added indication to tell if highscore is available
---
game/database.cc | 2 +-
game/database.hh | 2 +-
game/screen_songs.cc | 5 ++-
game/songitems.cc | 7 ++++
game/songitems.hh | 1 +
game/theme.cc | 3 +-
game/theme.hh | 2 +
themes/default/songs_hiscore.svg | 72 ++++++++++++++++++++++++++++++++++++++
8 files changed, 90 insertions(+), 4 deletions(-)
diff --git a/game/database.cc b/game/database.cc
index ee68700..92d22ad 100644
--- a/game/database.cc
+++ b/game/database.cc
@@ -130,7 +130,7 @@ void Database::queryPerPlayerHiscore (std::ostream & os, std::string const& trac
}
}
-bool Database::hasHiscore(boost::shared_ptr<Song> s) const {
+bool Database::hasHiscore(Song& s) const {
int songid = m_songs.lookup(s);
return m_hiscores.hasHiscore(songid);
}
diff --git a/game/database.hh b/game/database.hh
index 259be37..d842f46 100644
--- a/game/database.hh
+++ b/game/database.hh
@@ -101,7 +101,7 @@ class Database
void queryPerSongHiscore (std::ostream & os, boost::shared_ptr<Song> s, std::string const& track = "") const;
void queryPerPlayerHiscore (std::ostream & os, std::string const& track = "") const;
- bool hasHiscore(boost::shared_ptr<Song> s) const;
+ bool hasHiscore(Song& s) const;
bool noPlayers() const;
private:
diff --git a/game/screen_songs.cc b/game/screen_songs.cc
index a5f151b..fc140c7 100644
--- a/game/screen_songs.cc
+++ b/game/screen_songs.cc
@@ -177,7 +177,7 @@ void ScreenSongs::draw() {
info.videoGap = 0.0;
drawMultimedia();
- std::ostringstream oss_song, oss_order;
+ std::ostringstream oss_song, oss_order, oss_hiscore;
// Test if there are no songs
if (m_songs.empty()) {
// Format the song information text
@@ -192,6 +192,8 @@ void ScreenSongs::draw() {
Song& song = m_songs.current();
// Format the song information text
oss_song << song.title << '\n' << song.artist;
+ if(m_database.hasHiscore(song))
+ oss_hiscore << _("(hiscore available, push \"End\" key to see them)");
oss_order << _("filter: ") << (m_search.text.empty() ? _("none") : m_search.text) << '\n';
oss_order << m_songs.sortDesc() << '\n';
oss_order << "(" << m_songs.currentId() + 1 << "/" << m_songs.size() << ")";
@@ -311,6 +313,7 @@ void ScreenSongs::draw() {
// Draw song and order texts
theme->song.draw(oss_song.str());
theme->order.draw(oss_order.str());
+ theme->hiscore.draw(oss_hiscore.str());
}
stopMultimedia(info);
if (m_jukebox) {
diff --git a/game/songitems.cc b/game/songitems.cc
index a35a434..1491100 100644
--- a/game/songitems.cc
+++ b/game/songitems.cc
@@ -83,6 +83,13 @@ int SongItems::lookup(boost::shared_ptr<Song> song) const {
return -1;
}
+int SongItems::lookup(Song& song) const {
+ for (songs_t::const_iterator it = m_songs.begin(); it != m_songs.end(); ++it) {
+ if (song.collateByArtistOnly == it->artist && song.collateByTitleOnly == it->title) return it->id;
+ }
+ return -1;
+}
+
std::string SongItems::lookup (int id) const {
SongItem si;
si.id = id;
diff --git a/game/songitems.hh b/game/songitems.hh
index 4575c45..27b74c1 100644
--- a/game/songitems.hh
+++ b/game/songitems.hh
@@ -82,6 +82,7 @@ struct SongItems
/**Lookup a songid for a specific song.
@return -1 if no song found.*/
int lookup(boost::shared_ptr<Song> song) const;
+ int lookup(Song& song) const;
/**Lookup the artist + title for a specific song.
@return "Unknown Song" if nothing is found.
diff --git a/game/theme.cc b/game/theme.cc
index 7e928f2..6699a64 100755
--- a/game/theme.cc
+++ b/game/theme.cc
@@ -11,7 +11,8 @@ Theme::Theme(const std::string path) : bg(path)
ThemeSongs::ThemeSongs():
Theme(getThemePath("songs_bg.svg")),
song(getThemePath("songs_song.svg"), config["graphic/text_lod"].f()),
- order(getThemePath("songs_order.svg"), config["graphic/text_lod"].f())
+ order(getThemePath("songs_order.svg"), config["graphic/text_lod"].f()),
+ hiscore(getThemePath("songs_hiscore.svg"), config["graphic/text_lod"].f())
{}
ThemePractice::ThemePractice():
diff --git a/game/theme.hh b/game/theme.hh
index 3cbba53..6fcce45 100755
--- a/game/theme.hh
+++ b/game/theme.hh
@@ -22,6 +22,8 @@ struct ThemeSongs: Theme {
SvgTxtTheme song;
/// ordering display
SvgTxtTheme order;
+ /// hiscore display
+ SvgTxtTheme hiscore;
};
/// theme for practice screen
diff --git a/themes/default/songs_hiscore.svg b/themes/default/songs_hiscore.svg
new file mode 100644
index 0000000..e56ea6b
--- /dev/null
+++ b/themes/default/songs_hiscore.svg
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Sodipodi ("http://www.sodipodi.com/") -->
+<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"
+ version="1.0"
+ x="0"
+ y="0"
+ width="800.000000"
+ height="600.000000"
+ id="svg559"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ sodipodi:docname="songs_hiscore.svg"
+ sodipodi:docbase="/home/yoda/UltraStar/sf/UltraStar-ng/themes/default"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <metadata
+ id="metadata35">
+ <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>
+ <sodipodi:namedview
+ inkscape:window-height="797"
+ inkscape:window-width="1081"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="0.0"
+ guidetolerance="10.0"
+ gridtolerance="10.0"
+ objecttolerance="10.0"
+ borderopacity="1.0"
+ bordercolor="#666666"
+ pagecolor="#ffffff"
+ id="base"
+ inkscape:zoom="0.89095454"
+ inkscape:cx="141.39663"
+ inkscape:cy="249.62029"
+ inkscape:window-x="235"
+ inkscape:window-y="25"
+ inkscape:current-layer="svg559"
+ showgrid="false" />
+ <defs
+ id="defs561">
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 300 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="800 : 300 : 1"
+ inkscape:persp3d-origin="400 : 200 : 1"
+ id="perspective8" />
+ </defs>
+ <text
+ xml:space="preserve"
+ style="font-size:18px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Verdana;-inkscape-font-specification:Verdana Bold"
+ x="400"
+ y="240.31577"
+ id="text1990"><tspan
+ sodipodi:role="line"
+ id="tspan1992"
+ x="400"
+ y="332.31577">Hiscore</tspan></text>
+</svg>
|