[cluttermm_tutorial] Fixed reference count and scope issues in behaviour example.
- From: Chris Kühl <chriskuehl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cluttermm_tutorial] Fixed reference count and scope issues in behaviour example.
- Date: Fri, 17 Sep 2010 15:39:14 +0000 (UTC)
commit 3fb5ee893c849a53de413063acef408ca4b2b2d7
Author: Chris Kühl <chrisk openismus com>
Date: Fri Sep 17 17:30:14 2010 +0200
Fixed reference count and scope issues in behaviour example.
* examples/behaviour/main.cc: Changed return value of on_alpha
and freed code from block.
ChangeLog | 7 ++++++
examples/behaviour/main.cc | 46 +++++++++++++++++++------------------------
2 files changed, 27 insertions(+), 26 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 05fe30a..141a19f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-09-17 Chris Kühl <chrisk openismus com>
+
+ Fixed reference count and scope issues in behaviour example.
+
+ * examples/behaviour/main.cc: Changed return value of on_alpha
+ and freed code from block.
+
2010-09-13 Murray Cumming <murrayc murrayc com>
Finish fixing the build with --enable-warnings=fatal
diff --git a/examples/behaviour/main.cc b/examples/behaviour/main.cc
index ad0a7d8..1810887 100644
--- a/examples/behaviour/main.cc
+++ b/examples/behaviour/main.cc
@@ -23,17 +23,13 @@ namespace
static Glib::RefPtr<Clutter::Rectangle> rect;
/*
- * This must return a value between 0 and Clutter::Alpha::MAX_ALPHA, where
- * 0 means the start of the path, and Clutter::Alpha::MAX_ALPHA is the end
- * of the path.
- *
- * This will be called as many times per seconds as specified in our call
- * to Clutter::Timeline::create().
+ * This must return a value between 0 and 1.0, where 0 means the start of
+ * the path, and Clutter::1.0 is the end of the path.
*
* See also, for instance Clutter::Alpha::sine_half_func for a useful
* built-in callback.
*/
-static guint32 on_alpha(Glib::RefPtr<Clutter::Alpha> alpha)
+static double on_alpha(Glib::RefPtr<Clutter::Alpha> alpha)
{
// Get the position in the timeline, so we can base our value upon it:
const Glib::RefPtr<Clutter::Timeline> timeline = alpha->get_timeline();
@@ -63,25 +59,23 @@ int main(int argc, char** argv)
// Show the stage:
stage->show();
- {
- const Glib::RefPtr<Clutter::Timeline>
- timeline = Clutter::Timeline::create(5000 /* milliseconds */);
- timeline->set_loop(true);
- timeline->start();
-
- // Instead of our custom callback, we could use a standard callback.
- // For instance, Clutter::Alpha::sine_inc_func.
- const Glib::RefPtr<Clutter::Alpha>
- alpha = Clutter::Alpha::create(timeline, &on_alpha);
-
- std::vector<Clutter::Knot> knots (2);
- knots[0].set_xy(10, 10);
- knots[1].set_xy(150, 150);
-
- const Glib::RefPtr<Clutter::Behaviour>
- behaviour = Clutter::BehaviourPath::create_with_knots(alpha, knots);
- behaviour->apply(rect);
- }
+ const Glib::RefPtr<Clutter::Timeline>
+ timeline = Clutter::Timeline::create(5000 /* milliseconds */);
+ timeline->set_loop(true);
+ timeline->start();
+
+ // Instead of our custom callback, we could use a standard callback.
+ // For instance, Clutter::Alpha::sine_inc_func.
+ const Glib::RefPtr<Clutter::Alpha>
+ alpha = Clutter::Alpha::create(timeline, &on_alpha);
+
+ std::vector<Clutter::Knot> knots (2);
+ knots[0].set_xy(10, 10);
+ knots[1].set_xy(150, 150);
+
+ const Glib::RefPtr<Clutter::Behaviour>
+ behaviour = Clutter::BehaviourPath::create_with_knots(alpha, knots);
+ behaviour->apply(rect);
// Start the main loop, so we can respond to events:
Clutter::main();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]