Overlay with black lines for authentic ra feel
This commit is contained in:
@@ -18,11 +18,14 @@ namespace OpenRA.Widgets
|
|||||||
{
|
{
|
||||||
public class VqaPlayerWidget : Widget
|
public class VqaPlayerWidget : Widget
|
||||||
{
|
{
|
||||||
Sprite videoSprite;
|
Sprite videoSprite, overlaySprite;
|
||||||
VqaReader video = null;
|
VqaReader video = null;
|
||||||
string cachedVideo;
|
string cachedVideo;
|
||||||
float invLength;
|
float invLength;
|
||||||
float2 videoOrigin, videoSize;
|
float2 videoOrigin, videoSize;
|
||||||
|
int[,] overlay;
|
||||||
|
public bool DrawOverlay = true;
|
||||||
|
|
||||||
public void Load(string filename)
|
public void Load(string filename)
|
||||||
{
|
{
|
||||||
if (filename == cachedVideo)
|
if (filename == cachedVideo)
|
||||||
@@ -46,6 +49,18 @@ namespace OpenRA.Widgets
|
|||||||
var scale = Math.Min(RenderBounds.Width / video.Width, RenderBounds.Height / video.Height);
|
var scale = Math.Min(RenderBounds.Width / video.Width, RenderBounds.Height / video.Height);
|
||||||
videoOrigin = new float2(RenderBounds.X + (RenderBounds.Width - scale*video.Width)/2, RenderBounds.Y + (RenderBounds.Height - scale*video.Height)/2);
|
videoOrigin = new float2(RenderBounds.X + (RenderBounds.Width - scale*video.Width)/2, RenderBounds.Y + (RenderBounds.Height - scale*video.Height)/2);
|
||||||
videoSize = new float2(video.Width * scale, video.Height * scale);
|
videoSize = new float2(video.Width * scale, video.Height * scale);
|
||||||
|
|
||||||
|
if (!DrawOverlay)
|
||||||
|
return;
|
||||||
|
|
||||||
|
overlay = new int[2*textureSize, 2*textureSize];
|
||||||
|
var black = Color.Black.ToArgb();
|
||||||
|
for (var y = 0; y < video.Height; y++)
|
||||||
|
for (var x = 0; x < video.Width; x++)
|
||||||
|
overlay[2*y,x] = black;
|
||||||
|
|
||||||
|
overlaySprite = new Sprite(new Sheet(new Size(2*textureSize,2*textureSize)), new Rectangle( 0, 0, video.Width, 2*video.Height ), TextureChannel.Alpha);
|
||||||
|
overlaySprite.sheet.Texture.SetData(overlay);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool playing = false;
|
bool playing = false;
|
||||||
@@ -72,6 +87,9 @@ namespace OpenRA.Widgets
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Game.Renderer.RgbaSpriteRenderer.DrawSprite(videoSprite, videoOrigin, "chrome", videoSize);
|
Game.Renderer.RgbaSpriteRenderer.DrawSprite(videoSprite, videoOrigin, "chrome", videoSize);
|
||||||
|
|
||||||
|
if (DrawOverlay)
|
||||||
|
Game.Renderer.RgbaSpriteRenderer.DrawSprite(overlaySprite, videoOrigin, "chrome", videoSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Play()
|
public void Play()
|
||||||
|
|||||||
Reference in New Issue
Block a user