Example #1
0
        /// <summary>
        /// Construct a new wiimote provider.
        /// </summary>
        public WiiPointerProvider()
        {
            lastpoint   = new WiimoteLib.Point();
            lastpoint.X = 0;
            lastpoint.Y = 0;

            this.settingsControl = new WiiPointerProviderSettings();

            this.ScreenSize = new Vector(Util.ScreenWidth, Util.ScreenHeight);

            this.smoothingBuffer = new SmoothingBuffer(3);

            this.duoTouch = new DuoTouch(Util.ScreenBounds, 3, 1);

            this.keyMapper = new WiiKeyMapper(1);

            this.keyMapper.OnButtonDown    += WiiButton_Down;
            this.keyMapper.OnButtonUp      += WiiButton_Up;
            this.keyMapper.OnConfigChanged += WiiKeyMap_ConfigChanged;
            this.keyMapper.SendConfigChangedEvt();

            this.inputSimulator = new InputSimulator();

            this.showPointer = true;
            if (this.showPointer && !this.mouseMode)
            {
                this.duoTouch.enableHover();
            }
            else
            {
                this.duoTouch.disableHover();
            }

            screenPositionCalculator = new ScreenPositionCalculator();
        }
Example #2
0
        /// <summary>
        /// Construct a new wiimote provider.
        /// </summary>
        public WiiPointerProvider()
        {
            lastpoint = new WiimoteLib.Point();
            lastpoint.X = 0;
            lastpoint.Y = 0;

            this.settingsControl = new WiiPointerProviderSettings();

            this.ScreenSize = new Vector(Util.ScreenWidth, Util.ScreenHeight);

            this.smoothingBuffer = new SmoothingBuffer(3);

            this.duoTouch = new DuoTouch(Util.ScreenBounds, 3, 1);

            this.keyMapper = new WiiKeyMapper(1);

            this.keyMapper.OnButtonDown += WiiButton_Down;
            this.keyMapper.OnButtonUp += WiiButton_Up;
            this.keyMapper.OnConfigChanged += WiiKeyMap_ConfigChanged;
            this.keyMapper.SendConfigChangedEvt();

            this.inputSimulator = new InputSimulator();

            this.showPointer = true;
            if (this.showPointer && !this.mouseMode)
            {
                this.duoTouch.enableHover();
            }
            else
            {
                this.duoTouch.disableHover();
            }

            screenPositionCalculator = new ScreenPositionCalculator();
        }
Example #3
0
        public WiimoteControl(int id, Wiimote wiimote)
        {
            this.Wiimote = wiimote;
            this.Status = new WiimoteStatus();
            this.Status.ID = id;

            this.handlerFactory = new HandlerFactory();

            this.keyMapper = new WiiKeyMapper(id,handlerFactory);

            this.keyMapper.OnButtonDown += WiiButton_Down;
            this.keyMapper.OnButtonUp += WiiButton_Up;
            this.keyMapper.OnConfigChanged += WiiKeyMap_ConfigChanged;
            this.keyMapper.OnRumble += WiiKeyMap_OnRumble;
        }
Example #4
0
        public WiimoteControl(int id, Wiimote wiimote)
        {
            this.Wiimote   = wiimote;
            this.Status    = new WiimoteStatus();
            this.Status.ID = id;

            this.handlerFactory = new HandlerFactory();

            this.keyMapper = new WiiKeyMapper(id, handlerFactory);

            this.keyMapper.OnButtonDown    += WiiButton_Down;
            this.keyMapper.OnButtonUp      += WiiButton_Up;
            this.keyMapper.OnConfigChanged += WiiKeyMap_ConfigChanged;
            this.keyMapper.OnRumble        += WiiKeyMap_OnRumble;
        }
Example #5
0
        public WiimoteControl(int id, Wiimote wiimote)
        {
            this.Wiimote   = wiimote;
            this.Status    = new WiimoteStatus();
            this.Status.ID = id;

            lastpoint = new CursorPos(0, 0, 0);

            this.screenBounds = Util.ScreenBounds;

            ulong touchStartID = (ulong)(id - 1) * 4 + 1; //This'll make sure the touch point IDs won't be the same. DuoTouch uses a span of 4 IDs.

            this.duoTouch  = new DuoTouch(this.screenBounds, Properties.Settings.Default.pointer_positionSmoothing, touchStartID);
            this.keyMapper = new WiiKeyMapper(id);

            this.keyMapper.OnButtonDown    += WiiButton_Down;
            this.keyMapper.OnButtonUp      += WiiButton_Up;
            this.keyMapper.OnConfigChanged += WiiKeyMap_ConfigChanged;
            this.keyMapper.OnRumble        += WiiKeyMap_OnRumble;

            this.inputSimulator           = new InputSimulator();
            this.screenPositionCalculator = new ScreenPositionCalculator();
            this.useCustomCursor          = Settings.Default.pointer_customCursor;
            if (this.useCustomCursor)
            {
                Color myColor = CursorColor.getColor(this.Status.ID);
                this.masterCursor = new D3DCursor((this.Status.ID - 1) * 2, myColor);
                this.slaveCursor  = new D3DCursor((this.Status.ID - 1) * 2 + 1, myColor);

                masterCursor.Hide();
                slaveCursor.Hide();

                D3DCursorWindow.Current.AddCursor(masterCursor);
                D3DCursorWindow.Current.AddCursor(slaveCursor);

                this.keyMapper.SendConfigChangedEvt();
            }
        }
Example #6
0
        public WiimoteControl(int id, Wiimote wiimote)
        {
            this.Wiimote = wiimote;
            this.Status = new WiimoteStatus();
            this.Status.ID = id;

            lastpoint = new CursorPos(0,0,0);

            this.screenBounds = Util.ScreenBounds;

            ulong touchStartID = (ulong)(id - 1) * 4 + 1; //This'll make sure the touch point IDs won't be the same. DuoTouch uses a span of 4 IDs.
            this.duoTouch = new DuoTouch(this.screenBounds, Properties.Settings.Default.pointer_positionSmoothing, touchStartID);
            this.keyMapper = new WiiKeyMapper(id);

            this.keyMapper.OnButtonDown += WiiButton_Down;
            this.keyMapper.OnButtonUp += WiiButton_Up;
            this.keyMapper.OnConfigChanged += WiiKeyMap_ConfigChanged;
            this.keyMapper.OnRumble += WiiKeyMap_OnRumble;

            this.inputSimulator = new InputSimulator();
            this.screenPositionCalculator = new ScreenPositionCalculator();
            this.useCustomCursor = Settings.Default.pointer_customCursor;
            if (this.useCustomCursor)
            {
                Color myColor = CursorColor.getColor(this.Status.ID);
                this.masterCursor = new D3DCursor((this.Status.ID-1)*2,myColor);
                this.slaveCursor = new D3DCursor((this.Status.ID-1)*2+1,myColor);

                masterCursor.Hide();
                slaveCursor.Hide();

                D3DCursorWindow.Current.AddCursor(masterCursor);
                D3DCursorWindow.Current.AddCursor(slaveCursor);

                this.keyMapper.SendConfigChangedEvt();
            }
        }
Example #7
0
        public void ShowLayoutOverlay(WiiKeyMapper keyMapper)
        {
            if (this.hidden)
            {
                this.keyMapper = keyMapper;
                this.keyMapper.SwitchToDefault();
                Dispatcher.BeginInvoke(new Action(delegate()
                {

                    this.baseGrid.Opacity = 0.0;
                    this.baseGrid.Visibility = Visibility.Visible;
                    this.layoutChooserOverlay.Visibility = Visibility.Visible;
                    this.Activate();

                    Color bordercolor = CursorColor.getColor(keyMapper.WiimoteID);
                    bordercolor.ScA = 0.5f;
                    this.titleBorder.BorderBrush = new SolidColorBrush(bordercolor);

                    this.title.Text = "Choose a layout for Wiimote " + keyMapper.WiimoteID;

                    this.layoutList.Children.Clear();
                    foreach (JObject config in this.keyMapper.GetLayoutList())
                    {
                        string name = config.GetValue("Title").ToString();
                        string filename = config.GetValue("Keymap").ToString();
                        LayoutSelectionRow row = new LayoutSelectionRow(name, filename, bordercolor);
                        row.OnClick += Select_Layout;
                        this.layoutList.Children.Add(row);
                    }

                    DoubleAnimation animation = UIHelpers.createDoubleAnimation(1.0, 200, false);
                    animation.FillBehavior = FillBehavior.HoldEnd;
                    animation.Completed += delegate(object sender, EventArgs pEvent)
                    {

                    };
                    this.baseGrid.BeginAnimation(FrameworkElement.OpacityProperty, animation, HandoffBehavior.SnapshotAndReplace);

                    this.hidden = false;
                }), null);
            }
        }
        public void ShowLayoutOverlay(WiiKeyMapper keyMapper)
        {
            if (this.hidden)
            {
                this.keyMapper = keyMapper;
                this.keyMapper.SwitchToDefault();
                this.keyMapper.OnButtonDown += keyMapper_OnButtonDown;
                this.keyMapper.OnButtonUp += keyMapper_OnButtonUp;
                Dispatcher.BeginInvoke(new Action(delegate()
                {

                    this.baseGrid.Opacity = 0.0;
                    this.baseGrid.Visibility = Visibility.Visible;
                    this.layoutChooserOverlay.Visibility = Visibility.Visible;
                    this.Activate();

                    Color bordercolor = CursorColor.getColor(keyMapper.WiimoteID);
                    //bordercolor.ScA = 0.5f;
                    bordercolor.R = (byte)(bordercolor.R * 0.8);
                    bordercolor.G = (byte)(bordercolor.G * 0.8);
                    bordercolor.B = (byte)(bordercolor.B * 0.8);
                    this.titleBorder.BorderBrush = new SolidColorBrush(bordercolor);

                    this.title.Text = "Choose a layout for Wiimote " + keyMapper.WiimoteID;
                    //this.title.Foreground = new SolidColorBrush(bordercolor);

                    this.layoutList.Children.Clear();
                    foreach (LayoutChooserSetting config in this.keyMapper.GetLayoutList())
                    {
                        string name = config.Title;
                        string filename = config.Keymap;
                        LayoutSelectionRow row = new LayoutSelectionRow(name, filename, bordercolor);
                        //row.OnClick += row_OnClick;

                        if(this.keyMapper.GetFallbackKeymap().Equals(filename))
                        {
                            row.setSelected(true);
                        }

                        row.MouseDown += row_MouseDown;
                        row.TouchDown += row_TouchDown;
                        this.layoutList.Children.Add(row);
                    }

                    DoubleAnimation animation = UIHelpers.createDoubleAnimation(1.0, 200, false);
                    animation.FillBehavior = FillBehavior.HoldEnd;
                    animation.Completed += delegate(object sender, EventArgs pEvent)
                    {

                    };
                    this.baseGrid.BeginAnimation(FrameworkElement.OpacityProperty, animation, HandoffBehavior.SnapshotAndReplace);

                    this.hidden = false;
                }), null);
            }
        }