Exemplo n.º 1
0
        public static void Update()
        {
            if (Input.GetMouseButtonDown(0) && IsHoverTrigger() && CurrentStyle == Win32Export.WStyle.NORMAL)
            {
                _drag = true;
            }
            else if (Input.GetMouseButtonUp(0))
            {
                _drag = false;
            }

            if (_drag)
            {
                var dx = Input.mousePosition.x - _mouseX;
                var dy = Input.mousePosition.y - _mouseY;
                Win32Export.RECT wndRect = Win32Export.GetWndRect(_hWnd);
                float            x       = wndRect.left;
                x += dx;
                float y = wndRect.top;
                y -= dy;
                var width  = wndRect.right - wndRect.left;
                var height = wndRect.bottom - wndRect.top;
                if (!Application.isEditor)
                {
                    Win32Export.MoveWindow(_hWnd, (int)x, (int)y, width, height, true);
                }
                _mouseX = Input.mousePosition.x - dx;
                _mouseY = Input.mousePosition.y - dy;
                return;
            }
            _mouseX = Input.mousePosition.x;
            _mouseY = Input.mousePosition.y;
        }
Exemplo n.º 2
0
 public static void Init()
 {
     _hWnd = Win32Export.GetCurrentWindowHandle();
     if (Application.isEditor)
     {
         return;
     }
 }
Exemplo n.º 3
0
        private static void GetNormalSize(ref int x, ref int y, ref int w, ref int h)
        {
            Win32Export.RECT wndRect = Win32Export.GetWndRect(_hWnd);
            //Win32Export.RECT workArea = Win32Export.GetWorkArea(Win32Export.NewPoint(wndRect.left, wndRect.top));
            var dx = wndRect.left;
            var dy = wndRect.top;
            var dw = wndRect.right - wndRect.left;
            var dh = wndRect.bottom - wndRect.top;

            w = PlayerPrefs.GetInt("Screenmanager Resolution Width", dw);
            h = PlayerPrefs.GetInt("Screenmanager Resolution Height", dh);
        }
Exemplo n.º 4
0
        private static void SetNormalSize()
        {
            Win32Export.RECT wndRect = Win32Export.GetWndRect(_hWnd);
            //Win32Export.RECT workArea = Win32Export.GetWorkArea(Win32Export.NewPoint(wndRect.left, wndRect.top));
            var x = wndRect.left;
            var y = wndRect.top;
            var w = wndRect.right - wndRect.left;
            var h = wndRect.bottom - wndRect.top;

            PlayerPrefs.SetInt("Screenmanager Resolution Width", w);
            PlayerPrefs.SetInt("Screenmanager Resolution Height", h);
        }
Exemplo n.º 5
0
        private static void NoFrame()
        {
            if (Application.isEditor)
            {
                return;
            }

            long style = Win32Export.GetWindowLong(_hWnd, Win32Export.GWL_STYLE);

            style = style & ~Win32Export.WS_CAPTION & ~Win32Export.WS_SYSMENU & ~Win32Export.WS_SIZEBOX;
            Win32Export.SetWindowLong(_hWnd, Win32Export.GWL_STYLE, style);
        }
Exemplo n.º 6
0
        public static void Min()
        {
            _drag = false;
            if (Application.isEditor)
            {
                return;
            }

            SetNormalSize();
            Win32Export.ShowWindow(_hWnd, (int)Win32Export.WStyle.MINISIZE);
            //Win32.SetWindowPos(_hWnd, -2, x, y, cx, cy, nflags);
            OnWindowModeChangeCallback?.Invoke(CurrentStyle);
        }
Exemplo n.º 7
0
        public static void Normal()
        {
            _drag = false;
            if (Application.isEditor)
            {
                return;
            }

            OnlyFrame();
            Win32Export.ShowWindow(_hWnd, (int)Win32Export.WStyle.NORMAL);

            /*int x, y, w, h;
             * x = y = w = h = 0;
             * GetNormalSize(ref x, ref y, ref w, ref h);
             * Win32Export.SetWindowPos(_hWnd, Win32Export.HWND_NORMAL, x, y, w, h, Win32Export.SWP_SHOWWINDOW | Win32Export.SWP_NOMOVE);*/
            OnWindowModeChangeCallback?.Invoke(CurrentStyle);
        }
Exemplo n.º 8
0
        public static void InitFullNormal()
        {
            if (Application.isEditor)
            {
                return;
            }

            OnlyFrame();
            //Win32Export.ShowWindow(_hWnd, (int)Win32Export.WStyle.NORMAL);
            int x, y, w, h;

            x = y = w = h = 0;
            w = Win32Export.GetSystemMetrics(Win32Export.SM_CXSCREEN);
            h = Win32Export.GetSystemMetrics(Win32Export.SM_CYSCREEN);
            Win32Export.SetWindowPos(_hWnd, Win32Export.HWND_NORMAL, x, y, w, h, Win32Export.SWP_NOMOVE);
            OnWindowModeChangeCallback?.Invoke(CurrentStyle);
        }