Beispiel #1
0
        public static void Main(string[] args)
        {
            Application.Init();

            Stage stage = Stage.Default as Stage;

            (stage as Stage).KeyPressEvent += delegate {
                Clutter.Main.Quit();
            };

            // fixme: add constructor
            Clutter.Color stage_color = new Clutter.Color(0xcc, 0xcc, 0xcc, 0xff);
            stage.SetColor(stage_color);

            Clutter.Group group = new Group();
            stage.Add(group);
            group.Show();

            // Make a hand
            Clutter.Actor hand = new Texture("redhand.png");
            hand.SetPosition(0, 0);
            hand.Show();

            // Make a rect
            Clutter.Rectangle rect = new Clutter.Rectangle();
            rect.SetPosition(0, 0);
            rect.SetSize((int)hand.Width, (int)hand.Height);

            Clutter.Color rect_bg_color = new Clutter.Color(0x33, 0x22, 0x22, 0xff);
            rect.SetColor(rect_bg_color);
            rect.BorderWidth = 10;
            rect.Show();

            group.Add(rect);
            group.Add(hand);

            // Make a timeline
            Timeline timeline = new Timeline(100, 26);

            timeline.Loop = true;

            Alpha alpha = new Alpha(timeline, (a) => a.Value);

            Behaviour o_behave = new BehaviourOpacity(alpha, 0x33, 0xff);

            o_behave.Apply(group);

            // Make a path behaviour and apply that too
            Behaviour p_behave = new BehaviourPath(alpha, knots);             // fixme: add custom constructor?

            p_behave.Apply(group);

            // start timeline
            timeline.Start();

            stage.ShowAll();

            // launch
            Application.Run();
        }
Beispiel #2
0
        public static void Main(string[] args)
        {
            Application.Init ();

            Stage stage = Stage.Default as Stage;
            (stage as Stage).KeyPressEvent += delegate {
                Clutter.Main.Quit();
            };

            // fixme: add constructor
            Clutter.Color stage_color = new Clutter.Color (0xcc, 0xcc, 0xcc, 0xff);
            stage.SetColor (stage_color);

            Clutter.Group group = new Group();
            stage.Add (group);
            group.Show ();

            // Make a hand
            Clutter.Actor hand = new Texture ("redhand.png");
            hand.SetPosition (0,0);
            hand.Show ();

            // Make a rect
            Clutter.Rectangle rect = new Clutter.Rectangle();
            rect.SetPosition (0,0);
            rect.SetSize ((int)hand.Width, (int)hand.Height);

            Clutter.Color rect_bg_color = new Clutter.Color (0x33, 0x22, 0x22, 0xff);
            rect.SetColor (rect_bg_color);
            rect.BorderWidth = 10;
            rect.Show ();

            group.Add (rect);
            group.Add (hand);

            // Make a timeline
            Timeline timeline = new Timeline (100, 26);
            timeline.Loop = true;

            Alpha alpha = new Alpha (timeline, (a) => a.Value);

            Behaviour o_behave = new BehaviourOpacity (alpha, 0x33, 0xff);
            o_behave.Apply (group);

            // Make a path behaviour and apply that too
            Behaviour p_behave = new BehaviourPath(alpha, knots); // fixme: add custom constructor?
            p_behave.Apply (group);

            // start timeline
            timeline.Start ();

            stage.ShowAll();

            // launch
            Application.Run ();
        }
Beispiel #3
0
    public static void Main()
    {
        ClutterRun.Init();
        Gtk.Application.Init();

        Gtk.Window window = new Gtk.Window(WindowType.Toplevel);
        window.DeleteEvent += HandleDelete;
        Toplevel            = window;

        Gtk.VBox vbox = new Gtk.VBox(false, 6);
        window.Add(vbox);

        Embed clutter = new Embed();

        vbox.Add(clutter);

        Stage stage = clutter.Stage as Stage;

        Gtk.Label label = new Gtk.Label("This is a label");
        vbox.PackStart(label, false, false, 0);

        Gtk.Button button = Gtk.Button.NewWithLabel("This is a button...clicky");
        button.Clicked += HandleClickity;
        vbox.PackStart(button, false, false, 0);

        button          = new Gtk.Button(Gtk.Stock.Quit);
        button.Clicked += delegate { Gtk.Application.Quit(); };

        vbox.PackEnd(button, false, false, 0);

        stage.Color = new Clutter.Color(0x61, 0x64, 0x8c, 0xff);

        uint radius = stage.Width / n_hands / 2;

        SuperOH oh = new SuperOH();

        CurrentOH = oh;
        oh.Group  = new Group();
        oh.Hands  = new Actor[n_hands];

        for (int i = 0; i < n_hands; i++)
        {
            Texture hand_text = new Texture("redhand.png");
            uint    w         = hand_text.Width;
            uint    h         = hand_text.Height;

            oh.Hands[i] = hand_text;

            int x = (int)(stage.Width / 2
                          + radius
                          * Math.Cos(i * Math.PI / (n_hands / 2))
                          - w / 2);
            int y = (int)(stage.Height / 2
                          + radius
                          * Math.Sin(i * Math.PI / (n_hands / 2))
                          - h / 2);

            oh.Hands[i].SetPosition(x, y);

            oh.Group.AddActor(oh.Hands[i]);
        }

        oh.Group.ShowAll();

        oh.FadeTimeline      = new Timeline(2000);
        oh.FadeTimeline.Loop = true;
        BehaviourOpacity behaviour = new BehaviourOpacity(new Alpha(oh.FadeTimeline, Sine.Func), 0xff, 0x00);

        behaviour.Apply(oh.Group);

        stage.AddActor(oh.Group);
        stage.ButtonPressEvent += HandleButtonPress;
        stage.KeyPressEvent    += HandleKeyPress;

        stage.ShowAll();

        timeline      = new Timeline(360, 90);
        timeline.Loop = true;

        timeline.NewFrame += HandleNewFrame;

        window.ExposeEvent += delegate { timeline.Start(); };

        window.SetDefaultSize(400, 600);
        window.ShowAll();

        Gtk.Application.Run();
    }