Resolve WES-75 "Hangman integration"
This commit is contained in:
committed by
Dries Van Schuylenbergh
parent
f9298a055a
commit
f835adaa23
@@ -45,6 +45,12 @@ namespace Mediapipe.Unity.Tutorial
|
||||
[SerializeField]
|
||||
private RawImage screen;
|
||||
|
||||
/// <summary>
|
||||
/// A secondary optional screen object on which the video is displayed
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
private RawImage screen2;
|
||||
|
||||
/// <summary>
|
||||
/// MediaPipe graph
|
||||
/// </summary>
|
||||
@@ -161,6 +167,10 @@ namespace Mediapipe.Unity.Tutorial
|
||||
float webcamAspect = (float)webcamTexture.width / (float)webcamTexture.height;
|
||||
screen.rectTransform.sizeDelta = new Vector2(screen.rectTransform.sizeDelta.y * webcamAspect, (screen.rectTransform.sizeDelta.y));
|
||||
screen.texture = webcamTexture;
|
||||
if(screen2 != null)
|
||||
{
|
||||
screen2.rectTransform.sizeDelta = new Vector2(screen2.rectTransform.sizeDelta.y * webcamAspect, (screen2.rectTransform.sizeDelta.y));
|
||||
}
|
||||
|
||||
// TODO this method is kinda meh you should use
|
||||
inputTexture = new Texture2D(width, height, TextureFormat.RGBA32, false);
|
||||
@@ -368,5 +378,21 @@ namespace Mediapipe.Unity.Tutorial
|
||||
webcamTexture.Play();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Swaps the display screens
|
||||
/// </summary>
|
||||
public void SwapScreen()
|
||||
{
|
||||
if(screen2.texture == null && screen.texture != null)
|
||||
{
|
||||
screen2.texture = webcamTexture;
|
||||
screen.texture = null;
|
||||
}
|
||||
else if (screen2.texture != null && screen.texture == null)
|
||||
{
|
||||
screen.texture = webcamTexture;
|
||||
screen2.texture = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user