private void UpdateCurrentTouch() { if (Touches.Count > 0) { CurrentTouch = Touches.Dequeue(); } }
public MultiTouch(NativeOSWindow nativeWindow, Touches touches) : base(touches) { callbackHandler = new CallbackHandler(); Log.Info("Activating MultiTouch on window {0}", nativeWindow._NativePtr); nativeMultiTouch = callbackHandler.create(this, nativeWindow); }
protected override void Update(GameTime gameTime) { var currentUpdate = DateTime.Now; var delta = (currentUpdate - previousUpdate).TotalSeconds; if (delta > 0.25) { delta = 0.25; } previousUpdate = currentUpdate; accumulator = accumulator + delta; Touches.Clear(); var mouse = Mouse.GetState(); if (mouse.LeftButton == ButtonState.Pressed) { Touches.Add(Camera.GetWorldPosition(mouse.Position.ToVector2())); } if (accumulator >= dt) { base.Update(gameTime); accumulator = accumulator - dt; } else { SuppressDraw(); } FrameCounter.Update(accumulator); }
public VEnvironmentData(NotuiElement element) { _element = element; TypeCSharpName = element.GetType().GetCSharpName(); element.OnMainLoopEnd += (sender, args) => { Touches.AssignFrom(_element.Touching.Keys); TouchesHitting.AssignFrom(_element.Touching.Values.Select(t => t != null)); TouchingIntersections.AssignFrom(_element.Touching.Values.Where(t => t != null)); HittingTouches.AssignFrom(_element.Hitting.Keys); HittingIntersections.AssignFrom(_element.Hitting.Values); Mice.AssignFrom(_element.Mice.Select(t => t.AttachadMouse)); Children.AssignFrom(_element.Children.Values); Behaviors.AssignFrom(_element.Behaviors); if (_element.Parent == null) { Parent.SliceCount = 0; } else { Parent.SliceCount = 1; Parent[0] = element.Parent; } VDispTr = _element.DisplayMatrix.AsVMatrix4X4(); }; }
public override TouchHardware createTouchHardware(Touches touches) { if (enableMultitouch && MultiTouch.IsAvailable) { return(new MultiTouch(window, touches)); } return(null); }
/// <summary> /// Constructor. /// </summary> /// <param name="eventManager">The EventManager to use.</param> /// <param name="inputHandler">The InputHandler to use.</param> /// <param name="window">The window to show the onscreen keyboard on.</param> /// <param name="lastEventLayer">The last event layer in the eventManager.</param> public TouchMouseGuiForwarder(EventManager eventManager, InputHandler inputHandler, SystemTimer systemTimer, NativeOSWindow window, Object lastEventLayer) { this.touches = eventManager.Touches; this.touches.FingerStarted += HandleFingerStarted; this.inputHandler = inputHandler; this.window = window; this.systemTimer = systemTimer; }
public WacomTouchReport(byte[] report, ref TouchPoint[] prevTouches) { Raw = report; AuxButtons = Array.Empty <bool>(); Touches = prevTouches ?? new TouchPoint[MAX_POINTS]; if (report[2] == 0x81) { ApplyTouchMask((ushort)(Raw[3] | (Raw[4] << 8))); prevTouches = (TouchPoint[])Touches.Clone(); return; } var nChunks = Raw[1]; for (var i = 0; i < nChunks; i++) { var offset = (i << 3) + 2; var touchID = Raw[offset]; if (touchID == 0x80) { var auxByte = report[1 + offset]; AuxButtons = new bool[] { auxByte.IsBitSet(0), auxByte.IsBitSet(1), auxByte.IsBitSet(2), auxByte.IsBitSet(3), }; continue; } touchID -= 2; if (touchID >= MAX_POINTS) { continue; } var touchState = Raw[1 + offset]; if (touchState == 0x20) { Touches[touchID] = null; } else { Touches[touchID] = new TouchPoint { TouchID = touchID, Position = new Vector2 { X = (Raw[2 + offset] << 4) | (Raw[4 + offset] >> 4), Y = (Raw[3 + offset] << 4) | (Raw[4 + offset] & 0xF) }, }; } } prevTouches = (TouchPoint[])Touches.Clone(); }
public WacomTouchReport(byte[] report) { Raw = report; AuxButtons = new bool[0]; Touches = prevTouches ?? new TouchPoint[MAX_POINTS]; if (report[2] == 0x81) { ApplyTouchMask((ushort)(Raw[3] | (Raw[4] << 8))); prevTouches = (TouchPoint[])Touches.Clone(); return; } var nChunks = Raw[1]; for (var i = 0; i < nChunks; i++) { var offset = (i << 3) + 2; var touchID = Raw[offset]; if (touchID == 0x80) { AuxButtons = new bool[] { (report[1 + offset] & (1 << 0)) != 0, (report[1 + offset] & (1 << 1)) != 0, (report[1 + offset] & (1 << 2)) != 0, (report[1 + offset] & (1 << 3)) != 0 }; continue; } touchID -= 2; if (touchID >= MAX_POINTS) { continue; } var touchState = Raw[1 + offset]; if (touchState == 0x20) { Touches[touchID] = null; } else { Touches[touchID] = new TouchPoint { TouchID = touchID, Position = new Vector2 { X = (Raw[2 + offset] << 4) | (Raw[4 + offset] >> 4), Y = (Raw[3 + offset] << 4) | (Raw[4 + offset] & 0xF) }, }; } } prevTouches = (TouchPoint[])Touches.Clone(); }
protected override void Update(GameTime gameTime) { var state = TouchPanel.GetState(); Touches.Clear(); for (int i = 0; i < state.Count; i++) { if (state[i].State > 0) { Touches.Add(Camera.GetWorldPosition(state[i].Position)); } } base.Update(gameTime); }
/// <summary> /// <see cref="ISingleTouchObserver.OnTouchEnded" /> /// </summary> public void OnTouchEnded(Touch touch) { if (Touches.Contains(touch)) { if (Surface != null && Tool != null) { Tool.OnTouchEnded(Surface, touch); } } Touches.Remove(touch); if (Touches.Count == 0 && DrawingEnded != null) { DrawingEnded(this); } }
void ProcessTouchEvent(Touches touch) { int ID = touch.GetID(); if (touchList.ContainsKey(ID)) { touch.SetGesture(Touches.GESTURE_MOVE); touchList.Remove(ID); } else { touch.SetGesture(Touches.GESTURE_DOWN); } touchList.Add(ID, touch); SendTouchEvent(touch); }
/// <summary> /// <see cref="ISingleTouchObserver.OnTouchMoved" /> /// </summary> public void OnTouchMoved(Touch touch) { if (Touches.Contains(touch)) { if (Surface != null && Tool != null) { Tool.OnTouchMoved(Surface, touch); } } else if (IsAllowedToDrawWithTouch == null || IsAllowedToDrawWithTouch(touch)) { if (Surface != null && Tool != null) { Touches.Add(touch); if (Touches.Count == 1 && DrawingBegan != null) { DrawingBegan(this); } Tool.OnTouchBegan(Surface, touch); } } }
void SendTouchEvent(Touches touch) { // Draw touch ray Ray ray = touch.GetRay(); Debug.DrawRay(ray.origin, ray.direction * 10, Color.white); GameObject[] touchObjects = GameObject.FindGameObjectsWithTag("OmegaListener"); foreach (GameObject touchObj in touchObjects) { touchObj.BroadcastMessage("OnTouch", touch, SendMessageOptions.DontRequireReceiver); } // Send a RayCast from source along ray looking for colliders //RaycastHit hit; //if( Physics.Raycast(ray.origin, ray.direction, out hit) ){ // If a visible collider is hit, tell object it has been hit. //Debug.Log(hit.collider.gameObject.name); //hit.collider.gameObject.BroadcastMessage("OnTouch",touch); //} }
public IntuosV3TouchReport(byte[] report) { Raw = report; Touches = prevTouches ?? new TouchPoint[MAX_POINTS]; for (var i = 0; i < 5; i++) { var offset = (i << 3) + 2; var touchID = Raw[offset]; if (touchID == 0) { continue; } touchID -= 1; if (touchID >= MAX_POINTS) { continue; } var touchState = Raw[1 + offset]; if (touchState == 0) { Touches[touchID] = null; } else { Touches[touchID] = new TouchPoint { TouchID = touchID, Position = new Vector2 { X = BitConverter.ToUInt16(Raw, 2 + offset), Y = BitConverter.ToUInt16(Raw, 4 + offset), }, }; } } prevTouches = (TouchPoint[])Touches.Clone(); }
public IntuosV2TouchReport(byte[] report) { Raw = report; Touches = prevTouches ?? new TouchPoint[MAX_POINTS]; for (var i = 0; i < 5; i++) { var offset = (i << 3) + 2; var touchID = Raw[offset]; if (touchID == 0) { continue; } touchID -= 1; if (touchID >= MAX_POINTS) { continue; } var touchState = Raw[1 + offset]; if (touchState == 0) { Touches[touchID] = null; } else { Touches[touchID] = new TouchPoint { TouchID = touchID, Position = new Vector2 { X = Unsafe.ReadUnaligned <ushort>(ref report[2 + offset]), Y = Unsafe.ReadUnaligned <ushort>(ref report[4 + offset]), }, }; } } prevTouches = (TouchPoint[])Touches.Clone(); }
public string ToString(string formatString, string gameTime) { //Concatenate the in game prefix (should show *SG* if in at SG) prior to the name var name = FullName; if (gameTime != "FINAL") { name = InGame + name; } var min = MinutesPlayed.ToString(CultureInfo.InvariantCulture); var fg = FGM.ToString(CultureInfo.InvariantCulture) + "-" + FGA.ToString(CultureInfo.InvariantCulture); var threeP = ThreePM.ToString(CultureInfo.InvariantCulture) + "-" + ThreePA.ToString(CultureInfo.InvariantCulture); var ft = FTM.ToString(CultureInfo.InvariantCulture) + "-" + FTA.ToString(CultureInfo.InvariantCulture); var pts = Points.ToString(CultureInfo.InvariantCulture); var oreb = OffRebounds.ToString(CultureInfo.InvariantCulture); var dreb = DefRebounds.ToString(CultureInfo.InvariantCulture); var reb = Rebounds.ToString(CultureInfo.InvariantCulture); var ast = Assists.ToString(CultureInfo.InvariantCulture); var stl = Steals.ToString(CultureInfo.InvariantCulture); var blk = Blocks.ToString(CultureInfo.InvariantCulture); var to = Turnovers.ToString(CultureInfo.InvariantCulture); var pf = Fouls.ToString(CultureInfo.InvariantCulture); var pm = PlusMinus.ToString(CultureInfo.InvariantCulture); var prf = PointsResponsibleFor.ToString(CultureInfo.InvariantCulture); var pip = PointsInPaint.ToString(CultureInfo.InvariantCulture); var secChP = SecondChancePoints.ToString(CultureInfo.InvariantCulture); var fbPts = FastBreakPoints.ToString(CultureInfo.InvariantCulture); var ptsTO = PointsOffTurnovers.ToString(CultureInfo.InvariantCulture); var dunks = Dunks.ToString(CultureInfo.InvariantCulture); var touches = Touches.ToString(CultureInfo.InvariantCulture); var touchTime = Math.Round(TouchTime, 0, MidpointRounding.AwayFromZero).ToString(CultureInfo.InvariantCulture); var stats = string.Format(formatString, name, min, fg, threeP, ft, pts, oreb, dreb, reb, ast, stl, blk, to, pf, pm, prf, pip, secChP, fbPts, ptsTO, dunks, touches, touchTime); return(stats); }
public bool equals(Touches enumT) { return(touches == enumT); }
void Touches_AllFingersReleased(Touches obj) { currentGesture = Gesture.None; }
public virtual void Initialize(PTouch initPoint) { BaseShape.AddStartPoint(initPoint.Position); Touches.Add(initPoint); }
/// <summary> /// HasCode getter /// </summary> /// <returns></returns> public override int GetHashCode() { return(Touches.GetHashCode()); }
void SendTouchEvent( Touches touch ) { // Draw touch ray Ray ray = touch.GetRay(); Debug.DrawRay(ray.origin, ray.direction * 10, Color.white); GameObject[] touchObjects = GameObject.FindGameObjectsWithTag("OmegaListener"); foreach (GameObject touchObj in touchObjects) { touchObj.BroadcastMessage("OnTouch",touch,SendMessageOptions.DontRequireReceiver); } // Send a RayCast from source along ray looking for colliders //RaycastHit hit; //if( Physics.Raycast(ray.origin, ray.direction, out hit) ){ // If a visible collider is hit, tell object it has been hit. //Debug.Log(hit.collider.gameObject.name); //hit.collider.gameObject.BroadcastMessage("OnTouch",touch); //} }
void ProcessTouchEvent( Touches touch ) { int ID = touch.GetID(); if( touchList.ContainsKey( ID ) ){ touch.SetGesture(Touches.GESTURE_MOVE); touchList.Remove( ID ); } else { touch.SetGesture(Touches.GESTURE_DOWN); } touchList.Add( ID, touch ); SendTouchEvent( touch ); }
public void Update(PTouch updatePoint) { BaseShape.AddUpdatePoint(updatePoint.Position); Touches.Add(updatePoint); }
public void AddTouches(Center center) { Touches.Add(center); }
public new virtual bool TouchedBefore(User user, DateTime datetime) { return(Touches.Any(x => x.User == user && x.DateTime < datetime) && Actions.All(x => x.TouchedBefore(user, datetime))); }
void Awake() { touches = gameMain.GetComponent <Touches>(); rb = GetComponent <Rigidbody>(); playerrb = playerMain.GetComponent <Rigidbody>(); }
// Update is called once per frame void Update() { lock (dgrams.SyncRoot) { foreach (String dgram in dgrams) { ParseDGram(dgram); } dgrams.Clear(); } if (ping) { // Translate the passed message into ASCII and store it as a Byte array. client = new TcpClient(InputServer, msgPort); String message = "client_in,101,one ping only"; Byte[] data = System.Text.Encoding.ASCII.GetBytes(message); streamToServer = client.GetStream(); // Send the message to the server. streamToServer.Write(data, 0, data.Length); Debug.Log("Ping sent"); ping = false; } Hashtable tempList = new Hashtable(touchList); foreach (DictionaryEntry elem in tempList) { //Console.WriteLine("Key = {0}, Value = {1}", elem.Key, elem.Value); Touches t = (Touches)elem.Value; long timeStamp = t.GetTimeStamp(); DateTime baseTime = new DateTime(1970, 1, 1, 0, 0, 0); long curTime = (DateTime.UtcNow - baseTime).Ticks / 10000; if (timeStamp + touchTimeOut < curTime) { t.SetGesture(Touches.GESTURE_UP); SendTouchEvent(t); touchList.Remove(t.GetID()); } } // Emulates mouse input as touch events if (Input.GetMouseButtonDown(0)) { MouseTouch = new Touches(Input.mousePosition, -1); MouseTouch.SetGesture(Touches.GESTURE_DOWN); SendTouchEvent(MouseTouch); } else if (Input.GetMouseButtonUp(0)) { MouseTouch = new Touches(Input.mousePosition, -1); MouseTouch.SetGesture(Touches.GESTURE_UP); SendTouchEvent(MouseTouch); } else if (Input.GetMouseButton(0)) { MouseTouch = new Touches(Input.mousePosition, -1); MouseTouch.SetGesture(Touches.GESTURE_MOVE); SendTouchEvent(MouseTouch); } else { MouseTouch = null; } }
public new virtual bool Touched(User user) { return(Touches.Any(x => x.User == user) && Actions.All(x => x.Touched(user))); }
// Update is called once per frame void Update() { lock(dgrams.SyncRoot) { foreach (String dgram in dgrams) { ParseDGram(dgram); } dgrams.Clear(); } if( ping ){ // Translate the passed message into ASCII and store it as a Byte array. client = new TcpClient(InputServer, msgPort); String message = "client_in,101,one ping only"; Byte[] data = System.Text.Encoding.ASCII.GetBytes(message); streamToServer = client.GetStream(); // Send the message to the server. streamToServer.Write(data, 0, data.Length); Debug.Log("Ping sent"); ping = false; } Hashtable tempList = new Hashtable(touchList); foreach( DictionaryEntry elem in tempList ) { //Console.WriteLine("Key = {0}, Value = {1}", elem.Key, elem.Value); Touches t = (Touches)elem.Value; long timeStamp = t.GetTimeStamp(); DateTime baseTime = new DateTime(1970, 1, 1, 0, 0, 0); long curTime = (DateTime.UtcNow - baseTime).Ticks / 10000; if( timeStamp + touchTimeOut < curTime ){ t.SetGesture(Touches.GESTURE_UP); SendTouchEvent( t ); touchList.Remove( t.GetID() ); } } // Emulates mouse input as touch events if( Input.GetMouseButtonDown(0) ) { MouseTouch = new Touches( Input.mousePosition, -1 ); MouseTouch.SetGesture(Touches.GESTURE_DOWN); SendTouchEvent(MouseTouch); } else if( Input.GetMouseButtonUp(0) ) { MouseTouch = new Touches( Input.mousePosition, -1 ); MouseTouch.SetGesture(Touches.GESTURE_UP); SendTouchEvent(MouseTouch); } else if( Input.GetMouseButton(0) ) { MouseTouch = new Touches( Input.mousePosition, -1 ); MouseTouch.SetGesture(Touches.GESTURE_MOVE); SendTouchEvent(MouseTouch); } else { MouseTouch = null; } }