1
0
mirror of https://github.com/xiaopeng12138/MaiDXR.git synced 2024-12-18 20:05:52 +01:00
MaiDXR/Assets/uWindowCapture/Samples/GetPixels/UwcGetPixelExample.cs
2022-01-05 19:44:30 +01:00

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);
}
}
}
}