Group mouse move events from C API function
Groups together consecutive mouse move events like done in core.step() lua function but on the C side. It does not introduce any meaningful speedup but it theory is more efficient and simplifies the Lua code. The simplification of the Lua code alone is enough to justify this change?
This commit is contained in:
1 parent
702ab2625c
commit
752ecd5ece
2 files changed
+11
-11
No files matched your search
@@ -201,6 +201,14 @@ top:
|
||||
return 4;
|
||||
|
||||
case SDL_MOUSEMOTION:
|
||||
SDL_PumpEvents();
|
||||
SDL_Event event_plus;
|
||||
while (SDL_PeepEvents(&event_plus, 1, SDL_GETEVENT, SDL_MOUSEMOTION, SDL_MOUSEMOTION) > 0) {
|
||||
e.motion.x = event_plus.motion.x;
|
||||
e.motion.y = event_plus.motion.y;
|
||||
e.motion.xrel += event_plus.motion.xrel;
|
||||
e.motion.yrel += event_plus.motion.yrel;
|
||||
}
|
||||
lua_pushstring(L, "mousemoved");
|
||||
lua_pushnumber(L, e.motion.x);
|
||||
lua_pushnumber(L, e.motion.y);
|
||||
|
||||
Reference in new issue
Block a user