Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
GreepTheSheep opened this issue Jun 9, 2021 · 1 comment
Open

Comments

@GreepTheSheep
Copy link

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

@codecat
Copy link
Owner

codecat commented Jun 10, 2021

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);
			}
		}
	}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants