add function to fetch left/right/top/bottom/rotation.
This commit is contained in:
@@ -9,6 +9,8 @@ public class MultipleMonitorCreator : MonoBehaviour
|
||||
void Start()
|
||||
{
|
||||
var monitors = uDesktopDuplication.Manager.monitors;
|
||||
monitors.Sort((a, b) => a.left - b.left);
|
||||
|
||||
var n = monitors.Count;
|
||||
|
||||
var totalWidth = 0f;
|
||||
@@ -24,6 +26,7 @@ public class MultipleMonitorCreator : MonoBehaviour
|
||||
totalWidth += width * scaleX;
|
||||
}
|
||||
|
||||
|
||||
totalWidth += margin * (n - 1);
|
||||
var x = -totalWidth / 2;
|
||||
for (int i = 0 ; i < n; ++i) {
|
||||
|
||||
Binary file not shown.
@@ -18,6 +18,15 @@ public enum CursorShapeType
|
||||
MaskedColor = 4,
|
||||
}
|
||||
|
||||
public enum MonitorRotation
|
||||
{
|
||||
Unspecified = 0,
|
||||
Identity = 1,
|
||||
Rotate90 = 2,
|
||||
Rotate180 = 3,
|
||||
Rotate270 = 4
|
||||
}
|
||||
|
||||
public static class Lib
|
||||
{
|
||||
public delegate void MessageHandler(Message message);
|
||||
@@ -33,16 +42,30 @@ public static class Lib
|
||||
[DllImport("uDesktopDuplication")]
|
||||
public static extern int GetMonitorCount();
|
||||
[DllImport("uDesktopDuplication")]
|
||||
public static extern int GetTotalWidth();
|
||||
[DllImport("uDesktopDuplication")]
|
||||
public static extern int GetTotalHeight();
|
||||
[DllImport("uDesktopDuplication")]
|
||||
public static extern void SetTimeout(int timeout);
|
||||
[DllImport("uDesktopDuplication")]
|
||||
public static extern IntPtr GetRenderEventFunc();
|
||||
[DllImport("uDesktopDuplication")]
|
||||
public static extern void GetName(int id, StringBuilder buf, int len);
|
||||
[DllImport("uDesktopDuplication")]
|
||||
public static extern int GetLeft(int id);
|
||||
[DllImport("uDesktopDuplication")]
|
||||
public static extern int GetRight(int id);
|
||||
[DllImport("uDesktopDuplication")]
|
||||
public static extern int GetTop(int id);
|
||||
[DllImport("uDesktopDuplication")]
|
||||
public static extern int GetBottom(int id);
|
||||
[DllImport("uDesktopDuplication")]
|
||||
public static extern int GetWidth(int id);
|
||||
[DllImport("uDesktopDuplication")]
|
||||
public static extern int GetHeight(int id);
|
||||
[DllImport("uDesktopDuplication")]
|
||||
public static extern MonitorRotation GetRotation(int id);
|
||||
[DllImport("uDesktopDuplication")]
|
||||
public static extern bool IsPrimary(int id);
|
||||
[DllImport("uDesktopDuplication")]
|
||||
public static extern bool IsCursorVisible(int id);
|
||||
|
||||
@@ -31,6 +31,26 @@ public class Monitor
|
||||
get { return Lib.IsPrimary(id); }
|
||||
}
|
||||
|
||||
public int left
|
||||
{
|
||||
get { return Lib.GetLeft(id); }
|
||||
}
|
||||
|
||||
public int right
|
||||
{
|
||||
get { return Lib.GetRight(id); }
|
||||
}
|
||||
|
||||
public int top
|
||||
{
|
||||
get { return Lib.GetTop(id); }
|
||||
}
|
||||
|
||||
public int bottom
|
||||
{
|
||||
get { return Lib.GetBottom(id); }
|
||||
}
|
||||
|
||||
public int width
|
||||
{
|
||||
get { return Lib.GetWidth(id); }
|
||||
@@ -41,6 +61,11 @@ public class Monitor
|
||||
get { return Lib.GetHeight(id); }
|
||||
}
|
||||
|
||||
public MonitorRotation rotation
|
||||
{
|
||||
get { return Lib.GetRotation(id); }
|
||||
}
|
||||
|
||||
public float aspect
|
||||
{
|
||||
get { return (float)width / height; }
|
||||
|
||||
@@ -52,6 +52,7 @@ public class Texture : MonoBehaviour
|
||||
{
|
||||
monitor.shouldBeUpdated = true;
|
||||
UpdateMaterial();
|
||||
Debug.Log(Lib.GetTotalWidth() + " " + Lib.GetTotalHeight());
|
||||
}
|
||||
|
||||
void UpdateMaterial()
|
||||
|
||||
@@ -49,9 +49,9 @@ Pass
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma shader_feature ___ INVERT_X
|
||||
#pragma shader_feature ___ INVERT_Y
|
||||
#pragma shader_feature ___ VERTICAL
|
||||
#pragma multi_compile ___ INVERT_X
|
||||
#pragma multi_compile ___ INVERT_Y
|
||||
#pragma multi_compile ___ VERTICAL
|
||||
#pragma shader_feature ___ USE_BEND
|
||||
ENDCG
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user