Releases: hecomi/uWindowCapture
Releases · hecomi/uWindowCapture
v0.2.0 Released
Update
- Add
GetPixels()
/GetPixel()
APIs. - Add
GetBuffer()
API
Examples
Scenes
GetPixels
and Buffer
scenes were added as example projects.
GetPixels scene
Buffer scene
GetPixels()
UwcWindowTexture uwcTexture;
public Texture2D texture;
Color32[] colors;
...
colors = new Color32[w * h];
texture = new Texture2D(w, h, TextureFormat.RGBA32, false);
if (uwcTexture.window.GetPixels(colors, x, y, w, h)) {
texture.SetPixels32(colors);
texture.Apply();
}
GetPixel()
UwcWindowTexture uwcTexture;
...
var window = uwcTexture.window;
var x = cursorPos.x - window.x;
var y = cursorPos.y - window.y;
material_.color = window.GetPixel(x, y);
Buffer
UwcWindowTexture uwcTexture;
...
var window = uwcTexture.window;
var width = window.width;
var height = window.height;
texture_ = new Texture2D(width, height, TextureFormat.RGBA32, false);
texture_.filterMode = FilterMode.Bilinear;
pixels_ = texture_.GetPixels32();
handle_ = GCHandle.Alloc(pixels_, GCHandleType.Pinned);
ptr_ = handle_.AddrOfPinnedObject();
GetComponent<Renderer>().material.mainTexture = texture_;
var buffer = window.buffer;
memcpy(ptr_, buffer, width * height * sizeof(Byte) * 4);
texture_.SetPixels32(pixels_);
texture_.Apply();
v0.1.2 Released
Bug Fix
- Check whether the target window is fullscreen or not for the better alt-tab-window detection.
v0.1.1 Released
Changes
Search Timing
With the previous version, we had to search for an another window by partialWindowTitle
manually when the target window is lost. From now, we can customize the update timing from the inspector of UwcWindowTexture
.
- Always
- search for a window by
partialWindowTitle
every frame and use the first window from the list.
- search for a window by
- Manual
- you have to set
shouldUpdateWindow
property manually to search and set a new window.
- you have to set
- Only When Parameter Changed (default)
- search for a window only when one of some parameters like
type
,partialWindowTitle
, andaltTabWindows
is changed.
- search for a window only when one of some parameters like
Update Titles
UwcManager
has a new field, windowTitlesUpdateTiming
, which is able to change the timing to update titles of windows.
- Manual (default and same as the behavior of the previous version, lightest)
- you have to call
UwcManager.UpdateAllWindows()
orUwcManager.UpdateAltTabWindows()
manually when you want to update titles of windows.
- you have to call
- AlwaysAllWindows (heavier than Manual)
- call
UpdateAllWindows()
every frame.
- call
- AlwaysAltTabWindows (heaviest)
- call
UpdateAltTabWindows()
every frame.
- call
v0.1.0 Released
Update
- add
uWindowCapture.RayCastResult UwcWindow.RayCast(Vector3 from, Vector3 dir, float distance, LayerMask layerMask)
UwcRayCastExample.cs
using UnityEngine;
public class UwcRayCastExample : MonoBehaviour
{
[SerializeField]
Transform from;
[SerializeField]
Transform to;
[SerializeField]
LayerMask layerMask;
[SerializeField]
Vector2 windowCoord;
[SerializeField]
Vector2 desktopCoord;
void Update()
{
var from2to = to.position - from.position;
var dir = from2to.normalized;
var distance = from2to.magnitude;
var result = UwcWindowTexture.RayCast(from.position, dir, distance, layerMask);
if (result.hit) {
Debug.DrawLine(from.position, to.position, Color.red);
Debug.DrawRay(result.position, result.normal, Color.green);
windowCoord = result.windowCoord;
desktopCoord = result.desktopCoord;
} else {
Debug.DrawLine(from.position, to.position, Color.yellow);
windowCoord = new Vector2(-1, -1);
desktopCoord = new Vector2(-1, -1);
}
}
}
uWindowCapture v0.0.2 Released
Bug Fix
- Fix the
Capture Mode
bug that ignored it and set it as default after playing the game. - Fix the cursor position bug when using the
BitBlt
capture mode.
uWindowCapture Released!
v0.0.1 fix title bug.