Skip to content

Commit f96c02c

Browse files
committed
Fix UI lags
1 parent 47ad268 commit f96c02c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/engine/qcommon/common.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1492,6 +1492,9 @@ int Com_EventLoop( void )
14921492
byte bufData[ MAX_MSGLEN ];
14931493
msg_t buf;
14941494

1495+
int mouseX = 0, mouseY = 0, mouseTime = 0;
1496+
bool mouseHaveEvent = false;
1497+
14951498
MSG_Init( &buf, bufData, sizeof( bufData ) );
14961499

14971500
while ( 1 )
@@ -1501,6 +1504,10 @@ int Com_EventLoop( void )
15011504
// if no more events are available
15021505
if ( ev.evType == SE_NONE )
15031506
{
1507+
if ( mouseHaveEvent ){
1508+
CL_MouseEvent( mouseX, mouseY, mouseTime );
1509+
}
1510+
15041511
// manually send packet events for the loopback channel
15051512
while ( NET_GetLoopPacket( NS_CLIENT, &evFrom, &buf ) )
15061513
{
@@ -1551,7 +1558,10 @@ int Com_EventLoop( void )
15511558
break;
15521559

15531560
case SE_MOUSE:
1554-
CL_MouseEvent( ev.evValue, ev.evValue2, ev.evTime );
1561+
mouseHaveEvent = true;
1562+
mouseX += ev.evValue;
1563+
mouseY += ev.evValue2;
1564+
mouseTime += ev.evTime;
15551565
break;
15561566

15571567
case SE_JOYSTICK_AXIS:

0 commit comments

Comments
 (0)