mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-14 13:26:09 +00:00
SDL controller input
This commit is contained in:
@@ -11,33 +11,31 @@ void CInputGenerator::Update(float dt, CArchitectureQueue& queue) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Keyboard/Mouse first */
|
||||
CFinalInput kbInput = getFinalInput(0, dt);
|
||||
bool kbUsed = false;
|
||||
const CFinalInput& kbInput = getFinalInput(0, dt);
|
||||
queue.Push(MakeMsg::CreateUserInput(EArchMsgTarget::Game, kbInput));
|
||||
|
||||
/* Dolphin controllers next */
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
bool connected;
|
||||
EStatusChange change = m_dolphinCb.getStatusChange(i, connected);
|
||||
if (change != EStatusChange::NoChange)
|
||||
queue.Push(MakeMsg::CreateControllerStatus(EArchMsgTarget::Game, i, connected));
|
||||
if (connected) {
|
||||
CFinalInput input = m_dolphinCb.getFinalInput(i, dt, m_leftDiv, m_rightDiv);
|
||||
if (i == 0) /* Merge KB input with first controller */
|
||||
{
|
||||
input |= kbInput;
|
||||
kbUsed = true;
|
||||
}
|
||||
m_lastUpdate = input;
|
||||
queue.Push(MakeMsg::CreateUserInput(EArchMsgTarget::Game, input));
|
||||
}
|
||||
}
|
||||
// for (int i = 0; i < 4; ++i) {
|
||||
// bool connected;
|
||||
// EStatusChange change = m_dolphinCb.getStatusChange(i, connected);
|
||||
// if (change != EStatusChange::NoChange)
|
||||
// queue.Push(MakeMsg::CreateControllerStatus(EArchMsgTarget::Game, i, connected));
|
||||
// if (connected) {
|
||||
// CFinalInput input = m_dolphinCb.getFinalInput(i, dt, m_leftDiv, m_rightDiv);
|
||||
// if (i == 0) /* Merge KB input with first controller */
|
||||
// {
|
||||
// input |= kbInput;
|
||||
// kbUsed = true;
|
||||
// }
|
||||
// m_lastUpdate = input;
|
||||
// queue.Push(MakeMsg::CreateUserInput(EArchMsgTarget::Game, input));
|
||||
// }
|
||||
// }
|
||||
|
||||
/* Send straight keyboard input if no first controller present */
|
||||
if (!kbUsed) {
|
||||
m_lastUpdate = kbInput;
|
||||
queue.Push(MakeMsg::CreateUserInput(EArchMsgTarget::Game, kbInput));
|
||||
}
|
||||
// /* Send straight keyboard input if no first controller present */
|
||||
// if (!kbUsed) {
|
||||
// m_lastUpdate = kbInput;
|
||||
// }
|
||||
}
|
||||
|
||||
} // namespace metaforce
|
||||
|
||||
Reference in New Issue
Block a user