File tree Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,36 @@ void CUICursor::OnScreenResolutionChanged()
3131 InitInternal ();
3232}
3333
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+
52+ void CUICursor::Show ()
53+ {
54+ bVisible = true ;
55+ Clip (false );
56+ }
57+
58+ void CUICursor::Hide ()
59+ {
60+ bVisible = false ;
61+ Clip (true );
62+ }
63+
3464void CUICursor::InitInternal ()
3565{
3666 m_static = xr_new<CUIStatic>();
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ class CUICursor: public pureRender,
2525 virtual void OnScreenResolutionChanged ();
2626
2727 bool IsVisible () {return bVisible;}
28- void Show () {bVisible = true ;}
29- void Hide () {bVisible = false ;}
28+ void Show ();
29+ void Hide ();
30+ void Clip (bool clip);
3031};
You can’t perform that action at this time.
0 commit comments