|
From: Lasse Kärkkäi. <tr...@us...> - 2010-09-16 12:27:44
|
Module: performous
Branch: menuvideo
Commit: bdf30de234139d847d4584d6687ef6706a236468
Author: Lasse Karkkainen <tro...@tr...>
Date: Thu Sep 16 15:26:05 2010 +0300
Menu background video file and looping playback code. Removed original menu background.
---
game/screen_intro.cc | 3 +++
game/screen_intro.hh | 2 ++
game/video.cc | 11 ++++++++++-
game/video.hh | 5 ++++-
themes/CMakeLists.txt | 2 +-
themes/default/intro_bg.svg | 22 ++++------------------
themes/default/menu.mkv | Bin 0 -> 4850720 bytes
7 files changed, 24 insertions(+), 21 deletions(-)
diff --git a/game/screen_intro.cc b/game/screen_intro.cc
index b327a75..f05f82e 100644
--- a/game/screen_intro.cc
+++ b/game/screen_intro.cc
@@ -16,6 +16,7 @@ void ScreenIntro::enter() {
m_selAnim = AnimValue(0.0, 10.0);
m_submenuAnim = AnimValue(0.0, 3.0);
theme.reset(new ThemeIntro());
+ m_video.reset(new Video(getThemePath("menu.mkv")));
populateMenu();
if( m_first ) {
std::string msg;
@@ -27,6 +28,7 @@ void ScreenIntro::enter() {
void ScreenIntro::exit() {
m_menu.clear();
+ m_video.reset();
theme.reset();
}
@@ -99,6 +101,7 @@ void ScreenIntro::draw_menu_options() {
}
void ScreenIntro::draw() {
+ m_video->renderLoop();
theme->bg.draw();
if (m_menu.current().image) m_menu.current().image->draw();
// Comment
diff --git a/game/screen_intro.hh b/game/screen_intro.hh
index 917e602..ad2e48c 100644
--- a/game/screen_intro.hh
+++ b/game/screen_intro.hh
@@ -3,6 +3,7 @@
#include <boost/scoped_ptr.hpp>
#include "screen.hh"
#include "menu.hh"
+#include "video.hh"
#include "animvalue.hh"
class Audio;
@@ -27,6 +28,7 @@ class ScreenIntro : public Screen {
Audio& m_audio;
boost::scoped_ptr<ThemeIntro> theme;
+ boost::scoped_ptr<Video> m_video;
Menu m_menu;
bool m_first;
AnimValue m_selAnim;
diff --git a/game/video.cc b/game/video.cc
index 64dbc2c..6e5af03 100644
--- a/game/video.cc
+++ b/game/video.cc
@@ -4,7 +4,16 @@
#include <cmath>
-Video::Video(std::string const& _videoFile, double videoGap): m_mpeg(true, false, _videoFile), m_videoGap(videoGap), m_surfaceTime(), m_lastTime(), m_alpha(-0.5, 1.5) {}
+Video::Video(std::string const& _videoFile, double videoGap):
+ m_mpeg(true, false, _videoFile), m_videoGap(videoGap), m_surfaceTime(), m_lastTime(), m_alpha(-0.5, 1.5)
+{
+ m_loopTimer.setTarget(getInf());
+}
+
+void Video::renderLoop() {
+ if (m_videoFrame.data.empty()) m_loopTimer.setValue(1.0);
+ render(m_loopTimer.get());
+}
void Video::render(double time) {
time += m_videoGap;
diff --git a/game/video.hh b/game/video.hh
index c1ed3ea..dbff46b 100644
--- a/game/video.hh
+++ b/game/video.hh
@@ -10,8 +10,10 @@ class Video {
public:
/// opens given video file
Video(std::string const& videoFile, double videoGap = 0.0);
- /// renders video
+ /// Draw a video frame (at time)
void render(double time);
+ /// Render video using an internal clock and loop once the end is reached
+ void renderLoop();
/// returns Dimensions of video clip
Dimensions& dimensions() { return m_surface.dimensions; }
/// returns Dimensions of video clip
@@ -25,5 +27,6 @@ class Video {
double m_surfaceTime;
double m_lastTime;
AnimValue m_alpha;
+ AnimValue m_loopTimer;
};
diff --git a/themes/CMakeLists.txt b/themes/CMakeLists.txt
index 5636f21..8718e4d 100644
--- a/themes/CMakeLists.txt
+++ b/themes/CMakeLists.txt
@@ -1,4 +1,4 @@
-FILE(GLOB THEME_FILES "default/*.ogg" "default/*.svg" "default/*.png" "default/*.bmp" "default/*.obj")
+FILE(GLOB THEME_FILES "default/*.ogg" "default/*.svg" "default/*.png" "default/*.bmp" "default/*.mkv" "default/*.obj")
install( FILES ${THEME_FILES} DESTINATION ${SHARE_INSTALL}/themes/default/)
diff --git a/themes/default/intro_bg.svg b/themes/default/intro_bg.svg
index c80a9b5..3e506f2 100644
--- a/themes/default/intro_bg.svg
+++ b/themes/default/intro_bg.svg
@@ -17,7 +17,7 @@
height="800"
id="svg559"
sodipodi:version="0.32"
- inkscape:version="0.47pre4 r22446"
+ inkscape:version="0.47 r22583"
sodipodi:docname="intro_bg.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape">
<metadata
@@ -33,8 +33,8 @@
</rdf:RDF>
</metadata>
<sodipodi:namedview
- inkscape:window-height="726"
- inkscape:window-width="1280"
+ inkscape:window-height="992"
+ inkscape:window-width="1920"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
guidetolerance="10.0"
@@ -48,7 +48,7 @@
inkscape:cx="619.55102"
inkscape:cy="354.60886"
inkscape:window-x="0"
- inkscape:window-y="25"
+ inkscape:window-y="29"
inkscape:current-layer="svg559"
showgrid="false"
showguides="true"
@@ -565,20 +565,6 @@
id="stop3633-4-5" />
</linearGradient>
</defs>
- <rect
- style="fill:#ffffff;fill-opacity:1;stroke:none"
- id="rect2855-6"
- width="1000"
- height="800"
- x="0"
- y="0" />
- <rect
- style="fill:url(#radialGradient3750);fill-opacity:1;stroke:none"
- id="rect2855"
- width="1000"
- height="800"
- x="0"
- y="0" />
<text
xml:space="preserve"
style="font-size:24.89476013px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
diff --git a/themes/default/menu.mkv b/themes/default/menu.mkv
new file mode 100644
index 0000000..317ca75
Binary files /dev/null and b/themes/default/menu.mkv differ
|