Example #1
0
    private void LateUpdate()
    {
        IntPtr fore = WinAPI.GetForegroundWindow();

        Focused = WinAPI.CompareTitleAndClass(fore, GameWindowTitle, GameWindowClass);

        if (Focused)
        {
            WinAPI.GetClientRect(fore, out WinAPI.RECT cr);
            cr = cr.ClientToScreen(fore);

            this.Camera.pixelRect = new Rect(cr.left, cr.bottom, cr.Width, cr.Height);
            this.Camera.rect      = new Rect(this.Camera.rect.x, 1 - this.Camera.rect.y, this.Camera.rect.width, this.Camera.rect.height);

            this.Camera.cullingMask = this.defaultCullingMask;
        }
        else
        {
            this.Camera.cullingMask = 0;
        }
    }