Пример #1
0
        protected override void OnMouseMove(System.Windows.Forms.MouseEventArgs e)
        {
            if (Capture)
            {
                UrhoBackend.Vector2 delta = new UrhoBackend.Vector2(e.X, e.Y);
                delta.op_SubtractionAssignment(lastPosition);

                UrhoBackend.VariantMap eventData = new UrhoBackend.VariantMap();
                eventData.Set("X", new UrhoBackend.Variant(e.X));
                eventData.Set("Y", new UrhoBackend.Variant(e.Y));
                eventData.Set("DX", new UrhoBackend.Variant((int)delta.x));
                eventData.Set("DY", new UrhoBackend.Variant((int)delta.y));

                if (e.Button == System.Windows.Forms.MouseButtons.Left)
                {
                    eventData.Set("Buttons", new UrhoBackend.Variant((int)0));
                }
                if (e.Button == System.Windows.Forms.MouseButtons.Right)
                {
                    eventData.Set("Buttons", new UrhoBackend.Variant((int)1));
                }
                if (e.Button == System.Windows.Forms.MouseButtons.Middle)
                {
                    eventData.Set("Buttons", new UrhoBackend.Variant((int)2));
                }

                SendEvent("MouseMove", eventData);

                lastPosition.x = e.X;
                lastPosition.y = e.Y;
            }
            base.OnMouseMove(e);
        }
Пример #2
0
        public void OnLogMessage(uint eventType, UrhoBackend.VariantMap eventData)
        {
            int    level = eventData.Get("Level").GetInt();
            string msg   = eventData.Get("Message").GetString();

            AddLogMessage(msg);
        }