| 101 | } |
| 102 | |
| 103 | void ExtensionState::OnInputEvent(SDL_Event* event, int& result) |
| 104 | { |
| 105 | // Only dispatch cancelable events from the SDL thread |
| 106 | // (i.e. where we need immediate feedback from Lua code); |
| 107 | // others are deferred to the client update loop |
| 108 | if (Lua && Lua->IsEventCancelable(event)) { |
| 109 | ContextGuard ctx(ContextType::Client); |
| 110 | LuaClientPin lua(*this); |
| 111 | if (lua) { |
| 112 | lua->OnInputEvent(event, &result); |
| 113 | } |
| 114 | } else { |
| 115 | deferredInputEvents_.push(*event); |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | END_NS() |
no test coverage detected