update files.
This commit is contained in:
@@ -5,8 +5,13 @@
|
|||||||
#include "Monitor.h"
|
#include "Monitor.h"
|
||||||
|
|
||||||
|
|
||||||
Monitor::Monitor(int id, IDXGIOutput* output)
|
Monitor::Monitor(int id)
|
||||||
: id_(id)
|
: id_(id)
|
||||||
|
, cursor_(std::make_unique<Cursor>(this))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT Monitor::Initialize(IDXGIOutput* output)
|
||||||
{
|
{
|
||||||
output->GetDesc(&outputDesc_);
|
output->GetDesc(&outputDesc_);
|
||||||
monitorInfo_.cbSize = sizeof(MONITORINFOEX);
|
monitorInfo_.cbSize = sizeof(MONITORINFOEX);
|
||||||
@@ -15,36 +20,31 @@ Monitor::Monitor(int id, IDXGIOutput* output)
|
|||||||
auto output1 = reinterpret_cast<IDXGIOutput1*>(output);
|
auto output1 = reinterpret_cast<IDXGIOutput1*>(output);
|
||||||
const auto hr = output1->DuplicateOutput(GetDevice(), &deskDupl_);
|
const auto hr = output1->DuplicateOutput(GetDevice(), &deskDupl_);
|
||||||
|
|
||||||
auto error = 0;
|
|
||||||
|
|
||||||
// TODO: error check
|
// TODO: error check
|
||||||
switch (hr)
|
switch (hr)
|
||||||
{
|
{
|
||||||
case S_OK:
|
case S_OK:
|
||||||
|
available_ = true;
|
||||||
break;
|
break;
|
||||||
case E_INVALIDARG:
|
case E_INVALIDARG:
|
||||||
error = 1;
|
|
||||||
break;
|
break;
|
||||||
case E_ACCESSDENIED:
|
case E_ACCESSDENIED:
|
||||||
error = 2;
|
|
||||||
// For example, when the user presses Ctrl + Alt + Delete and the screen
|
// For example, when the user presses Ctrl + Alt + Delete and the screen
|
||||||
// switches to admin screen, this error occurs.
|
// switches to admin screen, this error occurs.
|
||||||
|
// GetMonitorManager()->RequireReinitilization();
|
||||||
break;
|
break;
|
||||||
case DXGI_ERROR_UNSUPPORTED:
|
case DXGI_ERROR_UNSUPPORTED:
|
||||||
error = 3;
|
// If the display adapter on the computer is running under the Microsoft Hybrid system,
|
||||||
|
// this error occurs.
|
||||||
break;
|
break;
|
||||||
case DXGI_ERROR_NOT_CURRENTLY_AVAILABLE:
|
case DXGI_ERROR_NOT_CURRENTLY_AVAILABLE:
|
||||||
error = 4;
|
// When other application use Desktop Duplication API, this error occurs.
|
||||||
// Other application use Desktop Duplication API...
|
|
||||||
break;
|
break;
|
||||||
case DXGI_ERROR_SESSION_DISCONNECTED:
|
case DXGI_ERROR_SESSION_DISCONNECTED:
|
||||||
error = 5;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
cursor_ = std::make_unique<Cursor>(this);
|
return hr;
|
||||||
|
|
||||||
// MEMO: 'output' will be released automatically after this ctor.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -61,7 +61,6 @@ HRESULT Monitor::Render(UINT timeout)
|
|||||||
{
|
{
|
||||||
if (deskDupl_ == nullptr)
|
if (deskDupl_ == nullptr)
|
||||||
{
|
{
|
||||||
GetMonitorManager()->RequireReinitilization();
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,7 +88,7 @@ HRESULT Monitor::Render(UINT timeout)
|
|||||||
resource->Release();
|
resource->Release();
|
||||||
deskDupl_->ReleaseFrame();
|
deskDupl_->ReleaseFrame();
|
||||||
|
|
||||||
return 0;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -99,6 +98,12 @@ int Monitor::GetId() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Monitor::IsAvailable() const
|
||||||
|
{
|
||||||
|
return available_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Monitor::SetUnityTexture(ID3D11Texture2D* texture)
|
void Monitor::SetUnityTexture(ID3D11Texture2D* texture)
|
||||||
{
|
{
|
||||||
unityTexture_ = texture;
|
unityTexture_ = texture;
|
||||||
|
|||||||
@@ -7,13 +7,15 @@ class Cursor;
|
|||||||
class Monitor
|
class Monitor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Monitor(int id, IDXGIOutput* output);
|
explicit Monitor(int id);
|
||||||
~Monitor();
|
~Monitor();
|
||||||
|
HRESULT Initialize(IDXGIOutput* output);
|
||||||
HRESULT Render(UINT timeout = 0);
|
HRESULT Render(UINT timeout = 0);
|
||||||
void UpdateCursorTexture(ID3D11Texture2D* texture);
|
void UpdateCursorTexture(ID3D11Texture2D* texture);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int GetId() const;
|
int GetId() const;
|
||||||
|
bool IsAvailable() const;
|
||||||
void SetUnityTexture(ID3D11Texture2D* texture);
|
void SetUnityTexture(ID3D11Texture2D* texture);
|
||||||
ID3D11Texture2D* GetUnityTexture() const;
|
ID3D11Texture2D* GetUnityTexture() const;
|
||||||
void GetName(char* buf, int len) const;
|
void GetName(char* buf, int len) const;
|
||||||
@@ -30,6 +32,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
int id_ = -1;
|
int id_ = -1;
|
||||||
|
bool available_ = false;
|
||||||
std::unique_ptr<Cursor> cursor_;
|
std::unique_ptr<Cursor> cursor_;
|
||||||
IDXGIOutputDuplication* deskDupl_ = nullptr;
|
IDXGIOutputDuplication* deskDupl_ = nullptr;
|
||||||
ID3D11Texture2D* unityTexture_ = nullptr;
|
ID3D11Texture2D* unityTexture_ = nullptr;
|
||||||
|
|||||||
@@ -42,7 +42,8 @@ void MonitorManager::Initialize()
|
|||||||
IDXGIOutput* output;
|
IDXGIOutput* output;
|
||||||
for (int j = 0; (adapter->EnumOutputs(j, &output) != DXGI_ERROR_NOT_FOUND); ++j)
|
for (int j = 0; (adapter->EnumOutputs(j, &output) != DXGI_ERROR_NOT_FOUND); ++j)
|
||||||
{
|
{
|
||||||
auto monitor = std::make_shared<Monitor>(id++, output);
|
auto monitor = std::make_shared<Monitor>(id++);
|
||||||
|
monitor->Initialize(output);
|
||||||
monitors_.push_back(monitor);
|
monitors_.push_back(monitor);
|
||||||
output->Release();
|
output->Release();
|
||||||
}
|
}
|
||||||
@@ -89,9 +90,12 @@ void MonitorManager::OnRender(int id)
|
|||||||
{
|
{
|
||||||
if (auto monitor = GetMonitor(id))
|
if (auto monitor = GetMonitor(id))
|
||||||
{
|
{
|
||||||
|
if (!monitor->IsAvailable()) return;
|
||||||
|
|
||||||
|
const auto hr = monitor->Render(timeout_);
|
||||||
|
|
||||||
// If any monitor setting has changed (e.g. monitor size has changed),
|
// If any monitor setting has changed (e.g. monitor size has changed),
|
||||||
// it is necessary to re-initialize monitors.
|
// it is necessary to re-initialize monitors.
|
||||||
const auto hr = monitor->Render(timeout_);
|
|
||||||
if (hr == DXGI_ERROR_ACCESS_LOST)
|
if (hr == DXGI_ERROR_ACCESS_LOST)
|
||||||
{
|
{
|
||||||
isReinitializationRequired_ = true;
|
isReinitializationRequired_ = true;
|
||||||
@@ -100,28 +104,15 @@ void MonitorManager::OnRender(int id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MonitorManager::UpdateCursorTexture(int id, ID3D11Texture2D* texture)
|
|
||||||
{
|
|
||||||
if (auto monitor = GetMonitor(id))
|
|
||||||
{
|
|
||||||
monitor->UpdateCursorTexture(texture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MonitorManager::SetTimeout(int timeout)
|
void MonitorManager::SetTimeout(int timeout)
|
||||||
{
|
{
|
||||||
timeout_ = timeout;
|
timeout_ = timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MonitorManager::SetTexturePtr(int id, void* texture)
|
int MonitorManager::GetTimeout() const
|
||||||
{
|
{
|
||||||
if (auto monitor = GetMonitor(id))
|
return timeout_;
|
||||||
{
|
|
||||||
auto d3d11Texture = reinterpret_cast<ID3D11Texture2D*>(texture);
|
|
||||||
monitor->SetUnityTexture(d3d11Texture);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -154,163 +145,4 @@ int MonitorManager::GetTotalHeight() const
|
|||||||
const auto minTop = *std::min_element(tops.begin(), tops.end());
|
const auto minTop = *std::min_element(tops.begin(), tops.end());
|
||||||
const auto maxBottom = *std::max_element(bottoms.begin(), bottoms.end());
|
const auto maxBottom = *std::max_element(bottoms.begin(), bottoms.end());
|
||||||
return maxBottom - minTop;
|
return maxBottom - minTop;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MonitorManager::GetName(int id, char* buf, int len) const
|
|
||||||
{
|
|
||||||
if (auto monitor = GetMonitor(id))
|
|
||||||
{
|
|
||||||
monitor->GetName(buf, len);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool MonitorManager::IsPrimary(int id) const
|
|
||||||
{
|
|
||||||
if (auto monitor = GetMonitor(id))
|
|
||||||
{
|
|
||||||
return monitor->IsPrimary();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int MonitorManager::GetLeft(int id) const
|
|
||||||
{
|
|
||||||
if (auto monitor = GetMonitor(id))
|
|
||||||
{
|
|
||||||
return monitor->GetLeft();
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int MonitorManager::GetRight(int id) const
|
|
||||||
{
|
|
||||||
if (auto monitor = GetMonitor(id))
|
|
||||||
{
|
|
||||||
return monitor->GetRight();
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int MonitorManager::GetTop(int id) const
|
|
||||||
{
|
|
||||||
if (auto monitor = GetMonitor(id))
|
|
||||||
{
|
|
||||||
return monitor->GetTop();
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int MonitorManager::GetBottom(int id) const
|
|
||||||
{
|
|
||||||
if (auto monitor = GetMonitor(id))
|
|
||||||
{
|
|
||||||
return monitor->GetBottom();
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int MonitorManager::GetWidth(int id) const
|
|
||||||
{
|
|
||||||
if (auto monitor = GetMonitor(id))
|
|
||||||
{
|
|
||||||
return monitor->GetWidth();
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int MonitorManager::GetHeight(int id) const
|
|
||||||
{
|
|
||||||
if (auto monitor = GetMonitor(id))
|
|
||||||
{
|
|
||||||
return monitor->GetHeight();
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int MonitorManager::GetRotation(int id) const
|
|
||||||
{
|
|
||||||
if (auto monitor = GetMonitor(id))
|
|
||||||
{
|
|
||||||
return monitor->GetRotation();
|
|
||||||
}
|
|
||||||
return DXGI_MODE_ROTATION_UNSPECIFIED;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool MonitorManager::IsCursorVisible(int id) const
|
|
||||||
{
|
|
||||||
if (auto monitor = GetMonitor(id))
|
|
||||||
{
|
|
||||||
return monitor->GetCursor()->IsVisible();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int MonitorManager::GetCursorX(int id) const
|
|
||||||
{
|
|
||||||
if (auto monitor = GetMonitor(id))
|
|
||||||
{
|
|
||||||
return monitor->GetCursor()->GetX();
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int MonitorManager::GetCursorY(int id) const
|
|
||||||
{
|
|
||||||
if (auto monitor = GetMonitor(id))
|
|
||||||
{
|
|
||||||
return monitor->GetCursor()->GetY();
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int MonitorManager::GetCursorShapeWidth(int id) const
|
|
||||||
{
|
|
||||||
if (auto monitor = GetMonitor(id))
|
|
||||||
{
|
|
||||||
return monitor->GetCursor()->GetWidth();
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int MonitorManager::GetCursorShapeHeight(int id) const
|
|
||||||
{
|
|
||||||
if (auto monitor = GetMonitor(id))
|
|
||||||
{
|
|
||||||
return monitor->GetCursor()->GetHeight();
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int MonitorManager::GetCursorShapePitch(int id) const
|
|
||||||
{
|
|
||||||
if (auto monitor = GetMonitor(id))
|
|
||||||
{
|
|
||||||
return monitor->GetCursor()->GetPitch();
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int MonitorManager::GetCursorShapeType(int id) const
|
|
||||||
{
|
|
||||||
if (auto monitor = GetMonitor(id))
|
|
||||||
{
|
|
||||||
return monitor->GetCursor()->GetType();
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
@@ -29,31 +29,14 @@ private:
|
|||||||
public:
|
public:
|
||||||
void OnRender(int id);
|
void OnRender(int id);
|
||||||
void Update();
|
void Update();
|
||||||
void UpdateCursorTexture(int id, ID3D11Texture2D* ptr);
|
|
||||||
void SetTimeout(int timeout);
|
void SetTimeout(int timeout);
|
||||||
void SetTexturePtr(int id, void* texture);
|
int GetTimeout() const;
|
||||||
|
|
||||||
// Getters from Unity
|
// Getters from Unity
|
||||||
public:
|
public:
|
||||||
int GetMonitorCount() const;
|
int GetMonitorCount() const;
|
||||||
int GetTotalWidth() const;
|
int GetTotalWidth() const;
|
||||||
int GetTotalHeight() const;
|
int GetTotalHeight() const;
|
||||||
void GetName(int id, char* buf, int len) const;
|
|
||||||
bool IsPrimary(int id) const;
|
|
||||||
int GetLeft(int id) const;
|
|
||||||
int GetRight(int id) const;
|
|
||||||
int GetTop(int id) const;
|
|
||||||
int GetBottom(int id) const;
|
|
||||||
int GetWidth(int id) const;
|
|
||||||
int GetHeight(int id) const;
|
|
||||||
int GetRotation(int id) const;
|
|
||||||
bool IsCursorVisible(int id) const;
|
|
||||||
int GetCursorX(int id) const;
|
|
||||||
int GetCursorY(int id) const;
|
|
||||||
int GetCursorShapeWidth(int id) const;
|
|
||||||
int GetCursorShapeHeight(int id) const;
|
|
||||||
int GetCursorShapePitch(int id) const;
|
|
||||||
int GetCursorShapeType(int id) const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int timeout_ = 10;
|
int timeout_ = 10;
|
||||||
|
|||||||
@@ -10,6 +10,8 @@
|
|||||||
#include "IUnityGraphicsD3D11.h"
|
#include "IUnityGraphicsD3D11.h"
|
||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
|
#include "Monitor.h"
|
||||||
|
#include "Cursor.h"
|
||||||
#include "MonitorManager.h"
|
#include "MonitorManager.h"
|
||||||
|
|
||||||
#pragma comment(lib, "dxgi.lib")
|
#pragma comment(lib, "dxgi.lib")
|
||||||
@@ -127,108 +129,178 @@ extern "C"
|
|||||||
UNITY_INTERFACE_EXPORT void UNITY_INTERFACE_API GetName(int id, char* buf, int len)
|
UNITY_INTERFACE_EXPORT void UNITY_INTERFACE_API GetName(int id, char* buf, int len)
|
||||||
{
|
{
|
||||||
if (!g_manager) return;
|
if (!g_manager) return;
|
||||||
g_manager->GetName(id, buf, len);
|
if (auto monitor = g_manager->GetMonitor(id))
|
||||||
|
{
|
||||||
|
monitor->GetName(buf, len);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UNITY_INTERFACE_EXPORT bool UNITY_INTERFACE_API IsPrimary(int id)
|
UNITY_INTERFACE_EXPORT bool UNITY_INTERFACE_API IsPrimary(int id)
|
||||||
{
|
{
|
||||||
if (!g_manager) return false;
|
if (!g_manager) return false;
|
||||||
return g_manager->IsPrimary(id);
|
if (auto monitor = g_manager->GetMonitor(id))
|
||||||
|
{
|
||||||
|
return monitor->IsPrimary();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API GetLeft(int id)
|
UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API GetLeft(int id)
|
||||||
{
|
{
|
||||||
if (!g_manager) return -1;
|
if (!g_manager) return -1;
|
||||||
return g_manager->GetLeft(id);
|
if (auto monitor = g_manager->GetMonitor(id))
|
||||||
|
{
|
||||||
|
return monitor->GetLeft();
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API GetRight(int id)
|
UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API GetRight(int id)
|
||||||
{
|
{
|
||||||
if (!g_manager) return -1;
|
if (!g_manager) return -1;
|
||||||
return g_manager->GetRight(id);
|
if (auto monitor = g_manager->GetMonitor(id))
|
||||||
|
{
|
||||||
|
return monitor->GetRight();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API GetTop(int id)
|
UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API GetTop(int id)
|
||||||
{
|
{
|
||||||
if (!g_manager) return -1;
|
if (!g_manager) return -1;
|
||||||
return g_manager->GetTop(id);
|
if (auto monitor = g_manager->GetMonitor(id))
|
||||||
|
{
|
||||||
|
return monitor->GetTop();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API GetBottom(int id)
|
UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API GetBottom(int id)
|
||||||
{
|
{
|
||||||
if (!g_manager) return -1;
|
if (!g_manager) return -1;
|
||||||
return g_manager->GetBottom(id);
|
if (auto monitor = g_manager->GetMonitor(id))
|
||||||
|
{
|
||||||
|
return monitor->GetBottom();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API GetWidth(int id)
|
UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API GetWidth(int id)
|
||||||
{
|
{
|
||||||
if (!g_manager) return -1;
|
if (!g_manager) return -1;
|
||||||
return g_manager->GetWidth(id);
|
if (auto monitor = g_manager->GetMonitor(id))
|
||||||
|
{
|
||||||
|
return monitor->GetWidth();
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API GetHeight(int id)
|
UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API GetHeight(int id)
|
||||||
{
|
{
|
||||||
if (!g_manager) return -1;
|
if (!g_manager) return -1;
|
||||||
return g_manager->GetHeight(id);
|
if (auto monitor = g_manager->GetMonitor(id))
|
||||||
|
{
|
||||||
|
return monitor->GetHeight();
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API GetRotation(int id)
|
UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API GetRotation(int id)
|
||||||
{
|
{
|
||||||
if (!g_manager) return -1;
|
if (!g_manager) return -1;
|
||||||
return g_manager->GetRotation(id);
|
if (auto monitor = g_manager->GetMonitor(id))
|
||||||
|
{
|
||||||
|
return monitor->GetRotation();
|
||||||
|
}
|
||||||
|
return DXGI_MODE_ROTATION_UNSPECIFIED;
|
||||||
}
|
}
|
||||||
|
|
||||||
UNITY_INTERFACE_EXPORT bool UNITY_INTERFACE_API IsCursorVisible(int id)
|
UNITY_INTERFACE_EXPORT bool UNITY_INTERFACE_API IsCursorVisible(int id)
|
||||||
{
|
{
|
||||||
if (!g_manager) return false;
|
if (!g_manager) return false;
|
||||||
return g_manager->IsCursorVisible(id);
|
if (auto monitor = g_manager->GetMonitor(id))
|
||||||
|
{
|
||||||
|
return monitor->GetCursor()->IsVisible();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API GetCursorX(int id)
|
UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API GetCursorX(int id)
|
||||||
{
|
{
|
||||||
if (!g_manager) return -1;
|
if (!g_manager) return -1;
|
||||||
return g_manager->GetCursorX(id);
|
if (auto monitor = g_manager->GetMonitor(id))
|
||||||
|
{
|
||||||
|
return monitor->GetCursor()->GetX();
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API GetCursorY(int id)
|
UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API GetCursorY(int id)
|
||||||
{
|
{
|
||||||
if (!g_manager) return -1;
|
if (!g_manager) return -1;
|
||||||
return g_manager->GetCursorY(id);
|
if (auto monitor = g_manager->GetMonitor(id))
|
||||||
|
{
|
||||||
|
return monitor->GetCursor()->GetY();
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API GetCursorShapeWidth(int id)
|
UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API GetCursorShapeWidth(int id)
|
||||||
{
|
{
|
||||||
if (!g_manager) return -1;
|
if (!g_manager) return -1;
|
||||||
return g_manager->GetCursorShapeWidth(id);
|
if (auto monitor = g_manager->GetMonitor(id))
|
||||||
|
{
|
||||||
|
return monitor->GetCursor()->GetWidth();
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API GetCursorShapeHeight(int id)
|
UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API GetCursorShapeHeight(int id)
|
||||||
{
|
{
|
||||||
if (!g_manager) return -1;
|
if (!g_manager) return -1;
|
||||||
return g_manager->GetCursorShapeHeight(id);
|
if (auto monitor = g_manager->GetMonitor(id))
|
||||||
|
{
|
||||||
|
return monitor->GetCursor()->GetHeight();
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API GetCursorShapePitch(int id)
|
UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API GetCursorShapePitch(int id)
|
||||||
{
|
{
|
||||||
if (!g_manager) return -1;
|
if (!g_manager) return -1;
|
||||||
return g_manager->GetCursorShapePitch(id);
|
if (auto monitor = g_manager->GetMonitor(id))
|
||||||
|
{
|
||||||
|
return monitor->GetCursor()->GetPitch();
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API GetCursorShapeType(int id)
|
UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API GetCursorShapeType(int id)
|
||||||
{
|
{
|
||||||
if (!g_manager) return -1;
|
if (!g_manager) return -1;
|
||||||
return g_manager->GetCursorShapeType(id);
|
if (auto monitor = g_manager->GetMonitor(id))
|
||||||
|
{
|
||||||
|
return monitor->GetCursor()->GetType();
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
UNITY_INTERFACE_EXPORT void UNITY_INTERFACE_API UpdateCursorTexture(int id, ID3D11Texture2D* ptr)
|
UNITY_INTERFACE_EXPORT void UNITY_INTERFACE_API UpdateCursorTexture(int id, ID3D11Texture2D* texture)
|
||||||
{
|
{
|
||||||
if (!g_manager) return;
|
if (!g_manager) return;
|
||||||
g_manager->UpdateCursorTexture(id, ptr);
|
if (auto monitor = g_manager->GetMonitor(id))
|
||||||
|
{
|
||||||
|
monitor->UpdateCursorTexture(texture);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UNITY_INTERFACE_EXPORT void UNITY_INTERFACE_API SetTexturePtr(int id, void* texture)
|
UNITY_INTERFACE_EXPORT void UNITY_INTERFACE_API SetTexturePtr(int id, void* texture)
|
||||||
{
|
{
|
||||||
if (!g_manager) return;
|
if (!g_manager) return;
|
||||||
g_manager->SetTexturePtr(id, texture);
|
if (auto monitor = g_manager->GetMonitor(id))
|
||||||
|
{
|
||||||
|
auto d3d11Texture = reinterpret_cast<ID3D11Texture2D*>(texture);
|
||||||
|
monitor->SetUnityTexture(d3d11Texture);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user