private void OnDPadPress(object sender, GamepadDPadEventArgs evt) { Text = "DPad pressed"; bool DownIsDown = (evt.Buttons & GamepadButtons.DPadDown) != 0; bool LeftIsDown = (evt.Buttons & GamepadButtons.DPadLeft) != 0; bool RightIsDown = (evt.Buttons & GamepadButtons.DPadRight) != 0; bool UpIsDown = (evt.Buttons & GamepadButtons.DPadUp) != 0; // double x=0.0, y = 0.0, z = 0.0; double deltaz = 2000 / myStage.ZCountsPerInch; if (UpIsDown || DownIsDown) { if (UpIsDown) { // myStage.GetPos(ref x, ref y, ref z); myStage.MoveToRel(0, 0, deltaz); } if (DownIsDown) { // myStage.GetPos(ref x, ref y, ref z); myStage.MoveToRel(0, 0, -deltaz); } } Thread.Sleep(50); }
private void OnDPadPress(object sender, GamepadDPadEventArgs args) { ButtonConfig currentButton = GetCurrentButton(args.Buttons); if (lastDPadButton == null) { if (currentButton != null) { OnButtonDown?.Invoke(this, new GamepadHelperEventArgs(currentButton)); } lastDPadButton = currentButton; } else { if (lastDPadButton != currentButton) { if (lastDPadButton != null) { OnButtonUp?.Invoke(this, new GamepadHelperEventArgs(lastDPadButton)); } if (currentButton != null) { OnButtonDown?.Invoke(this, new GamepadHelperEventArgs(currentButton)); } lastDPadButton = currentButton; } } }
private void OnDPadPress(object sender, GamepadDPadEventArgs evt) { Text = "DPad pressed"; bool DownIsDown = (evt.Buttons & GamepadButtons.DPadDown) != 0; bool LeftIsDown = (evt.Buttons & GamepadButtons.DPadLeft) != 0; bool RightIsDown = (evt.Buttons & GamepadButtons.DPadRight) != 0; bool UpIsDown = (evt.Buttons & GamepadButtons.DPadUp) != 0; double x, y, z; double deltaz = 0.05; if (UpIsDown || DownIsDown) { if (UpIsDown) { myStage.GetPos(out x, out y, out z); myStage.MoveTo(x, y, z + deltaz, false); } if (DownIsDown) { myStage.GetPos(out x, out y, out z); myStage.MoveTo(x, y, z - deltaz, false); } } Thread.Sleep(50); }
private void OnDPadChange(object sender, GamepadDPadEventArgs evt) { // Reset //DPadDownHighlight.Visible = false; //DPadDownLeftHighlight.Visible = false; //DPadDownRightHighlight.Visible = false; //DPadLeftHighlight.Visible = false; //DPadLeftHighlight.Visible = false; //DPadRightHighlight.Visible = false; //DPadUpHighlight.Visible = false; //DPadUpLeftHighlight.Visible = false; //DPadUpRightHighlight.Visible = false; bool DownIsDown = (evt.Buttons & GamepadButtons.DPadDown) != 0; bool LeftIsDown = (evt.Buttons & GamepadButtons.DPadLeft) != 0; bool RightIsDown = (evt.Buttons & GamepadButtons.DPadRight) != 0; bool UpIsDown = (evt.Buttons & GamepadButtons.DPadUp) != 0; //if (DownIsDown) DPadDownHighlight.Visible = true; //if (LeftIsDown) DPadLeftHighlight.Visible = true; //if (RightIsDown) DPadRightHighlight.Visible = true; //if (UpIsDown) DPadUpHighlight.Visible = true; //if (DownIsDown && LeftIsDown) //{ // DPadDownHighlight.Visible = false; // DPadLeftHighlight.Visible = false; // DPadDownLeftHighlight.Visible = true; //} //if (DownIsDown && RightIsDown) //{ // DPadDownHighlight.Visible = false; // DPadRightHighlight.Visible = false; // DPadDownRightHighlight.Visible = true; //} //if (UpIsDown && LeftIsDown) //{ // DPadUpHighlight.Visible = false; // DPadLeftHighlight.Visible = false; // DPadUpLeftHighlight.Visible = true; //} //if (UpIsDown && RightIsDown) //{ // DPadUpHighlight.Visible = false; // DPadRightHighlight.Visible = false; // DPadUpRightHighlight.Visible = true; //} }
private void OnDPadRelease(object sender, GamepadDPadEventArgs evt) { Text = "DPad released"; myStage.Stop(); }