Module: performous
Branch: master
Commit: a8e7fdceb27984d9ce042149ede4bb2e82e25e9f
Author: Miguel Sánchez de León Peque <peq...@ho...>
Date: Tue Dec 29 02:32:32 2009 +0100
Fixed bug in configuration screen (used too much CPU while rendering text). Added volume control in screens with F11 and F12 keys. Now screenshots in Performous are taken with the usual PRINT key.
---
game/main.cc | 2 +-
game/screen_configuration.cc | 6 ++-
game/screen_intro.cc | 4 ++
game/screen_practice.cc | 6 ++-
game/screen_sing.cc | 2 +
game/screen_songs.cc | 2 +
game/theme.cc | 1 +
game/theme.hh | 2 +
themes/default/menu_short_comment.svg | 76 +++++++++++++++++++++++++++++++++
9 files changed, 97 insertions(+), 4 deletions(-)
diff --git a/game/main.cc b/game/main.cc
index bcf3062..03b47f4 100644
--- a/game/main.cc
+++ b/game/main.cc
@@ -71,7 +71,7 @@ static void checkEvents_SDL(ScreenManager& sm, Window& window) {
config["graphic/fullscreen"].b() = !config["graphic/fullscreen"].b();
continue; // Already handled here...
}
- if (keypressed == SDLK_F11 ) {
+ if (keypressed == SDLK_PRINT ) {
g_take_screenshot = true;
}
if (keypressed == SDLK_F4 && modifier & KMOD_ALT) {
diff --git a/game/screen_configuration.cc b/game/screen_configuration.cc
index 5f9908e..8be8b28 100644
--- a/game/screen_configuration.cc
+++ b/game/screen_configuration.cc
@@ -38,6 +38,8 @@ void ScreenConfiguration::manageEvent(SDL_Event event) {
if (configuration.empty()) return; // The rest work if there are any config options
else if (key == SDLK_r && modifier & KMOD_CTRL) ci->reset(modifier & KMOD_ALT);
else if (key == SDLK_s && modifier & KMOD_CTRL) writeConfig(modifier & KMOD_ALT);
+ else if (key == SDLK_F11) --config["audio/preview_volume"];
+ else if (key == SDLK_F12) ++config["audio/preview_volume"];
}
}
@@ -51,8 +53,8 @@ void ScreenConfiguration::draw() {
theme->short_comment_bg.dimensions.fixedHeight(0.025);
theme->short_comment_bg.dimensions.right(-0.04).screenBottom(-0.054);
theme->short_comment_bg.draw();
- theme->comment.dimensions.left(-0.48).screenBottom(-0.067);
- theme->comment.draw("Ctrl + S to save, Ctrl + R to reset defaults");
+ theme->short_comment.dimensions.left(-0.48).screenBottom(-0.067);
+ theme->short_comment.draw("Ctrl + S to save, Ctrl + R to reset defaults");
// Long description
theme->comment_bg.dimensions.middle().screenBottom(-0.01);
theme->comment_bg.draw();
diff --git a/game/screen_intro.cc b/game/screen_intro.cc
index 3ef4f54..f4d7e0d 100755
--- a/game/screen_intro.cc
+++ b/game/screen_intro.cc
@@ -46,6 +46,10 @@ void ScreenIntro::manageEvent(SDL_Event event) {
} else if (nav == input::PAUSE) m_audio.togglePause();
// Normalize selected to [0, size)
selected = (m_menuOptions.size() + selected) % m_menuOptions.size();
+ } else if (event.type == SDL_KEYDOWN) {
+ int key = event.key.keysym.sym;
+ if (key == SDLK_F11) --config["audio/preview_volume"];
+ else if (key == SDLK_F12) ++config["audio/preview_volume"];
}
}
diff --git a/game/screen_practice.cc b/game/screen_practice.cc
index 59537ef..b313d74 100644
--- a/game/screen_practice.cc
+++ b/game/screen_practice.cc
@@ -38,7 +38,11 @@ void ScreenPractice::manageEvent(SDL_Event event) {
input::NavButton nav(input::getNav(event));
if (nav == input::CANCEL || nav == input::START || nav == input::SELECT) sm->activateScreen("Intro");
else if (nav == input::PAUSE) m_audio.togglePause();
- else if (event.type == SDL_JOYBUTTONDOWN // Play drum sounds here
+ else if (event.type == SDL_KEYDOWN) {
+ int key = event.key.keysym.sym;
+ if (key == SDLK_F11) --config["audio/music_volume"];
+ else if (key == SDLK_F12) ++config["audio/music_volume"];
+ } else if (event.type == SDL_JOYBUTTONDOWN // Play drum sounds here
&& input::Private::devices[event.jbutton.which].type_match(input::DRUMS)) {
int b = input::buttonFromSDL(input::Private::devices[event.jbutton.which].type(), event.jbutton.button);
if (b != -1) m_audio.play(m_samples[unsigned(b) % m_samples.size()], "audio/fail_volume");
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index 5899475..7ed89a1 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -232,6 +232,8 @@ void ScreenSing::manageEvent(SDL_Event event) {
else if (key == SDLK_F8) ++config["audio/round-trip"];
else if (key == SDLK_F9) ++config["game/karaoke_mode"];
else if (key == SDLK_F10) ++config["game/pitch"];
+ else if (key == SDLK_F11) --config["audio/music_volume"];
+ else if (key == SDLK_F12) ++config["audio/music_volume"];
else if (key == SDLK_HOME) m_audio.seekPos(0.0);
else if (key == SDLK_LEFT) { m_audio.seek(-5.0); seekback = true; }
else if (key == SDLK_RIGHT) m_audio.seek(5.0);
diff --git a/game/screen_songs.cc b/game/screen_songs.cc
index 4bb6ecf..1a271f9 100644
--- a/game/screen_songs.cc
+++ b/game/screen_songs.cc
@@ -96,6 +96,8 @@ void ScreenSongs::manageEvent(SDL_Event event) {
else if (m_songs.empty()) return;
else if (key == SDLK_PAGEUP) m_songs.advance(-10);
else if (key == SDLK_PAGEDOWN) m_songs.advance(10);
+ else if (key == SDLK_F11) --config["audio/preview_volume"];
+ else if (key == SDLK_F12) ++config["audio/preview_volume"];
else if (!m_jukebox && key == SDLK_F4) m_jukebox = true;
else if (key == SDLK_TAB && !(mod & KMOD_ALT)) m_songs.randomize();
else if (key == SDLK_END) {
diff --git a/game/theme.cc b/game/theme.cc
index e58d373..7e928f2 100755
--- a/game/theme.cc
+++ b/game/theme.cc
@@ -39,6 +39,7 @@ ThemeConfiguration::ThemeConfiguration():
item(getThemePath("configuration_item.svg"), config["graphic/text_lod"].f()),
value(getThemePath("configuration_value.svg"), config["graphic/text_lod"].f()),
comment(getThemePath("menu_comment.svg"), config["graphic/text_lod"].f()),
+ short_comment(getThemePath("menu_short_comment.svg"), config["graphic/text_lod"].f()),
comment_bg(getThemePath("menu_comment_bg.svg")),
short_comment_bg(getThemePath("menu_scomment_bg.svg"))
{}
diff --git a/game/theme.hh b/game/theme.hh
index d62a902..3cbba53 100755
--- a/game/theme.hh
+++ b/game/theme.hh
@@ -59,6 +59,8 @@ struct ThemeConfiguration: Theme {
SvgTxtTheme value;
/// configuration comment text
SvgTxtTheme comment;
+ /// configuration comment text (short tip)
+ SvgTxtTheme short_comment;
/// configuration comment background
Surface comment_bg;
/// configuration comment background (short tip)
diff --git a/themes/default/menu_short_comment.svg b/themes/default/menu_short_comment.svg
new file mode 100644
index 0000000..a74618f
--- /dev/null
+++ b/themes/default/menu_short_comment.svg
@@ -0,0 +1,76 @@
+<?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="80"
+ height="20"
+ id="svg559"
+ sodipodi:version="0.32"
+ inkscape:version="0.47 r22583"
+ sodipodi:docname="menu_short_comment.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs2522">
+ <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>
+ <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" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <sodipodi:namedview
+ inkscape:window-height="725"
+ inkscape:window-width="1280"
+ 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="3.5638182"
+ inkscape:cx="63.312761"
+ inkscape:cy="28.101518"
+ inkscape:window-x="0"
+ inkscape:window-y="25"
+ inkscape:current-layer="svg559"
+ showgrid="false"
+ inkscape:window-maximized="1" />
+ <text
+ x="1.4361764"
+ y="16.829205"
+ style="font-size:13.92942142px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#060000;fill-opacity:1;stroke:none;display:inline;font-family:Bitstream Charter;-inkscape-font-specification:Bitstream Charter"
+ id="text10203"
+ xml:space="preserve"
+ sodipodi:linespacing="125%"
+ transform="scale(1.0082228,0.99184427)"><tspan
+ x="1.4361764"
+ y="16.829205"
+ id="tspan10205"
+ style="font-size:13.92942142px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;text-anchor:start;fill:#060000;fill-opacity:1;stroke:none;font-family:Bitstream Charter;-inkscape-font-specification:Bitstream Charter">Comment</tspan></text>
+</svg>
|