void OnGUI () { string Str; int NumTouch = 0; if (!m_Initialised) { Str = "TouchTest"; if (Initialise(Str) < 0) { // ERROR STATE } m_Initialised = true; } NumTouch = GetTouchPointCount (); Str = "Number of Touch Points: " + NumTouch.ToString(); GUI.Label (new Rect (10,10,150,40), Str); for (int p=0; p<NumTouch; p++) { tTouchData TouchData = new tTouchData(); GetTouchPoint (p, TouchData); GUI.Label (new Rect (10,10 + (p+1) * 40, 200, 40), "ID:" + TouchData.m_ID + "Time:" + TouchData.m_Time.ToString() + "(" + TouchData.m_x.ToString() + "," + TouchData.m_y.ToString() + ")"); } }
private void Update() { if (IsInitialized()) { DLL_W8GetDesktopRect(out this.m_desktopRect); bool flag = DLL_W8IsVirtualKeyboardVisible(); if (flag != this.m_isVirtualKeyboardVisible) { this.m_isVirtualKeyboardVisible = flag; if (flag && (this.VirtualKeyboardDidShow != null)) { this.VirtualKeyboardDidShow(); } else if (!flag && (this.VirtualKeyboardDidHide != null)) { this.VirtualKeyboardDidHide(); } } if (this.m_isVirtualKeyboardVisible) { this.m_isVirtualKeyboardShowRequested = false; } else { this.m_isVirtualKeyboardHideRequested = false; } PowerSource batteryMode = this.GetBatteryMode(); if (batteryMode != this.m_lastPowerSourceState) { object[] args = new object[] { batteryMode }; Log.Yim.Print("PowerSource Change Detected: {0}", args); this.m_lastPowerSourceState = batteryMode; GraphicsManager.Get().RenderQualityLevel = (GraphicsQuality)Options.Get().GetInt(Option.GFX_QUALITY); } if ((!DLL_W8IsLastEventFromTouch() && UniversalInputManager.Get().IsTouchMode()) || (DLL_W8IsLastEventFromTouch() && !UniversalInputManager.Get().IsTouchMode())) { this.ToggleTouchMode(); } if (this.m_touchState != null) { int num = DLL_W8GetTouchPointCount(); for (int i = 0; i < 5; i++) { tTouchData n = new tTouchData(); bool flag2 = false; if (i < num) { flag2 = DLL_W8GetTouchPoint(i, n); } if (flag2 && (i == 0)) { Vector2 vector = this.TransformTouchPosition(new Vector2((float)n.m_x, (float)n.m_y)); if (((this.m_touchPosition.x != -1f) && (this.m_touchPosition.y != -1f)) && (this.m_touchState[i] == TouchState.Down)) { this.m_touchDelta.x = vector.x - this.m_touchPosition.x; this.m_touchDelta.y = vector.y - this.m_touchPosition.y; } else { this.m_touchDelta.x = this.m_touchDelta.y = 0f; } this.m_touchPosition.x = vector.x; this.m_touchPosition.y = vector.y; } if (flag2 && (n.m_ID != -1)) { if ((this.m_touchState[i] == TouchState.Down) || (this.m_touchState[i] == TouchState.InitialDown)) { this.m_touchState[i] = TouchState.Down; } else { this.m_touchState[i] = TouchState.InitialDown; } } else if ((this.m_touchState[i] == TouchState.Down) || (this.m_touchState[i] == TouchState.InitialDown)) { this.m_touchState[i] = TouchState.InitialUp; } else { this.m_touchState[i] = TouchState.None; } } } } }
public static extern void GetTouchPoint(int i, tTouchData n);