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: Markus R. <god...@us...> - 2009-07-29 15:34:54
|
Module: performous
Branch: hiscore
Commit: b2170b1d91971c000fd808ff87301d8a9b00150e
Author: Markus Raab <un...@ma...>
Date: Wed Jul 29 10:12:26 2009 +0200
Small changes
---
game/main.cc | 1 -
game/players.cc | 9 ++++++++-
game/players.hh | 2 ++
game/screen_players.cc | 9 +++++----
4 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/game/main.cc b/game/main.cc
index d8f5848..89669a6 100644
--- a/game/main.cc
+++ b/game/main.cc
@@ -135,7 +135,6 @@ void mainLoop() {
audioSetup(capture, audio);
Songs songs(songlist);
Players players(getSharePath("performous.xml"));
- try {players.load();} catch(...) {std::cerr << "Could not load players" << std::endl;}
ScreenManager sm;
Window window(config["graphic/window_width"].i(), config["graphic/window_height"].i(), config["graphic/fullscreen"].b(), config["graphic/fs_width"].i(), config["graphic/fs_height"].i());
sm.addScreen(new ScreenIntro("Intro", audio, capture));
diff --git a/game/players.cc b/game/players.cc
index fa00013..b13a4f9 100644
--- a/game/players.cc
+++ b/game/players.cc
@@ -17,11 +17,14 @@ Players::Players(std::string filename):
m_dirty(false),
cur()
{
+ try { load(); }
+ catch(...) { std::cerr << "Could not load " << file() << ", will create" << std::endl; }
m_filtered = m_players;
}
Players::~Players() {
- try { save(); } catch (...) { std::cerr << "Could not save players to " << m_filename << std::endl; }
+ try { save(); }
+ catch (...) { std::cerr << "Could not save players to " << file() << std::endl; }
}
void Players::load() {
@@ -67,6 +70,10 @@ void Players::update() {
if (m_dirty) filter_internal();
}
+std::string Players::file() {
+ return m_filename;
+}
+
void Players::addPlayer (std::string const& name, std::string const& picture) {
PlayerItem pi;
pi.name = name;
diff --git a/game/players.hh b/game/players.hh
index 924b13a..9f78b70 100644
--- a/game/players.hh
+++ b/game/players.hh
@@ -64,6 +64,8 @@ class Players: boost::noncopyable {
}
void save();
void update();
+ /**Returns the path to which file is used*/
+ std::string file();
void addPlayer (std::string const& name, std::string const& picture = "");
/// const array access
diff --git a/game/screen_players.cc b/game/screen_players.cc
index 0333213..f2b6542 100644
--- a/game/screen_players.cc
+++ b/game/screen_players.cc
@@ -18,7 +18,7 @@ void ScreenPlayers::enter() {
try {
m_highscore->load();
} catch (HiscoreException const& hi) {
- std::cerr << "high.sco:" << hi.line() << " " << hi.what() << std::endl;
+ std::cerr << "High.sco:" << hi.line() << " " << hi.what() << std::endl;
}
m_score_text[0].reset(new SvgTxtThemeSimple(getThemePath("sing_score_text.svg"), config["graphic/text_lod"].f()));
@@ -51,7 +51,7 @@ void ScreenPlayers::exit() {
try {
m_highscore->save();
} catch (HiscoreException const& hi) {
- std::cerr << "high.sco:" << hi.line() << " " << hi.what() << std::endl;
+ std::cerr << "High.sco:" << hi.line() << " " << hi.what() << std::endl;
}
m_highscore.reset();
}
@@ -137,8 +137,9 @@ void ScreenPlayers::draw() {
// Format the song information text
if (m_search.text.empty()) {
oss_song << "No players found!";
- oss_order << "Check players.xml in current\n"; // TODO retrieve from configuration
- oss_order << "directory for players";
+ oss_order << "Check " << m_players.file() << "\n";
+ oss_order << "directory for players\n";
+ oss_order << "Enter a name to create a new player.";
} else {
oss_song << "Press enter to create player!";
oss_order << m_search.text << '\n';
|
|
From: Markus R. <god...@us...> - 2009-07-29 15:34:53
|
Module: performous
Branch: hiscore
Commit: 5206710e9ecbe137118ca071fc1c25e908c21bca
Author: Markus Raab <un...@ma...>
Date: Wed Jul 29 10:03:12 2009 +0200
use share path
---
data/performous.xml | 9 +++++++++
game/fs.cc | 13 +++++++++++++
game/fs.hh | 3 +++
game/main.cc | 3 ++-
game/players.cc | 3 +--
5 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/data/performous.xml b/data/performous.xml
index 3760fa7..0183814 100644
--- a/data/performous.xml
+++ b/data/performous.xml
@@ -198,6 +198,15 @@
<long>Where to recursively look for songs.</long>
</locale>
</entry>
+ <entry name="system/path_share" type="string_list">
+ <stringvalue>~/.local/share</stringvalue>
+ <stringvalue>../share</stringvalue><!-- For Windows where the program is started in bin/ -->
+ <stringvalue>~/.performous/share</stringvalue>
+ <locale name="C">
+ <short>Data folders</short>
+ <long>Where Performous data are stored.</long>
+ </locale>
+ </entry>
<entry name="system/path_pictures" type="string_list">
<stringvalue>/usr/local/share/games/performous/pictures</stringvalue>
<stringvalue>/usr/share/games/performous/pictures</stringvalue>
diff --git a/game/fs.cc b/game/fs.cc
index f504fc1..82a5f93 100644
--- a/game/fs.cc
+++ b/game/fs.cc
@@ -49,6 +49,19 @@ std::string getDataPath(std::string const& filename) {
ConfigItem::StringList sd = config["system/path_data"].sl();
for (std::vector<std::string>::const_iterator it = sd.begin(); it != sd.end(); ++it) {
fs::path p = *it;
+ p = pathMangle(p);
+ if (fs::is_directory(p)) { data_dir = p.string(); break; }
+ }
+ return data_dir + "/" + filename;
+}
+
+std::string getSharePath(std::string const& filename) {
+ // Figure out theme folder (if theme name rather than path was given)
+ std::string data_dir;
+ ConfigItem::StringList sd = config["system/path_share"].sl();
+ for (std::vector<std::string>::const_iterator it = sd.begin(); it != sd.end(); ++it) {
+ fs::path p = *it;
+ p = pathMangle(p);
if (fs::is_directory(p)) { data_dir = p.string(); break; }
}
return data_dir + "/" + filename;
diff --git a/game/fs.hh b/game/fs.hh
index ea02bbe..6500baa 100644
--- a/game/fs.hh
+++ b/game/fs.hh
@@ -16,3 +16,6 @@ std::string getThemePath(std::string const& filename);
/** Get full path to a data file **/
std::string getDataPath(std::string const& filename);
+
+/** Get full path to a share file **/
+std::string getSharePath(std::string const& filename);
diff --git a/game/main.cc b/game/main.cc
index 4d80e8c..d8f5848 100644
--- a/game/main.cc
+++ b/game/main.cc
@@ -134,7 +134,8 @@ void mainLoop() {
Audio audio;
audioSetup(capture, audio);
Songs songs(songlist);
- Players players("players.xml"); // TODO: retrieve from configuration
+ Players players(getSharePath("performous.xml"));
+ try {players.load();} catch(...) {std::cerr << "Could not load players" << std::endl;}
ScreenManager sm;
Window window(config["graphic/window_width"].i(), config["graphic/window_height"].i(), config["graphic/fullscreen"].b(), config["graphic/fs_width"].i(), config["graphic/fs_height"].i());
sm.addScreen(new ScreenIntro("Intro", audio, capture));
diff --git a/game/players.cc b/game/players.cc
index 9eeb442..fa00013 100644
--- a/game/players.cc
+++ b/game/players.cc
@@ -17,12 +17,11 @@ Players::Players(std::string filename):
m_dirty(false),
cur()
{
- load();
m_filtered = m_players;
}
Players::~Players() {
- save();
+ try { save(); } catch (...) { std::cerr << "Could not save players to " << m_filename << std::endl; }
}
void Players::load() {
|
|
From: Markus R. <god...@us...> - 2009-07-29 15:34:51
|
Module: performous
Branch: hiscore
Commit: 26f0fadddd5c8dbeb4851cfa966a8e16164efbb9
Author: Markus Raab <un...@ma...>
Date: Wed Jul 29 09:31:37 2009 +0200
Hiscore now disabled per default
---
data/performous.xml | 6 ++++++
game/screen_sing.cc | 3 ++-
2 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/data/performous.xml b/data/performous.xml
index 8e894da..3760fa7 100644
--- a/data/performous.xml
+++ b/data/performous.xml
@@ -38,6 +38,12 @@
<long>Hide pitch wave, notes and scoring</long>
</locale>
</entry>
+ <entry name="game/song_hiscore" type="bool" value="false">
+ <locale name="C">
+ <short>Song Hiscore</short>
+ <long>Show and save a per song hiscore.</long>
+ </locale>
+ </entry>
<entry name="game/pitch" type="bool" value="true">
<locale name="C">
<short>Pitch waves</short>
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index 7accaea..09161f8 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -74,7 +74,8 @@ void ScreenSing::activatePlayerScreen()
if (m_players.scores.empty()
|| !hi.reachedNewHiscore(m_players.scores.front())
- || !hi.isWritable())
+ || !hi.isWritable()
+ || !config["game/song_hiscore"].b())
{
// if no highscore reached..
sm->activateScreen("Songs");
|
|
From: Markus R. <god...@us...> - 2009-07-29 15:34:49
|
Module: performous
Branch: hiscore
Commit: 3a3638414d016f922731b61d0d05ed9a77f69729
Author: Markus Raab <un...@ma...>
Date: Wed Jul 29 09:28:06 2009 +0200
Search for pictures in path_pictures
---
data/performous.xml | 10 ++++++++++
game/players.cc | 23 ++++++++++++++++++++++-
game/screen_players.cc | 8 ++++++--
3 files changed, 38 insertions(+), 3 deletions(-)
diff --git a/data/performous.xml b/data/performous.xml
index 29dc585..8e894da 100644
--- a/data/performous.xml
+++ b/data/performous.xml
@@ -192,4 +192,14 @@
<long>Where to recursively look for songs.</long>
</locale>
</entry>
+ <entry name="system/path_pictures" type="string_list">
+ <stringvalue>/usr/local/share/games/performous/pictures</stringvalue>
+ <stringvalue>/usr/share/games/performous/pictures</stringvalue>
+ <stringvalue>../pictures/</stringvalue><!-- For Windows where the program is started in bin/ -->
+ <stringvalue>~/.performous/pictures/</stringvalue>
+ <locale name="C">
+ <short>Picture folders</short>
+ <long>Where to look for pictures of players.</long>
+ </locale>
+ </entry>
</performous>
diff --git a/game/players.cc b/game/players.cc
index 93512d4..9eeb442 100644
--- a/game/players.cc
+++ b/game/players.cc
@@ -1,6 +1,10 @@
#include "players.hh"
+#include "fs.hh"
+#include "configuration.hh"
+
#include <fstream>
+#include <iostream>
#include <boost/regex.hpp>
#include <libxml++/libxml++.h>
@@ -67,8 +71,25 @@ void Players::update() {
void Players::addPlayer (std::string const& name, std::string const& picture) {
PlayerItem pi;
pi.name = name;
- pi.path = "";
pi.picture = picture;
+ pi.path = "";
+
+ if (pi.picture != "") // no picture, so don't search path
+ {
+ ConfigItem::StringList const& sl = config["system/path_pictures"].sl();
+ typedef std::set<fs::path> dirs;
+ dirs d;
+ std::transform(sl.begin(), sl.end(), std::inserter(d, d.end()), pathMangle);
+
+ for (dirs::const_iterator it = d.begin(); it != d.end(); ++it) {
+ if (!fs::exists(*it)) continue; // as long as it does not exists
+ pi.path = it->file_string();
+ }
+
+ if (pi.path != "") std::cout << "Found " << pi.picture << " in " << pi.path << std::endl;
+ else std::cout << "Not found " << pi.picture << std::endl;
+ }
+
players_t::const_iterator it = std::find(m_players.begin(), m_players.end(), pi);
if (it != m_players.end()) return; // dont do anything, player exists
diff --git a/game/screen_players.cc b/game/screen_players.cc
index 7435d5f..0333213 100644
--- a/game/screen_players.cc
+++ b/game/screen_players.cc
@@ -160,8 +160,12 @@ void ScreenPlayers::draw() {
for (int i = -2; i < 5; ++i) {
PlayerItem player_display = m_players[baseidx + i];
if (baseidx + i < 0 || baseidx + i >= int(ss)) continue;
- Surface* cover = NULL;
- try { cover = &m_covers[player_display.path + player_display.picture]; } catch (std::exception const&) {}
+ Surface* cover = 0;
+ if (player_display.picture != "")
+ {
+ try { cover = &m_covers[player_display.path + "/" + player_display.picture]; }
+ catch (std::exception const&) {}
+ }
Surface& s = (cover ? *cover : *m_emptyCover);
double diff = (i == 0 ? (0.5 - fabs(shift)) * 0.07 : 0.0);
double y = 0.27 + 0.5 * diff;
|
|
From: Markus R. <god...@us...> - 2009-07-29 15:34:48
|
Module: performous
Branch: hiscore
Commit: a088841982b759be5b3cce3908759d35f7b0f2cc
Author: Markus Raab <un...@ma...>
Date: Wed Jul 29 08:44:44 2009 +0200
input of Player only if location (was) writeable
---
game/highscore.cc | 11 +++++++++++
game/highscore.hh | 6 ++++++
game/screen_sing.cc | 4 +++-
3 files changed, 20 insertions(+), 1 deletions(-)
diff --git a/game/highscore.cc b/game/highscore.cc
index ebfdb84..a1420f8 100644
--- a/game/highscore.cc
+++ b/game/highscore.cc
@@ -113,6 +113,13 @@ void SongHiscore::save()
out << "E" << std::endl;
}
+bool SongHiscore::isWritable()
+{
+ std::ofstream out ((m_path + m_filename).c_str());
+
+ return out.is_open();
+}
+
void SongHiscore::getInfo (std::ostream & out)
{
for (size_t i=0; i<m_scores.size();i++)
@@ -150,6 +157,10 @@ int main()
{
try {
SongHiscore hi ("", "highscore.txt");
+
+ if (hi.isWritable()) std::cout << "Is writeable" << std::endl;
+ else std::cout << "Is not writeable" << std::endl;
+
hi.load();
int new_score = 9000;
if (hi.reachedNewHiscore(new_score))
diff --git a/game/highscore.hh b/game/highscore.hh
index 7e3642e..61a5183 100644
--- a/game/highscore.hh
+++ b/game/highscore.hh
@@ -52,6 +52,12 @@ class SongHiscore {
void load();
void save();
+ /**Check if file location is writable.
+ @return true if it is.
+ @return false if you can't write at the location where path points to.
+ */
+ bool isWritable();
+
void getInfo (std::ostream & os);
/**Check if you reached a new highscore.
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index 920ea63..7accaea 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -72,7 +72,9 @@ void ScreenSing::activatePlayerScreen()
std::cerr << "high.sco:" << hi.line() << " " << hi.what() << std::endl;
}
- if (m_players.scores.empty() || !hi.reachedNewHiscore(m_players.scores.front()))
+ if (m_players.scores.empty()
+ || !hi.reachedNewHiscore(m_players.scores.front())
+ || !hi.isWritable())
{
// if no highscore reached..
sm->activateScreen("Songs");
|
|
From: Markus R. <god...@us...> - 2009-07-29 15:34:46
|
Module: performous
Branch: hiscore
Commit: e33e68d97aa189fc1ce77955a5454c82bf679ab8
Author: Markus Raab <un...@ma...>
Date: Mon Jul 27 16:58:35 2009 +0200
Player Database now in xml
---
game/.gitignore | 2 +-
game/main.cc | 2 +-
game/players.cc | 28 +++++++++++++++++-----------
game/screen_players.cc | 2 +-
4 files changed, 20 insertions(+), 14 deletions(-)
diff --git a/game/.gitignore b/game/.gitignore
index 13ba250..deb27f7 100644
--- a/game/.gitignore
+++ b/game/.gitignore
@@ -3,4 +3,4 @@ Makefile
highscore
highscore.txt
players
-players.txt
+players.xml
diff --git a/game/main.cc b/game/main.cc
index 70944de..4d80e8c 100644
--- a/game/main.cc
+++ b/game/main.cc
@@ -134,7 +134,7 @@ void mainLoop() {
Audio audio;
audioSetup(capture, audio);
Songs songs(songlist);
- Players players("players.txt"); // TODO: retrieve from configuration
+ Players players("players.xml"); // TODO: retrieve from configuration
ScreenManager sm;
Window window(config["graphic/window_width"].i(), config["graphic/window_height"].i(), config["graphic/fullscreen"].b(), config["graphic/fs_width"].i(), config["graphic/fs_height"].i());
sm.addScreen(new ScreenIntro("Intro", audio, capture));
diff --git a/game/players.cc b/game/players.cc
index 572d8f7..2ae321d 100644
--- a/game/players.cc
+++ b/game/players.cc
@@ -2,6 +2,7 @@
#include <fstream>
#include <boost/regex.hpp>
+#include <libxml++/libxml++.h>
Players::Players(std::string filename):
m_players(),
@@ -21,22 +22,29 @@ Players::~Players() {
}
void Players::load() {
- std::ifstream in (m_filename.c_str());
+ xmlpp::DomParser domParser(m_filename);
+ xmlpp::NodeSet n = domParser.get_document()->get_root_node()->find("/performous/players/player");
- std::string str;
- while (getline(in, str))
+ for (xmlpp::NodeSet::const_iterator it = n.begin(); it != n.end(); ++it)
{
- addPlayer(str);
+ xmlpp::Element& element = dynamic_cast<xmlpp::Element&>(**it);
+ xmlpp::Attribute* a = element.get_attribute("name");
+ addPlayer(a->get_value());
}
}
void Players::save() {
- std::ofstream out (m_filename.c_str());
+ xmlpp::Document doc;
+ xmlpp::Node* nodeRoot = doc.create_root_node("performous");
+ xmlpp::Element *players = nodeRoot->add_child("players");
for (players_t::const_iterator it = m_players.begin(); it!=m_players.end(); ++it)
{
- out << it->name << std::endl;
+ xmlpp::Element* player = players->add_child("player");
+ player->set_attribute("name", it->name);
}
+
+ doc.write_to_file_formatted(m_filename, "UTF-8");
}
void Players::update() {
@@ -91,16 +99,14 @@ void Players::filter_internal() {
int main(int argc, char** argv)
{
- if (argc != 2) return 1;
-
- std::string filter = argv[1];
- Players p("players.txt");
+ Players p("players.xml");
p.addPlayer("hubert");
- p.setFilter(filter);
for (size_t i=0; i<p.size(); i++)
{
std::cout << p[i].name << std::endl;
}
+
+ return 0;
}
*/
diff --git a/game/screen_players.cc b/game/screen_players.cc
index 4b58452..872c0bf 100644
--- a/game/screen_players.cc
+++ b/game/screen_players.cc
@@ -137,7 +137,7 @@ void ScreenPlayers::draw() {
// Format the song information text
if (m_search.text.empty()) {
oss_song << "No players found!";
- oss_order << "Check players.txt in current\n";
+ oss_order << "Check players.xml in current\n"; // TODO retrieve from configuration
oss_order << "directory for players";
} else {
oss_song << "Press enter to create player!";
|
|
From: Markus R. <god...@us...> - 2009-07-29 15:34:45
|
Module: performous
Branch: hiscore
Commit: c12838d7aa61dc4c5e1de5dbdd00f59e6e3f1b44
Author: Markus Raab <un...@ma...>
Date: Tue Jul 28 10:34:46 2009 +0200
Loading pictures works
---
game/players.cc | 21 ++++++++++++++++++---
game/players.hh | 10 +++++++---
game/screen_players.cc | 7 ++-----
3 files changed, 27 insertions(+), 11 deletions(-)
diff --git a/game/players.cc b/game/players.cc
index 2ae321d..93512d4 100644
--- a/game/players.cc
+++ b/game/players.cc
@@ -29,7 +29,15 @@ void Players::load() {
{
xmlpp::Element& element = dynamic_cast<xmlpp::Element&>(**it);
xmlpp::Attribute* a = element.get_attribute("name");
- addPlayer(a->get_value());
+ xmlpp::NodeSet n2 = element.find("picture");
+ std::string picture;
+ if (!n2.empty()) // optional picture element
+ {
+ xmlpp::Element& element2 =dynamic_cast<xmlpp::Element&>(**n2.begin());
+ xmlpp::TextNode* tn = element2.get_child_text();
+ picture = tn->get_content();
+ }
+ addPlayer(a->get_value(), picture);
}
}
@@ -42,6 +50,11 @@ void Players::save() {
{
xmlpp::Element* player = players->add_child("player");
player->set_attribute("name", it->name);
+ if (it->picture != "")
+ {
+ xmlpp::Element* picture = player->add_child("picture");
+ picture->add_child_text(it->picture);
+ }
}
doc.write_to_file_formatted(m_filename, "UTF-8");
@@ -51,9 +64,11 @@ void Players::update() {
if (m_dirty) filter_internal();
}
-void Players::addPlayer (std::string const& name) {
+void Players::addPlayer (std::string const& name, std::string const& picture) {
PlayerItem pi;
pi.name = name;
+ pi.path = "";
+ pi.picture = picture;
players_t::const_iterator it = std::find(m_players.begin(), m_players.end(), pi);
if (it != m_players.end()) return; // dont do anything, player exists
@@ -104,7 +119,7 @@ int main(int argc, char** argv)
for (size_t i=0; i<p.size(); i++)
{
- std::cout << p[i].name << std::endl;
+ std::cout << p[i].name << " picture: " << p[i].picture << std::endl;
}
return 0;
diff --git a/game/players.hh b/game/players.hh
index e956828..924b13a 100644
--- a/game/players.hh
+++ b/game/players.hh
@@ -15,9 +15,10 @@
*/
struct PlayerItem {
std::string name; /// unique name, link to highscore
+ std::string path; /// a path to a picture shown
+ std::string picture; /// + the filename for it
/* Future ideas
std::string displayedName; /// artist name, short name, nick (can be changed)
- std::string picture; /// a path to a picture shown
std::map<std::string, int> scores; /// map between a Song and the highest score the Player achieved
*/
@@ -63,10 +64,13 @@ class Players: boost::noncopyable {
}
void save();
void update();
- void addPlayer (std::string const& name);
+ void addPlayer (std::string const& name, std::string const& picture = "");
/// const array access
- PlayerItem operator[](std::size_t pos) const { return m_filtered[pos]; }
+ PlayerItem operator[](std::size_t pos) const {
+ if (pos < m_filtered.size()) return m_filtered[pos];
+ else return PlayerItem();
+ }
/// number of songs
size_t size() const { return m_filtered.size(); };
/// true if empty
diff --git a/game/screen_players.cc b/game/screen_players.cc
index 872c0bf..7435d5f 100644
--- a/game/screen_players.cc
+++ b/game/screen_players.cc
@@ -158,13 +158,10 @@ void ScreenPlayers::draw() {
int baseidx = spos + 1.5; --baseidx; // Round correctly
double shift = spos - baseidx;
for (int i = -2; i < 5; ++i) {
+ PlayerItem player_display = m_players[baseidx + i];
if (baseidx + i < 0 || baseidx + i >= int(ss)) continue;
Surface* cover = NULL;
- /*
- Song& song_display = m_players[baseidx + i];
- // Fetch cover image from cache or try loading it
- if (!song_display.cover.empty()) try { cover = &m_covers[song_display.path + song_display.cover]; } catch (std::exception const&) {}
- */
+ try { cover = &m_covers[player_display.path + player_display.picture]; } catch (std::exception const&) {}
Surface& s = (cover ? *cover : *m_emptyCover);
double diff = (i == 0 ? (0.5 - fabs(shift)) * 0.07 : 0.0);
double y = 0.27 + 0.5 * diff;
|
|
From: Markus R. <god...@us...> - 2009-07-29 15:34:44
|
Module: performous
Branch: hiscore
Commit: aa80c8f0c28e636335883214f15a072efe58cd51
Author: Markus Raab <un...@ma...>
Date: Tue Jul 28 08:32:29 2009 +0200
activate PlayersScreen also on Timeout
---
game/screen_sing.cc | 66 +++++++++++++++++++++++++++++---------------------
game/screen_sing.hh | 1 +
2 files changed, 39 insertions(+), 28 deletions(-)
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index 96f5093..920ea63 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -59,40 +59,49 @@ void ScreenSing::exit() {
theme.reset();
}
+void ScreenSing::activatePlayerScreen()
+{
+ ScreenManager* sm = ScreenManager::getSingletonPtr();
+
+ // TODO: multiple loading...
+ // TODO: make it possible to switch of highscore through configuration
+ SongHiscore hi(m_song->path, "High.sco");
+ try {
+ hi.load();
+ } catch (HiscoreException const& hi) {
+ std::cerr << "high.sco:" << hi.line() << " " << hi.what() << std::endl;
+ }
+
+ if (m_players.scores.empty() || !hi.reachedNewHiscore(m_players.scores.front()))
+ {
+ // if no highscore reached..
+ sm->activateScreen("Songs");
+ return;
+ }
+
+ // Score window visible -> Enter quits to Players Screen
+ Screen* s = sm->getScreen("Players");
+ ScreenPlayers* ss = dynamic_cast<ScreenPlayers*> (s);
+ assert(ss);
+ ss->setSong(m_song);
+ sm->activateScreen("Players");
+}
+
void ScreenSing::manageEvent(SDL_Event event) {
if (event.type == SDL_KEYDOWN) {
double time = m_audio.getPosition();
Song::Status status = m_song->status(time);
m_quitTimer.setValue(QUIT_TIMEOUT);
bool seekback = false;
- ScreenManager* sm = ScreenManager::getSingletonPtr();
int key = event.key.keysym.sym;
- if (key == SDLK_ESCAPE || key == SDLK_q) sm->activateScreen("Songs");
+ if (key == SDLK_ESCAPE || key == SDLK_q) {
+ ScreenManager* sm = ScreenManager::getSingletonPtr();
+ sm->activateScreen("Songs");
+ }
else if (key == SDLK_RETURN) {
if (m_score_window.get())
{
- // TODO: multiple loading...
- // TODO: make it possible to switch of highscore through configuration
- SongHiscore hi(m_song->path, "High.sco");
- try {
- hi.load();
- } catch (HiscoreException const& hi) {
- std::cerr << "high.sco:" << hi.line() << " " << hi.what() << std::endl;
- }
-
- if (m_players.scores.empty() || !hi.reachedNewHiscore(m_players.scores.front()))
- {
- // if no highscore reached..
- sm->activateScreen("Songs");
- return;
- }
-
- // Score window visible -> Enter quits to Players Screen
- Screen* s = sm->getScreen("Players");
- ScreenPlayers* ss = dynamic_cast<ScreenPlayers*> (s);
- assert(ss);
- ss->setSong(m_song);
- sm->activateScreen("Players");
+ activatePlayerScreen();
return;
}
else if (status == Song::FINISHED) m_score_window.reset(new ScoreWindow(*m_engine, m_players)); // Song finished, but no score window -> show it
@@ -193,13 +202,14 @@ void ScreenSing::draw() {
theme->timer.draw(statustxt);
}
- ScreenManager* sm = ScreenManager::getSingletonPtr();
-
if (config["game/karaoke_mode"].b()) {
- if (!m_audio.isPlaying()) sm->activateScreen("Songs");
+ if (!m_audio.isPlaying()) {
+ ScreenManager* sm = ScreenManager::getSingletonPtr();
+ sm->activateScreen("Songs");
+ }
} else {
if (m_score_window.get()) {
- if (m_quitTimer.get() == 0.0 && !m_audio.isPaused()) { sm->activateScreen("Songs"); return; }
+ if (m_quitTimer.get() == 0.0 && !m_audio.isPaused()) { activatePlayerScreen(); return; }
m_score_window->draw();
}
else if (!m_audio.isPlaying() || (status == Song::FINISHED && m_audio.getLength() - time < 3.0)) {
diff --git a/game/screen_sing.hh b/game/screen_sing.hh
index a096e63..bf8317d 100644
--- a/game/screen_sing.hh
+++ b/game/screen_sing.hh
@@ -54,6 +54,7 @@ class ScreenSing: public Screen {
private:
void drawScores();
+ void activatePlayerScreen();
Audio& m_audio;
Capture& m_capture;
Players& m_players;
|
|
From: Markus R. <god...@us...> - 2009-07-29 15:34:44
|
Module: performous
Branch: hiscore
Commit: 1d9cf906230165eaf353c25aeadcd7ccf5ed6753
Author: Markus Raab <un...@ma...>
Date: Mon Jul 27 15:30:21 2009 +0200
more doc
---
game/highscore.hh | 18 +++++++++++++++++-
game/screen_players.cc | 3 ++-
game/screen_sing.cc | 1 +
3 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/game/highscore.hh b/game/highscore.hh
index 7f186da..6d1c2ad 100644
--- a/game/highscore.hh
+++ b/game/highscore.hh
@@ -32,7 +32,18 @@ struct HighScoreItem {
}
};
-/**HighScore loads and saves a list of HighScoreItems.*/
+/**HighScore loads and saves a list of HighScoreItems.
+
+ Format of highscore is compatible with Ultrastar.
+
+ Name of File: High.sco
+ @code
+#PLAYER0:name
+#SCORE0:1234
+ @endcode
+ Then the same thing for PLAYER/SCORE with other numbers up to 9.
+ Finally, you need to have a line that says only "E".
+ */
class HighScore {
public:
HighScore (std::string const& path_, std::string const& filename_);
@@ -44,6 +55,11 @@ class HighScore {
void getInfo (std::ostream & os);
/**Check if you reached a new highscore.
+
+ You must be in TOP 3 to enter the highscore list.
+ This is because it will take forever to fill all 9.
+ And people refuse to enter their names if they are not close to the top.
+
@param score is a value between 0 and 10000
values below 500 will lead to returning false
@return true if the score make it into the top.
diff --git a/game/screen_players.cc b/game/screen_players.cc
index fb424a9..6281c0c 100644
--- a/game/screen_players.cc
+++ b/game/screen_players.cc
@@ -88,7 +88,8 @@ void ScreenPlayers::manageEvent(SDL_Event event) {
} else {
m_search.text.clear();
m_players.setFilter("");
- // enter the next highscore
+ // add all players which reach highscore because if score is very near or same it might be
+ // frustrating for second one that he cannot enter, so better go for next one...
}
}
// The rest are only available when there are songs available
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index 5614597..765ef96 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -72,6 +72,7 @@ void ScreenSing::manageEvent(SDL_Event event) {
if (m_score_window.get())
{
// TODO: multiple loading...
+ // TODO: make it possible to switch of highscore through configuration
HighScore hi(m_song->path, "High.sco");
try {
hi.load();
|
|
From: Markus R. <god...@us...> - 2009-07-29 15:34:44
|
Module: performous
Branch: hiscore
Commit: e000615e428522783161eb52566b7fbb47505d24
Author: Markus Raab <un...@ma...>
Date: Mon Jul 27 15:49:37 2009 +0200
Restore Selection for Players
---
game/players.cc | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/game/players.cc b/game/players.cc
index 88adacf..572d8f7 100644
--- a/game/players.cc
+++ b/game/players.cc
@@ -62,6 +62,7 @@ void Players::setFilter(std::string const& val) {
void Players::filter_internal() {
m_dirty = false;
+ PlayerItem selection = current();
try {
players_t filtered;
@@ -73,7 +74,15 @@ void Players::filter_internal() {
players_t(m_players.begin(), m_players.end()).swap(m_filtered); // Invalid regex => copy everything
}
math_cover.reset();
- // TODO restore selection
+
+ // Restore old selection
+ int pos = 0;
+ if (selection.name != "") {
+ players_t::iterator it = std::find(m_filtered.begin(), m_filtered.end(), selection);
+ math_cover.setTarget(0, 0);
+ if (it != m_filtered.end()) pos = it - m_filtered.begin();
+ }
+ math_cover.setTarget(pos, size());
}
|
|
From: Markus R. <god...@us...> - 2009-07-29 15:34:42
|
Module: performous
Branch: hiscore
Commit: 4b11fda42f55715aae0624391aa6a41da16e2712
Author: Markus Raab <un...@ma...>
Date: Mon Jul 27 17:21:10 2009 +0200
Segfault when creating player
---
game/players.hh | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/game/players.hh b/game/players.hh
index 5937926..e956828 100644
--- a/game/players.hh
+++ b/game/players.hh
@@ -88,7 +88,10 @@ class Players: boost::noncopyable {
/// sets margins for animation
void setAnimMargins(double left, double right) { math_cover.setMargins(left, right); }
/// @return current PlayerItem (the copy is very cheap at the moment)
- PlayerItem current() const { return m_filtered[math_cover.getTarget()]; }
+ PlayerItem current() const {
+ if (math_cover.getTarget() < m_filtered.size()) return m_filtered[math_cover.getTarget()];
+ else return PlayerItem();
+ }
/// filters playerlist by regular expression
void setFilter(std::string const& regex);
private:
|
|
From: Markus R. <god...@us...> - 2009-07-29 15:34:38
|
Module: performous Branch: hiscore Commit: 98aba3e0c032cc52a56d9affbf736be4a2891df9 Author: Markus Raab <un...@ma...> Date: Mon Jul 27 15:37:50 2009 +0200 Highscore renamed to Hiscore --- game/highscore.cc | 68 +++++++++++++++++++++++----------------------- game/highscore.hh | 26 +++++++++--------- game/main.cc | 2 +- game/screen_highscore.cc | 20 +++++++------- game/screen_highscore.hh | 6 ++-- game/screen_players.cc | 10 +++--- game/screen_players.hh | 2 +- game/screen_sing.cc | 6 ++-- game/screen_songs.cc | 6 ++-- 9 files changed, 73 insertions(+), 73 deletions(-) |
|
From: Markus R. <god...@us...> - 2009-07-29 15:34:36
|
Module: performous Branch: hiscore Commit: 90eb5ea342e01b94904dcf8038590ef2d8ec4132 Author: Markus Raab <un...@ma...> Date: Sat Jul 25 12:37:03 2009 +0200 sort order should be correct now --- game/screen_sing.cc | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/game/screen_sing.cc b/game/screen_sing.cc index 10f6e5e..5614597 100644 --- a/game/screen_sing.cc +++ b/game/screen_sing.cc @@ -252,6 +252,7 @@ ScoreWindow::ScoreWindow(Engine& e, Players & players): ++p; } m_players.scores.sort(); + m_players.scores.reverse(); // top should be first // topScore is also in m_players.scores.front() if (m_players.cur.empty()) m_rank = "No singer!"; |
|
From: Markus R. <god...@us...> - 2009-07-29 15:34:36
|
Module: performous
Branch: hiscore
Commit: 01b0b5df91a4bd4b472b402a618970f12ada515a
Author: Markus Raab <un...@ma...>
Date: Mon Jul 27 09:01:09 2009 +0200
Adding new Player works
resetting Input correctly
---
game/players.cc | 10 ----------
game/screen_players.cc | 36 +++++++++++++++++-------------------
2 files changed, 17 insertions(+), 29 deletions(-)
diff --git a/game/players.cc b/game/players.cc
index ab2360e..88adacf 100644
--- a/game/players.cc
+++ b/game/players.cc
@@ -60,19 +60,9 @@ void Players::setFilter(std::string const& val) {
filter_internal();
}
-#include <iostream> //TODO remove
-
void Players::filter_internal() {
m_dirty = false;
- if (m_filter == "")
- {
- std::cout << "empty filter" << std::endl; //TODO remove
- // without filter get all names
- m_filtered = m_players;
- return;
- }
-
try {
players_t filtered;
for (players_t::const_iterator it = m_players.begin(); it != m_players.end(); ++it) {
diff --git a/game/screen_players.cc b/game/screen_players.cc
index 55d05da..fb424a9 100644
--- a/game/screen_players.cc
+++ b/game/screen_players.cc
@@ -57,32 +57,27 @@ void ScreenPlayers::exit() {
}
void ScreenPlayers::manageEvent(SDL_Event event) {
-ScreenManager* sm = ScreenManager::getSingletonPtr();
-if (event.type != SDL_KEYDOWN) return;
-SDL_keysym keysym = event.key.keysym;
-int key = keysym.sym;
-SDLMod mod = event.key.keysym.mod;
-
-if (key == SDLK_r && mod & KMOD_CTRL) { m_players.reload(); m_players.setFilter(m_search.text); }
-if (m_search.process(keysym)) m_players.setFilter(m_search.text);
-else if (key == SDLK_ESCAPE) {
- if (m_search.text.empty()) sm->activateScreen("Songs");
- else { m_search.text.clear(); m_players.setFilter(m_search.text); }
+ ScreenManager* sm = ScreenManager::getSingletonPtr();
+ if (event.type != SDL_KEYDOWN) return;
+ SDL_keysym keysym = event.key.keysym;
+ int key = keysym.sym;
+ SDLMod mod = event.key.keysym.mod;
+
+ if (key == SDLK_r && mod & KMOD_CTRL) { m_players.reload(); m_players.setFilter(m_search.text); }
+ if (m_search.process(keysym)) m_players.setFilter(m_search.text);
+ else if (key == SDLK_ESCAPE) {
+ if (m_search.text.empty()) sm->activateScreen("Songs");
+ else { m_search.text.clear(); m_players.setFilter(m_search.text); }
}
- // The rest are only available when there are songs available
- else if (m_players.empty()) return;
- else if (key == SDLK_SPACE || (key == SDLK_PAUSE || (key == SDLK_p && mod & KMOD_CTRL))) m_audio.togglePause();
else if (key == SDLK_RETURN)
{
if (m_players.empty())
{
m_players.addPlayer(m_search.text);
m_players.setFilter(m_search.text);
+ m_players.update();
// the current player is the new created one
}
- std::cout << "add new highscore " << m_players.scores.front()
- << " name: " << m_players.current().name
- << std::endl;
m_highscore->addNewHighscore(m_players.current().name, m_players.scores.front());
m_players.scores.pop_front();
@@ -91,11 +86,14 @@ else if (key == SDLK_ESCAPE) {
// no more highscore, we are now finished
sm->activateScreen("Songs");
} else {
- std::cout << "enter the next highscore" << std::endl;
m_search.text.clear();
+ m_players.setFilter("");
// enter the next highscore
}
}
+ // The rest are only available when there are songs available
+ else if (m_players.empty()) return;
+ else if (key == SDLK_SPACE || (key == SDLK_PAUSE || (key == SDLK_p && mod & KMOD_CTRL))) m_audio.togglePause();
else if (key == SDLK_LEFT) m_players.advance(-1);
else if (key == SDLK_RIGHT) m_players.advance(1);
else if (key == SDLK_PAGEUP) m_players.advance(-10);
@@ -147,11 +145,11 @@ void ScreenPlayers::draw() {
} else {
// Format the player information text
oss_song << "You reached " << m_players.scores.front() << " points!\n";
- oss_order << "Name: " << m_players.current().name << '\n'
+ oss_order << "Please enter your Name!\n"
+ << "Name: " << m_players.current().name << '\n'
<< "Search Text: "
<< (m_search.text.empty() ? std::string("please enter") : m_search.text)
<< '\n';
- oss_order << "(" << m_players.currentId() + 1 << "/" << m_players.size() << ")";
double spos = m_players.currentPosition(); // This needs to be polled to run the animation
// Draw the covers
|
|
From: Markus R. <god...@us...> - 2009-07-29 15:34:33
|
Module: performous
Branch: hiscore
Commit: 6b162bf37606b759910a7be814a470c611005e3f
Author: Markus Raab <un...@ma...>
Date: Sat Jul 25 15:53:57 2009 +0200
Try for Party...
END shows highscore...
---
game/highscore.cc | 15 +++++
game/highscore.hh | 4 +
game/main.cc | 2 +
game/screen_highscore.cc | 139 ++++++++++++++++++++++++++++++++++++++++++++++
game/screen_highscore.hh | 49 ++++++++++++++++
game/screen_songs.cc | 10 +++
6 files changed, 219 insertions(+), 0 deletions(-)
diff --git a/game/highscore.cc b/game/highscore.cc
index 17768f0..e799fd7 100644
--- a/game/highscore.cc
+++ b/game/highscore.cc
@@ -113,6 +113,21 @@ void HighScore::save()
out << "E" << std::endl;
}
+void HighScore::getInfo (std::ostream & out)
+{
+ for (size_t i=0; i<m_scores.size();i++)
+ {
+ if (m_scores[i].score <= 0) break; // maybe change to 500?
+
+ try {
+ out << i+1 << ".\t" << m_scores[i].name
+ << "\t" << m_scores[i].score << std::endl;
+ } catch (std::ofstream::failure const&) {
+ throw HighScoreException("Unexpected I/O error", i);
+ }
+ }
+}
+
void HighScore::addNewHighscore(std::string name, int score)
{
// do not allow invalid name
diff --git a/game/highscore.hh b/game/highscore.hh
index bed7ab8..7f186da 100644
--- a/game/highscore.hh
+++ b/game/highscore.hh
@@ -4,6 +4,8 @@
#include <vector>
#include <stdexcept>
+#include <ostream>
+
/**Exception which will be thrown when loading or
saving a HighScore fails.*/
struct HighScoreException: public std::runtime_error {
@@ -39,6 +41,8 @@ class HighScore {
void load();
void save();
+ void getInfo (std::ostream & os);
+
/**Check if you reached a new highscore.
@param score is a value between 0 and 10000
values below 500 will lead to returning false
diff --git a/game/main.cc b/game/main.cc
index dd7f5be..3a04405 100644
--- a/game/main.cc
+++ b/game/main.cc
@@ -7,6 +7,7 @@
#include "screen_practice.hh"
#include "screen_configuration.hh"
#include "screen_players.hh"
+#include "screen_highscore.hh"
#include "video_driver.hh"
#include "xtime.hh"
#include <boost/format.hpp>
@@ -142,6 +143,7 @@ void mainLoop() {
sm.addScreen(new ScreenPractice("Practice", audio, capture));
sm.addScreen(new ScreenConfiguration("Configuration", audio));
sm.addScreen(new ScreenPlayers("Players", audio, players));
+ sm.addScreen(new ScreenHighscore("Highscore", audio, players));
sm.activateScreen("Intro");
// Main loop
boost::xtime time = now();
diff --git a/game/screen_highscore.cc b/game/screen_highscore.cc
new file mode 100644
index 0000000..bc51118
--- /dev/null
+++ b/game/screen_highscore.cc
@@ -0,0 +1,139 @@
+#include "screen_highscore.hh"
+#include "util.hh"
+#include "xtime.hh"
+#include <iostream>
+#include <sstream>
+
+static const double IDLE_TIMEOUT = 45.0; // seconds
+
+ScreenHighscore::ScreenHighscore(std::string const& name, Audio& audio, Players& players):
+ Screen(name), m_audio(audio), m_players(players), m_covers(20)
+{
+ m_players.setAnimMargins(5.0, 5.0);
+ m_playTimer.setTarget(getInf()); // Using this as a simple timer counting seconds
+}
+
+void ScreenHighscore::enter() {
+ m_highscore.reset(new HighScore(m_song->path, "High.sco"));
+ try {
+ m_highscore->load();
+ } catch (HighScoreException const& hi) {
+ std::cerr << "high.sco:" << hi.line() << " " << hi.what() << std::endl;
+ }
+
+ m_score_text[0].reset(new SvgTxtThemeSimple(getThemePath("sing_score_text.svg"), config["graphic/text_lod"].f()));
+ m_score_text[1].reset(new SvgTxtThemeSimple(getThemePath("sing_score_text.svg"), config["graphic/text_lod"].f()));
+ m_score_text[2].reset(new SvgTxtThemeSimple(getThemePath("sing_score_text.svg"), config["graphic/text_lod"].f()));
+ m_score_text[3].reset(new SvgTxtThemeSimple(getThemePath("sing_score_text.svg"), config["graphic/text_lod"].f()));
+ m_player_icon.reset(new Surface(getThemePath("sing_pbox.svg")));
+ theme.reset(new ThemeSongs());
+ m_emptyCover.reset(new Surface(getThemePath("no_cover.svg"))); // TODO use persons head
+ m_search.text.clear();
+ m_players.setFilter(m_search.text);
+ m_audio.fadeout();
+}
+
+void ScreenHighscore::exit() {
+ m_player_icon.reset();
+ m_score_text[0].reset();
+ m_score_text[1].reset();
+ m_score_text[2].reset();
+ m_score_text[3].reset();
+
+ m_covers.clear();
+ m_emptyCover.reset();
+ theme.reset();
+ m_video.reset();
+ m_songbg.reset();
+ m_playing.clear();
+ m_playReq.clear();
+
+ try {
+ m_highscore->save();
+ } catch (HighScoreException const& hi) {
+ std::cerr << "high.sco:" << hi.line() << " " << hi.what() << std::endl;
+ }
+ m_highscore.reset();
+}
+
+void ScreenHighscore::manageEvent(SDL_Event event) {
+ ScreenManager* sm = ScreenManager::getSingletonPtr();
+ if (event.type != SDL_KEYDOWN) return;
+ SDL_keysym keysym = event.key.keysym;
+ int key = keysym.sym;
+ SDLMod mod = event.key.keysym.mod;
+
+ if (key == SDLK_r && mod & KMOD_CTRL) { m_players.reload(); m_players.setFilter(m_search.text); }
+ if (m_search.process(keysym)) m_players.setFilter(m_search.text);
+ else if (key == SDLK_ESCAPE) {
+ if (m_search.text.empty()) sm->activateScreen("Songs");
+ else { m_search.text.clear(); m_players.setFilter(m_search.text); }
+ }
+ // The rest are only available when there are songs available
+ else if (m_players.empty()) return;
+ else if (key == SDLK_SPACE || (key == SDLK_PAUSE || (key == SDLK_p && mod & KMOD_CTRL))) m_audio.togglePause();
+ else if (key == SDLK_RETURN)
+ {
+ sm->activateScreen("Songs");
+ }
+ else if (key == SDLK_LEFT) m_players.advance(-1);
+ else if (key == SDLK_RIGHT) m_players.advance(1);
+ else if (key == SDLK_PAGEUP) m_players.advance(-10);
+ else if (key == SDLK_PAGEDOWN) m_players.advance(10);
+}
+
+/**Draw the scores in the bottom*/
+void ScreenHighscore::drawScores() {
+ // Score display
+ {
+ unsigned int i = 0;
+ for (std::list<Player>::const_iterator p = m_players.cur.begin(); p != m_players.cur.end(); ++p, ++i) {
+ float act = p->activity();
+ if (act == 0.0f) continue;
+ glColor4f(p->m_color.r, p->m_color.g, p->m_color.b,act);
+ m_player_icon->dimensions.left(-0.5 + 0.01 + 0.25 * i).fixedWidth(0.075)
+ .screenBottom(-0.025);
+ m_player_icon->draw();
+ m_score_text[i%4]->render((boost::format("%04d") % p->getScore()).str());
+ m_score_text[i%4]->dimensions().middle(-0.350 + 0.01 + 0.25 * i).fixedHeight(0.075)
+ .screenBottom(-0.025);
+ m_score_text[i%4]->draw();
+ glColor4f(1.0, 1.0, 1.0, 1.0);
+ }
+ }
+}
+
+void ScreenHighscore::draw() {
+ m_players.update(); // Poll for new players
+ double length = m_audio.getLength();
+ double time = clamp(m_audio.getPosition() - config["audio/video_delay"].f(), 0.0, length);
+ if (m_songbg.get()) m_songbg->draw();
+ if (m_video.get()) m_video->render(time);
+ theme->bg.draw();
+ std::string music, songbg, video;
+ double videoGap = 0.0;
+ std::ostringstream oss_song, oss_order;
+
+ // Format the player information text
+ oss_song << "Highscore for " << m_song->title << "!\n";
+
+ m_highscore->getInfo (oss_order);
+
+ // Draw song and order texts
+ theme->song.draw(oss_song.str());
+ theme->order.draw(oss_order.str());
+
+ // Schedule playback change if the chosen song has changed
+ if (music != m_playReq) { m_playReq = music; m_playTimer.setValue(0.0); }
+ // Play/stop preview playback (if it is the time)
+ if (music != m_playing && m_playTimer.get() > 0.4) {
+ m_songbg.reset(); m_video.reset();
+ if (music.empty()) m_audio.fadeout(); else m_audio.playPreview(music, 30.0);
+ if (!songbg.empty()) try { m_songbg.reset(new Surface(songbg)); } catch (std::exception const&) {}
+ if (!video.empty() && config["graphic/video"].b()) m_video.reset(new Video(video, videoGap));
+ m_playing = music;
+ } else if (!m_audio.isPaused() && m_playTimer.get() > IDLE_TIMEOUT) { // Switch if song hasn't changed for IDLE_TIMEOUT seconds
+ if (!m_search.text.empty()) { m_search.text.clear(); m_players.setFilter(m_search.text); }
+ }
+}
+
diff --git a/game/screen_highscore.hh b/game/screen_highscore.hh
new file mode 100644
index 0000000..60f29ca
--- /dev/null
+++ b/game/screen_highscore.hh
@@ -0,0 +1,49 @@
+#pragma once
+
+#include <boost/scoped_ptr.hpp>
+#include "animvalue.hh"
+#include "cachemap.hh"
+#include "opengl_text.hh"
+#include "screen.hh"
+#include "surface.hh"
+#include "textinput.hh"
+#include "theme.hh"
+#include "video.hh"
+#include "players.hh"
+#include "highscore.hh"
+
+class CAudio;
+
+/// song chooser screen
+class ScreenHighscore : public Screen {
+ public:
+ /// constructor
+ ScreenHighscore(std::string const& name, Audio& audio, Players& players);
+ void enter();
+ void exit();
+ void manageEvent(SDL_Event event);
+ void draw();
+ void drawScores();
+
+ void setSong (boost::shared_ptr<Song> song_)
+ {
+ m_song = song_;
+ }
+
+ private:
+ Audio& m_audio;
+ Players& m_players;
+ boost::shared_ptr<Song> m_song; /// Pointer to the current song
+ boost::scoped_ptr<HighScore> m_highscore;
+ boost::scoped_ptr<Surface> m_songbg;
+ boost::scoped_ptr<Video> m_video;
+ boost::scoped_ptr<ThemeSongs> theme;
+ std::string m_playing;
+ std::string m_playReq;
+ AnimValue m_playTimer;
+ TextInput m_search;
+ boost::scoped_ptr<Surface> m_emptyCover;
+ Cachemap<std::string, Surface> m_covers;
+ boost::scoped_ptr<Surface> m_player_icon;
+ boost::scoped_ptr<SvgTxtThemeSimple> m_score_text[4];
+};
diff --git a/game/screen_songs.cc b/game/screen_songs.cc
index 63917bc..c60b357 100644
--- a/game/screen_songs.cc
+++ b/game/screen_songs.cc
@@ -1,5 +1,6 @@
#include "screen_songs.hh"
#include "screen_sing.hh"
+#include "screen_highscore.hh"
#include "configuration.hh"
#include "util.hh"
#include "xtime.hh"
@@ -50,6 +51,15 @@ void ScreenSongs::manageSharedKey(int key, SDLMod mod)
}
else if (key == SDLK_LEFT) m_songs.advance(-1);
else if (key == SDLK_RIGHT) m_songs.advance(1);
+ else if (key == SDLK_END)
+ {
+ ScreenManager* sm = ScreenManager::getSingletonPtr();
+ Screen* s = sm->getScreen("Highscore");
+ ScreenHighscore* ss = dynamic_cast<ScreenHighscore*> (s);
+ assert(ss);
+ ss->setSong(m_songs.currentPtr());
+ sm->activateScreen("Highscore");
+ }
}
void ScreenSongs::manageEvent(SDL_Event event) {
|
|
From: Markus R. <god...@us...> - 2009-07-29 15:34:30
|
Module: performous
Branch: hiscore
Commit: 0f6d7e9750340306eb95de790884a7de1b7b47ad
Author: Markus Raab <un...@ma...>
Date: Sat Jul 25 12:28:50 2009 +0200
draw scores in Players screen
---
game/screen_players.cc | 35 ++++++++++++++++++++++++++++++++++-
game/screen_players.hh | 3 +++
2 files changed, 37 insertions(+), 1 deletions(-)
diff --git a/game/screen_players.cc b/game/screen_players.cc
index 4b8a59e..55d05da 100644
--- a/game/screen_players.cc
+++ b/game/screen_players.cc
@@ -21,6 +21,11 @@ void ScreenPlayers::enter() {
std::cerr << "high.sco:" << hi.line() << " " << hi.what() << std::endl;
}
+ m_score_text[0].reset(new SvgTxtThemeSimple(getThemePath("sing_score_text.svg"), config["graphic/text_lod"].f()));
+ m_score_text[1].reset(new SvgTxtThemeSimple(getThemePath("sing_score_text.svg"), config["graphic/text_lod"].f()));
+ m_score_text[2].reset(new SvgTxtThemeSimple(getThemePath("sing_score_text.svg"), config["graphic/text_lod"].f()));
+ m_score_text[3].reset(new SvgTxtThemeSimple(getThemePath("sing_score_text.svg"), config["graphic/text_lod"].f()));
+ m_player_icon.reset(new Surface(getThemePath("sing_pbox.svg")));
theme.reset(new ThemeSongs());
m_emptyCover.reset(new Surface(getThemePath("no_cover.svg"))); // TODO use persons head
m_search.text.clear();
@@ -29,6 +34,12 @@ void ScreenPlayers::enter() {
}
void ScreenPlayers::exit() {
+ m_player_icon.reset();
+ m_score_text[0].reset();
+ m_score_text[1].reset();
+ m_score_text[2].reset();
+ m_score_text[3].reset();
+
m_covers.clear();
m_emptyCover.reset();
theme.reset();
@@ -91,6 +102,27 @@ else if (key == SDLK_ESCAPE) {
else if (key == SDLK_PAGEDOWN) m_players.advance(10);
}
+/**Draw the scores in the bottom*/
+void ScreenPlayers::drawScores() {
+ // Score display
+ {
+ unsigned int i = 0;
+ for (std::list<Player>::const_iterator p = m_players.cur.begin(); p != m_players.cur.end(); ++p, ++i) {
+ float act = p->activity();
+ if (act == 0.0f) continue;
+ glColor4f(p->m_color.r, p->m_color.g, p->m_color.b,act);
+ m_player_icon->dimensions.left(-0.5 + 0.01 + 0.25 * i).fixedWidth(0.075)
+ .screenBottom(-0.025);
+ m_player_icon->draw();
+ m_score_text[i%4]->render((boost::format("%04d") % p->getScore()).str());
+ m_score_text[i%4]->dimensions().middle(-0.350 + 0.01 + 0.25 * i).fixedHeight(0.075)
+ .screenBottom(-0.025);
+ m_score_text[i%4]->draw();
+ glColor4f(1.0, 1.0, 1.0, 1.0);
+ }
+ }
+}
+
void ScreenPlayers::draw() {
m_players.update(); // Poll for new players
double length = m_audio.getLength();
@@ -117,7 +149,7 @@ void ScreenPlayers::draw() {
oss_song << "You reached " << m_players.scores.front() << " points!\n";
oss_order << "Name: " << m_players.current().name << '\n'
<< "Search Text: "
- << (m_search.text.empty() ? std::string("new player") : m_search.text)
+ << (m_search.text.empty() ? std::string("please enter") : m_search.text)
<< '\n';
oss_order << "(" << m_players.currentId() + 1 << "/" << m_players.size() << ")";
double spos = m_players.currentPosition(); // This needs to be polled to run the animation
@@ -166,5 +198,6 @@ void ScreenPlayers::draw() {
} else if (!m_audio.isPaused() && m_playTimer.get() > IDLE_TIMEOUT) { // Switch if song hasn't changed for IDLE_TIMEOUT seconds
if (!m_search.text.empty()) { m_search.text.clear(); m_players.setFilter(m_search.text); }
}
+ drawScores();
}
diff --git a/game/screen_players.hh b/game/screen_players.hh
index 86e68b5..51ad72d 100644
--- a/game/screen_players.hh
+++ b/game/screen_players.hh
@@ -23,6 +23,7 @@ class ScreenPlayers : public Screen {
void exit();
void manageEvent(SDL_Event event);
void draw();
+ void drawScores();
void setSong (boost::shared_ptr<Song> song_)
{
@@ -43,4 +44,6 @@ class ScreenPlayers : public Screen {
TextInput m_search;
boost::scoped_ptr<Surface> m_emptyCover;
Cachemap<std::string, Surface> m_covers;
+ boost::scoped_ptr<Surface> m_player_icon;
+ boost::scoped_ptr<SvgTxtThemeSimple> m_score_text[4];
};
|
|
From: Markus R. <god...@us...> - 2009-07-29 15:34:29
|
Module: performous
Branch: hiscore
Commit: 47b8558e3ab57ae277564e032695feea26aa69e7
Author: Markus Raab <un...@ma...>
Date: Sat Jul 25 12:09:57 2009 +0200
only show highscore when reached
better output
+ more debug
---
game/engine.hh | 4 ++++
game/screen_players.cc | 11 ++++-------
game/screen_sing.cc | 17 +++++++++++++++++
3 files changed, 25 insertions(+), 7 deletions(-)
diff --git a/game/engine.hh b/game/engine.hh
index 83b247f..19c91ef 100644
--- a/game/engine.hh
+++ b/game/engine.hh
@@ -46,6 +46,10 @@ class Engine {
template <typename FwdIt> Engine(Audio& audio, Song& song, FwdIt anBegin, FwdIt anEnd, Players &players):
m_audio(audio), m_song(song), m_time(), m_quit(), m_players(players)
{
+ // clear old player information
+ m_players.cur.clear();
+ m_players.scores.clear();
+
size_t frames = m_audio.getLength() / Engine::TIMESTEP;
while (anBegin != anEnd) m_players.cur.push_back(Player(song, *anBegin++, frames));
size_t player = 0;
diff --git a/game/screen_players.cc b/game/screen_players.cc
index 8623b81..4b8a59e 100644
--- a/game/screen_players.cc
+++ b/game/screen_players.cc
@@ -78,9 +78,6 @@ else if (key == SDLK_ESCAPE) {
if (m_players.scores.empty() || !m_highscore->reachedNewHighscore(m_players.scores.front()))
{
// no more highscore, we are now finished
- // clear the old players lists
- m_players.scores.clear();
- m_players.cur.clear();
sm->activateScreen("Songs");
} else {
std::cout << "enter the next highscore" << std::endl;
@@ -112,14 +109,14 @@ void ScreenPlayers::draw() {
oss_order << "Check players.txt in current\n";
oss_order << "directory for players";
} else {
- oss_song << "press enter to create player";
+ oss_song << "Press enter to create player!";
oss_order << m_search.text << '\n';
}
} else {
// Format the player information text
- oss_song << "You reached " << m_players.scores.front() << " points\n";
- oss_order << "Name: " << m_players.current().name
- << " Search Text: "
+ oss_song << "You reached " << m_players.scores.front() << " points!\n";
+ oss_order << "Name: " << m_players.current().name << '\n'
+ << "Search Text: "
<< (m_search.text.empty() ? std::string("new player") : m_search.text)
<< '\n';
oss_order << "(" << m_players.currentId() + 1 << "/" << m_players.size() << ")";
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index 795b5b6..10f6e5e 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -8,6 +8,7 @@
#include "songs.hh"
#include <iostream>
#include <iomanip>
+#include "highscore.hh" // to check if Players have to be shown
namespace {
static const double QUIT_TIMEOUT = 20.0; // Return to songs screen after 20 seconds in score screen
@@ -70,12 +71,28 @@ void ScreenSing::manageEvent(SDL_Event event) {
else if (key == SDLK_RETURN) {
if (m_score_window.get())
{
+ // TODO: multiple loading...
+ HighScore hi(m_song->path, "High.sco");
+ try {
+ hi.load();
+ } catch (HighScoreException const& hi) {
+ std::cerr << "high.sco:" << hi.line() << " " << hi.what() << std::endl;
+ }
+
+ if (m_players.scores.empty() || !hi.reachedNewHighscore(m_players.scores.front()))
+ {
+ // if no highscore reached..
+ sm->activateScreen("Songs");
+ return;
+ }
+
// Score window visible -> Enter quits to Players Screen
Screen* s = sm->getScreen("Players");
ScreenPlayers* ss = dynamic_cast<ScreenPlayers*> (s);
assert(ss);
ss->setSong(m_song);
sm->activateScreen("Players");
+ return;
}
else if (status == Song::FINISHED) m_score_window.reset(new ScoreWindow(*m_engine, m_players)); // Song finished, but no score window -> show it
}
|
|
From: Markus R. <god...@us...> - 2009-07-29 15:34:27
|
Module: performous
Branch: hiscore
Commit: ce821cfd8c2977fa3dd569094fdc2627eb2bc628
Author: Markus Raab <un...@ma...>
Date: Sat Jul 25 11:41:13 2009 +0200
entry in highscore works
verbose output for debugging
---
game/players.hh | 2 +
game/screen_players.cc | 65 ++++++++++++++++++++++++++++++++++++------------
game/screen_players.hh | 10 ++++++-
game/screen_sing.cc | 36 ++++++++++----------------
game/screen_sing.hh | 3 +-
5 files changed, 75 insertions(+), 41 deletions(-)
diff --git a/game/players.hh b/game/players.hh
index 10f24f9..5937926 100644
--- a/game/players.hh
+++ b/game/players.hh
@@ -35,6 +35,7 @@ class Players: boost::noncopyable {
private:
typedef std::vector<PlayerItem> players_t;
typedef std::list<Player> cur_players_t;
+ typedef std::list<int> cur_scores_t;
private:
players_t m_players;
@@ -48,6 +49,7 @@ class Players: boost::noncopyable {
public:
cur_players_t cur;
+ cur_scores_t scores;
public:
Players(std::string filename);
diff --git a/game/screen_players.cc b/game/screen_players.cc
index ceaa6ae..8623b81 100644
--- a/game/screen_players.cc
+++ b/game/screen_players.cc
@@ -14,6 +14,13 @@ ScreenPlayers::ScreenPlayers(std::string const& name, Audio& audio, Players& pla
}
void ScreenPlayers::enter() {
+ m_highscore.reset(new HighScore(m_song->path, "High.sco"));
+ try {
+ m_highscore->load();
+ } catch (HighScoreException const& hi) {
+ std::cerr << "high.sco:" << hi.line() << " " << hi.what() << std::endl;
+ }
+
theme.reset(new ThemeSongs());
m_emptyCover.reset(new Surface(getThemePath("no_cover.svg"))); // TODO use persons head
m_search.text.clear();
@@ -29,20 +36,27 @@ void ScreenPlayers::exit() {
m_songbg.reset();
m_playing.clear();
m_playReq.clear();
+
+ try {
+ m_highscore->save();
+ } catch (HighScoreException const& hi) {
+ std::cerr << "high.sco:" << hi.line() << " " << hi.what() << std::endl;
+ }
+ m_highscore.reset();
}
void ScreenPlayers::manageEvent(SDL_Event event) {
- ScreenManager* sm = ScreenManager::getSingletonPtr();
- if (event.type != SDL_KEYDOWN) return;
- SDL_keysym keysym = event.key.keysym;
- int key = keysym.sym;
- SDLMod mod = event.key.keysym.mod;
+ScreenManager* sm = ScreenManager::getSingletonPtr();
+if (event.type != SDL_KEYDOWN) return;
+SDL_keysym keysym = event.key.keysym;
+int key = keysym.sym;
+SDLMod mod = event.key.keysym.mod;
- if (key == SDLK_r && mod & KMOD_CTRL) { m_players.reload(); m_players.setFilter(m_search.text); }
- if (m_search.process(keysym)) m_players.setFilter(m_search.text);
- else if (key == SDLK_ESCAPE) {
- if (m_search.text.empty()) sm->activateScreen("Songs");
- else { m_search.text.clear(); m_players.setFilter(m_search.text); }
+if (key == SDLK_r && mod & KMOD_CTRL) { m_players.reload(); m_players.setFilter(m_search.text); }
+if (m_search.process(keysym)) m_players.setFilter(m_search.text);
+else if (key == SDLK_ESCAPE) {
+ if (m_search.text.empty()) sm->activateScreen("Songs");
+ else { m_search.text.clear(); m_players.setFilter(m_search.text); }
}
// The rest are only available when there are songs available
else if (m_players.empty()) return;
@@ -52,10 +66,27 @@ void ScreenPlayers::manageEvent(SDL_Event event) {
if (m_players.empty())
{
m_players.addPlayer(m_search.text);
- m_players.setFilter(m_search.text); // set new Player as current
+ m_players.setFilter(m_search.text);
+ // the current player is the new created one
+ }
+ std::cout << "add new highscore " << m_players.scores.front()
+ << " name: " << m_players.current().name
+ << std::endl;
+ m_highscore->addNewHighscore(m_players.current().name, m_players.scores.front());
+ m_players.scores.pop_front();
+
+ if (m_players.scores.empty() || !m_highscore->reachedNewHighscore(m_players.scores.front()))
+ {
+ // no more highscore, we are now finished
+ // clear the old players lists
+ m_players.scores.clear();
+ m_players.cur.clear();
+ sm->activateScreen("Songs");
+ } else {
+ std::cout << "enter the next highscore" << std::endl;
+ m_search.text.clear();
+ // enter the next highscore
}
- // we are now finished
- sm->activateScreen("Songs");
}
else if (key == SDLK_LEFT) m_players.advance(-1);
else if (key == SDLK_RIGHT) m_players.advance(1);
@@ -85,10 +116,12 @@ void ScreenPlayers::draw() {
oss_order << m_search.text << '\n';
}
} else {
- PlayerItem player = m_players.current();
// Format the player information text
- oss_song << player.name << '\n';
- oss_order << (m_search.text.empty() ? std::string("new player") : m_search.text) << '\n';
+ oss_song << "You reached " << m_players.scores.front() << " points\n";
+ oss_order << "Name: " << m_players.current().name
+ << " Search Text: "
+ << (m_search.text.empty() ? std::string("new player") : m_search.text)
+ << '\n';
oss_order << "(" << m_players.currentId() + 1 << "/" << m_players.size() << ")";
double spos = m_players.currentPosition(); // This needs to be polled to run the animation
diff --git a/game/screen_players.hh b/game/screen_players.hh
index c8294d9..86e68b5 100644
--- a/game/screen_players.hh
+++ b/game/screen_players.hh
@@ -6,10 +6,11 @@
#include "opengl_text.hh"
#include "screen.hh"
#include "surface.hh"
-#include "players.hh"
#include "textinput.hh"
#include "theme.hh"
#include "video.hh"
+#include "players.hh"
+#include "highscore.hh"
class CAudio;
@@ -23,9 +24,16 @@ class ScreenPlayers : public Screen {
void manageEvent(SDL_Event event);
void draw();
+ void setSong (boost::shared_ptr<Song> song_)
+ {
+ m_song = song_;
+ }
+
private:
Audio& m_audio;
Players& m_players;
+ boost::shared_ptr<Song> m_song; /// Pointer to the current song
+ boost::scoped_ptr<HighScore> m_highscore;
boost::scoped_ptr<Surface> m_songbg;
boost::scoped_ptr<Video> m_video;
boost::scoped_ptr<ThemeSongs> theme;
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index 71eac09..795b5b6 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -3,7 +3,6 @@
#include "util.hh"
#include "configuration.hh"
#include "xtime.hh"
-#include "highscore.hh"
#include <boost/format.hpp>
#include <boost/lexical_cast.hpp>
#include "songs.hh"
@@ -71,11 +70,14 @@ void ScreenSing::manageEvent(SDL_Event event) {
else if (key == SDLK_RETURN) {
if (m_score_window.get())
{
- // Score window visible -> Enter quits to Songs or Players Screen
- // TODO if (m_players.hasNewHighscore()) sm->activateScreen("Players");
- sm->activateScreen("Songs");
+ // Score window visible -> Enter quits to Players Screen
+ Screen* s = sm->getScreen("Players");
+ ScreenPlayers* ss = dynamic_cast<ScreenPlayers*> (s);
+ assert(ss);
+ ss->setSong(m_song);
+ sm->activateScreen("Players");
}
- else if (status == Song::FINISHED) m_score_window.reset(new ScoreWindow(*m_engine, *m_song, m_players)); // Song finished, but no score window -> show it
+ else if (status == Song::FINISHED) m_score_window.reset(new ScoreWindow(*m_engine, m_players)); // Song finished, but no score window -> show it
}
else if (key == SDLK_SPACE || key == SDLK_PAUSE) m_audio.togglePause();
if (m_score_window.get()) return;
@@ -184,7 +186,7 @@ void ScreenSing::draw() {
}
else if (!m_audio.isPlaying() || (status == Song::FINISHED && m_audio.getLength() - time < 3.0)) {
m_quitTimer.setValue(QUIT_TIMEOUT);
- m_score_window.reset(new ScoreWindow(*m_engine, *m_song, m_players));
+ m_score_window.reset(new ScoreWindow(*m_engine, m_players));
}
}
@@ -212,8 +214,7 @@ void ScreenSing::drawScores() {
}
}
-ScoreWindow::ScoreWindow(Engine& e, Song const& song, Players & players):
- m_song(song),
+ScoreWindow::ScoreWindow(Engine& e, Players & players):
m_players(players),
m_pos(0.8, 2.0),
m_bg(getThemePath("score_window.svg")),
@@ -224,27 +225,18 @@ ScoreWindow::ScoreWindow(Engine& e, Song const& song, Players & players):
m_pos.setTarget(0.0);
e.kill(); // kill the engine thread (to avoid consuming memory)
-
- HighScore hi (m_song.path, "High.sco");
- // TODO fallback path if not writeable?
-
- try {
- hi.load();
- } catch (HighScoreException const& hi) {
- std::cerr << "high.sco:" << hi.line() << " " << hi.what() << std::endl;
- }
+ m_players.scores.clear();
unsigned int topScore = 0;
for (std::list<Player>::iterator p = m_players.cur.begin(); p != m_players.cur.end();) {
unsigned int score = p->getScore();
if (score < 500) { p = m_players.cur.erase(p); continue; }
+ m_players.scores.push_back(score);
if (score > topScore) topScore = score;
++p;
}
- try {
- hi.save();
- } catch (HighScoreException const& hi) {
- std::cerr << "high.sco:" << hi.line() << " " << hi.what() << std::endl;
- }
+ m_players.scores.sort();
+ // topScore is also in m_players.scores.front()
+
if (m_players.cur.empty()) m_rank = "No singer!";
else if (topScore > 8000) m_rank = "Hit singer";
else if (topScore > 6000) m_rank = "Lead singer";
diff --git a/game/screen_sing.hh b/game/screen_sing.hh
index c89ba9d..a096e63 100644
--- a/game/screen_sing.hh
+++ b/game/screen_sing.hh
@@ -21,12 +21,11 @@
class ScoreWindow {
public:
/// constructor
- ScoreWindow(Engine & e, Song const& song, Players & players);
+ ScoreWindow(Engine & e, Players & players);
/// draws ScoreWindow
void draw();
private:
- Song const& m_song;
Players & m_players;
AnimValue m_pos;
Surface m_bg;
|
|
From: Markus R. <god...@us...> - 2009-07-29 15:34:25
|
Module: performous Branch: hiscore Commit: 742d2c952e84ecb69fabad4804351a32ce2bd3f5 Author: Markus Raab <un...@ma...> Date: Fri Jul 24 23:37:06 2009 +0200 Pass Players everywhere also current players are now handeled in the Players class Engine has reference to it Engine does not return it anymore (other classes get reference too) --- game/engine.hh | 21 ++++++++------------- game/layout_singer.cc | 8 +++++--- game/layout_singer.hh | 3 ++- game/notegraph.cc | 6 +++--- game/notegraph.hh | 4 ++-- game/players.cc | 3 ++- game/players.hh | 9 ++++++++- game/screen_players.cc | 5 +++-- game/screen_sing.cc | 46 +++++++++++++++++++++------------------------- game/screen_sing.hh | 9 ++++----- 10 files changed, 58 insertions(+), 56 deletions(-) |
|
From: Markus R. <god...@us...> - 2009-07-29 15:34:23
|
Module: performous
Branch: hiscore
Commit: 2c28ed836d40f48266c611aa669a3ebefc1fdd0b
Author: Markus Raab <un...@ma...>
Date: Fri Jul 24 22:17:11 2009 +0200
sorting by score
---
game/player.hh | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/game/player.hh b/game/player.hh
index 8c49384..6335ec9 100644
--- a/game/player.hh
+++ b/game/player.hh
@@ -40,4 +40,9 @@ struct Player {
int getScore() const {
return 10000.0 * m_score;
}
+ /**Operator for sorting by score.*/
+ bool operator < (Player const& other) const
+ {
+ return other.m_score < m_score;
+ }
};
|
|
From: Markus R. <god...@us...> - 2009-07-29 15:34:22
|
Module: performous
Branch: hiscore
Commit: 43dbba757fffda37d8629e84b70b48f517b7f0e4
Author: Markus Raab <un...@ma...>
Date: Fri Jul 24 19:15:02 2009 +0200
Now name from Players is taken
BUG: always the first name
independend from selection
---
game/highscore.cc | 3 +++
game/highscore.hh | 4 +++-
game/main.cc | 2 +-
game/screen_sing.cc | 9 +++++----
game/screen_sing.hh | 10 ++++++----
5 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/game/highscore.cc b/game/highscore.cc
index 559aab2..17768f0 100644
--- a/game/highscore.cc
+++ b/game/highscore.cc
@@ -115,6 +115,9 @@ void HighScore::save()
void HighScore::addNewHighscore(std::string name, int score)
{
+ // do not allow invalid name
+ if (name == "") return;
+
HighScoreItem hsi;
hsi.name = name;
hsi.score = score;
diff --git a/game/highscore.hh b/game/highscore.hh
index 032eb14..bed7ab8 100644
--- a/game/highscore.hh
+++ b/game/highscore.hh
@@ -50,7 +50,9 @@ class HighScore {
if (score < 500) return false;
return score > m_scores[2].score;
}
- /**Add a new entry to the highscore.*/
+ /**Add a new entry to the highscore.
+ It will do nothing on empty name.
+ */
void addNewHighscore(std::string name, int score);
private:
static const int m_maxEntries = 10;
diff --git a/game/main.cc b/game/main.cc
index 53744a6..dd7f5be 100644
--- a/game/main.cc
+++ b/game/main.cc
@@ -138,7 +138,7 @@ void mainLoop() {
Window window(config["graphic/window_width"].i(), config["graphic/window_height"].i(), config["graphic/fullscreen"].b(), config["graphic/fs_width"].i(), config["graphic/fs_height"].i());
sm.addScreen(new ScreenIntro("Intro", audio, capture));
sm.addScreen(new ScreenSongs("Songs", audio, songs));
- sm.addScreen(new ScreenSing("Sing", audio, capture));
+ sm.addScreen(new ScreenSing("Sing", audio, capture, players));
sm.addScreen(new ScreenPractice("Practice", audio, capture));
sm.addScreen(new ScreenConfiguration("Configuration", audio));
sm.addScreen(new ScreenPlayers("Players", audio, players));
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index bc49fd7..8460735 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -70,7 +70,7 @@ void ScreenSing::manageEvent(SDL_Event event) {
if (key == SDLK_ESCAPE || key == SDLK_q) sm->activateScreen("Songs");
else if (key == SDLK_RETURN) {
if (m_score_window.get()) sm->activateScreen("Songs"); // Score window visible -> Enter quits
- else if (status == Song::FINISHED) m_score_window.reset(new ScoreWindow(*m_engine, *m_song)); // Song finished, but no score window -> show it
+ else if (status == Song::FINISHED) m_score_window.reset(new ScoreWindow(*m_engine, *m_song, m_allplayers)); // Song finished, but no score window -> show it
}
else if (key == SDLK_SPACE || key == SDLK_PAUSE) m_audio.togglePause();
if (m_score_window.get()) return;
@@ -179,7 +179,7 @@ void ScreenSing::draw() {
}
else if (!m_audio.isPlaying() || (status == Song::FINISHED && m_audio.getLength() - time < 3.0)) {
m_quitTimer.setValue(QUIT_TIMEOUT);
- m_score_window.reset(new ScoreWindow(*m_engine, *m_song));
+ m_score_window.reset(new ScoreWindow(*m_engine, *m_song, m_allplayers));
}
}
@@ -208,8 +208,9 @@ void ScreenSing::drawScores() {
}
}
-ScoreWindow::ScoreWindow(Engine& e, Song const& song):
+ScoreWindow::ScoreWindow(Engine& e, Song const& song, Players & allplayers):
m_song(song),
+ m_allplayers(allplayers),
m_pos(0.8, 2.0),
m_bg(getThemePath("score_window.svg")),
m_scoreBar(getThemePath("score_bar_bg.svg"), getThemePath("score_bar_fg.svg"), ProgressBar::VERTICAL, 0.0, 0.0, false),
@@ -240,7 +241,7 @@ ScoreWindow::ScoreWindow(Engine& e, Song const& song):
ScreenManager* sm = ScreenManager::getSingletonPtr();
// show the players screen
sm->activateScreen("Players");
- hi.addNewHighscore(getenv ("USER"), score);
+ hi.addNewHighscore(m_allplayers.current().name, score);
}
}
try {
diff --git a/game/screen_sing.hh b/game/screen_sing.hh
index 0e55ce7..e5bdda5 100644
--- a/game/screen_sing.hh
+++ b/game/screen_sing.hh
@@ -21,12 +21,13 @@
class ScoreWindow {
public:
/// constructor
- ScoreWindow(Engine & e, Song const& song);
+ ScoreWindow(Engine & e, Song const& song, Players & players);
/// draws ScoreWindow
void draw();
private:
Song const& m_song;
+ Players & m_allplayers;
AnimValue m_pos;
Surface m_bg;
ProgressBar m_scoreBar;
@@ -40,8 +41,8 @@ class ScoreWindow {
class ScreenSing: public Screen {
public:
/// constructor
- ScreenSing(std::string const& name, Audio& audio, Capture& capture):
- Screen(name), m_audio(audio), m_capture(capture), m_latencyAV()
+ ScreenSing(std::string const& name, Audio& audio, Capture& capture, Players & allplayers):
+ Screen(name), m_audio(audio), m_capture(capture), m_allplayers(allplayers), m_latencyAV()
{}
void enter();
void exit();
@@ -56,9 +57,10 @@ class ScreenSing: public Screen {
private:
void drawScores();
Audio& m_audio;
+ Capture& m_capture;
+ Players& m_allplayers;
boost::shared_ptr<Song> m_song; /// Pointer to the current song
boost::scoped_ptr<ScoreWindow> m_score_window;
- Capture& m_capture;
boost::scoped_ptr<ProgressBar> m_progress;
boost::scoped_ptr<Surface> m_background;
boost::scoped_ptr<Video> m_video;
|
|
From: Markus R. <god...@us...> - 2009-07-29 15:34:20
|
Module: performous
Branch: hiscore
Commit: b2bad5d7d2794d071d001952445f42191eb8e3f9
Author: Markus Raab <un...@ma...>
Date: Fri Jul 24 18:58:40 2009 +0200
lots of fixes
dirty implementation
now selection works
you can press enter to quit
(but there song is replayed?,
but score is shown)
---
game/players.cc | 27 ++++++++++++++++++---------
game/players.hh | 37 ++++++++++++++++++++-----------------
game/screen_players.cc | 32 ++++++++++++++++----------------
3 files changed, 54 insertions(+), 42 deletions(-)
diff --git a/game/players.cc b/game/players.cc
index c9830d3..ec2c129 100644
--- a/game/players.cc
+++ b/game/players.cc
@@ -8,19 +8,18 @@ Players::Players(std::string filename):
m_filtered(),
m_filename(filename),
m_filter(),
- math_cover()
+ math_cover(),
+ m_dirty(false)
{
load();
m_filtered = m_players;
}
-Players::~Players()
-{
+Players::~Players() {
save();
}
-void Players::load()
-{
+void Players::load() {
std::ifstream in (m_filename.c_str());
std::string str;
@@ -30,8 +29,7 @@ void Players::load()
}
}
-void Players::save()
-{
+void Players::save() {
std::ofstream out (m_filename.c_str());
for (players_t::const_iterator it = m_players.begin(); it!=m_players.end(); ++it)
@@ -40,14 +38,18 @@ void Players::save()
}
}
-void Players::addPlayer (std::string const& name)
-{
+void Players::update() {
+ if (m_dirty) filter_internal();
+}
+
+void Players::addPlayer (std::string const& name) {
PlayerItem pi;
pi.name = name;
players_t::const_iterator it = std::find(m_players.begin(), m_players.end(), pi);
if (it != m_players.end()) return; // dont do anything, player exists
+ m_dirty = true;
m_players.push_back(pi);
}
@@ -57,9 +59,14 @@ void Players::setFilter(std::string const& val) {
filter_internal();
}
+#include <iostream> //TODO remove
+
void Players::filter_internal() {
+ m_dirty = false;
+
if (m_filter == "")
{
+ std::cout << "empty filter" << std::endl; //TODO remove
// without filter get all names
m_filtered = m_players;
return;
@@ -75,8 +82,10 @@ void Players::filter_internal() {
players_t(m_players.begin(), m_players.end()).swap(m_filtered); // Invalid regex => copy everything
}
math_cover.reset();
+ // TODO restore selection
}
+
/*
#include <iostream>
diff --git a/game/players.hh b/game/players.hh
index e45ea59..ca4bf43 100644
--- a/game/players.hh
+++ b/game/players.hh
@@ -1,6 +1,7 @@
#pragma once
#include <vector>
#include <string>
+#include <boost/utility.hpp>
#include "animvalue.hh"
@@ -10,8 +11,7 @@
Used for Players Management.
*/
-struct PlayerItem
-{
+struct PlayerItem {
std::string name; /// unique name, link to highscore
/* Future ideas
std::string displayedName; /// artist name, short name, nick (can be changed)
@@ -29,8 +29,7 @@ struct PlayerItem
The current players plugged in a song can
be retrieved with Engine::getPlayers().*/
-class Players
-{
+class Players: boost::noncopyable {
public:
typedef std::vector<PlayerItem> players_t;
private:
@@ -41,6 +40,8 @@ class Players
std::string m_filter;
AnimAcceleration math_cover;
+ bool m_dirty;
+
public:
Players(std::string filename);
~Players();
@@ -52,8 +53,15 @@ class Players
load();
}
void save();
+ void update();
void addPlayer (std::string const& name);
+ /// const array access
+ PlayerItem operator[](std::size_t pos) const { return m_filtered[pos]; }
+ /// number of songs
+ size_t size() const { return m_filtered.size(); };
+ /// true if empty
+ int empty() const { return m_filtered.empty(); };
/// advances to next player
void advance(int diff) {
int size = m_filtered.size();
@@ -62,23 +70,18 @@ class Players
if (_current < 0) _current += m_filtered.size();
math_cover.setTarget(_current,this->size());
}
- /// array access
- PlayerItem operator[](std::size_t pos) { return m_filtered[pos]; }
- PlayerItem operator[](std::size_t pos) const { return m_filtered[pos]; }
- /// number of players
- std::size_t size() const { return m_filtered.size(); };
- /// true if empty
- int empty() const { return m_filtered.empty(); };
- /// filters playerlist by regular expression
- void setFilter(std::string const& regex);
- /// sets margins for animation
- void setAnimMargins(double left, double right) { math_cover.setMargins(left, right); }
- /// @return current PlayerItem (the copy is very cheap at the moment)
- PlayerItem current() const { return m_filtered[math_cover.getTarget()]; }
/// get current id
int currentId() const { return math_cover.getTarget(); }
/// gets current position
double currentPosition() { return math_cover.getValue(); }
+ /// gets current velocity
+ double currentVelocity() const { return math_cover.getVelocity(); }
+ /// sets margins for animation
+ void setAnimMargins(double left, double right) { math_cover.setMargins(left, right); }
+ /// @return current PlayerItem (the copy is very cheap at the moment)
+ PlayerItem current() const { return m_filtered[math_cover.getTarget()]; }
+ /// filters playerlist by regular expression
+ void setFilter(std::string const& regex);
private:
void filter_internal();
};
diff --git a/game/screen_players.cc b/game/screen_players.cc
index 27166d0..5253a17 100644
--- a/game/screen_players.cc
+++ b/game/screen_players.cc
@@ -11,18 +11,9 @@ ScreenPlayers::ScreenPlayers(std::string const& name, Audio& audio, Players& pla
{
m_players.setAnimMargins(5.0, 5.0);
m_playTimer.setTarget(getInf()); // Using this as a simple timer counting seconds
-
- // print all names
- std::cout << "Constructor of ScreenPlayers" << std::endl;
- for (size_t i=0; i<m_players.size(); i++)
- {
- std::cout << "Name " << i << ": " << m_players[i].name << std::endl;
- }
}
void ScreenPlayers::enter() {
- std::cout << "Entered ScreenPlayers" << std::endl;
-
theme.reset(new ThemeSongs());
m_emptyCover.reset(new Surface(getThemePath("no_cover.svg"))); // TODO use persons head
m_search.text.clear();
@@ -41,7 +32,7 @@ void ScreenPlayers::exit() {
}
void ScreenPlayers::manageEvent(SDL_Event event) {
- // ScreenManager* sm = ScreenManager::getSingletonPtr();
+ ScreenManager* sm = ScreenManager::getSingletonPtr();
if (event.type != SDL_KEYDOWN) return;
SDL_keysym keysym = event.key.keysym;
int key = keysym.sym;
@@ -50,25 +41,34 @@ void ScreenPlayers::manageEvent(SDL_Event event) {
if (key == SDLK_r && mod & KMOD_CTRL) { m_players.reload(); m_players.setFilter(m_search.text); }
if (m_search.process(keysym)) m_players.setFilter(m_search.text);
else if (key == SDLK_ESCAPE) {
- if (m_search.text.empty())/*TODO*/; // sm->activateScreen("Intro");
+ if (m_search.text.empty()) sm->activateScreen("Sing");
else { m_search.text.clear(); m_players.setFilter(m_search.text); }
}
// The rest are only available when there are songs available
else if (m_players.empty()) return;
else if (key == SDLK_SPACE || (key == SDLK_PAUSE || (key == SDLK_p && mod & KMOD_CTRL))) m_audio.togglePause();
- else if (key == SDLK_RETURN)/*TODO*/; // sm->activateScreen("Score");
+ else if (key == SDLK_RETURN)
+ {
+ if (m_players.empty())
+ {
+ m_players.addPlayer(m_search.text);
+ m_players.setFilter(m_search.text); // set new Player as current
+ }
+ sm->activateScreen("Sing");
+ }
else if (key == SDLK_LEFT) m_players.advance(-1);
else if (key == SDLK_RIGHT) m_players.advance(1);
else if (key == SDLK_PAGEUP) m_players.advance(-10);
else if (key == SDLK_PAGEDOWN) m_players.advance(10);
- // else if (key == SDLK_TAB && !(mod & KMOD_ALT)) m_players.randomize();
}
void ScreenPlayers::draw() {
+ m_players.update(); // Poll for new players
double length = m_audio.getLength();
double time = clamp(m_audio.getPosition() - config["audio/video_delay"].f(), 0.0, length);
if (m_songbg.get()) m_songbg->draw();
if (m_video.get()) m_video->render(time);
+ theme->bg.draw();
std::string music, songbg, video;
double videoGap = 0.0;
std::ostringstream oss_song, oss_order;
@@ -77,10 +77,10 @@ void ScreenPlayers::draw() {
// Format the song information text
if (m_search.text.empty()) {
oss_song << "No players found!";
- oss_order << "Visit performous.org\n";
+ oss_order << "Check players.txt in current\n";
+ oss_order << "directory for players";
} else {
- // TODO: create new player
- oss_song << "no players match search";
+ oss_song << "press enter to create player";
oss_order << m_search.text << '\n';
}
} else {
|
|
From: Markus R. <god...@us...> - 2009-07-29 15:34:19
|
Module: performous
Branch: hiscore
Commit: 15244b3ab9ad86db747e6ad47dc6154ba368ebbf
Author: Markus Raab <un...@ma...>
Date: Fri Jul 24 17:00:10 2009 +0200
people are displayed!
very relaxed filtering system
---
game/players.cc | 35 ++++++++++++++++++++++++++---------
game/players.hh | 9 +++++++--
game/screen_players.cc | 11 ++++++++++-
3 files changed, 43 insertions(+), 12 deletions(-)
diff --git a/game/players.cc b/game/players.cc
index 3b70fe1..c9830d3 100644
--- a/game/players.cc
+++ b/game/players.cc
@@ -4,11 +4,20 @@
#include <boost/regex.hpp>
Players::Players(std::string filename):
- m_filename(filename)
-{}
+ m_players(),
+ m_filtered(),
+ m_filename(filename),
+ m_filter(),
+ math_cover()
+{
+ load();
+ m_filtered = m_players;
+}
Players::~Players()
-{}
+{
+ save();
+}
void Players::load()
{
@@ -31,10 +40,14 @@ void Players::save()
}
}
-void Players::addPlayer (std::string name)
+void Players::addPlayer (std::string const& name)
{
PlayerItem pi;
pi.name = name;
+
+ players_t::const_iterator it = std::find(m_players.begin(), m_players.end(), pi);
+ if (it != m_players.end()) return; // dont do anything, player exists
+
m_players.push_back(pi);
}
@@ -45,6 +58,13 @@ void Players::setFilter(std::string const& val) {
}
void Players::filter_internal() {
+ if (m_filter == "")
+ {
+ // without filter get all names
+ m_filtered = m_players;
+ return;
+ }
+
try {
players_t filtered;
for (players_t::const_iterator it = m_players.begin(); it != m_players.end(); ++it) {
@@ -54,7 +74,7 @@ void Players::filter_internal() {
} catch (...) {
players_t(m_players.begin(), m_players.end()).swap(m_filtered); // Invalid regex => copy everything
}
- // TODO: reset images
+ math_cover.reset();
}
/*
@@ -66,15 +86,12 @@ int main(int argc, char** argv)
std::string filter = argv[1];
Players p("players.txt");
- p.load();
- // p.addPlayer(name);
+ p.addPlayer("hubert");
p.setFilter(filter);
for (size_t i=0; i<p.size(); i++)
{
std::cout << p[i].name << std::endl;
}
-
- p.save();
}
*/
diff --git a/game/players.hh b/game/players.hh
index 3979d3c..e45ea59 100644
--- a/game/players.hh
+++ b/game/players.hh
@@ -18,6 +18,11 @@ struct PlayerItem
std::string picture; /// a path to a picture shown
std::map<std::string, int> scores; /// map between a Song and the highest score the Player achieved
*/
+
+ bool operator== (PlayerItem const& pi) const
+ {
+ return name == pi.name;
+ }
};
/**A collection of all Players.
@@ -47,7 +52,7 @@ class Players
load();
}
void save();
- void addPlayer (std::string name);
+ void addPlayer (std::string const& name);
/// advances to next player
void advance(int diff) {
@@ -61,7 +66,7 @@ class Players
PlayerItem operator[](std::size_t pos) { return m_filtered[pos]; }
PlayerItem operator[](std::size_t pos) const { return m_filtered[pos]; }
/// number of players
- int size() const { return m_filtered.size(); };
+ std::size_t size() const { return m_filtered.size(); };
/// true if empty
int empty() const { return m_filtered.empty(); };
/// filters playerlist by regular expression
diff --git a/game/screen_players.cc b/game/screen_players.cc
index 0a54faa..27166d0 100644
--- a/game/screen_players.cc
+++ b/game/screen_players.cc
@@ -11,11 +11,20 @@ ScreenPlayers::ScreenPlayers(std::string const& name, Audio& audio, Players& pla
{
m_players.setAnimMargins(5.0, 5.0);
m_playTimer.setTarget(getInf()); // Using this as a simple timer counting seconds
+
+ // print all names
+ std::cout << "Constructor of ScreenPlayers" << std::endl;
+ for (size_t i=0; i<m_players.size(); i++)
+ {
+ std::cout << "Name " << i << ": " << m_players[i].name << std::endl;
+ }
}
void ScreenPlayers::enter() {
+ std::cout << "Entered ScreenPlayers" << std::endl;
+
theme.reset(new ThemeSongs());
- m_emptyCover.reset(new Surface(getThemePath("no_cover.svg")));
+ m_emptyCover.reset(new Surface(getThemePath("no_cover.svg"))); // TODO use persons head
m_search.text.clear();
m_players.setFilter(m_search.text);
m_audio.fadeout();
|
|
From: Markus R. <god...@us...> - 2009-07-29 15:34:17
|
Module: performous Branch: hiscore Commit: 95677ef408d5373b540dae72438491bad6092b42 Author: Markus Raab <un...@ma...> Date: Fri Jul 24 16:13:02 2009 +0200 Players screen is shown (It does not find any player yet) --- game/main.cc | 3 + game/players.cc | 33 +++++++++++- game/players.hh | 45 ++++++++++++++++- game/screen_players.cc | 130 ++++++++++++++++++++++++++++++++++++++++++++++++ game/screen_players.hh | 38 ++++++++++++++ game/screen_sing.cc | 5 ++- game/screen_sing.hh | 2 + 7 files changed, 251 insertions(+), 5 deletions(-) |
|
From: Markus R. <god...@us...> - 2009-07-29 15:34:16
|
Module: performous Branch: hiscore Commit: 1e7b8afa48542e6830baf1a8497bbb452557efc8 Author: Markus Raab <un...@ma...> Date: Fri Jul 24 13:24:20 2009 +0200 added pragma once in all header files --- game/cachemap.hh | 1 + game/color.hh | 1 + game/config.cmake.hh | 2 ++ game/dialog.hh | 1 + game/midifile.hh | 1 + game/opengl_text.hh | 1 + game/pitch.hh | 1 + game/screen_intro.hh | 1 + game/screen_practice.hh | 1 + game/screen_songs.hh | 1 + game/singleton.hh | 1 + game/textinput.hh | 1 + game/unused/fftgraph.hh | 1 + game/xtime.hh | 1 + 14 files changed, 15 insertions(+), 0 deletions(-) diff --git a/game/cachemap.hh b/game/cachemap.hh index b20bba7..7a59dc0 100644 --- a/game/cachemap.hh +++ b/game/cachemap.hh @@ -1,3 +1,4 @@ +#pragma once #include <boost/ptr_container/ptr_map.hpp> #include <list> diff --git a/game/color.hh b/game/color.hh index 9559747..57ca3fe 100644 --- a/game/color.hh +++ b/game/color.hh @@ -1,3 +1,4 @@ +#pragma once #ifndef PERFORMOUS_COLOR_HH #define PERFORMOUS_COLOR_HH diff --git a/game/config.cmake.hh b/game/config.cmake.hh index f81e70a..593a7b0 100644 --- a/game/config.cmake.hh +++ b/game/config.cmake.hh @@ -1,3 +1,5 @@ +#pragma once + // CMake uses config.cmake.hh to generate config.hh within the build folder. #ifndef PERFORMOUS_CONFIG_HH #define PERFORMOUS_CONFIG_HH diff --git a/game/dialog.hh b/game/dialog.hh index bec8dce..ce57981 100644 --- a/game/dialog.hh +++ b/game/dialog.hh @@ -1,3 +1,4 @@ +#pragma once #ifndef PERFORMOUS_DIALOG_HH #define PERFORMOUS_DIALOG_HH diff --git a/game/midifile.hh b/game/midifile.hh index 2ce9c46..9ba85f8 100644 --- a/game/midifile.hh +++ b/game/midifile.hh @@ -1,3 +1,4 @@ +#pragma once #include <boost/cstdint.hpp> #include <fstream> #include <map> diff --git a/game/opengl_text.hh b/game/opengl_text.hh index 37c8af1..b2f9e97 100644 --- a/game/opengl_text.hh +++ b/game/opengl_text.hh @@ -1,3 +1,4 @@ +#pragma once #ifndef __OPENGL_THEME_H__ #define __OPENGL_THEME_H__ diff --git a/game/pitch.hh b/game/pitch.hh index 6bc68a5..f64132d 100644 --- a/game/pitch.hh +++ b/game/pitch.hh @@ -1,3 +1,4 @@ +#pragma once #ifndef USNG_PITCH_H_INCLUDED #define USNG_PITCH_H_INCLUDED diff --git a/game/screen_intro.hh b/game/screen_intro.hh index 125462b..9e6c4ac 100644 --- a/game/screen_intro.hh +++ b/game/screen_intro.hh @@ -1,3 +1,4 @@ +#pragma once #ifndef __SCREENINTRO_H__ #define __SCREENINTRO_H__ diff --git a/game/screen_practice.hh b/game/screen_practice.hh index 8c72c16..1816055 100644 --- a/game/screen_practice.hh +++ b/game/screen_practice.hh @@ -1,3 +1,4 @@ +#pragma once #ifndef __SCREENPRACTICE_H__ #define __SCREENPRACTICE_H__ diff --git a/game/screen_songs.hh b/game/screen_songs.hh index 6eefff8..9508227 100644 --- a/game/screen_songs.hh +++ b/game/screen_songs.hh @@ -1,3 +1,4 @@ +#pragma once #ifndef PERFORMOUS_SCREEN_SONGS_HH #define PERFORMOUS_SCREEN_SONGS_HH diff --git a/game/singleton.hh b/game/singleton.hh index a85ce93..75361c0 100644 --- a/game/singleton.hh +++ b/game/singleton.hh @@ -1,3 +1,4 @@ +#pragma once #ifndef __SINGLETON_H__ #define __SINGLETON_H__ diff --git a/game/textinput.hh b/game/textinput.hh index 11156c6..67b36f1 100644 --- a/game/textinput.hh +++ b/game/textinput.hh @@ -1,3 +1,4 @@ +#pragma once #include <SDL.h> #include <string> diff --git a/game/unused/fftgraph.hh b/game/unused/fftgraph.hh index cd38fcb..5f6b8d9 100644 --- a/game/unused/fftgraph.hh +++ b/game/unused/fftgraph.hh @@ -1,3 +1,4 @@ +#pragma once #ifndef PERFORMOUS_FFTGRAPH_HH #define PERFORMOUS_FFTGRAPH_HH diff --git a/game/xtime.hh b/game/xtime.hh index 99a7d63..ff3109b 100644 --- a/game/xtime.hh +++ b/game/xtime.hh @@ -1,3 +1,4 @@ +#pragma once #ifndef USNG_XTIME_H_INCLUDED #define USNG_XTIME_H_INCLUDED |