From 14cd67e0c6d101df3bcf6d8fd4ab03cf172901bb Mon Sep 17 00:00:00 2001 From: hecomi Date: Sun, 30 Oct 2016 19:35:23 +0900 Subject: [PATCH] check if monitor is vertical or not. --- Assets/uDesktopDuplication/Scripts/Monitor.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Assets/uDesktopDuplication/Scripts/Monitor.cs b/Assets/uDesktopDuplication/Scripts/Monitor.cs index e5d59d5..ad34e3e 100644 --- a/Assets/uDesktopDuplication/Scripts/Monitor.cs +++ b/Assets/uDesktopDuplication/Scripts/Monitor.cs @@ -41,6 +41,16 @@ public class Monitor get { return (float)width / height; } } + public bool isHorizontal + { + get { return width > height; } + } + + public bool isVertical + { + get { return height > width; } + } + public bool isPointerVisible { get { return Lib.IsPointerVisible(id); } @@ -68,7 +78,9 @@ public class Monitor get { if (texture_ == null) { - texture_ = new Texture2D(width, height, TextureFormat.BGRA32, false); + var w = isHorizontal ? width : height; + var h = isHorizontal ? height : width; + texture_ = new Texture2D(w, h, TextureFormat.BGRA32, false); Lib.SetTexturePtr(id, texture_.GetNativeTexturePtr()); } return texture_;