mirror of
https://github.com/xiaopeng12138/MaiDXR.git
synced 2024-12-18 20:05:52 +01:00
31 lines
626 B
C#
31 lines
626 B
C#
using UnityEngine;
|
|
|
|
namespace uWindowCapture
|
|
{
|
|
|
|
public class UwcGetPixelExample : MonoBehaviour
|
|
{
|
|
[SerializeField] UwcWindowTexture uwcTexture;
|
|
|
|
Material material_;
|
|
|
|
void Start()
|
|
{
|
|
material_ = GetComponent<Renderer>().material;
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
var window = uwcTexture.window;
|
|
if (window == null) return;
|
|
|
|
if (UwcManager.cursorWindow == window) {
|
|
var cursorPos = Lib.GetCursorPosition();
|
|
var x = cursorPos.x - window.x;
|
|
var y = cursorPos.y - window.y;
|
|
material_.color = window.GetPixel(x, y);
|
|
}
|
|
}
|
|
}
|
|
|
|
} |