tm-dashboard icon indicating copy to clipboard operation
tm-dashboard copied to clipboard

Keyboard - Not switching from pad to kb when using WASD (ZQSD)

Open GreepTheSheep opened this issue 3 years ago • 1 comments

When using array keys, the overlay switch well from pad to keyboard, but when using WASD (or ZQSD in french keyboards), it won't switch

GreepTheSheep avatar Jun 09 '21 20:06 GreepTheSheep

This is a little complicated, because the input events are not directly accessible to us. I see script input events in CInputScriptManager which could be helpful here, as this is how Maniascript detects the active pad:

// Detect active pad
foreach (Event in PendingEvents) {
	if (Event.Type == CMlScriptEvent::Type::KeyPress) {
		foreach (Pad in Input.Pads) {
			if (Pad.Type == CInputPad::EPadType::Keyboard) {
				if (ActivePadId != Pad.Id) {
					ActivePadId = Pad.Id;
					if (Frame_Helper.Visible) {
						UpdateLabels(Label_Respawn, Label_Restart, ActivePadId);
					}
				}
				break;
			}
		}
	}
}
foreach (Event in Input.PendingEvents) {
	if (Event.Type == CInputEvent::EType::PadButtonPress) {
		if (Event.Pad != Null && ActivePadId != Event.Pad.Id) {
			ActivePadId = Event.Pad.Id;
			if (Frame_Helper.Visible) {
				UpdateLabels(Label_Respawn, Label_Restart, ActivePadId);
			}
		}
	}
}

codecat avatar Jun 10 '21 11:06 codecat