[Vala] [Genie] Clutter sample problem



Hi,

I try to port the clutter sample from vala (http://mail.gnome.org/archives/vala-list/2009-November/msg00057.html) to genie and, of course, i have a problem:

When i load the program, i have this message:
(/usr/home/niko/Desktop/cluttertest:82339): Clutter-CRITICAL **: clutter_color_from_string: assertion `str != NULL' failed

And after the rectangles move, the program crash with:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 36301140 (LWP 100199)]
0x080498d5 in _lambda0_ (s=0x36352e80, _data1_=0x3634a9c0) at cluttertest.gs:44
44                text.x = stage.width / 2

This is the code:

[indent=4]

uses
   Clutter

class ClutterDemo

   stage : Stage
   rectangles : array of Rectangle
const colors : array of string = { "blanched almond", "OldLace", "MistyRose", "White", "LavenderBlush", "CornflowerBlue", "chartreuse", "chocolate", "light coral", "medium violet red", "LemonChiffon2", "RosyBrown3" }

   construct ()
       stage = Stage.get_default ()
rectangles = new array of Rectangle[colors.length] /* probably the source of the first message */
       stage.hide.connect (Clutter.main_quit)
       create_rectangles ()
       stage.color = Clutter.Color () { alpha = 255 }
       stage.show_all ()

   def private create_rectangles ()
       i : int = 0
       while i < colors.length
           i++
           var r = new Rectangle
           r.width = r.height = stage.height / colors.length
           r.color = Color.from_string (colors[i])
           r.anchor_gravity = Gravity.CENTER
           r.y = i * r.height + r.height / 2
           stage.add_actor (r)
           rectangles[i] = r

   def start ()
       var animations = new array of Animation[rectangles.length]
       i : int = 0
       j : int = 0
       while i < rectangles.length
           i++
animations[i] = rectangles[i].animate (AnimationMode.LINEAR, 5000, "x", stage.width / 2, "rotation-angle-z", 500.0)
           animations[i].timeline.start ()

       animations[animations.length - 1].timeline.completed += def (s)
var text = new Text.full ("Bitstream Vera Sans 40", "Congratulations!", Color.from_string ("white"))
           text.set_anchor_point_from_gravity (Gravity.CENTER)
           text.x = stage.width / 2 /* Crash here !! */
           text.y = -text.height
           stage.add_actor (text)
           text.show ()
var text_anim = text.animate (AnimationMode.EASE_OUT_BOUNCE, 3000, "y", stage.height / 2)
           text_anim.timeline.start ()

           while j < rectangles.length
               j++
animations[i] = rectangles[i].animate (AnimationMode.EASE_OUT_BOUNCE, 3000, "x", Random.next_double () * stage.width, "y", Random.next_double () * stage.height / 2 + stage.height / 2, "rotation-angle-z", rectangles[i].rotation_angle_z, "opacity", 0.0)
               animations[i].timeline.start ()

init
   Clutter.init (ref args)
   var demo = new ClutterDemo ()
   demo.start ()
   Clutter.main ()

Someone know what i have this problem ?
Thanks,
Nicolas.





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]