| 520 | } |
| 521 | |
| 522 | fBool AppFrame::GetKeyState(int VKCode)LNOEXCEPT |
| 523 | { |
| 524 | if (VKCode > 0 && VKCode < _countof(m_KeyStateMap)) |
| 525 | { |
| 526 | if (LJOYSTICK1_MAPPING_START <= VKCode && VKCode <= LJOYSTICK1_MAPPING_END) // joystick1映射区域 |
| 527 | { |
| 528 | if (m_Joystick[0]) |
| 529 | { |
| 530 | switch (VKCode) |
| 531 | { |
| 532 | case LJOYSTICK1_MAPPING_START: // 上 |
| 533 | return (m_Joystick[0]->GetYPosition() < LJOYSTICK_Y_MIN); |
| 534 | case LJOYSTICK1_MAPPING_START + 1: // 下 |
| 535 | return (m_Joystick[0]->GetYPosition() > LJOYSTICK_Y_MAX); |
| 536 | case LJOYSTICK1_MAPPING_START + 2: // 左 |
| 537 | return (m_Joystick[0]->GetXPosition() < LJOYSTICK_X_MIN); |
| 538 | case LJOYSTICK1_MAPPING_START + 3: // 右 |
| 539 | return (m_Joystick[0]->GetXPosition() > LJOYSTICK_X_MAX); |
| 540 | default: |
| 541 | return m_Joystick[0]->IsButtonDown(VKCode - LJOYSTICK1_MAPPING_START - 4); |
| 542 | } |
| 543 | } |
| 544 | else |
| 545 | return false; |
| 546 | } |
| 547 | else if (LJOYSTICK2_MAPPING_START <= VKCode && VKCode <= LJOYSTICK2_MAPPING_END) // joystick2映射区域 |
| 548 | { |
| 549 | if (m_Joystick[1]) |
| 550 | { |
| 551 | switch (VKCode) |
| 552 | { |
| 553 | case LJOYSTICK2_MAPPING_START: // 上 |
| 554 | return (m_Joystick[1]->GetYPosition() < LJOYSTICK_Y_MIN); |
| 555 | case LJOYSTICK2_MAPPING_START + 1: // 下 |
| 556 | return (m_Joystick[1]->GetYPosition() > LJOYSTICK_Y_MAX); |
| 557 | case LJOYSTICK2_MAPPING_START + 2: // 左 |
| 558 | return (m_Joystick[1]->GetXPosition() < LJOYSTICK_X_MIN); |
| 559 | case LJOYSTICK2_MAPPING_START + 3: // 右 |
| 560 | return (m_Joystick[1]->GetXPosition() > LJOYSTICK_X_MAX); |
| 561 | default: |
| 562 | return m_Joystick[1]->IsButtonDown(VKCode - LJOYSTICK2_MAPPING_START - 4); |
| 563 | } |
| 564 | } |
| 565 | else |
| 566 | return false; |
| 567 | } |
| 568 | else if (m_Keyboard) |
| 569 | return m_Keyboard->IsKeyDown(VKKeyToF2DKey(VKCode)); |
| 570 | else |
| 571 | return m_KeyStateMap[VKCode]; |
| 572 | } |
| 573 | return false; |
| 574 | } |
| 575 | |
| 576 | LNOINLINE int AppFrame::GetLastChar(lua_State* L)LNOEXCEPT |
| 577 | { |
nothing calls this directly
no test coverage detected