Inheritance: TuioListener, IGestureListener
Ejemplo n.º 1
0
 public RemovingLinkGR(GRConfiguration configuration)
     : base(configuration)
 {
     RemovingLinkGRConfiguration conf = (RemovingLinkGRConfiguration)Configuration;
     m_demoObjectManager = conf.DemoObjectManager;
     DefaultEvents = new string[] { "RemoveLinks" };
     m_linksToRemove = new List<DemoObjectLink>();
 }
Ejemplo n.º 2
0
        public DemoObject(DemoObjectManager objectManager, Viewer viewer, int fiducialId, float x, float y, float angle)
        {
            m_targetRadius = 0.4f;

            m_objectManager = objectManager;
            m_viewer = viewer;
            m_id = fiducialId++;
            m_x = x;
            m_y = y;
            m_angle = angle;

            m_color = new MyColor(s_random.NextDouble(), s_random.NextDouble(), s_random.NextDouble());

            GestureEventManager.SetPriorityNumber(typeof(BasicMultiFingerGR), m_objectManager.BasicMultiFingerGRConf, 0);
            GestureEventManager.RegisterHandler(typeof(BasicMultiFingerGR), m_objectManager.BasicMultiFingerGRConf, "Hover", OnHover);
            GestureEventManager.RegisterHandler(typeof(BasicMultiFingerGR), m_objectManager.BasicMultiFingerGRConf, "EndHover", OnEndHover);
            GestureEventManager.RegisterHandler(typeof(BasicMultiFingerGR), m_objectManager.BasicMultiFingerGRConf, "Tap", OnTap);
            //GestureEventManager.RegisterHandler(typeof(BasicMultiFingerGR), m_objectManager.BasicMultiFingerGRConf, "DoubleTap", OnDoubleTap);

            PinchingGRConfiguration m_pinchingGRConf = new PinchingGRConfiguration(true, this, false);
            GestureEventManager.SetPriorityNumber(typeof(PinchingGR), m_pinchingGRConf, 3);
            GestureEventManager.RegisterHandler(typeof(PinchingGR), m_pinchingGRConf, "Pinch", OnPinch);
        }
Ejemplo n.º 3
0
 // exclusive
 public RemovingLinkGRConfiguration(DemoObjectManager demoObjectManager)
     : base(true)
 {
     m_demoObjectManager = demoObjectManager;
 }
Ejemplo n.º 4
0
        static void Main(String[] argv)
        {
            float x = 0, y = 0, w = 10, h = 10, a = 0;

            int port = 3333;
            switch (argv.Length)
            {
                case 0:
                    break;

                case 1:
                    port = int.Parse(argv[0], null);
                    if (port == 0) goto default;
                    break;

                case 5:
                    x = float.Parse(argv[0], null);
                    y = float.Parse(argv[1], null);
                    w = float.Parse(argv[2], null);
                    h = float.Parse(argv[3], null);
                    a = float.Parse(argv[4], null);
                    break;

                case 6:
                    x = float.Parse(argv[1], null);
                    y = float.Parse(argv[2], null);
                    w = float.Parse(argv[3], null);
                    h = float.Parse(argv[4], null);
                    a = float.Parse(argv[5], null);
                    goto case 1;

                default:
                    Console.WriteLine("Usage: [mono] GrafitiGenericDemo [port] [x y w h a]");
                    System.Environment.Exit(0);
                    break;
            }

            // Force compilation of GR classes
            new PinchingGR();
            new BasicMultiFingerGR();
            new MultiTraceGR();
            new CircleGR();
            new LazoGR();
            new RemovingLinkGR();

            // instantiate viewer
            s_viewer = new Viewer(x, y, w, h, a);

            // instantiate Grafiti
            s_grafitiSurface = Surface.Initialize(s_viewer);

            // instantiate objects' manager
            s_demoObjectManager = new DemoObjectManager(s_viewer);

            // Tuio connections
            s_client = new TuioClient(port);
            s_client.addTuioListener(s_grafitiSurface);
            s_client.addTuioListener(s_demoObjectManager);
            s_client.addTuioListener(s_viewer);
            s_client.connect();

            // initialize glut library
            Glut.glutInit();

            // initialize viewer's graphic
            s_viewer.Init();

            // register callback functions
            Glut.glutKeyboardFunc(new Glut.KeyboardCallback(S_KeyPressed));
            Glut.glutSpecialFunc(new Glut.SpecialCallback(S_SpecialKeyPressed));
            Glut.glutDisplayFunc(new Glut.DisplayCallback(S_Display));
            Glut.glutReshapeFunc(new Glut.ReshapeCallback(S_Reshape));
            Glut.glutTimerFunc(40, new Glut.TimerCallback(S_Timer), 0);

            // main loop
            try
            {
                Glut.glutMainLoop();
            }
            catch (ThreadAbortException e)
            {
                Exit();
            }
        }