refactoring.
This commit is contained in:
Binary file not shown.
@@ -47,7 +47,7 @@ public class Cursor : MonoBehaviour
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (monitor.isPointerVisible) {
|
||||
if (monitor.isCursorVisible) {
|
||||
UpdatePosition();
|
||||
UpdateTexture();
|
||||
UpdateMaterial();
|
||||
@@ -76,7 +76,7 @@ public class Cursor : MonoBehaviour
|
||||
pointerTextures_.Add(scale, texture);
|
||||
}
|
||||
var pointerTexture = pointerTextures_[scale];
|
||||
monitor.UpdatePointerTexture(pointerTexture.GetNativeTexturePtr());
|
||||
monitor.UpdateCursorTexture(pointerTexture.GetNativeTexturePtr());
|
||||
cursorMaterial_.SetTexture("_MainTex", pointerTexture);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ using System.Runtime.InteropServices;
|
||||
namespace uDesktopDuplication
|
||||
{
|
||||
|
||||
public enum PointerShapeType
|
||||
public enum CursorShapeType
|
||||
{
|
||||
MonoChrome = 1,
|
||||
Color = 2,
|
||||
@@ -29,27 +29,23 @@ public static class Lib
|
||||
[DllImport("uDesktopDuplication")]
|
||||
public static extern bool IsPrimary(int id);
|
||||
[DllImport("uDesktopDuplication")]
|
||||
public static extern bool IsPointerVisible(int id);
|
||||
public static extern bool IsCursorVisible(int id);
|
||||
[DllImport("uDesktopDuplication")]
|
||||
public static extern int GetPointerX(int id);
|
||||
public static extern int GetCursorX(int id);
|
||||
[DllImport("uDesktopDuplication")]
|
||||
public static extern int GetPointerY(int id);
|
||||
public static extern int GetCursorY(int id);
|
||||
[DllImport("uDesktopDuplication")]
|
||||
public static extern int GetPointerShapeWidth(int id);
|
||||
public static extern int GetCursorShapeWidth(int id);
|
||||
[DllImport("uDesktopDuplication")]
|
||||
public static extern int GetPointerShapeHeight(int id);
|
||||
public static extern int GetCursorShapeHeight(int id);
|
||||
[DllImport("uDesktopDuplication")]
|
||||
public static extern int GetPointerShapePitch(int id);
|
||||
public static extern int GetCursorShapePitch(int id);
|
||||
[DllImport("uDesktopDuplication")]
|
||||
public static extern PointerShapeType GetPointerShapeType(int id);
|
||||
public static extern CursorShapeType GetCursorShapeType(int id);
|
||||
[DllImport("uDesktopDuplication")]
|
||||
public static extern void UpdatePointerTexture(int id, System.IntPtr ptr);
|
||||
public static extern void UpdateCursorTexture(int id, System.IntPtr ptr);
|
||||
[DllImport("uDesktopDuplication")]
|
||||
public static extern int SetTexturePtr(int id, IntPtr ptr);
|
||||
[DllImport("uDesktopDuplication")]
|
||||
public static extern int GetErrorCode();
|
||||
[DllImport("uDesktopDuplication")]
|
||||
public static extern void GetErrorMessage(StringBuilder buf, int len);
|
||||
|
||||
public static string GetName(int id)
|
||||
{
|
||||
@@ -57,13 +53,6 @@ public static class Lib
|
||||
GetName(id, buf, buf.Capacity);
|
||||
return buf.ToString();
|
||||
}
|
||||
|
||||
public static string GetErrorMessage()
|
||||
{
|
||||
var buf = new StringBuilder(64);
|
||||
GetErrorMessage(buf, buf.Capacity);
|
||||
return buf.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -40,9 +40,6 @@ public class Manager : MonoBehaviour
|
||||
[SerializeField, Tooltip("Set Desktop Duplication API timeout (milliseconds).")]
|
||||
int timeout = 0;
|
||||
|
||||
[SerializeField, Tooltip("Output logs given by the plugin.")]
|
||||
bool outputDebugLog = false;
|
||||
|
||||
private Coroutine renderCoroutine_ = null;
|
||||
|
||||
void Awake()
|
||||
@@ -81,10 +78,6 @@ public class Manager : MonoBehaviour
|
||||
}
|
||||
monitor.shouldBeUpdated = false;
|
||||
}
|
||||
if (outputDebugLog && Lib.GetErrorCode() != 0)
|
||||
{
|
||||
Debug.Log(Lib.GetErrorMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,34 +51,34 @@ public class Monitor
|
||||
get { return height > width; }
|
||||
}
|
||||
|
||||
public bool isPointerVisible
|
||||
public bool isCursorVisible
|
||||
{
|
||||
get { return Lib.IsPointerVisible(id); }
|
||||
get { return Lib.IsCursorVisible(id); }
|
||||
}
|
||||
|
||||
public int pointerX
|
||||
{
|
||||
get { return Lib.GetPointerX(id); }
|
||||
get { return Lib.GetCursorX(id); }
|
||||
}
|
||||
|
||||
public int pointerY
|
||||
{
|
||||
get { return Lib.GetPointerY(id); }
|
||||
get { return Lib.GetCursorY(id); }
|
||||
}
|
||||
|
||||
public int pointerShapeWidth
|
||||
{
|
||||
get { return Lib.GetPointerShapeWidth(id); }
|
||||
get { return Lib.GetCursorShapeWidth(id); }
|
||||
}
|
||||
|
||||
public int pointerShapeHeight
|
||||
{
|
||||
get { return Lib.GetPointerShapeHeight(id); }
|
||||
get { return Lib.GetCursorShapeHeight(id); }
|
||||
}
|
||||
|
||||
public PointerShapeType pointerShapeType
|
||||
public CursorShapeType pointerShapeType
|
||||
{
|
||||
get { return Lib.GetPointerShapeType(id); }
|
||||
get { return Lib.GetCursorShapeType(id); }
|
||||
}
|
||||
|
||||
public bool shouldBeUpdated
|
||||
@@ -107,9 +107,9 @@ public class Monitor
|
||||
GL.IssuePluginEvent(Lib.GetRenderEventFunc(), id);
|
||||
}
|
||||
|
||||
public void UpdatePointerTexture(System.IntPtr ptr)
|
||||
public void UpdateCursorTexture(System.IntPtr ptr)
|
||||
{
|
||||
Lib.UpdatePointerTexture(id, ptr);
|
||||
Lib.UpdateCursorTexture(id, ptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user