@@ -52,6 +52,7 @@ CInput::CInput(BOOL bExclusive, int deviceForInit)
52
52
// ===================== Dummy pack
53
53
iCapture (&dummyController);
54
54
55
+ SDL_SetRelativeMouseMode (SDL_TRUE);
55
56
56
57
xrDebug::SetDialogHandler (on_error_dialog);
57
58
@@ -197,19 +198,18 @@ void CInput::ClipCursor(bool clip)
197
198
{
198
199
if (clip)
199
200
{
200
- // ::ClipCursor(&Device.m_rcWindowClient);
201
201
SDL_ShowCursor (SDL_DISABLE);
202
202
}
203
203
else
204
204
{
205
- // ::ClipCursor(nullptr);
206
205
SDL_ShowCursor (SDL_ENABLE);
207
206
}
208
207
}
209
208
210
- // void CInput::MouseUpdate(SDL_Event *event)
211
- void CInput::MouseUpdate ()
209
+ void CInput::MouseUpdate (SDL_Event *event)
212
210
{
211
+ DWORD dwElements = MOUSEBUFFERSIZE;
212
+
213
213
#ifndef _EDITOR
214
214
if (Device.dwPrecacheFrame )
215
215
return ;
@@ -224,14 +224,34 @@ void CInput::MouseUpdate()
224
224
mouse_prev[5 ] = mouseState[5 ];
225
225
mouse_prev[6 ] = mouseState[6 ];
226
226
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
+
227
249
}
228
250
229
251
// -------------------------------------------------------
230
252
void CInput::iCapture (IInputReceiver* p)
231
253
{
232
254
VERIFY (p);
233
-
234
- MouseUpdate ();
235
255
236
256
// change focus
237
257
if (!cbStack.empty ())
@@ -251,9 +271,7 @@ void CInput::iRelease(IInputReceiver* p)
251
271
{
252
272
cbStack.back ()->IR_OnDeactivate ();
253
273
cbStack.pop_back ();
254
-
255
- if (!cbStack.empty ())
256
- cbStack.back ()->IR_OnActivate ();
274
+ cbStack.back ()->IR_OnActivate ();
257
275
}
258
276
else
259
277
{
@@ -315,7 +333,7 @@ void CInput::OnFrame(void)
315
333
case SDL_MOUSEBUTTONUP:
316
334
case SDL_MOUSEBUTTONDOWN:
317
335
case SDL_MOUSEWHEEL:
318
- // MouseUpdate(&event);
336
+ MouseUpdate (&event);
319
337
// MouseUpdate();
320
338
continue ;
321
339
// case SDL_WINDOWEVENT:
0 commit comments