public bool setPosition(string key, Provider.CursorPos cursorPos) { if (key.ToLower().Equals("touch")) { positionToPush = cursorPos; return(true); } return(false); }
private void setPosition(Provider.CursorPos cursorPos) { if (!mightTimeOut) { timeoutCursorPos = cursorPos; this.timeoutTimer.Start(); } if (!this.touchDownMaster && !this.touchDownSlave && Math.Abs(this.timeoutCursorPos.X - cursorPos.X) < Settings.Default.pointer_cursorStillThreshold && Math.Abs(this.timeoutCursorPos.Y - cursorPos.Y) < Settings.Default.pointer_cursorStillThreshold) { this.mightTimeOut = true; } else { this.mightTimeOut = false; this.timedOut = false; this.timeoutTimer.Stop(); } if (!cursorPos.OutOfReach && !timedOut) { if (timedOut) { this.timedOut = false; } Queue <WiiContact> lFrame = new Queue <WiiContact>(1); // Store the state. if (this.usingCursors()) { this.masterCursor.Show(); } //significant = true; if (this.touchDownMaster) { duoTouch.setContactMaster(); } else { duoTouch.releaseContactMaster(); } duoTouch.setMasterPosition(new System.Windows.Point(cursorPos.X, cursorPos.Y)); if (this.touchDownSlave) { if (this.usingCursors()) { this.slaveCursor.Show(); } duoTouch.setSlavePosition(new System.Windows.Point(cursorPos.X, cursorPos.Y)); duoTouch.setContactSlave(); } else { duoTouch.releaseContactSlave(); if (this.usingCursors()) { this.slaveCursor.Hide(); } } lastCursorPos = cursorPos; lFrame = duoTouch.getFrame(); foreach (WiiContact contact in lFrame) { this.handler.queueContact(contact); } if (this.usingCursors()) { WiiContact master = null; WiiContact slave = null; foreach (WiiContact contact in lFrame) { if (master == null) { master = contact; } else if (master.Priority > contact.Priority) { slave = master; master = contact; } else { slave = contact; } } if (master != null) { this.masterCursor.SetPosition(master.Position); this.masterCursor.SetRotation(cursorPos.Rotation); } if (slave != null) { this.slaveCursor.SetPosition(slave.Position); this.slaveCursor.SetRotation(cursorPos.Rotation); } } } else //pointer out of reach { if (this.usingCursors()) { this.masterCursor.Hide(); this.masterCursor.SetPosition(new System.Windows.Point(cursorPos.X, cursorPos.Y)); } } }