move cursor owner from monitor to manager.
This commit is contained in:
Binary file not shown.
@@ -139,17 +139,17 @@ public static class Lib
|
|||||||
[DllImport("uDesktopDuplication")]
|
[DllImport("uDesktopDuplication")]
|
||||||
public static extern bool IsCursorVisible(int id);
|
public static extern bool IsCursorVisible(int id);
|
||||||
[DllImport("uDesktopDuplication")]
|
[DllImport("uDesktopDuplication")]
|
||||||
public static extern int GetCursorX(int id);
|
public static extern int GetCursorX();
|
||||||
[DllImport("uDesktopDuplication")]
|
[DllImport("uDesktopDuplication")]
|
||||||
public static extern int GetCursorY(int id);
|
public static extern int GetCursorY();
|
||||||
[DllImport("uDesktopDuplication")]
|
[DllImport("uDesktopDuplication")]
|
||||||
public static extern int GetCursorShapeWidth(int id);
|
public static extern int GetCursorShapeWidth();
|
||||||
[DllImport("uDesktopDuplication")]
|
[DllImport("uDesktopDuplication")]
|
||||||
public static extern int GetCursorShapeHeight(int id);
|
public static extern int GetCursorShapeHeight();
|
||||||
[DllImport("uDesktopDuplication")]
|
[DllImport("uDesktopDuplication")]
|
||||||
public static extern int GetCursorShapePitch(int id);
|
public static extern int GetCursorShapePitch();
|
||||||
[DllImport("uDesktopDuplication")]
|
[DllImport("uDesktopDuplication")]
|
||||||
public static extern CursorShapeType GetCursorShapeType(int id);
|
public static extern CursorShapeType GetCursorShapeType();
|
||||||
[DllImport("uDesktopDuplication")]
|
[DllImport("uDesktopDuplication")]
|
||||||
public static extern void GetCursorTexture(int id, System.IntPtr ptr);
|
public static extern void GetCursorTexture(int id, System.IntPtr ptr);
|
||||||
[DllImport("uDesktopDuplication")]
|
[DllImport("uDesktopDuplication")]
|
||||||
|
|||||||
@@ -171,12 +171,12 @@ public class Monitor
|
|||||||
|
|
||||||
public int cursorX
|
public int cursorX
|
||||||
{
|
{
|
||||||
get { return Lib.GetCursorX(id); }
|
get { return Lib.GetCursorMonitorId() == id ? Lib.GetCursorX() : -1; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public int cursorY
|
public int cursorY
|
||||||
{
|
{
|
||||||
get { return Lib.GetCursorY(id); }
|
get { return Lib.GetCursorMonitorId() == id ? Lib.GetCursorY() : -1; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public int systemCursorX
|
public int systemCursorX
|
||||||
@@ -199,17 +199,17 @@ public class Monitor
|
|||||||
|
|
||||||
public int cursorShapeWidth
|
public int cursorShapeWidth
|
||||||
{
|
{
|
||||||
get { return Lib.GetCursorShapeWidth(id); }
|
get { return Lib.GetCursorShapeWidth(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public int cursorShapeHeight
|
public int cursorShapeHeight
|
||||||
{
|
{
|
||||||
get { return Lib.GetCursorShapeHeight(id); }
|
get { return Lib.GetCursorShapeHeight(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public CursorShapeType cursorShapeType
|
public CursorShapeType cursorShapeType
|
||||||
{
|
{
|
||||||
get { return Lib.GetCursorShapeType(id); }
|
get { return Lib.GetCursorShapeType(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public int moveRectCount
|
public int moveRectCount
|
||||||
|
|||||||
@@ -8,8 +8,7 @@
|
|||||||
using namespace Microsoft::WRL;
|
using namespace Microsoft::WRL;
|
||||||
|
|
||||||
|
|
||||||
Cursor::Cursor(Monitor* monitor)
|
Cursor::Cursor()
|
||||||
: monitor_(monitor)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -19,7 +18,7 @@ Cursor::~Cursor()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Cursor::UpdateBuffer(const DXGI_OUTDUPL_FRAME_INFO& frameInfo)
|
void Cursor::UpdateBuffer(Monitor* monitor, const DXGI_OUTDUPL_FRAME_INFO& frameInfo)
|
||||||
{
|
{
|
||||||
if (frameInfo.LastMouseUpdateTime.QuadPart == 0)
|
if (frameInfo.LastMouseUpdateTime.QuadPart == 0)
|
||||||
{
|
{
|
||||||
@@ -29,18 +28,13 @@ void Cursor::UpdateBuffer(const DXGI_OUTDUPL_FRAME_INFO& frameInfo)
|
|||||||
isVisible_ = frameInfo.PointerPosition.Visible != 0;
|
isVisible_ = frameInfo.PointerPosition.Visible != 0;
|
||||||
if (isVisible_)
|
if (isVisible_)
|
||||||
{
|
{
|
||||||
GetMonitorManager()->SetCursorMonitorId(monitor_->GetId());
|
GetMonitorManager()->SetCursorMonitorId(monitor->GetId());
|
||||||
}
|
}
|
||||||
|
|
||||||
x_ = frameInfo.PointerPosition.Position.x;
|
x_ = frameInfo.PointerPosition.Position.x;
|
||||||
y_ = frameInfo.PointerPosition.Position.y;
|
y_ = frameInfo.PointerPosition.Position.y;
|
||||||
timestamp_ = frameInfo.LastMouseUpdateTime;
|
timestamp_ = frameInfo.LastMouseUpdateTime;
|
||||||
|
|
||||||
if (!IsCursorOnParentMonitor())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (frameInfo.PointerShapeBufferSize == 0)
|
if (frameInfo.PointerShapeBufferSize == 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@@ -55,7 +49,7 @@ void Cursor::UpdateBuffer(const DXGI_OUTDUPL_FRAME_INFO& frameInfo)
|
|||||||
// Get mouse pointer information
|
// Get mouse pointer information
|
||||||
UINT bufferSize;
|
UINT bufferSize;
|
||||||
DXGI_OUTDUPL_POINTER_SHAPE_INFO shapeInfo;
|
DXGI_OUTDUPL_POINTER_SHAPE_INFO shapeInfo;
|
||||||
const auto hr = monitor_->GetDeskDupl()->GetFramePointerShape(
|
const auto hr = monitor->GetDeskDupl()->GetFramePointerShape(
|
||||||
apiBuffer_.Size(),
|
apiBuffer_.Size(),
|
||||||
apiBuffer_.Get(),
|
apiBuffer_.Get(),
|
||||||
&bufferSize,
|
&bufferSize,
|
||||||
@@ -72,15 +66,10 @@ void Cursor::UpdateBuffer(const DXGI_OUTDUPL_FRAME_INFO& frameInfo)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Cursor::UpdateTexture()
|
void Cursor::Draw(Monitor* monitor)
|
||||||
{
|
{
|
||||||
if (!IsCursorOnParentMonitor())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check desktop texure
|
// Check desktop texure
|
||||||
if (monitor_->GetUnityTexture() == nullptr)
|
if (monitor->GetUnityTexture() == nullptr)
|
||||||
{
|
{
|
||||||
Debug::Error("Cursor::UpdateTexture() => Monitor::GetUnityTexture() is null.");
|
Debug::Error("Cursor::UpdateTexture() => Monitor::GetUnityTexture() is null.");
|
||||||
return;
|
return;
|
||||||
@@ -107,15 +96,15 @@ void Cursor::UpdateTexture()
|
|||||||
|
|
||||||
// Calculate information to capture desktop image under cursor.
|
// Calculate information to capture desktop image under cursor.
|
||||||
D3D11_BOX box;
|
D3D11_BOX box;
|
||||||
const auto monitorRot = static_cast<DXGI_MODE_ROTATION>(monitor_->GetRotation());
|
const auto monitorRot = static_cast<DXGI_MODE_ROTATION>(monitor->GetRotation());
|
||||||
auto colMin = 0;
|
auto colMin = 0;
|
||||||
auto colMax = cursorImageWidth;
|
auto colMax = cursorImageWidth;
|
||||||
auto rowMin = 0;
|
auto rowMin = 0;
|
||||||
auto rowMax = cursorImageHeight;
|
auto rowMax = cursorImageHeight;
|
||||||
|
|
||||||
{
|
{
|
||||||
const auto monitorWidth = monitor_->GetWidth();
|
const auto monitorWidth = monitor->GetWidth();
|
||||||
const auto monitorHeight = monitor_->GetHeight();
|
const auto monitorHeight = monitor->GetHeight();
|
||||||
const auto isVertical =
|
const auto isVertical =
|
||||||
monitorRot == DXGI_MODE_ROTATION_ROTATE90 ||
|
monitorRot == DXGI_MODE_ROTATION_ROTATE90 ||
|
||||||
monitorRot == DXGI_MODE_ROTATION_ROTATE270;
|
monitorRot == DXGI_MODE_ROTATION_ROTATE270;
|
||||||
@@ -230,7 +219,7 @@ void Cursor::UpdateTexture()
|
|||||||
{
|
{
|
||||||
ComPtr<ID3D11DeviceContext> context;
|
ComPtr<ID3D11DeviceContext> context;
|
||||||
GetDevice()->GetImmediateContext(&context);
|
GetDevice()->GetImmediateContext(&context);
|
||||||
context->CopySubresourceRegion(texture.Get(), 0, 0, 0, 0, monitor_->GetUnityTexture(), 0, &box);
|
context->CopySubresourceRegion(texture.Get(), 0, 0, 0, 0, monitor->GetUnityTexture(), 0, &box);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get mapped surface
|
// Get mapped surface
|
||||||
@@ -265,6 +254,7 @@ void Cursor::UpdateTexture()
|
|||||||
return desktop32[col * desktopPitch + (capturedImageHeight - 1 - row)];
|
return desktop32[col * desktopPitch + (capturedImageHeight - 1 - row)];
|
||||||
case DXGI_MODE_ROTATION_IDENTITY:
|
case DXGI_MODE_ROTATION_IDENTITY:
|
||||||
case DXGI_MODE_ROTATION_UNSPECIFIED:
|
case DXGI_MODE_ROTATION_UNSPECIFIED:
|
||||||
|
default:
|
||||||
return desktop32[row * desktopPitch + col];
|
return desktop32[row * desktopPitch + col];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -389,7 +379,7 @@ void Cursor::UpdateTexture()
|
|||||||
{
|
{
|
||||||
ComPtr<ID3D11DeviceContext> context;
|
ComPtr<ID3D11DeviceContext> context;
|
||||||
GetDevice()->GetImmediateContext(&context);
|
GetDevice()->GetImmediateContext(&context);
|
||||||
context->UpdateSubresource(monitor_->GetUnityTexture(), 0, &box, bgraBuffer_.Get(), GetWidth() * 4, 0);
|
context->UpdateSubresource(monitor->GetUnityTexture(), 0, &box, bgraBuffer_.Get(), GetWidth() * 4, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FAILED(surface->Unmap()))
|
if (FAILED(surface->Unmap()))
|
||||||
@@ -475,9 +465,3 @@ int Cursor::GetType() const
|
|||||||
{
|
{
|
||||||
return shapeInfo_.Type;
|
return shapeInfo_.Type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Cursor::IsCursorOnParentMonitor() const
|
|
||||||
{
|
|
||||||
return GetMonitorManager()->GetCursorMonitorId() == monitor_->GetId();
|
|
||||||
}
|
|
||||||
@@ -10,10 +10,10 @@ class Monitor;
|
|||||||
class Cursor
|
class Cursor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit Cursor(Monitor* monitor);
|
explicit Cursor();
|
||||||
~Cursor();
|
~Cursor();
|
||||||
void UpdateBuffer(const DXGI_OUTDUPL_FRAME_INFO& frameInfo);
|
void UpdateBuffer(Monitor* monitor, const DXGI_OUTDUPL_FRAME_INFO& frameInfo);
|
||||||
void UpdateTexture();
|
void Draw(Monitor* monitor);
|
||||||
void GetTexture(ID3D11Texture2D* texture);
|
void GetTexture(ID3D11Texture2D* texture);
|
||||||
|
|
||||||
bool IsVisible() const;
|
bool IsVisible() const;
|
||||||
@@ -25,9 +25,6 @@ public:
|
|||||||
int GetType() const;
|
int GetType() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool IsCursorOnParentMonitor() const;
|
|
||||||
|
|
||||||
Monitor* monitor_;
|
|
||||||
bool isVisible_ = false;
|
bool isVisible_ = false;
|
||||||
int x_ = -1;
|
int x_ = -1;
|
||||||
int y_ = -1;
|
int y_ = -1;
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ using namespace Microsoft::WRL;
|
|||||||
|
|
||||||
Monitor::Monitor(int id)
|
Monitor::Monitor(int id)
|
||||||
: id_(id)
|
: id_(id)
|
||||||
, cursor_(std::make_unique<Cursor>(this))
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,7 +196,16 @@ void Monitor::Render(UINT timeout)
|
|||||||
}
|
}
|
||||||
|
|
||||||
UpdateMetadata(frameInfo);
|
UpdateMetadata(frameInfo);
|
||||||
UpdateCursor(frameInfo);
|
|
||||||
|
if (frameInfo.PointerPosition.Visible)
|
||||||
|
{
|
||||||
|
GetMonitorManager()->SetCursorMonitorId(id_);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GetMonitorManager()->GetCursorMonitorId() == id_)
|
||||||
|
{
|
||||||
|
UpdateCursor(frameInfo);
|
||||||
|
}
|
||||||
|
|
||||||
hr = deskDupl_->ReleaseFrame();
|
hr = deskDupl_->ReleaseFrame();
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
@@ -229,8 +237,9 @@ void Monitor::Render(UINT timeout)
|
|||||||
|
|
||||||
void Monitor::UpdateCursor(const DXGI_OUTDUPL_FRAME_INFO& frameInfo)
|
void Monitor::UpdateCursor(const DXGI_OUTDUPL_FRAME_INFO& frameInfo)
|
||||||
{
|
{
|
||||||
cursor_->UpdateBuffer(frameInfo);
|
auto cursor_ = GetMonitorManager()->GetCursor();
|
||||||
cursor_->UpdateTexture();
|
cursor_->UpdateBuffer(this, frameInfo);
|
||||||
|
cursor_->Draw(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -360,18 +369,6 @@ IDXGIOutputDuplication* Monitor::GetDeskDupl()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const std::unique_ptr<Cursor>& Monitor::GetCursor()
|
|
||||||
{
|
|
||||||
return cursor_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Monitor::GetCursorTexture(ID3D11Texture2D* texture)
|
|
||||||
{
|
|
||||||
cursor_->GetTexture(texture);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Monitor::GetName(char* buf, int len) const
|
void Monitor::GetName(char* buf, int len) const
|
||||||
{
|
{
|
||||||
strcpy_s(buf, len, monitorInfo_.szDevice);
|
strcpy_s(buf, len, monitorInfo_.szDevice);
|
||||||
|
|||||||
@@ -6,8 +6,6 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
|
|
||||||
class Cursor;
|
|
||||||
|
|
||||||
enum class MonitorState
|
enum class MonitorState
|
||||||
{
|
{
|
||||||
NotSet = -1,
|
NotSet = -1,
|
||||||
@@ -31,7 +29,6 @@ public:
|
|||||||
~Monitor();
|
~Monitor();
|
||||||
void Initialize(IDXGIOutput* output);
|
void Initialize(IDXGIOutput* output);
|
||||||
void Render(UINT timeout = 0);
|
void Render(UINT timeout = 0);
|
||||||
void GetCursorTexture(ID3D11Texture2D* texture);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int GetId() const;
|
int GetId() const;
|
||||||
@@ -50,7 +47,6 @@ public:
|
|||||||
int GetDpiX() const;
|
int GetDpiX() const;
|
||||||
int GetDpiY() const;
|
int GetDpiY() const;
|
||||||
IDXGIOutputDuplication* GetDeskDupl();
|
IDXGIOutputDuplication* GetDeskDupl();
|
||||||
const std::unique_ptr<Cursor>& GetCursor();
|
|
||||||
int GetMoveRectCount() const;
|
int GetMoveRectCount() const;
|
||||||
DXGI_OUTDUPL_MOVE_RECT* GetMoveRects() const;
|
DXGI_OUTDUPL_MOVE_RECT* GetMoveRects() const;
|
||||||
int GetDirtyRectCount() const;
|
int GetDirtyRectCount() const;
|
||||||
@@ -66,7 +62,6 @@ private:
|
|||||||
UINT dpiX_ = -1, dpiY_ = -1;
|
UINT dpiX_ = -1, dpiY_ = -1;
|
||||||
int width_ = -1, height_ = -1;
|
int width_ = -1, height_ = -1;
|
||||||
State state_ = State::NotSet;
|
State state_ = State::NotSet;
|
||||||
std::unique_ptr<Cursor> cursor_;
|
|
||||||
IDXGIOutputDuplication* deskDupl_ = nullptr;
|
IDXGIOutputDuplication* deskDupl_ = nullptr;
|
||||||
ID3D11Texture2D* unityTexture_ = nullptr;
|
ID3D11Texture2D* unityTexture_ = nullptr;
|
||||||
DXGI_OUTPUT_DESC outputDesc_;
|
DXGI_OUTPUT_DESC outputDesc_;
|
||||||
|
|||||||
@@ -112,6 +112,12 @@ std::shared_ptr<Monitor> MonitorManager::GetMonitor(int id) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::shared_ptr<Cursor> MonitorManager::GetCursor() const
|
||||||
|
{
|
||||||
|
return cursor_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void MonitorManager::Update()
|
void MonitorManager::Update()
|
||||||
{
|
{
|
||||||
if (isReinitializationRequired_)
|
if (isReinitializationRequired_)
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ public:
|
|||||||
void SetCursorMonitorId(int id) { cursorMonitorId_ = id; }
|
void SetCursorMonitorId(int id) { cursorMonitorId_ = id; }
|
||||||
int GetCursorMonitorId() const { return cursorMonitorId_; }
|
int GetCursorMonitorId() const { return cursorMonitorId_; }
|
||||||
std::shared_ptr<Monitor> GetMonitor(int id) const;
|
std::shared_ptr<Monitor> GetMonitor(int id) const;
|
||||||
|
std::shared_ptr<Cursor> GetCursor() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Initialize();
|
void Initialize();
|
||||||
@@ -41,7 +42,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
int timeout_ = 10;
|
int timeout_ = 10;
|
||||||
std::vector<std::shared_ptr<Monitor>> monitors_;
|
std::vector<std::shared_ptr<Monitor>> monitors_;
|
||||||
std::shared_ptr<Cursor> cursor_;
|
std::shared_ptr<Cursor> cursor_ = std::make_shared<Cursor>();
|
||||||
int cursorMonitorId_ = -1;
|
int cursorMonitorId_ = -1;
|
||||||
bool isReinitializationRequired_ = false;
|
bool isReinitializationRequired_ = false;
|
||||||
};
|
};
|
||||||
@@ -295,83 +295,52 @@ extern "C"
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
UNITY_INTERFACE_EXPORT bool UNITY_INTERFACE_API IsCursorVisible(int id)
|
UNITY_INTERFACE_EXPORT bool UNITY_INTERFACE_API IsCursorVisible()
|
||||||
{
|
{
|
||||||
if (!g_manager) return false;
|
if (!g_manager) return false;
|
||||||
if (auto monitor = g_manager->GetMonitor(id))
|
return g_manager->GetCursor()->IsVisible();
|
||||||
{
|
|
||||||
return monitor->GetCursor()->IsVisible();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API GetCursorX(int id)
|
UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API GetCursorX()
|
||||||
{
|
{
|
||||||
if (!g_manager) return -1;
|
if (!g_manager) return -1;
|
||||||
if (auto monitor = g_manager->GetMonitor(id))
|
return g_manager->GetCursor()->GetX();
|
||||||
{
|
|
||||||
return monitor->GetCursor()->GetX();
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API GetCursorY(int id)
|
UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API GetCursorY()
|
||||||
{
|
{
|
||||||
if (!g_manager) return -1;
|
if (!g_manager) return -1;
|
||||||
if (auto monitor = g_manager->GetMonitor(id))
|
return g_manager->GetCursor()->GetY();
|
||||||
{
|
|
||||||
return monitor->GetCursor()->GetY();
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API GetCursorShapeWidth(int id)
|
UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API GetCursorShapeWidth()
|
||||||
{
|
{
|
||||||
if (!g_manager) return -1;
|
if (!g_manager) return -1;
|
||||||
if (auto monitor = g_manager->GetMonitor(id))
|
return g_manager->GetCursor()->GetWidth();
|
||||||
{
|
|
||||||
return monitor->GetCursor()->GetWidth();
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API GetCursorShapeHeight(int id)
|
UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API GetCursorShapeHeight()
|
||||||
{
|
{
|
||||||
if (!g_manager) return -1;
|
if (!g_manager) return -1;
|
||||||
if (auto monitor = g_manager->GetMonitor(id))
|
return g_manager->GetCursor()->GetHeight();
|
||||||
{
|
|
||||||
return monitor->GetCursor()->GetHeight();
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API GetCursorShapePitch(int id)
|
UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API GetCursorShapePitch()
|
||||||
{
|
{
|
||||||
if (!g_manager) return -1;
|
if (!g_manager) return -1;
|
||||||
if (auto monitor = g_manager->GetMonitor(id))
|
return g_manager->GetCursor()->GetPitch();
|
||||||
{
|
|
||||||
return monitor->GetCursor()->GetPitch();
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API GetCursorShapeType(int id)
|
UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API GetCursorShapeType()
|
||||||
{
|
{
|
||||||
if (!g_manager) return -1;
|
if (!g_manager) return -1;
|
||||||
if (auto monitor = g_manager->GetMonitor(id))
|
return g_manager->GetCursor()->GetType();
|
||||||
{
|
|
||||||
return monitor->GetCursor()->GetType();
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UNITY_INTERFACE_EXPORT void UNITY_INTERFACE_API GetCursorTexture(int id, ID3D11Texture2D* texture)
|
UNITY_INTERFACE_EXPORT void UNITY_INTERFACE_API GetCursorTexture(ID3D11Texture2D* texture)
|
||||||
{
|
{
|
||||||
if (!g_manager) return;
|
if (!g_manager) return;
|
||||||
if (auto monitor = g_manager->GetMonitor(id))
|
return g_manager->GetCursor()->GetTexture(texture);
|
||||||
{
|
|
||||||
monitor->GetCursorTexture(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)
|
||||||
@@ -391,6 +360,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
return monitor->GetMoveRectCount();
|
return monitor->GetMoveRectCount();
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
UNITY_INTERFACE_EXPORT void* UNITY_INTERFACE_API GetMoveRects(int id)
|
UNITY_INTERFACE_EXPORT void* UNITY_INTERFACE_API GetMoveRects(int id)
|
||||||
@@ -400,6 +370,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
return monitor->GetMoveRects();
|
return monitor->GetMoveRects();
|
||||||
}
|
}
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API GetDirtyRectCount(int id)
|
UNITY_INTERFACE_EXPORT int UNITY_INTERFACE_API GetDirtyRectCount(int id)
|
||||||
@@ -409,6 +380,7 @@ extern "C"
|
|||||||
{
|
{
|
||||||
return monitor->GetDirtyRectCount();
|
return monitor->GetDirtyRectCount();
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
UNITY_INTERFACE_EXPORT void* UNITY_INTERFACE_API GetDirtyRects(int id)
|
UNITY_INTERFACE_EXPORT void* UNITY_INTERFACE_API GetDirtyRects(int id)
|
||||||
@@ -418,5 +390,6 @@ extern "C"
|
|||||||
{
|
{
|
||||||
return monitor->GetDirtyRects();
|
return monitor->GetDirtyRects();
|
||||||
}
|
}
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user