@@ -52,6 +52,7 @@ CInput::CInput(BOOL bExclusive, int deviceForInit)
5252 // ===================== Dummy pack
5353 iCapture (&dummyController);
5454
55+ SDL_SetRelativeMouseMode (SDL_TRUE);
5556
5657 xrDebug::SetDialogHandler (on_error_dialog);
5758
@@ -197,19 +198,18 @@ void CInput::ClipCursor(bool clip)
197198{
198199 if (clip)
199200 {
200- // ::ClipCursor(&Device.m_rcWindowClient);
201201 SDL_ShowCursor (SDL_DISABLE);
202202 }
203203 else
204204 {
205- // ::ClipCursor(nullptr);
206205 SDL_ShowCursor (SDL_ENABLE);
207206 }
208207}
209208
210- // void CInput::MouseUpdate(SDL_Event *event)
211- void CInput::MouseUpdate ()
209+ void CInput::MouseUpdate (SDL_Event *event)
212210{
211+ DWORD dwElements = MOUSEBUFFERSIZE;
212+
213213#ifndef _EDITOR
214214 if (Device.dwPrecacheFrame )
215215 return ;
@@ -224,14 +224,34 @@ void CInput::MouseUpdate()
224224 mouse_prev[5 ] = mouseState[5 ];
225225 mouse_prev[6 ] = mouseState[6 ];
226226 mouse_prev[7 ] = mouseState[7 ];
227+
228+ offs[0 ] = offs[1 ] = offs[2 ] = 0 ;
229+
230+ switch (event->type )
231+ {
232+ case SDL_MOUSEMOTION:
233+ timeStamp[0 ] = event->motion .timestamp ;
234+ cbStack.back ()->IR_OnMouseMove (event->motion .xrel , event->motion .yrel );
235+ break ;
236+ case SDL_MOUSEBUTTONUP:
237+ cbStack.back ()->IR_OnMouseRelease (event->button .button );
238+ break ;
239+ case SDL_MOUSEBUTTONDOWN:
240+ cbStack.back ()->IR_OnMousePress (event->button .button );
241+ break ;
242+ case SDL_MOUSEWHEEL:
243+ timeStamp[2 ] = event->wheel .timestamp ;
244+ cbStack.back ()->IR_OnMouseWheel (event->wheel .direction );
245+ break ;
246+ default : break ;
247+ }
248+
227249}
228250
229251// -------------------------------------------------------
230252void CInput::iCapture (IInputReceiver* p)
231253{
232254 VERIFY (p);
233-
234- MouseUpdate ();
235255
236256 // change focus
237257 if (!cbStack.empty ())
@@ -251,9 +271,7 @@ void CInput::iRelease(IInputReceiver* p)
251271 {
252272 cbStack.back ()->IR_OnDeactivate ();
253273 cbStack.pop_back ();
254-
255- if (!cbStack.empty ())
256- cbStack.back ()->IR_OnActivate ();
274+ cbStack.back ()->IR_OnActivate ();
257275 }
258276 else
259277 {
@@ -315,7 +333,7 @@ void CInput::OnFrame(void)
315333 case SDL_MOUSEBUTTONUP:
316334 case SDL_MOUSEBUTTONDOWN:
317335 case SDL_MOUSEWHEEL:
318- // MouseUpdate(&event);
336+ MouseUpdate (&event);
319337 // MouseUpdate();
320338 continue ;
321339// case SDL_WINDOWEVENT:
0 commit comments