MCPcopy Create free account
hub / github.com/crossuo/crossuo / OnTextInput

Method OnTextInput

src/ScreenStages/GameScreen.cpp:2676–2702  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2674}
2675
2676void CGameScreen::OnTextInput(const TextEvent &ev)
2677{
2678 if (g_EntryPointer == nullptr)
2679 {
2680 return; //Ignore no print keys
2681 }
2682
2683 const auto ch = EvChar(ev);
2684 if (g_EntryPointer != &g_GameConsole && ch != 0x11 && ch != 0x17)
2685 {
2686 if (g_GumpManager.OnTextInput(ev, false))
2687 {
2688 return;
2689 }
2690 }
2691
2692 const auto mod = SDL_GetModState();
2693 const bool altGR = (mod & KMOD_RALT) != 0;
2694 const bool altPressed = (mod & KMOD_ALT) != 0;
2695 const bool ctrlPressed = (mod & KMOD_CTRL) != 0;
2696
2697 if ((altGR || (!altPressed && !ctrlPressed)) &&
2698 (int)g_EntryPointer->Length() < std::max(g_EntryPointer->MaxLength, 60))
2699 {
2700 g_EntryPointer->Insert(ch);
2701 }
2702}
2703
2704void CGameScreen::OnKeyDown(const KeyEvent &ev)
2705{

Callers

nothing calls this directly

Calls 3

SDL_GetModStateFunction · 0.85
LengthMethod · 0.80
InsertMethod · 0.45

Tested by

no test coverage detected