|
From: Lasse Kärkkäi. <tr...@us...> - 2009-07-26 01:13:19
|
Module: performous
Branch: master
Commit: 85b879f793d390bd32bb0438c153740a31672cb1
Author: Lasse Karkkainen <tro...@tr...>
Date: Sun Jul 26 01:17:02 2009 +0300
Print buttons on cursor. Crappy button.svg added, Yoda should have a better one.
Modified perspective.
---
game/guitargraph.cc | 25 ++++++++++---
game/guitargraph.hh | 1 +
themes/default/button.svg | 82 +++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 102 insertions(+), 6 deletions(-)
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index 9d08de3..7efc8cb 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -3,22 +3,22 @@
namespace {
const float past = -0.3f;
const float future = 3.0f;
- const float timescale = 30.0f;
+ const float timescale = 80.0f;
const float texCoordStep = -0.5f; // Two beat lines per neck texture => 0.5 tex units per beat
// Note: t is difference from playback time so it must be in range [past, future]
float time2y(float t) { return -timescale * (t - past) / (future - past); }
float time2a(float t) { return 1.0f - t / future; } // Note: we want 1.0 alpha already at zero t.
}
-GuitarGraph::GuitarGraph(Song const& song): m_song(song), m_neck("guitarneck.svg") {}
+GuitarGraph::GuitarGraph(Song const& song): m_song(song), m_neck("guitarneck.svg"), m_button("button.svg") {}
void GuitarGraph::draw(double time) {
if (m_song.tracks.empty()) return; // Can't render without tracks (FIXME: actually screen_song should choose a track for us)
Dimensions dimensions(1.0); // FIXME: bogus aspect ratio (is this fixable?)
- dimensions.screenBottom().fixedWidth(0.5f).left(-0.5f);
+ dimensions.screenBottom().fixedWidth(0.5f);
glutil::PushMatrix pmb;
glTranslatef(0.5 * (dimensions.x1() + dimensions.x2()), dimensions.y2(), 0.0f);
- glRotatef(80.0f, 1.0f, 0.0f, 0.0f);
+ glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
{ float s = dimensions.w() / 5.0f; glScalef(s, s, s); }
// Draw the neck
{
@@ -93,7 +93,7 @@ void GuitarGraph::draw(double time) {
glVertex2f(x + w, time2y(tBeg));
}
}
- glColor3f(1.0f, 1.0f, 1.0f);
+ glColor3f(0.0f, 0.0f, 0.0f);
// Draw the cursor
{
glutil::Begin block(GL_TRIANGLE_STRIP);
@@ -101,6 +101,19 @@ void GuitarGraph::draw(double time) {
glVertex2f(2.5f, time2y(0.01f));
glVertex2f(-2.5f, time2y(-0.01f));
glVertex2f(2.5f, time2y(-0.01f));
- }
+ }
+ for (int fret = 0; fret < 5; ++fret) {
+ float x = -2.0f + fret;
+ glutil::Color c = fretColors[fret];
+ if (true) {
+ c.r *= 0.5f;
+ c.g *= 0.5f;
+ c.b *= 0.5f;
+ }
+ glColor4fv(c);
+ m_button.dimensions.center(time2y(0.0)).middle(x);
+ m_button.draw();
+ }
+ glColor3f(1.0f, 1.0f, 1.0f);
}
diff --git a/game/guitargraph.hh b/game/guitargraph.hh
index 6f186a1..5b0c463 100644
--- a/game/guitargraph.hh
+++ b/game/guitargraph.hh
@@ -20,5 +20,6 @@ class GuitarGraph {
private:
Song const& m_song;
Texture m_neck;
+ Surface m_button;
};
diff --git a/themes/default/button.svg b/themes/default/button.svg
new file mode 100644
index 0000000..67f3086
--- /dev/null
+++ b/themes/default/button.svg
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<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"
+ width="64"
+ height="64"
+ id="svg1901"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ sodipodi:docname="button.svg"
+ sodipodi:docbase="/home/tsoots/ohj/translations/po"
+ version="1.0"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs1903">
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ id="perspective7" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="2.8284271"
+ inkscape:cx="-1.2442731"
+ inkscape:cy="40"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ gridtolerance="10000"
+ inkscape:window-width="877"
+ inkscape:window-height="739"
+ inkscape:window-x="10"
+ inkscape:window-y="69"
+ showgrid="true"
+ inkscape:showpageshadow="false">
+ <inkscape:grid
+ type="xygrid"
+ id="grid2382"
+ visible="true"
+ enabled="true"
+ empspacing="8" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata1906">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Taso 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ style="opacity:1">
+ <path
+ sodipodi:type="arc"
+ style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:4;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="path2390"
+ sodipodi:cx="32"
+ sodipodi:cy="32"
+ sodipodi:rx="24"
+ sodipodi:ry="24"
+ d="M 56,32 A 24,24 0 1 1 8,32 A 24,24 0 1 1 56,32 z" />
+ </g>
+</svg>
|