File tree Expand file tree Collapse file tree 4 files changed +22
-21
lines changed Expand file tree Collapse file tree 4 files changed +22
-21
lines changed Original file line number Diff line number Diff line change @@ -352,6 +352,24 @@ BOOL CInput::iGetAsyncBtnState(int btn)
352352 return !!mouseState[btn];
353353}
354354
355+ void CInput::ClipCursor (bool clip)
356+ {
357+ HWND hwnd = Device.m_hWnd ;
358+ if (hwnd)
359+ {
360+ if (clip)
361+ {
362+ RECT clientRect;
363+ ::GetClientRect (hwnd, &clientRect);
364+ ::ClientToScreen (hwnd, (LPPOINT)&clientRect.left);
365+ ::ClientToScreen (hwnd, (LPPOINT)&clientRect.right);
366+ ::ClipCursor (&clientRect);
367+ }
368+ else
369+ ::ClipCursor (nullptr );
370+ }
371+ }
372+
355373void CInput::MouseUpdate ()
356374{
357375 HRESULT hr;
Original file line number Diff line number Diff line change @@ -90,6 +90,7 @@ class ENGINE_API CInput
9090 BOOL iGetAsyncKeyState (int dik);
9191 BOOL iGetAsyncBtnState (int btn);
9292 void iGetLastMouseDelta (Ivector2& p) { p.set (offs[0 ], offs[1 ]); }
93+ void ClipCursor (bool clip);
9394
9495 CInput (BOOL bExclusive = true , int deviceForInit = default_key);
9596 ~CInput ();
Original file line number Diff line number Diff line change 44#include " ui/UIStatic.h"
55#include " ui/UIBtnHint.h"
66#include " xrEngine/IInputReceiver.h"
7+ #include " xrEngine/xr_input.h"
78
89#define C_DEFAULT color_xrgb (0xff ,0xff ,0xff )
910
@@ -31,34 +32,16 @@ void CUICursor::OnScreenResolutionChanged()
3132 InitInternal ();
3233}
3334
34- void CUICursor::Clip (bool clip)
35- {
36- HWND hwnd = Device.m_hWnd ;
37- if (hwnd)
38- {
39- if (clip)
40- {
41- RECT clientRect;
42- ::GetClientRect (hwnd, &clientRect);
43- ::ClientToScreen (hwnd, (LPPOINT)&clientRect.left);
44- ::ClientToScreen (hwnd, (LPPOINT)&clientRect.right);
45- ::ClipCursor (&clientRect);
46- }
47- else
48- ::ClipCursor (nullptr );
49- }
50- }
51-
5235void CUICursor::Show ()
5336{
5437 bVisible = true ;
55- Clip (false );
38+ pInput-> ClipCursor (false );
5639}
5740
5841void CUICursor::Hide ()
5942{
6043 bVisible = false ;
61- Clip (true );
44+ pInput-> ClipCursor (true );
6245}
6346
6447void CUICursor::InitInternal ()
Original file line number Diff line number Diff line change @@ -27,5 +27,4 @@ class CUICursor: public pureRender,
2727 bool IsVisible () {return bVisible;}
2828 void Show ();
2929 void Hide ();
30- void Clip (bool clip);
3130};
You can’t perform that action at this time.
0 commit comments