show not-available texture when display is not available.
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b281589e6b8e27b4fbf0509d620b7871
|
||||
folderAsset: yes
|
||||
timeCreated: 1478354860
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e36cd526b654d024e875d5110a1b0442
|
||||
folderAsset: yes
|
||||
timeCreated: 1478354877
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -50,6 +50,8 @@ public static class Lib
|
||||
[DllImport("uDesktopDuplication")]
|
||||
public static extern IntPtr GetRenderEventFunc();
|
||||
[DllImport("uDesktopDuplication")]
|
||||
public static extern bool IsAvailable();
|
||||
[DllImport("uDesktopDuplication")]
|
||||
public static extern void GetName(int id, StringBuilder buf, int len);
|
||||
[DllImport("uDesktopDuplication")]
|
||||
public static extern int GetLeft(int id);
|
||||
|
||||
@@ -21,6 +21,11 @@ public class Monitor
|
||||
get { return id < Manager.monitorCount; }
|
||||
}
|
||||
|
||||
public bool available
|
||||
{
|
||||
get { return Lib.IsAvailable(); }
|
||||
}
|
||||
|
||||
public string name
|
||||
{
|
||||
get { return Lib.GetName(id); }
|
||||
@@ -122,6 +127,9 @@ public class Monitor
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!available) {
|
||||
return Resources.Load<Texture2D>("uDesktopDuplication/Textures/NotAvailable");
|
||||
}
|
||||
if (texture_ == null) {
|
||||
CreateTexture();
|
||||
}
|
||||
@@ -131,7 +139,7 @@ public class Monitor
|
||||
|
||||
public void Render()
|
||||
{
|
||||
if (texture_) {
|
||||
if (texture_ && available) {
|
||||
Lib.SetTexturePtr(id, texture_.GetNativeTexturePtr());
|
||||
GL.IssuePluginEvent(Lib.GetRenderEventFunc(), id);
|
||||
}
|
||||
@@ -144,6 +152,8 @@ public class Monitor
|
||||
|
||||
void CreateTexture()
|
||||
{
|
||||
if (!available) return;
|
||||
|
||||
var w = isHorizontal ? width : height;
|
||||
var h = isHorizontal ? height : width;
|
||||
bool shouldCreate = true;
|
||||
|
||||
@@ -126,6 +126,16 @@ extern "C"
|
||||
g_manager->SetTimeout(timeout);
|
||||
}
|
||||
|
||||
UNITY_INTERFACE_EXPORT bool UNITY_INTERFACE_API IsAvailable(int id)
|
||||
{
|
||||
if (!g_manager) return false;
|
||||
if (auto monitor = g_manager->GetMonitor(id))
|
||||
{
|
||||
return monitor->IsAvailable();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
UNITY_INTERFACE_EXPORT void UNITY_INTERFACE_API GetName(int id, char* buf, int len)
|
||||
{
|
||||
if (!g_manager) return;
|
||||
|
||||
Reference in New Issue
Block a user