MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / IR_OnKeyboardPress

Method IR_OnKeyboardPress

ogsr_engine/xrGame/ui/UIDialogWnd.cpp:62–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60#define DOUBLE_CLICK_TIME 250
61
62bool CUIDialogWnd::IR_OnKeyboardPress(int dik)
63{
64 if (!IR_process())
65 return false;
66 // mouse click
67 if (dik == MOUSE_1 || dik == MOUSE_2 || dik == MOUSE_3)
68 {
69 Fvector2 cp = GetUICursor()->GetCursorPosition();
70 EUIMessages action = (dik == MOUSE_1) ? WINDOW_LBUTTON_DOWN : (dik == MOUSE_2) ? WINDOW_RBUTTON_DOWN : WINDOW_CBUTTON_DOWN;
71 if (action == WINDOW_LBUTTON_DOWN)
72 {
73 u32 dwCurTime = Device.dwTimeContinual;
74 if (dwCurTime - m_dwLastClickTime < DOUBLE_CLICK_TIME)
75 action = WINDOW_LBUTTON_DB_CLICK;
76 m_dwLastClickTime = dwCurTime;
77 }
78 if (OnMouse(cp.x, cp.y, action))
79 return true;
80 }
81
82 if (OnKeyboard(dik, WINDOW_KEY_PRESSED))
83 return true;
84
85 if (!StopAnyMove() && g_pGameLevel)
86 {
87 CObject* O = Level().CurrentEntity();
88 if (O)
89 {
90 IInputReceiver* IR = smart_cast<IInputReceiver*>(smart_cast<CGameObject*>(O));
91 if (!IR)
92 return (false);
93 IR->IR_OnKeyboardPress(get_binded_action(dik));
94 }
95 }
96 return false;
97}
98
99bool CUIDialogWnd::IR_OnKeyboardRelease(int dik)
100{

Callers

nothing calls this directly

Calls 3

GetUICursorFunction · 0.85
get_binded_actionFunction · 0.85
GetCursorPositionMethod · 0.80

Tested by

no test coverage detected