summaryrefslogtreecommitdiff
path: root/unsorted/evas/evas_mono_rectangle.cs
blob: 0b363a7602771829cdfda01522d69bcafcdac2c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System;

class TestMain
{
    private static int[,] colors = new int[,] {
        {255, 0, 0},
        {0, 255, 0},
        {0, 0, 255}
    };

    static void Main(string[] args)
    {
        int color_index = 0;

        Efl.All.Init();

        Efl.Loop loop = new Efl.Loop();
        EcoreEvas ecore_evas = new EcoreEvas();
        Efl.Canvas.Object canvas = ecore_evas.canvas;
        canvas.SetVisible(true);

        Efl.Object parent = canvas.GetParent();
        System.Diagnostics.Debug.Assert(parent.raw_handle != IntPtr.Zero);

        Efl.Canvas.Rectangle rect = new Efl.Canvas.Rectangle(canvas);
        rect.SetColor(colors[0, 0], colors[0, 1], colors[0, 2], 255);
        Eina.Size2D size = new Eina.Size2D();
        size.W = 640;
        size.H = 480;
        rect.SetSize(size);
        rect.SetVisible(true);

        canvas.KeyDownEvt += (object sender, Efl.Input.Interface.KeyDownEvt_Args e) => {
            color_index = (color_index + 1) % 3;
            Console.WriteLine("Key Down");
            Console.WriteLine("Got key obj at {0}", e.arg.raw_handle.ToString("X"));
            Console.WriteLine("Got key_get() == [{0}]", e.arg.GetKey());
            rect.SetColor(colors[color_index, 0],
                          colors[color_index, 1],
                          colors[color_index, 2], 255);
        };

        loop.Begin();

        Efl.All.Shutdown();
    }
}