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; }
public static void Init() { _hWnd = Win32Export.GetCurrentWindowHandle(); if (Application.isEditor) { return; } }
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); }
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); }
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); }
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); }
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); }
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); }