check if monitor is vertical or not.

This commit is contained in:
hecomi
2016-10-30 19:35:23 +09:00
parent 73018f671a
commit 14cd67e0c6
+13 -1
View File
@@ -41,6 +41,16 @@ public class Monitor
get { return (float)width / height; } get { return (float)width / height; }
} }
public bool isHorizontal
{
get { return width > height; }
}
public bool isVertical
{
get { return height > width; }
}
public bool isPointerVisible public bool isPointerVisible
{ {
get { return Lib.IsPointerVisible(id); } get { return Lib.IsPointerVisible(id); }
@@ -68,7 +78,9 @@ public class Monitor
get get
{ {
if (texture_ == null) { 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()); Lib.SetTexturePtr(id, texture_.GetNativeTexturePtr());
} }
return texture_; return texture_;