Re: [Vala] [PATCH] gtk-clutter-0.10 bindings



On 12/18/2009 08:53 AM, Gordon Allott wrote:
On Wed, 2009-12-16 at 22:34 -0600, Andrew Breiner wrote:

Your patch made gtkstage.get_stage() return a Clutter.Actor, I was
just 
wondering why it didn't return a Clutter.Stage.  I manually edited
the 
vapi file and told GtkClutter.Embed to have the following information:

public class Embed : Gtk.Container, Atk.Implementor, Gtk.Buildable {
    [CCode (type = "GtkWidget*", has_construct_function = false)]
    public Embed ();
    public unowned Clutter.Stage get_stage ();
} 

It returns a ClutterActor because thats what gtk_clutter_get_stage ()
returns, on the whole clutter functions will *always* return clutter
actors and its up to you to to cast them appropriately. just do 
Clutter.Stage stage = gtkstage.get_stage (); 

vala will handle the typecasting for you just fine. if it doesn't for
whatever reason (it should) just add "As Clutter.stage"


Thanks.  I did have to cast it.  I had "private Clutter.Stage stage;" at
the top of my class and inside my constructor I had:

      var gtkstage = new GtkClutter.Embed();
      stage = gtkstage.get_stage();

And it gave me the error:

Assignment: Cannot convert from `Clutter.Actor' to `Clutter.Stage'
      stage = gtkstage.get_stage();
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
So I changed the line to:

stage = (Clutter.Stage)gtkstage.get_stage();

and it was much happier.

However I have a side question if you don't mind.  I have a simple
button that starts the animation, but anytime I roll over the button
during animation it slows down/pauses my animation, is it just my
computer or is there something special I need to know about?

Again thanks for the help.

Andy B



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